RecipeProcessReadOnlyViewModel.cs 108 KB

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