AITPumpData.cs 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Linq;
  5. using System.Reflection;
  6. using System.Runtime.Serialization;
  7. using System.Text;
  8. using System.Windows.Input;
  9. using Aitex.Core.UI.MVVM;
  10. namespace Aitex.Core.Common.DeviceData
  11. {
  12. [DataContract]
  13. [Serializable]
  14. public class AITPumpData : INotifyPropertyChanged, IDeviceData
  15. {
  16. public event PropertyChangedEventHandler PropertyChanged;
  17. public void InvokePropertyChanged(string propertyName)
  18. {
  19. if (PropertyChanged != null)
  20. {
  21. PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
  22. }
  23. }
  24. public void InvokePropertyChanged()
  25. {
  26. PropertyInfo[] ps = this.GetType().GetProperties();
  27. foreach (PropertyInfo p in ps)
  28. {
  29. InvokePropertyChanged(p.Name);
  30. if (p.PropertyType == typeof(ICommand))
  31. {
  32. DelegateCommand<string> cmd = p.GetValue(this, null) as DelegateCommand<string>;
  33. if (cmd != null)
  34. cmd.RaiseCanExecuteChanged();
  35. }
  36. }
  37. FieldInfo[] fi = this.GetType().GetFields();
  38. foreach (FieldInfo p in fi)
  39. {
  40. InvokePropertyChanged(p.Name);
  41. if (p.FieldType == typeof(ICommand))
  42. {
  43. DelegateCommand<string> cmd = p.GetValue(this) as DelegateCommand<string>;
  44. if (cmd != null)
  45. cmd.RaiseCanExecuteChanged();
  46. }
  47. }
  48. }
  49. /// <summary>
  50. /// 阀的唯一名称,UI与RT交互的ID
  51. /// </summary>
  52. [DataMember]
  53. public string DeviceName { get; set; }
  54. /// <summary>
  55. /// 显示在界面上的名称
  56. /// </summary>
  57. [DataMember]
  58. public string DisplayName { get; set; }
  59. /// <summary>
  60. /// IO 表中定义的物理编号,物理追溯使用 比如: V122
  61. /// </summary>
  62. [DataMember]
  63. public string DeviceSchematicId { get; set; }
  64. /// <summary>
  65. /// 当前设定值
  66. /// </summary>
  67. [DataMember]
  68. public bool IsOn { get; set; }
  69. /// <summary>
  70. /// 默认值
  71. /// </summary>
  72. [DataMember]
  73. public bool IsWarning { get; set; }
  74. /// <summary>
  75. /// 实际反馈值
  76. /// </summary>
  77. [DataMember]
  78. public bool IsError { get; set; }
  79. [DataMember]
  80. public int LocalRemoteMode { get; set; }
  81. [DataMember]
  82. public double WaterFlow { get; set; }
  83. [DataMember]
  84. public bool IsDryPumpEnable { get; set; }
  85. [DataMember]
  86. public bool IsN2PressureEnable { get; set; }
  87. [DataMember]
  88. public bool N2PressureWarning { get; set; }
  89. [DataMember]
  90. public bool N2PressureAlarm { get; set; }
  91. [DataMember]
  92. public bool IsWaterFlowEnable { get; set; }
  93. [DataMember]
  94. public bool WaterFlowWarning { get; set; }
  95. [DataMember]
  96. public bool WaterFlowAlarm { get; set; }
  97. public AITPumpData()
  98. {
  99. DisplayName = "未定义";
  100. }
  101. public void Update(IDeviceData data)
  102. {
  103. AITPumpData item = data as AITPumpData;
  104. if (item == null)
  105. return;
  106. InvokePropertyChanged();
  107. }
  108. }
  109. public enum AITPumpOperation
  110. {
  111. SetOnOff,
  112. WaterFlowAlarm,
  113. }
  114. public class AITPumpProperty
  115. {
  116. public const string EnableWaterFlow = "EnableWaterFlow";
  117. public const string WaterFlowValue = "WaterFlowValue";
  118. public const string WaterFlowMinValue = "WaterFlowMinValue";
  119. public const string WaterFlowMaxValue = "WaterFlowMaxValue";
  120. public const string WaterFlowAlarm = "WaterFlowAlarm";
  121. public const string WaterFlowAlarmSetPoint = "WaterFlowAlarmSetPoint";
  122. public const string WaterFlowWarning = "WaterFlowWarning";
  123. public const string WaterFlowAlarmTime = "WaterFlowAlarmTime";
  124. public const string WaterFlowWarningTime = "WaterFlowWarningTime";
  125. public const string EnableN2Pressure = "EnableN2Pressure";
  126. public const string N2PressureValue = "N2PressureValue";
  127. public const string N2PressureMinValue = "N2PressureMinValue";
  128. public const string N2PressureMaxValue = "N2PressureMaxValue";
  129. public const string N2PressureAlarm = "N2PressureAlarm";
  130. public const string N2PressureAlarmSetPoint = "N2PressureAlarmSetPoint";
  131. public const string N2PressureWarning = "N2PressureWarning";
  132. public const string N2PressureAlarmTime = "N2PressureAlarmTime";
  133. public const string N2PressureWarningTime = "N2PressureWarningTime";
  134. public const string EnableDryPump = "EnableDryPump";
  135. public const string PumpBreakerStatus = "PumpBreakerStatus";
  136. public const string IsOverTemp = "IsOverTemp";
  137. public const string IsRunning = "IsRunning";
  138. public const string IsStart = "IsStart";
  139. public const string IsStop = "IsStop";
  140. }
  141. }