ManualSetViewModel.cs 68 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609
  1. using Aitex.Core.Common.DeviceData;
  2. using Aitex.Core.Util;
  3. using Caliburn.Micro;
  4. using Caliburn.Micro.Core;
  5. using FurnaceUI.Common;
  6. using FurnaceUI.Models;
  7. using FurnaceUI.Views.Editors;
  8. using FurnaceUI.Views.Parameter;
  9. using MECF.Framework.Common.DataCenter;
  10. using MECF.Framework.Common.OperationCenter;
  11. using MECF.Framework.Common.RecipeCenter;
  12. using MECF.Framework.UI.Client.CenterViews.Configs.SystemConfig;
  13. using MECF.Framework.UI.Client.CenterViews.Dialogs;
  14. using MECF.Framework.UI.Client.CenterViews.Editors.Recipe;
  15. using MECF.Framework.UI.Client.ClientBase;
  16. using OpenSEMI.ClientBase;
  17. using RecipeEditorLib.RecipeModel.Params;
  18. using System;
  19. using System.Collections.Generic;
  20. using System.Collections.ObjectModel;
  21. using System.Linq;
  22. using System.Windows;
  23. using System.Windows.Controls;
  24. namespace FurnaceUI.Views.Recipes
  25. {
  26. public class ManualSetViewModel : FurnaceUIViewModelBase
  27. {
  28. #region MFCs
  29. [Subscription("CHM.MFC1.DeviceData")]
  30. public AITMfcData MFC1Data { get; set; }
  31. [Subscription("CHM.MFC2.DeviceData")]
  32. public AITMfcData MFC2Data { get; set; }
  33. [Subscription("CHM.MFC3.DeviceData")]
  34. public AITMfcData MFC3Data { get; set; }
  35. [Subscription("CHM.MFC4.DeviceData")]
  36. public AITMfcData MFC4Data { get; set; }
  37. [Subscription("CHM.MFC5.DeviceData")]
  38. public AITMfcData MFC5Data { get; set; }
  39. [Subscription("CHM.MFC6.DeviceData")]
  40. public AITMfcData MFC6Data { get; set; }
  41. [Subscription("CHM.MFC7.DeviceData")]
  42. public AITMfcData MFC7Data { get; set; }
  43. [Subscription("CHM.MFC8.DeviceData")]
  44. public AITMfcData MFC8Data { get; set; }
  45. [Subscription("CHM.MFC9.DeviceData")]
  46. public AITMfcData MFC9Data { get; set; }
  47. [Subscription("CHM.MFC10.DeviceData")]
  48. public AITMfcData MFC10Data { get; set; }
  49. [Subscription("CHM.MFC11.DeviceData")]
  50. public AITMfcData MFC11Data { get; set; }
  51. [Subscription("CHM.MFC12.DeviceData")]
  52. public AITMfcData MFC12Data { get; set; }
  53. [Subscription("CHM.MFC51.DeviceData")]
  54. public AITMfcData MFC51Data { get; set; }
  55. #endregion
  56. [Subscription("PM1.EditRecipeStepNo")]
  57. public int EditRecipeStepNo { get; set; }
  58. [Subscription("PM1.EditRecipeName")]
  59. public string EditRecipeName { get; set; }
  60. [Subscription("PM1.EditRecipeStepName")]
  61. public string EditRecipeStepName { get; set; }
  62. private int ControlMode = 1;
  63. private UIElement _parent;
  64. [Subscription("System.Heater1.DeviceData")]
  65. public AITHeaterData Heater1Data { get; set; }
  66. [Subscription("System.Heater2.DeviceData")]
  67. public AITHeaterData Heater2Data { get; set; }
  68. [Subscription("System.Heater3.DeviceData")]
  69. public AITHeaterData Heater3Data { get; set; }
  70. [Subscription("System.Heater4.DeviceData")]
  71. public AITHeaterData Heater4Data { get; set; }
  72. [Subscription("System.Heater5.DeviceData")]
  73. public AITHeaterData Heater5Data { get; set; }
  74. [Subscription("System.Heater6.DeviceData")]
  75. public AITHeaterData Heater6Data { get; set; }
  76. [Subscription("System.Heater7.DeviceData")]
  77. public AITHeaterData Heater7Data { get; set; }
  78. [Subscription("System.Heater8.DeviceData")]
  79. public AITHeaterData Heater8Data { get; set; }
  80. [Subscription("System.Heater9.DeviceData")]
  81. public AITHeaterData Heater9Data { get; set; }
  82. [Subscription("System.Heater10.DeviceData")]
  83. public AITHeaterData Heater10Data { get; set; }
  84. public AITHeaterData BottomHeaterData => ControlMode == 0 ? Heater9Data : Heater10Data;
  85. public AITHeaterData CenterBottomHeaterData => ControlMode == 0 ? Heater7Data : Heater8Data;
  86. public AITHeaterData CenterHeaterData => ControlMode == 0 ? Heater5Data : Heater6Data;
  87. public AITHeaterData TopCenterHeaterData => ControlMode == 0 ? Heater3Data : Heater4Data;
  88. public AITHeaterData TopHeaterData => ControlMode == 0 ? Heater1Data : Heater2Data;
  89. public void SetParent(UIElement parent)
  90. {
  91. _parent = parent;
  92. }
  93. #region"Loader Set Value"
  94. private Visibility _loaderSet3SpeedVisibility = Visibility.Hidden;
  95. public Visibility LoaderSet3SpeedVisibility
  96. {
  97. get => _loaderSet3SpeedVisibility;
  98. set
  99. {
  100. _loaderSet3SpeedVisibility = value;
  101. NotifyOfPropertyChange(nameof(LoaderSet3SpeedVisibility));
  102. }
  103. }
  104. private Visibility _loaderSetSpeedVisibility = Visibility.Hidden;
  105. public Visibility LoaderSetSpeedVisibility
  106. {
  107. get => _loaderSetSpeedVisibility;
  108. set
  109. {
  110. _loaderSetSpeedVisibility = value;
  111. NotifyOfPropertyChange(nameof(LoaderSetSpeedVisibility));
  112. }
  113. }
  114. private Visibility _loaderSetSpeedFloatVisibility = Visibility.Hidden;
  115. public Visibility LoaderSetSpeedFloatVisibility
  116. {
  117. get => _loaderSetSpeedFloatVisibility;
  118. set
  119. {
  120. _loaderSetSpeedFloatVisibility = value;
  121. NotifyOfPropertyChange(nameof(LoaderSetSpeedFloatVisibility));
  122. }
  123. }
  124. public void SetShowLoaderValuePanel(string selectedCmd)
  125. {
  126. switch (selectedCmd)
  127. {
  128. case "Boat Load":
  129. case "Boat Unload":
  130. LoaderSet3SpeedVisibility = Visibility.Visible;
  131. LoaderSetSpeedVisibility = Visibility.Hidden;
  132. LoaderSetSpeedFloatVisibility = Visibility.Hidden;
  133. break;
  134. case "Boat Rotate":
  135. LoaderSet3SpeedVisibility = Visibility.Hidden;
  136. LoaderSetSpeedVisibility = Visibility.Hidden;
  137. LoaderSetSpeedFloatVisibility = Visibility.Visible;
  138. break;
  139. case "Boat CAP2":
  140. LoaderSet3SpeedVisibility = Visibility.Hidden;
  141. LoaderSetSpeedVisibility = Visibility.Visible;
  142. LoaderSetSpeedFloatVisibility = Visibility.Hidden;
  143. break;
  144. case "Stop(Include R-axis)":
  145. case "Boat Rotate Stop":
  146. case "Boat Loader Home":
  147. case "None":
  148. case "NONE":
  149. LoaderSet3SpeedVisibility = Visibility.Hidden;
  150. LoaderSetSpeedVisibility = Visibility.Hidden;
  151. LoaderSetSpeedFloatVisibility = Visibility.Hidden;
  152. break;
  153. default:
  154. break;
  155. }
  156. }
  157. public void SetLoaderValue(string selectedCmd, string Values)
  158. {
  159. switch (selectedCmd)
  160. {
  161. case "Boat Load":
  162. case "Boat Unload":
  163. if (string.IsNullOrEmpty(Values)) return;
  164. string[] list = Values.Split(';');
  165. if (list.Length < 3) return;
  166. Loader3Speed1 = int.Parse(list[0]);
  167. Loader3Speed2 = int.Parse(list[1]);
  168. Loader3Speed3 = int.Parse(list[2]);
  169. break;
  170. case "Boat Rotate":
  171. if (string.IsNullOrEmpty(Values)) return;
  172. LoaderFloatRPM = double.Parse(Values);
  173. break;
  174. case "Boat CAP2":
  175. if (string.IsNullOrEmpty(Values)) return;
  176. LoaderSpeed = int.Parse(Values);
  177. break;
  178. case "Stop(Include R-axis)":
  179. case "Boat Rotate Stop":
  180. case "Boat Loader Home":
  181. case "None":
  182. break;
  183. default:
  184. break;
  185. }
  186. }
  187. public string GetSaveLoaderValue(string selectedCmd)
  188. {
  189. switch (selectedCmd)
  190. {
  191. case "Boat Load":
  192. case "Boat Unload":
  193. return $"{Loader3Speed1};{Loader3Speed2};{Loader3Speed3}";
  194. case "Boat Rotate":
  195. return LoaderFloatRPM.ToString();
  196. case "Boat CAP2":
  197. return LoaderSpeed.ToString();
  198. case "Stop(Include R-axis)":
  199. case "Boat Rotate Stop":
  200. case "Boat Loader Home":
  201. case "None":
  202. return "";
  203. default:
  204. return "";
  205. }
  206. }
  207. private int loader3Speed1 = 5;
  208. public int Loader3Speed1
  209. {
  210. get => loader3Speed1;
  211. set
  212. {
  213. loader3Speed1 = value;
  214. NotifyOfPropertyChange(nameof(Loader3Speed1));
  215. }
  216. }
  217. private int loader3Speed2 = 0;
  218. public int Loader3Speed2
  219. {
  220. get => loader3Speed2;
  221. set
  222. {
  223. loader3Speed2 = value;
  224. NotifyOfPropertyChange(nameof(Loader3Speed2));
  225. }
  226. }
  227. private int loader3Speed3 = 0;
  228. public int Loader3Speed3
  229. {
  230. get => loader3Speed3;
  231. set
  232. {
  233. loader3Speed3 = value;
  234. NotifyOfPropertyChange(nameof(Loader3Speed3));
  235. }
  236. }
  237. private double _loaderFloatRPM = 0;
  238. public double LoaderFloatRPM
  239. {
  240. get => _loaderFloatRPM;
  241. set
  242. {
  243. _loaderFloatRPM = value;
  244. NotifyOfPropertyChange(nameof(LoaderFloatRPM));
  245. }
  246. }
  247. private int loaderSpeed = 0;
  248. public int LoaderSpeed
  249. {
  250. get => loaderSpeed;
  251. set
  252. {
  253. loaderSpeed = value;
  254. NotifyOfPropertyChange(nameof(LoaderSpeed));
  255. }
  256. }
  257. private void ClearLoaderSetValue()
  258. {
  259. Loader3Speed1 = 0;
  260. Loader3Speed2 = 0;
  261. Loader3Speed3 = 0;
  262. LoaderFloatRPM = 0;
  263. LoaderSpeed = 0;
  264. }
  265. #endregion
  266. #region"PressVisibility"
  267. private Visibility _pressVisibility = Visibility.Hidden;
  268. public Visibility PressVisibility
  269. {
  270. get => _pressVisibility;
  271. set
  272. {
  273. _pressVisibility = value;
  274. NotifyOfPropertyChange(nameof(PressVisibility));
  275. }
  276. }
  277. private Visibility _pressSlowVacVisibility = Visibility.Hidden;
  278. public Visibility PressSlowVacVisibility
  279. {
  280. get => _pressSlowVacVisibility;
  281. set
  282. {
  283. _pressSlowVacVisibility = value;
  284. NotifyOfPropertyChange(nameof(PressSlowVacVisibility));
  285. }
  286. }
  287. private Visibility _pressValveAngleVisibility = Visibility.Hidden;
  288. public Visibility PressValveAngleVisibility
  289. {
  290. get => _pressValveAngleVisibility;
  291. set
  292. {
  293. _pressValveAngleVisibility = value;
  294. NotifyOfPropertyChange(nameof(PressValveAngleVisibility));
  295. }
  296. }
  297. private Visibility _pressWaitVisibility = Visibility.Hidden;
  298. public Visibility PressWaitVisibility
  299. {
  300. get => _pressWaitVisibility;
  301. set
  302. {
  303. _pressWaitVisibility = value;
  304. NotifyOfPropertyChange(nameof(PressWaitVisibility));
  305. }
  306. }
  307. public void SetShowPressPanel(string selectedCmd)
  308. {
  309. switch (selectedCmd)
  310. {
  311. case "Press":
  312. case "Press2":
  313. PressVisibility = Visibility.Visible;
  314. PressSlowVacVisibility = Visibility.Hidden;
  315. PressValveAngleVisibility = Visibility.Hidden;
  316. PressWaitVisibility = Visibility.Hidden;
  317. break;
  318. case "Slow Vac":
  319. PressVisibility = Visibility.Hidden;
  320. PressSlowVacVisibility = Visibility.Visible;
  321. PressValveAngleVisibility = Visibility.Hidden;
  322. PressWaitVisibility = Visibility.Hidden;
  323. break;
  324. case "Valve Angle":
  325. PressVisibility = Visibility.Hidden;
  326. PressSlowVacVisibility = Visibility.Hidden;
  327. PressValveAngleVisibility = Visibility.Visible;
  328. PressWaitVisibility = Visibility.Hidden;
  329. break;
  330. case "Full Open":
  331. case "Full Close":
  332. case "Hold":
  333. case "Zero Set":
  334. case "Cancel Zero":
  335. PressVisibility = Visibility.Hidden;
  336. PressSlowVacVisibility = Visibility.Hidden;
  337. PressValveAngleVisibility = Visibility.Hidden;
  338. PressWaitVisibility = Visibility.Hidden;
  339. break;
  340. case "WaitPressUp1":
  341. case "WaitPressDown1":
  342. case "WaitPressUp2":
  343. case "WaitPressDown2":
  344. PressVisibility = Visibility.Hidden;
  345. PressSlowVacVisibility = Visibility.Hidden;
  346. PressValveAngleVisibility = Visibility.Hidden;
  347. PressWaitVisibility = Visibility.Visible;
  348. break;
  349. default:
  350. break;
  351. }
  352. }
  353. public void SetPressValue(string selectedCmd, string Values)
  354. {
  355. switch (selectedCmd)
  356. {
  357. case "Press":
  358. case "Press2":
  359. if (string.IsNullOrEmpty(Values)) return;
  360. string[] list = Values.Split(';');
  361. if (list.Length < 2) return;
  362. PressPID = list[0];
  363. PressSet = double.Parse(list[1]);
  364. break;
  365. case "Slow Vac":
  366. if (string.IsNullOrEmpty(Values)) return;
  367. PressSlowVacSet = double.Parse(Values);
  368. break;
  369. case "Valve Angle":
  370. if (string.IsNullOrEmpty(Values)) return;
  371. PressValveAngleSet = double.Parse(Values);
  372. break;
  373. case "Full Open":
  374. case "Full Close":
  375. case "Hold":
  376. case "Zero Set":
  377. case "Cancel Zero":
  378. break;
  379. case "WaitPressUp1":
  380. case "WaitPressDown1":
  381. case "WaitPressUp2":
  382. case "WaitPressDown2":
  383. if (string.IsNullOrEmpty(Values)) return;
  384. PressWait = double.Parse(Values);
  385. break;
  386. default:
  387. break;
  388. }
  389. }
  390. public string GetSavePressValue(string selectedCmd)
  391. {
  392. switch (selectedCmd)
  393. {
  394. case "Press":
  395. case "Press2":
  396. return $"{PressPID};{PressSet}";
  397. case "Slow Vac":
  398. return PressSlowVacSet.ToString();
  399. case "Valve Angle":
  400. return PressValveAngleSet.ToString();
  401. case "Full Open":
  402. case "Full Close":
  403. case "Hold":
  404. case "Zero Set":
  405. case "Cancel Zero":
  406. return "";
  407. case "WaitPressUp1":
  408. case "WaitPressDown1":
  409. case "WaitPressUp2":
  410. case "WaitPressDown2":
  411. return PressWait.ToString();
  412. default:
  413. return "";
  414. }
  415. }
  416. private string _pressPID;
  417. public string PressPID
  418. {
  419. get => _pressPID;
  420. set
  421. {
  422. _pressPID = value;
  423. NotifyOfPropertyChange(nameof(PressPID));
  424. }
  425. }
  426. private double _pressSet;
  427. public double PressSet
  428. {
  429. get => _pressSet;
  430. set
  431. {
  432. _pressSet = value;
  433. NotifyOfPropertyChange(nameof(PressSet));
  434. }
  435. }
  436. private double _pressSlowVacSet;
  437. public double PressSlowVacSet
  438. {
  439. get => _pressSlowVacSet;
  440. set
  441. {
  442. _pressSlowVacSet = value;
  443. NotifyOfPropertyChange(nameof(PressSlowVacSet));
  444. }
  445. }
  446. private double _pressValveAngleSet;
  447. public double PressValveAngleSet
  448. {
  449. get => _pressValveAngleSet;
  450. set
  451. {
  452. _pressValveAngleSet = value;
  453. NotifyOfPropertyChange(nameof(PressValveAngleSet));
  454. }
  455. }
  456. private string _lowPressWait;
  457. public string LowPressWait
  458. {
  459. get => _lowPressWait;
  460. set
  461. {
  462. _lowPressWait = value;
  463. NotifyOfPropertyChange(nameof(LowPressWait));
  464. }
  465. }
  466. private double _pressWait;
  467. public double PressWait
  468. {
  469. get => _pressWait;
  470. set
  471. {
  472. _pressWait = value;
  473. NotifyOfPropertyChange(nameof(PressWait));
  474. }
  475. }
  476. private void ClearPressSetValue()
  477. {
  478. PressPID = "None";
  479. PressSet = 0;
  480. PressSlowVacSet = 0;
  481. PressValveAngleSet = 0;
  482. LowPressWait = "None";
  483. PressWait = 0;
  484. }
  485. #endregion
  486. #region AlarmRecipe Visibility
  487. public bool IsAlarmReicpe => RecipeType.ToLower() == "alarm";
  488. public bool IsAbortReicpe => RecipeType.ToLower() == "abort";
  489. public bool IsSubReicpe => RecipeType.ToLower() == "sub";
  490. public bool IsTableVisibility => IsAlarmReicpe || IsAbortReicpe || IsSubReicpe;
  491. public bool IsRecipeHeaderVisibility => !IsTableVisibility;
  492. public bool IsVPDataListVisibility => !IsTableVisibility;
  493. public bool IsCombinationVisibility => !IsTableVisibility;
  494. #endregion
  495. private bool _noStandbyIsEnabled = false;
  496. public bool NoStandbyIsEnabled
  497. {
  498. get => _noStandbyIsEnabled;
  499. set
  500. {
  501. _noStandbyIsEnabled = value;
  502. NotifyOfPropertyChange(nameof(NoStandbyIsEnabled));
  503. }
  504. }
  505. private Visibility _standbyIsVisibility = Visibility.Visible;
  506. public Visibility StandbyIsVisibility
  507. {
  508. get => _standbyIsVisibility;
  509. set
  510. {
  511. _standbyIsVisibility = value;
  512. NotifyOfPropertyChange(nameof(StandbyIsVisibility));
  513. }
  514. }
  515. private string _selectedGasSetting2;
  516. public string SelectedGasSetting2
  517. {
  518. get
  519. {
  520. return _selectedGasSetting2;
  521. }
  522. set
  523. {
  524. _selectedGasSetting2 = value;
  525. NotifyOfPropertyChange(nameof(SelectedGasSetting2));
  526. }
  527. }
  528. private string _selectedGasSetting3;
  529. public string SelectedGasSetting3
  530. {
  531. get
  532. {
  533. return _selectedGasSetting3;
  534. }
  535. set
  536. {
  537. _selectedGasSetting3 = value;
  538. NotifyOfPropertyChange(nameof(SelectedGasSetting3));
  539. }
  540. }
  541. private string _selectedGasSetting4;
  542. public string SelectedGasSetting4
  543. {
  544. get
  545. {
  546. return _selectedGasSetting4;
  547. }
  548. set
  549. {
  550. _selectedGasSetting4 = value;
  551. NotifyOfPropertyChange(nameof(SelectedGasSetting4));
  552. }
  553. }
  554. private string _selectedGasSetting5;
  555. public string SelectedGasSetting5
  556. {
  557. get
  558. {
  559. return _selectedGasSetting5;
  560. }
  561. set
  562. {
  563. _selectedGasSetting5 = value;
  564. NotifyOfPropertyChange(nameof(SelectedGasSetting5));
  565. }
  566. }
  567. private string _selectedGasSetting6;
  568. public string SelectedGasSetting6
  569. {
  570. get
  571. {
  572. return _selectedGasSetting6;
  573. }
  574. set
  575. {
  576. _selectedGasSetting6 = value;
  577. NotifyOfPropertyChange(nameof(SelectedGasSetting6));
  578. }
  579. }
  580. private List<ConfigNode> _ConfigNodes = new List<ConfigNode>();
  581. public List<ConfigNode> ConfigNodes
  582. {
  583. get { return _ConfigNodes; }
  584. set
  585. {
  586. _ConfigNodes = value;
  587. NotifyOfPropertyChange(nameof(ConfigNodes));
  588. }
  589. }
  590. private ObservableCollection<MFCGasData> _mFCDatas = new ObservableCollection<MFCGasData>();
  591. public ObservableCollection<TempManualSetData> TempList { get; set; } = new ObservableCollection<TempManualSetData>();
  592. public ObservableCollection<MFCGasData> MFCDataList
  593. {
  594. get => _mFCDatas;
  595. set
  596. {
  597. _mFCDatas = value;
  598. NotifyOfPropertyChange(nameof(MFCDataList));
  599. }
  600. }
  601. private string _pressureUnit;
  602. public string PressureUnit
  603. {
  604. get => _pressureUnit;
  605. set
  606. {
  607. _pressureUnit = value;
  608. NotifyOfPropertyChange(nameof(PressureUnit));
  609. }
  610. }
  611. public string RecipeType { get; set; }
  612. public ManualSetViewModel()
  613. {
  614. }
  615. protected override void OnViewLoaded(object view)
  616. {
  617. base.OnViewLoaded(view);
  618. }
  619. protected override void OnActivate()
  620. {
  621. base.OnActivate();
  622. //InvokeClient.Instance.Service.DoOperation($"PM1.SetSensorRecipeOK", "");
  623. }
  624. protected override void OnDeactivate(bool close)
  625. {
  626. base.OnDeactivate(close);
  627. //InvokeClient.Instance.Service.DoOperation($"PM1.SetSensorPROCManualOK", "");
  628. }
  629. protected override void OnInitialize()
  630. {
  631. base.OnInitialize();
  632. // GetHeaderConfig();
  633. LoadData();
  634. }
  635. private void LoadData()
  636. {
  637. }
  638. //撤销修改
  639. public void RecipeIsChangeClick(object cmdName, object value)
  640. {
  641. var windowManager = IoC.Get<IWindowManager>();
  642. switch ((string)cmdName)
  643. {
  644. case "Alarm":
  645. break;
  646. case "MFC":
  647. break;
  648. case "Gas":
  649. break;
  650. case "AUX":
  651. break;
  652. case "Press":
  653. break;
  654. case "Temp":
  655. break;
  656. default:
  657. break;
  658. }
  659. }
  660. public void TempSetClick(object sender)
  661. {
  662. string stSetValue = ShowNumberKeyboard(sender as Button, "");
  663. //foreach (var item in TempList)
  664. //{
  665. // item.Value= stSetValue;
  666. //}
  667. }
  668. public void RampSetClick(object sender)
  669. {
  670. string strSetRamp = ShowNumberKeyboard(sender as Button, "");
  671. //foreach (var item in TempList)
  672. //{
  673. // item.Rampng = strSetRamp;
  674. //}
  675. }
  676. private string ShowNumberKeyboard(Control control, string defaultValue)
  677. {
  678. NumberKeyboard numberKeyboard = new NumberKeyboard("", defaultValue);
  679. var point = control.PointFromScreen(new Point(0, 0));
  680. double wx = SystemParameters.WorkArea.Width;
  681. double hy = SystemParameters.WorkArea.Height;
  682. if (-point.Y + control.ActualHeight + 5 + numberKeyboard.Height < hy)
  683. {
  684. numberKeyboard.Top = -point.Y + control.ActualHeight + 5;
  685. }
  686. else
  687. {
  688. numberKeyboard.Top = -point.Y - numberKeyboard.Height - 5;
  689. }
  690. if (-point.X + numberKeyboard.Width < wx)
  691. {
  692. numberKeyboard.Left = -point.X;
  693. }
  694. else
  695. {
  696. numberKeyboard.Left = -point.X - (numberKeyboard.Width - control.ActualWidth);
  697. }
  698. if ((bool)numberKeyboard.ShowDialog())
  699. return numberKeyboard.ValueString;
  700. else
  701. return "Cancel";
  702. }
  703. //public void TempTextClick(string type, object sender)
  704. //{
  705. // var windowManager = IoC.Get<IWindowManager>();
  706. // switch (type)
  707. // {
  708. // case "Mode":
  709. // RecipeTempModeViewModel recipeTempModeViewModel = new RecipeTempModeViewModel();
  710. // var rtn = (windowManager as WindowManager)?.ShowDialogWithTitle(recipeTempModeViewModel, null, "Temp Mode");
  711. // if ((bool)rtn)
  712. // {
  713. // }
  714. // break;
  715. // case "Correct":
  716. // TempCorrectionEditViewModel tempCorrectionEditViewModel = new TempCorrectionEditViewModel();
  717. // //tempCorrectionEditViewModel.ResultString = SelectedRecipeStep.TemperatureCorrect;
  718. // //tempCorrectionEditViewModel.SelectedRecipeStep = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault();
  719. // tempCorrectionEditViewModel.IsEnabledControl = false;
  720. // tempCorrectionEditViewModel.AutoSelectVisibility = Visibility.Visible;
  721. // // tempOffsetTableViewModel.SelectedRecipeStep = SelectedRecipeStep;
  722. // rtn = (windowManager as WindowManager)?.ShowDialogWithTitle(tempCorrectionEditViewModel, null, "Temp Correct Table");
  723. // if ((bool)rtn)
  724. // {
  725. // }
  726. // break;
  727. // case "PID":
  728. // TempOffsetTableViewModel tempOffsetTableViewModel1 = new TempOffsetTableViewModel();
  729. // //tempOffsetTableViewModel1.TempOffsetTableSelected = SelectedRecipeStep.TemperaturePID;
  730. // //tempOffsetTableViewModel1.SelectedRecipeStep = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault();
  731. // rtn = (windowManager as WindowManager)?.ShowDialogWithTitle(tempOffsetTableViewModel1, null, "Temp PID Table");
  732. // if ((bool)rtn)
  733. // {
  734. // //SelectedRecipeStep.TemperaturePID = tempOffsetTableViewModel1.TempOffsetTableSelected;
  735. // //var foundStep = this.CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault();
  736. // //if (foundStep != null)
  737. // //{
  738. // // foundStep.TemperaturePID = tempOffsetTableViewModel1.TempOffsetTableSelected;
  739. // //}
  740. // }
  741. // break;
  742. // default:
  743. // break;
  744. // }
  745. //}
  746. public void StepEdit(object cmdName, object value)
  747. {
  748. var windowManager = IoC.Get<IWindowManager>();
  749. switch ((string)cmdName)
  750. {
  751. case "RecipeCommand":
  752. RecipeCommandViewModel recipeCommandViewModel = new RecipeCommandViewModel();
  753. //ObservableCollection<string> loopStepNames = new ObservableCollection<string>(CurrentRecipe.Steps.OrderBy(x => x.StepNo).Where(x => x.StepNo < SelectedRecipeStep.StepNo).Select(x => x.Name).ToList());
  754. //ObservableCollection<string> jumpStepNames = new ObservableCollection<string>(CurrentRecipe.Steps.OrderBy(x => x.StepNo).Where(x => x.StepNo != SelectedRecipeStep.StepNo).Select(x => x.Name).ToList());
  755. //recipeCommandViewModel.LoopStepNames = loopStepNames;
  756. //recipeCommandViewModel.JumpStepNames = jumpStepNames;
  757. //recipeCommandViewModel.SelectRecipeCommand = SelectedRecipeStep.Command;
  758. //recipeCommandViewModel.RecipeData = CurrentRecipe;
  759. //if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeCommandViewModel, null, "Recipe Command"))
  760. //{
  761. // SelectedRecipeStep.Command = recipeCommandViewModel.SelectRecipeCommand;
  762. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().Command = SelectedRecipeStep.Command;
  763. //}
  764. break;
  765. case "ConditionCheck":
  766. RecipeConditionCheckSetViewModel recipeConditionCheckSetViewModel = new RecipeConditionCheckSetViewModel();
  767. //if (CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().ExternalSensor != null)
  768. //{
  769. // recipeConditionCheckSetViewModel.RecipeConditions.ExternalSensor = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().ExternalSensor;
  770. //}
  771. //var step = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault();
  772. //if (step != null)
  773. //{
  774. // recipeConditionCheckSetViewModel.RecipeConditions.TempStabizeSelected = step.TempStabilizeSelected;
  775. // recipeConditionCheckSetViewModel.RecipeConditions.FinishAutoProfile = step.FinishAutoProfile;
  776. // recipeConditionCheckSetViewModel.RecipeConditions.ReachTemp = step.ReachTemp;
  777. // recipeConditionCheckSetViewModel.RecipeConditions.ReachTempValue = step.ReachTempValue;
  778. // recipeConditionCheckSetViewModel.RecipeConditions.O2Density = step.O2Density;
  779. // recipeConditionCheckSetViewModel.RecipeConditions.O2DensityValue = step.O2DensityValue;
  780. // recipeConditionCheckSetViewModel.RecipeConditions.ReachPressure = step.ReachPressure;
  781. // recipeConditionCheckSetViewModel.RecipeConditions.ReachPressureVG = step.ReachPressureVG;
  782. // recipeConditionCheckSetViewModel.RecipeConditions.ReachPressureValue = step.ReachPressureValue;
  783. // recipeConditionCheckSetViewModel.RecipeConditions.PressureStabilizeVG = step.PressureStabilizeVG;
  784. // recipeConditionCheckSetViewModel.RecipeConditions.PressureStabilizeSelected = step.PressureStabilizeSelected;
  785. // recipeConditionCheckSetViewModel.RecipeConditions.ProcessTimeToEnd = step.ProcessTimeToEnd;
  786. //}
  787. //var result = (windowManager as WindowManager)?.ShowDialogWithTitle(recipeConditionCheckSetViewModel, null, "Condition Check");
  788. //if (recipeConditionCheckSetViewModel.IsSave)
  789. //{
  790. // if (recipeConditionCheckSetViewModel.IsNone)
  791. // {
  792. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().IsnoneConditionCheck = true;
  793. // }
  794. // else
  795. // {
  796. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().IsnoneConditionCheck = false;
  797. // }
  798. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().ExternalSensor = recipeConditionCheckSetViewModel.RecipeConditions.ExternalSensor;
  799. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().ExternalSensorName = recipeConditionCheckSetViewModel.RecipeConditions.ExternalSensorName;
  800. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().TempStabilizeSelected = recipeConditionCheckSetViewModel.RecipeConditions.TempStabizeSelected;
  801. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().FinishAutoProfile = recipeConditionCheckSetViewModel.RecipeConditions.FinishAutoProfile;
  802. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().ReachTemp = recipeConditionCheckSetViewModel.RecipeConditions.ReachTemp;
  803. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().ReachTempValue = recipeConditionCheckSetViewModel.RecipeConditions.ReachTempValue;
  804. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().O2Density = recipeConditionCheckSetViewModel.RecipeConditions.O2Density;
  805. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().O2DensityValue = recipeConditionCheckSetViewModel.RecipeConditions.O2DensityValue;
  806. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().ReachPressure = recipeConditionCheckSetViewModel.RecipeConditions.ReachPressure;
  807. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().ReachPressureVG = recipeConditionCheckSetViewModel.RecipeConditions.ReachPressureVG;
  808. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().PressureStabilizeVG = recipeConditionCheckSetViewModel.RecipeConditions.PressureStabilizeVG;
  809. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().ReachPressureValue = recipeConditionCheckSetViewModel.RecipeConditions.ReachPressureValue;
  810. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().PressureStabilizeSelected = recipeConditionCheckSetViewModel.RecipeConditions.PressureStabilizeSelected;
  811. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().ProcessTimeToEnd = recipeConditionCheckSetViewModel.RecipeConditions.ProcessTimeToEnd;
  812. //}
  813. if (recipeConditionCheckSetViewModel.IsNone)//不存数据处理
  814. { }
  815. break;
  816. case "AlarmAction":
  817. RecipeAlarmActionViewModel recipeAlarmActionViewModel = new RecipeAlarmActionViewModel
  818. {
  819. //CurrentRecipe = CurrentRecipe,
  820. //CurrentStepName = SelectedRecipeStep.Name,
  821. //TableIndex = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().AlarmTableIndex,
  822. //AlarmActions = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().AlarmActionSets
  823. };
  824. if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeAlarmActionViewModel, null, "Alarm Action"))
  825. {
  826. //CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().AlarmTableIndex = recipeAlarmActionViewModel.TableIndex;
  827. //CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().AlarmActionSets = recipeAlarmActionViewModel.AlarmActions;
  828. }
  829. break;
  830. case "TempSetting":
  831. //if (recipeTempSetViewModel is null)
  832. //{
  833. // recipeTempSetViewModel = new RecipeTempSetViewModel
  834. // {
  835. // RecipeTemplate = RecipeTemplate
  836. // };
  837. //}
  838. //if (CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().TemperatureSets != null)
  839. //{
  840. // var tempSets = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault();
  841. // recipeTempSetViewModel.TemperatureValues.Clear();
  842. // foreach (var item in tempSets.TemperatureSets.Keys)
  843. // {
  844. // recipeTempSetViewModel.TemperatureValues[item] = tempSets.TemperatureSets[item];
  845. // }
  846. //}
  847. //recipeTempSetViewModel.StepType = SelectedRecipeStep.Name;
  848. //recipeTempSetViewModel.RecipeType = RecipeType;
  849. //if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeTempSetViewModel, null, "Temp Detail"))
  850. //{
  851. // if (recipeTempSetViewModel.TemperatureValues != null && recipeTempSetViewModel.TemperatureValues.Count > 0 && recipeTempSetViewModel.IsSave)
  852. // {
  853. // if (CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().TemperatureSets != null)
  854. // {
  855. // var tempSets = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault();
  856. // foreach (var item in recipeTempSetViewModel.TempSetDataList)
  857. // {
  858. // if (tempSets.TemperatureSets.ContainsKey(item.Name))
  859. // {
  860. // tempSets.TemperatureSets[item.Name] = item;
  861. // }
  862. // }
  863. // }
  864. // }
  865. //}
  866. break;
  867. case "GASSetting":
  868. RecipeMFCSettingViewModel recipeMFCSettingViewModel = new RecipeMFCSettingViewModel();
  869. //InvokeClient.Instance.Service.DoOperation($"PM1.SetSensorRecipeOK", "");
  870. //var tempMFCSets = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().MFCSets;
  871. //if (tempMFCSets != null && tempMFCSets.Count > 0)
  872. //{
  873. // foreach (var item in tempMFCSets.Keys)
  874. // {
  875. // if (recipeMFCSettingViewModel.MFCSets.ContainsKey(item))
  876. // {
  877. // recipeMFCSettingViewModel.MFCSets[item] = tempMFCSets[item];
  878. // }
  879. // else
  880. // {
  881. // //recipeGASSettingViewModel.MFCSets.Add(item, tempMFCSets[item]);
  882. // 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 });
  883. // }
  884. // }
  885. //}
  886. ////recipeGASSettingViewModel.MFMSets = new MFMValue() { AlarmValue = tempMFMSets.AlarmValue, IsNotifying = tempMFMSets.IsNotifying, Name = tempMFMSets.Name, Value = tempMFMSets.Value };
  887. //recipeMFCSettingViewModel.RecipeType = RecipeType;
  888. //recipeMFCSettingViewModel.RecipeTemplate = RecipeTemplate;
  889. //if (!(bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeMFCSettingViewModel, null, "MFC Detail"))
  890. //{
  891. // //InvokeClient.Instance.Service.DoOperation($"PM1.SetSensorPROCManualOK", "");
  892. // return;
  893. //}
  894. ////InvokeClient.Instance.Service.DoOperation($"PM1.SetSensorPROCManualOK", "");
  895. //if (CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().MFCSets != null)
  896. //{
  897. // if (recipeMFCSettingViewModel.MFCSets != null && recipeMFCSettingViewModel.MFCSets.Count > 0)
  898. // {
  899. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().MFCSets = recipeMFCSettingViewModel.MFCSets;
  900. // }
  901. //}
  902. break;
  903. case "PressureSetting":
  904. RecipePressureSettingViewModel recipePressureSettingViewModel = new RecipePressureSettingViewModel();
  905. //var tempStep = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault();
  906. //recipePressureSettingViewModel.PressureSonsorValue = tempStep.PressureSonserValue;
  907. //recipePressureSettingViewModel.PressureValveAngleValue = tempStep.PressureValveAngle;
  908. //recipePressureSettingViewModel.PressureSettingVG = tempStep.PressureSettingVG;
  909. //if (!string.IsNullOrEmpty(tempStep.PressureAlarmTableNo))
  910. //{
  911. // if (tempStep.PressureAlarmTableNo.ToLower() == "none")
  912. // recipePressureSettingViewModel.PressureAlarmWatchTable = "None";
  913. // else
  914. // recipePressureSettingViewModel.PressureAlarmWatchTable = tempStep.PressureAlarmTableNo;
  915. //}
  916. //if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipePressureSettingViewModel, null, "Recipe Pressure Setting"))
  917. //{
  918. // if (CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault() != null)
  919. // {
  920. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().PressureSonserValue = recipePressureSettingViewModel.PressureSonsorValue;
  921. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().PressureValveAngle = recipePressureSettingViewModel.PressureValveAngleValue;
  922. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().PressureAlarmTableNo = recipePressureSettingViewModel.PressureAlarmWatchTable;
  923. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().PressureSettingVG = recipePressureSettingViewModel.PressureSettingVG;
  924. // SelectedRecipeStep.PressureSonserValue = $"{recipePressureSettingViewModel.PressureSonsorValue}";
  925. // }
  926. //}
  927. break;
  928. case "RFSetting":
  929. //RecipeRFPressureSettingViewModel recipeRFPressureSettingViewModel = new RecipeRFPressureSettingViewModel();
  930. //var tempRecipeStep = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault();
  931. //recipeRFPressureSettingViewModel.RFSwitch = tempRecipeStep.RFSwitch;
  932. //recipeRFPressureSettingViewModel.RFSetPointValue = tempRecipeStep.RFSetpoint;
  933. //recipeRFPressureSettingViewModel.C1SetPointValue = tempRecipeStep.C1Setpoint;
  934. //recipeRFPressureSettingViewModel.C2SetPointValue = tempRecipeStep.C2Setpoint;
  935. //recipeRFPressureSettingViewModel.ForwardPowerAlarmWatchSetPointValue = tempRecipeStep.ForwardPowerAlarmWatchTable;
  936. //recipeRFPressureSettingViewModel.PrAlarmWatchSetPointValue = tempRecipeStep.PrAlarmWatchTable;
  937. //recipeRFPressureSettingViewModel.PIAlarmWatchSetPointValue = tempRecipeStep.PIAlarmWatchTable;
  938. //recipeRFPressureSettingViewModel.C1AlarmWatchSetPointValue = tempRecipeStep.C1AlarmWatchTable;
  939. //recipeRFPressureSettingViewModel.C2AlarmWatchSetPointValue = tempRecipeStep.C2AlarmWatchTable;
  940. //recipeRFPressureSettingViewModel.VppAlarmWatchSetPointValue = tempRecipeStep.VppAlarmWatchTable;
  941. //recipeRFPressureSettingViewModel.VdcAlarmWatchSetPointValue = tempRecipeStep.VdcAlarmWatchTable;
  942. //if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeRFPressureSettingViewModel, null, "Recipe RF Setting"))
  943. //{
  944. // if (CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault() != null)
  945. // {
  946. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().RFSwitch = recipeRFPressureSettingViewModel.RFSwitch;
  947. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().RFSetpoint = recipeRFPressureSettingViewModel.RFSetPointValue;
  948. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().C1Setpoint = recipeRFPressureSettingViewModel.C1SetPointValue;
  949. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().C2Setpoint = recipeRFPressureSettingViewModel.C2SetPointValue;
  950. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().ForwardPowerAlarmWatchTable = recipeRFPressureSettingViewModel.ForwardPowerAlarmWatchSetPointValue;
  951. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().PrAlarmWatchTable = recipeRFPressureSettingViewModel.PrAlarmWatchSetPointValue;
  952. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().PIAlarmWatchTable = recipeRFPressureSettingViewModel.PIAlarmWatchSetPointValue;
  953. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().C1AlarmWatchTable = recipeRFPressureSettingViewModel.C1AlarmWatchSetPointValue;
  954. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().C2AlarmWatchTable = recipeRFPressureSettingViewModel.C2AlarmWatchSetPointValue;
  955. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().VppAlarmWatchTable = recipeRFPressureSettingViewModel.VppAlarmWatchSetPointValue;
  956. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().VdcAlarmWatchTable = recipeRFPressureSettingViewModel.VdcAlarmWatchSetPointValue;
  957. // // SelectedRecipeStep.RFSetting = $"{recipeRFPressureSettingViewModel.RFSetPointValue}";
  958. // }
  959. //}
  960. break;
  961. case "Loader":
  962. RecipeLoaderCommandViewModel recipeLoaderCommandViewModel = new RecipeLoaderCommandViewModel();
  963. //tempStep = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault();
  964. //recipeLoaderCommandViewModel.SelectedCmd = tempStep.LoaderCommand;
  965. //if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeLoaderCommandViewModel, null, "Loader Command"))
  966. //{
  967. // if (tempStep.LoaderCommand != recipeLoaderCommandViewModel.ReturnString)
  968. // {
  969. // ClearLoaderSetValue();
  970. // }
  971. // tempStep.LoaderCommand = recipeLoaderCommandViewModel.ReturnString;
  972. // SelectedRecipeStep.LoaderCommand = recipeLoaderCommandViewModel.ReturnString;
  973. // SetShowLoaderValuePanel(recipeLoaderCommandViewModel.ReturnString);
  974. //}
  975. break;
  976. case "Pressure":
  977. RecipePressCommandViewModel recipePressCommandViewModel = new RecipePressCommandViewModel();
  978. //tempStep = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault();
  979. //recipePressCommandViewModel.SelectedCmd = tempStep.PressCommand;
  980. //if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipePressCommandViewModel, null, "Press Command"))
  981. //{
  982. // tempStep.PressCommand = recipePressCommandViewModel.ReturnString;
  983. // SelectedRecipeStep.PressCommand = recipePressCommandViewModel.ReturnString;
  984. // SetShowPressPanel(recipePressCommandViewModel.ReturnString);
  985. //}
  986. break;
  987. case "Pattern":
  988. RecipeGasPanelSettingViewModel recipeGasPanelSettingViewModel = new RecipeGasPanelSettingViewModel();
  989. //recipeGasPanelSettingViewModel.CurrentRecipe = CurrentRecipe;
  990. //recipeGasPanelSettingViewModel.SelectedStepName = $"{SelectedRecipeStep.StepNo}:{SelectedRecipeStep.Name}";
  991. //recipeGasPanelSettingViewModel.ChangedStepEvent += RecipeGasPanelSettingViewModel_ChangedStepEvent;
  992. //recipeGasPanelSettingViewModel.SelectedStep = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault();
  993. //if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeGasPanelSettingViewModel, null, "Valve"))
  994. //{
  995. //}
  996. break;
  997. case "BoatElevatorSetting":
  998. BoatElevatorSettingViewModel boatElevatorSettingViewModel = new BoatElevatorSettingViewModel();
  999. //boatElevatorSettingViewModel.SelectedRecipeStep = SelectedRecipeStep;
  1000. //if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(boatElevatorSettingViewModel, null, "BoatElevator Setting"))
  1001. //{
  1002. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().ZAxisPosition = boatElevatorSettingViewModel.SelectedRecipeStep.ZAxisPosition;
  1003. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().ZAxisSpeed = boatElevatorSettingViewModel.SelectedRecipeStep.ZAxisSpeed;
  1004. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().RotatePosition = boatElevatorSettingViewModel.SelectedRecipeStep.RotatePosition;
  1005. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().RotateSpeed = boatElevatorSettingViewModel.SelectedRecipeStep.RotateSpeed;
  1006. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().RotateInterval = boatElevatorSettingViewModel.SelectedRecipeStep.RotateInterval;
  1007. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().RotateDirection = boatElevatorSettingViewModel.SelectedRecipeStep.RotateDirection;
  1008. //}
  1009. break;
  1010. case "AUX":
  1011. RecipeAUXSetViewModel recipeAUXSetViewModel = new RecipeAUXSetViewModel();
  1012. if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeAUXSetViewModel, null, "AUX Set"))
  1013. {
  1014. }
  1015. break;
  1016. case "RecipeHeader":
  1017. RecipeHeaderViewModel recipeHeaderViewModel = new RecipeHeaderViewModel();
  1018. if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeHeaderViewModel, null, "Recipe Header"))
  1019. {
  1020. }
  1021. break;
  1022. case "Combination":
  1023. //StringParam strCombination = CurrentRecipe.ConfigItems.FirstOrDefault(x => x.Name == "Combination") as StringParam;
  1024. //RecipeCombinationViewModel recipeCombinationViewModel = new RecipeCombinationViewModel();
  1025. //recipeCombinationViewModel.CombinationStr = strCombination.Value;
  1026. //if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeCombinationViewModel, null, "Combination"))
  1027. //{
  1028. // strCombination.Value = recipeCombinationViewModel.Combination.ToString();
  1029. //}
  1030. break;
  1031. case "VPDataList":
  1032. RecipeVPItemSelectViewModel recipeVPItemSelectViewModel = new RecipeVPItemSelectViewModel();
  1033. if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeVPItemSelectViewModel, null, "VP Item Select"))
  1034. {
  1035. }
  1036. break;
  1037. case "AbortRecipe":
  1038. //Step currentStep = CurrentRecipe.Steps.FirstOrDefault(x => x.StepNo == SelectedRecipeStep.StepNo);
  1039. //StringParam abortCombination = CurrentRecipe.ConfigItems.FirstOrDefault(x => x.Name == "Combination") as StringParam;
  1040. //Combination combination = new Combination(abortCombination.Value);
  1041. //if (string.IsNullOrEmpty(combination.AbortRecipePath))
  1042. //{
  1043. // DialogBox.ShowError("Please select abort recipe first!");
  1044. //}
  1045. //var retRecipe = RecipeTableSelect.ShowDialog($"Furnace\\abort", combination.AbortRecipePath, false);
  1046. //if (!string.IsNullOrEmpty(retRecipe))
  1047. //{
  1048. // currentStep.AbortRecipeTableIndex = retRecipe;
  1049. // SelectedRecipeStep.AbortRecipeTableIndex = retRecipe;
  1050. //}
  1051. break;
  1052. case "SkipOrWait":
  1053. RecipeSkipWaitCommandViewModel recipeSkipWaitCommandViewModel = new RecipeSkipWaitCommandViewModel();
  1054. //recipeSkipWaitCommandViewModel.SkipWait = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().SkipWait;
  1055. //if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeSkipWaitCommandViewModel, null, "Skip or wait command"))
  1056. //{
  1057. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().SkipWait = recipeSkipWaitCommandViewModel.RtnString;
  1058. // SelectedRecipeStep.SkipWait = recipeSkipWaitCommandViewModel.RtnString;
  1059. //}
  1060. break;
  1061. default:
  1062. break;
  1063. }
  1064. }
  1065. public void RecipeSave()
  1066. {
  1067. //if (!string.IsNullOrEmpty(type) && item != null && sender != null)
  1068. //{
  1069. // MFCData mFCData = (MFCData)item;
  1070. // string value = ((TextBox)sender).Text;
  1071. // switch (type)
  1072. // {
  1073. // case "Value":
  1074. // InvokeClient.Instance.Service.DoOperation($"CHM.{mFCData.DisplayName}.SetMfcVirtualValue", $"{value};{mFCData.Rampng};{mFCData.AlarmValue}");
  1075. // break;
  1076. // case "Rampng":
  1077. // InvokeClient.Instance.Service.DoOperation($"CHM.{mFCData.DisplayName}.SetMfcVirtualValue", $"{mFCData.Value};{value};{mFCData.AlarmValue}");
  1078. // SetRampngValue(mFCData.DisplayName, value);
  1079. // break;
  1080. // default:
  1081. // break;
  1082. // }
  1083. //}
  1084. //var result = this._recipeProvider.SaveRecipe(CurrentRecipe.PrefixPath, CurrentRecipe.Name, CurrentRecipe.GetXmlString());
  1085. //if (result)
  1086. ((Window)GetView()).Close();
  1087. }
  1088. public List<ConfigNode> GetMfcItem()
  1089. {
  1090. this.SystemName = "System";
  1091. ConfigNodes = SystemConfigProvider.Instance.GetConfigTree(SystemName).SubNodes;
  1092. var MfcItems = ConfigNodes.Where(x => x.Display == "Parameter").FirstOrDefault().SubNodes.Where(y => y.Name == "MFC").FirstOrDefault().SubNodes;
  1093. return MfcItems;
  1094. }
  1095. public void RecipeCancel()
  1096. {
  1097. if (DialogBox.ShowDialog(DialogButton.Yes | DialogButton.No, DialogType.CONFIRM, " You confirm that you want to unsave the recipe and exit the interface?") == DialogButton.No)
  1098. return;
  1099. ((Window)GetView()).Close();
  1100. }
  1101. public void PressPIDChick()
  1102. {
  1103. var windowManager = IoC.Get<IWindowManager>();
  1104. TempOffsetTableViewModel tempOffsetTableViewModel1 = new TempOffsetTableViewModel();
  1105. // tempOffsetTableViewModel1.TempOffsetTableSelected = SelectedRecipeStep.TemperaturePID;
  1106. var rtn = (windowManager as WindowManager)?.ShowDialogWithTitle(tempOffsetTableViewModel1, null, "Temp Correct Table");
  1107. if ((bool)rtn)
  1108. {
  1109. PressPID = tempOffsetTableViewModel1.TempOffsetTableSelected;
  1110. }
  1111. }
  1112. protected override void InvokeAfterUpdateProperty(Dictionary<string, object> data)
  1113. {
  1114. base.InvokeAfterUpdateProperty(data);
  1115. UpdateGASSetting();
  1116. UpdateHeaterSetting();
  1117. oldresult = data;
  1118. }
  1119. Dictionary<string, object> oldresult;
  1120. private void UpdateGASSetting()
  1121. {
  1122. List<AITMfcData> mfcDatas = new List<AITMfcData>()
  1123. {
  1124. MFC1Data,
  1125. MFC2Data,
  1126. MFC3Data,
  1127. MFC4Data,
  1128. MFC5Data,
  1129. MFC6Data,
  1130. MFC7Data,
  1131. MFC8Data,
  1132. MFC9Data,
  1133. MFC10Data,
  1134. MFC11Data,
  1135. MFC12Data,
  1136. MFC51Data,
  1137. };
  1138. if (MFCDataList.Count == 0)
  1139. {
  1140. for (int i = 0; i < mfcDatas.Count; i++)
  1141. {
  1142. if (mfcDatas[i] == null)
  1143. continue;
  1144. MFCDataList.Add(new MFCGasData()
  1145. {
  1146. Name = mfcDatas[i].DeviceName,
  1147. DisplayName = mfcDatas[i].DisplayName,
  1148. ActualValue = mfcDatas[i].FeedBack,
  1149. Value = mfcDatas[i].VirtualFeedBack,
  1150. ActualRampng = mfcDatas[i].Ramping,
  1151. Rampng = mfcDatas[i].VirtualRamping,
  1152. Unit = mfcDatas[i].Unit,
  1153. }); ;
  1154. }
  1155. }
  1156. else
  1157. {
  1158. for (int i = 0; i < MFCDataList.Count; i++)
  1159. {
  1160. var findMFC = mfcDatas.FirstOrDefault(x => x.DeviceName == MFCDataList[i].Name);
  1161. if (findMFC != null)
  1162. {
  1163. MFCDataList[i].ActualValue = findMFC.FeedBack;
  1164. MFCDataList[i].ActualRampng = findMFC.Ramping;
  1165. }
  1166. };
  1167. }
  1168. }
  1169. private void UpdateHeaterSetting()
  1170. {
  1171. if (Heater2Data != null && Heater4Data != null && Heater6Data != null && Heater8Data != null && Heater10Data != null)
  1172. {
  1173. List<AITHeaterData> heaterDatas = new List<AITHeaterData>()
  1174. {
  1175. BottomHeaterData,
  1176. CenterBottomHeaterData,
  1177. CenterHeaterData,
  1178. TopCenterHeaterData,
  1179. TopHeaterData
  1180. };
  1181. if (TempList.Count == 0)
  1182. {
  1183. for (int i = 0; i < heaterDatas.Count; i++)
  1184. {
  1185. TempList.Add(new TempManualSetData()
  1186. {
  1187. Name = heaterDatas[i].DeviceName,
  1188. DisplayName = heaterDatas[i].DisplayName,
  1189. ActualValue = heaterDatas[i].FeedBack,
  1190. Value = heaterDatas[i].SetPoint,
  1191. ActualRampng = heaterDatas[i].Ramping,
  1192. Rampng = heaterDatas[i].RampSetPoint,
  1193. Unit = heaterDatas[i].Unit,
  1194. });
  1195. }
  1196. }
  1197. else
  1198. {
  1199. for (int i = 0; i < TempList.Count; i++)
  1200. {
  1201. var findHeater = heaterDatas.FirstOrDefault(x => x.DeviceName == TempList[i].Name);
  1202. if (findHeater != null)
  1203. {
  1204. TempList[i].ActualValue = findHeater.FeedBack;
  1205. TempList[i].ActualRampng = findHeater.Ramping;
  1206. }
  1207. };
  1208. }
  1209. }
  1210. }
  1211. }
  1212. public class MFCGasData : PropertyChangedBase
  1213. {
  1214. private int _no;
  1215. public int No
  1216. {
  1217. get => _no;
  1218. set
  1219. {
  1220. _no = value;
  1221. NotifyOfPropertyChange(nameof(No));
  1222. }
  1223. }
  1224. private string _name;
  1225. public string Name
  1226. {
  1227. get => _name;
  1228. set
  1229. {
  1230. _name = value;
  1231. NotifyOfPropertyChange(nameof(Name));
  1232. }
  1233. }
  1234. public string _unit;
  1235. public string Unit
  1236. {
  1237. get => _unit;
  1238. set
  1239. {
  1240. _unit = value;
  1241. NotifyOfPropertyChange(nameof(Unit));
  1242. }
  1243. }
  1244. private string _displayName;
  1245. public string DisplayName
  1246. {
  1247. get => _displayName;
  1248. set
  1249. {
  1250. _displayName = value;
  1251. NotifyOfPropertyChange(nameof(DisplayName));
  1252. }
  1253. }
  1254. private string _controlName;
  1255. public string ControlName
  1256. {
  1257. get => _controlName;
  1258. set
  1259. {
  1260. _controlName = value;
  1261. NotifyOfPropertyChange(nameof(ControlName));
  1262. }
  1263. }
  1264. private double _actualValue;
  1265. public double ActualValue
  1266. {
  1267. get => _actualValue;
  1268. set
  1269. {
  1270. _actualValue = value;
  1271. NotifyOfPropertyChange(nameof(ActualValue));
  1272. }
  1273. }
  1274. private double _value;
  1275. public double Value
  1276. {
  1277. get => _value;
  1278. set
  1279. {
  1280. _value = value;
  1281. NotifyOfPropertyChange(nameof(Value));
  1282. }
  1283. }
  1284. private double _actualRampng;
  1285. public double ActualRampng
  1286. {
  1287. get => _actualRampng; set
  1288. {
  1289. _actualRampng = value;
  1290. NotifyOfPropertyChange(nameof(ActualRampng));
  1291. }
  1292. }
  1293. private double _rampng;
  1294. public double Rampng
  1295. {
  1296. get => _rampng; set
  1297. {
  1298. _rampng = value;
  1299. NotifyOfPropertyChange(nameof(Rampng));
  1300. }
  1301. }
  1302. private string _maxValue;
  1303. public string MaxValue
  1304. {
  1305. get => _maxValue; set
  1306. {
  1307. _maxValue = value;
  1308. NotifyOfPropertyChange(nameof(MaxValue));
  1309. }
  1310. }
  1311. private string _minValue;
  1312. public string MinValue
  1313. {
  1314. get => _minValue; set
  1315. {
  1316. _minValue = value;
  1317. NotifyOfPropertyChange(nameof(MinValue));
  1318. }
  1319. }
  1320. private bool _isChanged = true;
  1321. public bool IsChanged
  1322. {
  1323. get => _isChanged;
  1324. set
  1325. {
  1326. _isChanged = value;
  1327. NotifyOfPropertyChange(nameof(IsChanged));
  1328. }
  1329. }
  1330. }
  1331. public class TempManualSetData : PropertyChangedBase
  1332. {
  1333. private int _no;
  1334. public int No
  1335. {
  1336. get => _no;
  1337. set
  1338. {
  1339. _no = value;
  1340. NotifyOfPropertyChange("No");
  1341. }
  1342. }
  1343. private string _name;
  1344. public string Name
  1345. {
  1346. get => _name;
  1347. set
  1348. {
  1349. _name = value;
  1350. NotifyOfPropertyChange("Name");
  1351. }
  1352. }
  1353. private string _displayName;
  1354. public string DisplayName
  1355. {
  1356. get => _displayName;
  1357. set
  1358. {
  1359. _displayName = value;
  1360. NotifyOfPropertyChange(nameof(DisplayName));
  1361. }
  1362. }
  1363. private string _controlName;
  1364. public string ControlName
  1365. {
  1366. get => _controlName;
  1367. set
  1368. {
  1369. _controlName = value;
  1370. NotifyOfPropertyChange(nameof(ControlName));
  1371. }
  1372. }
  1373. private double _actualValue;
  1374. public double ActualValue
  1375. {
  1376. get => _actualValue;
  1377. set
  1378. {
  1379. _actualValue = value;
  1380. NotifyOfPropertyChange(nameof(ActualValue));
  1381. }
  1382. }
  1383. private double _value;
  1384. public double Value
  1385. {
  1386. get => _value;
  1387. set
  1388. {
  1389. _value = value;
  1390. NotifyOfPropertyChange(nameof(Value));
  1391. }
  1392. }
  1393. private double _actualRampng;
  1394. public double ActualRampng
  1395. {
  1396. get => _actualRampng; set
  1397. {
  1398. _actualRampng = value;
  1399. NotifyOfPropertyChange(nameof(ActualRampng));
  1400. }
  1401. }
  1402. private double _rampng;
  1403. public double Rampng
  1404. {
  1405. get => _rampng; set
  1406. {
  1407. _rampng = value;
  1408. NotifyOfPropertyChange(nameof(Rampng));
  1409. }
  1410. }
  1411. private string _maxValue;
  1412. public string MaxValue
  1413. {
  1414. get => _maxValue; set
  1415. {
  1416. _maxValue = value;
  1417. NotifyOfPropertyChange(nameof(MaxValue));
  1418. }
  1419. }
  1420. private string _minValue;
  1421. public string MinValue
  1422. {
  1423. get => _minValue; set
  1424. {
  1425. _minValue = value;
  1426. NotifyOfPropertyChange(nameof(MinValue));
  1427. }
  1428. }
  1429. private bool _isChanged = true;
  1430. public bool IsChanged
  1431. {
  1432. get => _isChanged;
  1433. set
  1434. {
  1435. _isChanged = value;
  1436. NotifyOfPropertyChange(nameof(IsChanged));
  1437. }
  1438. }
  1439. private string _unit;
  1440. public string Unit
  1441. {
  1442. get => _unit;
  1443. set
  1444. {
  1445. _unit = value;
  1446. NotifyOfPropertyChange("Unit");
  1447. }
  1448. }
  1449. }
  1450. }