TMOperationViewModel.cs 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710
  1. using Aitex.Core.Common.DeviceData;
  2. using Aitex.Core.RT.Log;
  3. using ExcelLibrary.BinaryFileFormat;
  4. using MECF.Framework.Common.DataCenter;
  5. using MECF.Framework.Common.Equipment;
  6. using MECF.Framework.Common.OperationCenter;
  7. using Prism.Commands;
  8. using Prism.Mvvm;
  9. using System;
  10. using System.Collections.Generic;
  11. using System.Collections.ObjectModel;
  12. using System.Linq;
  13. using System.Reflection;
  14. using System.Windows.Threading;
  15. using Venus_Core;
  16. using Venus_MainPages.Unity;
  17. using Venus_MainPages.Views;
  18. using Venus_Themes.CustomControls;
  19. namespace Venus_MainPages.ViewModels
  20. {
  21. public class TMOperationViewModel : BindableBase
  22. {
  23. #region 私有字段
  24. //private TMOperationView m_TMOperationView;
  25. //private bool m_IsOFFline = true;
  26. private bool m_TMIsOFFline = true;
  27. private bool m_LLAIsOFFline = true;
  28. private bool m_LLBIsOFFline = true;
  29. private bool m_PMAIsInstalled;
  30. private bool m_PMBIsInstalled;
  31. private bool m_PMCIsInstalled;
  32. private bool m_PMDIsInstalled;
  33. private bool m_LLAIsInstalled;
  34. private bool m_LLBIsInstalled;
  35. private Dictionary<string, object> m_RtDataValues;
  36. private string m_ModuleCheckedName = "TM";
  37. private bool m_TMValveN2IsOpen;
  38. private bool m_TMSoftPumpValveIsOpen;
  39. private bool m_TMFastPumpValveIsOpen;
  40. private bool m_TMPurgeValveIsOpen;
  41. private bool m_TMSoftVentValveIsOpen;
  42. private bool m_TMFastVentValveIsOpen;
  43. private bool m_LLASoftPumpValveIsOpen;
  44. private bool m_LLAFastPumpValveIsOpen;
  45. private bool m_LLAPurgeValveIsOpen;
  46. private bool m_LLAVentValveIsOpen;
  47. private bool m_LLBSoftPumpValveIsOpen;
  48. private bool m_LLBFastPumpValveIsOpen;
  49. private bool m_LLBPurgeValveIsOpen;
  50. private bool m_LLBVentValveIsOpen;
  51. private bool m_TMVentExhaustValveIsOpen;
  52. private bool m_LLAVentExhaustValveIsOpen;
  53. private bool m_LLBVentExhaustValveIsOpen;
  54. private List<string> m_RtDataKeys = new List<string>();
  55. private int m_TMOutChamberPressure;
  56. private int m_TMOutChamberFlow;
  57. private int m_TMChamberPressureSetPoint;
  58. private int m_TMChamberFlowSetPoint;
  59. private ObservableCollection<string> m_HomeAllSteps = new ObservableCollection<string>();
  60. private int m_StepProcess;
  61. private bool m_TMIsHoming;
  62. private PressureType m_PressureType;
  63. private TMState m_TMCurrentState;
  64. private LLState m_LLACurrentState;
  65. private LLState m_LLBCurrentState;
  66. private ObservableCollection<PMLeakCheckResult> m_LeakCheckResultList = new ObservableCollection<PMLeakCheckResult>();
  67. private bool m_firstLoad = true;
  68. DispatcherTimer timer;
  69. #endregion
  70. #region 属性
  71. public PressureType PressureType
  72. {
  73. get { return m_PressureType; }
  74. set { SetProperty(ref m_PressureType, value); }
  75. }
  76. public bool TMValveN2IsOpen
  77. {
  78. get { return m_TMValveN2IsOpen; }
  79. set { SetProperty(ref m_TMValveN2IsOpen, value); }
  80. }
  81. public bool TMSoftPumpValveIsOpen
  82. {
  83. get { return m_TMSoftPumpValveIsOpen; }
  84. set { SetProperty(ref m_TMSoftPumpValveIsOpen, value); }
  85. }
  86. public bool TMFastPumpValveIsOpen
  87. {
  88. get { return m_TMFastPumpValveIsOpen; }
  89. set { SetProperty(ref m_TMFastPumpValveIsOpen, value); }
  90. }
  91. public bool TMPurgeValveIsOpen
  92. {
  93. get { return m_TMPurgeValveIsOpen; }
  94. set { SetProperty(ref m_TMPurgeValveIsOpen, value); }
  95. }
  96. public bool TMSoftVentValveIsOpen
  97. {
  98. get { return m_TMSoftVentValveIsOpen; }
  99. set { SetProperty(ref m_TMSoftVentValveIsOpen, value); }
  100. }
  101. public bool TMFastVentValveIsOpen
  102. {
  103. get { return m_TMFastVentValveIsOpen; }
  104. set { SetProperty(ref m_TMFastVentValveIsOpen, value); }
  105. }
  106. public bool LLAFastPumpValveIsOpen
  107. {
  108. get { return m_LLAFastPumpValveIsOpen; }
  109. set { SetProperty(ref m_LLAFastPumpValveIsOpen, value); }
  110. }
  111. public bool LLASoftPumpValveIsOpen
  112. {
  113. get { return m_LLASoftPumpValveIsOpen; }
  114. set { SetProperty(ref m_LLASoftPumpValveIsOpen, value); }
  115. }
  116. public bool LLAPurgeValveIsOpen
  117. {
  118. get { return m_LLAPurgeValveIsOpen; }
  119. set { SetProperty(ref m_LLAPurgeValveIsOpen, value); }
  120. }
  121. public bool LLAVentValveIsOpen
  122. {
  123. get { return m_LLAVentValveIsOpen; }
  124. set { SetProperty(ref m_LLAVentValveIsOpen, value); }
  125. }
  126. public bool LLBSoftPumpValveIsOpen
  127. {
  128. get { return m_LLBSoftPumpValveIsOpen; }
  129. set { SetProperty(ref m_LLBSoftPumpValveIsOpen, value); }
  130. }
  131. public bool LLBFastPumpValveIsOpen
  132. {
  133. get { return m_LLBFastPumpValveIsOpen; }
  134. set { SetProperty(ref m_LLBFastPumpValveIsOpen, value); }
  135. }
  136. public bool LLBPurgeValveIsOpen
  137. {
  138. get { return m_LLBPurgeValveIsOpen; }
  139. set { SetProperty(ref m_LLBPurgeValveIsOpen, value); }
  140. }
  141. public bool LLBVentValveIsOpen
  142. {
  143. get { return m_LLBVentValveIsOpen; }
  144. set { SetProperty(ref m_LLBVentValveIsOpen, value); }
  145. }
  146. public bool TMVentExhaustValveIsOpen
  147. {
  148. get { return m_TMVentExhaustValveIsOpen; }
  149. set { SetProperty(ref m_TMVentExhaustValveIsOpen, value); }
  150. }
  151. public bool LLAVentExhaustValveIsOpen
  152. {
  153. get { return m_LLAVentExhaustValveIsOpen; }
  154. set { SetProperty(ref m_LLAVentExhaustValveIsOpen, value); }
  155. }
  156. public bool LLBVentExhaustValveIsOpen
  157. {
  158. get { return m_LLBVentExhaustValveIsOpen; }
  159. set { SetProperty(ref m_LLBVentExhaustValveIsOpen, value); }
  160. }
  161. public int TMChamberPressureSetPoint
  162. {
  163. get { return m_TMChamberPressureSetPoint; }
  164. set { SetProperty(ref m_TMChamberPressureSetPoint, value); }
  165. }
  166. public int TMChamberFlowSetPoint
  167. {
  168. get { return m_TMChamberFlowSetPoint; }
  169. set { SetProperty(ref m_TMChamberFlowSetPoint, value); }
  170. }
  171. //public bool IsOFFline
  172. //{
  173. // get { return m_IsOFFline; }
  174. // set
  175. // {
  176. // SetProperty(ref m_IsOFFline, value);
  177. // }
  178. //}
  179. public bool TMIsOFFline
  180. {
  181. get { return m_TMIsOFFline; }
  182. set
  183. {
  184. SetProperty(ref m_TMIsOFFline, value);
  185. }
  186. }
  187. public bool LLAIsOFFline
  188. {
  189. get { return m_LLAIsOFFline; }
  190. set
  191. {
  192. SetProperty(ref m_LLAIsOFFline, value);
  193. }
  194. }
  195. public bool LLBIsOFFline
  196. {
  197. get { return m_LLBIsOFFline; }
  198. set
  199. {
  200. SetProperty(ref m_LLBIsOFFline, value);
  201. }
  202. }
  203. public Dictionary<string, object> RtDataValues
  204. {
  205. get { return m_RtDataValues; }
  206. set { SetProperty(ref m_RtDataValues, value); }
  207. }
  208. public bool PMAIsInstalled
  209. {
  210. get { return m_PMAIsInstalled; }
  211. set { SetProperty(ref m_PMAIsInstalled, value); }
  212. }
  213. public bool PMBIsInstalled
  214. {
  215. get { return m_PMBIsInstalled; }
  216. set { SetProperty(ref m_PMBIsInstalled, value); }
  217. }
  218. public bool PMCIsInstalled
  219. {
  220. get { return m_PMCIsInstalled; }
  221. set { SetProperty(ref m_PMCIsInstalled, value); }
  222. }
  223. public bool PMDIsInstalled
  224. {
  225. get { return m_PMDIsInstalled; }
  226. set { SetProperty(ref m_PMDIsInstalled, value); }
  227. }
  228. public bool LLAIsInstalled
  229. {
  230. get { return m_LLAIsInstalled; }
  231. set { SetProperty(ref m_LLAIsInstalled, value); }
  232. }
  233. public bool LLBIsInstalled
  234. {
  235. get { return m_LLBIsInstalled; }
  236. set { SetProperty(ref m_LLBIsInstalled, value); }
  237. }
  238. public int TMOutChamberFlow
  239. {
  240. get { return m_TMOutChamberFlow; }
  241. set
  242. {
  243. if (value != m_TMOutChamberFlow)
  244. {
  245. InvokeClient.Instance.Service.DoOperation($"TM.SetChamberFlow", value);
  246. }
  247. SetProperty(ref m_TMOutChamberFlow, value);
  248. }
  249. }
  250. public int TMOutChamberPressure
  251. {
  252. get { return m_TMOutChamberPressure; }
  253. set
  254. {
  255. SetProperty(ref m_TMOutChamberPressure, value);
  256. }
  257. }
  258. public ObservableCollection<string> HomeAllSteps
  259. {
  260. get { return m_HomeAllSteps; }
  261. set { SetProperty(ref m_HomeAllSteps, value); }
  262. }
  263. public int StepProcess
  264. {
  265. get { return m_StepProcess; }
  266. set { SetProperty(ref m_StepProcess, value); }
  267. }
  268. public bool TMIsHoming
  269. {
  270. get { return m_TMIsHoming; }
  271. set { SetProperty(ref m_TMIsHoming, value); }
  272. }
  273. public TMState TMCurrentState
  274. {
  275. get { return m_TMCurrentState; }
  276. set
  277. {
  278. if ((m_TMCurrentState == TMState.Leakchecking) && value == TMState.Idle)
  279. {
  280. var AllLeakCheckDa = QueryDataClient.Instance.Service.GetPMLeakCheckResult(m_ModuleCheckedName);
  281. if (AllLeakCheckDa != null)
  282. {
  283. LeakCheckResultList = new ObservableCollection<PMLeakCheckResult>(AllLeakCheckDa);
  284. }
  285. }
  286. SetProperty(ref m_TMCurrentState, value);
  287. }
  288. }
  289. public LLState LLACurrentState
  290. {
  291. get { return m_LLACurrentState; }
  292. set
  293. {
  294. if ((m_LLACurrentState == LLState.LeakCheck) && value == LLState.Idle)
  295. {
  296. var AllLeakCheckDa = QueryDataClient.Instance.Service.GetPMLeakCheckResult(m_ModuleCheckedName);
  297. if (AllLeakCheckDa != null)
  298. {
  299. LeakCheckResultList = new ObservableCollection<PMLeakCheckResult>(AllLeakCheckDa);
  300. }
  301. }
  302. SetProperty(ref m_LLACurrentState, value);
  303. }
  304. }
  305. public LLState LLBCurrentState
  306. {
  307. get { return m_LLBCurrentState; }
  308. set
  309. {
  310. if ((m_LLBCurrentState == LLState.LeakCheck) && value == LLState.Idle)
  311. {
  312. var AllLeakCheckDa = QueryDataClient.Instance.Service.GetPMLeakCheckResult(m_ModuleCheckedName);
  313. if (AllLeakCheckDa != null)
  314. {
  315. LeakCheckResultList = new ObservableCollection<PMLeakCheckResult>(AllLeakCheckDa);
  316. }
  317. }
  318. SetProperty(ref m_LLBCurrentState, value);
  319. }
  320. }
  321. public ObservableCollection<PMLeakCheckResult> LeakCheckResultList
  322. {
  323. get { return m_LeakCheckResultList; }
  324. set { SetProperty(ref m_LeakCheckResultList, value); }
  325. }
  326. #endregion
  327. #region 命令
  328. private DelegateCommand<object> _LoadCommand;
  329. public DelegateCommand<object> LoadCommand =>
  330. _LoadCommand ?? (_LoadCommand = new DelegateCommand<object>(OnLoad));
  331. private DelegateCommand<object> _HomeCommand;
  332. public DelegateCommand<object> HomeCommand =>
  333. _HomeCommand ?? (_HomeCommand = new DelegateCommand<object>(OnHome));
  334. private DelegateCommand _RobotHomeCommand;
  335. public DelegateCommand RobotHomeCommand =>
  336. _RobotHomeCommand ?? (_RobotHomeCommand = new DelegateCommand(OnRobotHome));
  337. private DelegateCommand<object> _VentCommand;
  338. public DelegateCommand<object> VentCommand =>
  339. _VentCommand ?? (_VentCommand = new DelegateCommand<object>(OnVent));
  340. private DelegateCommand<object> _PumpCommand;
  341. public DelegateCommand<object> PumpCommand =>
  342. _PumpCommand ?? (_PumpCommand = new DelegateCommand<object>(OnPump));
  343. private DelegateCommand<object> _PurgeCommand;
  344. public DelegateCommand<object> PurgeCommand =>
  345. _PurgeCommand ?? (_PurgeCommand = new DelegateCommand<object>(OnPurge));
  346. private DelegateCommand _LeakCheckCommand;
  347. public DelegateCommand LeakCheckCommand =>
  348. _LeakCheckCommand ?? (_LeakCheckCommand = new DelegateCommand(OnLeakCheck));
  349. private DelegateCommand<object> _AbortCommand;
  350. public DelegateCommand<object> AbortCommand =>
  351. _AbortCommand ?? (_AbortCommand = new DelegateCommand<object>(OnAbort));
  352. //private DelegateCommand<object> _ModuleCheckedCommand;
  353. //public DelegateCommand<object> ModuleCheckedCommand =>
  354. // _ModuleCheckedCommand ?? (_ModuleCheckedCommand = new DelegateCommand<object>(OnModuleChecked));
  355. private DelegateCommand<object> _ControlValveCommand;
  356. public DelegateCommand<object> ControlValveCommand =>
  357. _ControlValveCommand ?? (_ControlValveCommand = new DelegateCommand<object>(OnControlValve));
  358. //private DelegateCommand _OpenLLPumpCommand;
  359. //public DelegateCommand OpenLLPumpCommand =>
  360. // _OpenLLPumpCommand ?? (_OpenLLPumpCommand = new DelegateCommand(OnOpenLLPump));
  361. //private DelegateCommand _CloseLLPumpCommand;
  362. //public DelegateCommand CloseLLPumpCommand =>
  363. // _CloseLLPumpCommand ?? (_CloseLLPumpCommand = new DelegateCommand(OnCloseLLPump));
  364. private DelegateCommand<object> _OpenPumpCommand;
  365. public DelegateCommand<object> OpenPumpCommand =>
  366. _OpenPumpCommand ?? (_OpenPumpCommand = new DelegateCommand<object>(OnOpenPump));
  367. private DelegateCommand<object> _ClosePumpCommand;
  368. public DelegateCommand<object> ClosePumpCommand =>
  369. _ClosePumpCommand ?? (_ClosePumpCommand = new DelegateCommand<object>(OnClosePump));
  370. private DelegateCommand<object> _DoorUpDownCommand;
  371. public DelegateCommand<object> DoorUpDownCommand =>
  372. _DoorUpDownCommand ?? (_DoorUpDownCommand = new DelegateCommand<object>(OnDoorUpDown));
  373. private DelegateCommand<object> _ChamberDoorOpenCommand;
  374. public DelegateCommand<object> ChamberDoorOpenCommand =>
  375. _ChamberDoorOpenCommand ?? (_ChamberDoorOpenCommand = new DelegateCommand<object>(OnChamberDoorOpen));
  376. private DelegateCommand<object> _ChamberDoorCloseCommand;
  377. public DelegateCommand<object> ChamberDoorCloseCommand =>
  378. _ChamberDoorCloseCommand ?? (_ChamberDoorCloseCommand = new DelegateCommand<object>(OnChamberDoorClose));
  379. private DelegateCommand<object> _SetTMChamberPressureCommand;
  380. public DelegateCommand<object> SetTMChamberPressureCommand =>
  381. _SetTMChamberPressureCommand ?? (_SetTMChamberPressureCommand = new DelegateCommand<object>(OnSetTMChamberPressure));
  382. private DelegateCommand<object> _OnlineCommand;
  383. public DelegateCommand<object> OnlineCommand =>
  384. _OnlineCommand ?? (_OnlineCommand = new DelegateCommand<object>(OnOnline));
  385. private DelegateCommand<object> _OfflineCommand;
  386. public DelegateCommand<object> OfflineCommand =>
  387. _OfflineCommand ?? (_OfflineCommand = new DelegateCommand<object>(OnOffline));
  388. #endregion
  389. #region 构造函数
  390. public TMOperationViewModel()
  391. {
  392. addDataKeys();
  393. RtDataValues = QueryDataClient.Instance.Service.PollData(m_RtDataKeys);
  394. string[] allModules = QueryDataClient.Instance.Service.GetConfig($"System.InstalledModules").ToString().Split(',');
  395. PMAIsInstalled = allModules.Contains("PMA");
  396. PMBIsInstalled = allModules.Contains("PMB");
  397. PMCIsInstalled = allModules.Contains("PMC");
  398. PMDIsInstalled = allModules.Contains("PMD");
  399. LLAIsInstalled = allModules.Contains("LLA");
  400. LLBIsInstalled = allModules.Contains("LLB");
  401. timer = new DispatcherTimer();
  402. timer.Interval = TimeSpan.FromSeconds(0.5);
  403. timer.Tick += timer_Tick;
  404. //timer.Start();
  405. HomeAllSteps.Add("Lid");
  406. HomeAllSteps.Add("Robot");
  407. HomeAllSteps.Add("Slit Door");
  408. HomeAllSteps.Add("Pump ");
  409. object obj = QueryDataClient.Instance.Service.GetData("System.PressureUnitType");
  410. PressureType = (PressureType)Convert.ToInt32(obj);
  411. }
  412. #endregion
  413. #region 命令方法
  414. private void OnLoad(object tmOperationView)
  415. {
  416. if (m_firstLoad)
  417. {
  418. //m_TMOperationView = (TMOperationView)tmOperationView;
  419. var AllLeakCheckDa = QueryDataClient.Instance.Service.GetPMLeakCheckResult("TM");
  420. if (AllLeakCheckDa != null)
  421. {
  422. LeakCheckResultList = new ObservableCollection<PMLeakCheckResult>(AllLeakCheckDa);
  423. }
  424. m_firstLoad=false;
  425. }
  426. }
  427. private void OnHome(object obj)
  428. {
  429. InvokeClient.Instance.Service.DoOperation($"{obj.ToString()}.Home");
  430. }
  431. private void OnRobotHome()
  432. {
  433. InvokeClient.Instance.Service.DoOperation($"{m_ModuleCheckedName}.RobotHome");
  434. }
  435. private void OnVent(object obj)
  436. {
  437. InvokeClient.Instance.Service.DoOperation($"{obj}.{RtOperation.Vent}");
  438. }
  439. private void OnPump(object obj)
  440. {
  441. InvokeClient.Instance.Service.DoOperation($"{obj}.{RtOperation.Pump}");
  442. }
  443. private void OnPurge(object obj)
  444. {
  445. InvokeClient.Instance.Service.DoOperation($"{obj}.{RtOperation.Purge}");
  446. }
  447. private void OnLeakCheck()
  448. {
  449. InvokeClient.Instance.Service.DoOperation($"{m_ModuleCheckedName}.{RtOperation.LeakCheck}");
  450. }
  451. private void OnAbort(object obj)
  452. {
  453. InvokeClient.Instance.Service.DoOperation($"{obj}.{RtOperation.Abort}");
  454. }
  455. //private void OnModuleChecked(object obj)
  456. //{
  457. // m_ModuleCheckedName = obj.ToString();
  458. //}
  459. private void OnControlValve(object obj)
  460. {
  461. CommonValveControl commonValveControl = (CommonValveControl)obj;
  462. if (commonValveControl.IsCanEdit == true)
  463. {
  464. InvokeClient.Instance.Service.DoOperation($"TM.{commonValveControl.Tag.ToString()}.{AITValveOperation.GVTurnValve}", !commonValveControl.Status);
  465. string operation = commonValveControl.Status ? "关闭" : "打开";
  466. LOG.Info($"{ModuleName.TM},{operation}{commonValveControl.Tag.ToString()}");
  467. }
  468. }
  469. private void OnOpenPump(object obj)
  470. {
  471. InvokeClient.Instance.Service.DoOperation($"{obj}.ControlPump", true);
  472. }
  473. private void OnClosePump(object obj)
  474. {
  475. InvokeClient.Instance.Service.DoOperation($"{obj}.ControlPump", false);
  476. }
  477. //private void OnOpenLLPump()
  478. //{
  479. // InvokeClient.Instance.Service.DoOperation("LL.ControlPump", true);
  480. //}
  481. //private void OnCloseLLPump()
  482. //{
  483. // InvokeClient.Instance.Service.DoOperation("LL.ControlPump", false);
  484. //}
  485. private void OnDoorUpDown(object obj)
  486. {
  487. InvokeClient.Instance.Service.DoOperation(obj.ToString());
  488. }
  489. private void OnChamberDoorOpen(object obj)
  490. {
  491. InvokeClient.Instance.Service.DoOperation($"{obj?.ToString()}.SlitDoor.Open");
  492. }
  493. private void OnChamberDoorClose(object obj)
  494. {
  495. InvokeClient.Instance.Service.DoOperation($"{obj?.ToString()}.SlitDoor.Close");
  496. }
  497. private void OnSetTMChamberPressure(object obj)
  498. {
  499. if (CommonFunction.GetValue<bool>(RtDataValues, $"{obj}.IsEnableControlPressure"))
  500. {
  501. InvokeClient.Instance.Service.DoOperation($"{obj}.{RtOperation.AbortControlPressure}");
  502. }
  503. else
  504. {
  505. InvokeClient.Instance.Service.DoOperation($"{obj}.{RtOperation.ControlPressure}");
  506. }
  507. }
  508. private void OnOnline(object obj)
  509. {
  510. InvokeClient.Instance.Service.DoOperation($"{obj.ToString()}.{RtOperation.Online}");
  511. }
  512. private void OnOffline(object obj)
  513. {
  514. InvokeClient.Instance.Service.DoOperation($"{obj.ToString()}.{RtOperation.Offline}");
  515. }
  516. #endregion
  517. #region 私有方法
  518. void timer_Tick(object sender, EventArgs e)
  519. {
  520. TMOutChamberPressure = (int)QueryDataClient.Instance.Service.GetConfig("TM.ControlPressureSetPoint");
  521. RtDataValues = QueryDataClient.Instance.Service.PollData(m_RtDataKeys);
  522. if (RtDataValues == null)
  523. {
  524. return;
  525. }
  526. TMValveN2IsOpen = CommonFunction.GetValue<bool>(RtDataValues, "TM.TMValveN2.IsOpen");
  527. TMSoftPumpValveIsOpen = CommonFunction.GetValue<bool>(RtDataValues, "TM.TMSoftPumpValve.IsOpen"); ;
  528. TMFastPumpValveIsOpen = CommonFunction.GetValue<bool>(RtDataValues, "TM.TMFastPumpValve.IsOpen"); ;
  529. //TMPurgeValveIsOpen = CommonFunction.GetValue<bool>(RtDataValues, "TM.TMPurgeValve.IsOpen"); ;
  530. TMSoftVentValveIsOpen = CommonFunction.GetValue<bool>(RtDataValues, "TM.TMPurgeValve.IsOpen"); ;
  531. TMFastVentValveIsOpen = CommonFunction.GetValue<bool>(RtDataValues, "TM.TMVentValve.IsOpen"); ;
  532. LLASoftPumpValveIsOpen = CommonFunction.GetValue<bool>(RtDataValues, "TM.LLASoftPumpValve.IsOpen");
  533. LLAFastPumpValveIsOpen = CommonFunction.GetValue<bool>(RtDataValues, "TM.LLAFastPumpValve.IsOpen");
  534. LLAPurgeValveIsOpen = CommonFunction.GetValue<bool>(RtDataValues, "TM.LLAPurgeValve.IsOpen");
  535. LLAVentValveIsOpen = CommonFunction.GetValue<bool>(RtDataValues, "TM.LLAVentValve.IsOpen");
  536. LLBSoftPumpValveIsOpen = CommonFunction.GetValue<bool>(RtDataValues, "TM.LLBSoftPumpValve.IsOpen");
  537. LLBFastPumpValveIsOpen = CommonFunction.GetValue<bool>(RtDataValues, "TM.LLBFastPumpValve.IsOpen");
  538. LLBPurgeValveIsOpen = CommonFunction.GetValue<bool>(RtDataValues, "TM.LLBPurgeValve.IsOpen");
  539. LLBVentValveIsOpen = CommonFunction.GetValue<bool>(RtDataValues, "TM.LLBVentValve.IsOpen");
  540. LLAVentExhaustValveIsOpen= CommonFunction.GetValue<bool>(RtDataValues, "TM.LLAVentExhaustValve.IsOpen");
  541. LLBVentExhaustValveIsOpen = CommonFunction.GetValue<bool>(RtDataValues, "TM.LLBVentExhaustValve.IsOpen");
  542. TMVentExhaustValveIsOpen = CommonFunction.GetValue<bool>(RtDataValues, "TM.TMVentExhaustValve.IsOpen");
  543. //IsOFFline = !CommonFunction.GetValue<bool>(RtDataValues, $"{m_ModuleCheckedName}.IsOnline");
  544. TMIsOFFline = !CommonFunction.GetValue<bool>(RtDataValues, $"TM.IsOnline");
  545. LLAIsOFFline = !CommonFunction.GetValue<bool>(RtDataValues, $"LLA.IsOnline");
  546. LLBIsOFFline = !CommonFunction.GetValue<bool>(RtDataValues, $"LLB.IsOnline");
  547. TMCurrentState = (TMState)(Enum.Parse(typeof(TMState), RtDataValues[$"TM.FsmState"].ToString()));
  548. LLACurrentState = (LLState)(Enum.Parse(typeof(LLState), RtDataValues[$"LLA.FsmState"].ToString()));
  549. LLBCurrentState = (LLState)(Enum.Parse(typeof(LLState), RtDataValues[$"LLB.FsmState"].ToString()));
  550. TMIsHoming = TMCurrentState == TMState.Initializing || (TMState)(Enum.Parse(typeof(TMState), RtDataValues[$"TM.FsmState"].ToString())) == TMState.InitializingRB;
  551. //if (m_TMOperationView != null)
  552. //{
  553. // m_TMOperationView.stepBar.Progress = CommonFunction.GetValue<int>(RtDataValues, "TM.Home.StepNo");
  554. //}
  555. }
  556. private void addDataKeys()
  557. {
  558. m_RtDataKeys.Add($"TM.TMValveN2.IsOpen");
  559. m_RtDataKeys.Add($"TM.TMSoftPumpValve.IsOpen");
  560. m_RtDataKeys.Add($"TM.TMFastPumpValve.IsOpen");
  561. m_RtDataKeys.Add($"TM.TMPurgeValve.IsOpen");
  562. //m_RtDataKeys.Add($"TM.TMSoftVentValve.IsOpen");
  563. m_RtDataKeys.Add($"TM.TMVentValve.IsOpen");
  564. m_RtDataKeys.Add($"TM.LLASoftPumpValve.IsOpen");
  565. m_RtDataKeys.Add($"TM.LLAFastPumpValve.IsOpen");
  566. m_RtDataKeys.Add($"TM.LLAPurgeValve.IsOpen");
  567. m_RtDataKeys.Add($"TM.LLBPurgeValve.IsOpen");
  568. m_RtDataKeys.Add($"TM.LLAVentValve.IsOpen");
  569. m_RtDataKeys.Add($"TM.LLBVentValve.IsOpen");
  570. m_RtDataKeys.Add($"TM.LLBSoftPumpValve.IsOpen");
  571. m_RtDataKeys.Add($"TM.LLBFastPumpValve.IsOpen");
  572. m_RtDataKeys.Add($"TM.TMVentExhaustValve.IsOpen");
  573. m_RtDataKeys.Add($"TM.LLAVentExhaustValve.IsOpen");
  574. m_RtDataKeys.Add($"TM.LLBVentExhaustValve.IsOpen");
  575. m_RtDataKeys.Add($"TM.IoSensor.TMVacSwitch.Value");
  576. m_RtDataKeys.Add($"TM.IoSensor.LLAVacSwitch.Value");
  577. m_RtDataKeys.Add($"TM.IoSensor.LLBVacSwitch.Value");
  578. m_RtDataKeys.Add($"TM.IoSensor.TMATMSwitch.Value");
  579. m_RtDataKeys.Add($"TM.IoSensor.LLAATMSwitch.Value");
  580. m_RtDataKeys.Add($"TM.IoSensor.LLBATMSwitch.Value");
  581. m_RtDataKeys.Add($"TM.TMProcessGauge.Value");
  582. m_RtDataKeys.Add($"TM.TMForelineGauge.Value");
  583. m_RtDataKeys.Add($"TM.LLAPressureGauge.Value");
  584. m_RtDataKeys.Add($"TM.LLBPressureGauge.Value");
  585. m_RtDataKeys.Add($"TM.LLAForelineGauge.Value");
  586. m_RtDataKeys.Add($"TM.LLBForelineGauge.Value");
  587. m_RtDataKeys.Add($"TM.PumpIsRunning");
  588. m_RtDataKeys.Add($"LLA.PumpIsRunning");
  589. m_RtDataKeys.Add($"LLB.PumpIsRunning");
  590. m_RtDataKeys.Add("PMA.IsSlitDoorClosed");
  591. m_RtDataKeys.Add("PMB.IsSlitDoorClosed");
  592. m_RtDataKeys.Add("PMC.IsSlitDoorClosed");
  593. m_RtDataKeys.Add("PMD.IsSlitDoorClosed");
  594. m_RtDataKeys.Add("TM.LLATSlitDoor.IsClosed");
  595. m_RtDataKeys.Add("TM.LLBTSlitDoor.IsClosed");
  596. m_RtDataKeys.Add("TM.LLAESlitDoor.IsClosed");
  597. m_RtDataKeys.Add("TM.LLBESlitDoor.IsClosed");
  598. m_RtDataKeys.Add("TM.IoSensor.N2PressureSwitch.Value");
  599. m_RtDataKeys.Add("TM.TMPressureCtrl.TMChamberSetPoint");
  600. m_RtDataKeys.Add("TM.TMPressureCtrl.LLAChamberSetPoint");
  601. m_RtDataKeys.Add("TM.TMPressureCtrl.LLBChamberSetPoint");
  602. m_RtDataKeys.Add("LLA.IsOnline");
  603. m_RtDataKeys.Add("LLB.IsOnline");
  604. m_RtDataKeys.Add("TM.IsOnline");
  605. m_RtDataKeys.Add("TM.FsmState");
  606. m_RtDataKeys.Add("LLA.FsmState");
  607. m_RtDataKeys.Add("LLB.FsmState");
  608. m_RtDataKeys.Add("TM.Home.StepNo");
  609. m_RtDataKeys.Add("TM.PMASlitDoor.IsClosed");
  610. m_RtDataKeys.Add("TM.PMBSlitDoor.IsClosed");
  611. m_RtDataKeys.Add("TM.PMCSlitDoor.IsClosed");
  612. m_RtDataKeys.Add("TM.PMDSlitDoor.IsClosed");
  613. m_RtDataKeys.Add("LLA.IsEnableControlPressure");
  614. m_RtDataKeys.Add("LLB.IsEnableControlPressure");
  615. }
  616. public void EnterExitView(bool isEnter)
  617. {
  618. if (isEnter)
  619. {
  620. timer_Tick(null, null);
  621. timer.Start();
  622. }
  623. else
  624. {
  625. timer.Stop();
  626. }
  627. }
  628. #endregion
  629. }
  630. }