RecipeProcessEditViewModel.cs 136 KB

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