RecipeProcessEditViewModel.cs 138 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072
  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. if (NewSteps == null || NewSteps.Count == 0 || NewSteps.Contains(SelectedRecipeStep)) return;
  785. var steps = CurrentRecipe.Steps.ToList();
  786. int currentIndex = steps.IndexOf(SelectedRecipeStep);
  787. if (currentIndex < 0) return;
  788. int index = steps.IndexOf(NewSteps.First());
  789. if (currentIndex < index)//向上翻
  790. {
  791. if (currentPage <= 1)
  792. {
  793. return;
  794. }
  795. currentPage = currentPage - 1;
  796. NewSteps = new ObservableCollection<Step>(CurrentRecipe.Steps.Take(pageSize * currentPage).Skip(pageSize * (currentPage - 1)));
  797. IndexNoDefault = pageSize - 1;
  798. if (IndexNoDefault >= NewSteps.Count)
  799. {
  800. IndexNoDefault = NewSteps.Count - 1;
  801. }
  802. }
  803. else//向下翻
  804. {
  805. if (currentPage >= GetTotalPage())
  806. {
  807. return;
  808. }
  809. currentPage = currentPage + 1;
  810. NewSteps = new ObservableCollection<Step>(CurrentRecipe.Steps.Take(pageSize * currentPage).Skip(pageSize * (currentPage - 1)));
  811. IndexNoDefault = 0;
  812. }
  813. }
  814. private bool _noStandbyOrEndIsEnabled = false;
  815. public bool NoStandbyOrEndIsEnabled
  816. {
  817. get => _noStandbyOrEndIsEnabled;
  818. set
  819. {
  820. _noStandbyOrEndIsEnabled = value;
  821. NotifyOfPropertyChange(nameof(NoStandbyOrEndIsEnabled));
  822. }
  823. }
  824. private Visibility _standbyIsVisibility = Visibility.Visible;
  825. public Visibility StandbyIsVisibility
  826. {
  827. get => _standbyIsVisibility;
  828. set
  829. {
  830. _standbyIsVisibility = value;
  831. NotifyOfPropertyChange(nameof(StandbyIsVisibility));
  832. }
  833. }
  834. private void SetChangedStepRefreshUpdate()
  835. {
  836. if (CurrentRecipe.Steps == null || CurrentRecipe.Steps.Count < 1)
  837. {
  838. return;
  839. }
  840. var endName = "";
  841. if (SelectedRecipeStep.Name.Contains(":") && SelectedRecipeStep.Name.Split(':').Length > 1)
  842. {
  843. endName = SelectedRecipeStep.Name.Split(':')[1].Trim().ToLower();
  844. }
  845. else
  846. {
  847. endName = SelectedRecipeStep.Name.Trim().ToLower();
  848. }
  849. if (SelectedRecipeStep.Name == "Standby" || endName == "end")
  850. {
  851. NoStandbyOrEndIsEnabled = false;
  852. StandbyIsVisibility = Visibility.Visible;
  853. // LoaderSetSpeedFloatVisibility= Visibility.Hidden;
  854. // LoaderSet3SpeedVisibility= Visibility.Visible;
  855. // LoaderSetSpeedVisibility = Visibility.Hidden;
  856. }
  857. else
  858. {
  859. NoStandbyOrEndIsEnabled = true && SettingButtonEnable;
  860. StandbyIsVisibility = Visibility.Visible;
  861. }
  862. }
  863. private void SetCmdIsEnabled()
  864. {
  865. AppendStepItemIsEnabled = true;
  866. if (CurrentRecipe.Steps == null || CurrentRecipe.Steps.Count == 0 || SelectedRecipeStep.Name == "Standby" || (CurrentRecipe.RecipeChamberType == RecipeDataBase.ProcessType && SelectedRecipeStep == CurrentRecipe.Steps.LastOrDefault()))
  867. {
  868. AppendStepItemIsEnabled = false;
  869. OverWriteCopyIsEnabled = false;
  870. InsertCopyIsEnabled = false;
  871. PrevStepOverwriteIsEnabled = false;
  872. PrevStepInsertIsEnabled = false;
  873. PrevStepItemIsEnabled = false;
  874. CurrStepDeleteIsEnabled = false;
  875. MultStepsDeleteIsEnabled = false;
  876. }
  877. else
  878. {
  879. if (CurrentRecipe.RecipeChamberType == RecipeDataBase.ProcessType)
  880. {
  881. AppendStepItemIsEnabled = true;
  882. InsertCopyIsEnabled = true;
  883. PrevStepItemIsEnabled = false;
  884. SetCurrAndMultStepDeleteIsEnabled();
  885. if (CurrentRecipe.Steps[1].StepNo == SelectedRecipeStep.StepNo)
  886. {
  887. OverWriteCopyIsEnabled = true;
  888. PrevStepOverwriteIsEnabled = false;
  889. PrevStepInsertIsEnabled = false;
  890. }
  891. else
  892. {
  893. OverWriteCopyIsEnabled = true;
  894. PrevStepOverwriteIsEnabled = true;
  895. PrevStepInsertIsEnabled = true;
  896. }
  897. }
  898. else
  899. {
  900. AppendStepItemIsEnabled = true;
  901. OverWriteCopyIsEnabled = true;
  902. InsertCopyIsEnabled = true;
  903. PrevStepItemIsEnabled = false;
  904. SetCurrAndMultStepDeleteIsEnabled();
  905. if (CurrentRecipe.Steps[0].StepNo == SelectedRecipeStep.StepNo)
  906. {
  907. PrevStepOverwriteIsEnabled = false;
  908. PrevStepInsertIsEnabled = false;
  909. }
  910. else
  911. {
  912. PrevStepOverwriteIsEnabled = true;
  913. PrevStepInsertIsEnabled = true;
  914. }
  915. }
  916. //OverWriteCopyIsEnabled = true;
  917. //InsertCopyIsEnabled = true;
  918. //PrevStepOverwriteIsEnabled = true;
  919. //PrevStepInsertIsEnabled = true;
  920. //PrevStepItemIsEnabled = true;
  921. //CurrStepDeleteIsEnabled = true;
  922. //MultStepsDeleteIsEnabled = true;
  923. //if (CurrentRecipe.RecipeChamberType == RecipeDataBase.ProcessType)
  924. // if (CurrentRecipe.Steps[1].StepNo == SelectedRecipeStep.StepNo)
  925. // {
  926. // AppendStepItemIsEnabled = true;
  927. // OverWriteCopyIsEnabled = false;
  928. // InsertCopyIsEnabled = true;
  929. // PrevStepOverwriteIsEnabled = false;
  930. // PrevStepInsertIsEnabled = false;
  931. // PrevStepItemIsEnabled = false;
  932. // CurrStepDeleteIsEnabled = true;
  933. // MultStepsDeleteIsEnabled = true;
  934. // }
  935. // else
  936. // {
  937. // OverWriteCopyIsEnabled = true;
  938. // InsertCopyIsEnabled = true;
  939. // PrevStepOverwriteIsEnabled = true;
  940. // PrevStepInsertIsEnabled = true;
  941. // PrevStepItemIsEnabled = false;
  942. // CurrStepDeleteIsEnabled = true;
  943. // MultStepsDeleteIsEnabled = true;
  944. // }
  945. //else
  946. //{
  947. // if (CurrentRecipe.Steps[0].StepNo == SelectedRecipeStep.StepNo)
  948. // {
  949. // AppendStepItemIsEnabled = true;
  950. // OverWriteCopyIsEnabled = true;
  951. // InsertCopyIsEnabled = true;
  952. // PrevStepOverwriteIsEnabled = false;
  953. // PrevStepInsertIsEnabled = false;
  954. // PrevStepItemIsEnabled = false;
  955. // CurrStepDeleteIsEnabled = true;
  956. // MultStepsDeleteIsEnabled = true;
  957. // }
  958. // else
  959. // {
  960. // OverWriteCopyIsEnabled = true;
  961. // InsertCopyIsEnabled = true;
  962. // PrevStepOverwriteIsEnabled = true;
  963. // PrevStepInsertIsEnabled = true;
  964. // PrevStepItemIsEnabled = false;
  965. // CurrStepDeleteIsEnabled = true;
  966. // MultStepsDeleteIsEnabled = true;
  967. // }
  968. //}
  969. }
  970. IsCommandConditionEventEnabled = SettingButtonEnable;
  971. IsStandbyEnabled = SettingButtonEnable && (RecipeType.ToLower() == "process");
  972. }
  973. private void SetCurrAndMultStepDeleteIsEnabled()
  974. {
  975. if (CurrentRecipe.RecipeChamberType == "Process")
  976. {
  977. if ((CurrentRecipe.Steps.Count < 4))
  978. {
  979. CurrStepDeleteIsEnabled = false;
  980. MultStepsDeleteIsEnabled = false;
  981. }
  982. else
  983. {
  984. MultStepsDeleteIsEnabled = true;
  985. if (SelectedRecipeStep.Name == "Standby" || SelectedRecipeStep.Name == "End")
  986. {
  987. CurrStepDeleteIsEnabled = false;
  988. }
  989. else
  990. {
  991. CurrStepDeleteIsEnabled = true;
  992. }
  993. }
  994. }
  995. else
  996. {
  997. if ((CurrentRecipe.Steps.Count < 2))
  998. {
  999. CurrStepDeleteIsEnabled = false;
  1000. MultStepsDeleteIsEnabled = false;
  1001. }
  1002. else
  1003. {
  1004. CurrStepDeleteIsEnabled = true;
  1005. MultStepsDeleteIsEnabled = true;
  1006. }
  1007. }
  1008. }
  1009. private string _selectedGasSetting2;
  1010. public string SelectedGasSetting2
  1011. {
  1012. get
  1013. {
  1014. return _selectedGasSetting2;
  1015. }
  1016. set
  1017. {
  1018. _selectedGasSetting2 = value;
  1019. NotifyOfPropertyChange(nameof(SelectedGasSetting2));
  1020. }
  1021. }
  1022. private string _selectedGasSetting3;
  1023. public string SelectedGasSetting3
  1024. {
  1025. get
  1026. {
  1027. return _selectedGasSetting3;
  1028. }
  1029. set
  1030. {
  1031. _selectedGasSetting3 = value;
  1032. NotifyOfPropertyChange(nameof(SelectedGasSetting3));
  1033. }
  1034. }
  1035. private string _selectedGasSetting4;
  1036. public string SelectedGasSetting4
  1037. {
  1038. get
  1039. {
  1040. return _selectedGasSetting4;
  1041. }
  1042. set
  1043. {
  1044. _selectedGasSetting4 = value;
  1045. NotifyOfPropertyChange(nameof(SelectedGasSetting4));
  1046. }
  1047. }
  1048. private string _selectedGasSetting5;
  1049. public string SelectedGasSetting5
  1050. {
  1051. get
  1052. {
  1053. return _selectedGasSetting5;
  1054. }
  1055. set
  1056. {
  1057. _selectedGasSetting5 = value;
  1058. NotifyOfPropertyChange(nameof(SelectedGasSetting5));
  1059. }
  1060. }
  1061. private string _selectedGasSetting6;
  1062. public string SelectedGasSetting6
  1063. {
  1064. get
  1065. {
  1066. return _selectedGasSetting6;
  1067. }
  1068. set
  1069. {
  1070. _selectedGasSetting6 = value;
  1071. NotifyOfPropertyChange(nameof(SelectedGasSetting6));
  1072. }
  1073. }
  1074. private List<ConfigNode> _ConfigNodes = new List<ConfigNode>();
  1075. public List<ConfigNode> ConfigNodes
  1076. {
  1077. get { return _ConfigNodes; }
  1078. set
  1079. {
  1080. _ConfigNodes = value;
  1081. NotifyOfPropertyChange(nameof(ConfigNodes));
  1082. }
  1083. }
  1084. //private ObservableCollection<MFCData> _mFCDatas = new ObservableCollection<MFCData>();
  1085. //public ObservableCollection<TempSetData> TempList { get; set; } = new ObservableCollection<TempSetData>();
  1086. //public ObservableCollection<MFCData> MFCDataList
  1087. //{
  1088. // get => _mFCDatas;
  1089. // set
  1090. // {
  1091. // _mFCDatas = value;
  1092. // NotifyOfPropertyChange(nameof(MFCDataList));
  1093. // }
  1094. //}
  1095. private string _pressureUnit;
  1096. public string PressureUnit
  1097. {
  1098. get => _pressureUnit;
  1099. set
  1100. {
  1101. _pressureUnit = value;
  1102. NotifyOfPropertyChange(nameof(PressureUnit));
  1103. }
  1104. }
  1105. public string RecipeType { get; set; }
  1106. private RecipeProcessEditView view1;
  1107. private int _tableIndex;
  1108. public RecipeProcessEditViewModel(string strPrefixPath, string strRecipeName, string permission = "", int tableIndex = 1)
  1109. {
  1110. PumpDict.Clear();
  1111. PumpDict.Add("DPR", "ValveAV91");
  1112. PumpDict.Add("AGV", "AGVPump");
  1113. PumpDict.Add("MBP", "BothPump");
  1114. PumpDict.Add("DP", "AUCPump");
  1115. PumpDict.Add("BWR", "ValveBWR");
  1116. OtherPumpDict.Clear();
  1117. OtherPumpDict.Add("F2Cln", "F2Cln");
  1118. OtherPumpDict.Add("HFCln", "HFCln");
  1119. OtherPumpDict.Add("HTR1", "HTR1");
  1120. OtherPumpDict.Add("HTR2", "HTR2");
  1121. OtherPumpDict.Add("HTR3", "HTR3");
  1122. DefaultUnit = (string)QueryDataClient.Instance.Service.GetConfig($"PM1.APC.PressureUnit");
  1123. RecipeTemplate = _recipeProvider.GetGroupRecipeTemplate();
  1124. CurrentRecipe.PrefixPath = strPrefixPath;
  1125. CurrentRecipe.Name = strRecipeName;
  1126. CurrentRecipe.RecipePermission = permission;
  1127. _tableIndex = tableIndex;
  1128. }
  1129. protected override void OnViewLoaded(object view)
  1130. {
  1131. base.OnViewLoaded(view);
  1132. view1 = (RecipeProcessEditView)view;
  1133. }
  1134. protected override void OnActivate()
  1135. {
  1136. base.OnActivate();
  1137. InvokeClient.Instance.Service.DoOperation($"PM1.SetSensorRecipeOK", "");
  1138. }
  1139. protected override void OnDeactivate(bool close)
  1140. {
  1141. base.OnDeactivate(close);
  1142. InvokeClient.Instance.Service.DoOperation($"PM1.SetSensorPROCManualOK", "");
  1143. }
  1144. protected override void OnInitialize()
  1145. {
  1146. base.OnInitialize();
  1147. ToolType = (string)QueryDataClient.Instance.Service.GetConfig("System.SetUp.ToolType");
  1148. // GetHeaderConfig();
  1149. LoadData();
  1150. RefreshUpdate();
  1151. currentPage = GetcurrentPage();
  1152. NewSteps = new ObservableCollection<Step>(CurrentRecipe.Steps.Take(pageSize * currentPage).Skip(pageSize * (currentPage - 1)));
  1153. }
  1154. private void LoadData()
  1155. {
  1156. if (RecipeType.ToLower() == "process" || RecipeType.ToLower() == "sub")
  1157. {
  1158. IsProcessVisibility = Visibility.Visible;
  1159. }
  1160. else
  1161. {
  1162. IsProcessVisibility = Visibility.Hidden;
  1163. }
  1164. CurrentRecipe.Clear();
  1165. var recipeContent = _recipeProvider.LoadRecipe(CurrentRecipe.PrefixPath, CurrentRecipe.Name);
  1166. if (string.IsNullOrEmpty(recipeContent))
  1167. {
  1168. System.Windows.MessageBox.Show($"{CurrentRecipe.PrefixPath}\\{CurrentRecipe.Name} is empty, please confirm the file is valid.");
  1169. return;
  1170. }
  1171. // CurrentRecipe.RecipeChamberType = "OriginChamber";
  1172. CurrentRecipe.InitData(CurrentRecipe.PrefixPath, CurrentRecipe.Name, recipeContent, "PM1",_tableIndex);
  1173. if (CurrentRecipe.Steps.Count > 0)
  1174. {
  1175. if (!string.IsNullOrEmpty(SelectedStepName))
  1176. {
  1177. //根据名称找到对应的Index
  1178. var steps = CurrentRecipe.Steps.Where(p => SelectedStepName.EndsWith(p.Name)).FirstOrDefault();
  1179. if (steps != null)
  1180. {
  1181. IndexNoDefault = CurrentRecipe.Steps.IndexOf(steps);
  1182. }
  1183. }
  1184. if (CurrentRecipe.Steps.Count > IndexNoDefault)
  1185. {
  1186. SelectStep(CurrentRecipe.Steps[IndexNoDefault]);
  1187. }
  1188. }
  1189. IsCommandConditionEventEnabled = true;
  1190. PressureUnit = "(" + (string)QueryDataClient.Instance.Service.GetConfig("PM1.APC.PressureUnit") + ")";
  1191. }
  1192. public void SwitchPage(string page)
  1193. {
  1194. var windowManager = IoC.Get<IWindowManager>();
  1195. switch (page)
  1196. {
  1197. case "GFCSetting":
  1198. RecipeGasPanelSettingViewModel recipeGasPanelSettingViewModel = new RecipeGasPanelSettingViewModel
  1199. {
  1200. SelectedStepNo = SelectedRecipeStep.StepNo,
  1201. SelectedStepName = $"{SelectedRecipeStep.StepNo}:{SelectedRecipeStep.Name}",
  1202. CurrentRecipe = CurrentRecipe,
  1203. SelectedStep = this.CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault()
  1204. };
  1205. recipeGasPanelSettingViewModel.ChangedStepEvent += RecipeGasPanelSettingViewModel_ChangedStepEvent;
  1206. (windowManager as WindowManager)?.ShowDialogWithTitle(recipeGasPanelSettingViewModel, null, "Recipe Gas Panel Setting");
  1207. break;
  1208. }
  1209. }
  1210. private void RecipeGasPanelSettingViewModel_ChangedStepEvent(Step step)
  1211. {
  1212. SelectStep(step);
  1213. }
  1214. private Step OldStep;
  1215. private Dictionary<string, string> PumpDict = new Dictionary<string, string>();
  1216. private Dictionary<string, string> OtherPumpDict = new Dictionary<string, string>();
  1217. public void SelectStep(object sender, object step)
  1218. {
  1219. var textBox = sender as UIElement;
  1220. if (textBox != null)
  1221. {
  1222. Keyboard.Focus(textBox);
  1223. }
  1224. SelectStep(step);
  1225. }
  1226. public void SelectStep(object step)
  1227. {
  1228. if (step == null || !(step is Step))
  1229. {
  1230. return;
  1231. }
  1232. var step1 = (Step)step;
  1233. var SelectedStep = this.CurrentRecipe.Steps.Where(x => x.StepNo == step1.StepNo).FirstOrDefault();
  1234. if (OldStep != null && step1.StepNo != OldStep.StepNo)
  1235. {
  1236. var selectedOldStep = this.CurrentRecipe.Steps.Where(x => x.StepNo == OldStep.StepNo).FirstOrDefault();
  1237. if (step1 != null && step1.TemperatureControlMode != null && !string.IsNullOrEmpty(step1.TemperatureControlMode.Value))
  1238. {
  1239. if (step1.TemperatureControlMode.Value.Contains("Profile"))
  1240. {
  1241. SelectBtnName = "Profile";
  1242. }
  1243. else
  1244. {
  1245. SelectBtnName = step1.TemperatureControlMode.Value;
  1246. }
  1247. }
  1248. else
  1249. {
  1250. SelectBtnName = "";
  1251. }
  1252. //if (selectedOldStep != null)
  1253. //{
  1254. // selectedOldStep.LoaderValue = GetSaveLoaderValue(selectedOldStep.LoaderCommand);
  1255. // selectedOldStep.PressValue = GetSavePressValue(selectedOldStep.PressCommand);
  1256. //}
  1257. }
  1258. OldStep = step1;
  1259. string strName = step1.Name == null ? step1.Name : step1.Name?.Trim();
  1260. SelectedRecipeStep = SelectedStep;
  1261. //if (SelectedRecipeStep.Name != EditRecipeStepName || SelectedRecipeStep.StepNo != step1.StepNo)
  1262. //{
  1263. SetShowLoaderValuePanel(SelectedRecipeStep.LoaderCommand.Value);
  1264. SetShowPressPanel(SelectedRecipeStep.PressCommand.Value);
  1265. InvokeClient.Instance.Service.DoOperation($"PM1.SetEditRecipeStepName", SelectedRecipeStep.Name);
  1266. new Task(() =>
  1267. {
  1268. var selectedStep = step1;
  1269. if (selectedStep.MFCSets != null && selectedStep.MFCSets.Count > 0)
  1270. {
  1271. Dictionary<string, string> dictMFC = new Dictionary<string, string>();
  1272. foreach (var mfc in selectedStep.MFCSets)
  1273. {
  1274. dictMFC[mfc.ControlName] = $"{mfc.SetValue.Value};{mfc.Rampng.Value};{mfc.AlarmValue}";
  1275. }
  1276. InvokeClient.Instance.Service.DoOperation($"PM1.SetAllMfcVirtualValue", dictMFC);
  1277. }
  1278. if (selectedStep.ValveSets != null && selectedStep.ValveSets.Count > 0)
  1279. {
  1280. Dictionary<string, bool> dictValve = new Dictionary<string, bool>();
  1281. foreach (var item in selectedStep.ValveSets)
  1282. {
  1283. if (PumpDict.ContainsKey(item.Name))
  1284. {
  1285. // dictValve[PumpDict[key]] = selectedStep.ValveSets[key] == "Open" ? true : false;
  1286. }
  1287. else if (OtherPumpDict.ContainsKey(item.Name))
  1288. { }
  1289. else
  1290. {
  1291. dictValve[item.Name] = item.Value;
  1292. }
  1293. }
  1294. InvokeClient.Instance.Service.DoOperation($"PM1.SetAll{AITValveOperation.GVVirtualTurnValve}", dictValve);
  1295. }
  1296. }).Start();
  1297. //if (selectedStep.TemperatureSets != null)
  1298. //{
  1299. // TempList.Clear();
  1300. // selectedStep.TemperatureSets.ToList().ForEach(x => TempList.Add(x));
  1301. //}
  1302. //SetLoaderValue(selectedStep.LoaderCommand, selectedStep.LoaderValue);
  1303. //SetPressValue(selectedStep.PressCommand, selectedStep.PressValue);
  1304. //}
  1305. RefreshUpdate();
  1306. }
  1307. #region"StepEdit"
  1308. public Step selectStep { get; set; } = new Step();
  1309. public void StepEdit(string stepEditCmd)
  1310. {
  1311. var windowManager = IoC.Get<IWindowManager>();
  1312. switch (stepEditCmd)
  1313. {
  1314. case "Append":
  1315. AppendStep2();
  1316. break;
  1317. case "InsertCopy":
  1318. InsertCopyStep();
  1319. break;
  1320. case "OverWrite"://任何步骤的内容都可以覆盖到选定的步骤中
  1321. OverWriteStep();
  1322. break;
  1323. case "PrevStepOverwrite"://用上一步的内容覆盖所选步骤
  1324. PrevStepOverwriteStep();
  1325. break;
  1326. case "PrevStepInsert"://在选定步骤之前,插入带有前一步内容的新步骤。
  1327. InsertPrevStep();
  1328. break;
  1329. case "PrevStepItem":
  1330. break;
  1331. case "CurrStepDelete":
  1332. if (SelectedRecipeStep == null || CurrentRecipe == null)
  1333. { return; }
  1334. CurrDeleteStep();
  1335. break;
  1336. case "MultStepsDelete":
  1337. RecipeStepDeleteDialogViewModel recipedeleteDialog = new RecipeStepDeleteDialogViewModel(CurrentRecipe);
  1338. (windowManager as WindowManager)?.ShowDialogWithTitle(recipedeleteDialog, null, "Delete Recipe Step");
  1339. IndexNoDefault = 0;
  1340. if (CurrentRecipe.Steps.Count > 0)
  1341. {
  1342. selectStep = CurrentRecipe.Steps[0];
  1343. }
  1344. break;
  1345. default:
  1346. break;
  1347. }
  1348. // var totalPage = GetTotalPage();
  1349. currentPage = GetcurrentPage();
  1350. NewSteps = new ObservableCollection<Step>(CurrentRecipe.Steps.Take(pageSize * currentPage).Skip(pageSize * (currentPage - 1)));
  1351. //currentPage = totalPage;
  1352. if (selectStep != null && selectStep.StepNo >= 0)
  1353. {
  1354. SelectStep(selectStep);
  1355. }
  1356. }
  1357. private void OverWriteStep()
  1358. {
  1359. var windowManager = IoC.Get<IWindowManager>();
  1360. if (CurrentRecipe == null) return;
  1361. RecipeStepSelectDialogViewModel recipeStepSelectDialogViewModel = new RecipeStepSelectDialogViewModel(CurrentRecipe);
  1362. if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeStepSelectDialogViewModel, null, "Select Recipe Step"))
  1363. {
  1364. var tempStep = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault();
  1365. CurrentRecipe.ShallowCopyStep(ref tempStep, recipeStepSelectDialogViewModel.SelectedStep);
  1366. selectStep = SelectedRecipeStep;
  1367. }
  1368. }
  1369. private void PrevStepOverwriteStep()
  1370. {
  1371. int index = -1;
  1372. index = SelectedRecipeStep.StepNo;
  1373. if (index > 1)
  1374. {
  1375. var setStep = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault();
  1376. CurrentRecipe.ShallowCopyStep(ref setStep, CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo - 1).FirstOrDefault());
  1377. selectStep = SelectedRecipeStep;
  1378. }
  1379. }
  1380. public void CurrDeleteStep()
  1381. {
  1382. int index = -1;
  1383. index = SelectedRecipeStep.StepNo;
  1384. CurrentRecipe.Steps.Remove(CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault());
  1385. if (CurrentRecipe.RecipeChamberType != RecipeDataBase.ProcessType)
  1386. {
  1387. for (int i = index; i < this.CurrentRecipe.Steps.Count + 1; i++)
  1388. {
  1389. this.CurrentRecipe.Steps[i - 1].StepNo = i;
  1390. }
  1391. }
  1392. else
  1393. {
  1394. for (int i = index; i < this.CurrentRecipe.Steps.Count + 1; i++)
  1395. {
  1396. this.CurrentRecipe.Steps[i - 1].StepNo = i - 1;
  1397. }
  1398. }
  1399. if (index > CurrentRecipe.Steps.Count - 1)
  1400. {
  1401. IndexNoDefault = CurrentRecipe.Steps.Count - 1;
  1402. }
  1403. else
  1404. {
  1405. IndexNoDefault = CurrentRecipe.Steps.IndexOf(CurrentRecipe.Steps.FirstOrDefault(x => x.StepNo == index));
  1406. }
  1407. if (CurrentRecipe != null && CurrentRecipe.Steps.Count > 0)
  1408. {
  1409. RefreshUpdate();
  1410. selectStep = CurrentRecipe.Steps[IndexNoDefault];
  1411. }
  1412. }
  1413. public void InsertPrevStep()
  1414. {
  1415. var foundPrevStep = this.CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo - 1).FirstOrDefault();
  1416. var foundStep = this.CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault();
  1417. if (foundPrevStep != null && foundStep != null)
  1418. {
  1419. var tempStep = CurrentRecipe.CreateStep();
  1420. CurrentRecipe.CloneStep(ref tempStep, foundPrevStep);
  1421. tempStep.StepNo = foundPrevStep.StepNo + 1;
  1422. foreach (var item in this.CurrentRecipe.Steps)
  1423. {
  1424. if (item.StepNo >= tempStep.StepNo)
  1425. {
  1426. item.StepNo += 1;
  1427. }
  1428. }
  1429. Step step = CurrentRecipe.Steps.FirstOrDefault(x => x.Name == "Standby");
  1430. CurrentRecipe.SetDelegateEvent(tempStep);
  1431. if (step == null)
  1432. {
  1433. this.CurrentRecipe.Steps.Insert(foundPrevStep.StepNo, tempStep);
  1434. }
  1435. else
  1436. {
  1437. this.CurrentRecipe.Steps.Insert(foundPrevStep.StepNo + 1, tempStep);
  1438. }
  1439. if (step == null)
  1440. {
  1441. IndexNoDefault = SelectedRecipeStep.StepNo - 1;
  1442. }
  1443. else
  1444. {
  1445. IndexNoDefault = SelectedRecipeStep.StepNo;
  1446. }
  1447. selectStep = CurrentRecipe.Steps[IndexNoDefault];
  1448. }
  1449. }
  1450. private void AppendStep()
  1451. {
  1452. if (CurrentRecipe.RecipeChamberType == "Process")
  1453. {
  1454. var last = CurrentRecipe.Steps.LastOrDefault();
  1455. CurrentRecipe.Steps.RemoveWhere(a => a.StepNo == last.StepNo);
  1456. var newStep = CurrentRecipe.CreateStep();
  1457. CurrentRecipe.Steps.Add(newStep);
  1458. int TempSelectIndex = 0;
  1459. Step step = CurrentRecipe.Steps.FirstOrDefault(x => x.Name == "Standby");
  1460. for (int i = 0; i < this.CurrentRecipe.Steps.Count; i++)
  1461. {
  1462. if (step == null)
  1463. {
  1464. this.CurrentRecipe.Steps[i].StepNo = i + 1;
  1465. }
  1466. else
  1467. {
  1468. this.CurrentRecipe.Steps[i].StepNo = i;
  1469. }
  1470. TempSelectIndex = i;
  1471. }
  1472. IndexNoDefault = TempSelectIndex;
  1473. last.StepNo = CurrentRecipe.Steps.LastOrDefault().StepNo + 1;
  1474. CurrentRecipe.Steps.Add(last);
  1475. selectStep = CurrentRecipe.Steps[newStep.StepNo - 1];
  1476. }
  1477. else
  1478. {
  1479. var newStep = CurrentRecipe.CreateStep();
  1480. CurrentRecipe.Steps.Add(newStep);
  1481. int TempSelectIndex = 0;
  1482. Step step = CurrentRecipe.Steps.FirstOrDefault(x => x.Name == "Standby");
  1483. for (int i = 0; i < this.CurrentRecipe.Steps.Count; i++)
  1484. {
  1485. if (step == null)
  1486. {
  1487. this.CurrentRecipe.Steps[i].StepNo = i + 1;
  1488. }
  1489. else
  1490. {
  1491. this.CurrentRecipe.Steps[i].StepNo = i;
  1492. }
  1493. TempSelectIndex = i;
  1494. }
  1495. IndexNoDefault = TempSelectIndex;
  1496. selectStep = CurrentRecipe.Steps[TempSelectIndex];
  1497. }
  1498. }
  1499. public void AppendStep2()
  1500. {
  1501. var foundStep = this.CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault();
  1502. int foundIndex = this.CurrentRecipe.Steps.IndexOf(foundStep);
  1503. if (foundStep != null)
  1504. {
  1505. var tempStep = CurrentRecipe.CreateStep();
  1506. CurrentRecipe.CloneStep(ref tempStep, foundStep);
  1507. tempStep.StepNo = foundStep.StepNo + 1;
  1508. tempStep.Name = $"Name{tempStep.StepNo}";
  1509. foreach (var item in this.CurrentRecipe.Steps)
  1510. {
  1511. if (item.StepNo >= tempStep.StepNo)
  1512. {
  1513. item.StepNo += 1;
  1514. }
  1515. }
  1516. this.CurrentRecipe.Steps.Insert(foundIndex + 1, tempStep);
  1517. selectStep = CurrentRecipe.Steps[foundIndex + 1];
  1518. }
  1519. }
  1520. public void InsertCopyStep()
  1521. {
  1522. var windowManager = IoC.Get<IWindowManager>();
  1523. if (CurrentRecipe == null) return;
  1524. RecipeStepSelectDialogViewModel recipeStepSelectDialogViewModel = new RecipeStepSelectDialogViewModel(CurrentRecipe);
  1525. if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeStepSelectDialogViewModel, null, "Select Recipe Step"))
  1526. {
  1527. var foundStep = this.CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault();
  1528. if (foundStep != null)
  1529. {
  1530. var tempStep = CurrentRecipe.CreateStep();
  1531. CurrentRecipe.CloneStep(ref tempStep, recipeStepSelectDialogViewModel.SelectedStep);
  1532. tempStep.StepNo = foundStep.StepNo;
  1533. int insertIndex = this.CurrentRecipe.Steps.IndexOf(foundStep);
  1534. CurrentRecipe.SetDelegateEvent(tempStep);
  1535. this.CurrentRecipe.Steps.Insert(insertIndex, tempStep);
  1536. if (CurrentRecipe.RecipeChamberType != RecipeDataBase.ProcessType)
  1537. {
  1538. for (int i = tempStep.StepNo; i < this.CurrentRecipe.Steps.Count + 1; i++)
  1539. {
  1540. this.CurrentRecipe.Steps[i - 1].StepNo = i;
  1541. }
  1542. }
  1543. else
  1544. {
  1545. for (int i = tempStep.StepNo; i < this.CurrentRecipe.Steps.Count; i++)
  1546. {
  1547. this.CurrentRecipe.Steps[i].StepNo = i;
  1548. }
  1549. }
  1550. selectStep = CurrentRecipe.Steps[insertIndex];
  1551. }
  1552. }
  1553. }
  1554. #endregion
  1555. public void RecipeSingMFCIsChangeClick(object value)
  1556. {
  1557. if (value is MFCData)
  1558. {
  1559. var mfc = value as MFCData;
  1560. if (mfc.IsSaved)
  1561. {
  1562. if (DialogButton.Yes == DialogBox.ShowDialog(DialogButton.Yes | DialogButton.No,
  1563. DialogType.CONFIRM,
  1564. $"Recipe single MFC is changed Flag, do you want to save it?"))
  1565. {
  1566. mfc.FlagIsSaved = false;
  1567. }
  1568. }
  1569. else
  1570. {
  1571. mfc.FlagIsSaved = true;
  1572. mfc.UndoChanges();
  1573. }
  1574. }
  1575. }
  1576. //撤销修改
  1577. public void RecipeIsChangeClick(object cmdName, object value)
  1578. {
  1579. if (value == null)
  1580. return;
  1581. var windowManager = IoC.Get<IWindowManager>();
  1582. switch ((string)cmdName)
  1583. {
  1584. case "Alarm":
  1585. ((Step)value).UndoAlarmChanges();
  1586. break;
  1587. case "MFC":
  1588. ((Step)value).UndoMFCChanges();
  1589. break;
  1590. case "Gas":
  1591. ((Step)value).UndoGasChanges();
  1592. break;
  1593. case "AUX":
  1594. ((Step)value).UndoAUXChanges();
  1595. break;
  1596. case "Press":
  1597. ((Step)value).UndoPressChanges();
  1598. SetShowPressPanel(((Step)value).PressCommand.Value);
  1599. break;
  1600. case "Temp":
  1601. ((Step)value).UndoTemperatureChanges();
  1602. break;
  1603. case "Loader":
  1604. ((Step)value).UndoLoaderChanges();
  1605. SetShowLoaderValuePanel(((Step)value).LoaderCommand.Value);
  1606. break;
  1607. default:
  1608. break;
  1609. }
  1610. }
  1611. public void TempSetClick(object sender)
  1612. {
  1613. string stSetValue = ShowNumberKeyboard(sender as Button, "", 1);
  1614. if (stSetValue != "Cancel")
  1615. {
  1616. foreach (var item in SelectedRecipeStep.TemperatureSets)
  1617. {
  1618. item.SetValue.SetValue(stSetValue);
  1619. }
  1620. }
  1621. }
  1622. public void RampSetClick(object sender)
  1623. {
  1624. string strSetRamp = ShowNumberKeyboard(sender as Button, "", 1);
  1625. if (strSetRamp != "Cancel")
  1626. {
  1627. foreach (var item in SelectedRecipeStep.TemperatureSets)
  1628. {
  1629. item.RampngValue.SetValue(strSetRamp);
  1630. }
  1631. }
  1632. }
  1633. private string ShowNumberKeyboard(Control control, string defaultValue, int keepDecimals = -1)
  1634. {
  1635. NumberKeyboard numberKeyboard = new NumberKeyboard("", defaultValue);
  1636. numberKeyboard.KeepDecimals = keepDecimals;
  1637. var point = control.PointFromScreen(new Point(0, 0));
  1638. double wx = SystemParameters.WorkArea.Width;
  1639. double hy = SystemParameters.WorkArea.Height;
  1640. if (-point.Y + control.ActualHeight + 5 + numberKeyboard.Height < hy)
  1641. {
  1642. numberKeyboard.Top = -point.Y + control.ActualHeight + 5;
  1643. }
  1644. else
  1645. {
  1646. numberKeyboard.Top = -point.Y - numberKeyboard.Height - 5;
  1647. }
  1648. if (-point.X + numberKeyboard.Width < wx)
  1649. {
  1650. numberKeyboard.Left = -point.X;
  1651. }
  1652. else
  1653. {
  1654. numberKeyboard.Left = -point.X - (numberKeyboard.Width - control.ActualWidth);
  1655. }
  1656. if ((bool)numberKeyboard.ShowDialog())
  1657. return numberKeyboard.ValueString;
  1658. else
  1659. return "Cancel";
  1660. }
  1661. private string GetTemperatureControlMode(string val)
  1662. {
  1663. if (string.IsNullOrEmpty(val) || !val.Contains("—"))
  1664. {
  1665. return val;
  1666. }
  1667. var temperatureControlModes = val.Split('—').ToList();
  1668. SelectBtnName = temperatureControlModes.LastOrDefault();
  1669. if (temperatureControlModes.Count == 1)
  1670. {
  1671. SelectBtnName = "";
  1672. }
  1673. return temperatureControlModes.FirstOrDefault();
  1674. }
  1675. public void TempTextClick(string type, object sender)
  1676. {
  1677. var windowManager = IoC.Get<IWindowManager>();
  1678. switch (type)
  1679. {
  1680. case "Mode":
  1681. RecipeTempModeViewModel recipeTempModeViewModel = new RecipeTempModeViewModel();
  1682. recipeTempModeViewModel.CurrentRecipe = CurrentRecipe;
  1683. recipeTempModeViewModel.SelectProfileTable = SelectedRecipeStep.TemperatureControlMode.Value;
  1684. recipeTempModeViewModel.SelectBtnName = SelectBtnName;
  1685. var rtn = (windowManager as WindowManager)?.ShowDialogWithTitle(recipeTempModeViewModel, null, "Temp Mode");
  1686. if ((bool)rtn)
  1687. {
  1688. SelectBtnName = recipeTempModeViewModel.SelectBtnName;
  1689. //SelectedRecipeStep.TemperatureControlMode.Value =recipeTempModeViewModel.ResultString;
  1690. var foundStep = this.CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault();
  1691. if (foundStep != null)
  1692. {
  1693. if (null != recipeTempModeViewModel && !string.IsNullOrEmpty(recipeTempModeViewModel.ResultString) && recipeTempModeViewModel.ResultString.Contains("Profile"))
  1694. {
  1695. SelectBtnName = "Profile";
  1696. }
  1697. foundStep.TemperatureControlMode.SetValue(recipeTempModeViewModel.ResultString);
  1698. }
  1699. }
  1700. break;
  1701. case "Correct":
  1702. TempCorrectionEditViewModel tempCorrectionEditViewModel = new TempCorrectionEditViewModel();
  1703. tempCorrectionEditViewModel.CurrentRecipe = CurrentRecipe;
  1704. tempCorrectionEditViewModel.ResultString = SelectedRecipeStep.TemperatureCorrect.Value;
  1705. tempCorrectionEditViewModel.IsEnabledControl = false;
  1706. tempCorrectionEditViewModel.AutoSelectVisibility = Visibility.Visible;
  1707. // tempOffsetTableViewModel.SelectedRecipeStep = SelectedRecipeStep;
  1708. rtn = (windowManager as WindowManager)?.ShowDialogWithTitle(tempCorrectionEditViewModel, null, "Temp Correct Table");
  1709. if ((bool)rtn)
  1710. {
  1711. // SelectedRecipeStep.TemperatureCorrect.Value = tempCorrectionEditViewModel.ResultString;
  1712. var foundStep = this.CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault();
  1713. if (foundStep != null)
  1714. {
  1715. foundStep.TemperatureCorrect.SetValue(tempCorrectionEditViewModel.ResultString);
  1716. }
  1717. }
  1718. break;
  1719. case "PID":
  1720. TempOffsetTableViewModel tempOffsetTableViewModel1 = new TempOffsetTableViewModel();
  1721. tempOffsetTableViewModel1.TempOffsetTableSelected = SelectedRecipeStep.TemperaturePID.Value;
  1722. tempOffsetTableViewModel1.CurrentRecipe = CurrentRecipe;
  1723. tempOffsetTableViewModel1.IsEnabledControl = false;
  1724. tempOffsetTableViewModel1.SelectedRecipeStep = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault();
  1725. rtn = (windowManager as WindowManager)?.ShowDialogWithTitle(tempOffsetTableViewModel1, null, "Temp PID Table");
  1726. if ((bool)rtn)
  1727. {
  1728. // SelectedRecipeStep.TemperaturePID.Value = tempOffsetTableViewModel1.TempOffsetTableSelected;
  1729. var foundStep = this.CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault();
  1730. if (foundStep != null)
  1731. {
  1732. foundStep.TemperaturePID.SetValue(tempOffsetTableViewModel1.TempOffsetTableSelected);
  1733. }
  1734. }
  1735. break;
  1736. default:
  1737. break;
  1738. }
  1739. }
  1740. //public void TempTextChanged(string type, object sender, object item)
  1741. //{
  1742. // if (!string.IsNullOrEmpty(type) && item != null && sender != null)
  1743. // {
  1744. // TempSetData tempData = (TempSetData)item;
  1745. // string value = ((TextBox)sender).Text;
  1746. // int stepNo = SelectedRecipeStep.StepNo;
  1747. // var step = CurrentRecipe.Steps.Where(x => x.StepNo == stepNo).FirstOrDefault();
  1748. // if (step != null)
  1749. // {
  1750. // var tempValue = CurrentRecipe.Steps.Where(x => x.StepNo == stepNo).FirstOrDefault().TemperatureSets.Where(x => x.Name == tempData.Name).FirstOrDefault();
  1751. // if (tempValue == null) return;
  1752. // switch (type)
  1753. // {
  1754. // case "Value":
  1755. // tempValue.SetValue.Value = value;
  1756. // break;
  1757. // case "Ramp":
  1758. // tempValue.RampngValue.Value = value;
  1759. // break;
  1760. // default:
  1761. // break;
  1762. // }
  1763. // }
  1764. // }
  1765. //}
  1766. private bool isEditMFC = false;
  1767. public void StepEdit(object cmdName, object value)
  1768. {
  1769. var windowManager = IoC.Get<IWindowManager>();
  1770. switch ((string)cmdName)
  1771. {
  1772. case "StepName":
  1773. RecipeStepNameViewModel recipeStepNameViewModel = new RecipeStepNameViewModel() { SelectedStepName = SelectedRecipeStep.Name };
  1774. if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeStepNameViewModel, null, "Recipe Step Name"))
  1775. {
  1776. SelectedRecipeStep.Name = recipeStepNameViewModel.SelectedStepName;
  1777. }
  1778. break;
  1779. case "StepTime":
  1780. RecipeStepTimeViewModel recipeStepTimeViewModel = new RecipeStepTimeViewModel("StepTime");
  1781. if (CurrentRecipe.Steps.Count > 0)
  1782. {
  1783. var timeValue = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().Time;
  1784. recipeStepTimeViewModel.SelectTime = (timeValue == null || timeValue.Contains(':')) ? "Value" : timeValue;
  1785. if (recipeStepTimeViewModel.SelectTime == "Value")
  1786. {
  1787. recipeStepTimeViewModel.SelectValueTime = timeValue;
  1788. }
  1789. (windowManager as WindowManager)?.ShowDialogWithTitle(recipeStepTimeViewModel, null, "Step Time Set");
  1790. if (recipeStepTimeViewModel.IsSave)
  1791. {
  1792. CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().Time = recipeStepTimeViewModel.SelectTime;
  1793. if (recipeStepTimeViewModel.SelectTime == "Value")
  1794. {
  1795. SelectedRecipeStep.Time = recipeStepTimeViewModel.SelectTime + ":" + recipeStepTimeViewModel.SelectValueTime;
  1796. if (CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault() != null)
  1797. {
  1798. CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().Time = recipeStepTimeViewModel.SelectValueTime;
  1799. }
  1800. }
  1801. else
  1802. {
  1803. SelectedRecipeStep.Time = recipeStepTimeViewModel.SelectTime + ":" + recipeStepTimeViewModel.RecipeStepTime[recipeStepTimeViewModel.SelectTime];
  1804. }
  1805. }
  1806. }
  1807. break;
  1808. case "RecipeCommand":
  1809. RecipeCommandViewModel recipeCommandViewModel = new RecipeCommandViewModel();
  1810. 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());
  1811. 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());
  1812. recipeCommandViewModel.LoopStepNames = loopStepNames;
  1813. recipeCommandViewModel.JumpStepNames = jumpStepNames;
  1814. recipeCommandViewModel.SelectedRecipeStep = SelectedRecipeStep;
  1815. recipeCommandViewModel.SelectRecipeCommand = SelectedRecipeStep.Command;
  1816. recipeCommandViewModel.RecipeData = CurrentRecipe;
  1817. if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeCommandViewModel, null, "Recipe Command"))
  1818. {
  1819. SelectedRecipeStep.Command = recipeCommandViewModel.SelectRecipeCommand;
  1820. CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().Command = SelectedRecipeStep.Command;
  1821. }
  1822. break;
  1823. case "ConditionCheck":
  1824. RecipeConditionCheckSetViewModel recipeConditionCheckSetViewModel = new RecipeConditionCheckSetViewModel();
  1825. if (CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().ExternalSensor != null)
  1826. {
  1827. recipeConditionCheckSetViewModel.RecipeConditions.ExternalSensor = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().ExternalSensor;
  1828. }
  1829. var step = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault();
  1830. if (step != null)
  1831. {
  1832. recipeConditionCheckSetViewModel.RecipeConditions.TempStabizeSelected = step.TempStabilizeSelected;
  1833. recipeConditionCheckSetViewModel.RecipeConditions.FinishAutoProfile = step.FinishAutoProfile;
  1834. recipeConditionCheckSetViewModel.RecipeConditions.ReachTemp = step.ReachTemp;
  1835. recipeConditionCheckSetViewModel.RecipeConditions.ReachTempValue = step.ReachTempValue;
  1836. recipeConditionCheckSetViewModel.RecipeConditions.O2Density = step.O2Density;
  1837. recipeConditionCheckSetViewModel.RecipeConditions.O2DensityValue = step.O2DensityValue;
  1838. recipeConditionCheckSetViewModel.RecipeConditions.ReachPressure = step.ReachPressure;
  1839. recipeConditionCheckSetViewModel.RecipeConditions.ReachPressureVG = step.ReachPressureVG;
  1840. recipeConditionCheckSetViewModel.RecipeConditions.ReachPressureValue = step.ReachPressureValue;
  1841. recipeConditionCheckSetViewModel.RecipeConditions.PressureStabilizeVG = step.PressureStabilizeVG;
  1842. recipeConditionCheckSetViewModel.RecipeConditions.PressureStabilizeSelected = step.PressureStabilizeSelected;
  1843. recipeConditionCheckSetViewModel.RecipeConditions.ProcessTimeToEnd = step.ProcessTimeToEnd;
  1844. }
  1845. var result = (windowManager as WindowManager)?.ShowDialogWithTitle(recipeConditionCheckSetViewModel, null, "Condition Check");
  1846. if (recipeConditionCheckSetViewModel.IsSave)
  1847. {
  1848. if (recipeConditionCheckSetViewModel.IsNone)
  1849. {
  1850. CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().IsnoneConditionCheck = true;
  1851. }
  1852. else
  1853. {
  1854. CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().IsnoneConditionCheck = false;
  1855. }
  1856. CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().ExternalSensor = recipeConditionCheckSetViewModel.RecipeConditions.ExternalSensor;
  1857. CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().ExternalSensorName = recipeConditionCheckSetViewModel.RecipeConditions.ExternalSensorName;
  1858. CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().TempStabilizeSelected = recipeConditionCheckSetViewModel.RecipeConditions.TempStabizeSelected;
  1859. CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().FinishAutoProfile = recipeConditionCheckSetViewModel.RecipeConditions.FinishAutoProfile;
  1860. CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().ReachTemp = recipeConditionCheckSetViewModel.RecipeConditions.ReachTemp;
  1861. CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().ReachTempValue = recipeConditionCheckSetViewModel.RecipeConditions.ReachTempValue;
  1862. CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().O2Density = recipeConditionCheckSetViewModel.RecipeConditions.O2Density;
  1863. CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().O2DensityValue = recipeConditionCheckSetViewModel.RecipeConditions.O2DensityValue;
  1864. CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().ReachPressure = recipeConditionCheckSetViewModel.RecipeConditions.ReachPressure;
  1865. CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().ReachPressureVG = recipeConditionCheckSetViewModel.RecipeConditions.ReachPressureVG;
  1866. CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().PressureStabilizeVG = recipeConditionCheckSetViewModel.RecipeConditions.PressureStabilizeVG;
  1867. CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().ReachPressureValue = recipeConditionCheckSetViewModel.RecipeConditions.ReachPressureValue;
  1868. CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().PressureStabilizeSelected = recipeConditionCheckSetViewModel.RecipeConditions.PressureStabilizeSelected;
  1869. CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().ProcessTimeToEnd = recipeConditionCheckSetViewModel.RecipeConditions.ProcessTimeToEnd;
  1870. }
  1871. if (recipeConditionCheckSetViewModel.IsNone)//不存数据处理
  1872. { }
  1873. break;
  1874. case "AlarmAction":
  1875. Combination combination = new Combination(CurrentRecipe.ConfigItems);
  1876. AlarmConditionEditViewModel alarmConditionViewModel = new AlarmConditionEditViewModel($"Parameter\\AlarmCondition", combination.AlarmCondition, SelectedRecipeStep.AlarmConditionTable.Value);
  1877. alarmConditionViewModel.IsEnableEdit = false;
  1878. alarmConditionViewModel.RecipeType = CurrentRecipe.RecipeChamberType;
  1879. if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(alarmConditionViewModel, null, "Alarm Action"))
  1880. {
  1881. CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().AlarmConditionTable.SetValue(alarmConditionViewModel.ReturnString);
  1882. }
  1883. //RecipeAlarmActionViewModel recipeAlarmActionViewModel = new RecipeAlarmActionViewModel
  1884. //{
  1885. // CurrentRecipe = CurrentRecipe,
  1886. // CurrentStepName = SelectedRecipeStep.Name,
  1887. // TableIndex = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().AlarmTableIndex,
  1888. // AlarmActions = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().AlarmActionSets
  1889. //};
  1890. //if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeAlarmActionViewModel, null, "Alarm Action"))
  1891. //{
  1892. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().AlarmTableIndex = recipeAlarmActionViewModel.TableIndex;
  1893. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().AlarmActionSets = recipeAlarmActionViewModel.AlarmActions;
  1894. //}
  1895. break;
  1896. case "TempSetting":
  1897. if (recipeTempSetViewModel is null)
  1898. {
  1899. recipeTempSetViewModel = new RecipeTempSetViewModel
  1900. {
  1901. RecipeTemplate = RecipeTemplate
  1902. };
  1903. }
  1904. if (CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().TemperatureSets != null)
  1905. {
  1906. var tempSets = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault();
  1907. recipeTempSetViewModel.TemperatureValues = tempSets.TemperatureSets;
  1908. //tempSets.TemperatureSets.ToList().ForEach(x => recipeTempSetViewModel.TemperatureValues.Add(x));
  1909. }
  1910. recipeTempSetViewModel.StepType = SelectedRecipeStep.Name;
  1911. recipeTempSetViewModel.RecipeType = RecipeType;
  1912. if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeTempSetViewModel, null, "Temp Detail"))
  1913. {
  1914. if (recipeTempSetViewModel.TemperatureValues != null && recipeTempSetViewModel.TemperatureValues.Count > 0 && recipeTempSetViewModel.IsSave)
  1915. {
  1916. if (CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().TemperatureSets != null)
  1917. {
  1918. // var tempSets = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault();
  1919. // tempSets.TemperatureSets = recipeTempSetViewModel.TempSetDataList;
  1920. }
  1921. }
  1922. }
  1923. break;
  1924. case "GASSetting":
  1925. RecipeMFCSettingViewModel recipeMFCSettingViewModel = new RecipeMFCSettingViewModel();
  1926. //InvokeClient.Instance.Service.DoOperation($"PM1.SetSensorRecipeOK", "");
  1927. recipeMFCSettingViewModel.MFCSets = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().MFCSets;
  1928. //recipeGASSettingViewModel.MFMSets = new MFMValue() { AlarmValue = tempMFMSets.AlarmValue, IsNotifying = tempMFMSets.IsNotifying, Name = tempMFMSets.Name, Value = tempMFMSets.Value };
  1929. recipeMFCSettingViewModel.RecipeType = RecipeType;
  1930. recipeMFCSettingViewModel.RecipeTemplate = RecipeTemplate;
  1931. if (!(bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeMFCSettingViewModel, null, "MFC Detail"))
  1932. {
  1933. //InvokeClient.Instance.Service.DoOperation($"PM1.SetSensorPROCManualOK", "");
  1934. return;
  1935. }
  1936. //InvokeClient.Instance.Service.DoOperation($"PM1.SetSensorPROCManualOK", "");
  1937. if (CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().MFCSets != null)
  1938. {
  1939. if (recipeMFCSettingViewModel.MFCSets != null && recipeMFCSettingViewModel.MFCSets.Count > 0)
  1940. {
  1941. CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().MFCSets = recipeMFCSettingViewModel.MFCSets;
  1942. UpdateMFCShow();
  1943. }
  1944. }
  1945. break;
  1946. case "PressureSetting":
  1947. RecipePressureSettingViewModel recipePressureSettingViewModel = new RecipePressureSettingViewModel();
  1948. var tempStep = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault();
  1949. // recipePressureSettingViewModel.PressureSonsorValue = tempStep.PressureSonserValue;
  1950. // recipePressureSettingViewModel.PressureValveAngleValue = tempStep.PressureValveAngle;
  1951. // recipePressureSettingViewModel.PressureSettingVG = tempStep.PressureSettingVG;
  1952. //if (!string.IsNullOrEmpty(tempStep.PressureAlarmTableNo))
  1953. //{
  1954. // if (tempStep.PressureAlarmTableNo.ToLower() == "none")
  1955. // recipePressureSettingViewModel.PressureAlarmWatchTable = "None";
  1956. // else
  1957. // recipePressureSettingViewModel.PressureAlarmWatchTable = tempStep.PressureAlarmTableNo;
  1958. //}
  1959. //if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipePressureSettingViewModel, null, "Recipe Pressure Setting"))
  1960. //{
  1961. // if (CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault() != null)
  1962. // {
  1963. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().PressureSonserValue = recipePressureSettingViewModel.PressureSonsorValue;
  1964. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().PressureValveAngle = recipePressureSettingViewModel.PressureValveAngleValue;
  1965. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().PressureAlarmTableNo = recipePressureSettingViewModel.PressureAlarmWatchTable;
  1966. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().PressureSettingVG = recipePressureSettingViewModel.PressureSettingVG;
  1967. // // SelectedRecipeStep.PressureSonserValue = $"{recipePressureSettingViewModel.PressureSonsorValue}";
  1968. // }
  1969. //}
  1970. break;
  1971. case "RFSetting":
  1972. //RecipeRFPressureSettingViewModel recipeRFPressureSettingViewModel = new RecipeRFPressureSettingViewModel();
  1973. //var tempRecipeStep = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault();
  1974. //recipeRFPressureSettingViewModel.RFSwitch = tempRecipeStep.RFSwitch;
  1975. //recipeRFPressureSettingViewModel.RFSetPointValue = tempRecipeStep.RFSetpoint;
  1976. //recipeRFPressureSettingViewModel.C1SetPointValue = tempRecipeStep.C1Setpoint;
  1977. //recipeRFPressureSettingViewModel.C2SetPointValue = tempRecipeStep.C2Setpoint;
  1978. //recipeRFPressureSettingViewModel.ForwardPowerAlarmWatchSetPointValue = tempRecipeStep.ForwardPowerAlarmWatchTable;
  1979. //recipeRFPressureSettingViewModel.PrAlarmWatchSetPointValue = tempRecipeStep.PrAlarmWatchTable;
  1980. //recipeRFPressureSettingViewModel.PIAlarmWatchSetPointValue = tempRecipeStep.PIAlarmWatchTable;
  1981. //recipeRFPressureSettingViewModel.C1AlarmWatchSetPointValue = tempRecipeStep.C1AlarmWatchTable;
  1982. //recipeRFPressureSettingViewModel.C2AlarmWatchSetPointValue = tempRecipeStep.C2AlarmWatchTable;
  1983. //recipeRFPressureSettingViewModel.VppAlarmWatchSetPointValue = tempRecipeStep.VppAlarmWatchTable;
  1984. //recipeRFPressureSettingViewModel.VdcAlarmWatchSetPointValue = tempRecipeStep.VdcAlarmWatchTable;
  1985. //if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeRFPressureSettingViewModel, null, "Recipe RF Setting"))
  1986. //{
  1987. // if (CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault() != null)
  1988. // {
  1989. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().RFSwitch = recipeRFPressureSettingViewModel.RFSwitch;
  1990. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().RFSetpoint = recipeRFPressureSettingViewModel.RFSetPointValue;
  1991. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().C1Setpoint = recipeRFPressureSettingViewModel.C1SetPointValue;
  1992. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().C2Setpoint = recipeRFPressureSettingViewModel.C2SetPointValue;
  1993. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().ForwardPowerAlarmWatchTable = recipeRFPressureSettingViewModel.ForwardPowerAlarmWatchSetPointValue;
  1994. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().PrAlarmWatchTable = recipeRFPressureSettingViewModel.PrAlarmWatchSetPointValue;
  1995. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().PIAlarmWatchTable = recipeRFPressureSettingViewModel.PIAlarmWatchSetPointValue;
  1996. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().C1AlarmWatchTable = recipeRFPressureSettingViewModel.C1AlarmWatchSetPointValue;
  1997. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().C2AlarmWatchTable = recipeRFPressureSettingViewModel.C2AlarmWatchSetPointValue;
  1998. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().VppAlarmWatchTable = recipeRFPressureSettingViewModel.VppAlarmWatchSetPointValue;
  1999. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().VdcAlarmWatchTable = recipeRFPressureSettingViewModel.VdcAlarmWatchSetPointValue;
  2000. // // SelectedRecipeStep.RFSetting = $"{recipeRFPressureSettingViewModel.RFSetPointValue}";
  2001. // }
  2002. //}
  2003. break;
  2004. case "Loader":
  2005. RecipeLoaderCommandViewModel recipeLoaderCommandViewModel = new RecipeLoaderCommandViewModel();
  2006. tempStep = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault();
  2007. recipeLoaderCommandViewModel.SelectedCmd = tempStep.LoaderCommand.Value;
  2008. if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeLoaderCommandViewModel, null, "Loader Command"))
  2009. {
  2010. if (tempStep.LoaderCommand.Value != recipeLoaderCommandViewModel.ReturnString)
  2011. {
  2012. ClearLoaderSetValue();
  2013. }
  2014. tempStep.LoaderCommand.SetValue(recipeLoaderCommandViewModel.ReturnString);
  2015. SelectedRecipeStep.LoaderCommand.SetValue(recipeLoaderCommandViewModel.ReturnString);
  2016. SetShowLoaderValuePanel(recipeLoaderCommandViewModel.ReturnString);
  2017. }
  2018. break;
  2019. case "Pressure":
  2020. RecipePressCommandViewModel recipePressCommandViewModel = new RecipePressCommandViewModel();
  2021. tempStep = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault();
  2022. recipePressCommandViewModel.SelectedCmd = tempStep.PressCommand.Value;
  2023. if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipePressCommandViewModel, null, "Press Command"))
  2024. {
  2025. tempStep.PressCommand.SetValue(recipePressCommandViewModel.ReturnString);
  2026. SelectedRecipeStep.PressCommand.SetValue(recipePressCommandViewModel.ReturnString);
  2027. SetShowPressPanel(recipePressCommandViewModel.ReturnString);
  2028. }
  2029. break;
  2030. case "PressureWait":
  2031. RecipePressureWaitViewModel recipePressureWaitViewModel = new RecipePressureWaitViewModel();
  2032. tempStep = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault();
  2033. var destinationStep = (Step)CloneUtil.CloneObject(tempStep);
  2034. destinationStep.StepNo = tempStep.StepNo;
  2035. destinationStep.PressWaitUnit.SetValue((string)QueryDataClient.Instance.Service.GetConfig($"PM1.APC.PressureUnit"));
  2036. recipePressureWaitViewModel.SelectedStep = destinationStep;
  2037. if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipePressureWaitViewModel, null, "Press WaitSet"))
  2038. {
  2039. tempStep.PressIsWait = recipePressureWaitViewModel.SelectedStep.PressIsWait;
  2040. tempStep.PressLowWait = recipePressureWaitViewModel.SelectedStep.PressLowWait;
  2041. tempStep.PressHighWait = recipePressureWaitViewModel.SelectedStep.PressHighWait;
  2042. tempStep.PressWaitUnit = recipePressureWaitViewModel.SelectedStep.PressWaitUnit;
  2043. }
  2044. break;
  2045. case "Pattern":
  2046. if (SelectedRecipeStep != null)
  2047. {
  2048. string toolType = (string)QueryDataClient.Instance.Service.GetConfig("System.SetUp.ToolType");
  2049. isEditMFC = true;
  2050. if (ConstantsCommon.ELK.Equals(toolType))
  2051. {
  2052. using (FurnaceUI.Views.Editors.ELK.RecipeGasPanelSettingViewModel recipeGasPanelSettingViewModel = new FurnaceUI.Views.Editors.ELK.RecipeGasPanelSettingViewModel())
  2053. {
  2054. recipeGasPanelSettingViewModel.CurrentRecipe = CurrentRecipe;
  2055. recipeGasPanelSettingViewModel.SelectedStepName = $"{SelectedRecipeStep.StepNo}:{SelectedRecipeStep.Name}";
  2056. recipeGasPanelSettingViewModel.ChangedStepEvent += RecipeGasPanelSettingViewModel_ChangedStepEvent;
  2057. recipeGasPanelSettingViewModel.SelectedStep = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault();
  2058. bool rtn = (bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeGasPanelSettingViewModel, null, "Valve");
  2059. if (rtn)
  2060. {
  2061. isEditMFC = false;
  2062. }
  2063. }
  2064. }
  2065. else if (ConstantsCommon.SIBCN.Equals(toolType))
  2066. {
  2067. using (FurnaceUI.Views.Editors.SiBCN.RecipeGasPanelSettingViewModel recipeGasPanelSettingViewModel = new FurnaceUI.Views.Editors.SiBCN.RecipeGasPanelSettingViewModel())
  2068. {
  2069. recipeGasPanelSettingViewModel.CurrentRecipe = CurrentRecipe;
  2070. recipeGasPanelSettingViewModel.SelectedStepName = $"{SelectedRecipeStep.StepNo}:{SelectedRecipeStep.Name}";
  2071. recipeGasPanelSettingViewModel.ChangedStepEvent += RecipeGasPanelSettingViewModel_ChangedStepEvent;
  2072. recipeGasPanelSettingViewModel.SelectedStep = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault();
  2073. bool rtn = (bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeGasPanelSettingViewModel, null, "Valve");
  2074. if (rtn)
  2075. {
  2076. isEditMFC = false;
  2077. }
  2078. }
  2079. }
  2080. else if (ConstantsCommon.TiN.Equals(toolType))
  2081. {
  2082. using (FurnaceUI.Views.Editors.TiN.RecipeGasPanelSettingViewModel recipeGasPanelSettingViewModel = new FurnaceUI.Views.Editors.TiN.RecipeGasPanelSettingViewModel())
  2083. {
  2084. recipeGasPanelSettingViewModel.CurrentRecipe = CurrentRecipe;
  2085. recipeGasPanelSettingViewModel.SelectedStepName = $"{SelectedRecipeStep.StepNo}:{SelectedRecipeStep.Name}";
  2086. recipeGasPanelSettingViewModel.ChangedStepEvent += RecipeGasPanelSettingViewModel_ChangedStepEvent;
  2087. recipeGasPanelSettingViewModel.SelectedStep = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault();
  2088. bool rtn = (bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeGasPanelSettingViewModel, null, "Valve");
  2089. if (rtn)
  2090. {
  2091. isEditMFC = false;
  2092. }
  2093. }
  2094. }
  2095. else
  2096. {
  2097. RecipeGasPanelSettingViewModel recipeGasPanelSettingViewModel = new RecipeGasPanelSettingViewModel();
  2098. recipeGasPanelSettingViewModel.CurrentRecipe = CurrentRecipe;
  2099. recipeGasPanelSettingViewModel.SelectedStepName = $"{SelectedRecipeStep.StepNo}:{SelectedRecipeStep.Name}";
  2100. recipeGasPanelSettingViewModel.ChangedStepEvent += RecipeGasPanelSettingViewModel_ChangedStepEvent;
  2101. recipeGasPanelSettingViewModel.SelectedStep = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault();
  2102. if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeGasPanelSettingViewModel, null, "Valve"))
  2103. {
  2104. }
  2105. }
  2106. }
  2107. break;
  2108. case "BoatElevatorSetting":
  2109. //BoatElevatorSettingViewModel boatElevatorSettingViewModel = new BoatElevatorSettingViewModel();
  2110. //boatElevatorSettingViewModel.SelectedRecipeStep = SelectedRecipeStep;
  2111. //if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(boatElevatorSettingViewModel, null, "BoatElevator Setting"))
  2112. //{
  2113. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().ZAxisPosition = boatElevatorSettingViewModel.SelectedRecipeStep.ZAxisPosition;
  2114. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().ZAxisSpeed = boatElevatorSettingViewModel.SelectedRecipeStep.ZAxisSpeed;
  2115. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().RotatePosition = boatElevatorSettingViewModel.SelectedRecipeStep.RotatePosition;
  2116. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().RotateSpeed = boatElevatorSettingViewModel.SelectedRecipeStep.RotateSpeed;
  2117. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().RotateInterval = boatElevatorSettingViewModel.SelectedRecipeStep.RotateInterval;
  2118. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().RotateDirection = boatElevatorSettingViewModel.SelectedRecipeStep.RotateDirection;
  2119. //}
  2120. break;
  2121. case "AUX":
  2122. if (SelectedRecipeStep == null || SelectedRecipeStep.AUXSets.Count == 0)
  2123. { return; }
  2124. RecipeAUXSetViewModel recipeAUXSetViewModel = new RecipeAUXSetViewModel();
  2125. recipeAUXSetViewModel.AUXDataList = SelectedRecipeStep.AUXSets;
  2126. if (!(bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeAUXSetViewModel, null, "AUX Set"))
  2127. {
  2128. // SelectedRecipeStep.UndoAUXChanges();
  2129. }
  2130. break;
  2131. case "RecipeHeader":
  2132. RecipeHeaderViewModel recipeHeaderViewModel = new RecipeHeaderViewModel();
  2133. recipeHeaderViewModel.CombinationData = new Combination(CurrentRecipe.ConfigItems);
  2134. if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeHeaderViewModel, null, "Recipe Header"))
  2135. {
  2136. recipeHeaderViewModel.CombinationData.SetValueToParam();
  2137. }
  2138. break;
  2139. case "Combination":
  2140. RecipeCombinationViewModel recipeCombinationViewModel = new RecipeCombinationViewModel();
  2141. recipeCombinationViewModel.CombinationData = new Combination(CurrentRecipe.ConfigItems);
  2142. recipeCombinationViewModel.CombinationData.ChangedValueEvent += CombinationData_ChangedValueEvent;
  2143. if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeCombinationViewModel, null, "Combination"))
  2144. {
  2145. recipeCombinationViewModel.CombinationData.SetValueToParam();
  2146. }
  2147. break;
  2148. case "VPDataList":
  2149. RecipeVPItemSelectViewModel recipeVPItemSelectViewModel = new RecipeVPItemSelectViewModel();
  2150. if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeVPItemSelectViewModel, null, "VP Item Select"))
  2151. {
  2152. }
  2153. break;
  2154. case "AbortRecipe":
  2155. Step currentStep = CurrentRecipe.Steps.FirstOrDefault(x => x.StepNo == SelectedRecipeStep.StepNo);
  2156. StringParam abortCombination = CurrentRecipe.ConfigItems.FirstOrDefault(x => x.Name == "Combination.AbortRecipe") as StringParam;
  2157. if (string.IsNullOrEmpty(abortCombination.Value))
  2158. {
  2159. DialogBox.ShowError("Please select abort recipe first!");
  2160. }
  2161. var retRecipe = RecipeTableSelect.ShowDialog($"Furnace\\abort", abortCombination.Value, false);
  2162. if (!string.IsNullOrEmpty(retRecipe))
  2163. {
  2164. currentStep.AbortRecipeTableIndex = retRecipe;
  2165. SelectedRecipeStep.AbortRecipeTableIndex = retRecipe;
  2166. }
  2167. break;
  2168. case "SkipOrWait":
  2169. RecipeSkipWaitCommandViewModel recipeSkipWaitCommandViewModel = new RecipeSkipWaitCommandViewModel();
  2170. recipeSkipWaitCommandViewModel.SkipWait = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().SkipWait;
  2171. if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeSkipWaitCommandViewModel, null, "Skip or wait command"))
  2172. {
  2173. CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().SkipWait = recipeSkipWaitCommandViewModel.RtnString;
  2174. SelectedRecipeStep.SkipWait = recipeSkipWaitCommandViewModel.RtnString;
  2175. }
  2176. break;
  2177. default:
  2178. break;
  2179. }
  2180. }
  2181. private void CombinationData_ChangedValueEvent(string type, string value)
  2182. {
  2183. string prefix = "";
  2184. switch (type)
  2185. {
  2186. case "SubRecipe":
  2187. break;
  2188. case "AlarmRecipe":
  2189. break;
  2190. case "AbortRecipePath":
  2191. break;
  2192. case "AlarmCondition":
  2193. break;
  2194. case "LeakCheck":
  2195. break;
  2196. case "PressAPCPID":
  2197. prefix = $"Parameter\\APCPID";
  2198. var pressAPCDictData = LoadData(prefix, value);
  2199. foreach (var item in CurrentRecipe.Steps)
  2200. {
  2201. if (item.PressPID.Value.Contains(","))
  2202. {
  2203. var pidList = item.PressPID.Value.Split(',');
  2204. if (pidList.Count() > 2)
  2205. {
  2206. pidList[0] = $"{prefix}\\{value}";
  2207. int pressAPCTempNo = 0;
  2208. int.TryParse(pidList[1], out pressAPCTempNo);
  2209. if (pressAPCDictData != null && pressAPCDictData.ContainsKey(pressAPCTempNo))
  2210. {
  2211. pidList[2] = pressAPCDictData[pressAPCTempNo];
  2212. }
  2213. item.PressPID.Value = string.Join(",", pidList);
  2214. }
  2215. }
  2216. }
  2217. break;
  2218. case "TempCorrection":
  2219. prefix = $"Parameter\\TempCorrection";
  2220. var tempCorDictData = LoadData(prefix, value);
  2221. foreach (var item in CurrentRecipe.Steps)
  2222. {
  2223. if (item.TemperatureCorrect.Value.Contains(","))
  2224. {
  2225. var pidList = item.TemperatureCorrect.Value.Split(',');
  2226. if (pidList.Count() > 2)
  2227. {
  2228. pidList[0] = $"{prefix}\\{value}";
  2229. int tempCorTempNo = 0;
  2230. int.TryParse(pidList[1], out tempCorTempNo);
  2231. if (tempCorDictData != null && tempCorDictData.ContainsKey(tempCorTempNo))
  2232. {
  2233. pidList[2] = tempCorDictData[tempCorTempNo];
  2234. }
  2235. item.TemperatureCorrect.Value = string.Join(",", pidList);
  2236. }
  2237. }
  2238. }
  2239. break;
  2240. case "TempPID":
  2241. prefix = $"Parameter\\TempPID";
  2242. var tempPIDDictData = LoadData(prefix, value);
  2243. foreach (var item in CurrentRecipe.Steps)
  2244. {
  2245. if (item.TemperaturePID.Value.Contains(","))
  2246. {
  2247. var pidList = item.TemperaturePID.Value.Split(',');
  2248. if (pidList.Count() > 2)
  2249. {
  2250. pidList[0] = $"{prefix}\\{value}";
  2251. int tempTempNo = 0;
  2252. int.TryParse(pidList[1], out tempTempNo);
  2253. if (tempPIDDictData != null && tempPIDDictData.ContainsKey(tempTempNo))
  2254. {
  2255. pidList[2] = tempPIDDictData[tempTempNo];
  2256. }
  2257. }
  2258. item.TemperaturePID.Value = string.Join(",", pidList);
  2259. }
  2260. }
  2261. break;
  2262. case "ProfileCondition":
  2263. break;
  2264. default:
  2265. break;
  2266. }
  2267. }
  2268. public TempPIDParameterData CurrentParameter { get; set; } = new TempPIDParameterData();
  2269. private readonly ParameterProvider _parameterProvider = new ParameterProvider();
  2270. private Dictionary<int, string> LoadData(string PrefixPath, string name)
  2271. {
  2272. var recipeContent = _parameterProvider.LoadParameter(PrefixPath, name);
  2273. if (string.IsNullOrEmpty(recipeContent))
  2274. {
  2275. System.Windows.MessageBox.Show($"{PrefixPath}\\{name} is empty, please confirm the file is valid.");
  2276. return null;
  2277. }
  2278. var parameter = new TempPIDParameterData();
  2279. parameter.PrefixPath = PrefixPath;
  2280. parameter.Name = name;
  2281. parameter.InitData(PrefixPath, name, recipeContent, "");
  2282. var dictData = new Dictionary<int, string>();
  2283. if (parameter != null && parameter.Steps.Count > 0)
  2284. {
  2285. foreach (var item in parameter.Steps)
  2286. {
  2287. dictData.Add(item.StepNo, item.Name);
  2288. }
  2289. }
  2290. return dictData;
  2291. }
  2292. public void LowPressWaitTextChanged(object sender, object item)
  2293. {
  2294. if (SelectedRecipeStep == null)
  2295. {
  2296. DialogBox.ShowWarning("The current step is empty!");
  2297. return;
  2298. }
  2299. SelectExistViewModel selectExistViewModel = new SelectExistViewModel();
  2300. selectExistViewModel.ProductZeroStr = SelectedRecipeStep.PressLowPressWait.Value;
  2301. var windowManager = IoC.Get<IWindowManager>();
  2302. var dialogReturn = (bool)(windowManager as WindowManager)?.ShowDialogWithTitle(selectExistViewModel, null, "Select");
  2303. if ((bool)dialogReturn)
  2304. {
  2305. SelectedRecipeStep.PressLowPressWait.SetValue(selectExistViewModel.DialogResultString);
  2306. }
  2307. }
  2308. public void UpdateTotalTime()
  2309. {
  2310. if (CurrentRecipe != null && CurrentRecipe.ConfigItems != null)
  2311. {
  2312. var param = CurrentRecipe.ConfigItems.FirstOrDefault(x => x.Name == "RecipeTime");
  2313. string outAlarmSet = "0";
  2314. if (param != null && param is StringParam)
  2315. {
  2316. List<double> timeList = new List<double>();
  2317. foreach (var item in CurrentRecipe.Steps)
  2318. {
  2319. var timeStr = item.Time;
  2320. if (timeStr != null)
  2321. {
  2322. double hhTime = 0;
  2323. double mmTime = 0;
  2324. double ssTime = 0;
  2325. var strs = timeStr.Split(':');
  2326. if (strs.Length < 3) continue;
  2327. double.TryParse(strs[0], out hhTime);
  2328. double.TryParse(strs[1], out mmTime);
  2329. double.TryParse(strs[2], out ssTime);
  2330. timeList.Add(hhTime * 3600 + mmTime * 60 + ssTime);
  2331. }
  2332. else
  2333. {
  2334. continue;
  2335. }
  2336. }
  2337. string sumValue = timeList.ToArray().Sum().ToString();
  2338. if (((StringParam)param).Value != sumValue)
  2339. {
  2340. ((StringParam)param).Value = sumValue;
  2341. //outAlarmSet = (timeList.ToArray().Sum() * 10).ToString();
  2342. }
  2343. }
  2344. var paramTimeOut = CurrentRecipe.ConfigItems.FirstOrDefault(x => x.Name == "TimeOutAlarmSet");
  2345. if (paramTimeOut != null && param is DoubleParam)
  2346. {
  2347. if (outAlarmSet != "0")
  2348. {
  2349. ((DoubleParam)paramTimeOut).Value = outAlarmSet;
  2350. }
  2351. }
  2352. }
  2353. }
  2354. public void RecipeSave()
  2355. {
  2356. List<string> noNeedEndRecipeType = new List<string>() {
  2357. "reset",
  2358. "idle",
  2359. "abort",
  2360. "sub",
  2361. "alarm",
  2362. };
  2363. var SelectedStep = this.CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault();
  2364. //if (SelectedStep != null)
  2365. //{
  2366. // SelectedStep.LoaderValue = GetSaveLoaderValue(SelectedStep.LoaderCommand);
  2367. // SelectedStep.PressValue = GetSavePressValue(SelectedStep.PressCommand);
  2368. //}
  2369. RecipePermissionSelectViewModel dialog = new RecipePermissionSelectViewModel("Save recipe and permission", CurrentRecipe.RecipePermission, CurrentRecipe.Description);
  2370. WindowManager wm = new WindowManager();
  2371. bool? dialogReturn = wm.ShowDialog(dialog);
  2372. if (!dialogReturn.HasValue || !dialogReturn.Value)
  2373. return;
  2374. this.CurrentRecipe.ReviseTime = DateTime.Now;
  2375. CurrentRecipe.Description = dialog.RecipeComment;
  2376. InvokeClient.Instance.Service.DoOperation("SetRecipeEditHistory", this.CurrentRecipe.GetRecipeHistory());
  2377. List<string> names = new List<string>();
  2378. string filmFormula = string.Empty;
  2379. Step step = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault();
  2380. if (string.IsNullOrEmpty(CurrentRecipe.Name))
  2381. {
  2382. DialogBox.ShowWarning("Recipe name is empty,can not save!");
  2383. return;
  2384. }
  2385. bool bStandby = false, bEnd;
  2386. foreach (Step recipestep in CurrentRecipe.Steps)
  2387. {
  2388. if (recipestep.StepNo == 0)
  2389. bStandby = true;
  2390. //DialogBox.ShowWarning($"{recipestep.TemperatureControlMode}");
  2391. //DialogBox.ShowWarning($"{recipestep.TemperatureCorrect}");
  2392. //DialogBox.ShowWarning($"{recipestep.TemperaturePID}");
  2393. //if (string.IsNullOrEmpty(filmFormula))
  2394. // filmFormula = recipestep.FilmThickFormula;
  2395. //if (filmFormula != recipestep.FilmThickFormula)
  2396. //{
  2397. // DialogBox.ShowWarning($"The step film thicknesss formula of step number {recipestep.StepNo} is different,can not save!");
  2398. // return;
  2399. //}
  2400. if (string.IsNullOrEmpty(recipestep.Name) || string.IsNullOrEmpty(recipestep.Time))
  2401. {
  2402. if (recipestep.Name != "Standby")
  2403. {
  2404. DialogBox.ShowWarning($"The step name or time of step number {recipestep.StepNo} is empty,can not save!");
  2405. return;
  2406. }
  2407. }
  2408. if (names.Where(x => x == recipestep.Name).FirstOrDefault() != null)
  2409. {
  2410. DialogBox.ShowWarning("Step name cannot be duplicated!");
  2411. return;
  2412. }
  2413. names.Add(recipestep.Name);
  2414. bEnd = bStandby ? recipestep.StepNo == CurrentRecipe.Steps.Count - 1 : recipestep.StepNo == CurrentRecipe.Steps.Count;
  2415. //// "reset/Idle/abort/sub"类型的Recipe不需要End结尾
  2416. if (bEnd == true && noNeedEndRecipeType.Contains(CurrentRecipe.RecipeChamberType.ToLower()))
  2417. {
  2418. bEnd = false;
  2419. }
  2420. //是否是最后一步
  2421. if (bEnd)
  2422. {
  2423. if (!recipestep.Name.ToUpper().Contains("END"))
  2424. {
  2425. DialogBox.ShowWarning("The step command of last step must be 'END',please check!");
  2426. return;
  2427. }
  2428. }
  2429. }
  2430. // step.SetStepValues(SelectedRecipeStep);
  2431. this.CurrentRecipe.Revisor = BaseApp.Instance.UserContext.LoginName;
  2432. this.CurrentRecipe.ReviseTime = DateTime.Now;
  2433. this.CurrentRecipe.RecipeLevel = this.LevelDisplay;
  2434. this.CurrentRecipe.RecipePermission = dialog.RecipeComment;
  2435. UpdateTotalTime();
  2436. var result = this._recipeProvider.SaveRecipe(CurrentRecipe.PrefixPath, CurrentRecipe.Name, CurrentRecipe.GetXmlString());
  2437. if (result)
  2438. {
  2439. ((Window)GetView()).DialogResult = true;
  2440. }
  2441. }
  2442. public List<ConfigNode> GetMfcItem()
  2443. {
  2444. this.SystemName = "System";
  2445. ConfigNodes = SystemConfigProvider.Instance.GetConfigTree(SystemName).SubNodes;
  2446. var MfcItems = ConfigNodes.Where(x => x.Display == "Parameter").FirstOrDefault().SubNodes.Where(y => y.Name == "MFC").FirstOrDefault().SubNodes;
  2447. return MfcItems;
  2448. }
  2449. public void RecipeCancel()
  2450. {
  2451. if (DialogBox.ShowDialog(DialogButton.Yes | DialogButton.No, DialogType.CONFIRM, " You confirm that you want to unsave the recipe and exit the interface?") == DialogButton.No)
  2452. return;
  2453. ((Window)GetView()).DialogResult = false;
  2454. }
  2455. public void PressPIDChick()
  2456. {
  2457. var windowManager = IoC.Get<IWindowManager>();
  2458. StringParam pressAPC = CurrentRecipe.ConfigItems.FirstOrDefault(x => x.Name == "Combination.PressAPCPID") as StringParam;
  2459. if (pressAPC == null)
  2460. {
  2461. DialogBox.ShowDialog(DialogButton.Cancel, DialogType.INFO, "Please set the combination file first");
  2462. return;
  2463. }
  2464. APCPIDEditViewModel aPCPIDEditViewModel = new APCPIDEditViewModel();
  2465. aPCPIDEditViewModel.IsEditEnabled = false;
  2466. aPCPIDEditViewModel.CurrentRecipe = CurrentRecipe;
  2467. var rtn = (windowManager as WindowManager)?.ShowDialogWithTitle(aPCPIDEditViewModel, null, "APC PID Table");
  2468. if ((bool)rtn && SelectedRecipeStep != null)
  2469. SelectedRecipeStep.PressPID.SetValue(aPCPIDEditViewModel.RetrunString);
  2470. }
  2471. protected override void InvokeAfterUpdateProperty(Dictionary<string, object> data)
  2472. {
  2473. base.InvokeAfterUpdateProperty(data);
  2474. if (SelectedRecipeStep != null)
  2475. {
  2476. if (CurrentRecipe.RecipeChamberType == RecipeDataBase.ProcessType)
  2477. {
  2478. SelectIndex = SelectedRecipeStep.StepNo + 1;
  2479. }
  2480. else
  2481. {
  2482. SelectIndex = SelectedRecipeStep.StepNo;
  2483. }
  2484. }
  2485. if (CurrentRecipe.Steps != null && CurrentRecipe.Steps.Count > 0 && CheckValueChange(data))
  2486. {
  2487. // UpdateRecipeGASSetting(data);
  2488. //SelectStep(CurrentRecipe.Steps[EditRecipeStepNo]);
  2489. }
  2490. // UpdateGASSetting();
  2491. oldresult = data;
  2492. SetCmdIsEnabled();
  2493. }
  2494. Dictionary<string, object> oldresult;
  2495. private bool CheckValueChange(Dictionary<string, object> result)
  2496. {
  2497. Dictionary<string, object> temp = result;
  2498. if (oldresult == null)
  2499. {
  2500. oldresult = result;
  2501. return true;
  2502. }
  2503. else
  2504. {
  2505. List<string> strkeys = new List<string>();
  2506. foreach (var key in result.Keys)
  2507. {
  2508. if (_subscribedKeys.Contains(key) && oldresult.ContainsKey(key) && result.ContainsKey(key))
  2509. {
  2510. if (result[key].GetType() == typeof(AITValveData) && ((AITValveData)oldresult[key]).VirtualFeedback != ((AITValveData)result[key]).VirtualFeedback)
  2511. {
  2512. return true;
  2513. }
  2514. else if (result[key].GetType() == typeof(AITMfcData) && ((AITMfcData)oldresult[key]).VirtualSetPoint != ((AITMfcData)result[key]).VirtualSetPoint)
  2515. {
  2516. return true;
  2517. }
  2518. else if (result[key].GetType() == typeof(bool) && (bool)oldresult[key] != (bool)result[key])
  2519. {
  2520. return true;
  2521. }
  2522. }
  2523. }
  2524. }
  2525. return false;
  2526. }
  2527. public void SetValue(object sender)
  2528. {
  2529. string value = ((TextBox)sender).Text;
  2530. NumberKeyboard fullKeyboard = new NumberKeyboard("", value);
  2531. if ((bool)fullKeyboard.ShowDialog())
  2532. {
  2533. ((TextBox)sender).Text = fullKeyboard.ValueString;
  2534. }
  2535. }
  2536. public void SetValue(object sender, string isFullKeyboard = "")
  2537. {
  2538. string value = ((TextBox)sender).Text;
  2539. if (!string.IsNullOrEmpty(isFullKeyboard))
  2540. {
  2541. FullKeyboard fullKeyboard1 = new FullKeyboard("", value);
  2542. if ((bool)fullKeyboard1.ShowDialog())
  2543. {
  2544. ((TextBox)sender).Text = fullKeyboard1.ValueString;
  2545. }
  2546. }
  2547. else
  2548. {
  2549. NumberKeyboard fullKeyboard = new NumberKeyboard("", value);
  2550. if ((bool)fullKeyboard.ShowDialog())
  2551. {
  2552. ((TextBox)sender).Text = fullKeyboard.ValueString;
  2553. }
  2554. }
  2555. }
  2556. public void MFCTextChanged(string type, object sender, object item)
  2557. {
  2558. if (!string.IsNullOrEmpty(type) && item != null && sender != null)
  2559. {
  2560. if (isEditMFC) return;
  2561. MFCData mFCData = (MFCData)item;
  2562. string value = ((TextBox)sender).Text;
  2563. switch (type)
  2564. {
  2565. case "Value":
  2566. InvokeClient.Instance.Service.DoOperation($"PM1.{mFCData.ControlName}.SetMfcVirtualValue", $"{value};{mFCData.Rampng.Value};{mFCData.AlarmValue}");
  2567. break;
  2568. case "Rampng":
  2569. InvokeClient.Instance.Service.DoOperation($"PM1.{mFCData.ControlName}.SetMfcVirtualValue", $"{mFCData.SetValue.Value};{value};{mFCData.AlarmValue}");
  2570. SetRampngValue(mFCData.DisplayName, value);
  2571. break;
  2572. default:
  2573. break;
  2574. }
  2575. }
  2576. }
  2577. public void PressTextChanged(string type, object sender, object item)
  2578. {
  2579. if (!string.IsNullOrEmpty(type) && item != null && sender != null)
  2580. {
  2581. Step step = (Step)item;
  2582. if (step.StepNo != OldStep.StepNo)
  2583. {
  2584. return;
  2585. }
  2586. //string value = ((TextBox)sender).Text;
  2587. //switch (type)
  2588. //{
  2589. // case "PressSet":
  2590. // step.PressSet.IsSaved = false;
  2591. // break;
  2592. // case "PressSlowVacSet":
  2593. // step.PressSlowVacSet.IsSaved = false;
  2594. // break;
  2595. // case "PressValveAngleSet":
  2596. // step.PressValveAngleSet.IsSaved = false;
  2597. // break;
  2598. // case "PressLowPressWait":
  2599. // step.PressLowPressWait.IsSaved = false;
  2600. // break;
  2601. // case "WaitPress":
  2602. // step.WaitPress.IsSaved = false;
  2603. // break;
  2604. // default:
  2605. // break;
  2606. //}
  2607. }
  2608. }
  2609. //public void PressValidated(string type, object sender, object item)
  2610. //{
  2611. // if (!string.IsNullOrEmpty(type) && item != null && sender != null)
  2612. // {
  2613. // Step step = (Step)item;
  2614. // if (step.StepNo != OldStep.StepNo)
  2615. // {
  2616. // return;
  2617. // }
  2618. // string value = ((TextBox)sender).Text;
  2619. // switch (type)
  2620. // {
  2621. // case "PressSet":
  2622. // step.PressSet.IsSaved = false;
  2623. // break;
  2624. // case "PressSlowVacSet":
  2625. // step.PressSlowVacSet.IsSaved = false;
  2626. // break;
  2627. // case "PressValveAngleSet":
  2628. // step.PressValveAngleSet.IsSaved = false;
  2629. // break;
  2630. // case "PressLowPressWait":
  2631. // step.PressLowPressWait.IsSaved = false;
  2632. // break;
  2633. // case "WaitPress":
  2634. // step.WaitPress.IsSaved = false;
  2635. // break;
  2636. // default:
  2637. // break;
  2638. // }
  2639. // }
  2640. //}
  2641. private void SetRampngValue(string name, string value)
  2642. {
  2643. if (double.TryParse(value, out double getValue))
  2644. {
  2645. var stepNo = 0;
  2646. if (!_isStandbyCheckedSelect)
  2647. stepNo = SelectedRecipeStep.StepNo;
  2648. var step = CurrentRecipe.Steps.Where(x => x.StepNo == stepNo).FirstOrDefault();
  2649. if (step != null)
  2650. {
  2651. var mfc = CurrentRecipe.Steps.Where(x => x.StepNo == stepNo).FirstOrDefault().MFCSets.FirstOrDefault(x => x.ControlName == name);
  2652. if (mfc != null)
  2653. {
  2654. mfc.Rampng.SetValue(value);
  2655. }
  2656. }
  2657. }
  2658. }
  2659. private void UpdateMFCShow()
  2660. {
  2661. var mfcDict = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().MFCSets;
  2662. foreach (var item in mfcDict)
  2663. {
  2664. //var mfc = MFCDataList.FirstOrDefault(x => x.Name == item.Key.Replace(".Flow", ""));
  2665. //if (mfc != null)
  2666. //{
  2667. // mfc.IsCheck = item.Value.IsCheck;
  2668. //}
  2669. }
  2670. }
  2671. private void UpdateRecipeGASSetting(Dictionary<string, object> result)
  2672. {
  2673. var stepNo = 0;
  2674. if (!_isStandbyCheckedSelect)
  2675. stepNo = SelectedRecipeStep.StepNo;
  2676. var step = CurrentRecipe.Steps.Where(x => x.StepNo == stepNo).FirstOrDefault();
  2677. if (step != null)
  2678. {
  2679. var mfcSets = CurrentRecipe.Steps.Where(x => x.StepNo == stepNo).FirstOrDefault().MFCSets;
  2680. var valveSets = CurrentRecipe.Steps.Where(x => x.StepNo == stepNo).FirstOrDefault().ValveSets;
  2681. foreach (var key in result.Keys)
  2682. {
  2683. //if (result[key].GetType() == typeof(AITValveData))
  2684. //{
  2685. // var valveData = (AITValveData)result[key];
  2686. // if (valveSets.ContainsKey(valveData.DeviceName))
  2687. // {
  2688. // valveSets[valveData.DeviceName] = valveData.VirtualFeedback ? "Open" : "Close";
  2689. // }
  2690. //}else
  2691. if (result[key].GetType() == typeof(AITMfcData))
  2692. {
  2693. var mfcData = (AITMfcData)result[key];
  2694. var name = $"{mfcData.DeviceName}.Flow";
  2695. var findMFC = mfcSets.FirstOrDefault(x => x.ControlName == name);
  2696. if (findMFC != null)
  2697. {
  2698. findMFC.SetValue.Value = mfcData.VirtualSetPoint.ToString();
  2699. findMFC.Rampng.Value = mfcData.VirtualRamping.ToString();
  2700. findMFC.AlarmValue = mfcData.VirtualAlarmWatchTable;
  2701. }
  2702. }
  2703. }
  2704. CurrentRecipe.Steps.Where(x => x.StepNo == stepNo).FirstOrDefault().MFCSets = mfcSets;
  2705. CurrentRecipe.Steps.Where(x => x.StepNo == stepNo).FirstOrDefault().ValveSets = valveSets;
  2706. }
  2707. }
  2708. private void UpdateGASSetting()
  2709. {
  2710. if (_isStandbyCheckedSelect)
  2711. return;
  2712. List<AITMfcData> mfcDatas = new List<AITMfcData>()
  2713. {
  2714. MFC1Data,
  2715. MFC2Data,
  2716. MFC3Data,
  2717. MFC4Data,
  2718. MFC5Data,
  2719. MFC6Data,
  2720. MFC7Data,
  2721. MFC8Data,
  2722. MFC9Data,
  2723. MFC10Data,
  2724. MFC11Data,
  2725. MFC12Data,
  2726. MFC13Data,
  2727. MFC14Data,
  2728. MFC15Data,
  2729. MFC16Data,
  2730. MFC17Data,
  2731. MFC31Data,
  2732. MFC32Data,
  2733. //MFC51Data,
  2734. };
  2735. for (int i = 0; i < mfcDatas.Count; i++)
  2736. {
  2737. if (SelectedRecipeStep != null)
  2738. {
  2739. if (mfcDatas[i] == null) continue;
  2740. var mfc = SelectedRecipeStep.MFCSets.FirstOrDefault(x => x.ControlName == mfcDatas[i].DeviceName);
  2741. mfc.SetValue.Value = mfcDatas[i].VirtualSetPoint.ToString();
  2742. mfc.Rampng.Value = mfcDatas[i].VirtualRamping.ToString();
  2743. }
  2744. }
  2745. }
  2746. public void SelecteTable()
  2747. {
  2748. CurrentRecipe.Tables.FirstOrDefault(x => x.Index == CurrentRecipe.TableIndex).TableData.Steps.Clear();
  2749. CurrentRecipe.Steps.ToList().ForEach(x =>
  2750. {
  2751. var tempStep = (Step)CloneUtil.CloneAllObject(x);
  2752. CurrentRecipe.Tables.FirstOrDefault(y => y.Index == CurrentRecipe.TableIndex).TableData.Steps.Add(tempStep);
  2753. });
  2754. CurrentRecipe.StepCloneChangedIndex();
  2755. int getIndex = RecipeTableSelect.ShowDialogGetTableIndex(CurrentRecipe, RecipeType);
  2756. //SelectStep(CurrentRecipe.Steps.FirstOrDefault());
  2757. if (getIndex != -1)
  2758. {
  2759. while (CurrentRecipe.Steps.Count > 0)
  2760. {
  2761. CurrentRecipe.Steps.RemoveAt(0);
  2762. }
  2763. CurrentRecipe.Tables.FirstOrDefault(x => x.Index == (getIndex + 1)).TableData.Steps.ToList().ForEach(x =>
  2764. {
  2765. Step tempStep = (Step)CloneUtil.CloneAllObject(x);
  2766. CurrentRecipe.SetDelegateEvent(tempStep);
  2767. CurrentRecipe.Steps.Add(tempStep);
  2768. });
  2769. NewSteps = new ObservableCollection<Step>(CurrentRecipe.Steps.Take(pageSize * currentPage).Skip(pageSize * (currentPage - 1)));
  2770. SelectStep(CurrentRecipe.Steps.FirstOrDefault());
  2771. }
  2772. }
  2773. private int currentPage = 1;
  2774. private int pageSize = 10;
  2775. private int totalPage = 0;
  2776. private ObservableCollection<Step> _newSteps = new ObservableCollection<Step>();
  2777. public ObservableCollection<Step> NewSteps
  2778. {
  2779. get
  2780. {
  2781. return _newSteps;
  2782. }
  2783. set
  2784. {
  2785. _newSteps = value;
  2786. NotifyOfPropertyChange(nameof(NewSteps));
  2787. }
  2788. }
  2789. public void PageLineTop()
  2790. {
  2791. if (currentPage <= 1)
  2792. {
  2793. return;
  2794. }
  2795. currentPage = currentPage - 1;
  2796. NewSteps = new ObservableCollection<Step>(CurrentRecipe.Steps.Take(pageSize * currentPage).Skip(pageSize * (currentPage - 1)));
  2797. IndexNoDefault = 9;
  2798. SelectStep(NewSteps[IndexNoDefault]);
  2799. RefreshUpdate();
  2800. }
  2801. public void PageTop()
  2802. {
  2803. if (IndexNoDefault == 0)
  2804. {
  2805. PageLineTop();
  2806. if (currentPage != 1)
  2807. {
  2808. IndexNoDefault = NewSteps.Count - 1;
  2809. }
  2810. return;
  2811. }
  2812. IndexNoDefault = IndexNoDefault - 1;
  2813. SelectStep(NewSteps[IndexNoDefault]);
  2814. RefreshUpdate();
  2815. }
  2816. public void PageDown()
  2817. {
  2818. if (IndexNoDefault == CurrentRecipe.Steps.Count || SelectedRecipeStep == CurrentRecipe.Steps.LastOrDefault())
  2819. {
  2820. return;
  2821. }
  2822. IndexNoDefault = IndexNoDefault + 1;
  2823. if ((IndexNoDefault % pageSize) == 0)
  2824. {
  2825. PageLineDown();
  2826. }
  2827. SelectStep(NewSteps[IndexNoDefault]);
  2828. RefreshUpdate();
  2829. }
  2830. public void PageLineDown()
  2831. {
  2832. if (currentPage >= GetTotalPage())
  2833. {
  2834. return;
  2835. }
  2836. currentPage = currentPage + 1;
  2837. NewSteps = new ObservableCollection<Step>(CurrentRecipe.Steps.Take(pageSize * currentPage).Skip(pageSize * (currentPage - 1)));
  2838. IndexNoDefault = 0;
  2839. SelectStep(NewSteps[IndexNoDefault]);
  2840. RefreshUpdate();
  2841. }
  2842. public int GetTotalPage()
  2843. {
  2844. var totalPage = CurrentRecipe.Steps.Count / pageSize;
  2845. if ((CurrentRecipe.Steps.Count % pageSize) > 0)
  2846. {
  2847. totalPage = totalPage + 1;
  2848. }
  2849. return totalPage;
  2850. }
  2851. public int GetcurrentPage()
  2852. {
  2853. var currentPage = IndexNoDefault / pageSize;
  2854. if ((IndexNoDefault % pageSize) > 0)
  2855. {
  2856. currentPage = currentPage + 1;
  2857. }
  2858. if (currentPage == 0) currentPage++;
  2859. return currentPage;
  2860. }
  2861. }
  2862. }