GasPanelViewModel.cs 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506
  1. using Aitex.Core.Common.DeviceData;
  2. using Aitex.Core.UI.ControlDataContext;
  3. using Aitex.Core.UI.MVVM;
  4. using Aitex.Core.Util;
  5. using MECF.Framework.Common.DataCenter;
  6. using MECF.Framework.Common.OperationCenter;
  7. using System.Windows.Input;
  8. using FurnaceUI.Models;
  9. namespace FurnaceUI.Views.Maintenances
  10. {
  11. public class GasPanelViewModel : FurnaceUIViewModelBase
  12. {
  13. public bool _ismanagerPermission = false;
  14. public bool IsManagerPermission
  15. {
  16. get
  17. {
  18. return _ismanagerPermission;
  19. }
  20. set
  21. {
  22. _ismanagerPermission = value;
  23. NotifyOfPropertyChange("IsManagerPermission");
  24. }
  25. }
  26. public ICommand CmdSetMfcFlow { get; set; }
  27. [Subscription("System.VentValve.DeviceData")]
  28. public AITValveData VentValveData { get; set; }
  29. [Subscription("System.PumpValve.DeviceData")]
  30. public AITValveData PumpValveData { get; set; }
  31. [Subscription("System.TubePressure.DeviceData")]
  32. public AITPressureMeterData TubePressureData { get; set; }
  33. [Subscription("PM1.NX2Valve.DeviceData")]
  34. public AITValveData NX2Valve { get; set; }
  35. [Subscription("PM1.NY2Valve.DeviceData")]
  36. public AITValveData NY2Valve { get; set; }
  37. [Subscription("PM1.N12Valve.DeviceData")]
  38. public AITValveData N12Valve { get; set; }
  39. [Subscription("PM1.N22Valve.DeviceData")]
  40. public AITValveData N22Valve { get; set; }
  41. [Subscription("PM1.N32Valve.DeviceData")]
  42. public AITValveData N32Valve { get; set; }
  43. [Subscription("PM1.M21Valve.DeviceData")]
  44. public AITValveData M21Valve { get; set; }
  45. [Subscription("PM1.M22Valve.DeviceData")]
  46. public AITValveData M22Valve { get; set; }
  47. [Subscription("PM1.M23Valve.DeviceData")]
  48. public AITValveData M23Valve { get; set; }
  49. [Subscription("PM1.M24Valve.DeviceData")]
  50. public AITValveData M24Valve { get; set; }
  51. [Subscription("PM1.D11Valve.DeviceData")]
  52. public AITValveData D11Valve { get; set; }
  53. [Subscription("PM1.D12Valve.DeviceData")]
  54. public AITValveData D12Valve { get; set; }
  55. [Subscription("PM1.D13Valve.DeviceData")]
  56. public AITValveData D13Valve { get; set; }
  57. [Subscription("PM1.D14Valve.DeviceData")]
  58. public AITValveData D14Valve { get; set; }
  59. [Subscription("PM1.D15Valve.DeviceData")]
  60. public AITValveData D15Valve { get; set; }
  61. [Subscription("PM1.M11Valve.DeviceData")]
  62. public AITValveData M11Valve { get; set; }
  63. [Subscription("PM1.M12Valve.DeviceData")]
  64. public AITValveData M12Valve { get; set; }
  65. [Subscription("PM1.M13Valve.DeviceData")]
  66. public AITValveData M13Valve { get; set; }
  67. [Subscription("PM1.M14Valve.DeviceData")]
  68. public AITValveData M14Valve { get; set; }
  69. [Subscription("PM1.J11Valve.DeviceData")]
  70. public AITValveData J11Valve { get; set; }
  71. [Subscription("PM1.J12Valve.DeviceData")]
  72. public AITValveData J12Valve { get; set; }
  73. [Subscription("PM1.J13Valve.DeviceData")]
  74. public AITValveData J13Valve { get; set; }
  75. [Subscription("PM1.J14Valve.DeviceData")]
  76. public AITValveData J14Valve { get; set; }
  77. [Subscription("PM1.NR2Valve.DeviceData")]
  78. public AITValveData NR2Valve { get; set; }
  79. [Subscription("PM1.NR3Valve.DeviceData")]
  80. public AITValveData NR3Valve { get; set; }
  81. [Subscription("PM1.NB1Valve.DeviceData")]
  82. public AITValveData NB1Valve { get; set; }
  83. [Subscription("PM1.MVValve.DeviceData")]
  84. public AITValveData MVValve { get; set; }
  85. [Subscription("PM1.SVValve.DeviceData")]
  86. public AITValveData SVValve { get; set; }
  87. [Subscription("PM1.SSVValve.DeviceData")]
  88. public AITValveData SSVValve { get; set; }
  89. [Subscription("PM1.IV1Valve.DeviceData")]
  90. public AITValveData IV1Valve { get; set; }
  91. [Subscription("PM1.IV2Valve.DeviceData")]
  92. public AITValveData IV2Valve { get; set; }
  93. [Subscription("PM1.VV1Valve.DeviceData")]
  94. public AITValveData VV1Valve { get; set; }
  95. [Subscription("PM1.VV2Valve.DeviceData")]
  96. public AITValveData VV2Valve { get; set; }
  97. [Subscription("PM1.LV1Valve.DeviceData")]
  98. public AITValveData LV1Valve { get; set; }
  99. [Subscription("PM1.SensorPureN2PressureOK.DeviceData")]
  100. public AITSensorData SensorPureN2PressureOK { get; set; }
  101. [Subscription("PM1.SensorNH3PressureOK.DeviceData")]
  102. public AITSensorData SensorNH3PressureOK { get; set; }
  103. [Subscription("PM1.SensorSiH2CL2PressureOK.DeviceData")]
  104. public AITSensorData SensorSiH2CL2PressureOK { get; set; }
  105. [Subscription("PM1.SensorN2OPressureOK.DeviceData")]
  106. public AITSensorData SensorN2OPressureOK { get; set; }
  107. [Subscription("PM1.SensorPSW1LOW.DeviceData")]
  108. public AITSensorData SensorPSW1LOW { get; set; }
  109. [Subscription("PM1.SensorPSW2LOW.DeviceData")]
  110. public AITSensorData SensorPSW2LOW { get; set; }
  111. [Subscription("PM1.SensorGUExhaustOK.DeviceData")]
  112. public AITSensorData SensorGUExhaustOK { get; set; }
  113. [Subscription("PM1.SensorTubeATMPressure.DeviceData")]
  114. public AITSensorData SensorTubeATMPressure { get; set; }
  115. [Subscription("PM1.MfcNX.DeviceData")]
  116. public AITMfcData MfcNXData { get; set; }
  117. [Subscription("PM1.MfcNY.DeviceData")]
  118. public AITMfcData MfcNYData { get; set; }
  119. [Subscription("PM1.MfcN1.DeviceData")]
  120. public AITMfcData MfcN1Data { get; set; }
  121. [Subscription("PM1.MfcN2.DeviceData")]
  122. public AITMfcData MfcN2Data { get; set; }
  123. [Subscription("PM1.MfcM1.DeviceData")]
  124. public AITMfcData MfcM1Data { get; set; }
  125. [Subscription("PM1.MfcD1.DeviceData")]
  126. public AITMfcData MfcD1Data { get; set; }
  127. [Subscription("PM1.MfcXY1.DeviceData")]
  128. public AITMfcData MfcXY1Data { get; set; }
  129. [Subscription("PM1.MfcXF1.DeviceData")]
  130. public AITMfcData MfcXF1Data { get; set; }
  131. [Subscription("PM1.MfcV1.DeviceData")]
  132. public AITMfcData MfcV1Data { get; set; }
  133. [Subscription("PM1.MfcNN1.DeviceData")]
  134. public AITMfcData MfcNN1Data { get; set; }
  135. [Subscription("PM1.MfcNN2.DeviceData")]
  136. public AITMfcData MfcNN2Data { get; set; }
  137. [Subscription("PM1.MfcF1.DeviceData")]
  138. public AITMfcData MfcF1Data { get; set; }
  139. [Subscription("PM1.MfcNV1.DeviceData")]
  140. public AITMfcData MfcNV1Data { get; set; }
  141. [Subscription("PM1.MfcNB.DeviceData")]
  142. public AITMfcData MfcNBData { get; set; }
  143. [Subscription("PM1.MfmD1.DeviceData")]
  144. public AITWaterFlowMeterData MfmD1Flow { get; set; }
  145. private bool _isMfcNRInstalled;
  146. public bool IsMfcNRInstalled
  147. {
  148. get => _isMfcNRInstalled;
  149. set
  150. {
  151. _isMfcNRInstalled = value;
  152. NotifyOfPropertyChange(nameof(IsMfcNRInstalled));
  153. }
  154. }
  155. public AnalogDeviceDataItem MfcNX
  156. {
  157. get
  158. {
  159. return new AnalogDeviceDataItem
  160. {
  161. Type = "MFC",
  162. DeviceName = MfcNXData.UniqueName,
  163. DeviceId = MfcNXData.DeviceSchematicId,
  164. DisplayName = MfcNXData.DisplayName,
  165. Scale = MfcNXData.Scale,
  166. Unit = MfcNXData.Unit,
  167. FeedBack = MfcNXData.FeedBack,
  168. SetPoint = MfcNXData.SetPoint,
  169. };
  170. }
  171. }
  172. public AnalogDeviceDataItem MfcNY
  173. {
  174. get
  175. {
  176. return new AnalogDeviceDataItem
  177. {
  178. Type = "MFC",
  179. DeviceName = MfcNYData.UniqueName,
  180. DeviceId = MfcNYData.DeviceSchematicId,
  181. DisplayName = MfcNYData.DisplayName,
  182. Scale = MfcNYData.Scale,
  183. Unit = MfcNYData.Unit,
  184. FeedBack = MfcNYData.FeedBack,
  185. SetPoint = MfcNYData.SetPoint,
  186. };
  187. }
  188. }
  189. public AnalogDeviceDataItem MfcN1
  190. {
  191. get
  192. {
  193. return new AnalogDeviceDataItem
  194. {
  195. Type = "MFC",
  196. DeviceName = MfcN1Data.UniqueName,
  197. DeviceId = MfcN1Data.DeviceSchematicId,
  198. DisplayName = MfcN1Data.DisplayName,
  199. Scale = MfcN1Data.Scale,
  200. Unit = MfcN1Data.Unit,
  201. FeedBack = MfcN1Data.FeedBack,
  202. SetPoint = MfcN1Data.SetPoint,
  203. };
  204. }
  205. }
  206. public AnalogDeviceDataItem MfcN2
  207. {
  208. get
  209. {
  210. return new AnalogDeviceDataItem
  211. {
  212. Type = "MFC",
  213. DeviceName = MfcN2Data.UniqueName,
  214. DeviceId = MfcN2Data.DeviceSchematicId,
  215. DisplayName = MfcN2Data.DisplayName,
  216. Scale = MfcN2Data.Scale,
  217. Unit = MfcN2Data.Unit,
  218. FeedBack = MfcN2Data.FeedBack,
  219. SetPoint = MfcN2Data.SetPoint,
  220. };
  221. }
  222. }
  223. public AnalogDeviceDataItem MfcM1
  224. {
  225. get
  226. {
  227. return new AnalogDeviceDataItem
  228. {
  229. Type = "MFC",
  230. DeviceName = MfcM1Data.UniqueName,
  231. DeviceId = MfcM1Data.DeviceSchematicId,
  232. DisplayName = MfcM1Data.DisplayName,
  233. Scale = MfcM1Data.Scale,
  234. Unit = MfcM1Data.Unit,
  235. FeedBack = MfcM1Data.FeedBack,
  236. SetPoint = MfcM1Data.SetPoint,
  237. };
  238. }
  239. }
  240. public AnalogDeviceDataItem MfcD1
  241. {
  242. get
  243. {
  244. return new AnalogDeviceDataItem
  245. {
  246. Type = "MFC",
  247. DeviceName = MfcD1Data.UniqueName,
  248. DeviceId = MfcD1Data.DeviceSchematicId,
  249. DisplayName = MfcD1Data.DisplayName,
  250. Scale = MfcD1Data.Scale,
  251. Unit = MfcD1Data.Unit,
  252. FeedBack = MfcD1Data.FeedBack,
  253. SetPoint = MfcD1Data.SetPoint,
  254. };
  255. }
  256. }
  257. public AnalogDeviceDataItem MfcXY1
  258. {
  259. get
  260. {
  261. return new AnalogDeviceDataItem
  262. {
  263. Type = "MFC",
  264. DeviceName = MfcXY1Data.UniqueName,
  265. DeviceId = MfcXY1Data.DeviceSchematicId,
  266. DisplayName = MfcXY1Data.DisplayName,
  267. Scale = MfcXY1Data.Scale,
  268. Unit = MfcXY1Data.Unit,
  269. FeedBack = MfcXY1Data.FeedBack,
  270. SetPoint = MfcXY1Data.SetPoint,
  271. };
  272. }
  273. }
  274. public AnalogDeviceDataItem MfcXF1
  275. {
  276. get
  277. {
  278. return new AnalogDeviceDataItem
  279. {
  280. Type = "MFC",
  281. DeviceName = MfcXF1Data.UniqueName,
  282. DeviceId = MfcXF1Data.DeviceSchematicId,
  283. DisplayName = MfcXF1Data.DisplayName,
  284. Scale = MfcXF1Data.Scale,
  285. Unit = MfcXF1Data.Unit,
  286. FeedBack = MfcXF1Data.FeedBack,
  287. SetPoint = MfcXF1Data.SetPoint,
  288. };
  289. }
  290. }
  291. public AnalogDeviceDataItem MfcV1
  292. {
  293. get
  294. {
  295. return new AnalogDeviceDataItem
  296. {
  297. Type = "MFC",
  298. DeviceName = MfcV1Data.UniqueName,
  299. DeviceId = MfcV1Data.DeviceSchematicId,
  300. DisplayName = MfcV1Data.DisplayName,
  301. Scale = MfcV1Data.Scale,
  302. Unit = MfcV1Data.Unit,
  303. FeedBack = MfcV1Data.FeedBack,
  304. SetPoint = MfcV1Data.SetPoint,
  305. };
  306. }
  307. }
  308. public AnalogDeviceDataItem MfcNN1
  309. {
  310. get
  311. {
  312. return new AnalogDeviceDataItem
  313. {
  314. Type = "MFC",
  315. DeviceName = MfcNN1Data.UniqueName,
  316. DeviceId = MfcNN1Data.DeviceSchematicId,
  317. DisplayName = MfcNN1Data.DisplayName,
  318. Scale = MfcNN1Data.Scale,
  319. Unit = MfcNN1Data.Unit,
  320. FeedBack = MfcNN1Data.FeedBack,
  321. SetPoint = MfcNN1Data.SetPoint,
  322. };
  323. }
  324. }
  325. public AnalogDeviceDataItem MfcNN2
  326. {
  327. get
  328. {
  329. return new AnalogDeviceDataItem
  330. {
  331. Type = "MFC",
  332. DeviceName = MfcNN2Data.UniqueName,
  333. DeviceId = MfcNN2Data.DeviceSchematicId,
  334. DisplayName = MfcNN2Data.DisplayName,
  335. Scale = MfcNN2Data.Scale,
  336. Unit = MfcNN2Data.Unit,
  337. FeedBack = MfcNN2Data.FeedBack,
  338. SetPoint = MfcNN2Data.SetPoint,
  339. };
  340. }
  341. }
  342. public AnalogDeviceDataItem MfcF1
  343. {
  344. get
  345. {
  346. return new AnalogDeviceDataItem
  347. {
  348. Type = "MFC",
  349. DeviceName = MfcF1Data.UniqueName,
  350. DeviceId = MfcF1Data.DeviceSchematicId,
  351. DisplayName = MfcF1Data.DisplayName,
  352. Scale = MfcF1Data.Scale,
  353. Unit = MfcF1Data.Unit,
  354. FeedBack = MfcF1Data.FeedBack,
  355. SetPoint = MfcF1Data.SetPoint,
  356. };
  357. }
  358. }
  359. public AnalogDeviceDataItem MfcNV1
  360. {
  361. get
  362. {
  363. return new AnalogDeviceDataItem
  364. {
  365. Type = "MFC",
  366. DeviceName = MfcNV1Data.UniqueName,
  367. DeviceId = MfcNV1Data.DeviceSchematicId,
  368. DisplayName = MfcNV1Data.DisplayName,
  369. Scale = MfcNV1Data.Scale,
  370. Unit = MfcNV1Data.Unit,
  371. FeedBack = MfcNV1Data.FeedBack,
  372. SetPoint = MfcNV1Data.SetPoint,
  373. };
  374. }
  375. }
  376. public AnalogDeviceDataItem MfcNB
  377. {
  378. get
  379. {
  380. return new AnalogDeviceDataItem
  381. {
  382. Type = "MFC",
  383. DeviceName = MfcNBData.UniqueName,
  384. DeviceId = MfcNBData.DeviceSchematicId,
  385. DisplayName = MfcNBData.DisplayName,
  386. Scale = MfcNBData.Scale,
  387. Unit = MfcNBData.Unit,
  388. FeedBack = MfcNBData.FeedBack,
  389. SetPoint = MfcNBData.SetPoint,
  390. };
  391. }
  392. }
  393. public AnalogDeviceDataItem NBMfCData
  394. {
  395. get
  396. {
  397. return new AnalogDeviceDataItem
  398. {
  399. Type = "MFC",
  400. DeviceName = MfcNBData.UniqueName,
  401. DeviceId = MfcNBData.DeviceSchematicId,
  402. DisplayName = MfcNBData.DisplayName,
  403. Scale = MfcNBData.Scale,
  404. Unit = MfcNBData.Unit,
  405. FeedBack = MfcNBData.FeedBack,
  406. SetPoint = MfcNBData.SetPoint,
  407. };
  408. }
  409. }
  410. private bool _manualCheckSelect = false;
  411. private bool _manualCheck;
  412. public bool ManualCheck
  413. {
  414. get => _manualCheck;
  415. set
  416. {
  417. _manualCheck = value;
  418. NotifyOfPropertyChange(nameof(ManualCheck));
  419. }
  420. }
  421. private bool _manualCheckHide;
  422. public bool ManumalCheckHide
  423. {
  424. get => _manualCheckHide;
  425. set
  426. {
  427. _manualCheckHide = value;
  428. NotifyOfPropertyChange(nameof(ManumalCheckHide));
  429. }
  430. }
  431. public bool EnableServiceControl { get; set; }
  432. public GasPanelViewModel()
  433. {
  434. CmdSetMfcFlow = new DelegateCommand<object>(PerformCmdSetMfcFlow);
  435. }
  436. protected override void OnActivate()
  437. {
  438. base.OnActivate();
  439. EnableServiceControl = (bool)QueryDataClient.Instance.Service.GetConfig("System.IsServiceControlMode");
  440. // IsMfcNRInstalled = (bool)QueryDataClient.Instance.Service.GetConfig("PM1.MFC.MfcNR.IsMFCInstalled");
  441. }
  442. protected override void OnDeactivate(bool close)
  443. {
  444. base.OnDeactivate(close);
  445. //IsManagerPermission = false;
  446. }
  447. public void SetManual()
  448. {
  449. if (!_manualCheckSelect)
  450. {
  451. _manualCheckSelect = !_manualCheckSelect;
  452. IsManagerPermission = true;
  453. }
  454. else
  455. {
  456. IsManagerPermission = false;
  457. ManualCheck = false;
  458. ManumalCheckHide = true;
  459. _manualCheckSelect = !_manualCheckSelect;
  460. }
  461. }
  462. public void OpenAll()
  463. {
  464. if(!VentValveData.IsOpen)
  465. InvokeClient.Instance.Service.DoOperation($"{VentValveData.UniqueName}.{AITValveOperation.GVTurnValve}", true);
  466. if(!PumpValveData.IsOpen)
  467. InvokeClient.Instance.Service.DoOperation($"{PumpValveData.UniqueName}.{AITValveOperation.GVTurnValve}", true);
  468. }
  469. public void CloseAll()
  470. {
  471. if(PumpValveData.IsOpen)
  472. InvokeClient.Instance.Service.DoOperation($"{PumpValveData.UniqueName}.{AITValveOperation.GVTurnValve}", false);
  473. if (VentValveData.IsOpen)
  474. InvokeClient.Instance.Service.DoOperation($"{VentValveData.UniqueName}.{AITValveOperation.GVTurnValve}", false);
  475. }
  476. private void PerformCmdSetMfcFlow(object param)
  477. {
  478. object[] args = (object[])param; //0:devicename, 1:operation, 2:args
  479. if (args.Length == 3)
  480. {
  481. InvokeClient.Instance.Service.DoOperation($"{args[0]}.{args[1]}", args[2]);
  482. }
  483. }
  484. }
  485. }