AITVaporLineData.cs 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  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;
  9. using System.Windows.Input;
  10. using Aitex.Core.UI.MVVM;
  11. namespace Aitex.Core.Common.DeviceData
  12. {
  13. [DataContract]
  14. [Serializable]
  15. public class AITVaporLineData : INotifyPropertyChanged, IDeviceData
  16. {
  17. public event PropertyChangedEventHandler PropertyChanged;
  18. public void InvokePropertyChanged(string propertyName)
  19. {
  20. if (PropertyChanged != null)
  21. {
  22. PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
  23. }
  24. }
  25. public void InvokePropertyChanged()
  26. {
  27. PropertyInfo[] ps = this.GetType().GetProperties();
  28. foreach (PropertyInfo p in ps)
  29. {
  30. InvokePropertyChanged(p.Name);
  31. if (p.PropertyType == typeof (ICommand))
  32. {
  33. DelegateCommand<string> cmd = p.GetValue(this, null) as DelegateCommand<string>;
  34. if (cmd != null)
  35. cmd.RaiseCanExecuteChanged();
  36. }
  37. }
  38. FieldInfo[] fi = this.GetType().GetFields();
  39. foreach (FieldInfo p in fi)
  40. {
  41. InvokePropertyChanged(p.Name);
  42. if (p.FieldType == typeof (ICommand))
  43. {
  44. DelegateCommand<string> cmd = p.GetValue(this) as DelegateCommand<string>;
  45. if (cmd != null)
  46. cmd.RaiseCanExecuteChanged();
  47. }
  48. }
  49. }
  50. /// <summary>
  51. /// 设备的唯一名称,UI与RT交互的ID
  52. /// </summary>
  53. [DataMember]
  54. public string DeviceName { get; set; }
  55. /// <summary>
  56. /// 显示在界面上的名称
  57. /// </summary>
  58. [DataMember]
  59. public string DisplayName { get; set; }
  60. /// <summary>
  61. /// IO 表中定义的物理编号,物理追溯使用 比如: M122
  62. /// </summary>
  63. [DataMember]
  64. public string DeviceSchematicId { get; set; }
  65. [DataMember]
  66. public string Unit { get; set; }
  67. [DataMember]
  68. public string Description { get; set; }
  69. /// <summary>
  70. /// 量程
  71. /// </summary>
  72. [DataMember]
  73. public double Scale { get; set; }
  74. /// <summary>
  75. /// 设定值
  76. /// </summary>
  77. [DataMember]
  78. public double SetPoint { get; set; }
  79. [DataMember]
  80. public double FeedBack { get; set; }
  81. /// <summary>
  82. /// 默认值
  83. /// </summary>
  84. [DataMember]
  85. public double DefaultValue { get; set; }
  86. /// <summary>
  87. /// 是否有报警
  88. /// </summary>
  89. [DataMember]
  90. public bool IsWarning { get; set; }
  91. /// <summary>
  92. /// alarm或是erro时显示的信息
  93. /// </summary>
  94. [DataMember]
  95. public string ErroMessage { get; set; }
  96. /// <summary>
  97. /// MFC,PC
  98. /// </summary>
  99. [DataMember]
  100. public string Type { get; set; }
  101. [DataMember]
  102. public double Factor { get; set; }
  103. private string _title;
  104. [DataMember]
  105. public string DisplayTitle
  106. {
  107. get
  108. {
  109. return string.Format("{0}({1})", DeviceSchematicId, DisplayName);
  110. }
  111. set
  112. {
  113. _title = value;
  114. }
  115. }
  116. [DataMember]
  117. public bool HasMFC
  118. {
  119. get;
  120. set;
  121. }
  122. public Visibility MFCVisibility
  123. {
  124. get
  125. {
  126. return HasMFC ? Visibility.Visible : Visibility.Hidden;
  127. }
  128. }
  129. [DataMember]
  130. public AITValveData SupplyValveData
  131. {
  132. get;
  133. set;
  134. }
  135. [DataMember]
  136. public AITValveData RunValveData
  137. {
  138. get;
  139. set;
  140. }
  141. [DataMember]
  142. public AITValveData BypassValveData
  143. {
  144. get;
  145. set;
  146. }
  147. [DataMember]
  148. public AITValveData FeedValveData
  149. {
  150. get;
  151. set;
  152. }
  153. [DataMember]
  154. public AITMfcData SupplyMFCData
  155. {
  156. get;
  157. set;
  158. }
  159. [DataMember]
  160. public AITPressureMeterData PressureMeterData
  161. {
  162. get;
  163. set;
  164. }
  165. [DataMember]
  166. public AITSensorData HighLevelSensordata
  167. {
  168. get;
  169. set;
  170. }
  171. [DataMember]
  172. public AITSensorData MiddleLevelSensordata
  173. {
  174. get;
  175. set;
  176. }
  177. [DataMember]
  178. public AITSensorData LowLevelSensordata
  179. {
  180. get;
  181. set;
  182. }
  183. [DataMember]
  184. public AITHeaterData HeaterData
  185. {
  186. get;
  187. set;
  188. }
  189. public AITVaporLineData()
  190. {
  191. DisplayName = "Undefined";
  192. Factor = 1.0;
  193. Unit = "";
  194. Type = "Vapor";
  195. }
  196. public void Update(IDeviceData data)
  197. {
  198. throw new NotImplementedException();
  199. }
  200. }
  201. public class AITVaporLineOperation
  202. {
  203. public const string Pump = "Pump";
  204. }
  205. }