N2PurgeStatusViewModel.cs 34 KB

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