ManualSetViewModel.cs 112 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558
  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 FurnaceUI.Client;
  8. using FurnaceUI.Common;
  9. using FurnaceUI.Models;
  10. using FurnaceUI.Views.Editors;
  11. using FurnaceUI.Views.Operations;
  12. using FurnaceUI.Views.Parameter;
  13. using FurnaceUI.Views.Status;
  14. using MECF.Framework.Common.DataCenter;
  15. using MECF.Framework.Common.OperationCenter;
  16. using MECF.Framework.Common.RecipeCenter;
  17. using MECF.Framework.UI.Client.CenterViews.Configs.SystemConfig;
  18. using MECF.Framework.UI.Client.CenterViews.Dialogs;
  19. using MECF.Framework.UI.Client.CenterViews.Editors.Recipe;
  20. using MECF.Framework.UI.Client.ClientBase;
  21. using OpenSEMI.ClientBase;
  22. using OpenSEMI.Ctrlib.Controls;
  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.AGV2PumpData != null && gasPanelTwoView.AGV2PumpData.DefaultValue != gasPanelTwoView.AGV2PumpData.Feedback)
  832. {
  833. PumpSetValues.Add(gasPanelTwoView.AGV2PumpData.UniqueName, gasPanelTwoView.AGV2PumpData.Feedback);
  834. }
  835. if (gasPanelTwoView.AUCPumpData != null && gasPanelTwoView.AUCPumpData.DefaultValue != gasPanelTwoView.AUCPumpData.Feedback)
  836. {
  837. PumpSetValues.Add(gasPanelTwoView.AUCPumpData.UniqueName, gasPanelTwoView.AUCPumpData.Feedback);
  838. // InvokeClient.Instance.Service.DoOperation($"{gasPanelTwoView.AUCPumpData.UniqueName}.{AITValveOperation.GVTurnValve}", gasPanelTwoView.AUCPumpData.Feedback);
  839. }
  840. if (gasPanelTwoView.BothPump1Data != null && gasPanelTwoView.BothPump1Data.DefaultValue != gasPanelTwoView.BothPump1Data.Feedback)
  841. {
  842. PumpSetValues.Add(gasPanelTwoView.BothPump1Data.UniqueName, gasPanelTwoView.BothPump1Data.Feedback);
  843. // InvokeClient.Instance.Service.DoOperation($"{gasPanelTwoView.BothPumpData.UniqueName}.{AITValveOperation.GVTurnValve}", gasPanelTwoView.BothPumpData.Feedback);
  844. }
  845. if (gasPanelTwoView.BothPump2Data != null && gasPanelTwoView.BothPump2Data.DefaultValue != gasPanelTwoView.BothPump2Data.Feedback)
  846. {
  847. PumpSetValues.Add(gasPanelTwoView.BothPump2Data.UniqueName, gasPanelTwoView.BothPump2Data.Feedback);
  848. // InvokeClient.Instance.Service.DoOperation($"{gasPanelTwoView.BothPumpData.UniqueName}.{AITValveOperation.GVTurnValve}", gasPanelTwoView.BothPumpData.Feedback);
  849. }
  850. if (gasPanelTwoView.ValveBWRData != null && gasPanelTwoView.ValveBWRData.DefaultValue != gasPanelTwoView.ValveBWRData.Feedback)
  851. {
  852. PumpSetValues.Add(gasPanelTwoView.ValveBWRData.UniqueName, gasPanelTwoView.ValveBWRData.Feedback);
  853. // InvokeClient.Instance.Service.DoOperation($"{gasPanelTwoView.ValveBWRData.UniqueName}.{AITValveOperation.GVTurnValve}", gasPanelTwoView.ValveBWRData.Feedback);
  854. }
  855. if (gasPanelTwoView.ValveDPRData != null && gasPanelTwoView.ValveDPRData.DefaultValue != gasPanelTwoView.ValveDPRData.Feedback)
  856. {
  857. PumpSetValues.Add(gasPanelTwoView.ValveDPRData.UniqueName, gasPanelTwoView.ValveDPRData.Feedback);
  858. // InvokeClient.Instance.Service.DoOperation($"{gasPanelTwoView.ValveDPRData.UniqueName}.{AITValveOperation.GVTurnValve}", gasPanelTwoView.ValveDPRData.Feedback);
  859. }
  860. if (gasPanelTwoView.HREFData != null && gasPanelTwoView.HREFData.DefaultValue != gasPanelTwoView.HREFData.Feedback)
  861. {
  862. PumpSetValues.Add(gasPanelTwoView.HREFData.UniqueName, gasPanelTwoView.HREFData.Feedback);
  863. }
  864. if (gasPanelTwoView.CREF2Data != null && gasPanelTwoView.CREF2Data.DefaultValue != gasPanelTwoView.CREF2Data.Feedback)
  865. {
  866. PumpSetValues.Add(gasPanelTwoView.CREF2Data.UniqueName, gasPanelTwoView.CREF2Data.Feedback);
  867. }
  868. if (gasPanelTwoView.HZEROData != null && gasPanelTwoView.HZEROData.DefaultValue != gasPanelTwoView.HZEROData.Feedback)
  869. {
  870. PumpSetValues.Add(gasPanelTwoView.HZEROData.UniqueName, gasPanelTwoView.HZEROData.Feedback);
  871. }
  872. if (gasPanelTwoView.HMNTData != null && gasPanelTwoView.HMNTData.DefaultValue != gasPanelTwoView.HMNTData.Feedback)
  873. {
  874. PumpSetValues.Add(gasPanelTwoView.HMNTData.UniqueName, gasPanelTwoView.HMNTData.Feedback);
  875. }
  876. if (gasPanelTwoView.CMNTData != null && gasPanelTwoView.CMNTData.DefaultValue != gasPanelTwoView.CMNTData.Feedback)
  877. {
  878. PumpSetValues.Add(gasPanelTwoView.CMNTData.UniqueName, gasPanelTwoView.CMNTData.Feedback);
  879. }
  880. if (gasPanelTwoView.CZEROData != null && gasPanelTwoView.CZEROData.DefaultValue != gasPanelTwoView.CZEROData.Feedback)
  881. {
  882. PumpSetValues.Add(gasPanelTwoView.CZEROData.UniqueName, gasPanelTwoView.CZEROData.Feedback);
  883. }
  884. F2HFClnOrHFCl2Values.Clear();
  885. if (gasPanelTwoView.IsDEPOOn != gasPanelTwoView.IsOldDEPOOn)
  886. {
  887. F2HFClnOrHFCl2Values.Add("PM1.SetDEPOEnable", gasPanelTwoView.IsDEPOOn);
  888. // InvokeClient.Instance.Service.DoOperation($"PM1.SetF2ClnEnable", gasPanelTwoView.IsF2ClnOn);
  889. }
  890. if (gasPanelTwoView.IsF2ClnOn != gasPanelTwoView.IsOldF2ClnOn)
  891. {
  892. F2HFClnOrHFCl2Values.Add("PM1.SetF2ClnEnable", gasPanelTwoView.IsF2ClnOn);
  893. // InvokeClient.Instance.Service.DoOperation($"PM1.SetF2ClnEnable", gasPanelTwoView.IsF2ClnOn);
  894. }
  895. if (gasPanelTwoView.IsHFClnOn != gasPanelTwoView.IsOldHFClnOn)
  896. {
  897. F2HFClnOrHFCl2Values.Add("PM1.SetHFClnEnable", gasPanelTwoView.IsHFClnOn);
  898. //InvokeClient.Instance.Service.DoOperation($"PM1.SetHFClnEnable", gasPanelTwoView.IsHFClnOn);
  899. }
  900. if (gasPanelTwoView.IsHTR1Enable != gasPanelTwoView.IsOldHTR1Enable)
  901. {
  902. F2HFClnOrHFCl2Values.Add("PM1.SetHTR1Enable", gasPanelTwoView.IsHTR1Enable);
  903. // InvokeClient.Instance.Service.DoOperation($"PM1.SetHTR1Enable", gasPanelTwoView.IsHTR1Enable);
  904. }
  905. if (gasPanelTwoView.IsHTR2Enable != gasPanelTwoView.IsOldHTR2Enable)
  906. {
  907. F2HFClnOrHFCl2Values.Add("PM1.SetHTR2Enable", gasPanelTwoView.IsHTR2Enable);
  908. //InvokeClient.Instance.Service.DoOperation($"PM1.SetHTR2Enable", gasPanelTwoView.IsHTR2Enable);
  909. }
  910. if (gasPanelTwoView.IsHTR3Enable != gasPanelTwoView.IsOldHTR3Enable)
  911. {
  912. F2HFClnOrHFCl2Values.Add("PM1.SetHTR3Enable", gasPanelTwoView.IsHTR3Enable);
  913. //InvokeClient.Instance.Service.DoOperation($"PM1.SetHTR2Enable", gasPanelTwoView.IsHTR2Enable);
  914. }
  915. if (gasPanelTwoView.IsCEXHOn != gasPanelTwoView.IsOldCEXHOn)
  916. {
  917. F2HFClnOrHFCl2Values.Add("PM1.SetCEXHEnable", gasPanelTwoView.IsCEXHOn);
  918. //InvokeClient.Instance.Service.DoOperation($"PM1.SetHTR2Enable", gasPanelTwoView.IsHTR2Enable);
  919. }
  920. if (gasPanelTwoView.IsCREFOn != gasPanelTwoView.IsOldCREFOn)
  921. {
  922. F2HFClnOrHFCl2Values.Add("PM1.SetCREFEnable", gasPanelTwoView.IsCREFOn);
  923. //InvokeClient.Instance.Service.DoOperation($"PM1.SetHTR2Enable", gasPanelTwoView.IsHTR2Enable);
  924. }
  925. if (gasPanelTwoView.IsSIREFOn != gasPanelTwoView.IsOldSIREFOn)
  926. {
  927. F2HFClnOrHFCl2Values.Add("PM1.SetSIREFEnable", gasPanelTwoView.IsSIREFOn);
  928. //InvokeClient.Instance.Service.DoOperation($"PM1.SetHTR2Enable", gasPanelTwoView.IsHTR2Enable);
  929. }
  930. }
  931. }
  932. }
  933. else if (!string.IsNullOrEmpty(toolType) && toolType.Equals(ConstantsCommon.SIBCN))
  934. {
  935. FurnaceUI.Views.Maintenances.Maintenances.SiBCN.GasPanelViewModel gasPanelTwoView = new Maintenances.Maintenances.SiBCN.GasPanelViewModel();
  936. gasPanelTwoView.MFCDataList = MFCDataList;
  937. var rtn = (wm as WindowManager)?.ShowDialogWithTitle(gasPanelTwoView, null, " Gas Panel");
  938. if ((bool)rtn)
  939. {
  940. DictValve = gasPanelTwoView.DictChangedValve;
  941. DictMFC = ChangedDictMFC(gasPanelTwoView.DictChangedMFC);
  942. foreach (var item in DictMFC)
  943. {
  944. var tempMFC = MFCDataList.FirstOrDefault(x => x.Name == item.Key);
  945. if (tempMFC != null)
  946. {
  947. tempMFC.IsSetChanged = false;
  948. tempMFC.Value = item.Value;
  949. }
  950. }
  951. if (DictMFC.Count == 0)
  952. {
  953. for (int i = 0; i < MFCDataList.Count; i++)
  954. {
  955. double setLastPoint = (double)QueryDataClient.Instance.Service.GetConfig($"PM1.MFC.{MFCDataList[i].DisplayName}.SetLastPoint");
  956. double setLastRamping = (double)QueryDataClient.Instance.Service.GetConfig($"PM1.MFC.{MFCDataList[i].DisplayName}.SetLastRamping");
  957. MFCDataList[i].Value = setLastPoint.ToString("f3");
  958. MFCDataList[i].Rampng = setLastRamping.ToString("f3");
  959. MFCDataList[i].IsSetChanged = true;
  960. };
  961. }
  962. if (gasPanelTwoView.DictChangedPumpValve.Count > 0)
  963. {
  964. PumpSetValues.Clear();
  965. if (gasPanelTwoView.AGVPumpData != null && gasPanelTwoView.AGVPumpData.DefaultValue != gasPanelTwoView.AGVPumpData.Feedback)
  966. {
  967. PumpSetValues.Add(gasPanelTwoView.AGVPumpData.UniqueName, gasPanelTwoView.AGVPumpData.Feedback);
  968. // InvokeClient.Instance.Service.DoOperation($"{gasPanelTwoView.AGVPumpData.UniqueName}.{AITValveOperation.GVTurnValve}", gasPanelTwoView.AGVPumpData.Feedback);
  969. }
  970. if (gasPanelTwoView.AUCPumpData != null && gasPanelTwoView.AUCPumpData.DefaultValue != gasPanelTwoView.AUCPumpData.Feedback)
  971. {
  972. PumpSetValues.Add(gasPanelTwoView.AUCPumpData.UniqueName, gasPanelTwoView.AUCPumpData.Feedback);
  973. // InvokeClient.Instance.Service.DoOperation($"{gasPanelTwoView.AUCPumpData.UniqueName}.{AITValveOperation.GVTurnValve}", gasPanelTwoView.AUCPumpData.Feedback);
  974. }
  975. if (gasPanelTwoView.BothPumpData != null && gasPanelTwoView.BothPumpData.DefaultValue != gasPanelTwoView.BothPumpData.Feedback)
  976. {
  977. PumpSetValues.Add(gasPanelTwoView.BothPumpData.UniqueName, gasPanelTwoView.BothPumpData.Feedback);
  978. // InvokeClient.Instance.Service.DoOperation($"{gasPanelTwoView.BothPumpData.UniqueName}.{AITValveOperation.GVTurnValve}", gasPanelTwoView.BothPumpData.Feedback);
  979. }
  980. if (gasPanelTwoView.ValveBWRData != null && gasPanelTwoView.ValveBWRData.DefaultValue != gasPanelTwoView.ValveBWRData.Feedback)
  981. {
  982. PumpSetValues.Add(gasPanelTwoView.ValveBWRData.UniqueName, gasPanelTwoView.ValveBWRData.Feedback);
  983. // InvokeClient.Instance.Service.DoOperation($"{gasPanelTwoView.ValveBWRData.UniqueName}.{AITValveOperation.GVTurnValve}", gasPanelTwoView.ValveBWRData.Feedback);
  984. }
  985. if (gasPanelTwoView.ValveDPRData != null && gasPanelTwoView.ValveDPRData.DefaultValue != gasPanelTwoView.ValveDPRData.Feedback)
  986. {
  987. PumpSetValues.Add(gasPanelTwoView.ValveDPRData.UniqueName, gasPanelTwoView.ValveDPRData.Feedback);
  988. // InvokeClient.Instance.Service.DoOperation($"{gasPanelTwoView.ValveDPRData.UniqueName}.{AITValveOperation.GVTurnValve}", gasPanelTwoView.ValveDPRData.Feedback);
  989. }
  990. F2HFClnOrHFCl2Values.Clear();
  991. if (gasPanelTwoView.IsDEPOOn != gasPanelTwoView.IsOldDEPOOn)
  992. {
  993. F2HFClnOrHFCl2Values.Add("PM1.SetDEPOEnable", gasPanelTwoView.IsDEPOOn);
  994. // InvokeClient.Instance.Service.DoOperation($"PM1.SetF2ClnEnable", gasPanelTwoView.IsF2ClnOn);
  995. }
  996. if (gasPanelTwoView.IsF2ClnOn != gasPanelTwoView.IsOldF2ClnOn)
  997. {
  998. F2HFClnOrHFCl2Values.Add("PM1.SetF2ClnEnable", gasPanelTwoView.IsF2ClnOn);
  999. // InvokeClient.Instance.Service.DoOperation($"PM1.SetF2ClnEnable", gasPanelTwoView.IsF2ClnOn);
  1000. }
  1001. if (gasPanelTwoView.IsHFClnOn != gasPanelTwoView.IsOldHFClnOn)
  1002. {
  1003. F2HFClnOrHFCl2Values.Add("PM1.SetHFClnEnable", gasPanelTwoView.IsHFClnOn);
  1004. //InvokeClient.Instance.Service.DoOperation($"PM1.SetHFClnEnable", gasPanelTwoView.IsHFClnOn);
  1005. }
  1006. if (gasPanelTwoView.IsHTR1Enable != gasPanelTwoView.IsOldHTR1Enable)
  1007. {
  1008. F2HFClnOrHFCl2Values.Add("PM1.SetHTR1Enable", gasPanelTwoView.IsHTR1Enable);
  1009. // InvokeClient.Instance.Service.DoOperation($"PM1.SetHTR1Enable", gasPanelTwoView.IsHTR1Enable);
  1010. }
  1011. if (gasPanelTwoView.IsHTR2Enable != gasPanelTwoView.IsOldHTR2Enable)
  1012. {
  1013. F2HFClnOrHFCl2Values.Add("PM1.SetHTR2Enable", gasPanelTwoView.IsHTR2Enable);
  1014. //InvokeClient.Instance.Service.DoOperation($"PM1.SetHTR2Enable", gasPanelTwoView.IsHTR2Enable);
  1015. }
  1016. if (gasPanelTwoView.IsHTR3Enable != gasPanelTwoView.IsOldHTR3Enable)
  1017. {
  1018. F2HFClnOrHFCl2Values.Add("PM1.SetHTR3Enable", gasPanelTwoView.IsHTR3Enable);
  1019. //InvokeClient.Instance.Service.DoOperation($"PM1.SetHTR2Enable", gasPanelTwoView.IsHTR2Enable);
  1020. }
  1021. if (gasPanelTwoView.IsCEXHOn != gasPanelTwoView.IsOldCEXHOn)
  1022. {
  1023. F2HFClnOrHFCl2Values.Add("PM1.SetCEXHEnable", gasPanelTwoView.IsCEXHOn);
  1024. //InvokeClient.Instance.Service.DoOperation($"PM1.SetHTR2Enable", gasPanelTwoView.IsHTR2Enable);
  1025. }
  1026. }
  1027. }
  1028. }
  1029. else if (!string.IsNullOrEmpty(toolType) && toolType.Equals(ConstantsCommon.TiN))
  1030. {
  1031. FurnaceUI.Views.Maintenances.Maintenances.TiN.GasPanelViewModel gasPanelTwoView = new Maintenances.Maintenances.TiN.GasPanelViewModel();
  1032. gasPanelTwoView.MFCDataList = MFCDataList;
  1033. var rtn = (wm as WindowManager)?.ShowDialogWithTitle(gasPanelTwoView, null, " Gas Panel");
  1034. if ((bool)rtn)
  1035. {
  1036. DictValve = gasPanelTwoView.DictChangedValve;
  1037. DictMFC = ChangedDictMFC(gasPanelTwoView.DictChangedMFC);
  1038. foreach (var item in DictMFC)
  1039. {
  1040. var tempMFC = MFCDataList.FirstOrDefault(x => x.Name == item.Key);
  1041. if (tempMFC != null)
  1042. {
  1043. tempMFC.IsSetChanged = false;
  1044. tempMFC.Value = item.Value;
  1045. }
  1046. }
  1047. if (DictMFC.Count == 0)
  1048. {
  1049. for (int i = 0; i < MFCDataList.Count; i++)
  1050. {
  1051. double setLastPoint = (double)QueryDataClient.Instance.Service.GetConfig($"PM1.MFC.{MFCDataList[i].DisplayName}.SetLastPoint");
  1052. double setLastRamping = (double)QueryDataClient.Instance.Service.GetConfig($"PM1.MFC.{MFCDataList[i].DisplayName}.SetLastRamping");
  1053. MFCDataList[i].Value = setLastPoint.ToString("f3");
  1054. MFCDataList[i].Rampng = setLastRamping.ToString("f3");
  1055. MFCDataList[i].IsSetChanged = true;
  1056. };
  1057. }
  1058. if (gasPanelTwoView.DictChangedPumpValve.Count > 0)
  1059. {
  1060. PumpSetValues.Clear();
  1061. if (gasPanelTwoView.AGVPumpData != null && gasPanelTwoView.AGVPumpData.DefaultValue != gasPanelTwoView.AGVPumpData.Feedback)
  1062. {
  1063. PumpSetValues.Add(gasPanelTwoView.AGVPumpData.UniqueName, gasPanelTwoView.AGVPumpData.Feedback);
  1064. // InvokeClient.Instance.Service.DoOperation($"{gasPanelTwoView.AGVPumpData.UniqueName}.{AITValveOperation.GVTurnValve}", gasPanelTwoView.AGVPumpData.Feedback);
  1065. }
  1066. if (gasPanelTwoView.AUCPumpData != null && gasPanelTwoView.AUCPumpData.DefaultValue != gasPanelTwoView.AUCPumpData.Feedback)
  1067. {
  1068. PumpSetValues.Add(gasPanelTwoView.AUCPumpData.UniqueName, gasPanelTwoView.AUCPumpData.Feedback);
  1069. // InvokeClient.Instance.Service.DoOperation($"{gasPanelTwoView.AUCPumpData.UniqueName}.{AITValveOperation.GVTurnValve}", gasPanelTwoView.AUCPumpData.Feedback);
  1070. }
  1071. if (gasPanelTwoView.BothPumpData != null && gasPanelTwoView.BothPumpData.DefaultValue != gasPanelTwoView.BothPumpData.Feedback)
  1072. {
  1073. PumpSetValues.Add(gasPanelTwoView.BothPumpData.UniqueName, gasPanelTwoView.BothPumpData.Feedback);
  1074. // InvokeClient.Instance.Service.DoOperation($"{gasPanelTwoView.BothPumpData.UniqueName}.{AITValveOperation.GVTurnValve}", gasPanelTwoView.BothPumpData.Feedback);
  1075. }
  1076. if (gasPanelTwoView.ValveBWRData != null && gasPanelTwoView.ValveBWRData.DefaultValue != gasPanelTwoView.ValveBWRData.Feedback)
  1077. {
  1078. PumpSetValues.Add(gasPanelTwoView.ValveBWRData.UniqueName, gasPanelTwoView.ValveBWRData.Feedback);
  1079. // InvokeClient.Instance.Service.DoOperation($"{gasPanelTwoView.ValveBWRData.UniqueName}.{AITValveOperation.GVTurnValve}", gasPanelTwoView.ValveBWRData.Feedback);
  1080. }
  1081. if (gasPanelTwoView.ValveDPRData != null && gasPanelTwoView.ValveDPRData.DefaultValue != gasPanelTwoView.ValveDPRData.Feedback)
  1082. {
  1083. PumpSetValues.Add(gasPanelTwoView.ValveDPRData.UniqueName, gasPanelTwoView.ValveDPRData.Feedback);
  1084. // InvokeClient.Instance.Service.DoOperation($"{gasPanelTwoView.ValveDPRData.UniqueName}.{AITValveOperation.GVTurnValve}", gasPanelTwoView.ValveDPRData.Feedback);
  1085. }
  1086. F2HFClnOrHFCl2Values.Clear();
  1087. if (gasPanelTwoView.IsDEPOOn != gasPanelTwoView.IsOldDEPOOn)
  1088. {
  1089. F2HFClnOrHFCl2Values.Add("PM1.SetDEPOEnable", gasPanelTwoView.IsDEPOOn);
  1090. // InvokeClient.Instance.Service.DoOperation($"PM1.SetF2ClnEnable", gasPanelTwoView.IsF2ClnOn);
  1091. }
  1092. if (gasPanelTwoView.IsF2ClnOn != gasPanelTwoView.IsOldF2ClnOn)
  1093. {
  1094. F2HFClnOrHFCl2Values.Add("PM1.SetF2ClnEnable", gasPanelTwoView.IsF2ClnOn);
  1095. // InvokeClient.Instance.Service.DoOperation($"PM1.SetF2ClnEnable", gasPanelTwoView.IsF2ClnOn);
  1096. }
  1097. if (gasPanelTwoView.IsHFClnOn != gasPanelTwoView.IsOldHFClnOn)
  1098. {
  1099. F2HFClnOrHFCl2Values.Add("PM1.SetHFClnEnable", gasPanelTwoView.IsHFClnOn);
  1100. //InvokeClient.Instance.Service.DoOperation($"PM1.SetHFClnEnable", gasPanelTwoView.IsHFClnOn);
  1101. }
  1102. if (gasPanelTwoView.IsHTR1Enable != gasPanelTwoView.IsOldHTR1Enable)
  1103. {
  1104. F2HFClnOrHFCl2Values.Add("PM1.SetHTR1Enable", gasPanelTwoView.IsHTR1Enable);
  1105. // InvokeClient.Instance.Service.DoOperation($"PM1.SetHTR1Enable", gasPanelTwoView.IsHTR1Enable);
  1106. }
  1107. if (gasPanelTwoView.IsHTR2Enable != gasPanelTwoView.IsOldHTR2Enable)
  1108. {
  1109. F2HFClnOrHFCl2Values.Add("PM1.SetHTR2Enable", gasPanelTwoView.IsHTR2Enable);
  1110. //InvokeClient.Instance.Service.DoOperation($"PM1.SetHTR2Enable", gasPanelTwoView.IsHTR2Enable);
  1111. }
  1112. if (gasPanelTwoView.IsHTR3Enable != gasPanelTwoView.IsOldHTR3Enable)
  1113. {
  1114. F2HFClnOrHFCl2Values.Add("PM1.SetHTR3Enable", gasPanelTwoView.IsHTR3Enable);
  1115. //InvokeClient.Instance.Service.DoOperation($"PM1.SetHTR2Enable", gasPanelTwoView.IsHTR2Enable);
  1116. }
  1117. if (gasPanelTwoView.IsCEXHOn != gasPanelTwoView.IsOldCEXHOn)
  1118. {
  1119. F2HFClnOrHFCl2Values.Add("PM1.SetCEXHEnable", gasPanelTwoView.IsCEXHOn);
  1120. //InvokeClient.Instance.Service.DoOperation($"PM1.SetHTR2Enable", gasPanelTwoView.IsHTR2Enable);
  1121. }
  1122. }
  1123. }
  1124. }
  1125. else
  1126. {
  1127. FurnaceUI.Views.Maintenances.GasPanelTwoViewModel gasPanelTwoView = new FurnaceUI.Views.Maintenances.GasPanelTwoViewModel();
  1128. gasPanelTwoView.MFCDataList = MFCDataList;
  1129. var rtn = (wm as WindowManager)?.ShowDialogWithTitle(gasPanelTwoView, null, " Gas Panel");
  1130. if ((bool)rtn)
  1131. {
  1132. DictValve = gasPanelTwoView.DictChangedValve;
  1133. DictMFC = ChangedDictMFC(gasPanelTwoView.DictChangedMFC);
  1134. foreach (var item in DictMFC)
  1135. {
  1136. var tempMFC = MFCDataList.FirstOrDefault(x => x.Name == item.Key);
  1137. if (tempMFC != null)
  1138. {
  1139. tempMFC.IsSetChanged = false;
  1140. tempMFC.Value = item.Value;
  1141. }
  1142. }
  1143. if (DictMFC.Count == 0)
  1144. {
  1145. for (int i = 0; i < MFCDataList.Count; i++)
  1146. {
  1147. double setLastPoint = (double)QueryDataClient.Instance.Service.GetConfig($"PM1.MFC.{MFCDataList[i].DisplayName}.SetLastPoint");
  1148. double setLastRamping = (double)QueryDataClient.Instance.Service.GetConfig($"PM1.MFC.{MFCDataList[i].DisplayName}.SetLastRamping");
  1149. MFCDataList[i].Value = setLastPoint.ToString("f3");
  1150. MFCDataList[i].Rampng = setLastRamping.ToString("f3");
  1151. MFCDataList[i].IsSetChanged = true;
  1152. };
  1153. }
  1154. if (gasPanelTwoView.DictChangedPumpValve.Count > 0)
  1155. {
  1156. PumpSetValues.Clear();
  1157. if (gasPanelTwoView.AGVPumpData != null && gasPanelTwoView.AGVPumpData.DefaultValue != gasPanelTwoView.AGVPumpData.Feedback)
  1158. {
  1159. PumpSetValues.Add(gasPanelTwoView.AGVPumpData.UniqueName, gasPanelTwoView.AGVPumpData.Feedback);
  1160. // InvokeClient.Instance.Service.DoOperation($"{gasPanelTwoView.AGVPumpData.UniqueName}.{AITValveOperation.GVTurnValve}", gasPanelTwoView.AGVPumpData.Feedback);
  1161. }
  1162. if (gasPanelTwoView.AUCPumpData != null && gasPanelTwoView.AUCPumpData.DefaultValue != gasPanelTwoView.AUCPumpData.Feedback)
  1163. {
  1164. PumpSetValues.Add(gasPanelTwoView.AUCPumpData.UniqueName, gasPanelTwoView.AUCPumpData.Feedback);
  1165. // InvokeClient.Instance.Service.DoOperation($"{gasPanelTwoView.AUCPumpData.UniqueName}.{AITValveOperation.GVTurnValve}", gasPanelTwoView.AUCPumpData.Feedback);
  1166. }
  1167. if (gasPanelTwoView.BothPumpData != null && gasPanelTwoView.BothPumpData.DefaultValue != gasPanelTwoView.BothPumpData.Feedback)
  1168. {
  1169. PumpSetValues.Add(gasPanelTwoView.BothPumpData.UniqueName, gasPanelTwoView.BothPumpData.Feedback);
  1170. // InvokeClient.Instance.Service.DoOperation($"{gasPanelTwoView.BothPumpData.UniqueName}.{AITValveOperation.GVTurnValve}", gasPanelTwoView.BothPumpData.Feedback);
  1171. }
  1172. if (gasPanelTwoView.ValveBWRData != null && gasPanelTwoView.ValveBWRData.DefaultValue != gasPanelTwoView.ValveBWRData.Feedback)
  1173. {
  1174. PumpSetValues.Add(gasPanelTwoView.ValveBWRData.UniqueName, gasPanelTwoView.ValveBWRData.Feedback);
  1175. // InvokeClient.Instance.Service.DoOperation($"{gasPanelTwoView.ValveBWRData.UniqueName}.{AITValveOperation.GVTurnValve}", gasPanelTwoView.ValveBWRData.Feedback);
  1176. }
  1177. if (gasPanelTwoView.ValveDPRData != null && gasPanelTwoView.ValveDPRData.DefaultValue != gasPanelTwoView.ValveDPRData.Feedback)
  1178. {
  1179. PumpSetValues.Add(gasPanelTwoView.ValveDPRData.UniqueName, gasPanelTwoView.ValveDPRData.Feedback);
  1180. // InvokeClient.Instance.Service.DoOperation($"{gasPanelTwoView.ValveDPRData.UniqueName}.{AITValveOperation.GVTurnValve}", gasPanelTwoView.ValveDPRData.Feedback);
  1181. }
  1182. F2HFClnOrHFCl2Values.Clear();
  1183. if (gasPanelTwoView.IsF2ClnOn != gasPanelTwoView.IsOldF2ClnOn)
  1184. {
  1185. F2HFClnOrHFCl2Values.Add("PM1.SetF2ClnEnable", gasPanelTwoView.IsF2ClnOn);
  1186. // InvokeClient.Instance.Service.DoOperation($"PM1.SetF2ClnEnable", gasPanelTwoView.IsF2ClnOn);
  1187. }
  1188. if (gasPanelTwoView.IsHFClnOn != gasPanelTwoView.IsOldHFClnOn)
  1189. {
  1190. F2HFClnOrHFCl2Values.Add("PM1.SetHFClnEnable", gasPanelTwoView.IsHFClnOn);
  1191. //InvokeClient.Instance.Service.DoOperation($"PM1.SetHFClnEnable", gasPanelTwoView.IsHFClnOn);
  1192. }
  1193. if (gasPanelTwoView.IsHTR1Enable != gasPanelTwoView.IsOldHTR1Enable)
  1194. {
  1195. F2HFClnOrHFCl2Values.Add("PM1.SetHTR1Enable", gasPanelTwoView.IsHTR1Enable);
  1196. // InvokeClient.Instance.Service.DoOperation($"PM1.SetHTR1Enable", gasPanelTwoView.IsHTR1Enable);
  1197. }
  1198. if (gasPanelTwoView.IsHTR2Enable != gasPanelTwoView.IsOldHTR2Enable)
  1199. {
  1200. F2HFClnOrHFCl2Values.Add("PM1.SetHTR2Enable", gasPanelTwoView.IsHTR2Enable);
  1201. //InvokeClient.Instance.Service.DoOperation($"PM1.SetHTR2Enable", gasPanelTwoView.IsHTR2Enable);
  1202. }
  1203. }
  1204. }
  1205. }
  1206. }
  1207. public void SwitchPage(string page)
  1208. {
  1209. switch (page)
  1210. {
  1211. case "Pressure":
  1212. {
  1213. ClientApp.Instance.SwitchPage("maintenance", "GasPanel", null);
  1214. }
  1215. break;
  1216. }
  1217. }
  1218. public void RampSetClick(object sender)
  1219. {
  1220. string strSetRamp = ShowNumberKeyboard(sender as Button, "", 1);
  1221. foreach (var item in TempList)
  1222. {
  1223. item.Rampng = strSetRamp;
  1224. item.IsRampngChanged = false;
  1225. }
  1226. }
  1227. private string ShowNumberKeyboard(Control control, string defaultValue, int keepDecimals = -1)
  1228. {
  1229. NumberKeyboard numberKeyboard = new NumberKeyboard("", defaultValue);
  1230. numberKeyboard.KeepDecimals = keepDecimals;
  1231. var point = control.PointFromScreen(new Point(0, 0));
  1232. double wx = SystemParameters.WorkArea.Width;
  1233. double hy = SystemParameters.WorkArea.Height;
  1234. if (-point.Y + control.ActualHeight + 5 + numberKeyboard.Height < hy)
  1235. {
  1236. numberKeyboard.Top = -point.Y + control.ActualHeight + 5;
  1237. }
  1238. else
  1239. {
  1240. numberKeyboard.Top = -point.Y - numberKeyboard.Height - 5;
  1241. }
  1242. if (-point.X + numberKeyboard.Width < wx)
  1243. {
  1244. numberKeyboard.Left = -point.X;
  1245. }
  1246. else
  1247. {
  1248. numberKeyboard.Left = -point.X - (numberKeyboard.Width - control.ActualWidth);
  1249. }
  1250. if ((bool)numberKeyboard.ShowDialog())
  1251. return numberKeyboard.ValueString;
  1252. else
  1253. return "Cancel";
  1254. }
  1255. private string SplitTemperatureControlMode(string str)
  1256. {
  1257. if (string.IsNullOrEmpty(str))
  1258. {
  1259. return str;
  1260. }
  1261. if (str.Contains("Profile("))
  1262. {
  1263. return str.Replace("Profile(", "").Replace(")", "").Replace(",", ":");
  1264. }
  1265. return str;
  1266. }
  1267. public void TempTextClick(string type, object sender)
  1268. {
  1269. switch (type)
  1270. {
  1271. case "Mode":
  1272. RecipeTempModeViewModel recipeTempModeViewModel = new RecipeTempModeViewModel();
  1273. recipeTempModeViewModel.SelectBtnName = SelectBtnName;
  1274. recipeTempModeViewModel.IsManualSet = true;
  1275. recipeTempModeViewModel.SelectProfileTable = SplitTemperatureControlMode(TemperatureControlMode);
  1276. var rtn = (wm as WindowManager)?.ShowDialogWithTitle(recipeTempModeViewModel, null, "Temp Mode");
  1277. if ((bool)rtn)
  1278. {
  1279. SelectBtnName = recipeTempModeViewModel.SelectBtnName;
  1280. if (null != recipeTempModeViewModel && !string.IsNullOrEmpty(recipeTempModeViewModel.ResultString) && recipeTempModeViewModel.ResultString.Contains("Profile"))
  1281. {
  1282. SelectBtnName = "Profile";
  1283. }
  1284. if (!string.IsNullOrEmpty(recipeTempModeViewModel.ResultString) && recipeTempModeViewModel.ResultString.Contains("Profile(,"))
  1285. {
  1286. recipeTempModeViewModel.ResultString = recipeTempModeViewModel.ResultString.Replace("Profile(,", "Profile(");
  1287. }
  1288. TemperatureControlMode = recipeTempModeViewModel.ResultString;
  1289. }
  1290. break;
  1291. case "Correct":
  1292. TempCorrectionEditViewModel tempCorrectionEditViewModel = new TempCorrectionEditViewModel();
  1293. tempCorrectionEditViewModel.ResultString = TemperatureCorrect;
  1294. tempCorrectionEditViewModel.IsManualSet = true;
  1295. //tempCorrectionEditViewModel.SelectedRecipeStep = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault();
  1296. tempCorrectionEditViewModel.IsEnabledControl = false;
  1297. tempCorrectionEditViewModel.AutoSelectVisibility = Visibility.Visible;
  1298. // tempOffsetTableViewModel.SelectedRecipeStep = SelectedRecipeStep;
  1299. rtn = (wm as WindowManager)?.ShowDialogWithTitle(tempCorrectionEditViewModel, null, "Temp Correct Table");
  1300. if ((bool)rtn)
  1301. {
  1302. TemperatureCorrect = tempCorrectionEditViewModel.ResultString;
  1303. }
  1304. break;
  1305. case "PID":
  1306. TempOffsetTableViewModel tempOffsetTableViewModel1 = new TempOffsetTableViewModel();
  1307. tempOffsetTableViewModel1.CboAutoSelectChecked = false;
  1308. tempOffsetTableViewModel1.IsEnabledControl = false;
  1309. tempOffsetTableViewModel1.IsManualSet = true;
  1310. tempOffsetTableViewModel1.TempOffsetTableSelected = TemperaturePID;
  1311. rtn = (wm as WindowManager)?.ShowDialogWithTitle(tempOffsetTableViewModel1, null, "Temp PID Table");
  1312. if ((bool)rtn)
  1313. {
  1314. TemperaturePID = tempOffsetTableViewModel1.TempOffsetTableSelected;
  1315. }
  1316. break;
  1317. default:
  1318. break;
  1319. }
  1320. }
  1321. private ObservableCollection<AUXData> _aUXDatas;
  1322. public void StepEdit(object cmdName, object value)
  1323. {
  1324. switch ((string)cmdName)
  1325. {
  1326. case "GASSetting":
  1327. RecipeMFCSettingViewModel recipeMFCSettingViewModel = new RecipeMFCSettingViewModel();
  1328. //InvokeClient.Instance.Service.DoOperation($"PM1.SetSensorRecipeOK", "");
  1329. //var tempMFCSets = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().MFCSets;
  1330. //if (tempMFCSets != null && tempMFCSets.Count > 0)
  1331. //{
  1332. // foreach (var item in tempMFCSets.Keys)
  1333. // {
  1334. // if (recipeMFCSettingViewModel.MFCSets.ContainsKey(item))
  1335. // {
  1336. // recipeMFCSettingViewModel.MFCSets[item] = tempMFCSets[item];
  1337. // }
  1338. // else
  1339. // {
  1340. // //recipeGASSettingViewModel.MFCSets.Add(item, tempMFCSets[item]);
  1341. // 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 });
  1342. // }
  1343. // }
  1344. //}
  1345. ////recipeGASSettingViewModel.MFMSets = new MFMValue() { AlarmValue = tempMFMSets.AlarmValue, IsNotifying = tempMFMSets.IsNotifying, Name = tempMFMSets.Name, Value = tempMFMSets.Value };
  1346. //recipeMFCSettingViewModel.RecipeType = RecipeType;
  1347. //recipeMFCSettingViewModel.RecipeTemplate = RecipeTemplate;
  1348. //if (!(bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeMFCSettingViewModel, null, "MFC Detail"))
  1349. //{
  1350. // //InvokeClient.Instance.Service.DoOperation($"PM1.SetSensorPROCManualOK", "");
  1351. // return;
  1352. //}
  1353. ////InvokeClient.Instance.Service.DoOperation($"PM1.SetSensorPROCManualOK", "");
  1354. //if (CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().MFCSets != null)
  1355. //{
  1356. // if (recipeMFCSettingViewModel.MFCSets != null && recipeMFCSettingViewModel.MFCSets.Count > 0)
  1357. // {
  1358. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().MFCSets = recipeMFCSettingViewModel.MFCSets;
  1359. // }
  1360. //}
  1361. break;
  1362. case "PressureSetting":
  1363. RecipePressureSettingViewModel recipePressureSettingViewModel = new RecipePressureSettingViewModel();
  1364. //var tempStep = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault();
  1365. //recipePressureSettingViewModel.PressureSonsorValue = tempStep.PressureSonserValue;
  1366. //recipePressureSettingViewModel.PressureValveAngleValue = tempStep.PressureValveAngle;
  1367. //recipePressureSettingViewModel.PressureSettingVG = tempStep.PressureSettingVG;
  1368. //if (!string.IsNullOrEmpty(tempStep.PressureAlarmTableNo))
  1369. //{
  1370. // if (tempStep.PressureAlarmTableNo.ToLower() == "none")
  1371. // recipePressureSettingViewModel.PressureAlarmWatchTable = "None";
  1372. // else
  1373. // recipePressureSettingViewModel.PressureAlarmWatchTable = tempStep.PressureAlarmTableNo;
  1374. //}
  1375. //if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipePressureSettingViewModel, null, "Recipe Pressure Setting"))
  1376. //{
  1377. // if (CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault() != null)
  1378. // {
  1379. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().PressureSonserValue = recipePressureSettingViewModel.PressureSonsorValue;
  1380. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().PressureValveAngle = recipePressureSettingViewModel.PressureValveAngleValue;
  1381. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().PressureAlarmTableNo = recipePressureSettingViewModel.PressureAlarmWatchTable;
  1382. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().PressureSettingVG = recipePressureSettingViewModel.PressureSettingVG;
  1383. // SelectedRecipeStep.PressureSonserValue = $"{recipePressureSettingViewModel.PressureSonsorValue}";
  1384. // }
  1385. //}
  1386. break;
  1387. case "RFSetting":
  1388. //RecipeRFPressureSettingViewModel recipeRFPressureSettingViewModel = new RecipeRFPressureSettingViewModel();
  1389. //var tempRecipeStep = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault();
  1390. //recipeRFPressureSettingViewModel.RFSwitch = tempRecipeStep.RFSwitch;
  1391. //recipeRFPressureSettingViewModel.RFSetPointValue = tempRecipeStep.RFSetpoint;
  1392. //recipeRFPressureSettingViewModel.C1SetPointValue = tempRecipeStep.C1Setpoint;
  1393. //recipeRFPressureSettingViewModel.C2SetPointValue = tempRecipeStep.C2Setpoint;
  1394. //recipeRFPressureSettingViewModel.ForwardPowerAlarmWatchSetPointValue = tempRecipeStep.ForwardPowerAlarmWatchTable;
  1395. //recipeRFPressureSettingViewModel.PrAlarmWatchSetPointValue = tempRecipeStep.PrAlarmWatchTable;
  1396. //recipeRFPressureSettingViewModel.PIAlarmWatchSetPointValue = tempRecipeStep.PIAlarmWatchTable;
  1397. //recipeRFPressureSettingViewModel.C1AlarmWatchSetPointValue = tempRecipeStep.C1AlarmWatchTable;
  1398. //recipeRFPressureSettingViewModel.C2AlarmWatchSetPointValue = tempRecipeStep.C2AlarmWatchTable;
  1399. //recipeRFPressureSettingViewModel.VppAlarmWatchSetPointValue = tempRecipeStep.VppAlarmWatchTable;
  1400. //recipeRFPressureSettingViewModel.VdcAlarmWatchSetPointValue = tempRecipeStep.VdcAlarmWatchTable;
  1401. //if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeRFPressureSettingViewModel, null, "Recipe RF Setting"))
  1402. //{
  1403. // if (CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault() != null)
  1404. // {
  1405. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().RFSwitch = recipeRFPressureSettingViewModel.RFSwitch;
  1406. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().RFSetpoint = recipeRFPressureSettingViewModel.RFSetPointValue;
  1407. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().C1Setpoint = recipeRFPressureSettingViewModel.C1SetPointValue;
  1408. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().C2Setpoint = recipeRFPressureSettingViewModel.C2SetPointValue;
  1409. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().ForwardPowerAlarmWatchTable = recipeRFPressureSettingViewModel.ForwardPowerAlarmWatchSetPointValue;
  1410. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().PrAlarmWatchTable = recipeRFPressureSettingViewModel.PrAlarmWatchSetPointValue;
  1411. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().PIAlarmWatchTable = recipeRFPressureSettingViewModel.PIAlarmWatchSetPointValue;
  1412. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().C1AlarmWatchTable = recipeRFPressureSettingViewModel.C1AlarmWatchSetPointValue;
  1413. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().C2AlarmWatchTable = recipeRFPressureSettingViewModel.C2AlarmWatchSetPointValue;
  1414. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().VppAlarmWatchTable = recipeRFPressureSettingViewModel.VppAlarmWatchSetPointValue;
  1415. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().VdcAlarmWatchTable = recipeRFPressureSettingViewModel.VdcAlarmWatchSetPointValue;
  1416. // // SelectedRecipeStep.RFSetting = $"{recipeRFPressureSettingViewModel.RFSetPointValue}";
  1417. // }
  1418. //}
  1419. break;
  1420. case "Loader":
  1421. RecipeLoaderCommandViewModel recipeLoaderCommandViewModel = new RecipeLoaderCommandViewModel();
  1422. recipeLoaderCommandViewModel.SetRecipeProcessEditViewEnable = false;
  1423. if ((bool)(wm as WindowManager)?.ShowDialogWithTitle(recipeLoaderCommandViewModel, null, "Loader Command"))
  1424. {
  1425. ClearLoaderSetValue();
  1426. LoaderCommand = recipeLoaderCommandViewModel.ReturnString;
  1427. SetShowLoaderValuePanel(recipeLoaderCommandViewModel.ReturnString);
  1428. }
  1429. break;
  1430. case "Pressure":
  1431. ManualPressCommandViewModel recipePressCommandViewModel = new ManualPressCommandViewModel();
  1432. recipePressCommandViewModel.SetRecipeProcessEditViewEnable = false;
  1433. recipePressCommandViewModel.SelectedCmd = PressCommand;
  1434. if ((bool)(wm as WindowManager)?.ShowDialogWithTitle(recipePressCommandViewModel, null, "Press Command"))
  1435. {
  1436. DefaultUnit = recipePressCommandViewModel.DefaultUnit;
  1437. string returnString = recipePressCommandViewModel.ReturnString;
  1438. PressCommand = returnString;
  1439. SetShowPressPanel(returnString);
  1440. }
  1441. break;
  1442. case "Pattern":
  1443. RecipeGasPanelSettingViewModel recipeGasPanelSettingViewModel = new RecipeGasPanelSettingViewModel();
  1444. //recipeGasPanelSettingViewModel.CurrentRecipe = CurrentRecipe;
  1445. //recipeGasPanelSettingViewModel.SelectedStepName = $"{SelectedRecipeStep.StepNo}:{SelectedRecipeStep.Name}";
  1446. //recipeGasPanelSettingViewModel.ChangedStepEvent += RecipeGasPanelSettingViewModel_ChangedStepEvent;
  1447. //recipeGasPanelSettingViewModel.SelectedStep = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault();
  1448. if ((bool)(wm as WindowManager)?.ShowDialogWithTitle(recipeGasPanelSettingViewModel, null, "Valve"))
  1449. {
  1450. }
  1451. break;
  1452. case "BoatElevatorSetting":
  1453. BoatElevatorSettingViewModel boatElevatorSettingViewModel = new BoatElevatorSettingViewModel();
  1454. //boatElevatorSettingViewModel.SelectedRecipeStep = SelectedRecipeStep;
  1455. //if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(boatElevatorSettingViewModel, null, "BoatElevator Setting"))
  1456. //{
  1457. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().ZAxisPosition = boatElevatorSettingViewModel.SelectedRecipeStep.ZAxisPosition;
  1458. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().ZAxisSpeed = boatElevatorSettingViewModel.SelectedRecipeStep.ZAxisSpeed;
  1459. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().RotatePosition = boatElevatorSettingViewModel.SelectedRecipeStep.RotatePosition;
  1460. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().RotateSpeed = boatElevatorSettingViewModel.SelectedRecipeStep.RotateSpeed;
  1461. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().RotateInterval = boatElevatorSettingViewModel.SelectedRecipeStep.RotateInterval;
  1462. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().RotateDirection = boatElevatorSettingViewModel.SelectedRecipeStep.RotateDirection;
  1463. //}
  1464. break;
  1465. case "AUX":
  1466. RecipeAUXSetViewModel recipeAUXSetViewModel = new RecipeAUXSetViewModel();
  1467. if (_aUXDatas != null && _aUXDatas.Count > 0)
  1468. {
  1469. recipeAUXSetViewModel.AUXDataList.Clear();
  1470. _aUXDatas.ToList().ForEach(x => recipeAUXSetViewModel.AUXDataList.Add(x));
  1471. }
  1472. else
  1473. {
  1474. int i = 1;
  1475. recipeAUXSetViewModel.AUXDataList.Clear();
  1476. foreach (var item in AUXDetailDatas)
  1477. {
  1478. var tempAux = new AUXData();
  1479. tempAux.No = i;
  1480. tempAux.ControlName = i.ToString();
  1481. tempAux.DisplayName = item.DisplayName;
  1482. tempAux.SetValue = new DoubleParam() { Name = "SetValue", Value = item.SetPoint.ToString() };
  1483. tempAux.IsCheck = new BoolParam() { Name = "IsCheck", Value = false };
  1484. tempAux.MaxValue = new DoubleParam() { Name = "MaxValue", Value = item.WarningHighLimit.ToString() };
  1485. tempAux.MinValue = new DoubleParam() { Name = "MinValue", Value = item.WarningLowLimit.ToString() };
  1486. tempAux.SetUnit = new StringParam() { Name = "SetUnit", Value = item.Unit };
  1487. recipeAUXSetViewModel.AUXDataList.Add(tempAux);
  1488. i++;
  1489. }
  1490. }
  1491. if ((bool)(wm as WindowManager)?.ShowDialogWithTitle(recipeAUXSetViewModel, null, "AUX Set"))
  1492. {
  1493. _aUXDatas = recipeAUXSetViewModel.AUXDataList;
  1494. }
  1495. break;
  1496. case "RecipeHeader":
  1497. RecipeHeaderViewModel recipeHeaderViewModel = new RecipeHeaderViewModel();
  1498. if ((bool)(wm as WindowManager)?.ShowDialogWithTitle(recipeHeaderViewModel, null, "Recipe Header"))
  1499. {
  1500. }
  1501. break;
  1502. case "Combination":
  1503. //StringParam strCombination = CurrentRecipe.ConfigItems.FirstOrDefault(x => x.Name == "Combination") as StringParam;
  1504. //RecipeCombinationViewModel recipeCombinationViewModel = new RecipeCombinationViewModel();
  1505. //recipeCombinationViewModel.CombinationStr = strCombination.Value;
  1506. //if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeCombinationViewModel, null, "Combination"))
  1507. //{
  1508. // strCombination.Value = recipeCombinationViewModel.Combination.ToString();
  1509. //}
  1510. break;
  1511. case "VPDataList":
  1512. RecipeVPItemSelectViewModel recipeVPItemSelectViewModel = new RecipeVPItemSelectViewModel();
  1513. if ((bool)(wm as WindowManager)?.ShowDialogWithTitle(recipeVPItemSelectViewModel, null, "VP Item Select"))
  1514. {
  1515. }
  1516. break;
  1517. case "SkipOrWait":
  1518. RecipeSkipWaitCommandViewModel recipeSkipWaitCommandViewModel = new RecipeSkipWaitCommandViewModel();
  1519. //recipeSkipWaitCommandViewModel.SkipWait = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().SkipWait;
  1520. //if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeSkipWaitCommandViewModel, null, "Skip or wait command"))
  1521. //{
  1522. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().SkipWait = recipeSkipWaitCommandViewModel.RtnString;
  1523. // SelectedRecipeStep.SkipWait = recipeSkipWaitCommandViewModel.RtnString;
  1524. //}
  1525. break;
  1526. default:
  1527. break;
  1528. }
  1529. }
  1530. public void MFCTextChanged(string type, object sender, object item)
  1531. {
  1532. try
  1533. {
  1534. if (!string.IsNullOrEmpty(type) && item != null && sender != null)
  1535. {
  1536. MFCGasData mFCData = (MFCGasData)item;
  1537. string value = ((TextBox)sender).Text;
  1538. string proStr = $"{mFCData.Name}Data";
  1539. Type type1 = typeof(ManualSetViewModel);
  1540. PropertyInfo property = type1.GetProperty(proStr);
  1541. if (property == null) return;
  1542. AITMfcData aITMfcData = (AITMfcData)property.GetValue(this);
  1543. double setValue = 0;
  1544. double.TryParse(value, out setValue);
  1545. if (setValue > mFCData.MaxValue && type == "Value")
  1546. {
  1547. DialogBox.ShowWarning($"{mFCData.Name} Out of the setting range {0}~{mFCData.MaxValue}!");
  1548. ((TextBoxEx)sender).ChangedColor = ((TextBoxEx)sender).NormalColor;
  1549. ((TextBoxEx)sender).Text = $"0";
  1550. return;
  1551. }
  1552. switch (type)
  1553. {
  1554. case "Value":
  1555. mFCData.Value = value;
  1556. if (setValue != aITMfcData.SetPoint)
  1557. {
  1558. mFCData.IsSetChanged = false;
  1559. }
  1560. else
  1561. {
  1562. // mFCData.IsSetChanged = true;
  1563. }
  1564. break;
  1565. case "Rampng":
  1566. mFCData.Rampng = value;
  1567. if (setValue != aITMfcData.Ramping)
  1568. {
  1569. mFCData.IsRampngChanged = false;
  1570. }
  1571. else
  1572. {
  1573. // mFCData.IsRampngChanged = true;
  1574. }
  1575. break;
  1576. default:
  1577. break;
  1578. }
  1579. }
  1580. }
  1581. catch (Exception ex)
  1582. {
  1583. LOG.Write(ex);
  1584. }
  1585. }
  1586. public void TempTextChanged(string type, object sender, object item)
  1587. {
  1588. try
  1589. {
  1590. if (!string.IsNullOrEmpty(type) && item != null && sender != null)
  1591. {
  1592. TempManualSetData tempData = (TempManualSetData)item;
  1593. string value = ((TextBox)sender).Text;
  1594. string proStr = tempData.ControlName;
  1595. Type type1 = typeof(ManualSetViewModel);
  1596. PropertyInfo property = type1.GetProperty(proStr);
  1597. if (property == null) return;
  1598. AITHeaterData aITHeaterData = (AITHeaterData)property.GetValue(this);
  1599. double setValue = 0;
  1600. double.TryParse(value, out setValue);
  1601. switch (type)
  1602. {
  1603. case "Value":
  1604. tempData.Value = value;
  1605. if (setValue != aITHeaterData.SetPoint)
  1606. {
  1607. tempData.IsSetChanged = false;
  1608. }
  1609. else
  1610. {
  1611. // tempData.IsSetChanged = false;
  1612. }
  1613. break;
  1614. case "Ramp":
  1615. tempData.Rampng = value;
  1616. if (setValue != aITHeaterData.RampSetPoint)
  1617. {
  1618. tempData.IsRampngChanged = false;
  1619. }
  1620. else
  1621. {
  1622. // tempData.IsRampngChanged = false;
  1623. }
  1624. break;
  1625. default:
  1626. break;
  1627. }
  1628. }
  1629. }
  1630. catch (Exception ex)
  1631. {
  1632. LOG.Write(ex);
  1633. }
  1634. }
  1635. private string oldPressStr = "";
  1636. public void Exec()
  1637. {
  1638. if (!DialogBox.Confirm("Are you sure to execute?"))
  1639. return;
  1640. if (DictValve != null && DictValve.Count > 0)
  1641. {
  1642. InvokeClient.Instance.Service.DoOperation($"PM1.SetAll{AITValveOperation.GVTurnValve}", DictValve);
  1643. }
  1644. if (MFCDataList != null && MFCDataList.Count() > 0)
  1645. {
  1646. Dictionary<string, string> setChangedMFC = new Dictionary<string, string>();
  1647. var changedList = MFCDataList.ToList().Where(x => !x.IsSetChanged);
  1648. foreach (var item in changedList)
  1649. {
  1650. setChangedMFC.Add(item.Name, item.Value);
  1651. }
  1652. InvokeClient.Instance.Service.DoOperation($"PM1.SetAllMfcValue", setChangedMFC);
  1653. MFCDataList.ToList().ForEach(x =>
  1654. {
  1655. if (!x.IsSetChanged)
  1656. {
  1657. // InvokeClient.Instance.Service.DoOperation($"PM1.{x.DisplayName}.SetMfcValue", $"{x.Value};{x.Rampng};{x.AlarmValue}");
  1658. InvokeClient.Instance.Service.DoOperation($"System.SetConfig", $"PM1.MFC.{x.DisplayName}.SetLastPoint", x.Value);
  1659. x.IsSetChanged = true;
  1660. }
  1661. if (!x.IsRampngChanged)
  1662. {
  1663. InvokeClient.Instance.Service.DoOperation($"PM1.{x.DisplayName}.SetMfcValue", $"{x.Value};{x.Rampng};{x.AlarmValue}");
  1664. InvokeClient.Instance.Service.DoOperation($"System.SetConfig", $"PM1.MFC.{x.DisplayName}.SetLastRamping", x.Rampng);
  1665. x.IsRampngChanged = true;
  1666. }
  1667. });
  1668. }
  1669. var pressStr = GetPressString();
  1670. if (oldPressStr != pressStr || (DictValve != null && DictValve.ContainsKey("ValveAV71")))
  1671. {
  1672. if ((CheckIsChanged(pressStr) && pressStr != ";;;") || (DictValve != null && DictValve.ContainsKey("ValveAV71")))
  1673. {
  1674. if (DictValve != null && DictValve.ContainsKey("ValveAV71"))
  1675. InvokeClient.Instance.Service.DoOperation($"PM1.APC.SetManualParameters", $"{pressStr};{DictValve["ValveAV71"]}");
  1676. else
  1677. InvokeClient.Instance.Service.DoOperation($"PM1.APC.SetManualParameters", $"{pressStr}");
  1678. }
  1679. }
  1680. OldPressCommand = PressCommand;
  1681. oldPressStr = pressStr;
  1682. if (HeaterUData.CorrectTable != TemperatureCorrect || HeaterUData.PIDTable != TemperaturePID || HeaterUData.ControlModeSetpoint != TemperatureControlMode)
  1683. {
  1684. string[] tempPra = new string[] { TemperatureControlMode, TemperatureCorrect, TemperaturePID };
  1685. InvokeClient.Instance.Service.DoOperation("PM1.Heater.SetParameters", string.Join(";", tempPra));
  1686. }
  1687. if (TempList != null && TempList.Count() > 0)
  1688. {
  1689. TempList.ToList().ForEach(x =>
  1690. {
  1691. if (!x.IsRampngChanged || !x.IsSetChanged)
  1692. {
  1693. InvokeClient.Instance.Service.DoOperation($"System.{x.Name}.SetManualParameters", $"{x.Value};{x.Rampng}");
  1694. if (!x.IsSetChanged)
  1695. {
  1696. InvokeClient.Instance.Service.DoOperation($"System.SetConfig", $"PM1.Heater.{x.Name}.SetLastPoint", x.Value);
  1697. }
  1698. if (!x.IsRampngChanged)
  1699. {
  1700. InvokeClient.Instance.Service.DoOperation($"System.SetConfig", $"PM1.Heater.{x.Name}.SetLastRamping", x.Rampng);
  1701. }
  1702. x.IsSetChanged = true;
  1703. x.IsRampngChanged = true;
  1704. }
  1705. });
  1706. }
  1707. if (!string.IsNullOrEmpty(LoaderCommand))
  1708. {
  1709. if (OldLoaderCommand != LoaderCommand)
  1710. {
  1711. InvokeClient.Instance.Service.DoOperation("PM1.SetBoatManualMotion", GetSaveLoaderValue(LoaderCommand));
  1712. }
  1713. OldLoaderCommand = LoaderCommand;
  1714. }
  1715. if (PumpSetValues.Count > 0)
  1716. {
  1717. PumpSetValues.ToList().ForEach(x => InvokeClient.Instance.Service.DoOperation($"{x.Key}.{AITValveOperation.GVTurnValve}", x.Value));
  1718. }
  1719. if (F2HFClnOrHFCl2Values.Count > 0)
  1720. {
  1721. F2HFClnOrHFCl2Values.ToList().ForEach(x => InvokeClient.Instance.Service.DoOperation(x.Key, x.Value));
  1722. }
  1723. }
  1724. private bool CheckIsChanged(string value)
  1725. {
  1726. string[] strList = value.Split(';');
  1727. if (APCData.CommandSetPoint != strList[0])
  1728. {
  1729. return true;
  1730. }
  1731. if (APCData.PIDTable != strList[1])
  1732. {
  1733. return true;
  1734. }
  1735. float.TryParse(strList[2], out float set);
  1736. if (APCData.SetPoint != set)
  1737. {
  1738. return true;
  1739. }
  1740. if (APCData.LowPressWaitSetPoint != strList[3])
  1741. {
  1742. return true;
  1743. }
  1744. return false;
  1745. }
  1746. public List<ConfigNode> GetMfcItem()
  1747. {
  1748. this.SystemName = "System";
  1749. ConfigNodes = SystemConfigProvider.Instance.GetConfigTree(SystemName).SubNodes;
  1750. var MfcItems = ConfigNodes.Where(x => x.Display == "Parameter").FirstOrDefault().SubNodes.Where(y => y.Name == "MFC").FirstOrDefault().SubNodes;
  1751. return MfcItems;
  1752. }
  1753. public void RecipeCancel()
  1754. {
  1755. if (DialogBox.ShowDialog(DialogButton.Yes | DialogButton.No, DialogType.CONFIRM, " You confirm that you want to unsave the recipe and exit the interface?") == DialogButton.No)
  1756. {
  1757. return;
  1758. }
  1759. else
  1760. {
  1761. UpdateGASSetting(true);
  1762. UpdateHeaterSetting();
  1763. ClearSetValue();
  1764. }
  1765. // ((Window)GetView()).Close();
  1766. }
  1767. public void PressPIDChick()
  1768. {
  1769. var windowManager = IoC.Get<IWindowManager>();
  1770. var defaultAPCPID = SystemConfigProvider.Instance.GetValueByName("PM1.APCPID");
  1771. if (string.IsNullOrEmpty(defaultAPCPID))
  1772. {
  1773. DialogBox.ShowDialog(DialogButton.Cancel, DialogType.INFO, "Please set the default file first");
  1774. return;
  1775. }
  1776. int last = defaultAPCPID.LastIndexOf('\\');
  1777. var pix = defaultAPCPID.Substring(0, last);
  1778. var file = defaultAPCPID.Substring(last + 1, defaultAPCPID.Length - last - 1);
  1779. APCPIDEditViewModel aPCPIDEditViewModel = new APCPIDEditViewModel(pix, file);
  1780. aPCPIDEditViewModel.IsEditEnabled = false;
  1781. var rtn = (windowManager as WindowManager)?.ShowDialogWithTitle(aPCPIDEditViewModel, null, "APC PID Table");
  1782. if ((bool)rtn)
  1783. {
  1784. PressPID = aPCPIDEditViewModel.RetrunString;
  1785. }
  1786. }
  1787. private bool firstUpdate = true;
  1788. private void ClearSetValue()
  1789. {
  1790. TemperatureControlMode = "";
  1791. TemperatureCorrect = "";
  1792. TemperaturePID = "";
  1793. ClearLoaderSetValue();
  1794. LoaderCommand = "";
  1795. SetShowLoaderValuePanel("None");
  1796. PressCommand = "";
  1797. SetShowPressPanel("None");
  1798. }
  1799. protected override void InvokeAfterUpdateProperty(Dictionary<string, object> data)
  1800. {
  1801. base.InvokeAfterUpdateProperty(data);
  1802. if (firstUpdate)
  1803. {
  1804. UpdateGASSetting(false);
  1805. UpdateHeaterSetting();
  1806. firstUpdate = false;
  1807. }
  1808. }
  1809. private void UpdateGASSetting(bool upDataMfcSetPoint)
  1810. {
  1811. List<AITMfcData> allmfcDatas = new List<AITMfcData>()
  1812. {
  1813. MFC1Data,
  1814. MFC2Data,
  1815. MFC3Data,
  1816. MFC4Data,
  1817. MFC5Data,
  1818. MFC6Data,
  1819. MFC7Data,
  1820. MFC8Data,
  1821. MFC9Data,
  1822. MFC10Data,
  1823. MFC11Data,
  1824. MFC12Data,
  1825. MFC13Data,
  1826. MFC14Data,
  1827. MFC15Data,
  1828. MFC16Data,
  1829. MFC17Data,
  1830. MFC31Data,
  1831. MFC32Data,
  1832. MFC51Data,
  1833. };
  1834. List<AITMfcData> mfcDatas = new List<AITMfcData>()
  1835. {
  1836. };
  1837. foreach (var item in allmfcDatas)
  1838. {
  1839. if (item != null)
  1840. {
  1841. mfcDatas.Add(item);
  1842. }
  1843. }
  1844. if (MFCDataList.Count == 0)
  1845. {
  1846. for (int i = 0; i < mfcDatas.Count; i++)
  1847. {
  1848. if (mfcDatas[i] == null)
  1849. continue;
  1850. double setLastPoint = (double)QueryDataClient.Instance.Service.GetConfig($"PM1.MFC.{mfcDatas[i].DeviceName}.SetLastPoint");
  1851. double setLastRamping = (double)QueryDataClient.Instance.Service.GetConfig($"PM1.MFC.{mfcDatas[i].DeviceName}.SetLastRamping");
  1852. //MFCDataList.Add(new MFCGasData()
  1853. //{
  1854. // Name = mfcDatas[i].DeviceName,
  1855. // DisplayName = mfcDatas[i].DisplayName,
  1856. // ActualValue = mfcDatas[i].FeedBack,
  1857. // Value = mfcDatas[i].SetPoint,
  1858. // ActualRampng = mfcDatas[i].Ramping,
  1859. // Rampng = mfcDatas[i].VirtualRamping,
  1860. // Unit = mfcDatas[i].Unit,
  1861. // AlarmValue = mfcDatas[i].AlarmWatchTable
  1862. //});
  1863. MFCDataList.Add(new MFCGasData()
  1864. {
  1865. Name = mfcDatas[i].DeviceName,
  1866. DisplayName = mfcDatas[i].DisplayName,
  1867. //ActualValue = mfcDatas[i].FeedBack,
  1868. Value = setLastPoint.ToString("f3"),
  1869. //ActualRampng = mfcDatas[i].Ramping,
  1870. Rampng = setLastRamping.ToString("f3"),
  1871. IsSetChanged = true,
  1872. Unit = mfcDatas[i].Unit,
  1873. AlarmValue = mfcDatas[i].AlarmWatchTable
  1874. });
  1875. }
  1876. }
  1877. else
  1878. {
  1879. for (int i = 0; i < MFCDataList.Count; i++)
  1880. {
  1881. var findMFC = mfcDatas.FirstOrDefault(x => x.DeviceName == MFCDataList[i].Name);
  1882. if (findMFC != null)
  1883. {
  1884. double setLastPoint = (double)QueryDataClient.Instance.Service.GetConfig($"PM1.MFC.{findMFC.DeviceName}.SetLastPoint");
  1885. double setLastRamping = (double)QueryDataClient.Instance.Service.GetConfig($"PM1.MFC.{findMFC.DeviceName}.SetLastRamping");
  1886. MFCDataList[i].Value = setLastPoint.ToString("f3");
  1887. MFCDataList[i].IsSetChanged = true;
  1888. MFCDataList[i].Rampng = setLastRamping.ToString("f3");
  1889. }
  1890. };
  1891. }
  1892. if (MFCDataList != null && MFCDataList.Count > 0)
  1893. {
  1894. if (upDataMfcSetPoint)
  1895. {
  1896. Dictionary<string, string> setChangedMFC = new Dictionary<string, string>();
  1897. foreach (var item in MFCDataList)
  1898. {
  1899. setChangedMFC.Add(item.Name, item.Value);
  1900. }
  1901. InvokeClient.Instance.Service.DoOperation($"PM1.SetAllMfcSetPoint", setChangedMFC);
  1902. }
  1903. }
  1904. }
  1905. private void UpdateHeaterSetting()
  1906. {
  1907. if ((HeaterUData != null && HeaterCUData != null && HeaterCData != null && HeaterCLData != null && HeaterLData != null))
  1908. {
  1909. List<AITHeaterData> heaterDatas = new List<AITHeaterData>()
  1910. {
  1911. HeaterUData,
  1912. HeaterCUData,
  1913. HeaterCData,
  1914. HeaterCLData,
  1915. HeaterLData,
  1916. };
  1917. if (TempList.Count == 0)
  1918. {
  1919. string[] strList = new string[5] { "BottomHeaterData", "CenterBottomHeaterData", "CenterHeaterData", "TopCenterHeaterData", "HeaterUData" };
  1920. for (int i = 0; i < heaterDatas.Count; i++)
  1921. {
  1922. double setLastPoint = (double)QueryDataClient.Instance.Service.GetConfig($"PM1.Heater.{heaterDatas[i].DeviceName}.SetLastPoint");
  1923. double setLastRamping = (double)QueryDataClient.Instance.Service.GetConfig($"PM1.Heater.{heaterDatas[i].DeviceName}.SetLastRamping");
  1924. //TempList.Add(new TempManualSetData()
  1925. //{
  1926. // DisplayName = heaterDatas[i].DisplayName,
  1927. // Name = heaterDatas[i].DeviceName,
  1928. // ControlName = strList[i],
  1929. // ActualValue = heaterDatas[i].FeedBack,
  1930. // Value = heaterDatas[i].SetPoint,
  1931. // ActualRampng = heaterDatas[i].Ramping,
  1932. // Rampng = heaterDatas[i].UpRateSetPoint,
  1933. // Unit = heaterDatas[i].Unit,
  1934. //});
  1935. TempList.Add(new TempManualSetData()
  1936. {
  1937. DisplayName = heaterDatas[i].DisplayName,
  1938. Name = heaterDatas[i].DeviceName,
  1939. ControlName = strList[i],
  1940. Value = setLastPoint.ToString("f1"),
  1941. Rampng = setLastRamping.ToString("f1"),
  1942. Unit = heaterDatas[i].Unit,
  1943. });
  1944. }
  1945. }
  1946. else
  1947. {
  1948. for (int i = 0; i < TempList.Count; i++)
  1949. {
  1950. var findHeater = heaterDatas.FirstOrDefault(x => x.DeviceName == TempList[i].Name);
  1951. double setLastPoint = (double)QueryDataClient.Instance.Service.GetConfig($"PM1.Heater.{findHeater.DeviceName}.SetLastPoint");
  1952. double setLastRamping = (double)QueryDataClient.Instance.Service.GetConfig($"PM1.Heater.{findHeater.DeviceName}.SetLastRamping");
  1953. if (findHeater != null)
  1954. {
  1955. TempList[i].Value = setLastPoint.ToString("f1");
  1956. TempList[i].Rampng = setLastRamping.ToString("f1");
  1957. TempList[i].IsSetChanged = true;
  1958. TempList[i].IsRampngChanged = true;
  1959. }
  1960. };
  1961. }
  1962. }
  1963. }
  1964. public void SetValue(object sender, string isFullKeyboard = "")
  1965. {
  1966. string value = ((TextBox)sender).Text;
  1967. if (!string.IsNullOrEmpty(isFullKeyboard))
  1968. {
  1969. FullKeyboard fullKeyboard1 = new FullKeyboard("", value);
  1970. if ((bool)fullKeyboard1.ShowDialog())
  1971. {
  1972. ((TextBox)sender).Text = fullKeyboard1.ValueString;
  1973. }
  1974. }
  1975. else
  1976. {
  1977. NumberKeyboard fullKeyboard = new NumberKeyboard("", value);
  1978. if ((bool)fullKeyboard.ShowDialog())
  1979. {
  1980. ((TextBox)sender).Text = fullKeyboard.ValueString;
  1981. }
  1982. }
  1983. }
  1984. private string GetPressString()
  1985. {
  1986. string[] pressStringList = new string[4] { "", "", "", "" };
  1987. pressStringList[0] = PressCommand;
  1988. if (!string.IsNullOrEmpty(PressCommand))
  1989. {
  1990. switch (PressCommand)
  1991. {
  1992. case "Press":
  1993. case "Press2":
  1994. PressVisibility = Visibility.Visible;
  1995. pressStringList[1] = PressPID;
  1996. pressStringList[2] = PressSet.ToString();
  1997. break;
  1998. case "Slow Vac":
  1999. var defaultAPCPID = SystemConfigProvider.Instance.GetValueByName("PM1.APCPID");
  2000. pressStringList[1] = defaultAPCPID;
  2001. pressStringList[2] = PressSlowVacSet.ToString();
  2002. break;
  2003. case "Valve Angle":
  2004. pressStringList[2] = PressValveAngleSet.ToString();
  2005. pressStringList[3] = LowPressWait;
  2006. break;
  2007. case "Full Open":
  2008. case "Full Close":
  2009. case "Hold":
  2010. case "Zero Set":
  2011. case "Cancel Zero":
  2012. pressStringList[1] = "";
  2013. pressStringList[2] = "";
  2014. pressStringList[3] = "";
  2015. break;
  2016. case "WaitPressUp1":
  2017. case "WaitPressDown1":
  2018. case "WaitPressUp2":
  2019. case "WaitPressDown2":
  2020. pressStringList[2] = PressWait.ToString();
  2021. break;
  2022. default:
  2023. break;
  2024. }
  2025. }
  2026. return string.Join(";", pressStringList);
  2027. }
  2028. }
  2029. public class MFCGasData : PropertyChangedBase
  2030. {
  2031. private int _no;
  2032. public int No
  2033. {
  2034. get => _no;
  2035. set
  2036. {
  2037. _no = value;
  2038. NotifyOfPropertyChange(nameof(No));
  2039. }
  2040. }
  2041. private string _name;
  2042. public string Name
  2043. {
  2044. get => _name;
  2045. set
  2046. {
  2047. _name = value;
  2048. NotifyOfPropertyChange(nameof(Name));
  2049. }
  2050. }
  2051. public string _unit;
  2052. public string Unit
  2053. {
  2054. get => _unit;
  2055. set
  2056. {
  2057. _unit = value;
  2058. NotifyOfPropertyChange(nameof(Unit));
  2059. }
  2060. }
  2061. private string _displayName;
  2062. public string DisplayName
  2063. {
  2064. get => _displayName;
  2065. set
  2066. {
  2067. _displayName = value;
  2068. NotifyOfPropertyChange(nameof(DisplayName));
  2069. }
  2070. }
  2071. private string _controlName;
  2072. public string ControlName
  2073. {
  2074. get => _controlName;
  2075. set
  2076. {
  2077. _controlName = value;
  2078. NotifyOfPropertyChange(nameof(ControlName));
  2079. }
  2080. }
  2081. private double _actualValue;
  2082. public double ActualValue
  2083. {
  2084. get => _actualValue;
  2085. set
  2086. {
  2087. _actualValue = value;
  2088. NotifyOfPropertyChange(nameof(ActualValue));
  2089. }
  2090. }
  2091. private string _value;
  2092. public string Value
  2093. {
  2094. get => _value;
  2095. set
  2096. {
  2097. _value = value;
  2098. NotifyOfPropertyChange(nameof(Value));
  2099. }
  2100. }
  2101. private double _actualRampng;
  2102. public double ActualRampng
  2103. {
  2104. get => _actualRampng; set
  2105. {
  2106. _actualRampng = value;
  2107. NotifyOfPropertyChange(nameof(ActualRampng));
  2108. }
  2109. }
  2110. private string _rampng;
  2111. public string Rampng
  2112. {
  2113. get => _rampng; set
  2114. {
  2115. _rampng = value;
  2116. NotifyOfPropertyChange(nameof(Rampng));
  2117. }
  2118. }
  2119. private double _maxValue;
  2120. public double MaxValue
  2121. {
  2122. get => _maxValue; set
  2123. {
  2124. _maxValue = value;
  2125. NotifyOfPropertyChange(nameof(MaxValue));
  2126. }
  2127. }
  2128. private double _minValue;
  2129. public double MinValue
  2130. {
  2131. get => _minValue; set
  2132. {
  2133. _minValue = value;
  2134. NotifyOfPropertyChange(nameof(MinValue));
  2135. }
  2136. }
  2137. private bool _isSetChanged = true;
  2138. public bool IsSetChanged
  2139. {
  2140. get => _isSetChanged;
  2141. set
  2142. {
  2143. _isSetChanged = value;
  2144. NotifyOfPropertyChange(nameof(IsSetChanged));
  2145. }
  2146. }
  2147. private bool _isRampngChanged = true;
  2148. public bool IsRampngChanged
  2149. {
  2150. get => _isRampngChanged;
  2151. set
  2152. {
  2153. _isRampngChanged = value;
  2154. NotifyOfPropertyChange(nameof(IsRampngChanged));
  2155. }
  2156. }
  2157. private string _alarmValue;
  2158. public string AlarmValue
  2159. {
  2160. get => _alarmValue;
  2161. set
  2162. {
  2163. _alarmValue = value;
  2164. NotifyOfPropertyChange(nameof(AlarmValue));
  2165. }
  2166. }
  2167. }
  2168. public class TempManualSetData : PropertyChangedBase
  2169. {
  2170. private int _no;
  2171. public int No
  2172. {
  2173. get => _no;
  2174. set
  2175. {
  2176. _no = value;
  2177. NotifyOfPropertyChange("No");
  2178. }
  2179. }
  2180. private string _name;
  2181. public string Name
  2182. {
  2183. get => _name;
  2184. set
  2185. {
  2186. _name = value;
  2187. NotifyOfPropertyChange("Name");
  2188. }
  2189. }
  2190. private string _displayName;
  2191. public string DisplayName
  2192. {
  2193. get => _displayName;
  2194. set
  2195. {
  2196. _displayName = value;
  2197. NotifyOfPropertyChange(nameof(DisplayName));
  2198. }
  2199. }
  2200. private string _controlName;
  2201. public string ControlName
  2202. {
  2203. get => _controlName;
  2204. set
  2205. {
  2206. _controlName = value;
  2207. NotifyOfPropertyChange(nameof(ControlName));
  2208. }
  2209. }
  2210. private double _actualValue;
  2211. public double ActualValue
  2212. {
  2213. get => _actualValue;
  2214. set
  2215. {
  2216. _actualValue = value;
  2217. NotifyOfPropertyChange(nameof(ActualValue));
  2218. }
  2219. }
  2220. private string _value;
  2221. public string Value
  2222. {
  2223. get => _value;
  2224. set
  2225. {
  2226. _value = value;
  2227. NotifyOfPropertyChange(nameof(Value));
  2228. }
  2229. }
  2230. private string _actualRampng;
  2231. public string ActualRampng
  2232. {
  2233. get => _actualRampng;
  2234. set
  2235. {
  2236. _actualRampng = value;
  2237. NotifyOfPropertyChange(nameof(ActualRampng));
  2238. }
  2239. }
  2240. private string _rampng;
  2241. public string Rampng
  2242. {
  2243. get => _rampng; set
  2244. {
  2245. _rampng = value;
  2246. NotifyOfPropertyChange(nameof(Rampng));
  2247. }
  2248. }
  2249. private string _maxValue;
  2250. public string MaxValue
  2251. {
  2252. get => _maxValue; set
  2253. {
  2254. _maxValue = value;
  2255. NotifyOfPropertyChange(nameof(MaxValue));
  2256. }
  2257. }
  2258. private string _minValue;
  2259. public string MinValue
  2260. {
  2261. get => _minValue; set
  2262. {
  2263. _minValue = value;
  2264. NotifyOfPropertyChange(nameof(MinValue));
  2265. }
  2266. }
  2267. private bool _isChanged = true;
  2268. public bool IsChanged
  2269. {
  2270. get => _isChanged;
  2271. set
  2272. {
  2273. _isChanged = value;
  2274. NotifyOfPropertyChange(nameof(IsChanged));
  2275. }
  2276. }
  2277. private string _unit;
  2278. public string Unit
  2279. {
  2280. get => _unit;
  2281. set
  2282. {
  2283. _unit = value;
  2284. NotifyOfPropertyChange("Unit");
  2285. }
  2286. }
  2287. private bool _isSetChanged = true;
  2288. public bool IsSetChanged
  2289. {
  2290. get => _isSetChanged;
  2291. set
  2292. {
  2293. _isSetChanged = value;
  2294. NotifyOfPropertyChange(nameof(IsSetChanged));
  2295. }
  2296. }
  2297. private bool _isRampngChanged = true;
  2298. public bool IsRampngChanged
  2299. {
  2300. get => _isRampngChanged;
  2301. set
  2302. {
  2303. _isRampngChanged = value;
  2304. NotifyOfPropertyChange(nameof(IsRampngChanged));
  2305. }
  2306. }
  2307. private string _alarmValue;
  2308. public string AlarmValue
  2309. {
  2310. get => _alarmValue;
  2311. set
  2312. {
  2313. _alarmValue = value;
  2314. NotifyOfPropertyChange(nameof(AlarmValue));
  2315. }
  2316. }
  2317. }
  2318. }