GasPanelViewModel.cs 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122
  1. using Aitex.Core.Common.DeviceData;
  2. using Aitex.Core.RT.Log;
  3. using Aitex.Core.UI.ControlDataContext;
  4. using Aitex.Core.UI.MVVM;
  5. using Aitex.Core.Util;
  6. using MECF.Framework.Common.DataCenter;
  7. using MECF.Framework.Common.OperationCenter;
  8. using System;
  9. using System.Collections.Generic;
  10. using System.Linq;
  11. using System.Reflection;
  12. using System.Text;
  13. using System.Threading.Tasks;
  14. using System.Windows;
  15. using System.Windows.Input;
  16. using FurnaceGasPanelUI.Models;
  17. using MECF.Framework.UI.Core.Control;
  18. using static System.Windows.Forms.VisualStyles.VisualStyleElement.Window;
  19. using Aitex.Core.UI.Control;
  20. using OpenSEMI.ClientBase;
  21. using Aitex.Core.UI.DeviceControl;
  22. using MECF.Framework.UI.Core.ExtendedControls;
  23. namespace FurnaceGasPanelUI.Views.Maintenances
  24. {
  25. public class GasPanelViewModel : ThermalGasPanelUIViewModelBase
  26. {
  27. public ICommand CmdSetMfcFlow { get; set; }
  28. public bool _ismanagerPermission = true;
  29. public Window WinOwner { get; set; }
  30. public bool IsManagerPermission
  31. {
  32. get
  33. {
  34. return _ismanagerPermission;
  35. }
  36. set
  37. {
  38. _ismanagerPermission = value;
  39. NotifyOfPropertyChange("IsManagerPermission");
  40. }
  41. }
  42. private bool _isRecipeEdit = false;
  43. public bool ManualEnable { get; set; } = true;
  44. public string ManualEnableColor
  45. {
  46. get
  47. {
  48. if (ManualEnable)
  49. {
  50. return "Green";
  51. }
  52. return "#FFB0D1F1";
  53. }
  54. }
  55. public void SwichManualEnable()
  56. {
  57. ManualEnable = true;
  58. }
  59. public void SwichMonitor()
  60. {
  61. ManualEnable = false;
  62. }
  63. public void SwichRecipe()
  64. {
  65. IsRecipeEdit = true;
  66. }
  67. public bool MonitorChecked { get; set; } = true;
  68. public bool ManualChecked { get; set; } = false;
  69. public bool IsRecipeEdit
  70. {
  71. get
  72. {
  73. return _isRecipeEdit;
  74. }
  75. set
  76. {
  77. _isRecipeEdit = value;
  78. NotifyOfPropertyChange("IsRecipeEdit");
  79. }
  80. }
  81. public bool EditTrue { get; set; } = false;
  82. [Subscription("PM1.SensorRecipeOK")]
  83. public AITSensorData SensorRecipeOK { get; set; }
  84. [Subscription("PM1.SensorPROCManualOK")]
  85. public AITSensorData SensorPROCManualOK { get; set; }
  86. [Subscription("System.VentValve.DeviceData")]
  87. public AITValveData VentValveData { get; set; }
  88. [Subscription("System.PumpValve.DeviceData")]
  89. public AITValveData PumpValveData { get; set; }
  90. [Subscription("PM1.SensorTubeATMPressure.DeviceData")]
  91. public AITSensorData SensorTubeATMPressure { get; set; }
  92. [Subscription("System.TubePressure.DeviceData")]
  93. public AITPressureMeterData TubePressureData { get; set; }
  94. [Subscription("PM1.SensorVAC1.Value")]
  95. public bool VAC1 { get; set; }
  96. [Subscription("PM1.SensorVAC2.Value")]
  97. public bool VAC2 { get; set; }
  98. [Subscription("PM1.SensorVAC3.Value")]
  99. public bool VAC3 { get; set; }
  100. #region Valves
  101. [Subscription("PM1.ValveAV1.DeviceData")]
  102. public AITValveData ValveAV1 { get; set; }
  103. [Subscription("PM1.ValveAV2.DeviceData")]
  104. public AITValveData ValveAV2 { get; set; }
  105. [Subscription("PM1.ValveAV3.DeviceData")]
  106. public AITValveData ValveAV3 { get; set; }
  107. [Subscription("PM1.ValveAV4.DeviceData")]
  108. public AITValveData ValveAV4 { get; set; }
  109. [Subscription("PM1.ValveAV5.DeviceData")]
  110. public AITValveData ValveAV5 { get; set; }
  111. [Subscription("PM1.ValveAV6.DeviceData")]
  112. public AITValveData ValveAV6 { get; set; }
  113. [Subscription("PM1.ValveAV7.DeviceData")]
  114. public AITValveData ValveAV7 { get; set; }
  115. [Subscription("PM1.ValveAV8.DeviceData")]
  116. public AITValveData ValveAV8 { get; set; }
  117. [Subscription("PM1.ValveAV9.DeviceData")]
  118. public AITValveData ValveAV9 { get; set; }
  119. [Subscription("PM1.ValveAV10.DeviceData")]
  120. public AITValveData ValveAV10 { get; set; }
  121. [Subscription("PM1.ValveAV11.DeviceData")]
  122. public AITValveData ValveAV11 { get; set; }
  123. [Subscription("PM1.ValveAV12.DeviceData")]
  124. public AITValveData ValveAV12 { get; set; }
  125. [Subscription("PM1.ValveAV13.DeviceData")]
  126. public AITValveData ValveAV13 { get; set; }
  127. [Subscription("PM1.ValveAV14.DeviceData")]
  128. public AITValveData ValveAV14 { get; set; }
  129. [Subscription("PM1.ValveAV15.DeviceData")]
  130. public AITValveData ValveAV15 { get; set; }
  131. [Subscription("PM1.ValveAV16.DeviceData")]
  132. public AITValveData ValveAV16 { get; set; }
  133. [Subscription("PM1.ValveAV17.DeviceData")]
  134. public AITValveData ValveAV17 { get; set; }
  135. [Subscription("PM1.ValveAV18.DeviceData")]
  136. public AITValveData ValveAV18 { get; set; }
  137. [Subscription("PM1.ValveAV19.DeviceData")]
  138. public AITValveData ValveAV19 { get; set; }
  139. [Subscription("PM1.ValveAV20.DeviceData")]
  140. public AITValveData ValveAV20 { get; set; }
  141. [Subscription("PM1.ValveAV21.DeviceData")]
  142. public AITValveData ValveAV21 { get; set; }
  143. [Subscription("PM1.ValveAV22.DeviceData")]
  144. public AITValveData ValveAV22 { get; set; }
  145. [Subscription("PM1.ValveAV23.DeviceData")]
  146. public AITValveData ValveAV23 { get; set; }
  147. [Subscription("PM1.ValveAV24.DeviceData")]
  148. public AITValveData ValveAV24 { get; set; }
  149. [Subscription("PM1.ValveAV25.DeviceData")]
  150. public AITValveData ValveAV25 { get; set; }
  151. [Subscription("PM1.ValveAV26.DeviceData")]
  152. public AITValveData ValveAV26 { get; set; }
  153. [Subscription("PM1.ValveAV27.DeviceData")]
  154. public AITValveData ValveAV27 { get; set; }
  155. [Subscription("PM1.ValveAV28.DeviceData")]
  156. public AITValveData ValveAV28 { get; set; }
  157. [Subscription("PM1.ValveAV29.DeviceData")]
  158. public AITValveData ValveAV29 { get; set; }
  159. [Subscription("PM1.ValveAV30.DeviceData")]
  160. public AITValveData ValveAV30 { get; set; }
  161. [Subscription("PM1.ValveAV31.DeviceData")]
  162. public AITValveData ValveAV31 { get; set; }
  163. [Subscription("PM1.ValveAV32.DeviceData")]
  164. public AITValveData ValveAV32 { get; set; }
  165. [Subscription("PM1.ValveAV33.DeviceData")]
  166. public AITValveData ValveAV33 { get; set; }
  167. [Subscription("PM1.ValveAV34.DeviceData")]
  168. public AITValveData ValveAV34 { get; set; }
  169. [Subscription("PM1.ValveAV35.DeviceData")]
  170. public AITValveData ValveAV35 { get; set; }
  171. [Subscription("PM1.ValveAV36.DeviceData")]
  172. public AITValveData ValveAV36 { get; set; }
  173. [Subscription("PM1.ValveAV37.DeviceData")]
  174. public AITValveData ValveAV37 { get; set; }
  175. [Subscription("PM1.ValveAV38.DeviceData")]
  176. public AITValveData ValveAV38 { get; set; }
  177. [Subscription("PM1.ValveAV39.DeviceData")]
  178. public AITValveData ValveAV39 { get; set; }
  179. [Subscription("PM1.ValveAV52.DeviceData")]
  180. public AITValveData ValveAV52 { get; set; }
  181. [Subscription("PM1.ValveAV54.DeviceData")]
  182. public AITValveData ValveAV54 { get; set; }
  183. [Subscription("PM1.ValveAV56.DeviceData")]
  184. public AITValveData ValveAV56 { get; set; }
  185. [Subscription("PM1.ValveAV57.DeviceData")]
  186. public AITValveData ValveAV57 { get; set; }
  187. [Subscription("PM1.ValveAV58.DeviceData")]
  188. public AITValveData ValveAV58 { get; set; }
  189. [Subscription("PM1.ValveAV59.DeviceData")]
  190. public AITValveData ValveAV59 { get; set; }
  191. [Subscription("PM1.ValveAV60.DeviceData")]
  192. public AITValveData ValveAV60 { get; set; }
  193. [Subscription("PM1.ValveFIMS1N2Purge.DeviceData")]
  194. public AITValveData ValveAV63 { get; set; }
  195. [Subscription("PM1.ValveFIMS2N2Purge.DeviceData")]
  196. public AITValveData ValveAV64 { get; set; }
  197. [Subscription("PM1.ValveAV65.DeviceData")]
  198. public AITValveData ValveAV65 { get; set; }
  199. [Subscription("PM1.ValveAV66.DeviceData")]
  200. public AITValveData ValveAV66 { get; set; }
  201. [Subscription("PM1.ValveAV68.DeviceData")]
  202. public AITValveData ValveAV68 { get; set; }
  203. [Subscription("PM1.ValveAV71.DeviceData")]
  204. public AITValveData ValveAV71 { get; set; }
  205. [Subscription("PM1.ValveAV72.DeviceData")]
  206. public AITValveData ValveAV72 { get; set; }
  207. [Subscription("PM1.ValveAV73.DeviceData")]
  208. public AITValveData ValveAV73 { get; set; }
  209. [Subscription("PM1.ValveAV74.DeviceData")]
  210. public AITValveData ValveAV74 { get; set; }
  211. [Subscription("PM1.ValveAV75.DeviceData")]
  212. public AITValveData ValveAV75 { get; set; }
  213. [Subscription("PM1.ValveAV77.DeviceData")]
  214. public AITValveData ValveAV77 { get; set; }
  215. [Subscription("PM1.ValveAV81.DeviceData")]
  216. public AITValveData ValveAV81 { get; set; }
  217. [Subscription("PM1.ValveAV82.DeviceData")]
  218. public AITValveData ValveAV82 { get; set; }
  219. [Subscription("PM1.ValveAV83.DeviceData")]
  220. public AITValveData ValveAV83 { get; set; }
  221. [Subscription("PM1.ValveAV91.DeviceData")]
  222. public AITValveData ValveDPR { get; set; }
  223. public string ValveDPRBrush
  224. {
  225. get
  226. {
  227. if (ValveDPR != null && ValveDPR.Feedback)
  228. {
  229. return "Green";
  230. }
  231. return "#FFB0D1F1";
  232. }
  233. }
  234. [Subscription("PM1.ValveBlowerPowerOn.DeviceData")]
  235. public AITValveData ValveBWR { get; set; }
  236. public string ValveBWRBrush
  237. {
  238. get
  239. {
  240. if (ValveBWR != null && ValveBWR.Feedback)
  241. {
  242. return "Green";
  243. }
  244. return "#FFB0D1F1";
  245. }
  246. }
  247. [Subscription("PM1.IsF2ClnOn")]
  248. public bool IsF2ClnOn { get; set; }
  249. public string F2ClnBrush
  250. {
  251. get
  252. {
  253. if (IsF2ClnOn)
  254. {
  255. return "Green";
  256. }
  257. return "#FFB0D1F1";
  258. }
  259. }
  260. [Subscription("PM1.IsHFClnOn")]
  261. public bool IsHFClnOn { get; set; }
  262. public string HFClnBrush
  263. {
  264. get
  265. {
  266. if (IsHFClnOn)
  267. {
  268. return "Green";
  269. }
  270. return "#FFB0D1F1";
  271. }
  272. }
  273. [Subscription("PM1.HTR1Enable")]
  274. public bool IsHTR1Enable { get; set; }
  275. public string HTR1Brush
  276. {
  277. get
  278. {
  279. if (IsHTR1Enable)
  280. {
  281. return "Green";
  282. }
  283. return "#FFB0D1F1";
  284. }
  285. }
  286. [Subscription("PM1.HTR2Enable")]
  287. public bool IsHTR2Enable { get; set; }
  288. public string HTR2Brush
  289. {
  290. get
  291. {
  292. if (IsHTR2Enable)
  293. {
  294. return "Green";
  295. }
  296. return "#FFB0D1F1";
  297. }
  298. }
  299. [Subscription("PM1.AUCPump.DeviceData")]
  300. public AITValveData AUCPump { get; set; }
  301. public string AUCPumpBrush
  302. {
  303. get
  304. {
  305. if(AUCPump!=null&& AUCPump.Feedback)
  306. {
  307. return "Green";
  308. }
  309. return "#FFB0D1F1";
  310. }
  311. }
  312. [Subscription("PM1.BothPump.DeviceData")]
  313. public AITValveData BothPump { get; set; }
  314. public string BothPumpBrush
  315. {
  316. get
  317. {
  318. if (BothPump != null && BothPump.Feedback)
  319. {
  320. return "Green";
  321. }
  322. return "#FFB0D1F1";
  323. }
  324. }
  325. [Subscription("PM1.AGVPump.DeviceData")]
  326. public AITValveData AGVPump { get; set; }
  327. public string AGVPumpBrush
  328. {
  329. get
  330. {
  331. if (AGVPump != null && AGVPump.Feedback)
  332. {
  333. return "Green";
  334. }
  335. return "#FFB0D1F1";
  336. }
  337. }
  338. #endregion
  339. #region MFCs
  340. [Subscription("PM1.MFC1.DeviceData")]
  341. public AITMfcData MFC1Data { get; set; }
  342. [Subscription("PM1.MFC2.DeviceData")]
  343. public AITMfcData MFC2Data { get; set; }
  344. [Subscription("PM1.MFC3.DeviceData")]
  345. public AITMfcData MFC3Data { get; set; }
  346. [Subscription("PM1.MFC4.DeviceData")]
  347. public AITMfcData MFC4Data { get; set; }
  348. [Subscription("PM1.MFC5.DeviceData")]
  349. public AITMfcData MFC5Data { get; set; }
  350. [Subscription("PM1.MFC6.DeviceData")]
  351. public AITMfcData MFC6Data { get; set; }
  352. [Subscription("PM1.MFC7.DeviceData")]
  353. public AITMfcData MFC7Data { get; set; }
  354. [Subscription("PM1.MFC8.DeviceData")]
  355. public AITMfcData MFC8Data { get; set; }
  356. [Subscription("PM1.MFC9.DeviceData")]
  357. public AITMfcData MFC9Data { get; set; }
  358. [Subscription("PM1.MFC10.DeviceData")]
  359. public AITMfcData MFC10Data { get; set; }
  360. [Subscription("PM1.MFC11.DeviceData")]
  361. public AITMfcData MFC11Data { get; set; }
  362. [Subscription("PM1.MFC12.DeviceData")]
  363. public AITMfcData MFC12Data { get; set; }
  364. [Subscription("PM1.MFC51.DeviceData")]
  365. public AITMfcData MFC51Data { get; set; }
  366. #endregion
  367. [Subscription("PM1.MFM57.DeviceData")]
  368. public AITWaterFlowMeterData MFM57Flow { get; set; }
  369. [Subscription("PM1.RfPower.IsPowerOn")]
  370. public bool IsPowerOn { get; set; }
  371. [Subscription("PM1.RfPower.PowerSetPoint")]
  372. public float PowerSetPoint { get; set; }
  373. [Subscription("PM1.RfPower.ForwardPower")]
  374. public float ForwardPower { get; set; }
  375. [Subscription("PM1.RfMatch.Capacitance1PositionFeedBack")]
  376. public float Capacitance1PositionFeedBack { get; set; }
  377. [Subscription("PM1.RfMatch.Capacitance2PositionFeedBack")]
  378. public float Capacitance2PositionFeedBack { get; set; }
  379. [Subscription("PM1.RfMatch.VppFeedBack")]
  380. public float VppFeedBack { get; set; }
  381. public ICommand CmdSetValve { get; set; }
  382. private GasPanelStateType _selectedGasStateType = GasPanelStateType.Monitor;
  383. public GasPanelStateType SelectedGasStateType
  384. {
  385. get
  386. {
  387. return _selectedGasStateType;
  388. }
  389. set
  390. {
  391. _selectedGasStateType = value;
  392. NotifyOfPropertyChange(nameof(SelectedGasStateType));
  393. }
  394. }
  395. public AnalogDeviceDataItem MFC1
  396. {
  397. get
  398. {
  399. return new AnalogDeviceDataItem
  400. {
  401. Type = "MFC",
  402. DeviceName = MFC1Data.UniqueName,
  403. DeviceId = MFC1Data.DeviceSchematicId,
  404. DisplayName = MFC1Data.DisplayName,
  405. Scale = MFC1Data.Scale,
  406. Unit = MFC1Data.Unit,
  407. FeedBack = MFC1Data.FeedBack,
  408. SetPoint = MFC1Data.SetPoint,
  409. VirtualFeedBack= MFC1Data.VirtualFeedBack
  410. };
  411. }
  412. }
  413. public AnalogDeviceDataItem MFC2
  414. {
  415. get
  416. {
  417. return new AnalogDeviceDataItem
  418. {
  419. Type = "MFC",
  420. DeviceName = MFC2Data.UniqueName,
  421. DeviceId = MFC2Data.DeviceSchematicId,
  422. DisplayName = MFC2Data.DisplayName,
  423. Scale = MFC2Data.Scale,
  424. Unit = MFC2Data.Unit,
  425. FeedBack = MFC2Data.FeedBack,
  426. SetPoint = MFC2Data.SetPoint,
  427. VirtualFeedBack = MFC2Data.VirtualFeedBack
  428. };
  429. }
  430. }
  431. public AnalogDeviceDataItem MFC3
  432. {
  433. get
  434. {
  435. return new AnalogDeviceDataItem
  436. {
  437. Type = "MFC",
  438. DeviceName = MFC3Data.UniqueName,
  439. DeviceId = MFC3Data.DeviceSchematicId,
  440. DisplayName = MFC3Data.DisplayName,
  441. Scale = MFC3Data.Scale,
  442. Unit = MFC3Data.Unit,
  443. FeedBack = MFC3Data.FeedBack,
  444. SetPoint = MFC3Data.SetPoint,
  445. VirtualFeedBack = MFC3Data.VirtualFeedBack
  446. };
  447. }
  448. }
  449. public AnalogDeviceDataItem MFC4
  450. {
  451. get
  452. {
  453. return new AnalogDeviceDataItem
  454. {
  455. Type = "MFC",
  456. DeviceName = MFC4Data.UniqueName,
  457. DeviceId = MFC4Data.DeviceSchematicId,
  458. DisplayName = MFC4Data.DisplayName,
  459. Scale = MFC4Data.Scale,
  460. Unit = MFC4Data.Unit,
  461. FeedBack = MFC4Data.FeedBack,
  462. SetPoint = MFC4Data.SetPoint,
  463. VirtualFeedBack = MFC4Data.VirtualFeedBack
  464. };
  465. }
  466. }
  467. public AnalogDeviceDataItem MFC5
  468. {
  469. get
  470. {
  471. return new AnalogDeviceDataItem
  472. {
  473. Type = "MFC",
  474. DeviceName = MFC5Data.UniqueName,
  475. DeviceId = MFC5Data.DeviceSchematicId,
  476. DisplayName = MFC5Data.DisplayName,
  477. Scale = MFC5Data.Scale,
  478. Unit = MFC5Data.Unit,
  479. FeedBack = MFC5Data.FeedBack,
  480. SetPoint = MFC5Data.SetPoint,
  481. VirtualFeedBack = MFC5Data.VirtualFeedBack
  482. };
  483. }
  484. }
  485. public AnalogDeviceDataItem MFC6
  486. {
  487. get
  488. {
  489. return new AnalogDeviceDataItem
  490. {
  491. Type = "MFC",
  492. DeviceName = MFC6Data.UniqueName,
  493. DeviceId = MFC6Data.DeviceSchematicId,
  494. DisplayName = MFC6Data.DisplayName,
  495. Scale = MFC6Data.Scale,
  496. Unit = MFC6Data.Unit,
  497. FeedBack = MFC6Data.FeedBack,
  498. SetPoint = MFC6Data.SetPoint,
  499. VirtualFeedBack = MFC6Data.VirtualFeedBack
  500. };
  501. }
  502. }
  503. public AnalogDeviceDataItem MFC7
  504. {
  505. get
  506. {
  507. return new AnalogDeviceDataItem
  508. {
  509. Type = "MFC",
  510. DeviceName = MFC7Data.UniqueName,
  511. DeviceId = MFC7Data.DeviceSchematicId,
  512. DisplayName = MFC7Data.DisplayName,
  513. Scale = MFC7Data.Scale,
  514. Unit = MFC7Data.Unit,
  515. FeedBack = MFC7Data.FeedBack,
  516. SetPoint = MFC7Data.SetPoint,
  517. VirtualFeedBack = MFC7Data.VirtualFeedBack
  518. };
  519. }
  520. }
  521. public AnalogDeviceDataItem MFC8
  522. {
  523. get
  524. {
  525. return new AnalogDeviceDataItem
  526. {
  527. Type = "MFC",
  528. DeviceName = MFC8Data.UniqueName,
  529. DeviceId = MFC8Data.DeviceSchematicId,
  530. DisplayName = MFC8Data.DisplayName,
  531. Scale = MFC8Data.Scale,
  532. Unit = MFC8Data.Unit,
  533. FeedBack = MFC8Data.FeedBack,
  534. SetPoint = MFC8Data.SetPoint,
  535. VirtualFeedBack = MFC8Data.VirtualFeedBack
  536. };
  537. }
  538. }
  539. public AnalogDeviceDataItem MFC9
  540. {
  541. get
  542. {
  543. return new AnalogDeviceDataItem
  544. {
  545. Type = "MFC",
  546. DeviceName = MFC9Data.UniqueName,
  547. DeviceId = MFC9Data.DeviceSchematicId,
  548. DisplayName = MFC9Data.DisplayName,
  549. Scale = MFC9Data.Scale,
  550. Unit = MFC9Data.Unit,
  551. FeedBack = MFC9Data.FeedBack,
  552. SetPoint = MFC9Data.SetPoint,
  553. VirtualFeedBack = MFC9Data.VirtualFeedBack
  554. };
  555. }
  556. }
  557. public AnalogDeviceDataItem MFC10
  558. {
  559. get
  560. {
  561. return new AnalogDeviceDataItem
  562. {
  563. Type = "MFC",
  564. DeviceName = MFC10Data.UniqueName,
  565. DeviceId = MFC10Data.DeviceSchematicId,
  566. DisplayName = MFC10Data.DisplayName,
  567. Scale = MFC10Data.Scale,
  568. Unit = MFC10Data.Unit,
  569. FeedBack = MFC10Data.FeedBack,
  570. SetPoint = MFC10Data.SetPoint,
  571. VirtualFeedBack = MFC10Data.VirtualFeedBack
  572. };
  573. }
  574. }
  575. public AnalogDeviceDataItem MFC11
  576. {
  577. get
  578. {
  579. return new AnalogDeviceDataItem
  580. {
  581. Type = "MFC",
  582. DeviceName = MFC11Data.UniqueName,
  583. DeviceId = MFC11Data.DeviceSchematicId,
  584. DisplayName = MFC11Data.DisplayName,
  585. Scale = MFC11Data.Scale,
  586. Unit = MFC11Data.Unit,
  587. FeedBack = MFC11Data.FeedBack,
  588. SetPoint = MFC11Data.SetPoint,
  589. VirtualFeedBack = MFC11Data.VirtualFeedBack
  590. };
  591. }
  592. }
  593. public AnalogDeviceDataItem MFC12
  594. {
  595. get
  596. {
  597. return new AnalogDeviceDataItem
  598. {
  599. Type = "MFC",
  600. DeviceName = MFC12Data.UniqueName,
  601. DeviceId = MFC12Data.DeviceSchematicId,
  602. DisplayName = MFC12Data.DisplayName,
  603. Scale = MFC12Data.Scale,
  604. Unit = MFC12Data.Unit,
  605. FeedBack = MFC12Data.FeedBack,
  606. SetPoint = MFC12Data.SetPoint,
  607. VirtualFeedBack = MFC12Data.VirtualFeedBack
  608. };
  609. }
  610. }
  611. public AnalogDeviceDataItem MFC51
  612. {
  613. get
  614. {
  615. return new AnalogDeviceDataItem
  616. {
  617. Type = "MFC",
  618. DeviceName = MFC51Data.UniqueName,
  619. DeviceId = MFC51Data.DeviceSchematicId,
  620. DisplayName = MFC51Data.DisplayName,
  621. Scale = MFC51Data.Scale,
  622. Unit = MFC51Data.Unit,
  623. FeedBack = MFC51Data.FeedBack,
  624. SetPoint = MFC51Data.SetPoint,
  625. VirtualFeedBack = MFC51Data.VirtualFeedBack
  626. };
  627. }
  628. }
  629. public AnalogDeviceDataItem MFM57
  630. {
  631. get
  632. {
  633. return new AnalogDeviceDataItem
  634. {
  635. Type = "MFM",
  636. DeviceId = MFM57Flow.DeviceSchematicId,
  637. DisplayName = MFM57Flow.DisplayName,
  638. Scale = MFM57Flow.Scale,
  639. Unit = MFM57Flow.Unit,
  640. FeedBack = MFM57Flow.FeedBack,
  641. SetPoint = MFM57Flow.SetPoint,
  642. };
  643. }
  644. }
  645. public string IsRfPowerOn
  646. {
  647. get
  648. {
  649. return IsPowerOn ? "On" : "Off";
  650. }
  651. }
  652. private bool _manualCheckSelect = false;
  653. private bool _manualCheck = true;
  654. public bool ManualCheck
  655. {
  656. get => _manualCheck;
  657. set
  658. {
  659. _manualCheck = value;
  660. NotifyOfPropertyChange(nameof(ManualCheck));
  661. }
  662. }
  663. private bool _manualCheckHide;
  664. public bool ManumalCheckHide
  665. {
  666. get => _manualCheckHide;
  667. set
  668. {
  669. _manualCheckHide = value;
  670. NotifyOfPropertyChange(nameof(ManumalCheckHide));
  671. }
  672. }
  673. public bool ValveTrue { get; set; } = true;
  674. public bool ValveFalse { get; set; } = false;
  675. private bool _enablePLCPointControl=false;
  676. public bool EnablePLCPointControl
  677. {
  678. get => _enablePLCPointControl;
  679. set
  680. {
  681. _enablePLCPointControl = value;
  682. NotifyOfPropertyChange(nameof(EnablePLCPointControl));
  683. }
  684. }
  685. public GasPanelViewModel()
  686. {
  687. CmdSetMfcFlow = new DelegateCommand<object>(PerformCmdSetMfcFlow);
  688. }
  689. public void SelectedGasStateTypeCmd(string cmd)
  690. {
  691. switch (cmd)
  692. {
  693. case "Manual":
  694. SelectedGasStateType = GasPanelStateType.Manual;
  695. ManualEnable = true;
  696. break;
  697. case "Monitor":
  698. SelectedGasStateType = GasPanelStateType.Monitor;
  699. ManualEnable = true;
  700. break;
  701. case "Recipe":
  702. SelectedGasStateType = GasPanelStateType.Recipe;
  703. ManualEnable = false;
  704. break;
  705. default:
  706. break;
  707. }
  708. }
  709. protected override void OnActivate()
  710. {
  711. base.OnActivate();
  712. // EnableServiceControl = (bool)QueryDataClient.Instance.Service.GetConfig("System.IsServiceControlMode");
  713. // IsMfcNRInstalled = (bool)QueryDataClient.Instance.Service.GetConfig("PM1.MFC.MfcNR.IsMFCInstalled");
  714. }
  715. public void SetEditClick()
  716. {
  717. IsRecipeEdit = true;
  718. // EnableServiceControl = false;
  719. }
  720. protected override void OnDeactivate(bool close)
  721. {
  722. base.OnDeactivate(close);
  723. //IsManagerPermission = false;
  724. }
  725. public void SetManual()
  726. {
  727. if (!_manualCheckSelect)
  728. {
  729. _manualCheckSelect = !_manualCheckSelect;
  730. IsManagerPermission = true;
  731. EnablePLCPointControl = false;
  732. }
  733. else
  734. {
  735. IsManagerPermission = true;
  736. ManualCheck = false;
  737. ManumalCheckHide = true;
  738. _manualCheckSelect = !_manualCheckSelect;
  739. EnablePLCPointControl = true;
  740. }
  741. }
  742. public void OpenAll()
  743. {
  744. if (!VentValveData.IsOpen)
  745. InvokeClient.Instance.Service.DoOperation($"{VentValveData.UniqueName}.{AITValveOperation.GVTurnValve}", true);
  746. if (!PumpValveData.IsOpen)
  747. InvokeClient.Instance.Service.DoOperation($"{PumpValveData.UniqueName}.{AITValveOperation.GVTurnValve}", true);
  748. }
  749. public void CloseAll()
  750. {
  751. if (PumpValveData.IsOpen)
  752. InvokeClient.Instance.Service.DoOperation($"{PumpValveData.UniqueName}.{AITValveOperation.GVTurnValve}", false);
  753. if (VentValveData.IsOpen)
  754. InvokeClient.Instance.Service.DoOperation($"{VentValveData.UniqueName}.{AITValveOperation.GVTurnValve}", false);
  755. }
  756. private void PerformCmdSetMfcFlow(object param)
  757. {
  758. object[] args = (object[])param; //0:devicename, 1:operation, 2:args
  759. if (args.Length == 3)
  760. {
  761. InvokeClient.Instance.Service.DoOperation($"{args[0]}.{args[1]}", args[2]);
  762. }
  763. }
  764. bool isSensorRecipeOK = false;
  765. Dictionary<string, object> oldresult;
  766. private Dictionary<string, object> ClearNotChangedValue(Dictionary<string, object> result)
  767. {
  768. Dictionary<string, object> temp = result;
  769. if (oldresult == null)
  770. {
  771. oldresult = result;
  772. }
  773. else
  774. {
  775. try
  776. {
  777. List<string> strkeys = new List<string>();
  778. foreach (var key in result.Keys)
  779. {
  780. if (_subscribedKeys.Contains(key) && oldresult.ContainsKey(key) && result.ContainsKey(key))
  781. {
  782. if (result[key].GetType() == typeof(AITValveData) && (((AITValveData)oldresult[key]).Feedback != ((AITValveData)result[key]).Feedback
  783. || ((AITValveData)oldresult[key]).VirtualFeedback != ((AITValveData)result[key]).VirtualFeedback))
  784. {
  785. strkeys.Add(key);
  786. }
  787. else if (result[key].GetType() == typeof(AITSensorData) && ((AITSensorData)oldresult[key]).Value != ((AITSensorData)result[key]).Value)
  788. {
  789. strkeys.Add(key);
  790. }
  791. else if (result[key].GetType() == typeof(AITMfcData) && (((AITMfcData)oldresult[key]).FeedBack != ((AITMfcData)result[key]).FeedBack ||
  792. ((AITMfcData)oldresult[key]).VirtualFeedBack != ((AITMfcData)result[key]).VirtualFeedBack))
  793. {
  794. strkeys.Add(key);
  795. }
  796. else if (result[key].GetType() == typeof(float) && (float)oldresult[key] == (float)result[key])
  797. {
  798. strkeys.Add(key);
  799. }
  800. else if (result[key].GetType() == typeof(int) && (int)oldresult[key] == (int)result[key])
  801. {
  802. strkeys.Add(key);
  803. }
  804. else if (result[key].GetType() == typeof(bool) && (bool)oldresult[key] == (bool)result[key])
  805. {
  806. strkeys.Add(key);
  807. }
  808. }
  809. }
  810. for (int i = 0; i < strkeys.Count; i++)
  811. {
  812. temp.Remove(strkeys[i]);
  813. }
  814. }
  815. catch (Exception ex)
  816. {
  817. LOG.Error("由RT返回的数据更新失败" + "ClearNotChangedValue", ex);
  818. }
  819. }
  820. return temp;
  821. }
  822. protected override void Poll()
  823. {
  824. if (_subscribedKeys.Count > 0)
  825. {
  826. Dictionary<string, object> result = QueryDataClient.Instance.Service.PollData(_subscribedKeys);
  827. Dictionary<string, object> Tempresult = new Dictionary<string, object>(result);
  828. result = ClearNotChangedValue(result);
  829. oldresult = Tempresult;
  830. if (result == null)
  831. {
  832. LOG.Error("获取RT数据失败");
  833. return;
  834. }
  835. if (result.Count != _subscribedKeys.Count)
  836. {
  837. string unknowKeys = string.Empty;
  838. foreach (string key in _subscribedKeys)
  839. {
  840. if (!result.ContainsKey(key))
  841. {
  842. unknowKeys += key + "\r\n";
  843. }
  844. }
  845. }
  846. InvokeBeforeUpdateProperty(result);
  847. UpdateValue(result);
  848. Application.Current?.Dispatcher.Invoke(new Action(() =>
  849. {
  850. if (result.Count != 0)
  851. {
  852. InvokePropertyChanged();
  853. }
  854. InvokeAfterUpdateProperty(result);
  855. }));
  856. }
  857. }
  858. protected override void InvokeBeforeUpdateProperty(Dictionary<string, object> data)
  859. {
  860. //List<string> aITValveDataKeys = new List<string>();
  861. //List<string> aITSensorDataKeys = new List<string>();
  862. //List<string> aITMfcDataKeys = new List<string>();
  863. //foreach (var item in data.Keys)
  864. //{
  865. // try
  866. // {
  867. // if (data[item].GetType() == typeof(AITValveData))
  868. // {
  869. // var array = item.Split('.');
  870. // if (array.Length > 1)
  871. // {
  872. // var name = array[1];
  873. // var property = this.GetType().GetProperties().Where(x => x.Name == name).FirstOrDefault();
  874. // object value = property.GetValue(this, null);
  875. // if (value != null && ((AITValveData)value).Equals((AITValveData)data[item]))
  876. // aITValveDataKeys.Add(item);
  877. // }
  878. // }
  879. // else if (data[item].GetType() == typeof(AITSensorData))
  880. // {
  881. // var array = item.Split('.');
  882. // if (array.Length > 1)
  883. // {
  884. // var name = array[1];
  885. // var property = this.GetType().GetProperties().Where(x => x.Name == name).FirstOrDefault();
  886. // object value = property.GetValue(this, null);
  887. // if (value != null && ((AITSensorData)value).Equals((AITSensorData)data[item]))
  888. // aITSensorDataKeys.Add(item);
  889. // }
  890. // }
  891. // else if (data[item].GetType() == typeof(AITMfcData))
  892. // {
  893. // var array = item.Split('.');
  894. // if (array.Length > 1)
  895. // {
  896. // var name = array[1];
  897. // var property = this.GetType().GetProperties().Where(x => x.Name == $"{name}Data").FirstOrDefault();
  898. // object value = property.GetValue(this, null);
  899. // if (value != null && ((AITMfcData)value).Equals((AITMfcData)data[item]))
  900. // aITMfcDataKeys.Add(item);
  901. // }
  902. // }
  903. // }
  904. // catch (Exception ex)
  905. // {
  906. // Console.WriteLine(ex.Message);
  907. // }
  908. //}
  909. //if (aITValveDataKeys.Count > 0)
  910. //{
  911. // foreach (var item in aITValveDataKeys)
  912. // {
  913. // data.Remove(item);
  914. // }
  915. //}
  916. //if (aITSensorDataKeys.Count > 0)
  917. //{
  918. // foreach (var item in aITSensorDataKeys)
  919. // {
  920. // data.Remove(item);
  921. // }
  922. //}
  923. //if (aITMfcDataKeys.Count > 0)
  924. //{
  925. // foreach (var item in aITMfcDataKeys)
  926. // {
  927. // data.Remove(item);
  928. // }
  929. //}
  930. base.InvokeBeforeUpdateProperty(data);
  931. }
  932. protected override void InvokeAfterUpdateProperty(Dictionary<string, object> data)
  933. {
  934. base.InvokeAfterUpdateProperty(data);
  935. if (SensorRecipeOK != null && SensorRecipeOK.Value)
  936. {
  937. if (isSensorRecipeOK != SensorRecipeOK.Value)
  938. {
  939. _manualCheckSelect = false;
  940. IsManagerPermission = true;
  941. IsRecipeEdit = true;
  942. // EnableServiceControl = false;
  943. }
  944. isSensorRecipeOK = SensorRecipeOK.Value;
  945. }
  946. }
  947. public void SwichValue(string name)
  948. {
  949. if (SelectedGasStateType == GasPanelStateType.Monitor || SelectedGasStateType == GasPanelStateType.Recipe) return;
  950. var dialog = new SwitchValueDialog { };
  951. dialog.IsOpen = true;
  952. switch(name.ToUpper())
  953. {
  954. case "BWR":
  955. dialog.IsOpen = ValveBWR.Feedback;
  956. break;
  957. case "DPR":
  958. dialog.IsOpen = ValveDPR.Feedback;
  959. break;
  960. case "F2":
  961. dialog.IsOpen = IsF2ClnOn;
  962. break;
  963. case "HF":
  964. dialog.IsOpen = IsHFClnOn;
  965. break;
  966. }
  967. dialog.Owner = WinOwner;
  968. dialog.Topmost = true;
  969. dialog.WindowStartupLocation = WindowStartupLocation.CenterScreen;
  970. dialog.DeviceName = $"Swich {name}";
  971. dialog.ShowDialog();
  972. if ((bool)dialog.IsSave)
  973. {
  974. switch (name.ToUpper())
  975. {
  976. case "BWR":
  977. InvokeClient.Instance.Service.DoOperation($"{ValveBWR.UniqueName}.{AITValveOperation.GVTurnValve}", dialog.IsOpen);
  978. break;
  979. case "DPR":
  980. InvokeClient.Instance.Service.DoOperation($"{ValveDPR.UniqueName}.{AITValveOperation.GVTurnValve}", dialog.IsOpen);
  981. break;
  982. case "F2":
  983. InvokeClient.Instance.Service.DoOperation($"PM1.SetF2ClnEnable", dialog.IsOpen);
  984. break;
  985. case "HF":
  986. InvokeClient.Instance.Service.DoOperation($"PM1.SetHFClnEnable", dialog.IsOpen);
  987. break;
  988. }
  989. }
  990. }
  991. public void SetEnable(string name)
  992. {
  993. if (SelectedGasStateType == GasPanelStateType.Monitor || SelectedGasStateType == GasPanelStateType.Recipe) return;
  994. var dialog = new SwitchValueDialog2 { };
  995. dialog.IsOpen = true;
  996. switch (name.ToUpper())
  997. {
  998. case "HTR1":
  999. dialog.IsOpen = IsHTR1Enable;
  1000. break;
  1001. case "HTR2":
  1002. dialog.IsOpen = IsHTR2Enable;
  1003. break;
  1004. }
  1005. dialog.Owner = WinOwner;
  1006. dialog.Topmost = true;
  1007. dialog.WindowStartupLocation = WindowStartupLocation.CenterScreen;
  1008. dialog.DeviceName = $"Swich {name}";
  1009. dialog.ShowDialog();
  1010. if ((bool)dialog.IsSave)
  1011. {
  1012. switch (name.ToUpper())
  1013. {
  1014. case "HTR1":
  1015. InvokeClient.Instance.Service.DoOperation($"PM1.SetHTR1Enable", dialog.IsOpen);
  1016. break;
  1017. case "HTR2":
  1018. InvokeClient.Instance.Service.DoOperation($"PM1.SetHTR2Enable", dialog.IsOpen);
  1019. break;
  1020. }
  1021. }
  1022. }
  1023. public void SelectPump(string _pumpname)
  1024. {
  1025. if (SelectedGasStateType == GasPanelStateType.Monitor || SelectedGasStateType == GasPanelStateType.Recipe) return;
  1026. if (!DialogBox.Confirm($"Are you sure change {_pumpname} status?"))
  1027. return;
  1028. if(_pumpname== "AUC")
  1029. {
  1030. InvokeClient.Instance.Service.DoOperation($"{AUCPump.UniqueName}.{AITValveOperation.GVTurnValve}", !AUCPump.Feedback);
  1031. }
  1032. if (_pumpname == "AGV")
  1033. {
  1034. InvokeClient.Instance.Service.DoOperation($"{AGVPump.UniqueName}.{AITValveOperation.GVTurnValve}", !AGVPump.Feedback);
  1035. }
  1036. if (_pumpname == "Both")
  1037. {
  1038. InvokeClient.Instance.Service.DoOperation($"{BothPump.UniqueName}.{AITValveOperation.GVTurnValve}", !BothPump.Feedback);
  1039. }
  1040. }
  1041. }
  1042. }