DETMOperationViewModel.cs 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583
  1. using Aitex.Core.Common.DeviceData;
  2. using Aitex.Core.RT.SCCore;
  3. using ExcelLibrary.BinaryFileFormat;
  4. using MECF.Framework.Common.DataCenter;
  5. using MECF.Framework.Common.OperationCenter;
  6. using Prism.Commands;
  7. using Prism.Mvvm;
  8. using System;
  9. using System.Collections.Generic;
  10. using System.Collections.ObjectModel;
  11. using System.Diagnostics;
  12. using System.Linq;
  13. using System.Reflection;
  14. using System.Text;
  15. using System.Threading.Tasks;
  16. using System.Windows.Threading;
  17. using Unity;
  18. using Venus_Core;
  19. using Venus_MainPages.Unity;
  20. using Venus_Themes.CustomControls;
  21. using Venus_Themes.UserControls;
  22. using VenusCommon;
  23. namespace Venus_MainPages.ViewModels
  24. {
  25. public class DETMOperationViewModel : BindableBase
  26. {
  27. #region 私有变量
  28. private bool m_TMValveN2IsOpen;
  29. private bool m_TMSoftPumpIsOpen;
  30. private bool m_TMSoftVentIsOpen;
  31. private bool m_TMFastPumpIsOpen;
  32. private bool m_TMFastVentIsOpen;
  33. private bool m_VCEASoftPumpIsOpen;
  34. private bool m_VCEASoftVentIsOpen;
  35. private bool m_VCEAFastPumpIsOpen;
  36. private bool m_VCEAFastVentIsOpen;
  37. private bool m_VCEBSoftPumpIsOpen;
  38. private bool m_VCEBSoftVentIsOpen;
  39. private bool m_VCEBFastPumpIsOpen;
  40. private bool m_VCEBFastVentIsOpen;
  41. private bool m_PMAIsInstalled;
  42. private bool m_PMBIsInstalled;
  43. private bool m_PMCIsInstalled;
  44. private bool m_PMDIsInstalled;
  45. private bool m_VCEAIsInstalled;
  46. private bool m_VCEBIsInstalled;
  47. private bool m_VCEADoorIsOpen;
  48. private bool m_VCEBDoorIsOpen;
  49. private bool m_PMADoorIsOpen;
  50. private bool m_PMBDoorIsOpen;
  51. private bool m_PMCDoorIsOpen;
  52. private bool m_PMDDoorIsOpen;
  53. private bool m_VCEAOutDoorIsOpen;
  54. private bool m_VCEBOutDoorIsOpen;
  55. private bool m_TMIsVAC;
  56. private bool m_TMIsATM;
  57. private bool m_VCEAIsVAC;
  58. private bool m_VCEAIsATM;
  59. private bool m_VCEBIsVAC;
  60. private bool m_VCEBIsATM;
  61. private int m_GoToSlotNumber;
  62. private bool m_TMIsOnline;
  63. private Dictionary<string, object> m_RtDataValues = new Dictionary<string, object>();
  64. private List<string> m_RtDataKeys = new List<string>();
  65. #endregion
  66. #region 暴露变量
  67. private ObservableCollection<PMLeakCheckResult> m_TMLeakCheckResultList = new ObservableCollection<PMLeakCheckResult>();
  68. public ObservableCollection<PMLeakCheckResult> TMLeakCheckResultList
  69. {
  70. get { return m_TMLeakCheckResultList; }
  71. set { SetProperty(ref m_TMLeakCheckResultList, value); }
  72. }
  73. private ObservableCollection<PMLeakCheckResult> m_VCEALeakCheckResultList = new ObservableCollection<PMLeakCheckResult>();
  74. public ObservableCollection<PMLeakCheckResult> VCEALeakCheckResultList
  75. {
  76. get { return m_VCEALeakCheckResultList; }
  77. set { SetProperty(ref m_VCEALeakCheckResultList, value); }
  78. }
  79. private ObservableCollection<PMLeakCheckResult> m_VCEBLeakCheckResultList = new ObservableCollection<PMLeakCheckResult>();
  80. public ObservableCollection<PMLeakCheckResult> VCEBLeakCheckResultList
  81. {
  82. get { return m_VCEBLeakCheckResultList; }
  83. set { SetProperty(ref m_VCEBLeakCheckResultList, value); }
  84. }
  85. private PMLeakCheckResult m_VCEACurrentLeakCheckResultItem = new PMLeakCheckResult();
  86. public PMLeakCheckResult VCEACurrentLeakCheckResultItem
  87. {
  88. get { return m_VCEACurrentLeakCheckResultItem; }
  89. set { SetProperty(ref m_VCEACurrentLeakCheckResultItem, value); }
  90. }
  91. private PMLeakCheckResult m_VCEBCurrentLeakCheckResultItem = new PMLeakCheckResult();
  92. public PMLeakCheckResult VCEBCurrentLeakCheckResultItem
  93. {
  94. get { return m_VCEBCurrentLeakCheckResultItem; }
  95. set { SetProperty(ref m_VCEBCurrentLeakCheckResultItem, value); }
  96. }
  97. private PMLeakCheckResult m_TMCurrentLeakCheckResultItem = new PMLeakCheckResult();
  98. public PMLeakCheckResult TMCurrentLeakCheckResultItem
  99. {
  100. get { return m_TMCurrentLeakCheckResultItem; }
  101. set { SetProperty(ref m_TMCurrentLeakCheckResultItem, value); }
  102. }
  103. private bool _TMCheckFlag = false;
  104. private string m_TMCurrentState;
  105. public string TMCurrentState
  106. {
  107. get { return m_TMCurrentState; }
  108. set
  109. {
  110. if (m_TMCurrentState == null && !_TMCheckFlag)
  111. {
  112. _TMCheckFlag = true;
  113. var AllLeakCheckDa = QueryDataClient.Instance.Service.GetPMLeakCheckResult("DETM");
  114. if (AllLeakCheckDa != null)
  115. {
  116. TMLeakCheckResultList = new ObservableCollection<PMLeakCheckResult>(AllLeakCheckDa);
  117. }
  118. }
  119. if ((m_TMCurrentState == "Leakchecking") && value == "Idle")
  120. {
  121. var AllLeakCheckDa = QueryDataClient.Instance.Service.GetPMLeakCheckResult("DETM");
  122. if (AllLeakCheckDa != null)
  123. {
  124. TMLeakCheckResultList = new ObservableCollection<PMLeakCheckResult>(AllLeakCheckDa);
  125. }
  126. }
  127. SetProperty(ref m_TMCurrentState, value);
  128. }
  129. }
  130. private bool _VCEACheckFlag = false;
  131. private string m_VCEACurrentState;
  132. public string VCEACurrentState
  133. {
  134. get { return m_VCEACurrentState; }
  135. set
  136. {
  137. if (m_VCEACurrentState == null && !_VCEACheckFlag)
  138. {
  139. _VCEACheckFlag = true;
  140. var AllLeakCheckDa = QueryDataClient.Instance.Service.GetPMLeakCheckResult("VCEA");
  141. if (AllLeakCheckDa != null)
  142. {
  143. VCEALeakCheckResultList = new ObservableCollection<PMLeakCheckResult>(AllLeakCheckDa);
  144. }
  145. }
  146. if ((m_VCEACurrentState == "LeakChecking") && value == "Idle")
  147. {
  148. var AllLeakCheckDa = QueryDataClient.Instance.Service.GetPMLeakCheckResult("VCEA");
  149. if (AllLeakCheckDa != null)
  150. {
  151. VCEALeakCheckResultList = new ObservableCollection<PMLeakCheckResult>(AllLeakCheckDa);
  152. }
  153. }
  154. SetProperty(ref m_VCEACurrentState, value);
  155. }
  156. }
  157. private bool _VCEBCheckFlag = false;
  158. private string m_VCEBCurrentState;
  159. public string VCEBCurrentState
  160. {
  161. get { return m_VCEBCurrentState; }
  162. set
  163. {
  164. if (m_VCEBCurrentState == null && !_VCEBCheckFlag)
  165. {
  166. _VCEBCheckFlag = true;
  167. var AllLeakCheckDa = QueryDataClient.Instance.Service.GetPMLeakCheckResult("VCEB");
  168. if (AllLeakCheckDa != null)
  169. {
  170. VCEBLeakCheckResultList = new ObservableCollection<PMLeakCheckResult>(AllLeakCheckDa);
  171. }
  172. }
  173. if ((m_VCEBCurrentState == "LeakChecking") && value == "Idle")
  174. {
  175. var AllLeakCheckDa = QueryDataClient.Instance.Service.GetPMLeakCheckResult("VCEB");
  176. if (AllLeakCheckDa != null)
  177. {
  178. VCEBLeakCheckResultList = new ObservableCollection<PMLeakCheckResult>(AllLeakCheckDa);
  179. }
  180. }
  181. SetProperty(ref m_VCEBCurrentState, value);
  182. }
  183. }
  184. public bool TMValveN2IsOpen
  185. {
  186. get => m_TMValveN2IsOpen;
  187. set => SetProperty(ref m_TMValveN2IsOpen, value);
  188. }
  189. public bool TMSoftPumpIsOpen { get => m_TMSoftPumpIsOpen; set => SetProperty(ref m_TMSoftPumpIsOpen, value); }
  190. public bool TMSoftVentIsOpen { get => m_TMSoftVentIsOpen; set => SetProperty(ref m_TMSoftVentIsOpen, value); }
  191. public bool TMFastPumpIsOpen { get => m_TMFastPumpIsOpen; set => SetProperty(ref m_TMFastPumpIsOpen, value); }
  192. public bool TMFastVentIsOpen { get => m_TMFastVentIsOpen; set => SetProperty(ref m_TMFastVentIsOpen, value); }
  193. public bool VCEASoftPumpIsOpen { get => m_VCEASoftPumpIsOpen; set => SetProperty(ref m_VCEASoftPumpIsOpen, value); }
  194. public bool VCEASoftVentIsOpen { get => m_VCEASoftVentIsOpen; set => SetProperty(ref m_VCEASoftVentIsOpen, value); }
  195. public bool VCEAFastPumpIsOpen { get => m_VCEAFastPumpIsOpen; set => SetProperty(ref m_VCEAFastPumpIsOpen, value); }
  196. public bool VCEAFastVentIsOpen { get => m_VCEAFastVentIsOpen; set => SetProperty(ref m_VCEAFastVentIsOpen, value); }
  197. public bool VCEBSoftPumpIsOpen { get => m_VCEBSoftPumpIsOpen; set => SetProperty(ref m_VCEBSoftPumpIsOpen, value); }
  198. public bool VCEBSoftVentIsOpen { get => m_VCEBSoftVentIsOpen; set => SetProperty(ref m_VCEBSoftVentIsOpen, value); }
  199. public bool VCEBFastPumpIsOpen { get => m_VCEBFastPumpIsOpen; set => SetProperty(ref m_VCEBFastPumpIsOpen, value); }
  200. public bool VCEBFastVentIsOpen { get => m_VCEBFastVentIsOpen; set => SetProperty(ref m_VCEBFastVentIsOpen, value); }
  201. public bool TMIsVAC { get => m_TMIsVAC; set => SetProperty(ref m_TMIsVAC, value); }
  202. public bool TMIsATM { get => m_TMIsATM; set => SetProperty(ref m_TMIsATM, value); }
  203. public bool VCEAIsVAC { get => m_VCEAIsVAC; set => SetProperty(ref m_VCEAIsVAC, value); }
  204. public bool VCEBIsVAC { get => m_VCEBIsVAC; set => SetProperty(ref m_VCEBIsVAC, value); }
  205. public bool VCEAIsATM { get => m_VCEAIsATM; set => SetProperty(ref m_VCEAIsATM, value); }
  206. public bool VCEBIsATM { get => m_VCEBIsATM; set => SetProperty(ref m_VCEBIsATM, value); }
  207. public bool PMAIsInstalled { get => m_PMAIsInstalled; set => SetProperty(ref m_PMAIsInstalled, value); }
  208. public bool PMBIsInstalled { get => m_PMBIsInstalled; set => SetProperty(ref m_PMBIsInstalled, value); }
  209. public bool PMCIsInstalled { get => m_PMCIsInstalled; set => SetProperty(ref m_PMCIsInstalled, value); }
  210. public bool PMDIsInstalled { get => m_PMDIsInstalled; set => SetProperty(ref m_PMDIsInstalled, value); }
  211. public bool VCEAIsInstalled { get => m_VCEAIsInstalled; set => SetProperty(ref m_VCEAIsInstalled, value); }
  212. public bool VCEBIsInstalled { get => m_VCEBIsInstalled; set => SetProperty(ref m_VCEBIsInstalled, value); }
  213. public int GoToSlotNumber { get => m_GoToSlotNumber; set => SetProperty(ref m_GoToSlotNumber, value); }
  214. public Dictionary<string, object> RtDataValues
  215. {
  216. get { return m_RtDataValues; }
  217. set { SetProperty(ref m_RtDataValues, value); }
  218. }
  219. //public bool TMIsOFFline => !TMIsOnline;
  220. public bool VCEADoorIsOpen { get => m_VCEADoorIsOpen; set => SetProperty(ref m_VCEADoorIsOpen, value); }
  221. public bool VCEBDoorIsOpen { get => m_VCEBDoorIsOpen; set => SetProperty(ref m_VCEBDoorIsOpen, value); }
  222. public bool PMADoorIsOpen { get => m_PMADoorIsOpen; set => SetProperty(ref m_PMADoorIsOpen, value); }
  223. public bool PMBDoorIsOpen { get => m_PMBDoorIsOpen; set => SetProperty(ref m_PMBDoorIsOpen, value); }
  224. public bool PMCDoorIsOpen { get => m_PMCDoorIsOpen; set => SetProperty(ref m_PMCDoorIsOpen, value); }
  225. public bool PMDDoorIsOpen { get => m_PMDDoorIsOpen; set => SetProperty(ref m_PMDDoorIsOpen, value); }
  226. public bool VCEAOutDoorIsOpen { get => m_VCEAOutDoorIsOpen; set => SetProperty(ref m_VCEAOutDoorIsOpen, value); }
  227. public bool VCEBOutDoorIsOpen { get => m_VCEBOutDoorIsOpen; set => SetProperty(ref m_VCEBOutDoorIsOpen, value); }
  228. #endregion
  229. #region 构造函数
  230. public DETMOperationViewModel()
  231. {
  232. addDataKeys();
  233. string[] allModules = QueryDataClient.Instance.Service.GetConfig($"System.InstalledModules").ToString().Split(',');
  234. PMAIsInstalled = allModules.Contains("PMA");
  235. PMBIsInstalled = allModules.Contains("PMB");
  236. PMCIsInstalled = allModules.Contains("PMC");
  237. PMDIsInstalled = allModules.Contains("PMD");
  238. VCEAIsInstalled = allModules.Contains("VCEA");
  239. VCEBIsInstalled = allModules.Contains("VCEB");
  240. RtDataValues = QueryDataClient.Instance.Service.PollData(m_RtDataKeys);
  241. //2023/10/20 朱永吉 郭治川 取消N2 valve 动画保持流的状态
  242. TMValveN2IsOpen = true;
  243. TMSoftPumpIsOpen = CommonFunction.GetValue<bool>(RtDataValues, "DETM.TMSoftPumpValve.IsOpen");
  244. TMSoftVentIsOpen = CommonFunction.GetValue<bool>(RtDataValues, "DETM.TMSoftVentValve.IsOpen");
  245. TMFastPumpIsOpen = CommonFunction.GetValue<bool>(RtDataValues, "DETM.TMFastPumpValve.IsOpen");
  246. TMFastVentIsOpen = CommonFunction.GetValue<bool>(RtDataValues, "DETM.TMFastVentValve.IsOpen");
  247. VCEASoftPumpIsOpen = CommonFunction.GetValue<bool>(RtDataValues, "DETM.VCEASoftPumpValve.IsOpen");
  248. VCEASoftVentIsOpen = CommonFunction.GetValue<bool>(RtDataValues, "DETM.VCEASoftVentValve.IsOpen");
  249. VCEAFastPumpIsOpen = CommonFunction.GetValue<bool>(RtDataValues, "DETM.VCEAFastPumpValve.IsOpen");
  250. VCEAFastVentIsOpen = CommonFunction.GetValue<bool>(RtDataValues, "DETM.VCEAFastVentValve.IsOpen");
  251. VCEBSoftPumpIsOpen = CommonFunction.GetValue<bool>(RtDataValues, "DETM.VCEBSoftPumpValve.IsOpen");
  252. VCEBSoftVentIsOpen = CommonFunction.GetValue<bool>(RtDataValues, "DETM.VCEBSoftVentValve.IsOpen");
  253. VCEBFastPumpIsOpen = CommonFunction.GetValue<bool>(RtDataValues, "DETM.VCEBFastPumpValve.IsOpen");
  254. VCEBFastVentIsOpen = CommonFunction.GetValue<bool>(RtDataValues, "DETM.VCEBFastVentValve.IsOpen");
  255. TMIsVAC = CommonFunction.GetValue<bool>(RtDataValues, "DETM.TMVACSensor.Value");
  256. TMIsATM = CommonFunction.GetValue<bool>(RtDataValues, "DETM.TMIsATM");
  257. //VCEAIsVAC = CommonFunction.GetValue<bool>(RtDataValues, "DETM.VCEAVACSensor.Value");
  258. //VCEBIsVAC = CommonFunction.GetValue<bool>(RtDataValues, "DETM.VCEAVACSensor.Value");
  259. VCEAIsATM = CommonFunction.GetValue<bool>(RtDataValues, "DETM.VCEAIsATM");
  260. VCEBIsATM = CommonFunction.GetValue<bool>(RtDataValues, "DETM.VCEBIsATM");
  261. VCEADoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "DETM.VCEASlitDoorClosed");
  262. VCEBDoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "DETM.VCEBSlitDoorClosed");
  263. PMADoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "DETM.PMASlitDoorClosed");
  264. PMBDoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "DETM.PMBSlitDoorClosed");
  265. PMCDoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "DETM.PMCSlitDoorClosed");
  266. PMDDoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "DETM.PMDSlitDoorClosed");
  267. VCEAOutDoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "VCEA.VCEOutDoorClosed");
  268. VCEBOutDoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "VCEB.VCEOutDoorClosed");
  269. DispatcherTimer timer = new DispatcherTimer();
  270. timer.Interval = TimeSpan.FromSeconds(0.5);
  271. timer.Tick += timer_Tick;
  272. timer.Start();
  273. }
  274. #endregion
  275. #region 公共方法
  276. private DelegateCommand<object> _ControlValveCommand;
  277. public DelegateCommand<object> ControlValveCommand =>
  278. _ControlValveCommand ?? (_ControlValveCommand = new DelegateCommand<object>(OnControlValve));
  279. private DelegateCommand<object> _LeakCheck;
  280. public DelegateCommand<object> LeakCheck =>
  281. _LeakCheck ?? (_LeakCheck = new DelegateCommand<object>(OnLeakCheck));
  282. private DelegateCommand<object> _ControlSlitDoorCommand;
  283. public DelegateCommand<object> ControlSlitDoorCommand =>
  284. _ControlSlitDoorCommand ?? (_ControlSlitDoorCommand = new DelegateCommand<object>(OnControlSlitDoor));
  285. private DelegateCommand<object> _MapCommand;
  286. public DelegateCommand<object> MapCommand =>
  287. _MapCommand ?? (_MapCommand = new DelegateCommand<object>(OnMap));
  288. private DelegateCommand<object> _GoToLoadCommand;
  289. public DelegateCommand<object> GoToLoadCommand =>
  290. _GoToLoadCommand ?? (_GoToLoadCommand = new DelegateCommand<object>(OnGoToLoad));
  291. private DelegateCommand<object> _GoToSlotCommand;
  292. public DelegateCommand<object> GoToSlotCommand =>
  293. _GoToSlotCommand ?? (_GoToSlotCommand = new DelegateCommand<object>(OnGoToSlot));
  294. private DelegateCommand<object> _OpenDoorCommand;
  295. public DelegateCommand<object> OpenDoorCommand =>
  296. _OpenDoorCommand ?? (_OpenDoorCommand = new DelegateCommand<object>(OnOpenDoor));
  297. private DelegateCommand<object> _CloseDoorCommand;
  298. public DelegateCommand<object> CloseDoorCommand =>
  299. _CloseDoorCommand ?? (_CloseDoorCommand = new DelegateCommand<object>(OnCloseDoor));
  300. private DelegateCommand<object> _HOMECommand;
  301. public DelegateCommand<object> HOMECommand =>
  302. _HOMECommand ?? (_HOMECommand = new DelegateCommand<object>(OnHome));
  303. private DelegateCommand<object> _DETMPumpCommand;
  304. public DelegateCommand<object> DETMPumpCommand =>
  305. _DETMPumpCommand ?? (_DETMPumpCommand = new DelegateCommand<object>(OnSetDEPump));
  306. private DelegateCommand<object> _VCEAPumpCommand;
  307. public DelegateCommand<object> VCEAPumpCommand =>
  308. _VCEAPumpCommand ?? (_VCEAPumpCommand = new DelegateCommand<object>(OnSetVCEAPump));
  309. private DelegateCommand<object> _PumpDown;
  310. public DelegateCommand<object> PumpDown =>
  311. _PumpDown ?? (_PumpDown = new DelegateCommand<object>(OnPumpDown));
  312. private DelegateCommand<object> _Vent;
  313. public DelegateCommand<object> Vent =>
  314. _Vent ?? (_Vent = new DelegateCommand<object>(OnVent));
  315. private DelegateCommand _tmhome;
  316. public DelegateCommand TmHome =>
  317. _tmhome ?? (_tmhome = new DelegateCommand(tmhome));
  318. private DelegateCommand _abort;
  319. public DelegateCommand Abort =>
  320. _abort ?? (_abort = new DelegateCommand(abort));
  321. private DelegateCommand _TMSetOnline;
  322. public DelegateCommand TMSetOnline =>
  323. _TMSetOnline ?? (_TMSetOnline = new DelegateCommand(TmSetOnline));
  324. private DelegateCommand _TMSetOffline;
  325. public DelegateCommand TMSetOffline =>
  326. _TMSetOffline ?? (_TMSetOffline = new DelegateCommand(TmSetOffline));
  327. private DelegateCommand<object> _VCEHome;
  328. public DelegateCommand<object> VCEHome => _VCEHome ?? (_VCEHome = new DelegateCommand<object>(vceHome));
  329. private DelegateCommand<object> _VCEClear;
  330. public DelegateCommand<object> VCEClear => _VCEClear ?? (_VCEClear = new DelegateCommand<object>(vceClear));
  331. private DelegateCommand<object> _VCEAbort;
  332. public DelegateCommand<object> VCEAbort => _VCEAbort ?? (_VCEAbort = new DelegateCommand<object>(vceAbort));
  333. private DelegateCommand<object> _VCESetOnline;
  334. public DelegateCommand<object> VCESetOnline => _VCESetOnline ?? (_VCESetOnline = new DelegateCommand<object>(vceOnline));
  335. private DelegateCommand<object> _VCESetOffline;
  336. public DelegateCommand<object> VCESetOffline => _VCESetOffline ?? (_VCESetOffline = new DelegateCommand<object>(vceOffline));
  337. #endregion
  338. #region 私有方法
  339. private void addDataKeys()
  340. {
  341. m_RtDataKeys.Add($"DETM.TMSoftPumpValve.IsOpen");
  342. m_RtDataKeys.Add($"DETM.TMSoftVentValve.IsOpen");
  343. m_RtDataKeys.Add($"DETM.TMFastPumpValve.IsOpen");
  344. m_RtDataKeys.Add($"DETM.TMFastVentValve.IsOpen");
  345. m_RtDataKeys.Add($"DETM.VCEASoftPumpValve.IsOpen");
  346. m_RtDataKeys.Add($"DETM.VCEBSoftPumpValve.IsOpen");
  347. m_RtDataKeys.Add($"DETM.VCEASoftVentValve.IsOpen");
  348. m_RtDataKeys.Add($"DETM.VCEBSoftVentValve.IsOpen");
  349. m_RtDataKeys.Add($"DETM.VCEAFastPumpValve.IsOpen");
  350. m_RtDataKeys.Add($"DETM.VCEBFastPumpValve.IsOpen");
  351. m_RtDataKeys.Add($"DETM.VCEAFastVentValve.IsOpen");
  352. m_RtDataKeys.Add($"DETM.VCEBFastVentValve.IsOpen");
  353. m_RtDataKeys.Add($"DETM.VCEASlitDoorClosed");
  354. m_RtDataKeys.Add($"DETM.VCEBSlitDoorClosed");
  355. m_RtDataKeys.Add($"DETM.PMASlitDoorClosed");
  356. m_RtDataKeys.Add($"DETM.PMBSlitDoorClosed");
  357. m_RtDataKeys.Add($"DETM.PMCSlitDoorClosed");
  358. m_RtDataKeys.Add($"DETM.PMDSlitDoorClosed");
  359. m_RtDataKeys.Add($"DETM.TMVACSensor.Value");
  360. m_RtDataKeys.Add($"DETM.TMIsATM");
  361. m_RtDataKeys.Add($"DETM.VCEAIsATM");
  362. m_RtDataKeys.Add($"DETM.VCEBIsATM");
  363. m_RtDataKeys.Add($"DETM.IsOnline");
  364. m_RtDataKeys.Add($"DETM.IsOffline");
  365. m_RtDataKeys.Add($"DETM.FsmState");
  366. m_RtDataKeys.Add($"VCEA.FsmState");
  367. m_RtDataKeys.Add($"VCEB.FsmState");
  368. m_RtDataKeys.Add($"VCEA.IsOnline");
  369. m_RtDataKeys.Add($"VCEA.IsOffline");
  370. m_RtDataKeys.Add($"VCEB.IsOnline");
  371. m_RtDataKeys.Add($"VCEB.IsOffline");
  372. m_RtDataKeys.Add($"DETM.PumpIsRunning");
  373. m_RtDataKeys.Add($"VCEA.PumpIsRunning");
  374. m_RtDataKeys.Add($"DETM.TMPipelinePressure.Value");
  375. m_RtDataKeys.Add($"DETM.TMPressure.Value");
  376. m_RtDataKeys.Add($"DETM.VCEAPressure.Value");
  377. m_RtDataKeys.Add($"DETM.VCEBPressure.Value");
  378. m_RtDataKeys.Add($"VCEA.VCEOutDoorClosed");
  379. m_RtDataKeys.Add($"VCEB.VCEOutDoorClosed");
  380. m_RtDataKeys.Add($"DETM.TM_MFC1.FeedBack");
  381. m_RtDataKeys.Add($"DETM.TM_MFC1.SetPoint");
  382. }
  383. private void timer_Tick(object sender, EventArgs e)
  384. {
  385. RtDataValues = QueryDataClient.Instance.Service.PollData(m_RtDataKeys);
  386. TMSoftPumpIsOpen = CommonFunction.GetValue<bool>(RtDataValues, "DETM.TMSoftPumpValve.IsOpen");
  387. TMSoftVentIsOpen = CommonFunction.GetValue<bool>(RtDataValues, "DETM.TMSoftVentValve.IsOpen");
  388. TMFastPumpIsOpen = CommonFunction.GetValue<bool>(RtDataValues, "DETM.TMFastPumpValve.IsOpen");
  389. TMFastVentIsOpen = CommonFunction.GetValue<bool>(RtDataValues, "DETM.TMFastVentValve.IsOpen");
  390. VCEASoftPumpIsOpen = CommonFunction.GetValue<bool>(RtDataValues, "DETM.VCEASoftPumpValve.IsOpen");
  391. VCEASoftVentIsOpen = CommonFunction.GetValue<bool>(RtDataValues, "DETM.VCEASoftVentValve.IsOpen");
  392. VCEAFastPumpIsOpen = CommonFunction.GetValue<bool>(RtDataValues, "DETM.VCEAFastPumpValve.IsOpen");
  393. VCEAFastVentIsOpen = CommonFunction.GetValue<bool>(RtDataValues, "DETM.VCEAFastVentValve.IsOpen");
  394. VCEBSoftPumpIsOpen = CommonFunction.GetValue<bool>(RtDataValues, "DETM.VCEBSoftPumpValve.IsOpen");
  395. VCEBSoftVentIsOpen = CommonFunction.GetValue<bool>(RtDataValues, "DETM.VCEBSoftVentValve.IsOpen");
  396. VCEBFastPumpIsOpen = CommonFunction.GetValue<bool>(RtDataValues, "DETM.VCEBFastPumpValve.IsOpen");
  397. VCEBFastVentIsOpen = CommonFunction.GetValue<bool>(RtDataValues, "DETM.VCEBFastVentValve.IsOpen");
  398. VCEADoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "DETM.VCEASlitDoorClosed");
  399. VCEBDoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "DETM.VCEBSlitDoorClosed");
  400. PMADoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "DETM.PMASlitDoorClosed");
  401. PMBDoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "DETM.PMBSlitDoorClosed");
  402. PMCDoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "DETM.PMCSlitDoorClosed");
  403. VCEAOutDoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "VCEA.VCEAOutDoorClosed");
  404. VCEBOutDoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "VCEB.VCEBOutDoorClosed");
  405. TMIsVAC = (CommonFunction.GetValue<int>(RtDataValues, "DETM.TMPressure.Value") < Convert.ToInt32(QueryDataClient.Instance.Service.GetConfig($"DETM.VACTargetPressure")));
  406. TMIsATM = CommonFunction.GetValue<bool>(RtDataValues, "DETM.TMIsATM");
  407. VCEAIsVAC = (CommonFunction.GetValue<int>(RtDataValues, "DETM.VCEAPressure.Value") < Convert.ToInt32(QueryDataClient.Instance.Service.GetConfig($"VCEA.VACTargetPressure")));
  408. VCEBIsVAC = (CommonFunction.GetValue<int>(RtDataValues, "DETM.VCEBPressure.Value") < Convert.ToInt32(QueryDataClient.Instance.Service.GetConfig($"VCEB.VACTargetPressure")));
  409. VCEAIsATM = CommonFunction.GetValue<bool>(RtDataValues, "DETM.VCEAIsATM");
  410. VCEBIsATM = CommonFunction.GetValue<bool>(RtDataValues, "DETM.VCEBIsATM");
  411. TMCurrentState = CommonFunction.GetValue<string>(RtDataValues, "DETM.FsmState");
  412. VCEACurrentState = CommonFunction.GetValue<string>(RtDataValues, "VCEA.FsmState");
  413. VCEBCurrentState = CommonFunction.GetValue<string>(RtDataValues, "VCEB.FsmState");
  414. }
  415. private void TmSetOnline()
  416. {
  417. InvokeClient.Instance.Service.DoOperation("DETM.Online");
  418. }
  419. private void TmSetOffline()
  420. {
  421. InvokeClient.Instance.Service.DoOperation("DETM.Offline");
  422. }
  423. private void vceHome(object obj)
  424. {
  425. InvokeClient.Instance.Service.DoOperation($"{obj}.HOME");
  426. }
  427. private void vceClear(object obj)
  428. {
  429. InvokeClient.Instance.Service.DoOperation($"{obj}.ClearError");
  430. }
  431. private void vceAbort(object obj)
  432. {
  433. InvokeClient.Instance.Service.DoOperation($"{obj}.Abort");
  434. }
  435. private void tmhome()
  436. {
  437. InvokeClient.Instance.Service.DoOperation("DETM.Home");
  438. }
  439. private void abort()
  440. {
  441. InvokeClient.Instance.Service.DoOperation("DETM.Abort");
  442. }
  443. private void OnVent(object obj)
  444. {
  445. InvokeClient.Instance.Service.DoOperation($"{obj}.Vent");
  446. }
  447. private void OnPumpDown(object obj)
  448. {
  449. InvokeClient.Instance.Service.DoOperation($"{obj}.PumpDown");
  450. }
  451. private void OnSetDEPump(object obj)
  452. {
  453. bool.TryParse(obj.ToString(), out bool Open);
  454. InvokeClient.Instance.Service.DoOperation("DETM.ControlPump", Open);
  455. }
  456. private void OnSetVCEAPump(object obj)
  457. {
  458. bool.TryParse(obj.ToString(), out bool Open);
  459. InvokeClient.Instance.Service.DoOperation("VCEA.ControlPump", Open);
  460. }
  461. private void OnHome(object chamber)
  462. {
  463. InvokeClient.Instance.Service.DoOperation($"{chamber}.HOME");
  464. }
  465. private void OnOpenDoor(object chamber)
  466. {
  467. InvokeClient.Instance.Service.DoOperation($"{chamber}.DoorOpen");
  468. }
  469. private void OnCloseDoor(object chamber)
  470. {
  471. InvokeClient.Instance.Service.DoOperation($"{chamber}.DoorClose");
  472. }
  473. private void OnMap(object chamber)
  474. {
  475. InvokeClient.Instance.Service.DoOperation($"{chamber}.Map");
  476. }
  477. private void OnGoToLoad(object chamber)
  478. {
  479. InvokeClient.Instance.Service.DoOperation($"{chamber}.GotoLP");
  480. }
  481. private void OnGoToSlot(object chamber)
  482. {
  483. InvokeClient.Instance.Service.DoOperation($"{chamber}.Goto", GoToSlotNumber);
  484. }
  485. private void OnControlValve(object obj)
  486. {
  487. CommonValveControl commonValveControl = (CommonValveControl)obj;
  488. if (commonValveControl.IsCanEdit == true)
  489. {
  490. InvokeClient.Instance.Service.DoOperation($"DETM.{commonValveControl.Tag}Valve.{AITValveOperation.GVTurnValve}", !commonValveControl.Status);
  491. }
  492. }
  493. private void vceOnline(object chamber)
  494. {
  495. InvokeClient.Instance.Service.DoOperation($"{chamber}.Online");
  496. }
  497. private void vceOffline(object chamber)
  498. {
  499. InvokeClient.Instance.Service.DoOperation($"{chamber}.Offline");
  500. }
  501. public void OnLeakCheck(object chamber)
  502. {
  503. InvokeClient.Instance.Service.DoOperation($"{chamber}.LeakCheck", chamber);
  504. }
  505. private void OnControlSlitDoor(object obj)
  506. {
  507. string Module = obj.ToString().Split(',')[0];
  508. bool.TryParse(obj.ToString().Split(',')[1], out bool Open);
  509. InvokeClient.Instance.Service.DoOperation($"DETM.SetSlitDoor", Module, Open);
  510. }
  511. #endregion
  512. }
  513. }