N2PurgeStatusViewModel.cs 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879
  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 Caliburn.Micro;
  17. using FurnaceUI.Client.Dialog;
  18. using FurnaceUI.Models;
  19. using MECF.Framework.UI.Core.ExtendedControls;
  20. namespace FurnaceUI.Views.Operations.Maintenances
  21. {
  22. public class N2PurgeStatusViewModel : FurnaceModuleUIViewModelBase
  23. {
  24. public SelectSequenceViewModel _selectSequence;
  25. public bool IsOutLineDetail { get; set; }
  26. public bool IsPMCDetail { get; set; }
  27. public bool IsRoBoDetail { get; set; }
  28. public ICommand CmdSetMfcFlow { get; set; }
  29. public ICommand CmdSetMfmFlow { get; set; }
  30. //public bool _ismanagerPermission = true;
  31. //public bool IsManagerPermission
  32. //{
  33. // get
  34. // {
  35. // return _ismanagerPermission;
  36. // }
  37. // set
  38. // {
  39. // _ismanagerPermission = value;
  40. // NotifyOfPropertyChange("IsManagerPermission");
  41. // }
  42. //}
  43. public bool IsManagerPermission=> IsPermission && SelectedGasStateType== GasPanelStateType.Manual;
  44. public bool IsPermission => this.Permission ==3;
  45. public string SequenceSelected { get; set; }
  46. private bool _isRecipeEdit = false;
  47. private string _N2PurgeModeDisplay;
  48. public string N2PurgeModeDisplay { get => _N2PurgeModeDisplay; set => SetField(ref _N2PurgeModeDisplay, value, nameof(N2PurgeModeDisplay)); }
  49. [Subscription("PM1.N2PurgeMode")]
  50. public string N2PurgeMode { get; set; }
  51. [Subscription("PM1.SensorRecipeOK")]
  52. public AITSensorData SensorRecipeOK { get; set; }
  53. [Subscription("PM1.SensorPROCManualOK")]
  54. public AITSensorData SensorPROCManualOK { get; set; }
  55. [Subscription("System.VentValve.DeviceData")]
  56. public AITValveData VentValveData { get; set; }
  57. [Subscription("System.PumpValve.DeviceData")]
  58. public AITValveData PumpValveData { get; set; }
  59. [Subscription("PM1.SensorTubeATMPressure.DeviceData")]
  60. public AITSensorData SensorTubeATMPressure { get; set; }
  61. [Subscription("System.TubePressure.DeviceData")]
  62. public AITPressureMeterData TubePressureData { get; set; }
  63. #region Valves
  64. [Subscription("PM1.ValveAV1.DeviceData")]
  65. public AITValveData ValveAV1 { get; set; }
  66. [Subscription("PM1.ValveAV2.DeviceData")]
  67. public AITValveData ValveAV2 { get; set; }
  68. [Subscription("PM1.ValveAV3.DeviceData")]
  69. public AITValveData ValveAV3 { get; set; }
  70. [Subscription("PM1.ValveAV4.DeviceData")]
  71. public AITValveData ValveAV4 { get; set; }
  72. [Subscription("PM1.ValveAV5.DeviceData")]
  73. public AITValveData ValveAV5 { get; set; }
  74. [Subscription("PM1.ValveAV6.DeviceData")]
  75. public AITValveData ValveAV6 { get; set; }
  76. [Subscription("PM1.ValveAV7.DeviceData")]
  77. public AITValveData ValveAV7 { get; set; }
  78. [Subscription("PM1.ValveAV8.DeviceData")]
  79. public AITValveData ValveAV8 { get; set; }
  80. [Subscription("PM1.ValveAV9.DeviceData")]
  81. public AITValveData ValveAV9 { get; set; }
  82. [Subscription("PM1.ValveAV10.DeviceData")]
  83. public AITValveData ValveAV10 { get; set; }
  84. [Subscription("PM1.ValveAV11.DeviceData")]
  85. public AITValveData ValveAV11 { get; set; }
  86. [Subscription("PM1.ValveAV12.DeviceData")]
  87. public AITValveData ValveAV12 { get; set; }
  88. [Subscription("PM1.ValveAV13.DeviceData")]
  89. public AITValveData ValveAV13 { get; set; }
  90. [Subscription("PM1.ValveAV14.DeviceData")]
  91. public AITValveData ValveAV14 { get; set; }
  92. [Subscription("PM1.ValveAV15.DeviceData")]
  93. public AITValveData ValveAV15 { get; set; }
  94. [Subscription("PM1.ValveAV16.DeviceData")]
  95. public AITValveData ValveAV16 { get; set; }
  96. [Subscription("PM1.ValveAV17.DeviceData")]
  97. public AITValveData ValveAV17 { get; set; }
  98. [Subscription("PM1.ValveAV18.DeviceData")]
  99. public AITValveData ValveAV18 { get; set; }
  100. [Subscription("PM1.ValveAV19.DeviceData")]
  101. public AITValveData ValveAV19 { get; set; }
  102. [Subscription("PM1.ValveAV20.DeviceData")]
  103. public AITValveData ValveAV20 { get; set; }
  104. [Subscription("PM1.ValveAV21.DeviceData")]
  105. public AITValveData ValveAV21 { get; set; }
  106. [Subscription("PM1.ValveAV22.DeviceData")]
  107. public AITValveData ValveAV22 { get; set; }
  108. [Subscription("PM1.ValveAV23.DeviceData")]
  109. public AITValveData ValveAV23 { get; set; }
  110. [Subscription("PM1.ValveAV24.DeviceData")]
  111. public AITValveData ValveAV24 { get; set; }
  112. [Subscription("PM1.ValveAV25.DeviceData")]
  113. public AITValveData ValveAV25 { get; set; }
  114. [Subscription("PM1.ValveAV26.DeviceData")]
  115. public AITValveData ValveAV26 { get; set; }
  116. [Subscription("PM1.ValveAV27.DeviceData")]
  117. public AITValveData ValveAV27 { get; set; }
  118. [Subscription("PM1.ValveAV28.DeviceData")]
  119. public AITValveData ValveAV28 { get; set; }
  120. [Subscription("PM1.ValveAV29.DeviceData")]
  121. public AITValveData ValveAV29 { get; set; }
  122. [Subscription("PM1.ValveAV30.DeviceData")]
  123. public AITValveData ValveAV30 { get; set; }
  124. [Subscription("PM1.ValveAV31.DeviceData")]
  125. public AITValveData ValveAV31 { get; set; }
  126. [Subscription("PM1.ValveAV32.DeviceData")]
  127. public AITValveData ValveAV32 { get; set; }
  128. [Subscription("PM1.ValveAV33.DeviceData")]
  129. public AITValveData ValveAV33 { get; set; }
  130. [Subscription("PM1.ValveAV34.DeviceData")]
  131. public AITValveData ValveAV34 { get; set; }
  132. [Subscription("PM1.ValveAV35.DeviceData")]
  133. public AITValveData ValveAV35 { get; set; }
  134. [Subscription("PM1.ValveAV36.DeviceData")]
  135. public AITValveData ValveAV36 { get; set; }
  136. [Subscription("PM1.ValveAV37.DeviceData")]
  137. public AITValveData ValveAV37 { get; set; }
  138. [Subscription("PM1.ValveAV38.DeviceData")]
  139. public AITValveData ValveAV38 { get; set; }
  140. [Subscription("PM1.ValveAV39.DeviceData")]
  141. public AITValveData ValveAV39 { get; set; }
  142. [Subscription("PM1.ValveAV52.DeviceData")]
  143. public AITValveData ValveAV52 { get; set; }
  144. [Subscription("PM1.ValveAV54.DeviceData")]
  145. public AITValveData ValveAV54 { get; set; }
  146. [Subscription("PM1.ValveAV56.DeviceData")]
  147. public AITValveData ValveAV56 { get; set; }
  148. [Subscription("PM1.ValveAV57.DeviceData")]
  149. public AITValveData ValveAV57 { get; set; }
  150. [Subscription("PM1.ValveAV58.DeviceData")]
  151. public AITValveData ValveAV58 { get; set; }
  152. [Subscription("PM1.ValveAV59.DeviceData")]
  153. public AITValveData ValveAV59 { get; set; }
  154. [Subscription("PM1.ValveAV60.DeviceData")]
  155. public AITValveData ValveAV60 { get; set; }
  156. [Subscription("PM1.ValveFIMS1N2Purge.DeviceData")]
  157. public AITValveData ValveAV63 { get; set; }
  158. [Subscription("PM1.ValveFIMS2N2Purge.DeviceData")]
  159. public AITValveData ValveAV64 { get; set; }
  160. [Subscription("PM1.ValveAV65.DeviceData")]
  161. public AITValveData ValveAV65 { get; set; }
  162. [Subscription("PM1.ValveAV66.DeviceData")]
  163. public AITValveData ValveAV66 { get; set; }
  164. [Subscription("PM1.ValveAV68.DeviceData")]
  165. public AITValveData ValveAV68 { get; set; }
  166. [Subscription("PM1.APC.ModeFeedback")]
  167. public int APCModeFeedback { get; set; }
  168. [Subscription("PM1.ValveAV71.DeviceData")] public AITValveData ValveAV71Data { get; set; }
  169. public AITValveData ValveAV71
  170. {
  171. get
  172. {
  173. return new AITValveData()
  174. {
  175. DeviceName = ValveAV71Data.DeviceName,
  176. DisplayName = ValveAV71Data.DisplayName,
  177. UniqueName = ValveAV71Data.UniqueName,
  178. DefaultValue = ValveAV71Data.DefaultValue,
  179. SetPoint = ValveAV71Data.SetPoint,
  180. Feedback = APCModeFeedback != 5,
  181. VirtualFeedback = ValveAV71Data.VirtualFeedback
  182. };
  183. }
  184. }
  185. [Subscription("PM1.ValveAV72.DeviceData")]
  186. public AITValveData ValveAV72 { get; set; }
  187. [Subscription("PM1.ValveAV73.DeviceData")]
  188. public AITValveData ValveAV73 { get; set; }
  189. [Subscription("PM1.ValveAV74.DeviceData")]
  190. public AITValveData ValveAV74 { get; set; }
  191. [Subscription("PM1.ValveAV75.DeviceData")]
  192. public AITValveData ValveAV75 { get; set; }
  193. [Subscription("PM1.ValveAV77.DeviceData")]
  194. public AITValveData ValveAV77 { get; set; }
  195. [Subscription("PM1.ValveAV81.DeviceData")]
  196. public AITValveData ValveAV81 { get; set; }
  197. [Subscription("PM1.ValveAV82.DeviceData")]
  198. public AITValveData ValveAV82 { get; set; }
  199. [Subscription("PM1.ValveAV83.DeviceData")]
  200. public AITValveData ValveAV83 { get; set; }
  201. [Subscription("PM1.ValveAV91.DeviceData")]
  202. public AITValveData ValveAV91 { get; set; }
  203. #endregion
  204. #region MFCs
  205. [Subscription("PM1.MFC1.DeviceData")]
  206. public AITMfcData MFC1Data { get; set; }
  207. [Subscription("PM1.MFC2.DeviceData")]
  208. public AITMfcData MFC2Data { get; set; }
  209. [Subscription("PM1.MFC3.DeviceData")]
  210. public AITMfcData MFC3Data { get; set; }
  211. [Subscription("PM1.MFC4.DeviceData")]
  212. public AITMfcData MFC4Data { get; set; }
  213. [Subscription("PM1.MFC5.DeviceData")]
  214. public AITMfcData MFC5Data { get; set; }
  215. [Subscription("PM1.MFC6.DeviceData")]
  216. public AITMfcData MFC6Data { get; set; }
  217. [Subscription("PM1.MFC7.DeviceData")]
  218. public AITMfcData MFC7Data { get; set; }
  219. [Subscription("PM1.MFC8.DeviceData")]
  220. public AITMfcData MFC8Data { get; set; }
  221. [Subscription("PM1.MFC9.DeviceData")]
  222. public AITMfcData MFC9Data { get; set; }
  223. [Subscription("PM1.MFC10.DeviceData")]
  224. public AITMfcData MFC10Data { get; set; }
  225. [Subscription("PM1.MFC11.DeviceData")]
  226. public AITMfcData MFC11Data { get; set; }
  227. [Subscription("PM1.MFC12.DeviceData")]
  228. public AITMfcData MFC12Data { get; set; }
  229. [Subscription("PM1.MFC51.DeviceData")]
  230. public AITMfcData MFC51Data { get; set; }
  231. [Subscription("PM1.ConcentrationO2.Value")]
  232. public double ConcentrationO2Value { get; set; }
  233. #endregion
  234. [Subscription("PM1.MFM57.DeviceData")]
  235. public AITWaterFlowMeterData MFM57Flow { get; set; }
  236. [Subscription("PM1.RfPower.IsPowerOn")]
  237. public bool IsPowerOn { get; set; }
  238. [Subscription("PM1.RfPower.PowerSetPoint")]
  239. public float PowerSetPoint { get; set; }
  240. [Subscription("PM1.RfPower.ForwardPower")]
  241. public float ForwardPower { get; set; }
  242. [Subscription("PM1.RfMatch.Capacitance1PositionFeedBack")]
  243. public float Capacitance1PositionFeedBack { get; set; }
  244. [Subscription("PM1.RfMatch.Capacitance2PositionFeedBack")]
  245. public float Capacitance2PositionFeedBack { get; set; }
  246. [Subscription("PM1.RfMatch.VppFeedBack")]
  247. public float VppFeedBack { get; set; }
  248. public ICommand CmdSetValve { get; set; }
  249. private GasPanelStateType _selectedGasStateType = GasPanelStateType.Manual;
  250. public GasPanelStateType SelectedGasStateType
  251. {
  252. get
  253. {
  254. return _selectedGasStateType;
  255. }
  256. set
  257. {
  258. if (_selectedGasStateType != value)
  259. {
  260. _selectedGasStateType = value;
  261. NotifyOfPropertyChange("SelectedGasStateType");
  262. }
  263. }
  264. }
  265. public AnalogDeviceDataItem MFC1
  266. {
  267. get
  268. {
  269. return new AnalogDeviceDataItem
  270. {
  271. Type = "MFC",
  272. DeviceName = MFC1Data.UniqueName,
  273. DeviceId = MFC1Data.DeviceSchematicId,
  274. DisplayName = MFC1Data.DisplayName,
  275. Scale = MFC1Data.Scale,
  276. Unit = MFC1Data.Unit,
  277. FeedBack = MFC1Data.FeedBack,
  278. SetPoint = MFC1Data.SetPoint,
  279. };
  280. }
  281. }
  282. public AnalogDeviceDataItem MFC2
  283. {
  284. get
  285. {
  286. return new AnalogDeviceDataItem
  287. {
  288. Type = "MFC",
  289. DeviceName = MFC2Data.UniqueName,
  290. DeviceId = MFC2Data.DeviceSchematicId,
  291. DisplayName = MFC2Data.DisplayName,
  292. Scale = MFC2Data.Scale,
  293. Unit = MFC2Data.Unit,
  294. FeedBack = MFC2Data.FeedBack,
  295. SetPoint = MFC2Data.SetPoint,
  296. };
  297. }
  298. }
  299. public AnalogDeviceDataItem MFC3
  300. {
  301. get
  302. {
  303. return new AnalogDeviceDataItem
  304. {
  305. Type = "MFC",
  306. DeviceName = MFC3Data.UniqueName,
  307. DeviceId = MFC3Data.DeviceSchematicId,
  308. DisplayName = MFC3Data.DisplayName,
  309. Scale = MFC3Data.Scale,
  310. Unit = MFC3Data.Unit,
  311. FeedBack = MFC3Data.FeedBack,
  312. SetPoint = MFC3Data.SetPoint,
  313. };
  314. }
  315. }
  316. public AnalogDeviceDataItem MFC4
  317. {
  318. get
  319. {
  320. return new AnalogDeviceDataItem
  321. {
  322. Type = "MFC",
  323. DeviceName = MFC4Data.UniqueName,
  324. DeviceId = MFC4Data.DeviceSchematicId,
  325. DisplayName = MFC4Data.DisplayName,
  326. Scale = MFC4Data.Scale,
  327. Unit = MFC4Data.Unit,
  328. FeedBack = MFC4Data.FeedBack,
  329. SetPoint = MFC4Data.SetPoint,
  330. };
  331. }
  332. }
  333. public AnalogDeviceDataItem MFC5
  334. {
  335. get
  336. {
  337. return new AnalogDeviceDataItem
  338. {
  339. Type = "MFC",
  340. DeviceName = MFC5Data.UniqueName,
  341. DeviceId = MFC5Data.DeviceSchematicId,
  342. DisplayName = MFC5Data.DisplayName,
  343. Scale = MFC5Data.Scale,
  344. Unit = MFC5Data.Unit,
  345. FeedBack = MFC5Data.FeedBack,
  346. SetPoint = MFC5Data.SetPoint,
  347. };
  348. }
  349. }
  350. public AnalogDeviceDataItem MFC6
  351. {
  352. get
  353. {
  354. return new AnalogDeviceDataItem
  355. {
  356. Type = "MFC",
  357. DeviceName = MFC6Data.UniqueName,
  358. DeviceId = MFC6Data.DeviceSchematicId,
  359. DisplayName = MFC6Data.DisplayName,
  360. Scale = MFC6Data.Scale,
  361. Unit = MFC6Data.Unit,
  362. FeedBack = MFC6Data.FeedBack,
  363. SetPoint = MFC6Data.SetPoint,
  364. };
  365. }
  366. }
  367. public AnalogDeviceDataItem MFC7
  368. {
  369. get
  370. {
  371. return new AnalogDeviceDataItem
  372. {
  373. Type = "MFC",
  374. DeviceName = MFC7Data.UniqueName,
  375. DeviceId = MFC7Data.DeviceSchematicId,
  376. DisplayName = MFC7Data.DisplayName,
  377. Scale = MFC7Data.Scale,
  378. Unit = MFC7Data.Unit,
  379. FeedBack = MFC7Data.FeedBack,
  380. SetPoint = MFC7Data.SetPoint,
  381. };
  382. }
  383. }
  384. public AnalogDeviceDataItem MFC8
  385. {
  386. get
  387. {
  388. return new AnalogDeviceDataItem
  389. {
  390. Type = "MFC",
  391. DeviceName = MFC8Data.UniqueName,
  392. DeviceId = MFC8Data.DeviceSchematicId,
  393. DisplayName = MFC8Data.DisplayName,
  394. Scale = MFC8Data.Scale,
  395. Unit = MFC8Data.Unit,
  396. FeedBack = MFC8Data.FeedBack,
  397. SetPoint = MFC8Data.SetPoint,
  398. };
  399. }
  400. }
  401. public AnalogDeviceDataItem MFC9
  402. {
  403. get
  404. {
  405. return new AnalogDeviceDataItem
  406. {
  407. Type = "MFC",
  408. DeviceName = MFC9Data.UniqueName,
  409. DeviceId = MFC9Data.DeviceSchematicId,
  410. DisplayName = MFC9Data.DisplayName,
  411. Scale = MFC9Data.Scale,
  412. Unit = MFC9Data.Unit,
  413. FeedBack = MFC9Data.FeedBack,
  414. SetPoint = MFC9Data.SetPoint,
  415. };
  416. }
  417. }
  418. public AnalogDeviceDataItem MFC10
  419. {
  420. get
  421. {
  422. return new AnalogDeviceDataItem
  423. {
  424. Type = "MFC",
  425. DeviceName = MFC10Data.UniqueName,
  426. DeviceId = MFC10Data.DeviceSchematicId,
  427. DisplayName = MFC10Data.DisplayName,
  428. Scale = MFC10Data.Scale,
  429. Unit = MFC10Data.Unit,
  430. FeedBack = MFC10Data.FeedBack,
  431. SetPoint = MFC10Data.SetPoint,
  432. };
  433. }
  434. }
  435. public AnalogDeviceDataItem MFC11
  436. {
  437. get
  438. {
  439. return new AnalogDeviceDataItem
  440. {
  441. Type = "MFC",
  442. DeviceName = MFC11Data.UniqueName,
  443. DeviceId = MFC11Data.DeviceSchematicId,
  444. DisplayName = MFC11Data.DisplayName,
  445. Scale = MFC11Data.Scale,
  446. Unit = MFC11Data.Unit,
  447. FeedBack = MFC11Data.FeedBack,
  448. SetPoint = MFC11Data.SetPoint,
  449. };
  450. }
  451. }
  452. public AnalogDeviceDataItem MFC12
  453. {
  454. get
  455. {
  456. return new AnalogDeviceDataItem
  457. {
  458. Type = "MFC",
  459. DeviceName = MFC12Data.UniqueName,
  460. DeviceId = MFC12Data.DeviceSchematicId,
  461. DisplayName = MFC12Data.DisplayName,
  462. Scale = MFC12Data.Scale,
  463. Unit = MFC12Data.Unit,
  464. FeedBack = MFC12Data.FeedBack,
  465. SetPoint = MFC12Data.SetPoint,
  466. };
  467. }
  468. }
  469. public AnalogDeviceDataItem MFC51
  470. {
  471. get
  472. {
  473. return new AnalogDeviceDataItem
  474. {
  475. Type = "MFC",
  476. DeviceName = MFC51Data.UniqueName,
  477. DeviceId = MFC51Data.DeviceSchematicId,
  478. DisplayName = MFC51Data.DisplayName,
  479. Scale = MFC51Data.Scale,
  480. Unit = MFC51Data.Unit,
  481. FeedBack = MFC51Data.FeedBack,
  482. SetPoint = MFC51Data.SetPoint,
  483. };
  484. }
  485. }
  486. public AnalogDeviceDataItem MFM57
  487. {
  488. get
  489. {
  490. return new AnalogDeviceDataItem
  491. {
  492. Type = "MFM",
  493. DeviceId = MFM57Flow.DeviceSchematicId,
  494. DisplayName = MFM57Flow.DisplayName,
  495. DeviceName = MFM57Flow.UniqueName,
  496. Scale = MFM57Flow.Scale,
  497. Unit = MFM57Flow.Unit,
  498. FeedBack = MFM57Flow.FeedBack,
  499. SetPoint = MFM57Flow.SetPoint,
  500. };
  501. }
  502. }
  503. public string IsRfPowerOn
  504. {
  505. get
  506. {
  507. return IsPowerOn ? "On" : "Off";
  508. }
  509. }
  510. private bool _manualCheck;
  511. public bool ManualCheck
  512. {
  513. get => _manualCheck;
  514. set
  515. {
  516. _manualCheck = value;
  517. NotifyOfPropertyChange(nameof(ManualCheck));
  518. }
  519. }
  520. private bool _manualCheckHide;
  521. public bool ManumalCheckHide
  522. {
  523. get => _manualCheckHide;
  524. set
  525. {
  526. _manualCheckHide = value;
  527. NotifyOfPropertyChange(nameof(ManumalCheckHide));
  528. }
  529. }
  530. public bool EnableServiceControl { get; set; } = true;
  531. private bool _enablePLCPointControl = true;
  532. public bool EnablePLCPointControl
  533. {
  534. get => _enablePLCPointControl;
  535. set
  536. {
  537. _enablePLCPointControl = value;
  538. NotifyOfPropertyChange(nameof(EnablePLCPointControl));
  539. }
  540. }
  541. public N2PurgeStatusViewModel()
  542. {
  543. CmdSetMfcFlow = new DelegateCommand<object>(PerformCmdSetMfcFlow);
  544. CmdSetMfmFlow = new DelegateCommand<object>(PerformCmdSetMfmFlow);
  545. CmdSetValve = new DelegateCommand<object>(SetValveCommand);
  546. }
  547. protected override void OnActivate()
  548. {
  549. base.OnActivate();
  550. _selectSequence = new SelectSequenceViewModel();
  551. IsOutLineDetail = true;
  552. IsPMCDetail = false;
  553. IsRoBoDetail = false;
  554. EnableServiceControl = true;
  555. // IsMfcNRInstalled = (bool)QueryDataClient.Instance.Service.GetConfig("PM1.MFC.MfcNR.IsMFCInstalled");
  556. }
  557. public void SetEditClick()
  558. {
  559. EnableServiceControl = true;
  560. }
  561. protected override void OnDeactivate(bool close)
  562. {
  563. base.OnDeactivate(close);
  564. //IsManagerPermission = false;
  565. }
  566. public void OpenAll()
  567. {
  568. if (!VentValveData.IsOpen)
  569. InvokeClient.Instance.Service.DoOperation($"{VentValveData.UniqueName}.{AITValveOperation.GVTurnValve}", true);
  570. if (!PumpValveData.IsOpen)
  571. InvokeClient.Instance.Service.DoOperation($"{PumpValveData.UniqueName}.{AITValveOperation.GVTurnValve}", true);
  572. }
  573. public void CloseAll()
  574. {
  575. if (PumpValveData.IsOpen)
  576. InvokeClient.Instance.Service.DoOperation($"{PumpValveData.UniqueName}.{AITValveOperation.GVTurnValve}", false);
  577. if (VentValveData.IsOpen)
  578. InvokeClient.Instance.Service.DoOperation($"{VentValveData.UniqueName}.{AITValveOperation.GVTurnValve}", false);
  579. }
  580. private void PerformCmdSetMfcFlow(object param)
  581. {
  582. object[] args = (object[])param; //0:devicename, 1:operation, 2:args
  583. if (args.Length == 3)
  584. {
  585. InvokeClient.Instance.Service.DoOperation($"{args[0]}.{args[1]}", args[2]);
  586. }
  587. }
  588. private void PerformCmdSetMfmFlow(object param)
  589. {
  590. object[] args = (object[])param; //0:devicename, 1:operation, 2:args
  591. if (args.Length == 3)
  592. {
  593. InvokeClient.Instance.Service.DoOperation($"{args[0]}.{args[1]}", args[2]);
  594. }
  595. }
  596. public void SetValveCommand(object param)
  597. {
  598. object[] args = (object[])param;
  599. if (args.Length == 3)
  600. {
  601. InvokeClient.Instance.Service.DoOperation($"PM1.{args[0]}.{AITValveOperation.GVTurnValve}", args[2]);
  602. }
  603. }
  604. public void SwitchDetail(string detail)
  605. {
  606. switch (detail)
  607. {
  608. case "OutLine":
  609. IsOutLineDetail = true;
  610. IsPMCDetail = false;
  611. IsRoBoDetail = false;
  612. break;
  613. case "PMCDetail":
  614. IsOutLineDetail = false;
  615. IsPMCDetail = true;
  616. IsRoBoDetail = false;
  617. break;
  618. case "RoBoDetail":
  619. IsOutLineDetail = false;
  620. IsPMCDetail = false;
  621. IsRoBoDetail = true;
  622. break;
  623. }
  624. }
  625. Dictionary<string, object> oldresult;
  626. private Dictionary<string, object> ClearNotChangedValue(Dictionary<string, object> result)
  627. {
  628. Dictionary<string, object> temp = result;
  629. if (oldresult == null)
  630. {
  631. oldresult = result;
  632. }
  633. else
  634. {
  635. try
  636. {
  637. List<string> strkeys = new List<string>();
  638. foreach (var key in result.Keys)
  639. {
  640. if (_subscribedKeys.Contains(key) && oldresult.ContainsKey(key) && result.ContainsKey(key))
  641. {
  642. if (result[key].GetType() == typeof(AITValveData) && ((AITValveData)oldresult[key]).Feedback == ((AITValveData)result[key]).Feedback)
  643. {
  644. strkeys.Add(key);
  645. }
  646. else if (result[key].GetType() == typeof(AITSensorData) && ((AITSensorData)oldresult[key]).Value == ((AITSensorData)result[key]).Value)
  647. {
  648. strkeys.Add(key);
  649. }
  650. else if (result[key].GetType() == typeof(AITMfcData) && ((AITMfcData)oldresult[key]).FeedBack == ((AITMfcData)result[key]).FeedBack)
  651. {
  652. strkeys.Add(key);
  653. }
  654. else if (result[key].GetType() == typeof(float) && (float)oldresult[key] == (float)result[key])
  655. {
  656. strkeys.Add(key);
  657. }
  658. else if (result[key].GetType() == typeof(int) && (int)oldresult[key] == (int)result[key])
  659. {
  660. strkeys.Add(key);
  661. }
  662. else if (result[key].GetType() == typeof(bool) && (bool)oldresult[key] == (bool)result[key])
  663. {
  664. strkeys.Add(key);
  665. }
  666. }
  667. }
  668. for (int i = 0; i < strkeys.Count; i++)
  669. {
  670. temp.Remove(strkeys[i]);
  671. }
  672. }
  673. catch (Exception ex)
  674. {
  675. LOG.Error("由RT返回的数据更新失败" + "ClearNotChangedValue", ex);
  676. }
  677. }
  678. return temp;
  679. }
  680. protected override void Poll()
  681. {
  682. if (_subscribedKeys.Count > 0)
  683. {
  684. Dictionary<string, object> result = QueryDataClient.Instance.Service.PollData(_subscribedKeys);
  685. Dictionary<string, object> Tempresult = new Dictionary<string, object>(result);
  686. result = ClearNotChangedValue(result);
  687. oldresult = Tempresult;
  688. if (result == null)
  689. {
  690. LOG.Error("获取RT数据失败");
  691. return;
  692. }
  693. if (result.Count != _subscribedKeys.Count)
  694. {
  695. string unknowKeys = string.Empty;
  696. foreach (string key in _subscribedKeys)
  697. {
  698. if (!result.ContainsKey(key))
  699. {
  700. unknowKeys += key + "\r\n";
  701. }
  702. }
  703. }
  704. InvokeBeforeUpdateProperty(result);
  705. UpdateValue(result);
  706. Application.Current?.Dispatcher.Invoke(new System.Action(() =>
  707. {
  708. if (result.Count != 0)
  709. {
  710. InvokePropertyChanged();
  711. }
  712. InvokeAfterUpdateProperty(result);
  713. }));
  714. }
  715. }
  716. protected override void InvokeBeforeUpdateProperty(Dictionary<string, object> data)
  717. {
  718. //List<string> aITValveDataKeys = new List<string>();
  719. //List<string> aITSensorDataKeys = new List<string>();
  720. //List<string> aITMfcDataKeys = new List<string>();
  721. //foreach (var item in data.Keys)
  722. //{
  723. // try
  724. // {
  725. // if (data[item].GetType() == typeof(AITValveData))
  726. // {
  727. // var array = item.Split('.');
  728. // if (array.Length > 1)
  729. // {
  730. // var name = array[1];
  731. // var property = this.GetType().GetProperties().Where(x => x.Name == name).FirstOrDefault();
  732. // object value = property.GetValue(this, null);
  733. // if (value != null && ((AITValveData)value).Equals((AITValveData)data[item]))
  734. // aITValveDataKeys.Add(item);
  735. // }
  736. // }
  737. // else if (data[item].GetType() == typeof(AITSensorData))
  738. // {
  739. // var array = item.Split('.');
  740. // if (array.Length > 1)
  741. // {
  742. // var name = array[1];
  743. // var property = this.GetType().GetProperties().Where(x => x.Name == name).FirstOrDefault();
  744. // object value = property.GetValue(this, null);
  745. // if (value != null && ((AITSensorData)value).Equals((AITSensorData)data[item]))
  746. // aITSensorDataKeys.Add(item);
  747. // }
  748. // }
  749. // else if (data[item].GetType() == typeof(AITMfcData))
  750. // {
  751. // var array = item.Split('.');
  752. // if (array.Length > 1)
  753. // {
  754. // var name = array[1];
  755. // var property = this.GetType().GetProperties().Where(x => x.Name == $"{name}Data").FirstOrDefault();
  756. // object value = property.GetValue(this, null);
  757. // if (value != null && ((AITMfcData)value).Equals((AITMfcData)data[item]))
  758. // aITMfcDataKeys.Add(item);
  759. // }
  760. // }
  761. // }
  762. // catch (Exception ex)
  763. // {
  764. // Console.WriteLine(ex.Message);
  765. // }
  766. //}
  767. //if (aITValveDataKeys.Count > 0)
  768. //{
  769. // foreach (var item in aITValveDataKeys)
  770. // {
  771. // data.Remove(item);
  772. // }
  773. //}
  774. //if (aITSensorDataKeys.Count > 0)
  775. //{
  776. // foreach (var item in aITSensorDataKeys)
  777. // {
  778. // data.Remove(item);
  779. // }
  780. //}
  781. //if (aITMfcDataKeys.Count > 0)
  782. //{
  783. // foreach (var item in aITMfcDataKeys)
  784. // {
  785. // data.Remove(item);
  786. // }
  787. //}
  788. base.InvokeBeforeUpdateProperty(data);
  789. }
  790. protected override void InvokeAfterUpdateProperty(Dictionary<string, object> data)
  791. {
  792. base.InvokeAfterUpdateProperty(data);
  793. if (N2PurgeMode == "ManualMode")
  794. {
  795. SelectedGasStateType = GasPanelStateType.Manual;
  796. }
  797. else
  798. {
  799. SelectedGasStateType = GasPanelStateType.Monitor;
  800. }
  801. }
  802. public void SequenceSelect()
  803. {
  804. WindowManager wm = new WindowManager();
  805. bool? bret = wm.ShowDialogWithTitle(_selectSequence, null, "Sequence Select");
  806. if (bret.Value)
  807. {
  808. if (_selectSequence.DialogResultString != null || _selectSequence.DialogResultString != "")
  809. {
  810. SequenceSelected = _selectSequence.DialogResultView;
  811. N2PurgeModeDisplay = SequenceSelected;
  812. }
  813. }
  814. }
  815. }
  816. }