N2PurgeStatusViewModel.cs 34 KB

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