RecipeProcessEditViewModel.cs 136 KB

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