N2PurgeStatusViewModel.cs 34 KB

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