RecipeProcessEditViewModel.cs 137 KB

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