N2PurgeStatusViewModel.cs 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882
  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.CheckO2Location")]
  235. public string CheckO2Location { get; set; }
  236. [Subscription("PM1.N2PurgeLimitData")]
  237. public float N2PurgeLimitData { get; set; }
  238. [Subscription("PM1.MFM57.DeviceData")]
  239. public AITWaterFlowMeterData MFM57Flow { get; set; }
  240. [Subscription("PM1.RfPower.IsPowerOn")]
  241. public bool IsPowerOn { get; set; }
  242. [Subscription("PM1.RfPower.PowerSetPoint")]
  243. public float PowerSetPoint { get; set; }
  244. [Subscription("PM1.RfPower.ForwardPower")]
  245. public float ForwardPower { get; set; }
  246. [Subscription("PM1.RfMatch.Capacitance1PositionFeedBack")]
  247. public float Capacitance1PositionFeedBack { get; set; }
  248. [Subscription("PM1.RfMatch.Capacitance2PositionFeedBack")]
  249. public float Capacitance2PositionFeedBack { get; set; }
  250. [Subscription("PM1.RfMatch.VppFeedBack")]
  251. public float VppFeedBack { get; set; }
  252. public ICommand CmdSetValve { get; set; }
  253. private GasPanelStateType _selectedGasStateType = GasPanelStateType.Manual;
  254. public GasPanelStateType SelectedGasStateType
  255. {
  256. get
  257. {
  258. return _selectedGasStateType;
  259. }
  260. set
  261. {
  262. if (_selectedGasStateType != value)
  263. {
  264. _selectedGasStateType = value;
  265. NotifyOfPropertyChange("SelectedGasStateType");
  266. }
  267. }
  268. }
  269. public AnalogDeviceDataItem MFC1
  270. {
  271. get
  272. {
  273. return new AnalogDeviceDataItem
  274. {
  275. Type = "MFC",
  276. DeviceName = MFC1Data.UniqueName,
  277. DeviceId = MFC1Data.DeviceSchematicId,
  278. DisplayName = MFC1Data.DisplayName,
  279. Scale = MFC1Data.Scale,
  280. Unit = MFC1Data.Unit,
  281. FeedBack = MFC1Data.FeedBack,
  282. SetPoint = MFC1Data.SetPoint,
  283. };
  284. }
  285. }
  286. public AnalogDeviceDataItem MFC2
  287. {
  288. get
  289. {
  290. return new AnalogDeviceDataItem
  291. {
  292. Type = "MFC",
  293. DeviceName = MFC2Data.UniqueName,
  294. DeviceId = MFC2Data.DeviceSchematicId,
  295. DisplayName = MFC2Data.DisplayName,
  296. Scale = MFC2Data.Scale,
  297. Unit = MFC2Data.Unit,
  298. FeedBack = MFC2Data.FeedBack,
  299. SetPoint = MFC2Data.SetPoint,
  300. };
  301. }
  302. }
  303. public AnalogDeviceDataItem MFC3
  304. {
  305. get
  306. {
  307. return new AnalogDeviceDataItem
  308. {
  309. Type = "MFC",
  310. DeviceName = MFC3Data.UniqueName,
  311. DeviceId = MFC3Data.DeviceSchematicId,
  312. DisplayName = MFC3Data.DisplayName,
  313. Scale = MFC3Data.Scale,
  314. Unit = MFC3Data.Unit,
  315. FeedBack = MFC3Data.FeedBack,
  316. SetPoint = MFC3Data.SetPoint,
  317. };
  318. }
  319. }
  320. public AnalogDeviceDataItem MFC4
  321. {
  322. get
  323. {
  324. return new AnalogDeviceDataItem
  325. {
  326. Type = "MFC",
  327. DeviceName = MFC4Data.UniqueName,
  328. DeviceId = MFC4Data.DeviceSchematicId,
  329. DisplayName = MFC4Data.DisplayName,
  330. Scale = MFC4Data.Scale,
  331. Unit = MFC4Data.Unit,
  332. FeedBack = MFC4Data.FeedBack,
  333. SetPoint = MFC4Data.SetPoint,
  334. };
  335. }
  336. }
  337. public AnalogDeviceDataItem MFC5
  338. {
  339. get
  340. {
  341. return new AnalogDeviceDataItem
  342. {
  343. Type = "MFC",
  344. DeviceName = MFC5Data.UniqueName,
  345. DeviceId = MFC5Data.DeviceSchematicId,
  346. DisplayName = MFC5Data.DisplayName,
  347. Scale = MFC5Data.Scale,
  348. Unit = MFC5Data.Unit,
  349. FeedBack = MFC5Data.FeedBack,
  350. SetPoint = MFC5Data.SetPoint,
  351. };
  352. }
  353. }
  354. public AnalogDeviceDataItem MFC6
  355. {
  356. get
  357. {
  358. return new AnalogDeviceDataItem
  359. {
  360. Type = "MFC",
  361. DeviceName = MFC6Data.UniqueName,
  362. DeviceId = MFC6Data.DeviceSchematicId,
  363. DisplayName = MFC6Data.DisplayName,
  364. Scale = MFC6Data.Scale,
  365. Unit = MFC6Data.Unit,
  366. FeedBack = MFC6Data.FeedBack,
  367. SetPoint = MFC6Data.SetPoint,
  368. };
  369. }
  370. }
  371. public AnalogDeviceDataItem MFC7
  372. {
  373. get
  374. {
  375. return new AnalogDeviceDataItem
  376. {
  377. Type = "MFC",
  378. DeviceName = MFC7Data.UniqueName,
  379. DeviceId = MFC7Data.DeviceSchematicId,
  380. DisplayName = MFC7Data.DisplayName,
  381. Scale = MFC7Data.Scale,
  382. Unit = MFC7Data.Unit,
  383. FeedBack = MFC7Data.FeedBack,
  384. SetPoint = MFC7Data.SetPoint,
  385. };
  386. }
  387. }
  388. public AnalogDeviceDataItem MFC8
  389. {
  390. get
  391. {
  392. return new AnalogDeviceDataItem
  393. {
  394. Type = "MFC",
  395. DeviceName = MFC8Data.UniqueName,
  396. DeviceId = MFC8Data.DeviceSchematicId,
  397. DisplayName = MFC8Data.DisplayName,
  398. Scale = MFC8Data.Scale,
  399. Unit = MFC8Data.Unit,
  400. FeedBack = MFC8Data.FeedBack,
  401. SetPoint = MFC8Data.SetPoint,
  402. };
  403. }
  404. }
  405. public AnalogDeviceDataItem MFC9
  406. {
  407. get
  408. {
  409. return new AnalogDeviceDataItem
  410. {
  411. Type = "MFC",
  412. DeviceName = MFC9Data.UniqueName,
  413. DeviceId = MFC9Data.DeviceSchematicId,
  414. DisplayName = MFC9Data.DisplayName,
  415. Scale = MFC9Data.Scale,
  416. Unit = MFC9Data.Unit,
  417. FeedBack = MFC9Data.FeedBack,
  418. SetPoint = MFC9Data.SetPoint,
  419. };
  420. }
  421. }
  422. public AnalogDeviceDataItem MFC10
  423. {
  424. get
  425. {
  426. return new AnalogDeviceDataItem
  427. {
  428. Type = "MFC",
  429. DeviceName = MFC10Data.UniqueName,
  430. DeviceId = MFC10Data.DeviceSchematicId,
  431. DisplayName = MFC10Data.DisplayName,
  432. Scale = MFC10Data.Scale,
  433. Unit = MFC10Data.Unit,
  434. FeedBack = MFC10Data.FeedBack,
  435. SetPoint = MFC10Data.SetPoint,
  436. };
  437. }
  438. }
  439. public AnalogDeviceDataItem MFC11
  440. {
  441. get
  442. {
  443. return new AnalogDeviceDataItem
  444. {
  445. Type = "MFC",
  446. DeviceName = MFC11Data.UniqueName,
  447. DeviceId = MFC11Data.DeviceSchematicId,
  448. DisplayName = MFC11Data.DisplayName,
  449. Scale = MFC11Data.Scale,
  450. Unit = MFC11Data.Unit,
  451. FeedBack = MFC11Data.FeedBack,
  452. SetPoint = MFC11Data.SetPoint,
  453. };
  454. }
  455. }
  456. public AnalogDeviceDataItem MFC12
  457. {
  458. get
  459. {
  460. return new AnalogDeviceDataItem
  461. {
  462. Type = "MFC",
  463. DeviceName = MFC12Data.UniqueName,
  464. DeviceId = MFC12Data.DeviceSchematicId,
  465. DisplayName = MFC12Data.DisplayName,
  466. Scale = MFC12Data.Scale,
  467. Unit = MFC12Data.Unit,
  468. FeedBack = MFC12Data.FeedBack,
  469. SetPoint = MFC12Data.SetPoint,
  470. };
  471. }
  472. }
  473. public AnalogDeviceDataItem MFC51
  474. {
  475. get
  476. {
  477. return new AnalogDeviceDataItem
  478. {
  479. Type = "MFC",
  480. DeviceName = MFC51Data.UniqueName,
  481. DeviceId = MFC51Data.DeviceSchematicId,
  482. DisplayName = MFC51Data.DisplayName,
  483. Scale = MFC51Data.Scale,
  484. Unit = MFC51Data.Unit,
  485. FeedBack = MFC51Data.FeedBack,
  486. SetPoint = MFC51Data.SetPoint,
  487. };
  488. }
  489. }
  490. public AnalogDeviceDataItem MFM57
  491. {
  492. get
  493. {
  494. return new AnalogDeviceDataItem
  495. {
  496. Type = "MFM",
  497. DeviceId = MFM57Flow.DeviceSchematicId,
  498. DisplayName = MFM57Flow.DisplayName,
  499. DeviceName = MFM57Flow.UniqueName,
  500. Scale = MFM57Flow.Scale,
  501. Unit = MFM57Flow.Unit,
  502. FeedBack = MFM57Flow.FeedBack,
  503. SetPoint = MFM57Flow.SetPoint,
  504. };
  505. }
  506. }
  507. public string IsRfPowerOn
  508. {
  509. get
  510. {
  511. return IsPowerOn ? "On" : "Off";
  512. }
  513. }
  514. private bool _manualCheck;
  515. public bool ManualCheck
  516. {
  517. get => _manualCheck;
  518. set
  519. {
  520. _manualCheck = value;
  521. NotifyOfPropertyChange(nameof(ManualCheck));
  522. }
  523. }
  524. private bool _manualCheckHide;
  525. public bool ManumalCheckHide
  526. {
  527. get => _manualCheckHide;
  528. set
  529. {
  530. _manualCheckHide = value;
  531. NotifyOfPropertyChange(nameof(ManumalCheckHide));
  532. }
  533. }
  534. public bool EnableServiceControl { get; set; } = true;
  535. private bool _enablePLCPointControl = true;
  536. public bool EnablePLCPointControl
  537. {
  538. get => _enablePLCPointControl;
  539. set
  540. {
  541. _enablePLCPointControl = value;
  542. NotifyOfPropertyChange(nameof(EnablePLCPointControl));
  543. }
  544. }
  545. public N2PurgeStatusViewModel()
  546. {
  547. CmdSetMfcFlow = new DelegateCommand<object>(PerformCmdSetMfcFlow);
  548. CmdSetMfmFlow = new DelegateCommand<object>(PerformCmdSetMfmFlow);
  549. CmdSetValve = new DelegateCommand<object>(SetValveCommand);
  550. }
  551. protected override void OnActivate()
  552. {
  553. base.OnActivate();
  554. _selectSequence = new SelectSequenceViewModel();
  555. IsOutLineDetail = true;
  556. IsPMCDetail = false;
  557. IsRoBoDetail = false;
  558. EnableServiceControl = true;
  559. // IsMfcNRInstalled = (bool)QueryDataClient.Instance.Service.GetConfig("PM1.MFC.MfcNR.IsMFCInstalled");
  560. }
  561. public void SetEditClick()
  562. {
  563. EnableServiceControl = true;
  564. }
  565. protected override void OnDeactivate(bool close)
  566. {
  567. base.OnDeactivate(close);
  568. //IsManagerPermission = false;
  569. }
  570. public void OpenAll()
  571. {
  572. if (!VentValveData.IsOpen)
  573. InvokeClient.Instance.Service.DoOperation($"{VentValveData.UniqueName}.{AITValveOperation.GVTurnValve}", true);
  574. if (!PumpValveData.IsOpen)
  575. InvokeClient.Instance.Service.DoOperation($"{PumpValveData.UniqueName}.{AITValveOperation.GVTurnValve}", true);
  576. }
  577. public void CloseAll()
  578. {
  579. if (PumpValveData.IsOpen)
  580. InvokeClient.Instance.Service.DoOperation($"{PumpValveData.UniqueName}.{AITValveOperation.GVTurnValve}", false);
  581. if (VentValveData.IsOpen)
  582. InvokeClient.Instance.Service.DoOperation($"{VentValveData.UniqueName}.{AITValveOperation.GVTurnValve}", false);
  583. }
  584. private void PerformCmdSetMfcFlow(object param)
  585. {
  586. object[] args = (object[])param; //0:devicename, 1:operation, 2:args
  587. if (args.Length == 3)
  588. {
  589. InvokeClient.Instance.Service.DoOperation($"{args[0]}.{args[1]}", args[2]);
  590. }
  591. }
  592. private void PerformCmdSetMfmFlow(object param)
  593. {
  594. object[] args = (object[])param; //0:devicename, 1:operation, 2:args
  595. if (args.Length == 3)
  596. {
  597. InvokeClient.Instance.Service.DoOperation($"{args[0]}.{args[1]}", args[2]);
  598. }
  599. }
  600. public void SetValveCommand(object param)
  601. {
  602. object[] args = (object[])param;
  603. if (args.Length == 3)
  604. {
  605. InvokeClient.Instance.Service.DoOperation($"PM1.{args[0]}.{AITValveOperation.GVTurnValve}", args[2]);
  606. }
  607. }
  608. public void SwitchDetail(string detail)
  609. {
  610. switch (detail)
  611. {
  612. case "OutLine":
  613. IsOutLineDetail = true;
  614. IsPMCDetail = false;
  615. IsRoBoDetail = false;
  616. break;
  617. case "PMCDetail":
  618. IsOutLineDetail = false;
  619. IsPMCDetail = true;
  620. IsRoBoDetail = false;
  621. break;
  622. case "RoBoDetail":
  623. IsOutLineDetail = false;
  624. IsPMCDetail = false;
  625. IsRoBoDetail = true;
  626. break;
  627. }
  628. }
  629. Dictionary<string, object> oldresult;
  630. private Dictionary<string, object> ClearNotChangedValue(Dictionary<string, object> result)
  631. {
  632. Dictionary<string, object> temp = result;
  633. if (oldresult == null)
  634. {
  635. oldresult = result;
  636. }
  637. else
  638. {
  639. try
  640. {
  641. List<string> strkeys = new List<string>();
  642. foreach (var key in result.Keys)
  643. {
  644. if (_subscribedKeys.Contains(key) && oldresult.ContainsKey(key) && result.ContainsKey(key))
  645. {
  646. if (result[key].GetType() == typeof(AITValveData) && ((AITValveData)oldresult[key]).Feedback == ((AITValveData)result[key]).Feedback)
  647. {
  648. strkeys.Add(key);
  649. }
  650. else if (result[key].GetType() == typeof(AITSensorData) && ((AITSensorData)oldresult[key]).Value == ((AITSensorData)result[key]).Value)
  651. {
  652. strkeys.Add(key);
  653. }
  654. else if (result[key].GetType() == typeof(AITMfcData) && ((AITMfcData)oldresult[key]).FeedBack == ((AITMfcData)result[key]).FeedBack)
  655. {
  656. strkeys.Add(key);
  657. }
  658. else if (result[key].GetType() == typeof(float) && (float)oldresult[key] == (float)result[key])
  659. {
  660. strkeys.Add(key);
  661. }
  662. else if (result[key].GetType() == typeof(int) && (int)oldresult[key] == (int)result[key])
  663. {
  664. strkeys.Add(key);
  665. }
  666. else if (result[key].GetType() == typeof(bool) && (bool)oldresult[key] == (bool)result[key])
  667. {
  668. strkeys.Add(key);
  669. }
  670. }
  671. }
  672. for (int i = 0; i < strkeys.Count; i++)
  673. {
  674. temp.Remove(strkeys[i]);
  675. }
  676. }
  677. catch (Exception ex)
  678. {
  679. LOG.Error("由RT返回的数据更新失败" + "ClearNotChangedValue", ex);
  680. }
  681. }
  682. return temp;
  683. }
  684. protected override void Poll()
  685. {
  686. if (_subscribedKeys.Count > 0)
  687. {
  688. Dictionary<string, object> result = QueryDataClient.Instance.Service.PollData(_subscribedKeys);
  689. Dictionary<string, object> Tempresult = new Dictionary<string, object>(result);
  690. result = ClearNotChangedValue(result);
  691. oldresult = Tempresult;
  692. if (result == null)
  693. {
  694. LOG.Error("获取RT数据失败");
  695. return;
  696. }
  697. if (result.Count != _subscribedKeys.Count)
  698. {
  699. string unknowKeys = string.Empty;
  700. foreach (string key in _subscribedKeys)
  701. {
  702. if (!result.ContainsKey(key))
  703. {
  704. unknowKeys += key + "\r\n";
  705. }
  706. }
  707. }
  708. InvokeBeforeUpdateProperty(result);
  709. UpdateValue(result);
  710. Application.Current?.Dispatcher.Invoke(new System.Action(() =>
  711. {
  712. if (result.Count != 0)
  713. {
  714. InvokePropertyChanged();
  715. }
  716. InvokeAfterUpdateProperty(result);
  717. }));
  718. }
  719. }
  720. protected override void InvokeBeforeUpdateProperty(Dictionary<string, object> data)
  721. {
  722. //List<string> aITValveDataKeys = new List<string>();
  723. //List<string> aITSensorDataKeys = new List<string>();
  724. //List<string> aITMfcDataKeys = new List<string>();
  725. //foreach (var item in data.Keys)
  726. //{
  727. // try
  728. // {
  729. // if (data[item].GetType() == typeof(AITValveData))
  730. // {
  731. // var array = item.Split('.');
  732. // if (array.Length > 1)
  733. // {
  734. // var name = array[1];
  735. // var property = this.GetType().GetProperties().Where(x => x.Name == name).FirstOrDefault();
  736. // object value = property.GetValue(this, null);
  737. // if (value != null && ((AITValveData)value).Equals((AITValveData)data[item]))
  738. // aITValveDataKeys.Add(item);
  739. // }
  740. // }
  741. // else if (data[item].GetType() == typeof(AITSensorData))
  742. // {
  743. // var array = item.Split('.');
  744. // if (array.Length > 1)
  745. // {
  746. // var name = array[1];
  747. // var property = this.GetType().GetProperties().Where(x => x.Name == name).FirstOrDefault();
  748. // object value = property.GetValue(this, null);
  749. // if (value != null && ((AITSensorData)value).Equals((AITSensorData)data[item]))
  750. // aITSensorDataKeys.Add(item);
  751. // }
  752. // }
  753. // else if (data[item].GetType() == typeof(AITMfcData))
  754. // {
  755. // var array = item.Split('.');
  756. // if (array.Length > 1)
  757. // {
  758. // var name = array[1];
  759. // var property = this.GetType().GetProperties().Where(x => x.Name == $"{name}Data").FirstOrDefault();
  760. // object value = property.GetValue(this, null);
  761. // if (value != null && ((AITMfcData)value).Equals((AITMfcData)data[item]))
  762. // aITMfcDataKeys.Add(item);
  763. // }
  764. // }
  765. // }
  766. // catch (Exception ex)
  767. // {
  768. // Console.WriteLine(ex.Message);
  769. // }
  770. //}
  771. //if (aITValveDataKeys.Count > 0)
  772. //{
  773. // foreach (var item in aITValveDataKeys)
  774. // {
  775. // data.Remove(item);
  776. // }
  777. //}
  778. //if (aITSensorDataKeys.Count > 0)
  779. //{
  780. // foreach (var item in aITSensorDataKeys)
  781. // {
  782. // data.Remove(item);
  783. // }
  784. //}
  785. //if (aITMfcDataKeys.Count > 0)
  786. //{
  787. // foreach (var item in aITMfcDataKeys)
  788. // {
  789. // data.Remove(item);
  790. // }
  791. //}
  792. base.InvokeBeforeUpdateProperty(data);
  793. }
  794. protected override void InvokeAfterUpdateProperty(Dictionary<string, object> data)
  795. {
  796. base.InvokeAfterUpdateProperty(data);
  797. if (N2PurgeMode == "ManualMode")
  798. {
  799. SelectedGasStateType = GasPanelStateType.Manual;
  800. }
  801. else
  802. {
  803. SelectedGasStateType = GasPanelStateType.Monitor;
  804. }
  805. }
  806. public void SequenceSelect()
  807. {
  808. WindowManager wm = new WindowManager();
  809. bool? bret = wm.ShowDialogWithTitle(_selectSequence, null, "Sequence Select");
  810. if (bret.Value)
  811. {
  812. if (_selectSequence.DialogResultString != null || _selectSequence.DialogResultString != "")
  813. {
  814. SequenceSelected = _selectSequence.DialogResultView;
  815. N2PurgeModeDisplay = SequenceSelected;
  816. }
  817. }
  818. }
  819. }
  820. }