GasPanelTwoViewModel.cs 56 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499
  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 FurnaceUI.Models;
  17. using MECF.Framework.UI.Core.Control;
  18. using static System.Windows.Forms.VisualStyles.VisualStyleElement.Window;
  19. using Aitex.Core.UI.Control;
  20. using OpenSEMI.ClientBase;
  21. using MECF.Framework.UI.Core.ExtendedControls;
  22. using System.Collections.ObjectModel;
  23. using FurnaceUI.Views.Recipes;
  24. namespace FurnaceUI.Views.Maintenances
  25. {
  26. public class GasPanelTwoViewModel : FurnaceUIViewModelBase
  27. {
  28. public bool ManualEnable { get; set; } = false;
  29. public string ManualEnableContent
  30. {
  31. get
  32. {
  33. return ManualEnable ? "Monitor" : "Manual";
  34. }
  35. }
  36. public string ManualEnableColor
  37. {
  38. get
  39. {
  40. if (ManualEnable)
  41. {
  42. return "Green";
  43. }
  44. return "#FFB0D1F1";
  45. }
  46. }
  47. public void SelectedGasStateTypeCmd(string cmd)
  48. {
  49. switch (cmd)
  50. {
  51. case "Manual":
  52. SelectedGasStateType = GasPanelStateType.Manual;
  53. ManualChecked = true;
  54. MonitorChecked = false;
  55. ManualEnable = true;
  56. break;
  57. case "Monitor":
  58. SelectedGasStateType = GasPanelStateType.Monitor;
  59. ManualChecked = false;
  60. MonitorChecked = true;
  61. ManualEnable = false;
  62. break;
  63. case "Recipe":
  64. SelectedGasStateType = GasPanelStateType.Recipe;
  65. break;
  66. default:
  67. break;
  68. }
  69. }
  70. public bool MonitorChecked { get; set; } = false;
  71. public bool ManualChecked { get; set; } = true;
  72. public ICommand CmdSetMfcFlow { get; set; }
  73. public bool _ismanagerPermission = true;
  74. public Window WinOwner { get; set; }
  75. public bool IsManagerPermission
  76. {
  77. get
  78. {
  79. return _ismanagerPermission;
  80. }
  81. set
  82. {
  83. _ismanagerPermission = value;
  84. NotifyOfPropertyChange("IsManagerPermission");
  85. }
  86. }
  87. private bool _isRecipeEdit = false;
  88. public bool IsRecipeEdit
  89. {
  90. get
  91. {
  92. return _isRecipeEdit;
  93. }
  94. set
  95. {
  96. _isRecipeEdit = value;
  97. NotifyOfPropertyChange("IsRecipeEdit");
  98. }
  99. }
  100. public bool EditTrue { get; set; } = false;
  101. [Subscription("PM1.SensorRecipeOK")]
  102. public AITSensorData SensorRecipeOK { get; set; }
  103. [Subscription("PM1.SensorPROCManualOK")]
  104. public AITSensorData SensorPROCManualOK { get; set; }
  105. [Subscription("System.VentValve.DeviceData")]
  106. public AITValveData VentValveData { get; set; }
  107. [Subscription("System.PumpValve.DeviceData")]
  108. public AITValveData PumpValveData { get; set; }
  109. [Subscription("PM1.SensorTubeATMPressure.DeviceData")]
  110. public AITSensorData SensorTubeATMPressure { get; set; }
  111. [Subscription("System.TubePressure.DeviceData")]
  112. public AITPressureMeterData TubePressureData { get; set; }
  113. [Subscription("PM1.SensorVAC1.Value")]
  114. public bool VAC1 { get; set; }
  115. [Subscription("PM1.SensorVAC2.Value")]
  116. public bool VAC2 { get; set; }
  117. [Subscription("PM1.SensorVAC3.Value")]
  118. public bool VAC3 { get; set; }
  119. #region Valves
  120. [Subscription("PM1.ValveAV1.DeviceData")]
  121. public AITValveData ValveAV1Data { get; set; }
  122. [Subscription("PM1.ValveAV2.DeviceData")]
  123. public AITValveData ValveAV2Data { get; set; }
  124. [Subscription("PM1.ValveAV3.DeviceData")]
  125. public AITValveData ValveAV3Data { get; set; }
  126. [Subscription("PM1.ValveAV4.DeviceData")]
  127. public AITValveData ValveAV4Data { get; set; }
  128. [Subscription("PM1.ValveAV5.DeviceData")]
  129. public AITValveData ValveAV5Data { get; set; }
  130. [Subscription("PM1.ValveAV6.DeviceData")]
  131. public AITValveData ValveAV6Data { get; set; }
  132. [Subscription("PM1.ValveAV7.DeviceData")]
  133. public AITValveData ValveAV7Data { get; set; }
  134. [Subscription("PM1.ValveAV8.DeviceData")]
  135. public AITValveData ValveAV8Data { get; set; }
  136. [Subscription("PM1.ValveAV9.DeviceData")]
  137. public AITValveData ValveAV9Data { get; set; }
  138. [Subscription("PM1.ValveAV10.DeviceData")]
  139. public AITValveData ValveAV10Data { get; set; }
  140. [Subscription("PM1.ValveAV11.DeviceData")]
  141. public AITValveData ValveAV11Data { get; set; }
  142. [Subscription("PM1.ValveAV12.DeviceData")]
  143. public AITValveData ValveAV12Data { get; set; }
  144. [Subscription("PM1.ValveAV13.DeviceData")]
  145. public AITValveData ValveAV13Data { get; set; }
  146. [Subscription("PM1.ValveAV14.DeviceData")]
  147. public AITValveData ValveAV14Data { get; set; }
  148. [Subscription("PM1.ValveAV15.DeviceData")]
  149. public AITValveData ValveAV15Data { get; set; }
  150. [Subscription("PM1.ValveAV16.DeviceData")]
  151. public AITValveData ValveAV16Data { get; set; }
  152. [Subscription("PM1.ValveAV17.DeviceData")]
  153. public AITValveData ValveAV17Data { get; set; }
  154. [Subscription("PM1.ValveAV18.DeviceData")]
  155. public AITValveData ValveAV18Data { get; set; }
  156. [Subscription("PM1.ValveAV19.DeviceData")]
  157. public AITValveData ValveAV19Data { get; set; }
  158. [Subscription("PM1.ValveAV20.DeviceData")]
  159. public AITValveData ValveAV20Data { get; set; }
  160. [Subscription("PM1.ValveAV21.DeviceData")]
  161. public AITValveData ValveAV21Data { get; set; }
  162. [Subscription("PM1.ValveAV22.DeviceData")]
  163. public AITValveData ValveAV22Data { get; set; }
  164. [Subscription("PM1.ValveAV23.DeviceData")]
  165. public AITValveData ValveAV23Data { get; set; }
  166. [Subscription("PM1.ValveAV24.DeviceData")]
  167. public AITValveData ValveAV24Data { get; set; }
  168. [Subscription("PM1.ValveAV25.DeviceData")]
  169. public AITValveData ValveAV25Data { get; set; }
  170. [Subscription("PM1.ValveAV26.DeviceData")]
  171. public AITValveData ValveAV26Data { get; set; }
  172. [Subscription("PM1.ValveAV27.DeviceData")]
  173. public AITValveData ValveAV27Data { get; set; }
  174. [Subscription("PM1.ValveAV28.DeviceData")]
  175. public AITValveData ValveAV28Data { get; set; }
  176. [Subscription("PM1.ValveAV29.DeviceData")]
  177. public AITValveData ValveAV29Data { get; set; }
  178. [Subscription("PM1.ValveAV30.DeviceData")]
  179. public AITValveData ValveAV30Data { get; set; }
  180. [Subscription("PM1.ValveAV31.DeviceData")]
  181. public AITValveData ValveAV31Data { get; set; }
  182. [Subscription("PM1.ValveAV32.DeviceData")]
  183. public AITValveData ValveAV32Data { get; set; }
  184. [Subscription("PM1.ValveAV33.DeviceData")]
  185. public AITValveData ValveAV33Data { get; set; }
  186. [Subscription("PM1.ValveAV34.DeviceData")]
  187. public AITValveData ValveAV34Data { get; set; }
  188. [Subscription("PM1.ValveAV35.DeviceData")]
  189. public AITValveData ValveAV35Data { get; set; }
  190. [Subscription("PM1.ValveAV36.DeviceData")]
  191. public AITValveData ValveAV36Data { get; set; }
  192. [Subscription("PM1.ValveAV37.DeviceData")]
  193. public AITValveData ValveAV37Data { get; set; }
  194. [Subscription("PM1.ValveAV38.DeviceData")]
  195. public AITValveData ValveAV38Data { get; set; }
  196. [Subscription("PM1.ValveAV39.DeviceData")]
  197. public AITValveData ValveAV39Data { get; set; }
  198. [Subscription("PM1.ValveAV52.DeviceData")]
  199. public AITValveData ValveAV52Data { get; set; }
  200. [Subscription("PM1.ValveAV54.DeviceData")]
  201. public AITValveData ValveAV54Data { get; set; }
  202. [Subscription("PM1.ValveAV56.DeviceData")]
  203. public AITValveData ValveAV56Data { get; set; }
  204. [Subscription("PM1.ValveAV57.DeviceData")]
  205. public AITValveData ValveAV57Data { get; set; }
  206. [Subscription("PM1.ValveAV58.DeviceData")]
  207. public AITValveData ValveAV58Data { get; set; }
  208. [Subscription("PM1.ValveAV59.DeviceData")]
  209. public AITValveData ValveAV59Data { get; set; }
  210. [Subscription("PM1.ValveAV60.DeviceData")]
  211. public AITValveData ValveAV60Data { get; set; }
  212. [Subscription("PM1.ValveFIMS1N2Purge.DeviceData")]
  213. public AITValveData ValveAV63Data { get; set; }
  214. [Subscription("PM1.ValveFIMS2N2Purge.DeviceData")]
  215. public AITValveData ValveAV64Data { get; set; }
  216. [Subscription("PM1.ValveAV65.DeviceData")]
  217. public AITValveData ValveAV65Data { get; set; }
  218. [Subscription("PM1.ValveAV66.DeviceData")]
  219. public AITValveData ValveAV66Data { get; set; }
  220. [Subscription("PM1.ValveAV68.DeviceData")]
  221. public AITValveData ValveAV68Data { get; set; }
  222. [Subscription("PM1.ValveAV71.DeviceData")]
  223. public AITValveData ValveAV71Data { get; set; }
  224. [Subscription("PM1.ValveAV72.DeviceData")]
  225. public AITValveData ValveAV72Data { get; set; }
  226. [Subscription("PM1.ValveAV73.DeviceData")]
  227. public AITValveData ValveAV73Data { get; set; }
  228. [Subscription("PM1.ValveAV74.DeviceData")]
  229. public AITValveData ValveAV74Data { get; set; }
  230. [Subscription("PM1.ValveAV75.DeviceData")]
  231. public AITValveData ValveAV75Data { get; set; }
  232. [Subscription("PM1.ValveAV77.DeviceData")]
  233. public AITValveData ValveAV77Data { get; set; }
  234. [Subscription("PM1.ValveAV81.DeviceData")]
  235. public AITValveData ValveAV81Data { get; set; }
  236. [Subscription("PM1.ValveAV82.DeviceData")]
  237. public AITValveData ValveAV82Data { get; set; }
  238. [Subscription("PM1.ValveAV83.DeviceData")]
  239. public AITValveData ValveAV83Data { get; set; }
  240. [Subscription("PM1.APC.ModeFeedback")]
  241. public int APCModeFeedback { get; set; }
  242. public AITValveData ValveAV1 { get; set; }
  243. public AITValveData ValveAV2 { get; set; }
  244. public AITValveData ValveAV3 { get; set; }
  245. public AITValveData ValveAV4 { get; set; }
  246. public AITValveData ValveAV5 { get; set; }
  247. public AITValveData ValveAV6 { get; set; }
  248. public AITValveData ValveAV7 { get; set; }
  249. public AITValveData ValveAV8 { get; set; }
  250. public AITValveData ValveAV9 { get; set; }
  251. public AITValveData ValveAV10 { get; set; }
  252. public AITValveData ValveAV11 { get; set; }
  253. public AITValveData ValveAV12 { get; set; }
  254. public AITValveData ValveAV13 { get; set; }
  255. public AITValveData ValveAV14 { get; set; }
  256. public AITValveData ValveAV15 { get; set; }
  257. public AITValveData ValveAV16 { get; set; }
  258. public AITValveData ValveAV17 { get; set; }
  259. public AITValveData ValveAV18 { get; set; }
  260. public AITValveData ValveAV19 { get; set; }
  261. public AITValveData ValveAV20 { get; set; }
  262. public AITValveData ValveAV21 { get; set; }
  263. public AITValveData ValveAV22 { get; set; }
  264. public AITValveData ValveAV23 { get; set; }
  265. public AITValveData ValveAV24 { get; set; }
  266. public AITValveData ValveAV25 { get; set; }
  267. public AITValveData ValveAV26 { get; set; }
  268. public AITValveData ValveAV27 { get; set; }
  269. public AITValveData ValveAV28 { get; set; }
  270. public AITValveData ValveAV29 { get; set; }
  271. public AITValveData ValveAV30 { get; set; }
  272. public AITValveData ValveAV31 { get; set; }
  273. public AITValveData ValveAV32 { get; set; }
  274. public AITValveData ValveAV33 { get; set; }
  275. public AITValveData ValveAV34 { get; set; }
  276. public AITValveData ValveAV35 { get; set; }
  277. public AITValveData ValveAV36 { get; set; }
  278. public AITValveData ValveAV37 { get; set; }
  279. public AITValveData ValveAV38 { get; set; }
  280. public AITValveData ValveAV39 { get; set; }
  281. public AITValveData ValveAV52 { get; set; }
  282. public AITValveData ValveAV54 { get; set; }
  283. public AITValveData ValveAV56 { get; set; }
  284. public AITValveData ValveAV57 { get; set; }
  285. public AITValveData ValveAV58 { get; set; }
  286. public AITValveData ValveAV59 { get; set; }
  287. public AITValveData ValveAV60 { get; set; }
  288. public AITValveData ValveAV63 { get; set; }
  289. public AITValveData ValveAV64 { get; set; }
  290. public AITValveData ValveAV65 { get; set; }
  291. public AITValveData ValveAV66 { get; set; }
  292. public AITValveData ValveAV68 { get; set; }
  293. public AITValveData ValveAV71 { get; set; }
  294. public AITValveData ValveAV72 { get; set; }
  295. public AITValveData ValveAV73 { get; set; }
  296. public AITValveData ValveAV74 { get; set; }
  297. public AITValveData ValveAV75 { get; set; }
  298. public AITValveData ValveAV77 { get; set; }
  299. public AITValveData ValveAV81 { get; set; }
  300. public AITValveData ValveAV82 { get; set; }
  301. public AITValveData ValveAV83 { get; set; }
  302. [Subscription("PM1.ValveAV91.DeviceData")]
  303. public AITValveData ValveDPR { get; set; }
  304. public AITValveData ValveDPRData { get; set; }
  305. public string ValveDPRBrush
  306. {
  307. get
  308. {
  309. if (ValveDPRData != null && ValveDPRData.Feedback)
  310. {
  311. return "Green";
  312. }
  313. return "#FFB0D1F1";
  314. }
  315. }
  316. [Subscription("PM1.ValveBlowerPowerOn.DeviceData")]
  317. public AITValveData ValveBWR { get; set; }
  318. public AITValveData ValveBWRData { get; set; }
  319. public string ValveBWRBrush
  320. {
  321. get
  322. {
  323. if (ValveBWRData != null && ValveBWRData.Feedback)
  324. {
  325. return "Green";
  326. }
  327. return "#FFB0D1F1";
  328. }
  329. }
  330. [Subscription("PM1.HTR1Enable")]
  331. public bool IsOldHTR1Enable { get; set; }
  332. public bool IsHTR1Enable { get; set; }
  333. public string HTR1Brush
  334. {
  335. get
  336. {
  337. if (IsHTR1Enable)
  338. {
  339. return "Green";
  340. }
  341. return "#FFB0D1F1";
  342. }
  343. }
  344. [Subscription("PM1.HTR2Enable")]
  345. public bool IsOldHTR2Enable { get; set; }
  346. public bool IsHTR2Enable { get; set; }
  347. public string HTR2Brush
  348. {
  349. get
  350. {
  351. if (IsHTR2Enable)
  352. {
  353. return "Green";
  354. }
  355. return "#FFB0D1F1";
  356. }
  357. }
  358. [Subscription("PM1.IsF2ClnOn")]
  359. public bool IsOldF2ClnOn { get; set; }
  360. public bool IsF2ClnOn { get; set; }
  361. public string F2ClnBrush
  362. {
  363. get
  364. {
  365. if (IsF2ClnOn)
  366. {
  367. return "Green";
  368. }
  369. return "#FFB0D1F1";
  370. }
  371. }
  372. [Subscription("PM1.IsHFClnOn")]
  373. public bool IsOldHFClnOn { get; set; }
  374. public bool IsHFClnOn { get; set; }
  375. public string HFClnBrush
  376. {
  377. get
  378. {
  379. if (IsHFClnOn)
  380. {
  381. return "Green";
  382. }
  383. return "#FFB0D1F1";
  384. }
  385. }
  386. [Subscription("PM1.AUCPump.DeviceData")]
  387. public AITValveData AUCPump { get; set; }
  388. public AITValveData AUCPumpData { get; set; }
  389. public string AUCPumpBrush
  390. {
  391. get
  392. {
  393. if (AUCPumpData != null && AUCPumpData.Feedback)
  394. {
  395. return "Green";
  396. }
  397. return "#FFB0D1F1";
  398. }
  399. }
  400. [Subscription("PM1.BothPump.DeviceData")]
  401. public AITValveData BothPump { get; set; }
  402. public AITValveData BothPumpData { get; set; }
  403. public string BothPumpBrush
  404. {
  405. get
  406. {
  407. if (BothPumpData != null && BothPumpData.Feedback)
  408. {
  409. return "Green";
  410. }
  411. return "#FFB0D1F1";
  412. }
  413. }
  414. [Subscription("PM1.AGVPump.DeviceData")]
  415. public AITValveData AGVPump { get; set; }
  416. public AITValveData AGVPumpData { get; set; }
  417. public string AGVPumpBrush
  418. {
  419. get
  420. {
  421. if (AGVPumpData != null && AGVPumpData.Feedback)
  422. {
  423. return "Green";
  424. }
  425. return "#FFB0D1F1";
  426. }
  427. }
  428. #endregion
  429. #region MFCs
  430. [Subscription("PM1.MFC1.DeviceData")]
  431. public AITMfcData MFC1Data { get; set; }
  432. [Subscription("PM1.MFC2.DeviceData")]
  433. public AITMfcData MFC2Data { get; set; }
  434. [Subscription("PM1.MFC3.DeviceData")]
  435. public AITMfcData MFC3Data { get; set; }
  436. [Subscription("PM1.MFC4.DeviceData")]
  437. public AITMfcData MFC4Data { get; set; }
  438. [Subscription("PM1.MFC5.DeviceData")]
  439. public AITMfcData MFC5Data { get; set; }
  440. [Subscription("PM1.MFC6.DeviceData")]
  441. public AITMfcData MFC6Data { get; set; }
  442. [Subscription("PM1.MFC7.DeviceData")]
  443. public AITMfcData MFC7Data { get; set; }
  444. [Subscription("PM1.MFC8.DeviceData")]
  445. public AITMfcData MFC8Data { get; set; }
  446. [Subscription("PM1.MFC9.DeviceData")]
  447. public AITMfcData MFC9Data { get; set; }
  448. [Subscription("PM1.MFC10.DeviceData")]
  449. public AITMfcData MFC10Data { get; set; }
  450. [Subscription("PM1.MFC11.DeviceData")]
  451. public AITMfcData MFC11Data { get; set; }
  452. [Subscription("PM1.MFC12.DeviceData")]
  453. public AITMfcData MFC12Data { get; set; }
  454. [Subscription("PM1.MFC51.DeviceData")]
  455. public AITMfcData MFC51Data { get; set; }
  456. #endregion
  457. [Subscription("PM1.MFM57.DeviceData")]
  458. public AITWaterFlowMeterData MFM57Flow { get; set; }
  459. [Subscription("PM1.RfPower.IsPowerOn")]
  460. public bool IsPowerOn { get; set; }
  461. [Subscription("PM1.RfPower.PowerSetPoint")]
  462. public float PowerSetPoint { get; set; }
  463. [Subscription("PM1.RfPower.ForwardPower")]
  464. public float ForwardPower { get; set; }
  465. [Subscription("PM1.RfMatch.Capacitance1PositionFeedBack")]
  466. public float Capacitance1PositionFeedBack { get; set; }
  467. [Subscription("PM1.RfMatch.Capacitance2PositionFeedBack")]
  468. public float Capacitance2PositionFeedBack { get; set; }
  469. [Subscription("PM1.RfMatch.VppFeedBack")]
  470. public float VppFeedBack { get; set; }
  471. private GasPanelStateType _selectedGasStateType = GasPanelStateType.Manual;
  472. public GasPanelStateType SelectedGasStateType
  473. {
  474. get
  475. {
  476. return _selectedGasStateType;
  477. }
  478. set
  479. {
  480. _selectedGasStateType = value;
  481. NotifyOfPropertyChange(nameof(SelectedGasStateType));
  482. }
  483. }
  484. public ICommand CmdSetValve { get; set; }
  485. public AnalogDeviceDataItem MFC1 { get; set; }
  486. public AnalogDeviceDataItem MFC2 { get; set; }
  487. public AnalogDeviceDataItem MFC3 { get; set; }
  488. public AnalogDeviceDataItem MFC4 { get; set; }
  489. public AnalogDeviceDataItem MFC5 { get; set; }
  490. public AnalogDeviceDataItem MFC6 { get; set; }
  491. public AnalogDeviceDataItem MFC7 { get; set; }
  492. public AnalogDeviceDataItem MFC8 { get; set; }
  493. public AnalogDeviceDataItem MFC9 { get; set; }
  494. public AnalogDeviceDataItem MFC10 { get; set; }
  495. public AnalogDeviceDataItem MFC11 { get; set; }
  496. public AnalogDeviceDataItem MFC12 { get; set; }
  497. public AnalogDeviceDataItem MFC51 { get; set; }
  498. //{
  499. // get
  500. // {
  501. // return new AnalogDeviceDataItem
  502. // {
  503. // Type = "MFC",
  504. // DeviceName = MFC51Data.UniqueName,
  505. // DeviceId = MFC51Data.DeviceSchematicId,
  506. // DisplayName = MFC51Data.DisplayName,
  507. // Scale = MFC51Data.Scale,
  508. // Unit = MFC51Data.Unit,
  509. // // FeedBack = MFC51Data.FeedBack,
  510. // // SetPoint = MFC51Data.SetPoint,
  511. // };
  512. // }
  513. // }
  514. public AnalogDeviceDataItem MFM57 { get; set; }
  515. //{
  516. // get
  517. // {
  518. // return new AnalogDeviceDataItem
  519. // {
  520. // Type = "MFM",
  521. // DeviceId = MFM57Flow.DeviceSchematicId,
  522. // DisplayName = MFM57Flow.DisplayName,
  523. // Scale = MFM57Flow.Scale,
  524. // Unit = MFM57Flow.Unit,
  525. // // FeedBack = MFM57Flow.FeedBack,
  526. // // SetPoint = MFM57Flow.SetPoint,
  527. // };
  528. // }
  529. // }
  530. private ObservableCollection<MFCGasData> _mFCDatas = new ObservableCollection<MFCGasData>();
  531. public ObservableCollection<MFCGasData> MFCDataList
  532. {
  533. get => _mFCDatas;
  534. set
  535. {
  536. _mFCDatas = value;
  537. NotifyOfPropertyChange(nameof(MFCDataList));
  538. }
  539. }
  540. public string IsRfPowerOn
  541. {
  542. get
  543. {
  544. return IsPowerOn ? "On" : "Off";
  545. }
  546. }
  547. private bool _manualCheckSelect = false;
  548. private bool _manualCheck = true;
  549. public bool ManualCheck
  550. {
  551. get => _manualCheck;
  552. set
  553. {
  554. _manualCheck = value;
  555. NotifyOfPropertyChange(nameof(ManualCheck));
  556. }
  557. }
  558. private bool _manualCheckHide;
  559. public bool ManumalCheckHide
  560. {
  561. get => _manualCheckHide;
  562. set
  563. {
  564. _manualCheckHide = value;
  565. NotifyOfPropertyChange(nameof(ManumalCheckHide));
  566. }
  567. }
  568. public bool EnableServiceControl
  569. {
  570. get
  571. {
  572. return true;
  573. }
  574. set
  575. {
  576. }
  577. }
  578. public bool ValveTrue { get; set; } = true;
  579. public bool ValveFalse { get; set; } = false;
  580. private bool _enablePLCPointControl = false;
  581. public bool EnablePLCPointControl
  582. {
  583. get => _enablePLCPointControl;
  584. set
  585. {
  586. _enablePLCPointControl = value;
  587. NotifyOfPropertyChange(nameof(EnablePLCPointControl));
  588. }
  589. }
  590. private bool firstOne = true;
  591. private Dictionary<string, bool> DictValveAV = new Dictionary<string, bool>();
  592. private Dictionary<string, double> DictMFC = new Dictionary<string, double>();
  593. public GasPanelTwoViewModel()
  594. {
  595. NotifyOfPropertyChange(nameof(ValveAV1Data));
  596. CmdSetMfcFlow = new DelegateCommand<object>(PerformCmdSetMfcFlow);
  597. CmdSetValve = new DelegateCommand<object>(SetValveCommand);
  598. }
  599. private void CreateValveAV()
  600. {
  601. ValveAV1 = CreateNewValveAV(ValveAV1Data, "ValveAV1");
  602. ValveAV2 = CreateNewValveAV(ValveAV2Data, "ValveAV2");
  603. ValveAV3 = CreateNewValveAV(ValveAV3Data, "ValveAV3");
  604. ValveAV4 = CreateNewValveAV(ValveAV4Data, "ValveAV4");
  605. ValveAV5 = CreateNewValveAV(ValveAV5Data, "ValveAV5");
  606. ValveAV6 = CreateNewValveAV(ValveAV6Data, "ValveAV6");
  607. ValveAV7 = CreateNewValveAV(ValveAV7Data, "ValveAV7");
  608. ValveAV8 = CreateNewValveAV(ValveAV8Data, "ValveAV8");
  609. ValveAV9 = CreateNewValveAV(ValveAV9Data, "ValveAV9");
  610. ValveAV10 = CreateNewValveAV(ValveAV10Data, "ValveAV10");
  611. ValveAV11 = CreateNewValveAV(ValveAV11Data, "ValveAV11");
  612. ValveAV12 = CreateNewValveAV(ValveAV12Data, "ValveAV12");
  613. ValveAV13 = CreateNewValveAV(ValveAV13Data, "ValveAV13");
  614. ValveAV14 = CreateNewValveAV(ValveAV14Data, "ValveAV14");
  615. ValveAV15 = CreateNewValveAV(ValveAV15Data, "ValveAV15");
  616. ValveAV16 = CreateNewValveAV(ValveAV16Data, "ValveAV16");
  617. ValveAV17 = CreateNewValveAV(ValveAV17Data, "ValveAV17");
  618. ValveAV18 = CreateNewValveAV(ValveAV18Data, "ValveAV18");
  619. ValveAV19 = CreateNewValveAV(ValveAV19Data, "ValveAV19");
  620. ValveAV20 = CreateNewValveAV(ValveAV20Data, "ValveAV20");
  621. ValveAV21 = CreateNewValveAV(ValveAV21Data, "ValveAV21");
  622. ValveAV22 = CreateNewValveAV(ValveAV22Data, "ValveAV22");
  623. ValveAV23 = CreateNewValveAV(ValveAV23Data, "ValveAV23");
  624. ValveAV24 = CreateNewValveAV(ValveAV24Data, "ValveAV24");
  625. ValveAV25 = CreateNewValveAV(ValveAV25Data, "ValveAV25");
  626. ValveAV26 = CreateNewValveAV(ValveAV26Data, "ValveAV26");
  627. ValveAV27 = CreateNewValveAV(ValveAV27Data, "ValveAV27");
  628. ValveAV28 = CreateNewValveAV(ValveAV28Data, "ValveAV28");
  629. ValveAV29 = CreateNewValveAV(ValveAV29Data, "ValveAV29");
  630. ValveAV30 = CreateNewValveAV(ValveAV30Data, "ValveAV30");
  631. ValveAV31 = CreateNewValveAV(ValveAV31Data, "ValveAV31");
  632. ValveAV32 = CreateNewValveAV(ValveAV32Data, "ValveAV32");
  633. ValveAV33 = CreateNewValveAV(ValveAV33Data, "ValveAV33");
  634. ValveAV34 = CreateNewValveAV(ValveAV34Data, "ValveAV34");
  635. ValveAV35 = CreateNewValveAV(ValveAV35Data, "ValveAV35");
  636. ValveAV36 = CreateNewValveAV(ValveAV36Data, "ValveAV36");
  637. ValveAV37 = CreateNewValveAV(ValveAV37Data, "ValveAV37");
  638. ValveAV38 = CreateNewValveAV(ValveAV38Data, "ValveAV38");
  639. ValveAV39 = CreateNewValveAV(ValveAV39Data, "ValveAV39");
  640. ValveAV52 = CreateNewValveAV(ValveAV52Data, "ValveAV52");
  641. ValveAV54 = CreateNewValveAV(ValveAV54Data, "ValveAV54");
  642. ValveAV56 = CreateNewValveAV(ValveAV56Data, "ValveAV56");
  643. ValveAV57 = CreateNewValveAV(ValveAV57Data, "ValveAV57");
  644. ValveAV58 = CreateNewValveAV(ValveAV58Data, "ValveAV58");
  645. ValveAV59 = CreateNewValveAV(ValveAV59Data, "ValveAV59");
  646. ValveAV60 = CreateNewValveAV(ValveAV60Data, "ValveAV60");
  647. ValveAV63 = CreateNewValveAV(ValveAV63Data, "ValveAV63");
  648. ValveAV64 = CreateNewValveAV(ValveAV64Data, "ValveAV64");
  649. ValveAV65 = CreateNewValveAV(ValveAV65Data, "ValveAV65");
  650. ValveAV66 = CreateNewValveAV(ValveAV66Data, "ValveAV66");
  651. ValveAV68 = CreateNewValveAV(ValveAV68Data, "ValveAV68");
  652. ValveAV71 = CreateNewValveAV(ValveAV71Data, "ValveAV71");
  653. ValveAV72 = CreateNewValveAV(ValveAV72Data, "ValveAV72");
  654. ValveAV73 = CreateNewValveAV(ValveAV73Data, "ValveAV73");
  655. ValveAV74 = CreateNewValveAV(ValveAV74Data, "ValveAV74");
  656. ValveAV75 = CreateNewValveAV(ValveAV75Data, "ValveAV75");
  657. ValveAV77 = CreateNewValveAV(ValveAV77Data, "ValveAV77");
  658. ValveAV81 = CreateNewValveAV(ValveAV81Data, "ValveAV81");
  659. ValveAV82 = CreateNewValveAV(ValveAV82Data, "ValveAV82");
  660. ValveAV83 = CreateNewValveAV(ValveAV83Data, "ValveAV83");
  661. }
  662. private AITValveData CreateNewValveAV(AITValveData valve, string valveName)
  663. {
  664. if (valve != null)
  665. {
  666. if (valveName == "ValveAV71")
  667. {
  668. return new AITValveData()
  669. {
  670. DeviceName = valve.DeviceName,
  671. DisplayName = valve.DisplayName,
  672. UniqueName = valve.UniqueName,
  673. DefaultValue = valve.DefaultValue,
  674. SetPoint = valve.SetPoint,
  675. Feedback = APCModeFeedback != 5,
  676. VirtualFeedback = valve.VirtualFeedback
  677. };
  678. }
  679. else
  680. {
  681. return new AITValveData()
  682. {
  683. DeviceName = valve.DeviceName,
  684. DisplayName = valve.DisplayName,
  685. UniqueName = valve.UniqueName,
  686. DefaultValue = valve.DefaultValue,
  687. SetPoint = valve.SetPoint,
  688. Feedback = valve.Feedback,
  689. VirtualFeedback = valve.VirtualFeedback
  690. };
  691. }
  692. }
  693. else
  694. {
  695. return new AITValveData()
  696. {
  697. DeviceName = valveName,
  698. DisplayName = valveName,
  699. DefaultValue = false,
  700. SetPoint = false,
  701. Feedback = false,
  702. VirtualFeedback = false
  703. };
  704. }
  705. }
  706. private void CreateMFCs()
  707. {
  708. MFC1 = CreateNewMFC(MFC1Data);
  709. MFC2 = CreateNewMFC(MFC2Data);
  710. MFC3 = CreateNewMFC(MFC3Data);
  711. MFC4 = CreateNewMFC(MFC4Data);
  712. MFC5 = CreateNewMFC(MFC5Data);
  713. MFC6 = CreateNewMFC(MFC6Data);
  714. MFC7 = CreateNewMFC(MFC7Data);
  715. MFC8 = CreateNewMFC(MFC8Data);
  716. MFC9 = CreateNewMFC(MFC9Data);
  717. MFC10 = CreateNewMFC(MFC10Data);
  718. MFC11 = CreateNewMFC(MFC11Data);
  719. MFC12 = CreateNewMFC(MFC12Data);
  720. MFC51 = CreateNewMFC(MFC51Data);
  721. }
  722. private AnalogDeviceDataItem CreateNewMFC(AITMfcData mfcData)
  723. {
  724. return new AnalogDeviceDataItem
  725. {
  726. Type = "MFC",
  727. DeviceName = mfcData.UniqueName,
  728. DeviceId = mfcData.DeviceSchematicId,
  729. DisplayName = mfcData.DisplayName,
  730. Scale = mfcData.Scale,
  731. Unit = mfcData.Unit,
  732. FeedBack = mfcData.FeedBack,
  733. SetPoint = mfcData.SetPoint,
  734. };
  735. }
  736. public void StartUpdate()
  737. {
  738. base.OnActivate();
  739. }
  740. protected override void OnActivate()
  741. {
  742. base.OnActivate();
  743. firstOne = true;
  744. EnableServiceControl = (bool)QueryDataClient.Instance.Service.GetConfig("System.IsServiceControlMode");
  745. // IsMfcNRInstalled = (bool)QueryDataClient.Instance.Service.GetConfig("PM1.MFC.MfcNR.IsMFCInstalled");
  746. }
  747. public void SetEditClick()
  748. {
  749. IsRecipeEdit = true;
  750. EnableServiceControl = false;
  751. }
  752. protected override void OnDeactivate(bool close)
  753. {
  754. base.OnDeactivate(close);
  755. //IsManagerPermission = false;
  756. }
  757. public void SetManual()
  758. {
  759. if (!_manualCheckSelect)
  760. {
  761. _manualCheckSelect = !_manualCheckSelect;
  762. IsManagerPermission = true;
  763. EnablePLCPointControl = false;
  764. }
  765. else
  766. {
  767. IsManagerPermission = true;
  768. ManualCheck = false;
  769. ManumalCheckHide = true;
  770. _manualCheckSelect = !_manualCheckSelect;
  771. EnablePLCPointControl = true;
  772. }
  773. }
  774. //public void OpenAll()
  775. //{
  776. // if (!VentValveData.IsOpen)
  777. // InvokeClient.Instance.Service.DoOperation($"{VentValveData.UniqueName}.{AITValveOperation.GVTurnValve}", true);
  778. // if (!PumpValveData.IsOpen)
  779. // InvokeClient.Instance.Service.DoOperation($"{PumpValveData.UniqueName}.{AITValveOperation.GVTurnValve}", true);
  780. //}
  781. //public void CloseAll()
  782. //{
  783. // if (PumpValveData.IsOpen)
  784. // InvokeClient.Instance.Service.DoOperation($"{PumpValveData.UniqueName}.{AITValveOperation.GVTurnValve}", false);
  785. // if (VentValveData.IsOpen)
  786. // InvokeClient.Instance.Service.DoOperation($"{VentValveData.UniqueName}.{AITValveOperation.GVTurnValve}", false);
  787. //}
  788. private void PerformCmdSetMfcFlow(object param)
  789. {
  790. object[] args = (object[])param; //0:devicename, 1:operation, 2:args
  791. if (args.Length == 3)
  792. {
  793. InvokeClient.Instance.Service.DoOperation($"{args[0]}.{args[1]}", args[2]);
  794. }
  795. }
  796. public void SetValveCommand(object param)
  797. {
  798. object[] args = (object[])param;
  799. if (args.Length == 3)
  800. {
  801. InvokeClient.Instance.Service.DoOperation($"{args[0]}.{args[1]}", args[2]);
  802. }
  803. }
  804. bool isSensorRecipeOK = false;
  805. Dictionary<string, object> oldresult;
  806. private Dictionary<string, object> ClearNotChangedValue(Dictionary<string, object> result)
  807. {
  808. Dictionary<string, object> temp = result;
  809. if (oldresult == null)
  810. {
  811. oldresult = result;
  812. }
  813. else
  814. {
  815. try
  816. {
  817. List<string> strkeys = new List<string>();
  818. foreach (var key in result.Keys)
  819. {
  820. if (_subscribedKeys.Contains(key) && oldresult.ContainsKey(key) && result.ContainsKey(key))
  821. {
  822. if (result[key].GetType() == typeof(AITValveData) && (((AITValveData)oldresult[key]).Feedback != ((AITValveData)result[key]).Feedback
  823. || ((AITValveData)oldresult[key]).VirtualFeedback != ((AITValveData)result[key]).VirtualFeedback))
  824. {
  825. strkeys.Add(key);
  826. }
  827. else if (result[key].GetType() == typeof(AITSensorData) && ((AITSensorData)oldresult[key]).Value != ((AITSensorData)result[key]).Value)
  828. {
  829. strkeys.Add(key);
  830. }
  831. else if (result[key].GetType() == typeof(AITMfcData) && (((AITMfcData)oldresult[key]).FeedBack != ((AITMfcData)result[key]).FeedBack ||
  832. ((AITMfcData)oldresult[key]).VirtualFeedBack != ((AITMfcData)result[key]).VirtualFeedBack))
  833. {
  834. strkeys.Add(key);
  835. }
  836. else if (result[key].GetType() == typeof(float) && (float)oldresult[key] == (float)result[key])
  837. {
  838. strkeys.Add(key);
  839. }
  840. else if (result[key].GetType() == typeof(int) && (int)oldresult[key] == (int)result[key])
  841. {
  842. strkeys.Add(key);
  843. }
  844. else if (result[key].GetType() == typeof(bool) && (bool)oldresult[key] == (bool)result[key])
  845. {
  846. strkeys.Add(key);
  847. }
  848. }
  849. }
  850. for (int i = 0; i < strkeys.Count; i++)
  851. {
  852. temp.Remove(strkeys[i]);
  853. }
  854. }
  855. catch (Exception ex)
  856. {
  857. LOG.Error("由RT返回的数据更新失败" + "ClearNotChangedValue", ex);
  858. }
  859. }
  860. return temp;
  861. }
  862. protected override void Poll()
  863. {
  864. if (_subscribedKeys.Count > 0)
  865. {
  866. Dictionary<string, object> result = QueryDataClient.Instance.Service.PollData(_subscribedKeys);
  867. Dictionary<string, object> Tempresult = new Dictionary<string, object>(result);
  868. if (SelectedGasStateType != GasPanelStateType.Monitor)
  869. {
  870. result = ClearNotChangedValue(result);
  871. }
  872. //oldresult = Tempresult;
  873. if (result == null)
  874. {
  875. LOG.Error("获取RT数据失败");
  876. return;
  877. }
  878. //if (result.Count != _subscribedKeys.Count)
  879. //{
  880. string unknowKeys = string.Empty;
  881. foreach (string key in _subscribedKeys)
  882. {
  883. if (!result.ContainsKey(key))
  884. {
  885. unknowKeys += key + "\r\n";
  886. }
  887. }
  888. //}
  889. InvokeBeforeUpdateProperty(result);
  890. UpdateValue(result);
  891. Application.Current?.Dispatcher.Invoke(new Action(() =>
  892. {
  893. if (result.Count != 0)
  894. {
  895. InvokePropertyChanged();
  896. foreach (var item in result.Values)
  897. {
  898. InvokePropertyChanged(nameof(item));
  899. var properties = item.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance);
  900. foreach (var subItem in properties)
  901. {
  902. InvokePropertyChanged(nameof(subItem));
  903. }
  904. }
  905. }
  906. InvokeAfterUpdateProperty(result);
  907. }));
  908. }
  909. }
  910. protected override void InvokeBeforeUpdateProperty(Dictionary<string, object> data)
  911. {
  912. base.InvokeBeforeUpdateProperty(data);
  913. }
  914. protected override void InvokeAfterUpdateProperty(Dictionary<string, object> data)
  915. {
  916. base.InvokeAfterUpdateProperty(data);
  917. if (SensorRecipeOK != null && SensorRecipeOK.Value)
  918. {
  919. if (isSensorRecipeOK != SensorRecipeOK.Value)
  920. {
  921. _manualCheckSelect = false;
  922. IsManagerPermission = true;
  923. IsRecipeEdit = true;
  924. EnableServiceControl = false;
  925. }
  926. isSensorRecipeOK = SensorRecipeOK.Value;
  927. }
  928. var properties = GetType().GetProperties();
  929. foreach (var item in properties)
  930. {
  931. var tempObj = item.GetValue(this);
  932. if (tempObj is AITValveData)
  933. {
  934. var subProperties = ((AITValveData)tempObj).GetType().GetProperties();
  935. foreach (var subItem in subProperties)
  936. {
  937. NotifyOfPropertyChange(subItem.Name);
  938. }
  939. }
  940. }
  941. if (AGVPumpData == null && AGVPump != null)
  942. {
  943. AGVPumpData = CreateNewValveAV(AGVPump, "AGVPump");
  944. AGVPumpData.DefaultValue = AGVPump.Feedback;
  945. AGVPumpData.Feedback = AGVPump.Feedback;
  946. }
  947. if (BothPumpData == null && BothPump != null)
  948. {
  949. BothPumpData = CreateNewValveAV(BothPump, "BothPump");
  950. BothPumpData.DefaultValue = BothPump.Feedback;
  951. BothPumpData.Feedback = BothPump.Feedback;
  952. }
  953. if (AUCPumpData == null && AUCPump != null)
  954. {
  955. AUCPumpData = CreateNewValveAV(AUCPump, "AUCPump");
  956. AUCPumpData.DefaultValue = AUCPump.Feedback;
  957. AUCPumpData.Feedback = AUCPump.Feedback;
  958. }
  959. if (ValveBWRData == null && ValveBWR != null)
  960. {
  961. ValveBWRData = CreateNewValveAV(ValveBWR, "ValveBWR");
  962. ValveBWRData.DefaultValue = ValveBWR.Feedback;
  963. ValveBWRData.Feedback = ValveBWR.Feedback;
  964. }
  965. if (ValveDPRData == null && ValveDPR != null)
  966. {
  967. ValveDPRData = CreateNewValveAV(ValveDPR, "ValveDPR");
  968. ValveDPRData.DefaultValue = ValveDPR.Feedback;
  969. ValveDPRData.Feedback = ValveDPR.Feedback;
  970. }
  971. if (firstOne)
  972. {
  973. firstOne = false;
  974. CreateValveAV();
  975. CreateMFCs();
  976. GetDefault(data);
  977. IsF2ClnOn = IsOldF2ClnOn;
  978. IsHFClnOn = IsOldHFClnOn;
  979. IsHTR1Enable = IsOldHTR1Enable;
  980. IsHTR2Enable = IsOldHTR2Enable;
  981. }
  982. if (SelectedGasStateType == GasPanelStateType.Monitor)
  983. {
  984. CreateMFCs();
  985. GetDefault(data);
  986. }
  987. }
  988. private void GetDefault(Dictionary<string, object> data)
  989. {
  990. GetDefaultMFC(data);
  991. GetDefaultValve(data);
  992. }
  993. private void GetDefaultMFC(Dictionary<string, object> data)
  994. {
  995. foreach (var item in data)
  996. {
  997. if (item.Value is AITMfcData)
  998. {
  999. var mfc = (AITMfcData)item.Value;
  1000. if (DictMFC.ContainsKey(mfc.DeviceName))
  1001. {
  1002. DictMFC[mfc.DeviceName] = mfc.FeedBack;
  1003. }
  1004. else
  1005. {
  1006. DictMFC.Add(mfc.DeviceName, mfc.FeedBack);
  1007. }
  1008. }
  1009. }
  1010. }
  1011. private void GetDefaultValve(Dictionary<string, object> data)
  1012. {
  1013. foreach (var item in data)
  1014. {
  1015. if (item.Value is AITValveData)
  1016. {
  1017. var valve = (AITValveData)item.Value;
  1018. if (DictValveAV.ContainsKey(valve.DeviceName))
  1019. {
  1020. DictValveAV[valve.DeviceName] = valve.Feedback;
  1021. }
  1022. else
  1023. {
  1024. DictValveAV.Add(valve.DeviceName, valve.Feedback);
  1025. }
  1026. }
  1027. }
  1028. }
  1029. public void SwichValue(string name)
  1030. {
  1031. if (SelectedGasStateType == GasPanelStateType.Monitor)
  1032. {
  1033. return;
  1034. }
  1035. var dialog = new SwitchValueDialog { };
  1036. dialog.IsOpen = true;
  1037. switch (name.ToUpper())
  1038. {
  1039. case "BWR":
  1040. dialog.IsOpen = ValveBWRData.Feedback;
  1041. break;
  1042. case "DPR":
  1043. dialog.IsOpen = ValveDPRData.Feedback;
  1044. break;
  1045. case "F2":
  1046. dialog.IsOpen = IsF2ClnOn;
  1047. break;
  1048. case "HF":
  1049. dialog.IsOpen = IsHFClnOn;
  1050. break;
  1051. }
  1052. dialog.Owner = WinOwner;
  1053. dialog.Topmost = true;
  1054. dialog.WindowStartupLocation = WindowStartupLocation.CenterScreen;
  1055. dialog.DeviceName = $"Swich {name}";
  1056. dialog.ShowDialog();
  1057. if ((bool)dialog.IsSave)
  1058. {
  1059. switch (name.ToUpper())
  1060. {
  1061. case "BWR":
  1062. ValveBWRData.Feedback = dialog.IsOpen;
  1063. //InvokeClient.Instance.Service.DoOperation($"{ValveBWR.UniqueName}.{AITValveOperation.GVTurnValve}", dialog.IsOpen);
  1064. break;
  1065. case "DPR":
  1066. ValveDPRData.Feedback = dialog.IsOpen;
  1067. //InvokeClient.Instance.Service.DoOperation($"{ValveDPR.UniqueName}.{AITValveOperation.GVTurnValve}", dialog.IsOpen);
  1068. break;
  1069. case "F2":
  1070. IsF2ClnOn = dialog.IsOpen;
  1071. //InvokeClient.Instance.Service.DoOperation($"PM1.SetF2ClnEnable", dialog.IsOpen);
  1072. break;
  1073. case "HF":
  1074. IsHFClnOn = dialog.IsOpen;
  1075. //InvokeClient.Instance.Service.DoOperation($"PM1.SetHFClnEnable", dialog.IsOpen);
  1076. break;
  1077. }
  1078. }
  1079. }
  1080. public void SetEnable(string name)
  1081. {
  1082. if (SelectedGasStateType == GasPanelStateType.Monitor)
  1083. {
  1084. return;
  1085. }
  1086. var dialog = new SwitchValueDialog2 { };
  1087. dialog.IsOpen = true;
  1088. switch (name.ToUpper())
  1089. {
  1090. case "HTR1":
  1091. dialog.IsOpen = IsHTR1Enable;
  1092. break;
  1093. case "HTR2":
  1094. dialog.IsOpen = IsHTR2Enable;
  1095. break;
  1096. }
  1097. dialog.Owner = WinOwner;
  1098. dialog.Topmost = true;
  1099. dialog.WindowStartupLocation = WindowStartupLocation.CenterScreen;
  1100. dialog.DeviceName = $"Swich {name}";
  1101. dialog.ShowDialog();
  1102. if ((bool)dialog.IsSave)
  1103. {
  1104. switch (name.ToUpper())
  1105. {
  1106. case "HTR1":
  1107. IsHTR1Enable = dialog.IsOpen;
  1108. //InvokeClient.Instance.Service.DoOperation($"PM1.SetHTR1Enable", dialog.IsOpen);
  1109. break;
  1110. case "HTR2":
  1111. IsHTR2Enable = dialog.IsOpen;
  1112. // InvokeClient.Instance.Service.DoOperation($"PM1.SetHTR2Enable", dialog.IsOpen);
  1113. break;
  1114. }
  1115. }
  1116. }
  1117. public void SelectPump(string _pumpname)
  1118. {
  1119. if (SelectedGasStateType == GasPanelStateType.Monitor)
  1120. {
  1121. return;
  1122. }
  1123. var dialog = new SwitchValueDialog { };
  1124. dialog.IsOpen = true;
  1125. switch (_pumpname.ToUpper())
  1126. {
  1127. case "AUC":
  1128. dialog.IsOpen = AUCPumpData.Feedback;
  1129. break;
  1130. case "AGV":
  1131. dialog.IsOpen = AGVPumpData.Feedback;
  1132. break;
  1133. case "BOTH":
  1134. dialog.IsOpen = BothPumpData.Feedback;
  1135. break;
  1136. case "DP":
  1137. dialog.IsOpen = BothPumpData.Feedback;
  1138. break;
  1139. }
  1140. dialog.Owner = WinOwner;
  1141. dialog.Topmost = true;
  1142. dialog.WindowStartupLocation = WindowStartupLocation.CenterScreen;
  1143. dialog.DeviceName = $"Swich {_pumpname}";
  1144. dialog.ShowDialog();
  1145. if ((bool)dialog.IsSave)
  1146. {
  1147. switch (_pumpname.ToUpper())
  1148. {
  1149. case "AUC":
  1150. AUCPumpData.Feedback = dialog.IsOpen;
  1151. break;
  1152. case "AGV":
  1153. AGVPumpData.Feedback = dialog.IsOpen;
  1154. break;
  1155. case "BOTH":
  1156. BothPumpData.Feedback = dialog.IsOpen;
  1157. break;
  1158. case "DP":
  1159. BothPumpData.Feedback = dialog.IsOpen;
  1160. break;
  1161. }
  1162. }
  1163. //if (!DialogBox.Confirm($"Are you sure change {_pumpname} status?"))
  1164. // return;
  1165. //if (_pumpname == "AUC")
  1166. //{
  1167. // InvokeClient.Instance.Service.DoOperation($"{AUCPump.UniqueName}.{AITValveOperation.GVTurnValve}", !AUCPump.Feedback);
  1168. //}
  1169. //if (_pumpname == "AGV")
  1170. //{
  1171. // InvokeClient.Instance.Service.DoOperation($"{AGVPump.UniqueName}.{AITValveOperation.GVTurnValve}", !AGVPump.Feedback);
  1172. //}
  1173. //if (_pumpname == "Both")
  1174. //{
  1175. // InvokeClient.Instance.Service.DoOperation($"{BothPump.UniqueName}.{AITValveOperation.GVTurnValve}", !BothPump.Feedback);
  1176. //}
  1177. }
  1178. public Dictionary<string, bool> DictChangedValve { get; set; } = new Dictionary<string, bool>();
  1179. public Dictionary<string, double> DictChangedMFC { get; set; } = new Dictionary<string, double>();
  1180. public Dictionary<string, bool> DictChangedPumpValve { get; set; } = new Dictionary<string, bool>();
  1181. public List<string> PumpNames = new List<string>() { "AGVPump", "BothPump", "AUCPump", "ValveBlowerPowerOn", "ValveAV91" };
  1182. private bool CheckChanged()
  1183. {
  1184. DictChangedValve.Clear();
  1185. var propList = this.GetType().GetProperties().ToList();
  1186. foreach (var item in DictValveAV)
  1187. {
  1188. var getProp = propList.FirstOrDefault(x => x.Name == item.Key);
  1189. if (getProp != null)
  1190. {
  1191. var valveNew = (AITValveData)getProp.GetValue(this);
  1192. if (!PumpNames.Contains(valveNew.DeviceName))
  1193. {
  1194. if (valveNew.Feedback != item.Value)
  1195. {
  1196. if (DictChangedValve.ContainsKey(item.Key))
  1197. {
  1198. DictChangedValve[item.Key] = valveNew.Feedback;
  1199. }
  1200. else
  1201. {
  1202. DictChangedValve.Add(item.Key, valveNew.Feedback);
  1203. }
  1204. }
  1205. }
  1206. }
  1207. }
  1208. DictChangedPumpValve.Clear();
  1209. SetPumpDataToDictChanged(AGVPumpData);
  1210. SetPumpDataToDictChanged(BothPumpData);
  1211. SetPumpDataToDictChanged(AUCPumpData);
  1212. SetPumpDataToDictChanged(ValveBWRData);
  1213. SetPumpDataToDictChanged(ValveDPRData);
  1214. SetClnToDictChanged();
  1215. DictChangedMFC.Clear();
  1216. foreach (var item in DictMFC)
  1217. {
  1218. var getProp = propList.FirstOrDefault(x => x.Name == item.Key);
  1219. if (getProp != null)
  1220. {
  1221. var mfcNew = (AnalogDeviceDataItem)getProp.GetValue(this);
  1222. if (mfcNew.IsCharge)
  1223. {
  1224. if (DictChangedMFC.ContainsKey(item.Key))
  1225. {
  1226. DictChangedMFC[item.Key] = mfcNew.SetValue;
  1227. }
  1228. else
  1229. {
  1230. DictChangedMFC.Add(item.Key, mfcNew.SetValue);
  1231. }
  1232. }
  1233. }
  1234. }
  1235. if (DictChangedValve.Count() > 0 || DictChangedMFC.Count() > 0 || DictChangedPumpValve.Count() > 0)
  1236. {
  1237. return true;
  1238. }
  1239. return false;
  1240. }
  1241. private void SetClnToDictChanged()
  1242. {
  1243. if (IsF2ClnOn!=IsOldF2ClnOn)
  1244. {
  1245. if (DictChangedPumpValve.ContainsKey("IsF2ClnOn"))
  1246. {
  1247. DictChangedPumpValve["IsF2ClnOn"] = IsF2ClnOn;
  1248. }
  1249. else
  1250. {
  1251. DictChangedPumpValve.Add("IsF2ClnOn", IsF2ClnOn);
  1252. }
  1253. }
  1254. else
  1255. {
  1256. if (DictChangedPumpValve.ContainsKey("IsF2ClnOn"))
  1257. {
  1258. DictChangedPumpValve.Remove("IsF2ClnOn");
  1259. }
  1260. }
  1261. if (IsHFClnOn!=IsOldHFClnOn)
  1262. {
  1263. if (DictChangedPumpValve.ContainsKey("IsHFClnOn"))
  1264. {
  1265. DictChangedPumpValve["IsHFClnOn"] = IsHFClnOn;
  1266. }
  1267. else
  1268. {
  1269. DictChangedPumpValve.Add("IsHFClnOn", IsHFClnOn);
  1270. }
  1271. }
  1272. else
  1273. {
  1274. if (DictChangedPumpValve.ContainsKey("IsHFClnOn"))
  1275. {
  1276. DictChangedPumpValve.Remove("IsHFClnOn");
  1277. }
  1278. }
  1279. if (IsHTR1Enable!=IsOldHTR1Enable)
  1280. {
  1281. if (DictChangedPumpValve.ContainsKey("IsHTR1Enable"))
  1282. {
  1283. DictChangedPumpValve["IsHTR1Enable"] = IsHTR1Enable;
  1284. }
  1285. else
  1286. {
  1287. DictChangedPumpValve.Add("IsHTR1Enable", IsHTR1Enable);
  1288. }
  1289. }
  1290. else
  1291. {
  1292. if (DictChangedPumpValve.ContainsKey("IsHTR1Enable"))
  1293. {
  1294. DictChangedPumpValve.Remove("IsHTR1Enable");
  1295. }
  1296. }
  1297. if (IsHTR2Enable!=IsOldHTR2Enable)
  1298. {
  1299. if (DictChangedPumpValve.ContainsKey("IsHTR2Enable"))
  1300. {
  1301. DictChangedPumpValve["IsHTR2Enable"] = IsHTR2Enable;
  1302. }
  1303. else
  1304. {
  1305. DictChangedPumpValve.Add("IsHTR2Enable", IsHTR2Enable);
  1306. }
  1307. }
  1308. else
  1309. {
  1310. if (DictChangedPumpValve.ContainsKey("IsHTR2Enable"))
  1311. {
  1312. DictChangedPumpValve.Remove("IsHTR2Enable");
  1313. }
  1314. }
  1315. }
  1316. private void SetPumpDataToDictChanged(AITValveData pumpData)
  1317. {
  1318. if (pumpData.DefaultValue != pumpData.Feedback)
  1319. {
  1320. if (DictChangedPumpValve.ContainsKey(pumpData.DeviceName))
  1321. {
  1322. DictChangedPumpValve[pumpData.DeviceName] = pumpData.Feedback;
  1323. }
  1324. else
  1325. {
  1326. DictChangedPumpValve.Add(pumpData.DeviceName, pumpData.Feedback);
  1327. }
  1328. }
  1329. }
  1330. public void SetAllClick()
  1331. {
  1332. if (CheckChanged())
  1333. {
  1334. //if (DictChangedMFC.Count > 0)
  1335. //{
  1336. // Dictionary<string, string> sendDict = new Dictionary<string, string>();
  1337. // foreach (var item in DictChangedMFC)
  1338. // {
  1339. // sendDict.Add(item.Key, item.Value.ToString("f3"));
  1340. // }
  1341. // // InvokeClient.Instance.Service.DoOperation($"PM1.SetAllMfcValue", sendDict);
  1342. //}
  1343. // if (DictChangedValve.Count > 0)
  1344. //InvokeClient.Instance.Service.DoOperation($"PM1.SetAll{AITValveOperation.GVTurnValve}", DictChangedValve);
  1345. }
  1346. else
  1347. {
  1348. MessageBox.Show($"The Settings were not modified!");
  1349. }
  1350. ((Window)GetView()).DialogResult = true;
  1351. }
  1352. public void CancelClick()
  1353. {
  1354. ((Window)GetView()).DialogResult = false;
  1355. TryClose(false);
  1356. }
  1357. }
  1358. }