ManualSetViewModel.cs 111 KB

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