N2PurgeStatusViewModel.cs 33 KB

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