RecipeProcessEditViewModel.cs 137 KB

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