ManualSetViewModel.cs 110 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513
  1. using Aitex.Core.Common.DeviceData;
  2. using Aitex.Core.RT.IOCore;
  3. using Aitex.Core.RT.Log;
  4. using Aitex.Core.Util;
  5. using Caliburn.Micro;
  6. using Caliburn.Micro.Core;
  7. using FurnaceGasPanelUI.Views.Maintenances;
  8. using FurnaceUI.Client;
  9. using FurnaceUI.Common;
  10. using FurnaceUI.Models;
  11. using FurnaceUI.Views.Editors;
  12. using FurnaceUI.Views.Operations;
  13. using FurnaceUI.Views.Parameter;
  14. using FurnaceUI.Views.Status;
  15. using MECF.Framework.Common.DataCenter;
  16. using MECF.Framework.Common.OperationCenter;
  17. using MECF.Framework.Common.RecipeCenter;
  18. using MECF.Framework.UI.Client.CenterViews.Configs.SystemConfig;
  19. using MECF.Framework.UI.Client.CenterViews.Dialogs;
  20. using MECF.Framework.UI.Client.CenterViews.Editors.Recipe;
  21. using MECF.Framework.UI.Client.ClientBase;
  22. using OpenSEMI.ClientBase;
  23. using RecipeEditorLib.RecipeModel.Params;
  24. using System;
  25. using System.Collections.Generic;
  26. using System.Collections.ObjectModel;
  27. using System.Linq;
  28. using System.Reflection;
  29. using System.Windows;
  30. using System.Windows.Controls;
  31. namespace FurnaceUI.Views.Recipes
  32. {
  33. public class ManualSetViewModel : FurnaceUIViewModelBase
  34. {
  35. [Subscription("PM1.CurrentAuxData")]
  36. public List<AITAuxData> AUXDetailDatas { get; set; }
  37. public string DefaultUnit { get; set; }
  38. #region MFCs
  39. [Subscription("PM1.MFC1.DeviceData")]
  40. public AITMfcData MFC1Data { get; set; }
  41. [Subscription("PM1.MFC2.DeviceData")]
  42. public AITMfcData MFC2Data { get; set; }
  43. [Subscription("PM1.MFC3.DeviceData")]
  44. public AITMfcData MFC3Data { get; set; }
  45. [Subscription("PM1.MFC4.DeviceData")]
  46. public AITMfcData MFC4Data { get; set; }
  47. [Subscription("PM1.MFC5.DeviceData")]
  48. public AITMfcData MFC5Data { get; set; }
  49. [Subscription("PM1.MFC6.DeviceData")]
  50. public AITMfcData MFC6Data { get; set; }
  51. [Subscription("PM1.MFC7.DeviceData")]
  52. public AITMfcData MFC7Data { get; set; }
  53. [Subscription("PM1.MFC8.DeviceData")]
  54. public AITMfcData MFC8Data { get; set; }
  55. [Subscription("PM1.MFC9.DeviceData")]
  56. public AITMfcData MFC9Data { get; set; }
  57. [Subscription("PM1.MFC10.DeviceData")]
  58. public AITMfcData MFC10Data { get; set; }
  59. [Subscription("PM1.MFC11.DeviceData")]
  60. public AITMfcData MFC11Data { get; set; }
  61. [Subscription("PM1.MFC12.DeviceData")]
  62. public AITMfcData MFC12Data { get; set; }
  63. [Subscription("PM1.MFC13.DeviceData")]
  64. public AITMfcData MFC13Data { get; set; }
  65. [Subscription("PM1.MFC14.DeviceData")]
  66. public AITMfcData MFC14Data { get; set; }
  67. [Subscription("PM1.MFC15.DeviceData")]
  68. public AITMfcData MFC15Data { get; set; }
  69. [Subscription("PM1.MFC16.DeviceData")]
  70. public AITMfcData MFC16Data { get; set; }
  71. [Subscription("PM1.MFC17.DeviceData")]
  72. public AITMfcData MFC17Data { get; set; }
  73. [Subscription("PM1.MFC31.DeviceData")]
  74. public AITMfcData MFC31Data { get; set; }
  75. [Subscription("PM1.MFC32.DeviceData")]
  76. public AITMfcData MFC32Data { get; set; }
  77. [Subscription("PM1.MFC51.DeviceData")]
  78. public AITMfcData MFC51Data { get; set; }
  79. #endregion
  80. [Subscription("PM1.EditRecipeStepNo")]
  81. public int EditRecipeStepNo { get; set; }
  82. [Subscription("PM1.EditRecipeName")]
  83. public string EditRecipeName { get; set; }
  84. [Subscription("PM1.EditRecipeStepName")]
  85. public string EditRecipeStepName { get; set; }
  86. private int ControlMode = 1;
  87. private UIElement _parent;
  88. [Subscription("System.HeaterU.DeviceData")]
  89. public AITHeaterData HeaterUData { get; set; }
  90. [Subscription("System.HeaterCU.DeviceData")]
  91. public AITHeaterData HeaterCUData { get; set; }
  92. [Subscription("System.HeaterC.DeviceData")]
  93. public AITHeaterData HeaterCData { get; set; }
  94. [Subscription("System.HeaterCL.DeviceData")]
  95. public AITHeaterData HeaterCLData { get; set; }
  96. [Subscription("System.HeaterL.DeviceData")]
  97. public AITHeaterData HeaterLData { get; set; }
  98. public AITHeaterData BottomHeaterData => HeaterLData;
  99. public AITHeaterData CenterBottomHeaterData => HeaterCLData;
  100. public AITHeaterData CenterHeaterData => HeaterCData;
  101. public AITHeaterData TopCenterHeaterData => HeaterCUData;
  102. public AITHeaterData TopHeaterData => HeaterUData;
  103. [Subscription("PM1.APC.DeviceData")]
  104. public AITAPCData APCData { get; set; }
  105. IWindowManager wm = IoC.Get<IWindowManager>();
  106. private string _selectBtnName;
  107. public string SelectBtnName
  108. {
  109. get { return _selectBtnName; }
  110. set { _selectBtnName = value; this.NotifyOfPropertyChange(nameof(SelectBtnName)); }
  111. }
  112. private string _temperatureControlMode;
  113. public string TemperatureControlMode
  114. {
  115. get => _temperatureControlMode;
  116. set
  117. {
  118. _temperatureControlMode = value;
  119. NotifyOfPropertyChange(nameof(TemperatureControlMode));
  120. }
  121. }
  122. private string _temperatureCorrect;
  123. public string TemperatureCorrect
  124. {
  125. get => _temperatureCorrect;
  126. set
  127. {
  128. _temperatureCorrect = value;
  129. NotifyOfPropertyChange(nameof(TemperatureCorrect));
  130. }
  131. }
  132. private string _temperaturePID;
  133. public string TemperaturePID
  134. {
  135. get => _temperaturePID;
  136. set
  137. {
  138. _temperaturePID = value;
  139. NotifyOfPropertyChange(nameof(TemperaturePID));
  140. }
  141. }
  142. private string _loaderCommand = "";
  143. public string LoaderCommand
  144. {
  145. get => _loaderCommand;
  146. set
  147. {
  148. _loaderCommand = value;
  149. NotifyOfPropertyChange(nameof(LoaderCommand));
  150. NotifyOfPropertyChange(nameof(LoaderCommandIsSaved));
  151. }
  152. }
  153. public string OldLoaderCommand { get; set; } = "";
  154. public void SetParent(UIElement parent)
  155. {
  156. _parent = parent;
  157. }
  158. public bool LoaderCommandIsSaved
  159. {
  160. get => LoaderCommand == OldLoaderCommand;
  161. }
  162. #region"Loader Set Value"
  163. private Visibility _loaderSet3SpeedVisibility = Visibility.Hidden;
  164. public Visibility LoaderSet3SpeedVisibility
  165. {
  166. get => _loaderSet3SpeedVisibility;
  167. set
  168. {
  169. _loaderSet3SpeedVisibility = value;
  170. NotifyOfPropertyChange(nameof(LoaderSet3SpeedVisibility));
  171. }
  172. }
  173. private Visibility _loaderSetSpeedVisibility = Visibility.Hidden;
  174. public Visibility LoaderSetSpeedVisibility
  175. {
  176. get => _loaderSetSpeedVisibility;
  177. set
  178. {
  179. _loaderSetSpeedVisibility = value;
  180. NotifyOfPropertyChange(nameof(LoaderSetSpeedVisibility));
  181. }
  182. }
  183. private Visibility _loaderSetSpeedFloatVisibility = Visibility.Hidden;
  184. public Visibility LoaderSetSpeedFloatVisibility
  185. {
  186. get => _loaderSetSpeedFloatVisibility;
  187. set
  188. {
  189. _loaderSetSpeedFloatVisibility = value;
  190. NotifyOfPropertyChange(nameof(LoaderSetSpeedFloatVisibility));
  191. }
  192. }
  193. private string _pressCommand = "";
  194. public string PressCommand
  195. {
  196. get => _pressCommand;
  197. set
  198. {
  199. _pressCommand = value;
  200. NotifyOfPropertyChange(nameof(PressCommand));
  201. NotifyOfPropertyChange(nameof(PressCommandIsSaved));
  202. }
  203. }
  204. public string OldPressCommand { get; set; } = "";
  205. public bool PressCommandIsSaved
  206. {
  207. get => _pressCommand == OldPressCommand;
  208. }
  209. public void SetShowLoaderValuePanel(string selectedCmd)
  210. {
  211. switch (selectedCmd)
  212. {
  213. case "Boat Load":
  214. case "Boat Unload":
  215. LoaderSet3SpeedVisibility = Visibility.Visible;
  216. LoaderSetSpeedVisibility = Visibility.Hidden;
  217. LoaderSetSpeedFloatVisibility = Visibility.Hidden;
  218. break;
  219. case "Boat Rotate":
  220. LoaderSet3SpeedVisibility = Visibility.Hidden;
  221. LoaderSetSpeedVisibility = Visibility.Hidden;
  222. LoaderSetSpeedFloatVisibility = Visibility.Visible;
  223. break;
  224. case "Boat CAP2":
  225. LoaderSet3SpeedVisibility = Visibility.Hidden;
  226. LoaderSetSpeedVisibility = Visibility.Visible;
  227. LoaderSetSpeedFloatVisibility = Visibility.Hidden;
  228. break;
  229. case "Stop(Include R-axis)":
  230. case "Boat Rotate Stop":
  231. case "Boat Loader Home":
  232. case "None":
  233. case "NONE":
  234. LoaderSet3SpeedVisibility = Visibility.Hidden;
  235. LoaderSetSpeedVisibility = Visibility.Hidden;
  236. LoaderSetSpeedFloatVisibility = Visibility.Hidden;
  237. break;
  238. default:
  239. break;
  240. }
  241. }
  242. public void SetLoaderValue(string selectedCmd, string Values)
  243. {
  244. switch (selectedCmd)
  245. {
  246. case "Boat Load":
  247. case "Boat Unload":
  248. if (string.IsNullOrEmpty(Values)) return;
  249. string[] list = Values.Split(';');
  250. if (list.Length < 3) return;
  251. Loader3Speed1 = int.Parse(list[0]);
  252. Loader3Speed2 = int.Parse(list[1]);
  253. Loader3Speed3 = int.Parse(list[2]);
  254. break;
  255. case "Boat Rotate":
  256. if (string.IsNullOrEmpty(Values)) return;
  257. LoaderRPM = double.Parse(Values);
  258. break;
  259. case "Boat CAP2":
  260. if (string.IsNullOrEmpty(Values)) return;
  261. LoaderSpeed = int.Parse(Values);
  262. break;
  263. case "Stop(Include R-axis)":
  264. case "Boat Rotate Stop":
  265. case "Boat Loader Home":
  266. case "None":
  267. break;
  268. default:
  269. break;
  270. }
  271. }
  272. public string GetSaveLoaderValue(string selectedCmd)
  273. {
  274. switch (selectedCmd)
  275. {
  276. case "Boat Load":
  277. case "Boat Unload":
  278. return $"{selectedCmd};{Loader3Speed1};{Loader3Speed2};{Loader3Speed3}";
  279. case "Boat Rotate":
  280. return $"{selectedCmd};{LoaderRPM.ToString()}";
  281. case "Boat CAP2":
  282. return $"{selectedCmd};{LoaderSpeed.ToString()}";
  283. case "Stop(Include R-axis)":
  284. case "Boat Rotate Stop":
  285. case "Boat Loader Home":
  286. case "None":
  287. return $"{selectedCmd};";
  288. default:
  289. return "";
  290. }
  291. }
  292. private int loader3Speed1 = 5;
  293. public int Loader3Speed1
  294. {
  295. get => loader3Speed1;
  296. set
  297. {
  298. loader3Speed1 = value;
  299. NotifyOfPropertyChange(nameof(Loader3Speed1));
  300. }
  301. }
  302. private int loader3Speed2 = 0;
  303. public int Loader3Speed2
  304. {
  305. get => loader3Speed2;
  306. set
  307. {
  308. loader3Speed2 = value;
  309. NotifyOfPropertyChange(nameof(Loader3Speed2));
  310. }
  311. }
  312. private int loader3Speed3 = 0;
  313. public int Loader3Speed3
  314. {
  315. get => loader3Speed3;
  316. set
  317. {
  318. loader3Speed3 = value;
  319. NotifyOfPropertyChange(nameof(Loader3Speed3));
  320. }
  321. }
  322. private double _loaderRPM = 0;
  323. public double LoaderRPM
  324. {
  325. get => _loaderRPM;
  326. set
  327. {
  328. _loaderRPM = value;
  329. NotifyOfPropertyChange(nameof(LoaderRPM));
  330. }
  331. }
  332. private int loaderSpeed = 0;
  333. public int LoaderSpeed
  334. {
  335. get => loaderSpeed;
  336. set
  337. {
  338. loaderSpeed = value;
  339. NotifyOfPropertyChange(nameof(LoaderSpeed));
  340. }
  341. }
  342. private void ClearLoaderSetValue()
  343. {
  344. Loader3Speed1 = 0;
  345. Loader3Speed2 = 0;
  346. Loader3Speed3 = 0;
  347. LoaderRPM = 0;
  348. LoaderSpeed = 0;
  349. }
  350. #endregion
  351. #region"PressVisibility"
  352. private Visibility _pressVisibility = Visibility.Hidden;
  353. public Visibility PressVisibility
  354. {
  355. get => _pressVisibility;
  356. set
  357. {
  358. _pressVisibility = value;
  359. NotifyOfPropertyChange(nameof(PressVisibility));
  360. }
  361. }
  362. private Visibility _pressSlowVacVisibility = Visibility.Hidden;
  363. public Visibility PressSlowVacVisibility
  364. {
  365. get => _pressSlowVacVisibility;
  366. set
  367. {
  368. _pressSlowVacVisibility = value;
  369. NotifyOfPropertyChange(nameof(PressSlowVacVisibility));
  370. }
  371. }
  372. private Visibility _pressValveAngleVisibility = Visibility.Hidden;
  373. public Visibility PressValveAngleVisibility
  374. {
  375. get => _pressValveAngleVisibility;
  376. set
  377. {
  378. _pressValveAngleVisibility = value;
  379. NotifyOfPropertyChange(nameof(PressValveAngleVisibility));
  380. }
  381. }
  382. private Visibility _pressWaitVisibility = Visibility.Hidden;
  383. public Visibility PressWaitVisibility
  384. {
  385. get => _pressWaitVisibility;
  386. set
  387. {
  388. _pressWaitVisibility = value;
  389. NotifyOfPropertyChange(nameof(PressWaitVisibility));
  390. }
  391. }
  392. private string _pressureCommand;
  393. public string PressureCommand
  394. {
  395. get => _pressureCommand;
  396. set
  397. {
  398. _pressureCommand = value;
  399. }
  400. }
  401. public void SetShowPressPanel(string selectedCmd)
  402. {
  403. switch (selectedCmd)
  404. {
  405. case "Press":
  406. case "Press2":
  407. PressVisibility = Visibility.Visible;
  408. PressSlowVacVisibility = Visibility.Hidden;
  409. PressValveAngleVisibility = Visibility.Hidden;
  410. PressWaitVisibility = Visibility.Hidden;
  411. break;
  412. case "Slow Vac":
  413. PressVisibility = Visibility.Hidden;
  414. PressSlowVacVisibility = Visibility.Visible;
  415. PressValveAngleVisibility = Visibility.Hidden;
  416. PressWaitVisibility = Visibility.Hidden;
  417. break;
  418. case "Valve Angle":
  419. PressVisibility = Visibility.Hidden;
  420. PressSlowVacVisibility = Visibility.Hidden;
  421. PressValveAngleVisibility = Visibility.Visible;
  422. PressWaitVisibility = Visibility.Hidden;
  423. break;
  424. case "Full Open":
  425. case "Full Close":
  426. case "Hold":
  427. case "Zero Set":
  428. case "Cancel Zero":
  429. case "Home":
  430. case "None":
  431. PressVisibility = Visibility.Hidden;
  432. PressSlowVacVisibility = Visibility.Hidden;
  433. PressValveAngleVisibility = Visibility.Hidden;
  434. PressWaitVisibility = Visibility.Hidden;
  435. break;
  436. case "WaitPressUp1":
  437. case "WaitPressDown1":
  438. case "WaitPressUp2":
  439. case "WaitPressDown2":
  440. PressVisibility = Visibility.Hidden;
  441. PressSlowVacVisibility = Visibility.Hidden;
  442. PressValveAngleVisibility = Visibility.Hidden;
  443. PressWaitVisibility = Visibility.Visible;
  444. break;
  445. default:
  446. break;
  447. }
  448. }
  449. public void SetPressValue(string selectedCmd, string Values)
  450. {
  451. switch (selectedCmd)
  452. {
  453. case "Press":
  454. case "Press2":
  455. if (string.IsNullOrEmpty(Values)) return;
  456. string[] list = Values.Split(';');
  457. if (list.Length < 2) return;
  458. PressPID = list[0];
  459. PressSet = double.Parse(list[1]);
  460. break;
  461. case "Slow Vac":
  462. if (string.IsNullOrEmpty(Values)) return;
  463. PressSlowVacSet = double.Parse(Values);
  464. break;
  465. case "Valve Angle":
  466. if (string.IsNullOrEmpty(Values)) return;
  467. PressValveAngleSet = double.Parse(Values);
  468. break;
  469. case "Full Open":
  470. case "Full Close":
  471. case "Hold":
  472. case "Zero Set":
  473. case "Cancel Zero":
  474. break;
  475. case "WaitPressUp1":
  476. case "WaitPressDown1":
  477. case "WaitPressUp2":
  478. case "WaitPressDown2":
  479. if (string.IsNullOrEmpty(Values)) return;
  480. PressWait = double.Parse(Values);
  481. break;
  482. default:
  483. break;
  484. }
  485. }
  486. public string GetSavePressValue(string selectedCmd)
  487. {
  488. switch (selectedCmd)
  489. {
  490. case "Press":
  491. case "Press2":
  492. return $"{PressPID};{PressSet}";
  493. case "Slow Vac":
  494. return PressSlowVacSet.ToString();
  495. case "Valve Angle":
  496. return PressValveAngleSet.ToString();
  497. case "Full Open":
  498. case "Full Close":
  499. case "Hold":
  500. case "Zero Set":
  501. case "Cancel Zero":
  502. return "";
  503. case "WaitPressUp1":
  504. case "WaitPressDown1":
  505. case "WaitPressUp2":
  506. case "WaitPressDown2":
  507. return PressWait.ToString();
  508. default:
  509. return "";
  510. }
  511. }
  512. private string _pressPID;
  513. public string PressPID
  514. {
  515. get => _pressPID;
  516. set
  517. {
  518. _pressPID = value;
  519. NotifyOfPropertyChange(nameof(PressPID));
  520. }
  521. }
  522. private double _pressSet;
  523. public double PressSet
  524. {
  525. get => _pressSet;
  526. set
  527. {
  528. _pressSet = value;
  529. NotifyOfPropertyChange(nameof(PressSet));
  530. }
  531. }
  532. private double _pressSlowVacSet;
  533. public double PressSlowVacSet
  534. {
  535. get => _pressSlowVacSet;
  536. set
  537. {
  538. _pressSlowVacSet = value;
  539. NotifyOfPropertyChange(nameof(PressSlowVacSet));
  540. }
  541. }
  542. private double _pressValveAngleSet;
  543. public double PressValveAngleSet
  544. {
  545. get => _pressValveAngleSet;
  546. set
  547. {
  548. _pressValveAngleSet = value;
  549. NotifyOfPropertyChange(nameof(PressValveAngleSet));
  550. }
  551. }
  552. private string _lowPressWait = "None";
  553. public string LowPressWait
  554. {
  555. get => _lowPressWait;
  556. set
  557. {
  558. _lowPressWait = value;
  559. NotifyOfPropertyChange(nameof(LowPressWait));
  560. }
  561. }
  562. private double _pressWait;
  563. public double PressWait
  564. {
  565. get => _pressWait;
  566. set
  567. {
  568. _pressWait = value;
  569. NotifyOfPropertyChange(nameof(PressWait));
  570. }
  571. }
  572. private void ClearPressSetValue()
  573. {
  574. PressPID = "None";
  575. PressSet = 0;
  576. PressSlowVacSet = 0;
  577. PressValveAngleSet = 0;
  578. LowPressWait = "None";
  579. PressWait = 0;
  580. }
  581. #endregion
  582. #region AlarmRecipe Visibility
  583. public bool IsAlarmReicpe => RecipeType.ToLower() == "alarm";
  584. public bool IsAbortReicpe => RecipeType.ToLower() == "abort";
  585. public bool IsSubReicpe => RecipeType.ToLower() == "sub";
  586. public bool IsTableVisibility => IsAlarmReicpe || IsAbortReicpe || IsSubReicpe;
  587. public bool IsRecipeHeaderVisibility => !IsTableVisibility;
  588. public bool IsVPDataListVisibility => !IsTableVisibility;
  589. public bool IsCombinationVisibility => !IsTableVisibility;
  590. #endregion
  591. private bool _noStandbyIsEnabled = false;
  592. public bool NoStandbyIsEnabled
  593. {
  594. get => _noStandbyIsEnabled;
  595. set
  596. {
  597. _noStandbyIsEnabled = value;
  598. NotifyOfPropertyChange(nameof(NoStandbyIsEnabled));
  599. }
  600. }
  601. private Visibility _standbyIsVisibility = Visibility.Visible;
  602. public Visibility StandbyIsVisibility
  603. {
  604. get => _standbyIsVisibility;
  605. set
  606. {
  607. _standbyIsVisibility = value;
  608. NotifyOfPropertyChange(nameof(StandbyIsVisibility));
  609. }
  610. }
  611. private string _selectedGasSetting2;
  612. public string SelectedGasSetting2
  613. {
  614. get
  615. {
  616. return _selectedGasSetting2;
  617. }
  618. set
  619. {
  620. _selectedGasSetting2 = value;
  621. NotifyOfPropertyChange(nameof(SelectedGasSetting2));
  622. }
  623. }
  624. private string _selectedGasSetting3;
  625. public string SelectedGasSetting3
  626. {
  627. get
  628. {
  629. return _selectedGasSetting3;
  630. }
  631. set
  632. {
  633. _selectedGasSetting3 = value;
  634. NotifyOfPropertyChange(nameof(SelectedGasSetting3));
  635. }
  636. }
  637. private string _selectedGasSetting4;
  638. public string SelectedGasSetting4
  639. {
  640. get
  641. {
  642. return _selectedGasSetting4;
  643. }
  644. set
  645. {
  646. _selectedGasSetting4 = value;
  647. NotifyOfPropertyChange(nameof(SelectedGasSetting4));
  648. }
  649. }
  650. private string _selectedGasSetting5;
  651. public string SelectedGasSetting5
  652. {
  653. get
  654. {
  655. return _selectedGasSetting5;
  656. }
  657. set
  658. {
  659. _selectedGasSetting5 = value;
  660. NotifyOfPropertyChange(nameof(SelectedGasSetting5));
  661. }
  662. }
  663. private string _selectedGasSetting6;
  664. public string SelectedGasSetting6
  665. {
  666. get
  667. {
  668. return _selectedGasSetting6;
  669. }
  670. set
  671. {
  672. _selectedGasSetting6 = value;
  673. NotifyOfPropertyChange(nameof(SelectedGasSetting6));
  674. }
  675. }
  676. private List<ConfigNode> _ConfigNodes = new List<ConfigNode>();
  677. public List<ConfigNode> ConfigNodes
  678. {
  679. get { return _ConfigNodes; }
  680. set
  681. {
  682. _ConfigNodes = value;
  683. NotifyOfPropertyChange(nameof(ConfigNodes));
  684. }
  685. }
  686. public ObservableCollection<TempManualSetData> TempList { get; set; } = new ObservableCollection<TempManualSetData>();
  687. private ObservableCollection<MFCGasData> _mFCDatas = new ObservableCollection<MFCGasData>();
  688. public ObservableCollection<MFCGasData> MFCDataList
  689. {
  690. get => _mFCDatas;
  691. set
  692. {
  693. _mFCDatas = value;
  694. NotifyOfPropertyChange(nameof(MFCDataList));
  695. }
  696. }
  697. private string _pressureUnit;
  698. public string PressureUnit
  699. {
  700. get => _pressureUnit;
  701. set
  702. {
  703. _pressureUnit = value;
  704. NotifyOfPropertyChange(nameof(PressureUnit));
  705. }
  706. }
  707. public string RecipeType { get; set; }
  708. public ManualSetViewModel()
  709. {
  710. }
  711. protected override void OnViewLoaded(object view)
  712. {
  713. base.OnViewLoaded(view);
  714. }
  715. protected override void OnActivate()
  716. {
  717. base.OnActivate();
  718. //InvokeClient.Instance.Service.DoOperation($"PM1.SetSensorRecipeOK", "");
  719. LoadData();
  720. }
  721. protected override void OnDeactivate(bool close)
  722. {
  723. base.OnDeactivate(close);
  724. //InvokeClient.Instance.Service.DoOperation($"PM1.SetSensorPROCManualOK", "");
  725. }
  726. protected override void OnInitialize()
  727. {
  728. base.OnInitialize();
  729. // GetHeaderConfig();
  730. }
  731. private void LoadData()
  732. {
  733. firstUpdate = true;
  734. }
  735. //撤销修改
  736. public void RecipeIsChangeClick(object cmdName, object value)
  737. {
  738. var windowManager = IoC.Get<IWindowManager>();
  739. switch ((string)cmdName)
  740. {
  741. case "Alarm":
  742. break;
  743. case "MFC":
  744. break;
  745. case "Gas":
  746. break;
  747. case "AUX":
  748. break;
  749. case "Press":
  750. break;
  751. case "Temp":
  752. break;
  753. default:
  754. break;
  755. }
  756. }
  757. public void TempSetClick(object sender)
  758. {
  759. string stSetValue = ShowNumberKeyboard(sender as Button, "", 1);
  760. foreach (var item in TempList)
  761. {
  762. item.Value = stSetValue;
  763. item.IsSetChanged = false;
  764. }
  765. }
  766. public Dictionary<string, bool> DictValve { get; set; } = new Dictionary<string, bool>();
  767. public Dictionary<string, string> DictMFC { get; set; } = new Dictionary<string, string>();
  768. public Dictionary<string, string> DictMFCRamp { get; set; } = new Dictionary<string, string>();
  769. public Dictionary<string, bool> PumpSetValues { get; set; } = new Dictionary<string, bool>();
  770. public Dictionary<string, bool> F2HFClnOrHFCl2Values { get; set; } = new Dictionary<string, bool>();
  771. private Dictionary<string, string> ChangedDictMFC(Dictionary<string, double> oldDict)
  772. {
  773. Dictionary<string, string> rtnKeyValue = new Dictionary<string, string>();
  774. foreach (var item in oldDict.Keys)
  775. {
  776. rtnKeyValue.Add(item, oldDict[item].ToString());
  777. }
  778. return rtnKeyValue;
  779. }
  780. public void PatternCmd()
  781. {
  782. string toolType = (string)QueryDataClient.Instance.Service.GetConfig("System.SetUp.ToolType");
  783. if (!string.IsNullOrEmpty(toolType) && toolType.Equals(ConstantsCommon.ELK))
  784. {
  785. FurnaceUI.Views.Maintenances.Maintenances.ELK.GasPanelViewModel gasPanelTwoView = new Maintenances.Maintenances.ELK.GasPanelViewModel();
  786. gasPanelTwoView.MFCDataList = MFCDataList;
  787. var rtn = (wm as WindowManager)?.ShowDialogWithTitle(gasPanelTwoView, null, " Gas Panel");
  788. if ((bool)rtn)
  789. {
  790. DictValve = gasPanelTwoView.DictChangedValve;
  791. DictMFC = ChangedDictMFC(gasPanelTwoView.DictChangedMFC);
  792. DictMFCRamp = ChangedDictMFC(gasPanelTwoView.DictChangedMFCRamp);
  793. foreach (var item in DictMFC)
  794. {
  795. var tempMFC = MFCDataList.FirstOrDefault(x => x.Name == item.Key);
  796. if (tempMFC != null)
  797. {
  798. tempMFC.IsSetChanged = false;
  799. tempMFC.Value = item.Value;
  800. }
  801. }
  802. foreach (var item in DictMFCRamp)
  803. {
  804. var tempMFC = MFCDataList.FirstOrDefault(x => x.Name == item.Key);
  805. if (tempMFC != null)
  806. {
  807. tempMFC.IsRampngChanged = false;
  808. tempMFC.Rampng = item.Value;
  809. }
  810. }
  811. if (DictMFC.Count == 0 && DictMFCRamp.Count == 0)
  812. {
  813. for (int i = 0; i < MFCDataList.Count; i++)
  814. {
  815. double setLastPoint = (double)QueryDataClient.Instance.Service.GetConfig($"PM1.MFC.{MFCDataList[i].DisplayName}.SetLastPoint");
  816. double setLastRamping = (double)QueryDataClient.Instance.Service.GetConfig($"PM1.MFC.{MFCDataList[i].DisplayName}.SetLastRamping");
  817. MFCDataList[i].Value = setLastPoint.ToString("f3");
  818. MFCDataList[i].Rampng = setLastRamping.ToString("f3");
  819. MFCDataList[i].IsSetChanged = true;
  820. MFCDataList[i].IsRampngChanged = true;
  821. };
  822. }
  823. if (gasPanelTwoView.DictChangedPumpValve.Count > 0)
  824. {
  825. PumpSetValues.Clear();
  826. if (gasPanelTwoView.AGVPumpData != null && gasPanelTwoView.AGVPumpData.DefaultValue != gasPanelTwoView.AGVPumpData.Feedback)
  827. {
  828. PumpSetValues.Add(gasPanelTwoView.AGVPumpData.UniqueName, gasPanelTwoView.AGVPumpData.Feedback);
  829. // InvokeClient.Instance.Service.DoOperation($"{gasPanelTwoView.AGVPumpData.UniqueName}.{AITValveOperation.GVTurnValve}", gasPanelTwoView.AGVPumpData.Feedback);
  830. }
  831. if (gasPanelTwoView.AUCPumpData != null && gasPanelTwoView.AUCPumpData.DefaultValue != gasPanelTwoView.AUCPumpData.Feedback)
  832. {
  833. PumpSetValues.Add(gasPanelTwoView.AUCPumpData.UniqueName, gasPanelTwoView.AUCPumpData.Feedback);
  834. // InvokeClient.Instance.Service.DoOperation($"{gasPanelTwoView.AUCPumpData.UniqueName}.{AITValveOperation.GVTurnValve}", gasPanelTwoView.AUCPumpData.Feedback);
  835. }
  836. if (gasPanelTwoView.BothPump1Data != null && gasPanelTwoView.BothPump1Data.DefaultValue != gasPanelTwoView.BothPump1Data.Feedback)
  837. {
  838. PumpSetValues.Add(gasPanelTwoView.BothPump1Data.UniqueName, gasPanelTwoView.BothPump1Data.Feedback);
  839. // InvokeClient.Instance.Service.DoOperation($"{gasPanelTwoView.BothPumpData.UniqueName}.{AITValveOperation.GVTurnValve}", gasPanelTwoView.BothPumpData.Feedback);
  840. }
  841. if (gasPanelTwoView.BothPump2Data != null && gasPanelTwoView.BothPump2Data.DefaultValue != gasPanelTwoView.BothPump2Data.Feedback)
  842. {
  843. PumpSetValues.Add(gasPanelTwoView.BothPump2Data.UniqueName, gasPanelTwoView.BothPump2Data.Feedback);
  844. // InvokeClient.Instance.Service.DoOperation($"{gasPanelTwoView.BothPumpData.UniqueName}.{AITValveOperation.GVTurnValve}", gasPanelTwoView.BothPumpData.Feedback);
  845. }
  846. if (gasPanelTwoView.ValveBWRData != null && gasPanelTwoView.ValveBWRData.DefaultValue != gasPanelTwoView.ValveBWRData.Feedback)
  847. {
  848. PumpSetValues.Add(gasPanelTwoView.ValveBWRData.UniqueName, gasPanelTwoView.ValveBWRData.Feedback);
  849. // InvokeClient.Instance.Service.DoOperation($"{gasPanelTwoView.ValveBWRData.UniqueName}.{AITValveOperation.GVTurnValve}", gasPanelTwoView.ValveBWRData.Feedback);
  850. }
  851. if (gasPanelTwoView.ValveDPRData != null && gasPanelTwoView.ValveDPRData.DefaultValue != gasPanelTwoView.ValveDPRData.Feedback)
  852. {
  853. PumpSetValues.Add(gasPanelTwoView.ValveDPRData.UniqueName, gasPanelTwoView.ValveDPRData.Feedback);
  854. // InvokeClient.Instance.Service.DoOperation($"{gasPanelTwoView.ValveDPRData.UniqueName}.{AITValveOperation.GVTurnValve}", gasPanelTwoView.ValveDPRData.Feedback);
  855. }
  856. F2HFClnOrHFCl2Values.Clear();
  857. if (gasPanelTwoView.IsDEPOOn != gasPanelTwoView.IsOldDEPOOn)
  858. {
  859. F2HFClnOrHFCl2Values.Add("PM1.SetDEPOEnable", gasPanelTwoView.IsDEPOOn);
  860. // InvokeClient.Instance.Service.DoOperation($"PM1.SetF2ClnEnable", gasPanelTwoView.IsF2ClnOn);
  861. }
  862. if (gasPanelTwoView.IsF2ClnOn != gasPanelTwoView.IsOldF2ClnOn)
  863. {
  864. F2HFClnOrHFCl2Values.Add("PM1.SetF2ClnEnable", gasPanelTwoView.IsF2ClnOn);
  865. // InvokeClient.Instance.Service.DoOperation($"PM1.SetF2ClnEnable", gasPanelTwoView.IsF2ClnOn);
  866. }
  867. if (gasPanelTwoView.IsHFClnOn != gasPanelTwoView.IsOldHFClnOn)
  868. {
  869. F2HFClnOrHFCl2Values.Add("PM1.SetHFClnEnable", gasPanelTwoView.IsHFClnOn);
  870. //InvokeClient.Instance.Service.DoOperation($"PM1.SetHFClnEnable", gasPanelTwoView.IsHFClnOn);
  871. }
  872. if (gasPanelTwoView.IsHTR1Enable != gasPanelTwoView.IsOldHTR1Enable)
  873. {
  874. F2HFClnOrHFCl2Values.Add("PM1.SetHTR1Enable", gasPanelTwoView.IsHTR1Enable);
  875. // InvokeClient.Instance.Service.DoOperation($"PM1.SetHTR1Enable", gasPanelTwoView.IsHTR1Enable);
  876. }
  877. if (gasPanelTwoView.IsHTR2Enable != gasPanelTwoView.IsOldHTR2Enable)
  878. {
  879. F2HFClnOrHFCl2Values.Add("PM1.SetHTR2Enable", gasPanelTwoView.IsHTR2Enable);
  880. //InvokeClient.Instance.Service.DoOperation($"PM1.SetHTR2Enable", gasPanelTwoView.IsHTR2Enable);
  881. }
  882. if (gasPanelTwoView.IsHTR3Enable != gasPanelTwoView.IsOldHTR3Enable)
  883. {
  884. F2HFClnOrHFCl2Values.Add("PM1.SetHTR3Enable", gasPanelTwoView.IsHTR3Enable);
  885. //InvokeClient.Instance.Service.DoOperation($"PM1.SetHTR2Enable", gasPanelTwoView.IsHTR2Enable);
  886. }
  887. if (gasPanelTwoView.IsCEXHOn != gasPanelTwoView.IsOldCEXHOn)
  888. {
  889. F2HFClnOrHFCl2Values.Add("PM1.SetCEXHEnable", gasPanelTwoView.IsCEXHOn);
  890. //InvokeClient.Instance.Service.DoOperation($"PM1.SetHTR2Enable", gasPanelTwoView.IsHTR2Enable);
  891. }
  892. if (gasPanelTwoView.IsCREFOn != gasPanelTwoView.IsOldCREFOn)
  893. {
  894. F2HFClnOrHFCl2Values.Add("PM1.SetCREFEnable", gasPanelTwoView.IsCREFOn);
  895. //InvokeClient.Instance.Service.DoOperation($"PM1.SetHTR2Enable", gasPanelTwoView.IsHTR2Enable);
  896. }
  897. if (gasPanelTwoView.IsSIREFOn != gasPanelTwoView.IsOldSIREFOn)
  898. {
  899. F2HFClnOrHFCl2Values.Add("PM1.SetSIREFEnable", gasPanelTwoView.IsSIREFOn);
  900. //InvokeClient.Instance.Service.DoOperation($"PM1.SetHTR2Enable", gasPanelTwoView.IsHTR2Enable);
  901. }
  902. }
  903. }
  904. }
  905. else if (!string.IsNullOrEmpty(toolType) && toolType.Equals(ConstantsCommon.SIBCN))
  906. {
  907. FurnaceUI.Views.Maintenances.Maintenances.SiBCN.GasPanelViewModel gasPanelTwoView = new Maintenances.Maintenances.SiBCN.GasPanelViewModel();
  908. gasPanelTwoView.MFCDataList = MFCDataList;
  909. var rtn = (wm as WindowManager)?.ShowDialogWithTitle(gasPanelTwoView, null, " Gas Panel");
  910. if ((bool)rtn)
  911. {
  912. DictValve = gasPanelTwoView.DictChangedValve;
  913. DictMFC = ChangedDictMFC(gasPanelTwoView.DictChangedMFC);
  914. foreach (var item in DictMFC)
  915. {
  916. var tempMFC = MFCDataList.FirstOrDefault(x => x.Name == item.Key);
  917. if (tempMFC != null)
  918. {
  919. tempMFC.IsSetChanged = false;
  920. tempMFC.Value = item.Value;
  921. }
  922. }
  923. if (DictMFC.Count == 0)
  924. {
  925. for (int i = 0; i < MFCDataList.Count; i++)
  926. {
  927. double setLastPoint = (double)QueryDataClient.Instance.Service.GetConfig($"PM1.MFC.{MFCDataList[i].DisplayName}.SetLastPoint");
  928. double setLastRamping = (double)QueryDataClient.Instance.Service.GetConfig($"PM1.MFC.{MFCDataList[i].DisplayName}.SetLastRamping");
  929. MFCDataList[i].Value = setLastPoint.ToString("f3");
  930. MFCDataList[i].Rampng = setLastRamping.ToString("f3");
  931. MFCDataList[i].IsSetChanged = true;
  932. };
  933. }
  934. if (gasPanelTwoView.DictChangedPumpValve.Count > 0)
  935. {
  936. PumpSetValues.Clear();
  937. if (gasPanelTwoView.AGVPumpData != null && gasPanelTwoView.AGVPumpData.DefaultValue != gasPanelTwoView.AGVPumpData.Feedback)
  938. {
  939. PumpSetValues.Add(gasPanelTwoView.AGVPumpData.UniqueName, gasPanelTwoView.AGVPumpData.Feedback);
  940. // InvokeClient.Instance.Service.DoOperation($"{gasPanelTwoView.AGVPumpData.UniqueName}.{AITValveOperation.GVTurnValve}", gasPanelTwoView.AGVPumpData.Feedback);
  941. }
  942. if (gasPanelTwoView.AUCPumpData != null && gasPanelTwoView.AUCPumpData.DefaultValue != gasPanelTwoView.AUCPumpData.Feedback)
  943. {
  944. PumpSetValues.Add(gasPanelTwoView.AUCPumpData.UniqueName, gasPanelTwoView.AUCPumpData.Feedback);
  945. // InvokeClient.Instance.Service.DoOperation($"{gasPanelTwoView.AUCPumpData.UniqueName}.{AITValveOperation.GVTurnValve}", gasPanelTwoView.AUCPumpData.Feedback);
  946. }
  947. if (gasPanelTwoView.BothPumpData != null && gasPanelTwoView.BothPumpData.DefaultValue != gasPanelTwoView.BothPumpData.Feedback)
  948. {
  949. PumpSetValues.Add(gasPanelTwoView.BothPumpData.UniqueName, gasPanelTwoView.BothPumpData.Feedback);
  950. // InvokeClient.Instance.Service.DoOperation($"{gasPanelTwoView.BothPumpData.UniqueName}.{AITValveOperation.GVTurnValve}", gasPanelTwoView.BothPumpData.Feedback);
  951. }
  952. if (gasPanelTwoView.ValveBWRData != null && gasPanelTwoView.ValveBWRData.DefaultValue != gasPanelTwoView.ValveBWRData.Feedback)
  953. {
  954. PumpSetValues.Add(gasPanelTwoView.ValveBWRData.UniqueName, gasPanelTwoView.ValveBWRData.Feedback);
  955. // InvokeClient.Instance.Service.DoOperation($"{gasPanelTwoView.ValveBWRData.UniqueName}.{AITValveOperation.GVTurnValve}", gasPanelTwoView.ValveBWRData.Feedback);
  956. }
  957. if (gasPanelTwoView.ValveDPRData != null && gasPanelTwoView.ValveDPRData.DefaultValue != gasPanelTwoView.ValveDPRData.Feedback)
  958. {
  959. PumpSetValues.Add(gasPanelTwoView.ValveDPRData.UniqueName, gasPanelTwoView.ValveDPRData.Feedback);
  960. // InvokeClient.Instance.Service.DoOperation($"{gasPanelTwoView.ValveDPRData.UniqueName}.{AITValveOperation.GVTurnValve}", gasPanelTwoView.ValveDPRData.Feedback);
  961. }
  962. F2HFClnOrHFCl2Values.Clear();
  963. if (gasPanelTwoView.IsDEPOOn != gasPanelTwoView.IsOldDEPOOn)
  964. {
  965. F2HFClnOrHFCl2Values.Add("PM1.SetDEPOEnable", gasPanelTwoView.IsDEPOOn);
  966. // InvokeClient.Instance.Service.DoOperation($"PM1.SetF2ClnEnable", gasPanelTwoView.IsF2ClnOn);
  967. }
  968. if (gasPanelTwoView.IsF2ClnOn != gasPanelTwoView.IsOldF2ClnOn)
  969. {
  970. F2HFClnOrHFCl2Values.Add("PM1.SetF2ClnEnable", gasPanelTwoView.IsF2ClnOn);
  971. // InvokeClient.Instance.Service.DoOperation($"PM1.SetF2ClnEnable", gasPanelTwoView.IsF2ClnOn);
  972. }
  973. if (gasPanelTwoView.IsHFClnOn != gasPanelTwoView.IsOldHFClnOn)
  974. {
  975. F2HFClnOrHFCl2Values.Add("PM1.SetHFClnEnable", gasPanelTwoView.IsHFClnOn);
  976. //InvokeClient.Instance.Service.DoOperation($"PM1.SetHFClnEnable", gasPanelTwoView.IsHFClnOn);
  977. }
  978. if (gasPanelTwoView.IsHTR1Enable != gasPanelTwoView.IsOldHTR1Enable)
  979. {
  980. F2HFClnOrHFCl2Values.Add("PM1.SetHTR1Enable", gasPanelTwoView.IsHTR1Enable);
  981. // InvokeClient.Instance.Service.DoOperation($"PM1.SetHTR1Enable", gasPanelTwoView.IsHTR1Enable);
  982. }
  983. if (gasPanelTwoView.IsHTR2Enable != gasPanelTwoView.IsOldHTR2Enable)
  984. {
  985. F2HFClnOrHFCl2Values.Add("PM1.SetHTR2Enable", gasPanelTwoView.IsHTR2Enable);
  986. //InvokeClient.Instance.Service.DoOperation($"PM1.SetHTR2Enable", gasPanelTwoView.IsHTR2Enable);
  987. }
  988. if (gasPanelTwoView.IsHTR3Enable != gasPanelTwoView.IsOldHTR3Enable)
  989. {
  990. F2HFClnOrHFCl2Values.Add("PM1.SetHTR3Enable", gasPanelTwoView.IsHTR3Enable);
  991. //InvokeClient.Instance.Service.DoOperation($"PM1.SetHTR2Enable", gasPanelTwoView.IsHTR2Enable);
  992. }
  993. if (gasPanelTwoView.IsCEXHOn != gasPanelTwoView.IsOldCEXHOn)
  994. {
  995. F2HFClnOrHFCl2Values.Add("PM1.SetCEXHEnable", gasPanelTwoView.IsCEXHOn);
  996. //InvokeClient.Instance.Service.DoOperation($"PM1.SetHTR2Enable", gasPanelTwoView.IsHTR2Enable);
  997. }
  998. }
  999. }
  1000. }
  1001. else if (!string.IsNullOrEmpty(toolType) && toolType.Equals(ConstantsCommon.TiN))
  1002. {
  1003. FurnaceUI.Views.Maintenances.Maintenances.TiN.GasPanelViewModel gasPanelTwoView = new Maintenances.Maintenances.TiN.GasPanelViewModel();
  1004. gasPanelTwoView.MFCDataList = MFCDataList;
  1005. var rtn = (wm as WindowManager)?.ShowDialogWithTitle(gasPanelTwoView, null, " Gas Panel");
  1006. if ((bool)rtn)
  1007. {
  1008. DictValve = gasPanelTwoView.DictChangedValve;
  1009. DictMFC = ChangedDictMFC(gasPanelTwoView.DictChangedMFC);
  1010. foreach (var item in DictMFC)
  1011. {
  1012. var tempMFC = MFCDataList.FirstOrDefault(x => x.Name == item.Key);
  1013. if (tempMFC != null)
  1014. {
  1015. tempMFC.IsSetChanged = false;
  1016. tempMFC.Value = item.Value;
  1017. }
  1018. }
  1019. if (DictMFC.Count == 0)
  1020. {
  1021. for (int i = 0; i < MFCDataList.Count; i++)
  1022. {
  1023. double setLastPoint = (double)QueryDataClient.Instance.Service.GetConfig($"PM1.MFC.{MFCDataList[i].DisplayName}.SetLastPoint");
  1024. double setLastRamping = (double)QueryDataClient.Instance.Service.GetConfig($"PM1.MFC.{MFCDataList[i].DisplayName}.SetLastRamping");
  1025. MFCDataList[i].Value = setLastPoint.ToString("f3");
  1026. MFCDataList[i].Rampng = setLastRamping.ToString("f3");
  1027. MFCDataList[i].IsSetChanged = true;
  1028. };
  1029. }
  1030. if (gasPanelTwoView.DictChangedPumpValve.Count > 0)
  1031. {
  1032. PumpSetValues.Clear();
  1033. if (gasPanelTwoView.AGVPumpData != null && gasPanelTwoView.AGVPumpData.DefaultValue != gasPanelTwoView.AGVPumpData.Feedback)
  1034. {
  1035. PumpSetValues.Add(gasPanelTwoView.AGVPumpData.UniqueName, gasPanelTwoView.AGVPumpData.Feedback);
  1036. // InvokeClient.Instance.Service.DoOperation($"{gasPanelTwoView.AGVPumpData.UniqueName}.{AITValveOperation.GVTurnValve}", gasPanelTwoView.AGVPumpData.Feedback);
  1037. }
  1038. if (gasPanelTwoView.AUCPumpData != null && gasPanelTwoView.AUCPumpData.DefaultValue != gasPanelTwoView.AUCPumpData.Feedback)
  1039. {
  1040. PumpSetValues.Add(gasPanelTwoView.AUCPumpData.UniqueName, gasPanelTwoView.AUCPumpData.Feedback);
  1041. // InvokeClient.Instance.Service.DoOperation($"{gasPanelTwoView.AUCPumpData.UniqueName}.{AITValveOperation.GVTurnValve}", gasPanelTwoView.AUCPumpData.Feedback);
  1042. }
  1043. if (gasPanelTwoView.BothPumpData != null && gasPanelTwoView.BothPumpData.DefaultValue != gasPanelTwoView.BothPumpData.Feedback)
  1044. {
  1045. PumpSetValues.Add(gasPanelTwoView.BothPumpData.UniqueName, gasPanelTwoView.BothPumpData.Feedback);
  1046. // InvokeClient.Instance.Service.DoOperation($"{gasPanelTwoView.BothPumpData.UniqueName}.{AITValveOperation.GVTurnValve}", gasPanelTwoView.BothPumpData.Feedback);
  1047. }
  1048. if (gasPanelTwoView.ValveBWRData != null && gasPanelTwoView.ValveBWRData.DefaultValue != gasPanelTwoView.ValveBWRData.Feedback)
  1049. {
  1050. PumpSetValues.Add(gasPanelTwoView.ValveBWRData.UniqueName, gasPanelTwoView.ValveBWRData.Feedback);
  1051. // InvokeClient.Instance.Service.DoOperation($"{gasPanelTwoView.ValveBWRData.UniqueName}.{AITValveOperation.GVTurnValve}", gasPanelTwoView.ValveBWRData.Feedback);
  1052. }
  1053. if (gasPanelTwoView.ValveDPRData != null && gasPanelTwoView.ValveDPRData.DefaultValue != gasPanelTwoView.ValveDPRData.Feedback)
  1054. {
  1055. PumpSetValues.Add(gasPanelTwoView.ValveDPRData.UniqueName, gasPanelTwoView.ValveDPRData.Feedback);
  1056. // InvokeClient.Instance.Service.DoOperation($"{gasPanelTwoView.ValveDPRData.UniqueName}.{AITValveOperation.GVTurnValve}", gasPanelTwoView.ValveDPRData.Feedback);
  1057. }
  1058. F2HFClnOrHFCl2Values.Clear();
  1059. if (gasPanelTwoView.IsDEPOOn != gasPanelTwoView.IsOldDEPOOn)
  1060. {
  1061. F2HFClnOrHFCl2Values.Add("PM1.SetDEPOEnable", gasPanelTwoView.IsDEPOOn);
  1062. // InvokeClient.Instance.Service.DoOperation($"PM1.SetF2ClnEnable", gasPanelTwoView.IsF2ClnOn);
  1063. }
  1064. if (gasPanelTwoView.IsF2ClnOn != gasPanelTwoView.IsOldF2ClnOn)
  1065. {
  1066. F2HFClnOrHFCl2Values.Add("PM1.SetF2ClnEnable", gasPanelTwoView.IsF2ClnOn);
  1067. // InvokeClient.Instance.Service.DoOperation($"PM1.SetF2ClnEnable", gasPanelTwoView.IsF2ClnOn);
  1068. }
  1069. if (gasPanelTwoView.IsHFClnOn != gasPanelTwoView.IsOldHFClnOn)
  1070. {
  1071. F2HFClnOrHFCl2Values.Add("PM1.SetHFClnEnable", gasPanelTwoView.IsHFClnOn);
  1072. //InvokeClient.Instance.Service.DoOperation($"PM1.SetHFClnEnable", gasPanelTwoView.IsHFClnOn);
  1073. }
  1074. if (gasPanelTwoView.IsHTR1Enable != gasPanelTwoView.IsOldHTR1Enable)
  1075. {
  1076. F2HFClnOrHFCl2Values.Add("PM1.SetHTR1Enable", gasPanelTwoView.IsHTR1Enable);
  1077. // InvokeClient.Instance.Service.DoOperation($"PM1.SetHTR1Enable", gasPanelTwoView.IsHTR1Enable);
  1078. }
  1079. if (gasPanelTwoView.IsHTR2Enable != gasPanelTwoView.IsOldHTR2Enable)
  1080. {
  1081. F2HFClnOrHFCl2Values.Add("PM1.SetHTR2Enable", gasPanelTwoView.IsHTR2Enable);
  1082. //InvokeClient.Instance.Service.DoOperation($"PM1.SetHTR2Enable", gasPanelTwoView.IsHTR2Enable);
  1083. }
  1084. if (gasPanelTwoView.IsHTR3Enable != gasPanelTwoView.IsOldHTR3Enable)
  1085. {
  1086. F2HFClnOrHFCl2Values.Add("PM1.SetHTR3Enable", gasPanelTwoView.IsHTR3Enable);
  1087. //InvokeClient.Instance.Service.DoOperation($"PM1.SetHTR2Enable", gasPanelTwoView.IsHTR2Enable);
  1088. }
  1089. if (gasPanelTwoView.IsCEXHOn != gasPanelTwoView.IsOldCEXHOn)
  1090. {
  1091. F2HFClnOrHFCl2Values.Add("PM1.SetCEXHEnable", gasPanelTwoView.IsCEXHOn);
  1092. //InvokeClient.Instance.Service.DoOperation($"PM1.SetHTR2Enable", gasPanelTwoView.IsHTR2Enable);
  1093. }
  1094. }
  1095. }
  1096. }
  1097. else
  1098. {
  1099. FurnaceUI.Views.Maintenances.GasPanelTwoViewModel gasPanelTwoView = new FurnaceUI.Views.Maintenances.GasPanelTwoViewModel();
  1100. gasPanelTwoView.MFCDataList = MFCDataList;
  1101. var rtn = (wm as WindowManager)?.ShowDialogWithTitle(gasPanelTwoView, null, " Gas Panel");
  1102. if ((bool)rtn)
  1103. {
  1104. DictValve = gasPanelTwoView.DictChangedValve;
  1105. DictMFC = ChangedDictMFC(gasPanelTwoView.DictChangedMFC);
  1106. foreach (var item in DictMFC)
  1107. {
  1108. var tempMFC = MFCDataList.FirstOrDefault(x => x.Name == item.Key);
  1109. if (tempMFC != null)
  1110. {
  1111. tempMFC.IsSetChanged = false;
  1112. tempMFC.Value = item.Value;
  1113. }
  1114. }
  1115. if (DictMFC.Count == 0)
  1116. {
  1117. for (int i = 0; i < MFCDataList.Count; i++)
  1118. {
  1119. double setLastPoint = (double)QueryDataClient.Instance.Service.GetConfig($"PM1.MFC.{MFCDataList[i].DisplayName}.SetLastPoint");
  1120. double setLastRamping = (double)QueryDataClient.Instance.Service.GetConfig($"PM1.MFC.{MFCDataList[i].DisplayName}.SetLastRamping");
  1121. MFCDataList[i].Value = setLastPoint.ToString("f3");
  1122. MFCDataList[i].Rampng = setLastRamping.ToString("f3");
  1123. MFCDataList[i].IsSetChanged = true;
  1124. };
  1125. }
  1126. if (gasPanelTwoView.DictChangedPumpValve.Count > 0)
  1127. {
  1128. PumpSetValues.Clear();
  1129. if (gasPanelTwoView.AGVPumpData != null && gasPanelTwoView.AGVPumpData.DefaultValue != gasPanelTwoView.AGVPumpData.Feedback)
  1130. {
  1131. PumpSetValues.Add(gasPanelTwoView.AGVPumpData.UniqueName, gasPanelTwoView.AGVPumpData.Feedback);
  1132. // InvokeClient.Instance.Service.DoOperation($"{gasPanelTwoView.AGVPumpData.UniqueName}.{AITValveOperation.GVTurnValve}", gasPanelTwoView.AGVPumpData.Feedback);
  1133. }
  1134. if (gasPanelTwoView.AUCPumpData != null && gasPanelTwoView.AUCPumpData.DefaultValue != gasPanelTwoView.AUCPumpData.Feedback)
  1135. {
  1136. PumpSetValues.Add(gasPanelTwoView.AUCPumpData.UniqueName, gasPanelTwoView.AUCPumpData.Feedback);
  1137. // InvokeClient.Instance.Service.DoOperation($"{gasPanelTwoView.AUCPumpData.UniqueName}.{AITValveOperation.GVTurnValve}", gasPanelTwoView.AUCPumpData.Feedback);
  1138. }
  1139. if (gasPanelTwoView.BothPumpData != null && gasPanelTwoView.BothPumpData.DefaultValue != gasPanelTwoView.BothPumpData.Feedback)
  1140. {
  1141. PumpSetValues.Add(gasPanelTwoView.BothPumpData.UniqueName, gasPanelTwoView.BothPumpData.Feedback);
  1142. // InvokeClient.Instance.Service.DoOperation($"{gasPanelTwoView.BothPumpData.UniqueName}.{AITValveOperation.GVTurnValve}", gasPanelTwoView.BothPumpData.Feedback);
  1143. }
  1144. if (gasPanelTwoView.ValveBWRData != null && gasPanelTwoView.ValveBWRData.DefaultValue != gasPanelTwoView.ValveBWRData.Feedback)
  1145. {
  1146. PumpSetValues.Add(gasPanelTwoView.ValveBWRData.UniqueName, gasPanelTwoView.ValveBWRData.Feedback);
  1147. // InvokeClient.Instance.Service.DoOperation($"{gasPanelTwoView.ValveBWRData.UniqueName}.{AITValveOperation.GVTurnValve}", gasPanelTwoView.ValveBWRData.Feedback);
  1148. }
  1149. if (gasPanelTwoView.ValveDPRData != null && gasPanelTwoView.ValveDPRData.DefaultValue != gasPanelTwoView.ValveDPRData.Feedback)
  1150. {
  1151. PumpSetValues.Add(gasPanelTwoView.ValveDPRData.UniqueName, gasPanelTwoView.ValveDPRData.Feedback);
  1152. // InvokeClient.Instance.Service.DoOperation($"{gasPanelTwoView.ValveDPRData.UniqueName}.{AITValveOperation.GVTurnValve}", gasPanelTwoView.ValveDPRData.Feedback);
  1153. }
  1154. F2HFClnOrHFCl2Values.Clear();
  1155. if (gasPanelTwoView.IsF2ClnOn != gasPanelTwoView.IsOldF2ClnOn)
  1156. {
  1157. F2HFClnOrHFCl2Values.Add("PM1.SetF2ClnEnable", gasPanelTwoView.IsF2ClnOn);
  1158. // InvokeClient.Instance.Service.DoOperation($"PM1.SetF2ClnEnable", gasPanelTwoView.IsF2ClnOn);
  1159. }
  1160. if (gasPanelTwoView.IsHFClnOn != gasPanelTwoView.IsOldHFClnOn)
  1161. {
  1162. F2HFClnOrHFCl2Values.Add("PM1.SetHFClnEnable", gasPanelTwoView.IsHFClnOn);
  1163. //InvokeClient.Instance.Service.DoOperation($"PM1.SetHFClnEnable", gasPanelTwoView.IsHFClnOn);
  1164. }
  1165. if (gasPanelTwoView.IsHTR1Enable != gasPanelTwoView.IsOldHTR1Enable)
  1166. {
  1167. F2HFClnOrHFCl2Values.Add("PM1.SetHTR1Enable", gasPanelTwoView.IsHTR1Enable);
  1168. // InvokeClient.Instance.Service.DoOperation($"PM1.SetHTR1Enable", gasPanelTwoView.IsHTR1Enable);
  1169. }
  1170. if (gasPanelTwoView.IsHTR2Enable != gasPanelTwoView.IsOldHTR2Enable)
  1171. {
  1172. F2HFClnOrHFCl2Values.Add("PM1.SetHTR2Enable", gasPanelTwoView.IsHTR2Enable);
  1173. //InvokeClient.Instance.Service.DoOperation($"PM1.SetHTR2Enable", gasPanelTwoView.IsHTR2Enable);
  1174. }
  1175. }
  1176. }
  1177. }
  1178. }
  1179. public void SwitchPage(string page)
  1180. {
  1181. switch (page)
  1182. {
  1183. case "Pressure":
  1184. {
  1185. ClientApp.Instance.SwitchPage("maintenance", "GasPanel", null);
  1186. }
  1187. break;
  1188. }
  1189. }
  1190. public void RampSetClick(object sender)
  1191. {
  1192. string strSetRamp = ShowNumberKeyboard(sender as Button, "", 1);
  1193. foreach (var item in TempList)
  1194. {
  1195. item.Rampng = strSetRamp;
  1196. item.IsRampngChanged = false;
  1197. }
  1198. }
  1199. private string ShowNumberKeyboard(Control control, string defaultValue, int keepDecimals = -1)
  1200. {
  1201. NumberKeyboard numberKeyboard = new NumberKeyboard("", defaultValue);
  1202. numberKeyboard.KeepDecimals = keepDecimals;
  1203. var point = control.PointFromScreen(new Point(0, 0));
  1204. double wx = SystemParameters.WorkArea.Width;
  1205. double hy = SystemParameters.WorkArea.Height;
  1206. if (-point.Y + control.ActualHeight + 5 + numberKeyboard.Height < hy)
  1207. {
  1208. numberKeyboard.Top = -point.Y + control.ActualHeight + 5;
  1209. }
  1210. else
  1211. {
  1212. numberKeyboard.Top = -point.Y - numberKeyboard.Height - 5;
  1213. }
  1214. if (-point.X + numberKeyboard.Width < wx)
  1215. {
  1216. numberKeyboard.Left = -point.X;
  1217. }
  1218. else
  1219. {
  1220. numberKeyboard.Left = -point.X - (numberKeyboard.Width - control.ActualWidth);
  1221. }
  1222. if ((bool)numberKeyboard.ShowDialog())
  1223. return numberKeyboard.ValueString;
  1224. else
  1225. return "Cancel";
  1226. }
  1227. private string SplitTemperatureControlMode(string str)
  1228. {
  1229. if (string.IsNullOrEmpty(str))
  1230. {
  1231. return str;
  1232. }
  1233. if (str.Contains("Profile("))
  1234. {
  1235. return str.Replace("Profile(", "").Replace(")", "").Replace(",", ":");
  1236. }
  1237. return str;
  1238. }
  1239. public void TempTextClick(string type, object sender)
  1240. {
  1241. switch (type)
  1242. {
  1243. case "Mode":
  1244. RecipeTempModeViewModel recipeTempModeViewModel = new RecipeTempModeViewModel();
  1245. recipeTempModeViewModel.SelectBtnName = SelectBtnName;
  1246. recipeTempModeViewModel.IsManualSet = true;
  1247. recipeTempModeViewModel.SelectProfileTable = SplitTemperatureControlMode(TemperatureControlMode);
  1248. var rtn = (wm as WindowManager)?.ShowDialogWithTitle(recipeTempModeViewModel, null, "Temp Mode");
  1249. if ((bool)rtn)
  1250. {
  1251. SelectBtnName = recipeTempModeViewModel.SelectBtnName;
  1252. if (null != recipeTempModeViewModel && !string.IsNullOrEmpty(recipeTempModeViewModel.ResultString) && recipeTempModeViewModel.ResultString.Contains("Profile"))
  1253. {
  1254. SelectBtnName = "Profile";
  1255. }
  1256. if (!string.IsNullOrEmpty(recipeTempModeViewModel.ResultString) && recipeTempModeViewModel.ResultString.Contains("Profile(,"))
  1257. {
  1258. recipeTempModeViewModel.ResultString = recipeTempModeViewModel.ResultString.Replace("Profile(,", "Profile(");
  1259. }
  1260. TemperatureControlMode = recipeTempModeViewModel.ResultString;
  1261. }
  1262. break;
  1263. case "Correct":
  1264. TempCorrectionEditViewModel tempCorrectionEditViewModel = new TempCorrectionEditViewModel();
  1265. tempCorrectionEditViewModel.ResultString = TemperatureCorrect;
  1266. tempCorrectionEditViewModel.IsManualSet = true;
  1267. //tempCorrectionEditViewModel.SelectedRecipeStep = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault();
  1268. tempCorrectionEditViewModel.IsEnabledControl = false;
  1269. tempCorrectionEditViewModel.AutoSelectVisibility = Visibility.Visible;
  1270. // tempOffsetTableViewModel.SelectedRecipeStep = SelectedRecipeStep;
  1271. rtn = (wm as WindowManager)?.ShowDialogWithTitle(tempCorrectionEditViewModel, null, "Temp Correct Table");
  1272. if ((bool)rtn)
  1273. {
  1274. TemperatureCorrect = tempCorrectionEditViewModel.ResultString;
  1275. }
  1276. break;
  1277. case "PID":
  1278. TempOffsetTableViewModel tempOffsetTableViewModel1 = new TempOffsetTableViewModel();
  1279. tempOffsetTableViewModel1.CboAutoSelectChecked = false;
  1280. tempOffsetTableViewModel1.IsEnabledControl = false;
  1281. tempOffsetTableViewModel1.IsManualSet = true;
  1282. tempOffsetTableViewModel1.TempOffsetTableSelected = TemperaturePID;
  1283. rtn = (wm as WindowManager)?.ShowDialogWithTitle(tempOffsetTableViewModel1, null, "Temp PID Table");
  1284. if ((bool)rtn)
  1285. {
  1286. TemperaturePID = tempOffsetTableViewModel1.TempOffsetTableSelected;
  1287. }
  1288. break;
  1289. default:
  1290. break;
  1291. }
  1292. }
  1293. private ObservableCollection<AUXData> _aUXDatas;
  1294. public void StepEdit(object cmdName, object value)
  1295. {
  1296. switch ((string)cmdName)
  1297. {
  1298. case "GASSetting":
  1299. RecipeMFCSettingViewModel recipeMFCSettingViewModel = new RecipeMFCSettingViewModel();
  1300. //InvokeClient.Instance.Service.DoOperation($"PM1.SetSensorRecipeOK", "");
  1301. //var tempMFCSets = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().MFCSets;
  1302. //if (tempMFCSets != null && tempMFCSets.Count > 0)
  1303. //{
  1304. // foreach (var item in tempMFCSets.Keys)
  1305. // {
  1306. // if (recipeMFCSettingViewModel.MFCSets.ContainsKey(item))
  1307. // {
  1308. // recipeMFCSettingViewModel.MFCSets[item] = tempMFCSets[item];
  1309. // }
  1310. // else
  1311. // {
  1312. // //recipeGASSettingViewModel.MFCSets.Add(item, tempMFCSets[item]);
  1313. // recipeMFCSettingViewModel.MFCSets.Add(item, new MFCValue() { AlarmValue = tempMFCSets[item].MinValue, IsNotifying = tempMFCSets[item].IsNotifying, MaxValue = tempMFCSets[item].MaxValue, MinValue = tempMFCSets[item].MinValue, IsCheck = tempMFCSets[item].IsCheck, Name = tempMFCSets[item].Name, Rampng = tempMFCSets[item].Rampng, Value = tempMFCSets[item].Value });
  1314. // }
  1315. // }
  1316. //}
  1317. ////recipeGASSettingViewModel.MFMSets = new MFMValue() { AlarmValue = tempMFMSets.AlarmValue, IsNotifying = tempMFMSets.IsNotifying, Name = tempMFMSets.Name, Value = tempMFMSets.Value };
  1318. //recipeMFCSettingViewModel.RecipeType = RecipeType;
  1319. //recipeMFCSettingViewModel.RecipeTemplate = RecipeTemplate;
  1320. //if (!(bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeMFCSettingViewModel, null, "MFC Detail"))
  1321. //{
  1322. // //InvokeClient.Instance.Service.DoOperation($"PM1.SetSensorPROCManualOK", "");
  1323. // return;
  1324. //}
  1325. ////InvokeClient.Instance.Service.DoOperation($"PM1.SetSensorPROCManualOK", "");
  1326. //if (CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().MFCSets != null)
  1327. //{
  1328. // if (recipeMFCSettingViewModel.MFCSets != null && recipeMFCSettingViewModel.MFCSets.Count > 0)
  1329. // {
  1330. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().MFCSets = recipeMFCSettingViewModel.MFCSets;
  1331. // }
  1332. //}
  1333. break;
  1334. case "PressureSetting":
  1335. RecipePressureSettingViewModel recipePressureSettingViewModel = new RecipePressureSettingViewModel();
  1336. //var tempStep = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault();
  1337. //recipePressureSettingViewModel.PressureSonsorValue = tempStep.PressureSonserValue;
  1338. //recipePressureSettingViewModel.PressureValveAngleValue = tempStep.PressureValveAngle;
  1339. //recipePressureSettingViewModel.PressureSettingVG = tempStep.PressureSettingVG;
  1340. //if (!string.IsNullOrEmpty(tempStep.PressureAlarmTableNo))
  1341. //{
  1342. // if (tempStep.PressureAlarmTableNo.ToLower() == "none")
  1343. // recipePressureSettingViewModel.PressureAlarmWatchTable = "None";
  1344. // else
  1345. // recipePressureSettingViewModel.PressureAlarmWatchTable = tempStep.PressureAlarmTableNo;
  1346. //}
  1347. //if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipePressureSettingViewModel, null, "Recipe Pressure Setting"))
  1348. //{
  1349. // if (CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault() != null)
  1350. // {
  1351. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().PressureSonserValue = recipePressureSettingViewModel.PressureSonsorValue;
  1352. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().PressureValveAngle = recipePressureSettingViewModel.PressureValveAngleValue;
  1353. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().PressureAlarmTableNo = recipePressureSettingViewModel.PressureAlarmWatchTable;
  1354. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().PressureSettingVG = recipePressureSettingViewModel.PressureSettingVG;
  1355. // SelectedRecipeStep.PressureSonserValue = $"{recipePressureSettingViewModel.PressureSonsorValue}";
  1356. // }
  1357. //}
  1358. break;
  1359. case "RFSetting":
  1360. //RecipeRFPressureSettingViewModel recipeRFPressureSettingViewModel = new RecipeRFPressureSettingViewModel();
  1361. //var tempRecipeStep = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault();
  1362. //recipeRFPressureSettingViewModel.RFSwitch = tempRecipeStep.RFSwitch;
  1363. //recipeRFPressureSettingViewModel.RFSetPointValue = tempRecipeStep.RFSetpoint;
  1364. //recipeRFPressureSettingViewModel.C1SetPointValue = tempRecipeStep.C1Setpoint;
  1365. //recipeRFPressureSettingViewModel.C2SetPointValue = tempRecipeStep.C2Setpoint;
  1366. //recipeRFPressureSettingViewModel.ForwardPowerAlarmWatchSetPointValue = tempRecipeStep.ForwardPowerAlarmWatchTable;
  1367. //recipeRFPressureSettingViewModel.PrAlarmWatchSetPointValue = tempRecipeStep.PrAlarmWatchTable;
  1368. //recipeRFPressureSettingViewModel.PIAlarmWatchSetPointValue = tempRecipeStep.PIAlarmWatchTable;
  1369. //recipeRFPressureSettingViewModel.C1AlarmWatchSetPointValue = tempRecipeStep.C1AlarmWatchTable;
  1370. //recipeRFPressureSettingViewModel.C2AlarmWatchSetPointValue = tempRecipeStep.C2AlarmWatchTable;
  1371. //recipeRFPressureSettingViewModel.VppAlarmWatchSetPointValue = tempRecipeStep.VppAlarmWatchTable;
  1372. //recipeRFPressureSettingViewModel.VdcAlarmWatchSetPointValue = tempRecipeStep.VdcAlarmWatchTable;
  1373. //if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeRFPressureSettingViewModel, null, "Recipe RF Setting"))
  1374. //{
  1375. // if (CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault() != null)
  1376. // {
  1377. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().RFSwitch = recipeRFPressureSettingViewModel.RFSwitch;
  1378. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().RFSetpoint = recipeRFPressureSettingViewModel.RFSetPointValue;
  1379. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().C1Setpoint = recipeRFPressureSettingViewModel.C1SetPointValue;
  1380. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().C2Setpoint = recipeRFPressureSettingViewModel.C2SetPointValue;
  1381. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().ForwardPowerAlarmWatchTable = recipeRFPressureSettingViewModel.ForwardPowerAlarmWatchSetPointValue;
  1382. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().PrAlarmWatchTable = recipeRFPressureSettingViewModel.PrAlarmWatchSetPointValue;
  1383. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().PIAlarmWatchTable = recipeRFPressureSettingViewModel.PIAlarmWatchSetPointValue;
  1384. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().C1AlarmWatchTable = recipeRFPressureSettingViewModel.C1AlarmWatchSetPointValue;
  1385. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().C2AlarmWatchTable = recipeRFPressureSettingViewModel.C2AlarmWatchSetPointValue;
  1386. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().VppAlarmWatchTable = recipeRFPressureSettingViewModel.VppAlarmWatchSetPointValue;
  1387. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().VdcAlarmWatchTable = recipeRFPressureSettingViewModel.VdcAlarmWatchSetPointValue;
  1388. // // SelectedRecipeStep.RFSetting = $"{recipeRFPressureSettingViewModel.RFSetPointValue}";
  1389. // }
  1390. //}
  1391. break;
  1392. case "Loader":
  1393. RecipeLoaderCommandViewModel recipeLoaderCommandViewModel = new RecipeLoaderCommandViewModel();
  1394. recipeLoaderCommandViewModel.SetRecipeProcessEditViewEnable = false;
  1395. if ((bool)(wm as WindowManager)?.ShowDialogWithTitle(recipeLoaderCommandViewModel, null, "Loader Command"))
  1396. {
  1397. ClearLoaderSetValue();
  1398. LoaderCommand = recipeLoaderCommandViewModel.ReturnString;
  1399. SetShowLoaderValuePanel(recipeLoaderCommandViewModel.ReturnString);
  1400. }
  1401. break;
  1402. case "Pressure":
  1403. ManualPressCommandViewModel recipePressCommandViewModel = new ManualPressCommandViewModel();
  1404. recipePressCommandViewModel.SetRecipeProcessEditViewEnable = false;
  1405. recipePressCommandViewModel.SelectedCmd = PressCommand;
  1406. if ((bool)(wm as WindowManager)?.ShowDialogWithTitle(recipePressCommandViewModel, null, "Press Command"))
  1407. {
  1408. DefaultUnit = recipePressCommandViewModel.DefaultUnit;
  1409. string returnString = recipePressCommandViewModel.ReturnString;
  1410. PressCommand = returnString;
  1411. SetShowPressPanel(returnString);
  1412. }
  1413. break;
  1414. case "Pattern":
  1415. RecipeGasPanelSettingViewModel recipeGasPanelSettingViewModel = new RecipeGasPanelSettingViewModel();
  1416. //recipeGasPanelSettingViewModel.CurrentRecipe = CurrentRecipe;
  1417. //recipeGasPanelSettingViewModel.SelectedStepName = $"{SelectedRecipeStep.StepNo}:{SelectedRecipeStep.Name}";
  1418. //recipeGasPanelSettingViewModel.ChangedStepEvent += RecipeGasPanelSettingViewModel_ChangedStepEvent;
  1419. //recipeGasPanelSettingViewModel.SelectedStep = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault();
  1420. if ((bool)(wm as WindowManager)?.ShowDialogWithTitle(recipeGasPanelSettingViewModel, null, "Valve"))
  1421. {
  1422. }
  1423. break;
  1424. case "BoatElevatorSetting":
  1425. BoatElevatorSettingViewModel boatElevatorSettingViewModel = new BoatElevatorSettingViewModel();
  1426. //boatElevatorSettingViewModel.SelectedRecipeStep = SelectedRecipeStep;
  1427. //if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(boatElevatorSettingViewModel, null, "BoatElevator Setting"))
  1428. //{
  1429. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().ZAxisPosition = boatElevatorSettingViewModel.SelectedRecipeStep.ZAxisPosition;
  1430. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().ZAxisSpeed = boatElevatorSettingViewModel.SelectedRecipeStep.ZAxisSpeed;
  1431. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().RotatePosition = boatElevatorSettingViewModel.SelectedRecipeStep.RotatePosition;
  1432. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().RotateSpeed = boatElevatorSettingViewModel.SelectedRecipeStep.RotateSpeed;
  1433. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().RotateInterval = boatElevatorSettingViewModel.SelectedRecipeStep.RotateInterval;
  1434. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().RotateDirection = boatElevatorSettingViewModel.SelectedRecipeStep.RotateDirection;
  1435. //}
  1436. break;
  1437. case "AUX":
  1438. RecipeAUXSetViewModel recipeAUXSetViewModel = new RecipeAUXSetViewModel();
  1439. if (_aUXDatas != null && _aUXDatas.Count > 0)
  1440. {
  1441. recipeAUXSetViewModel.AUXDataList.Clear();
  1442. _aUXDatas.ToList().ForEach(x => recipeAUXSetViewModel.AUXDataList.Add(x));
  1443. }
  1444. else
  1445. {
  1446. int i = 1;
  1447. recipeAUXSetViewModel.AUXDataList.Clear();
  1448. foreach (var item in AUXDetailDatas)
  1449. {
  1450. var tempAux = new AUXData();
  1451. tempAux.No = i;
  1452. tempAux.ControlName = i.ToString();
  1453. tempAux.DisplayName = item.DisplayName;
  1454. tempAux.SetValue = new DoubleParam() { Name = "SetValue", Value = item.SetPoint.ToString() };
  1455. tempAux.IsCheck = new BoolParam() { Name = "IsCheck", Value = false };
  1456. tempAux.MaxValue = new DoubleParam() { Name = "MaxValue", Value = item.WarningHighLimit.ToString() };
  1457. tempAux.MinValue = new DoubleParam() { Name = "MinValue", Value = item.WarningLowLimit.ToString() };
  1458. tempAux.SetUnit = new StringParam() { Name = "SetUnit", Value = item.Unit };
  1459. recipeAUXSetViewModel.AUXDataList.Add(tempAux);
  1460. i++;
  1461. }
  1462. }
  1463. if ((bool)(wm as WindowManager)?.ShowDialogWithTitle(recipeAUXSetViewModel, null, "AUX Set"))
  1464. {
  1465. _aUXDatas = recipeAUXSetViewModel.AUXDataList;
  1466. }
  1467. break;
  1468. case "RecipeHeader":
  1469. RecipeHeaderViewModel recipeHeaderViewModel = new RecipeHeaderViewModel();
  1470. if ((bool)(wm as WindowManager)?.ShowDialogWithTitle(recipeHeaderViewModel, null, "Recipe Header"))
  1471. {
  1472. }
  1473. break;
  1474. case "Combination":
  1475. //StringParam strCombination = CurrentRecipe.ConfigItems.FirstOrDefault(x => x.Name == "Combination") as StringParam;
  1476. //RecipeCombinationViewModel recipeCombinationViewModel = new RecipeCombinationViewModel();
  1477. //recipeCombinationViewModel.CombinationStr = strCombination.Value;
  1478. //if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeCombinationViewModel, null, "Combination"))
  1479. //{
  1480. // strCombination.Value = recipeCombinationViewModel.Combination.ToString();
  1481. //}
  1482. break;
  1483. case "VPDataList":
  1484. RecipeVPItemSelectViewModel recipeVPItemSelectViewModel = new RecipeVPItemSelectViewModel();
  1485. if ((bool)(wm as WindowManager)?.ShowDialogWithTitle(recipeVPItemSelectViewModel, null, "VP Item Select"))
  1486. {
  1487. }
  1488. break;
  1489. case "SkipOrWait":
  1490. RecipeSkipWaitCommandViewModel recipeSkipWaitCommandViewModel = new RecipeSkipWaitCommandViewModel();
  1491. //recipeSkipWaitCommandViewModel.SkipWait = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().SkipWait;
  1492. //if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeSkipWaitCommandViewModel, null, "Skip or wait command"))
  1493. //{
  1494. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().SkipWait = recipeSkipWaitCommandViewModel.RtnString;
  1495. // SelectedRecipeStep.SkipWait = recipeSkipWaitCommandViewModel.RtnString;
  1496. //}
  1497. break;
  1498. default:
  1499. break;
  1500. }
  1501. }
  1502. public void MFCTextChanged(string type, object sender, object item)
  1503. {
  1504. try
  1505. {
  1506. if (!string.IsNullOrEmpty(type) && item != null && sender != null)
  1507. {
  1508. MFCGasData mFCData = (MFCGasData)item;
  1509. string value = ((TextBox)sender).Text;
  1510. string proStr = $"{mFCData.Name}Data";
  1511. Type type1 = typeof(ManualSetViewModel);
  1512. PropertyInfo property = type1.GetProperty(proStr);
  1513. if (property == null) return;
  1514. AITMfcData aITMfcData = (AITMfcData)property.GetValue(this);
  1515. double setValue = 0;
  1516. double.TryParse(value, out setValue);
  1517. switch (type)
  1518. {
  1519. case "Value":
  1520. mFCData.Value = value;
  1521. if (setValue != aITMfcData.SetPoint)
  1522. {
  1523. mFCData.IsSetChanged = false;
  1524. }
  1525. else
  1526. {
  1527. // mFCData.IsSetChanged = true;
  1528. }
  1529. break;
  1530. case "Rampng":
  1531. mFCData.Rampng = value;
  1532. if (setValue != aITMfcData.Ramping)
  1533. {
  1534. mFCData.IsRampngChanged = false;
  1535. }
  1536. else
  1537. {
  1538. // mFCData.IsRampngChanged = true;
  1539. }
  1540. break;
  1541. default:
  1542. break;
  1543. }
  1544. }
  1545. }
  1546. catch (Exception ex)
  1547. {
  1548. LOG.Write(ex);
  1549. }
  1550. }
  1551. public void TempTextChanged(string type, object sender, object item)
  1552. {
  1553. try
  1554. {
  1555. if (!string.IsNullOrEmpty(type) && item != null && sender != null)
  1556. {
  1557. TempManualSetData tempData = (TempManualSetData)item;
  1558. string value = ((TextBox)sender).Text;
  1559. string proStr = tempData.ControlName;
  1560. Type type1 = typeof(ManualSetViewModel);
  1561. PropertyInfo property = type1.GetProperty(proStr);
  1562. if (property == null) return;
  1563. AITHeaterData aITHeaterData = (AITHeaterData)property.GetValue(this);
  1564. double setValue = 0;
  1565. double.TryParse(value, out setValue);
  1566. switch (type)
  1567. {
  1568. case "Value":
  1569. tempData.Value = value;
  1570. if (setValue != aITHeaterData.SetPoint)
  1571. {
  1572. tempData.IsSetChanged = false;
  1573. }
  1574. else
  1575. {
  1576. // tempData.IsSetChanged = false;
  1577. }
  1578. break;
  1579. case "Ramp":
  1580. tempData.Rampng = value;
  1581. if (setValue != aITHeaterData.RampSetPoint)
  1582. {
  1583. tempData.IsRampngChanged = false;
  1584. }
  1585. else
  1586. {
  1587. // tempData.IsRampngChanged = false;
  1588. }
  1589. break;
  1590. default:
  1591. break;
  1592. }
  1593. }
  1594. }
  1595. catch (Exception ex)
  1596. {
  1597. LOG.Write(ex);
  1598. }
  1599. }
  1600. private string oldPressStr = "";
  1601. public void Exec()
  1602. {
  1603. if (!DialogBox.Confirm("Are you sure to execute?"))
  1604. return;
  1605. if (DictValve != null && DictValve.Count > 0)
  1606. {
  1607. InvokeClient.Instance.Service.DoOperation($"PM1.SetAll{AITValveOperation.GVTurnValve}", DictValve);
  1608. }
  1609. if (MFCDataList != null && MFCDataList.Count() > 0)
  1610. {
  1611. Dictionary<string, string> setChangedMFC = new Dictionary<string, string>();
  1612. var changedList = MFCDataList.ToList().Where(x => !x.IsSetChanged);
  1613. foreach (var item in changedList)
  1614. {
  1615. setChangedMFC.Add(item.Name, item.Value);
  1616. }
  1617. InvokeClient.Instance.Service.DoOperation($"PM1.SetAllMfcValue", setChangedMFC);
  1618. MFCDataList.ToList().ForEach(x =>
  1619. {
  1620. if (!x.IsSetChanged)
  1621. {
  1622. // InvokeClient.Instance.Service.DoOperation($"PM1.{x.DisplayName}.SetMfcValue", $"{x.Value};{x.Rampng};{x.AlarmValue}");
  1623. InvokeClient.Instance.Service.DoOperation($"System.SetConfig", $"PM1.MFC.{x.DisplayName}.SetLastPoint", x.Value);
  1624. x.IsSetChanged = true;
  1625. }
  1626. if (!x.IsRampngChanged)
  1627. {
  1628. InvokeClient.Instance.Service.DoOperation($"PM1.{x.DisplayName}.SetMfcValue", $"{x.Value};{x.Rampng};{x.AlarmValue}");
  1629. InvokeClient.Instance.Service.DoOperation($"System.SetConfig", $"PM1.MFC.{x.DisplayName}.SetLastRamping", x.Rampng);
  1630. x.IsRampngChanged = true;
  1631. }
  1632. });
  1633. }
  1634. var pressStr = GetPressString();
  1635. if (oldPressStr != pressStr)
  1636. {
  1637. if ((CheckIsChanged(pressStr) && pressStr != ";;;") || (DictValve != null && DictValve.ContainsKey("ValveAV71")))
  1638. {
  1639. if (DictValve != null && DictValve.ContainsKey("ValveAV71"))
  1640. InvokeClient.Instance.Service.DoOperation($"PM1.APC.SetManualParameters", $"{pressStr};{DictValve["ValveAV71"]}");
  1641. else
  1642. InvokeClient.Instance.Service.DoOperation($"PM1.APC.SetManualParameters", $"{pressStr}");
  1643. }
  1644. }
  1645. OldPressCommand = PressCommand;
  1646. oldPressStr = pressStr;
  1647. if (HeaterUData.CorrectTable != TemperatureCorrect || HeaterUData.PIDTable != TemperaturePID || HeaterUData.ControlModeSetpoint != TemperatureControlMode)
  1648. {
  1649. string[] tempPra = new string[] { TemperatureControlMode, TemperatureCorrect, TemperaturePID };
  1650. InvokeClient.Instance.Service.DoOperation("PM1.Heater.SetParameters", string.Join(";", tempPra));
  1651. }
  1652. if (TempList != null && TempList.Count() > 0)
  1653. {
  1654. TempList.ToList().ForEach(x =>
  1655. {
  1656. if (!x.IsRampngChanged || !x.IsSetChanged)
  1657. {
  1658. InvokeClient.Instance.Service.DoOperation($"System.{x.Name}.SetManualParameters", $"{x.Value};{x.Rampng}");
  1659. if (!x.IsSetChanged)
  1660. {
  1661. InvokeClient.Instance.Service.DoOperation($"System.SetConfig", $"PM1.Heater.{x.Name}.SetLastPoint", x.Value);
  1662. }
  1663. if (!x.IsRampngChanged)
  1664. {
  1665. InvokeClient.Instance.Service.DoOperation($"System.SetConfig", $"PM1.Heater.{x.Name}.SetLastRamping", x.Rampng);
  1666. }
  1667. x.IsSetChanged = true;
  1668. x.IsRampngChanged = true;
  1669. }
  1670. });
  1671. }
  1672. if (!string.IsNullOrEmpty(LoaderCommand))
  1673. {
  1674. if (OldLoaderCommand != LoaderCommand)
  1675. {
  1676. InvokeClient.Instance.Service.DoOperation("PM1.SetBoatManualMotion", GetSaveLoaderValue(LoaderCommand));
  1677. }
  1678. OldLoaderCommand = LoaderCommand;
  1679. }
  1680. if (PumpSetValues.Count > 0)
  1681. {
  1682. PumpSetValues.ToList().ForEach(x => InvokeClient.Instance.Service.DoOperation($"{x.Key}.{AITValveOperation.GVTurnValve}", x.Value));
  1683. }
  1684. if (F2HFClnOrHFCl2Values.Count > 0)
  1685. {
  1686. F2HFClnOrHFCl2Values.ToList().ForEach(x => InvokeClient.Instance.Service.DoOperation(x.Key, x.Value));
  1687. }
  1688. }
  1689. private bool CheckIsChanged(string value)
  1690. {
  1691. string[] strList = value.Split(';');
  1692. if (APCData.CommandSetPoint != strList[0])
  1693. {
  1694. return true;
  1695. }
  1696. if (APCData.PIDTable != strList[1])
  1697. {
  1698. return true;
  1699. }
  1700. float.TryParse(strList[2], out float set);
  1701. if (APCData.SetPoint != set)
  1702. {
  1703. return true;
  1704. }
  1705. if (APCData.LowPressWaitSetPoint != strList[3])
  1706. {
  1707. return true;
  1708. }
  1709. return false;
  1710. }
  1711. public List<ConfigNode> GetMfcItem()
  1712. {
  1713. this.SystemName = "System";
  1714. ConfigNodes = SystemConfigProvider.Instance.GetConfigTree(SystemName).SubNodes;
  1715. var MfcItems = ConfigNodes.Where(x => x.Display == "Parameter").FirstOrDefault().SubNodes.Where(y => y.Name == "MFC").FirstOrDefault().SubNodes;
  1716. return MfcItems;
  1717. }
  1718. public void RecipeCancel()
  1719. {
  1720. if (DialogBox.ShowDialog(DialogButton.Yes | DialogButton.No, DialogType.CONFIRM, " You confirm that you want to unsave the recipe and exit the interface?") == DialogButton.No)
  1721. {
  1722. return;
  1723. }
  1724. else
  1725. {
  1726. UpdateGASSetting(true);
  1727. UpdateHeaterSetting();
  1728. ClearSetValue();
  1729. }
  1730. // ((Window)GetView()).Close();
  1731. }
  1732. public void PressPIDChick()
  1733. {
  1734. var windowManager = IoC.Get<IWindowManager>();
  1735. var defaultAPCPID = SystemConfigProvider.Instance.GetValueByName("PM1.APCPID");
  1736. if (string.IsNullOrEmpty(defaultAPCPID))
  1737. {
  1738. DialogBox.ShowDialog(DialogButton.Cancel, DialogType.INFO, "Please set the default file first");
  1739. return;
  1740. }
  1741. int last = defaultAPCPID.LastIndexOf('\\');
  1742. var pix = defaultAPCPID.Substring(0, last);
  1743. var file = defaultAPCPID.Substring(last + 1, defaultAPCPID.Length - last - 1);
  1744. APCPIDEditViewModel aPCPIDEditViewModel = new APCPIDEditViewModel(pix, file);
  1745. aPCPIDEditViewModel.IsEditEnabled = false;
  1746. var rtn = (windowManager as WindowManager)?.ShowDialogWithTitle(aPCPIDEditViewModel, null, "APC PID Table");
  1747. if ((bool)rtn)
  1748. {
  1749. PressPID = aPCPIDEditViewModel.RetrunString;
  1750. }
  1751. }
  1752. private bool firstUpdate = true;
  1753. private void ClearSetValue()
  1754. {
  1755. TemperatureControlMode = "";
  1756. TemperatureCorrect = "";
  1757. TemperaturePID = "";
  1758. ClearLoaderSetValue();
  1759. LoaderCommand = "";
  1760. SetShowLoaderValuePanel("None");
  1761. PressCommand = "";
  1762. SetShowPressPanel("None");
  1763. }
  1764. protected override void InvokeAfterUpdateProperty(Dictionary<string, object> data)
  1765. {
  1766. base.InvokeAfterUpdateProperty(data);
  1767. if (firstUpdate)
  1768. {
  1769. UpdateGASSetting(false);
  1770. UpdateHeaterSetting();
  1771. firstUpdate = false;
  1772. }
  1773. }
  1774. private void UpdateGASSetting(bool upDataMfcSetPoint)
  1775. {
  1776. List<AITMfcData> allmfcDatas = new List<AITMfcData>()
  1777. {
  1778. MFC1Data,
  1779. MFC2Data,
  1780. MFC3Data,
  1781. MFC4Data,
  1782. MFC5Data,
  1783. MFC6Data,
  1784. MFC7Data,
  1785. MFC8Data,
  1786. MFC9Data,
  1787. MFC10Data,
  1788. MFC11Data,
  1789. MFC12Data,
  1790. MFC13Data,
  1791. MFC14Data,
  1792. MFC15Data,
  1793. MFC16Data,
  1794. MFC17Data,
  1795. MFC31Data,
  1796. MFC32Data,
  1797. MFC51Data,
  1798. };
  1799. List<AITMfcData> mfcDatas = new List<AITMfcData>()
  1800. {
  1801. };
  1802. foreach (var item in allmfcDatas)
  1803. {
  1804. if (item != null)
  1805. {
  1806. mfcDatas.Add(item);
  1807. }
  1808. }
  1809. if (MFCDataList.Count == 0)
  1810. {
  1811. for (int i = 0; i < mfcDatas.Count; i++)
  1812. {
  1813. if (mfcDatas[i] == null)
  1814. continue;
  1815. double setLastPoint = (double)QueryDataClient.Instance.Service.GetConfig($"PM1.MFC.{mfcDatas[i].DeviceName}.SetLastPoint");
  1816. double setLastRamping = (double)QueryDataClient.Instance.Service.GetConfig($"PM1.MFC.{mfcDatas[i].DeviceName}.SetLastRamping");
  1817. //MFCDataList.Add(new MFCGasData()
  1818. //{
  1819. // Name = mfcDatas[i].DeviceName,
  1820. // DisplayName = mfcDatas[i].DisplayName,
  1821. // ActualValue = mfcDatas[i].FeedBack,
  1822. // Value = mfcDatas[i].SetPoint,
  1823. // ActualRampng = mfcDatas[i].Ramping,
  1824. // Rampng = mfcDatas[i].VirtualRamping,
  1825. // Unit = mfcDatas[i].Unit,
  1826. // AlarmValue = mfcDatas[i].AlarmWatchTable
  1827. //});
  1828. MFCDataList.Add(new MFCGasData()
  1829. {
  1830. Name = mfcDatas[i].DeviceName,
  1831. DisplayName = mfcDatas[i].DisplayName,
  1832. //ActualValue = mfcDatas[i].FeedBack,
  1833. Value = setLastPoint.ToString("f3"),
  1834. //ActualRampng = mfcDatas[i].Ramping,
  1835. Rampng = setLastRamping.ToString("f3"),
  1836. IsSetChanged = true,
  1837. Unit = mfcDatas[i].Unit,
  1838. AlarmValue = mfcDatas[i].AlarmWatchTable
  1839. });
  1840. }
  1841. }
  1842. else
  1843. {
  1844. for (int i = 0; i < MFCDataList.Count; i++)
  1845. {
  1846. var findMFC = mfcDatas.FirstOrDefault(x => x.DeviceName == MFCDataList[i].Name);
  1847. if (findMFC != null)
  1848. {
  1849. double setLastPoint = (double)QueryDataClient.Instance.Service.GetConfig($"PM1.MFC.{findMFC.DeviceName}.SetLastPoint");
  1850. double setLastRamping = (double)QueryDataClient.Instance.Service.GetConfig($"PM1.MFC.{findMFC.DeviceName}.SetLastRamping");
  1851. MFCDataList[i].Value = setLastPoint.ToString("f3");
  1852. MFCDataList[i].IsSetChanged = true;
  1853. MFCDataList[i].Rampng = setLastRamping.ToString("f3");
  1854. }
  1855. };
  1856. }
  1857. if (MFCDataList != null && MFCDataList.Count > 0)
  1858. {
  1859. if (upDataMfcSetPoint)
  1860. {
  1861. Dictionary<string, string> setChangedMFC = new Dictionary<string, string>();
  1862. foreach (var item in MFCDataList)
  1863. {
  1864. setChangedMFC.Add(item.Name, item.Value);
  1865. }
  1866. InvokeClient.Instance.Service.DoOperation($"PM1.SetAllMfcSetPoint", setChangedMFC);
  1867. }
  1868. }
  1869. }
  1870. private void UpdateHeaterSetting()
  1871. {
  1872. if ((HeaterUData != null && HeaterCUData != null && HeaterCData != null && HeaterCLData != null && HeaterLData != null))
  1873. {
  1874. List<AITHeaterData> heaterDatas = new List<AITHeaterData>()
  1875. {
  1876. HeaterUData,
  1877. HeaterCUData,
  1878. HeaterCData,
  1879. HeaterCLData,
  1880. HeaterLData,
  1881. };
  1882. if (TempList.Count == 0)
  1883. {
  1884. string[] strList = new string[5] { "BottomHeaterData", "CenterBottomHeaterData", "CenterHeaterData", "TopCenterHeaterData", "HeaterUData" };
  1885. for (int i = 0; i < heaterDatas.Count; i++)
  1886. {
  1887. double setLastPoint = (double)QueryDataClient.Instance.Service.GetConfig($"PM1.Heater.{heaterDatas[i].DeviceName}.SetLastPoint");
  1888. double setLastRamping = (double)QueryDataClient.Instance.Service.GetConfig($"PM1.Heater.{heaterDatas[i].DeviceName}.SetLastRamping");
  1889. //TempList.Add(new TempManualSetData()
  1890. //{
  1891. // DisplayName = heaterDatas[i].DisplayName,
  1892. // Name = heaterDatas[i].DeviceName,
  1893. // ControlName = strList[i],
  1894. // ActualValue = heaterDatas[i].FeedBack,
  1895. // Value = heaterDatas[i].SetPoint,
  1896. // ActualRampng = heaterDatas[i].Ramping,
  1897. // Rampng = heaterDatas[i].UpRateSetPoint,
  1898. // Unit = heaterDatas[i].Unit,
  1899. //});
  1900. TempList.Add(new TempManualSetData()
  1901. {
  1902. DisplayName = heaterDatas[i].DisplayName,
  1903. Name = heaterDatas[i].DeviceName,
  1904. ControlName = strList[i],
  1905. Value = setLastPoint.ToString("f1"),
  1906. Rampng = setLastRamping.ToString("f1"),
  1907. Unit = heaterDatas[i].Unit,
  1908. });
  1909. }
  1910. }
  1911. else
  1912. {
  1913. for (int i = 0; i < TempList.Count; i++)
  1914. {
  1915. var findHeater = heaterDatas.FirstOrDefault(x => x.DeviceName == TempList[i].Name);
  1916. double setLastPoint = (double)QueryDataClient.Instance.Service.GetConfig($"PM1.Heater.{findHeater.DeviceName}.SetLastPoint");
  1917. double setLastRamping = (double)QueryDataClient.Instance.Service.GetConfig($"PM1.Heater.{findHeater.DeviceName}.SetLastRamping");
  1918. if (findHeater != null)
  1919. {
  1920. TempList[i].Value = setLastPoint.ToString("f1");
  1921. TempList[i].Rampng = setLastRamping.ToString("f1");
  1922. TempList[i].IsSetChanged = true;
  1923. TempList[i].IsRampngChanged = true;
  1924. }
  1925. };
  1926. }
  1927. }
  1928. }
  1929. public void SetValue(object sender, string isFullKeyboard = "")
  1930. {
  1931. string value = ((TextBox)sender).Text;
  1932. if (!string.IsNullOrEmpty(isFullKeyboard))
  1933. {
  1934. FullKeyboard fullKeyboard1 = new FullKeyboard("", value);
  1935. if ((bool)fullKeyboard1.ShowDialog())
  1936. {
  1937. ((TextBox)sender).Text = fullKeyboard1.ValueString;
  1938. }
  1939. }
  1940. else
  1941. {
  1942. NumberKeyboard fullKeyboard = new NumberKeyboard("", value);
  1943. if ((bool)fullKeyboard.ShowDialog())
  1944. {
  1945. ((TextBox)sender).Text = fullKeyboard.ValueString;
  1946. }
  1947. }
  1948. }
  1949. private string GetPressString()
  1950. {
  1951. string[] pressStringList = new string[4] { "", "", "", "" };
  1952. pressStringList[0] = PressCommand;
  1953. if (!string.IsNullOrEmpty(PressCommand))
  1954. {
  1955. switch (PressCommand)
  1956. {
  1957. case "Press":
  1958. case "Press2":
  1959. PressVisibility = Visibility.Visible;
  1960. pressStringList[1] = PressPID;
  1961. pressStringList[2] = PressSet.ToString();
  1962. break;
  1963. case "Slow Vac":
  1964. var defaultAPCPID = SystemConfigProvider.Instance.GetValueByName("PM1.APCPID");
  1965. pressStringList[1] = defaultAPCPID;
  1966. pressStringList[2] = PressSlowVacSet.ToString();
  1967. break;
  1968. case "Valve Angle":
  1969. pressStringList[2] = PressValveAngleSet.ToString();
  1970. pressStringList[3] = LowPressWait;
  1971. break;
  1972. case "Full Open":
  1973. case "Full Close":
  1974. case "Hold":
  1975. case "Zero Set":
  1976. case "Cancel Zero":
  1977. pressStringList[1] = "";
  1978. pressStringList[2] = "";
  1979. pressStringList[3] = "";
  1980. break;
  1981. case "WaitPressUp1":
  1982. case "WaitPressDown1":
  1983. case "WaitPressUp2":
  1984. case "WaitPressDown2":
  1985. pressStringList[2] = PressWait.ToString();
  1986. break;
  1987. default:
  1988. break;
  1989. }
  1990. }
  1991. return string.Join(";", pressStringList);
  1992. }
  1993. }
  1994. public class MFCGasData : PropertyChangedBase
  1995. {
  1996. private int _no;
  1997. public int No
  1998. {
  1999. get => _no;
  2000. set
  2001. {
  2002. _no = value;
  2003. NotifyOfPropertyChange(nameof(No));
  2004. }
  2005. }
  2006. private string _name;
  2007. public string Name
  2008. {
  2009. get => _name;
  2010. set
  2011. {
  2012. _name = value;
  2013. NotifyOfPropertyChange(nameof(Name));
  2014. }
  2015. }
  2016. public string _unit;
  2017. public string Unit
  2018. {
  2019. get => _unit;
  2020. set
  2021. {
  2022. _unit = value;
  2023. NotifyOfPropertyChange(nameof(Unit));
  2024. }
  2025. }
  2026. private string _displayName;
  2027. public string DisplayName
  2028. {
  2029. get => _displayName;
  2030. set
  2031. {
  2032. _displayName = value;
  2033. NotifyOfPropertyChange(nameof(DisplayName));
  2034. }
  2035. }
  2036. private string _controlName;
  2037. public string ControlName
  2038. {
  2039. get => _controlName;
  2040. set
  2041. {
  2042. _controlName = value;
  2043. NotifyOfPropertyChange(nameof(ControlName));
  2044. }
  2045. }
  2046. private double _actualValue;
  2047. public double ActualValue
  2048. {
  2049. get => _actualValue;
  2050. set
  2051. {
  2052. _actualValue = value;
  2053. NotifyOfPropertyChange(nameof(ActualValue));
  2054. }
  2055. }
  2056. private string _value;
  2057. public string Value
  2058. {
  2059. get => _value;
  2060. set
  2061. {
  2062. _value = value;
  2063. NotifyOfPropertyChange(nameof(Value));
  2064. }
  2065. }
  2066. private double _actualRampng;
  2067. public double ActualRampng
  2068. {
  2069. get => _actualRampng; set
  2070. {
  2071. _actualRampng = value;
  2072. NotifyOfPropertyChange(nameof(ActualRampng));
  2073. }
  2074. }
  2075. private string _rampng;
  2076. public string Rampng
  2077. {
  2078. get => _rampng; set
  2079. {
  2080. _rampng = value;
  2081. NotifyOfPropertyChange(nameof(Rampng));
  2082. }
  2083. }
  2084. private string _maxValue;
  2085. public string MaxValue
  2086. {
  2087. get => _maxValue; set
  2088. {
  2089. _maxValue = value;
  2090. NotifyOfPropertyChange(nameof(MaxValue));
  2091. }
  2092. }
  2093. private string _minValue;
  2094. public string MinValue
  2095. {
  2096. get => _minValue; set
  2097. {
  2098. _minValue = value;
  2099. NotifyOfPropertyChange(nameof(MinValue));
  2100. }
  2101. }
  2102. private bool _isSetChanged = true;
  2103. public bool IsSetChanged
  2104. {
  2105. get => _isSetChanged;
  2106. set
  2107. {
  2108. _isSetChanged = value;
  2109. NotifyOfPropertyChange(nameof(IsSetChanged));
  2110. }
  2111. }
  2112. private bool _isRampngChanged = true;
  2113. public bool IsRampngChanged
  2114. {
  2115. get => _isRampngChanged;
  2116. set
  2117. {
  2118. _isRampngChanged = value;
  2119. NotifyOfPropertyChange(nameof(IsRampngChanged));
  2120. }
  2121. }
  2122. private string _alarmValue;
  2123. public string AlarmValue
  2124. {
  2125. get => _alarmValue;
  2126. set
  2127. {
  2128. _alarmValue = value;
  2129. NotifyOfPropertyChange(nameof(AlarmValue));
  2130. }
  2131. }
  2132. }
  2133. public class TempManualSetData : PropertyChangedBase
  2134. {
  2135. private int _no;
  2136. public int No
  2137. {
  2138. get => _no;
  2139. set
  2140. {
  2141. _no = value;
  2142. NotifyOfPropertyChange("No");
  2143. }
  2144. }
  2145. private string _name;
  2146. public string Name
  2147. {
  2148. get => _name;
  2149. set
  2150. {
  2151. _name = value;
  2152. NotifyOfPropertyChange("Name");
  2153. }
  2154. }
  2155. private string _displayName;
  2156. public string DisplayName
  2157. {
  2158. get => _displayName;
  2159. set
  2160. {
  2161. _displayName = value;
  2162. NotifyOfPropertyChange(nameof(DisplayName));
  2163. }
  2164. }
  2165. private string _controlName;
  2166. public string ControlName
  2167. {
  2168. get => _controlName;
  2169. set
  2170. {
  2171. _controlName = value;
  2172. NotifyOfPropertyChange(nameof(ControlName));
  2173. }
  2174. }
  2175. private double _actualValue;
  2176. public double ActualValue
  2177. {
  2178. get => _actualValue;
  2179. set
  2180. {
  2181. _actualValue = value;
  2182. NotifyOfPropertyChange(nameof(ActualValue));
  2183. }
  2184. }
  2185. private string _value;
  2186. public string Value
  2187. {
  2188. get => _value;
  2189. set
  2190. {
  2191. _value = value;
  2192. NotifyOfPropertyChange(nameof(Value));
  2193. }
  2194. }
  2195. private string _actualRampng;
  2196. public string ActualRampng
  2197. {
  2198. get => _actualRampng;
  2199. set
  2200. {
  2201. _actualRampng = value;
  2202. NotifyOfPropertyChange(nameof(ActualRampng));
  2203. }
  2204. }
  2205. private string _rampng;
  2206. public string Rampng
  2207. {
  2208. get => _rampng; set
  2209. {
  2210. _rampng = value;
  2211. NotifyOfPropertyChange(nameof(Rampng));
  2212. }
  2213. }
  2214. private string _maxValue;
  2215. public string MaxValue
  2216. {
  2217. get => _maxValue; set
  2218. {
  2219. _maxValue = value;
  2220. NotifyOfPropertyChange(nameof(MaxValue));
  2221. }
  2222. }
  2223. private string _minValue;
  2224. public string MinValue
  2225. {
  2226. get => _minValue; set
  2227. {
  2228. _minValue = value;
  2229. NotifyOfPropertyChange(nameof(MinValue));
  2230. }
  2231. }
  2232. private bool _isChanged = true;
  2233. public bool IsChanged
  2234. {
  2235. get => _isChanged;
  2236. set
  2237. {
  2238. _isChanged = value;
  2239. NotifyOfPropertyChange(nameof(IsChanged));
  2240. }
  2241. }
  2242. private string _unit;
  2243. public string Unit
  2244. {
  2245. get => _unit;
  2246. set
  2247. {
  2248. _unit = value;
  2249. NotifyOfPropertyChange("Unit");
  2250. }
  2251. }
  2252. private bool _isSetChanged = true;
  2253. public bool IsSetChanged
  2254. {
  2255. get => _isSetChanged;
  2256. set
  2257. {
  2258. _isSetChanged = value;
  2259. NotifyOfPropertyChange(nameof(IsSetChanged));
  2260. }
  2261. }
  2262. private bool _isRampngChanged = true;
  2263. public bool IsRampngChanged
  2264. {
  2265. get => _isRampngChanged;
  2266. set
  2267. {
  2268. _isRampngChanged = value;
  2269. NotifyOfPropertyChange(nameof(IsRampngChanged));
  2270. }
  2271. }
  2272. private string _alarmValue;
  2273. public string AlarmValue
  2274. {
  2275. get => _alarmValue;
  2276. set
  2277. {
  2278. _alarmValue = value;
  2279. NotifyOfPropertyChange(nameof(AlarmValue));
  2280. }
  2281. }
  2282. }
  2283. }