RecipeLayoutEditViewModel.cs 55 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263
  1. using Caliburn.Micro;
  2. using MECF.Framework.Common.CommonData;
  3. using MECF.Framework.Common.DataCenter;
  4. using MECF.Framework.UI.Client.CenterViews.Editors.Recipe;
  5. using MECF.Framework.UI.Client.ClientBase;
  6. using OpenSEMI.ClientBase;
  7. using System;
  8. using System.Collections.Generic;
  9. using System.Windows;
  10. using System.Windows.Media;
  11. using FurnaceUI.Models;
  12. using FurnaceUI.Views.Editors;
  13. using System.Windows.Controls;
  14. using FurnaceUI.Views.DataLog;
  15. using System.Linq;
  16. using RecipeEditorLib.RecipeModel.Params;
  17. using System.Collections.ObjectModel;
  18. using FurnaceUI.Client.Dialog;
  19. using SciChart.Core.Extensions;
  20. namespace FurnaceUI.Views.Recipes
  21. {
  22. public class RecipeLayoutEditViewModel : FurnaceUIViewModelBase
  23. {
  24. #region properties
  25. private string _recipeName;
  26. public string RecipeName
  27. {
  28. get => _recipeName;
  29. set
  30. {
  31. _recipeName = value;
  32. NotifyOfPropertyChange(nameof(RecipeName));
  33. }
  34. }
  35. public int FoupListMaxValue { get; set; }
  36. private int waferNumberP;
  37. public int WaferNumberP { get { return waferNumberP; } set { waferNumberP = value; NotifyOfPropertyChange(nameof(waferNumberP)); } }
  38. private int waferNumberSD;
  39. public int WaferNumberSD { get { return waferNumberSD; } set { waferNumberSD = value; NotifyOfPropertyChange(nameof(waferNumberSD)); } }
  40. private int waferNumberM;
  41. public int WaferNumberM { get { return waferNumberM; } set { waferNumberM = value; NotifyOfPropertyChange(nameof(waferNumberM)); } }
  42. private int currentItemIndex;
  43. private string SelectedSlotType { get; set; }
  44. private RecipeProvider _recipeProvider = new RecipeProvider();
  45. private SolidColorBrush _DefaultdBk = new SolidColorBrush(Colors.White);
  46. private SolidColorBrush _PBk = new SolidColorBrush(Colors.SkyBlue);
  47. private SolidColorBrush _SDBk = new SolidColorBrush(Colors.White);
  48. private SolidColorBrush _EDBk = new SolidColorBrush(Colors.Yellow);
  49. private SolidColorBrush _MBk = new SolidColorBrush(Colors.Pink);
  50. private SolidColorBrush _XDBk = new SolidColorBrush(Colors.White);
  51. private SolidColorBrush _TBk = new SolidColorBrush(Colors.DarkGreen);
  52. #endregion
  53. public RecipeDataLayout CurrentRecipe { get; set; } = new RecipeDataLayout();
  54. public RecipeLayoutEntityNormal NormalEntity { get { return CurrentRecipe.NormalSteps[0]; } set { CurrentRecipe.NormalSteps[0] = value; this.NotifyOfPropertyChange(nameof(NormalEntity)); } }
  55. public List<BoatWaferItem> BoatWafers { get { return CurrentRecipe.ExpertSteps[0].Items; } set { CurrentRecipe.ExpertSteps[0].Items = value; } }
  56. private bool _IsStandardPitchEnabled = true;
  57. public bool IsStandardPitchEnabled
  58. {
  59. get => _IsStandardPitchEnabled;
  60. set
  61. {
  62. _IsStandardPitchEnabled = value;
  63. NotifyOfPropertyChange(nameof(IsStandardPitchEnabled));
  64. }
  65. }
  66. private bool _IsDoublePitchEnabled;
  67. public bool IsDoublePitchEnabled
  68. {
  69. get => _IsDoublePitchEnabled;
  70. set
  71. {
  72. _IsDoublePitchEnabled = value;
  73. NotifyOfPropertyChange(nameof(IsDoublePitchEnabled));
  74. }
  75. }
  76. private bool _IsTriplePitchEnabled;
  77. public bool IsTriplePitchEnabled
  78. {
  79. get => _IsTriplePitchEnabled;
  80. set
  81. {
  82. _IsTriplePitchEnabled = value;
  83. NotifyOfPropertyChange(nameof(IsTriplePitchEnabled));
  84. }
  85. }
  86. public bool IsEnable => CGlobal.RecipeLayoutEditViewEnable;//是否是View模式
  87. private int _cassetteSlotCount;
  88. private TotalWaferNumberMode _totalWaferNumber = TotalWaferNumberMode.Total;
  89. public TotalWaferNumberMode TotalWaferNumber
  90. {
  91. get => _totalWaferNumber;
  92. set
  93. {
  94. _totalWaferNumber = value;
  95. NotifyOfPropertyChange(nameof(TotalWaferNumber));
  96. }
  97. }
  98. private string _totalWaferNumberValue = "";
  99. public string TotalWaferNumberValue
  100. {
  101. get => _totalWaferNumberValue;
  102. set
  103. {
  104. _totalWaferNumberValue = value;
  105. NotifyOfPropertyChange(nameof(TotalWaferNumberValue));
  106. }
  107. }
  108. private LayoutReplacement _setLayoutReplacement = LayoutReplacement.Upper;
  109. public LayoutReplacement SetLayoutReplacement
  110. {
  111. get => _setLayoutReplacement;
  112. set
  113. {
  114. _setLayoutReplacement = value;
  115. NotifyOfPropertyChange(nameof(SetLayoutReplacement));
  116. }
  117. }
  118. private string _setLayoutReplacementValue = "";
  119. public string SetLayoutReplacementValue
  120. {
  121. get => _setLayoutReplacementValue;
  122. set
  123. {
  124. _setLayoutReplacementValue = value;
  125. NotifyOfPropertyChange(nameof(SetLayoutReplacementValue));
  126. }
  127. }
  128. private MonitorTransferType _waferChargeMonitor1 = MonitorTransferType.AutoLayout;
  129. public MonitorTransferType WaferChargeMonitor1
  130. {
  131. get => _waferChargeMonitor1;
  132. set
  133. {
  134. _waferChargeMonitor1 = value;
  135. NotifyOfPropertyChange(nameof(WaferChargeMonitor1));
  136. }
  137. }
  138. private string _waferChargeMonitorValue1 = "";
  139. public string WaferChargeMonitorValue1
  140. {
  141. get => _waferChargeMonitorValue1;
  142. set
  143. {
  144. _waferChargeMonitorValue1 = value;
  145. NotifyOfPropertyChange(nameof(WaferChargeMonitorValue1));
  146. }
  147. }
  148. private MonitorTransferType _waferChargeMonitor2 = MonitorTransferType.AutoLayout;
  149. public MonitorTransferType WaferChargeMonitor2
  150. {
  151. get => _waferChargeMonitor2;
  152. set
  153. {
  154. _waferChargeMonitor2 = value;
  155. NotifyOfPropertyChange(nameof(WaferChargeMonitor2));
  156. }
  157. }
  158. private string _waferChargeMonitorValue2 = "";
  159. public string WaferChargeMonitorValue2
  160. {
  161. get => _waferChargeMonitorValue2;
  162. set
  163. {
  164. _waferChargeMonitorValue2 = value;
  165. NotifyOfPropertyChange(nameof(WaferChargeMonitorValue2));
  166. }
  167. }
  168. private string _fillDummyTransferStr = "None";
  169. public string FillDummyTransferStr
  170. {
  171. get => _fillDummyTransferStr;
  172. set
  173. {
  174. _fillDummyTransferStr = value;
  175. NotifyOfPropertyChange(nameof(FillDummyTransferStr));
  176. }
  177. }
  178. private string _productZeroStr;
  179. public string ProductZeroStr
  180. {
  181. get => _productZeroStr;
  182. set
  183. {
  184. _productZeroStr = value;
  185. NotifyOfPropertyChange(nameof(ProductZeroStr));
  186. }
  187. }
  188. private string _ProductTransferStr;
  189. public string ProductTransferStr
  190. {
  191. get => _ProductTransferStr;
  192. set
  193. {
  194. _ProductTransferStr = value;
  195. NotifyOfPropertyChange(nameof(ProductTransferStr));
  196. }
  197. }
  198. private MonitorReturnType _dialogResultmonitor1 = MonitorReturnType.ChargeSlot;
  199. public MonitorReturnType DialogResultmonitor1
  200. {
  201. get => _dialogResultmonitor1;
  202. set
  203. {
  204. _dialogResultmonitor1 = value;
  205. NotifyOfPropertyChange(nameof(DialogResultmonitor1));
  206. }
  207. }
  208. private MonitorReturnType _dialogResultmonitor2 = MonitorReturnType.ChargeSlot;
  209. public MonitorReturnType DialogResultmonitor2
  210. {
  211. get => _dialogResultmonitor2;
  212. set
  213. {
  214. _dialogResultmonitor2 = value;
  215. NotifyOfPropertyChange(nameof(DialogResultmonitor2));
  216. }
  217. }
  218. private string _yAxisModeStr = "Normal";
  219. public string YAxisModeStr
  220. {
  221. get => _yAxisModeStr;
  222. set
  223. {
  224. _yAxisModeStr = value;
  225. NotifyOfPropertyChange(nameof(YAxisModeStr));
  226. }
  227. }
  228. private int _topSlotNo = 149;
  229. public int TopSlotNo
  230. {
  231. get => _topSlotNo;
  232. set
  233. {
  234. _topSlotNo = value;
  235. NotifyOfPropertyChange(nameof(TopSlotNo));
  236. }
  237. }
  238. private int _upperSideDummyNum = 3;
  239. public int UpperSideDummyNum
  240. {
  241. get => _upperSideDummyNum;
  242. set
  243. {
  244. _upperSideDummyNum = value;
  245. NotifyOfPropertyChange(nameof(UpperSideDummyNum));
  246. }
  247. }
  248. private int _boatTotalSlot = 143;
  249. public int BoatTotalSlot
  250. {
  251. get => _boatTotalSlot;
  252. set
  253. {
  254. _boatTotalSlot = value;
  255. NotifyOfPropertyChange(nameof(BoatTotalSlot));
  256. }
  257. }
  258. private int _upperSDNum = 0;
  259. public int UpperSDNum
  260. {
  261. get => _upperSDNum;
  262. set
  263. {
  264. _upperSDNum = value;
  265. NotifyOfPropertyChange(nameof(UpperSDNum));
  266. }
  267. }
  268. private int _productNum = 0;
  269. public int ProductNum
  270. {
  271. get => _productNum;
  272. set
  273. {
  274. _productNum = value;
  275. NotifyOfPropertyChange(nameof(ProductNum));
  276. }
  277. }
  278. private int _monitorNum1 = 0;
  279. public int MonitorNum1
  280. {
  281. get => _monitorNum1;
  282. set
  283. {
  284. _monitorNum1 = value;
  285. NotifyOfPropertyChange(nameof(MonitorNum1));
  286. }
  287. }
  288. private int _monitorNum2 = 0;
  289. public int MonitorNum2
  290. {
  291. get => _monitorNum2;
  292. set
  293. {
  294. _monitorNum2 = value;
  295. NotifyOfPropertyChange(nameof(MonitorNum2));
  296. }
  297. }
  298. private int _lowerSDNum = 0;
  299. public int LowerSDNum
  300. {
  301. get => _lowerSDNum;
  302. set
  303. {
  304. _lowerSDNum = value;
  305. NotifyOfPropertyChange(nameof(LowerSDNum));
  306. }
  307. }
  308. private int _lowerSideDummyNum = 9;
  309. public int LowerSideDummyNum
  310. {
  311. get => _lowerSideDummyNum;
  312. set
  313. {
  314. _lowerSideDummyNum = value;
  315. NotifyOfPropertyChange(nameof(LowerSideDummyNum));
  316. }
  317. }
  318. private List<string> _boatMapWafers = new List<string>();
  319. public List<string> BoatMapWafers
  320. {
  321. get => _boatMapWafers;
  322. set
  323. {
  324. _boatMapWafers = value;
  325. NotifyOfPropertyChange(nameof(BoatMapWafers));
  326. }
  327. }
  328. public RecipeFormatBuilder ColumnBuilder { get; set; }
  329. public RecipeLayoutEditViewModel(string strPrefixPath, string strName, RecipeFormatBuilder columnBuilder, string permission = "")
  330. {
  331. FoupListMaxValue = (int)QueryDataClient.Instance.Service.GetConfig("Boat.SlotCount");
  332. _cassetteSlotCount = (int)QueryDataClient.Instance.Service.GetConfig("System.CassetteSlotCount");
  333. RecipeName = strName;
  334. ColumnBuilder = columnBuilder;
  335. LoadData(strPrefixPath, strName, permission);
  336. }
  337. private void LoadData(string strPrefixPath, string strName, string permission)
  338. {
  339. CurrentRecipe.Clear();
  340. CurrentRecipe.PrefixPath = strPrefixPath;
  341. CurrentRecipe.Name = strName;
  342. CurrentRecipe.RecipePermission = permission;
  343. var recipeContent = _recipeProvider.LoadRecipe(strPrefixPath, strName);
  344. if (string.IsNullOrEmpty(recipeContent))
  345. {
  346. System.Windows.MessageBox.Show($"{CurrentRecipe.PrefixPath}\\{CurrentRecipe.Name} is empty, please confirm the file is valid.");
  347. return;
  348. }
  349. CurrentRecipe.RecipeChamberType = "OriginChamber";
  350. CurrentRecipe.InitData(CurrentRecipe.PrefixPath, CurrentRecipe.Name, recipeContent, ColumnBuilder.Configs, "PM1");
  351. var waferNumberAll = (int)QueryDataClient.Instance.Service.GetConfig("Boat.SlotCount");
  352. var cassetteSlotCount = (int)QueryDataClient.Instance.Service.GetConfig("System.CassetteSlotCount");
  353. List<string> listWafers = QueryDataClient.Instance.Service.GetLayoutRecipeContent(CurrentRecipe.GetXmlString(), waferNumberAll.ToString(), cassetteSlotCount.ToString());
  354. BoatMapWafers = listWafers;
  355. if (CurrentRecipe.ExpertSteps.Count == 0 || CurrentRecipe.ExpertSteps[0].Items.Count <= 0)
  356. {
  357. RecipeLayoutEntityExpert expert = new RecipeLayoutEntityExpert();
  358. CurrentRecipe.ExpertSteps.Add(expert);
  359. for (int i = 0; i < FoupListMaxValue; i++)
  360. {
  361. BoatWaferItem item = new BoatWaferItem() { Slot = i + 1, Description = $"" };
  362. CurrentRecipe.ExpertSteps[0].Items.Add(item);
  363. }
  364. }
  365. if (CurrentRecipe.NormalSteps.Count == 0 || CurrentRecipe.ExpertSteps[0].Items.Count <= 0)
  366. {
  367. RecipeLayoutEntityNormal normal = new RecipeLayoutEntityNormal();
  368. CurrentRecipe.NormalSteps.Add(normal);
  369. }
  370. if (CurrentRecipe.ConfigItems != null && CurrentRecipe.ConfigItems.Count > 0)
  371. {
  372. var asd = CurrentRecipe.ConfigItems.Select(a => a.Name).ToList();
  373. if (CurrentRecipe.ConfigItems.Where(x => x.Name == "BoatTotalSlot").Count() > 0)
  374. {
  375. BoatTotalSlot = ((NumParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "BoatTotalSlot").FirstOrDefault()).Value;
  376. }
  377. if (CurrentRecipe.ConfigItems.Where(x => x.Name == "UpperSDNum").Count() > 0)
  378. {
  379. UpperSDNum = ((NumParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "UpperSDNum").FirstOrDefault()).Value;
  380. }
  381. if (CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductNum").Count() > 0)
  382. {
  383. ProductNum = ((NumParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductNum").FirstOrDefault()).Value;
  384. }
  385. if (CurrentRecipe.ConfigItems.Where(x => x.Name == "MonitorNum1").Count() > 0)
  386. {
  387. ProductNum = ((NumParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "MonitorNum1").FirstOrDefault()).Value;
  388. }
  389. if (CurrentRecipe.ConfigItems.Where(x => x.Name == "MonitorNum2").Count() > 0)
  390. {
  391. ProductNum = ((NumParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "MonitorNum2").FirstOrDefault()).Value;
  392. }
  393. if (CurrentRecipe.ConfigItems.Where(x => x.Name == "LowerSDNum").Count() > 0)
  394. {
  395. LowerSDNum = ((NumParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "LowerSDNum").FirstOrDefault()).Value;
  396. }
  397. if (CurrentRecipe.ConfigItems.Where(x => x.Name == "TopSlotNo").Count() > 0)
  398. {
  399. TopSlotNo = ((NumParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "TopSlotNo").FirstOrDefault()).Value;
  400. }
  401. if (CurrentRecipe.ConfigItems.Where(x => x.Name == "UpperSideDummyNum").Count() > 0)
  402. {
  403. UpperSideDummyNum = ((NumParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "UpperSideDummyNum").FirstOrDefault()).Value;
  404. }
  405. if (CurrentRecipe.ConfigItems.Where(x => x.Name == "BoatMapDecisionMethod").Count() > 0)
  406. {
  407. IsDispTypeEnabled = ((NumParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "BoatMapDecisionMethod").FirstOrDefault()).Value == 0 ? true : false;
  408. }
  409. if (CurrentRecipe.ConfigItems.Where(x => x.Name == "LowerSideDummyNum").Count() > 0)
  410. {
  411. LowerSideDummyNum = ((NumParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "LowerSideDummyNum").FirstOrDefault()).Value;
  412. }
  413. if (CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductAndFill").Count() > 0)
  414. {
  415. if (string.IsNullOrEmpty(((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductAndFill").FirstOrDefault()).Value))
  416. {
  417. TotalWaferNumber = TotalWaferNumberMode.Total;
  418. }
  419. else
  420. {
  421. TotalWaferNumber = (TotalWaferNumberMode)Enum.Parse(typeof(TotalWaferNumberMode), ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductAndFill").FirstOrDefault()).Value);
  422. }
  423. }
  424. if (CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductAndFillValue").Count() > 0)
  425. {
  426. if (!string.IsNullOrEmpty(((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductAndFillValue").FirstOrDefault()).Value))
  427. {
  428. TotalWaferNumberValue = ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductAndFillValue").FirstOrDefault()).Value;
  429. }
  430. }
  431. if (CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferSupplement").Count() > 0)
  432. {
  433. if (string.IsNullOrEmpty(((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferSupplement").FirstOrDefault()).Value))
  434. {
  435. SetLayoutReplacement = LayoutReplacement.Upper;
  436. }
  437. else
  438. {
  439. SetLayoutReplacement = (LayoutReplacement)Enum.Parse(typeof(LayoutReplacement), ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferSupplement").FirstOrDefault()).Value);
  440. }
  441. }
  442. if (CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferSupplementValue").Count() > 0)
  443. {
  444. if (!string.IsNullOrEmpty(((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferSupplementValue").FirstOrDefault()).Value))
  445. {
  446. SetLayoutReplacementValue = ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferSupplementValue").FirstOrDefault()).Value;
  447. }
  448. }
  449. if (CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferChargeMonitor1").Count() > 0)
  450. {
  451. if (string.IsNullOrEmpty(((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferChargeMonitor1").FirstOrDefault()).Value))
  452. {
  453. WaferChargeMonitor1 = MonitorTransferType.AutoLayout;
  454. }
  455. else
  456. {
  457. WaferChargeMonitor1 = (MonitorTransferType)Enum.Parse(typeof(MonitorTransferType), ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferChargeMonitor1").FirstOrDefault()).Value);
  458. }
  459. }
  460. if (CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferChargeMonitorValue1").Count() > 0)
  461. {
  462. if (!string.IsNullOrEmpty(((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferChargeMonitorValue1").FirstOrDefault()).Value))
  463. {
  464. WaferChargeMonitorValue1 = ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferChargeMonitorValue1").FirstOrDefault()).Value;
  465. }
  466. }
  467. if (CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferChargeMonitor2").Count() > 0)
  468. {
  469. if (string.IsNullOrEmpty(((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferChargeMonitor2").FirstOrDefault()).Value))
  470. {
  471. WaferChargeMonitor2 = MonitorTransferType.AutoLayout;
  472. }
  473. else
  474. {
  475. WaferChargeMonitor2 = (MonitorTransferType)Enum.Parse(typeof(MonitorTransferType), ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferChargeMonitor2").FirstOrDefault()).Value);
  476. }
  477. }
  478. if (CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferChargeMonitorValue2").Count() > 0)
  479. {
  480. if (!string.IsNullOrEmpty(((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferChargeMonitorValue2").FirstOrDefault()).Value))
  481. {
  482. WaferChargeMonitorValue2 = ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferChargeMonitorValue2").FirstOrDefault()).Value;
  483. }
  484. }
  485. if (CurrentRecipe.ConfigItems.Where(x => x.Name == "FillDummyTransfer").Count() > 0)
  486. {
  487. if (string.IsNullOrEmpty(((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "FillDummyTransfer").FirstOrDefault()).Value))
  488. {
  489. FillDummyTransferStr = "None";
  490. }
  491. else
  492. {
  493. FillDummyTransferStr = ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "FillDummyTransfer").FirstOrDefault()).Value;
  494. }
  495. }
  496. if (CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductZeroNotFill").Count() > 0)
  497. {
  498. if (string.IsNullOrEmpty(((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductZeroNotFill").FirstOrDefault()).Value))
  499. {
  500. ProductZeroStr = "None";
  501. }
  502. else
  503. {
  504. ProductZeroStr = ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductZeroNotFill").FirstOrDefault()).Value;
  505. }
  506. }
  507. if (CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductTransferPosition").Count() > 0)
  508. {
  509. if (string.IsNullOrEmpty(((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductTransferPosition").FirstOrDefault()).Value))
  510. {
  511. ProductTransferStr = "None";
  512. }
  513. else
  514. {
  515. ProductTransferStr = ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductTransferPosition").FirstOrDefault()).Value;
  516. }
  517. }
  518. if (CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferDischargeMonitor1").Count() > 0)
  519. {
  520. if (string.IsNullOrEmpty(((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferDischargeMonitor1").FirstOrDefault()).Value))
  521. {
  522. DialogResultmonitor1 = MonitorReturnType.ChargeSlot;
  523. }
  524. else
  525. {
  526. DialogResultmonitor1 = (MonitorReturnType)Enum.Parse(typeof(MonitorReturnType), ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferDischargeMonitor1").FirstOrDefault()).Value);
  527. }
  528. }
  529. if (CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferDischargeMonitor2").Count() > 0)
  530. {
  531. if (string.IsNullOrEmpty(((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferDischargeMonitor2").FirstOrDefault()).Value))
  532. {
  533. DialogResultmonitor2 = MonitorReturnType.ChargeSlot;
  534. }
  535. else
  536. {
  537. DialogResultmonitor2 = (MonitorReturnType)Enum.Parse(typeof(MonitorReturnType), ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferDischargeMonitor2").FirstOrDefault()).Value);
  538. }
  539. }
  540. }
  541. if (null != BoatMapWafers && BoatMapWafers.Count > 0)
  542. {
  543. var data = ComputSD(BoatMapWafers);
  544. LowerSDNum = data.Item1;
  545. UpperSDNum = data.Item2;
  546. ProductNum = listWafers.Where(x => x == "PD").Count();
  547. MonitorNum1 = listWafers.Where(x => x == "M1").Count();
  548. MonitorNum2 = listWafers.Where(x => x == "M2").Count();
  549. }
  550. }
  551. protected override void OnActivate()
  552. {
  553. base.OnActivate();
  554. }
  555. public void SetCommand(object obj)
  556. {
  557. WindowManager wm = new WindowManager();
  558. switch (obj.ToString())
  559. {
  560. case "Product Pos":
  561. RecipeProductPosViewModel viewProduct = new RecipeProductPosViewModel();
  562. viewProduct.NormalEntity = NormalEntity;
  563. wm.ShowDialogWithTitle(viewProduct, null, obj.ToString());
  564. SelectedSlotType = "";
  565. break;
  566. case "Monitor Pos":
  567. RecipeMonitorPosViewModel viewMonitor = new RecipeMonitorPosViewModel();
  568. viewMonitor.NormalEntity = NormalEntity;
  569. wm.ShowDialogWithTitle(viewMonitor, null, obj.ToString());
  570. SelectedSlotType = obj.ToString();
  571. break;
  572. case "All Clear":
  573. NormalEntity = new RecipeLayoutEntityNormal()
  574. {
  575. WhenPWaferShort = NormalEntity.WhenPWaferShort,
  576. SDRule = NormalEntity.SDRule,
  577. WhenCassetteInBatchAreShort = NormalEntity.WhenCassetteInBatchAreShort,
  578. WhenWaferInCassetteAreShort = NormalEntity.WhenWaferInCassetteAreShort,
  579. WhenEDAreShort = NormalEntity.WhenEDAreShort,
  580. RuleOfSpaceInBoat = NormalEntity.RuleOfSpaceInBoat,
  581. };
  582. foreach (var item in BoatWafers)
  583. {
  584. item.Description = "";
  585. }
  586. SelectedSlotType = obj.ToString();
  587. break;
  588. case "Wafer Charge Rule":
  589. RecipeWaferChargeRuleViewModel viewWaferChargeRule = new RecipeWaferChargeRuleViewModel();
  590. viewWaferChargeRule.NormalEntity = NormalEntity;
  591. wm.ShowDialogWithTitle(viewWaferChargeRule, null, obj.ToString());
  592. SelectedSlotType = obj.ToString();
  593. break;
  594. case "Product":
  595. //NormalEntity.ProductSlotNo = ProccessSlotNoPositionString("Add",NormalEntity.ProductSlotNo,currentItemIndex);
  596. //NormalEntity.MonitorSlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.MonitorSlotNo,currentItemIndex);
  597. SelectedSlotType = obj.ToString();
  598. break;
  599. case "Monitor":
  600. //NormalEntity.MonitorSlotNo = ProccessSlotNoPositionString("Add",NormalEntity.MonitorSlotNo, currentItemIndex);
  601. //NormalEntity.ProductSlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.ProductSlotNo, currentItemIndex);
  602. SelectedSlotType = obj.ToString();
  603. break;
  604. case "Space":
  605. //NormalEntity.ProductSlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.ProductSlotNo, currentItemIndex);
  606. //NormalEntity.MonitorSlotNo = ProccessSlotNoPositionString("Delete",NormalEntity.MonitorSlotNo, currentItemIndex);
  607. SelectedSlotType = obj.ToString();
  608. break;
  609. }
  610. }
  611. private string ProccessSlotNoPositionString(string strType, string str, int iCurrentItemIndex)
  612. {
  613. string strRet = "";
  614. if (iCurrentItemIndex <= 0) return strRet;
  615. string strOrgTemp = "," + str;
  616. string strDesTemp = "," + iCurrentItemIndex;
  617. string strComTemp = "," + iCurrentItemIndex + ",";
  618. if (strType == "Add")
  619. {
  620. if (!strOrgTemp.Contains(strComTemp))
  621. strOrgTemp = strOrgTemp + strDesTemp;
  622. }
  623. else
  624. {
  625. if (strOrgTemp.Contains(strDesTemp))
  626. strOrgTemp = strOrgTemp.Replace(strDesTemp, "");
  627. }
  628. strRet = strOrgTemp;
  629. for (int i = 0; i < 2; i++)
  630. {
  631. if (strRet.StartsWith(","))
  632. strRet = strRet.Substring(1);
  633. }
  634. return strRet;
  635. }
  636. public void TextSelectCmdMouseDown(string cmd, object sender)
  637. {
  638. var colsender = (TextBox)sender;
  639. WindowManager wm = new WindowManager();
  640. switch (cmd)
  641. {
  642. case "TotalWaferNumber":
  643. RecipeLayoutSetTotalWaferNumberViewModel recipeLayoutSetTotalWaferNumberViewModel = new RecipeLayoutSetTotalWaferNumberViewModel();
  644. recipeLayoutSetTotalWaferNumberViewModel.TotalWaferNumber = TotalWaferNumber;
  645. recipeLayoutSetTotalWaferNumberViewModel.ReturnValue = TotalWaferNumberValue;
  646. bool? dialogReturn = wm.ShowDialogWithTitle(recipeLayoutSetTotalWaferNumberViewModel, null, "WAP Logic Design");
  647. if ((bool)dialogReturn)
  648. {
  649. TotalWaferNumber = recipeLayoutSetTotalWaferNumberViewModel.DialogResultTotalWaferNumberMode;
  650. TotalWaferNumberValue = recipeLayoutSetTotalWaferNumberViewModel.ReturnValue;
  651. }
  652. break;
  653. case "Replacement":
  654. RecipeLayoutSetReplacementViewModel recipeLayoutSetReplacementViewModel = new RecipeLayoutSetReplacementViewModel();
  655. recipeLayoutSetReplacementViewModel.SetLayoutReplacement = SetLayoutReplacement;
  656. dialogReturn = wm.ShowDialogWithTitle(recipeLayoutSetReplacementViewModel, null, "File Wafer Replacement");
  657. if ((bool)dialogReturn)
  658. {
  659. SetLayoutReplacement = recipeLayoutSetReplacementViewModel.DialogResultLayoutReplacement;
  660. }
  661. break;
  662. case "WaferChargeMonitor1":
  663. RecipeLayoutSetMonitorTransferViewModel recipeLayoutSetMonitorTransferViewModel1 = new RecipeLayoutSetMonitorTransferViewModel();
  664. recipeLayoutSetMonitorTransferViewModel1.WaferChargeMonitor = WaferChargeMonitor1;
  665. recipeLayoutSetMonitorTransferViewModel1.WaferChargeMonitorValue = WaferChargeMonitorValue1;
  666. dialogReturn = wm.ShowDialogWithTitle(recipeLayoutSetMonitorTransferViewModel1, null, "Monitor Transfer1");
  667. if ((bool)dialogReturn)
  668. {
  669. WaferChargeMonitor1 = recipeLayoutSetMonitorTransferViewModel1.DialogResultMonitorTransferType;
  670. WaferChargeMonitorValue1 = recipeLayoutSetMonitorTransferViewModel1.ReturnString;
  671. }
  672. break;
  673. case "WaferChargeMonitor2":
  674. RecipeLayoutSetMonitorTransferViewModel recipeLayoutSetMonitorTransferViewModel2 = new RecipeLayoutSetMonitorTransferViewModel();
  675. recipeLayoutSetMonitorTransferViewModel2.WaferChargeMonitor = WaferChargeMonitor2;
  676. dialogReturn = wm.ShowDialogWithTitle(recipeLayoutSetMonitorTransferViewModel2, null, "Monitor Transfer2");
  677. if ((bool)dialogReturn)
  678. {
  679. WaferChargeMonitor2 = recipeLayoutSetMonitorTransferViewModel2.DialogResultMonitorTransferType;
  680. WaferChargeMonitorValue2 = recipeLayoutSetMonitorTransferViewModel2.ReturnString;
  681. }
  682. break;
  683. case "MonitorReturn1":
  684. RecipeLayoutSetMonitorReturnViewModel recipeLayoutSetMonitorReturnViewModel = new RecipeLayoutSetMonitorReturnViewModel();
  685. recipeLayoutSetMonitorReturnViewModel.DialogResultmonitor = DialogResultmonitor1;
  686. dialogReturn = wm.ShowDialogWithTitle(recipeLayoutSetMonitorReturnViewModel, null, "Monitor Return1");
  687. if ((bool)dialogReturn)
  688. {
  689. DialogResultmonitor1 = recipeLayoutSetMonitorReturnViewModel.DialogResultmonitor;
  690. }
  691. break;
  692. case "MonitorReturn2":
  693. RecipeLayoutSetMonitorReturnViewModel recipeLayoutSetMonitorReturnViewModel2 = new RecipeLayoutSetMonitorReturnViewModel();
  694. recipeLayoutSetMonitorReturnViewModel2.DialogResultmonitor = DialogResultmonitor2;
  695. dialogReturn = wm.ShowDialogWithTitle(recipeLayoutSetMonitorReturnViewModel2, null, "Monitor Return2");
  696. if ((bool)dialogReturn)
  697. {
  698. DialogResultmonitor2 = recipeLayoutSetMonitorReturnViewModel2.DialogResultmonitor;
  699. }
  700. break;
  701. case "FillDummyTransfer":
  702. RecipeLayoutSetFillDummyTransferViewModel recipeLayoutSetFillDummyTransferViewModel = new RecipeLayoutSetFillDummyTransferViewModel();
  703. recipeLayoutSetFillDummyTransferViewModel.FillDummyTransferStr = FillDummyTransferStr;
  704. dialogReturn = wm.ShowDialogWithTitle(recipeLayoutSetFillDummyTransferViewModel, null, "Fill Dummy Transfer");
  705. if ((bool)dialogReturn)
  706. {
  707. FillDummyTransferStr = recipeLayoutSetFillDummyTransferViewModel.DialogResultString;
  708. }
  709. break;
  710. case "ProductZero":
  711. SelectExistViewModel selectExistViewModel = new SelectExistViewModel();
  712. selectExistViewModel.ProductZeroStr = ProductZeroStr;
  713. dialogReturn = wm.ShowDialogWithTitle(selectExistViewModel, null, "Select");
  714. if ((bool)dialogReturn)
  715. {
  716. ProductZeroStr = selectExistViewModel.DialogResultString;
  717. }
  718. break;
  719. case "ProductTransfer":
  720. RecipeLayoutSetProductTransferViewModel recipeLayoutSetProductTransferViewModel = new RecipeLayoutSetProductTransferViewModel();
  721. recipeLayoutSetProductTransferViewModel.ProductTransferStr = ProductTransferStr;
  722. dialogReturn = wm.ShowDialogWithTitle(recipeLayoutSetProductTransferViewModel, null, "Product Transfer Position");
  723. if ((bool)dialogReturn)
  724. {
  725. ProductTransferStr = recipeLayoutSetProductTransferViewModel.DialogResultString;
  726. }
  727. break;
  728. case "Replacement1":
  729. RecipeLayoutMonitorWaferReplaceViewModel recipeLayoutMonitorWaferReplaceViewModel = new RecipeLayoutMonitorWaferReplaceViewModel();
  730. dialogReturn = wm.ShowDialogWithTitle(recipeLayoutMonitorWaferReplaceViewModel, null, "Monitor Wafer Replace");
  731. colsender.Text = recipeLayoutMonitorWaferReplaceViewModel.MonitorWaferFillReplace;
  732. break;
  733. case "Replacement2":
  734. RecipeLayoutMonitorWaferReplaceViewModel recipeLayoutMonitorWaferReplaceViewModel2 = new RecipeLayoutMonitorWaferReplaceViewModel();
  735. dialogReturn = wm.ShowDialogWithTitle(recipeLayoutMonitorWaferReplaceViewModel2, null, "Monitor Wafer Replace");
  736. colsender.Text = recipeLayoutMonitorWaferReplaceViewModel2.MonitorWaferFillReplace;
  737. break;
  738. case "YAxisMode":
  739. SelectExpandViewModel selectExpandViewModel = new SelectExpandViewModel();
  740. dialogReturn = wm.ShowDialogWithTitle(selectExpandViewModel, null, "Select");
  741. if ((bool)dialogReturn)
  742. {
  743. YAxisModeStr = selectExpandViewModel.DialogResultString;
  744. }
  745. break;
  746. default:
  747. break;
  748. }
  749. }
  750. public void BoatMapMouseDown()
  751. {
  752. WindowManager wm = new WindowManager();
  753. if (CurrentRecipe != null)
  754. {
  755. RecipeLayoutBoatMapViewModel recipeLayoutBoatMapViewModel = new RecipeLayoutBoatMapViewModel(CurrentRecipe.PrefixPath, CurrentRecipe.Name, ColumnBuilder);
  756. var dialogReturn = wm.ShowDialogWithTitle(recipeLayoutBoatMapViewModel, null, "Boat Map Direct Edit");
  757. if ((bool)dialogReturn)
  758. {
  759. BoatMapWafers = recipeLayoutBoatMapViewModel.listBoatWafers.ToList();
  760. CurrentRecipe = recipeLayoutBoatMapViewModel.CurrentRecipe;
  761. ProductNum = recipeLayoutBoatMapViewModel.ProductSlotCount;
  762. MonitorNum1 = recipeLayoutBoatMapViewModel.Monitor1SlotCount;
  763. MonitorNum2 = recipeLayoutBoatMapViewModel.Monitor2SlotCount;
  764. var data = ComputSD(BoatMapWafers);
  765. LowerSDNum = data.Item1;
  766. UpperSDNum = data.Item2;
  767. }
  768. }
  769. }
  770. private Tuple<int, int> ComputSD(List<string> dataSource)
  771. {
  772. List<string> otherSlot = dataSource.Where(a => a != "SD" && !string.IsNullOrEmpty(a)).ToList().Distinct().ToList();
  773. if (dataSource == null || dataSource.Count == 0)
  774. {
  775. return new Tuple<int, int>(0, 0);
  776. }
  777. List<int> minList = new List<int>();
  778. for (int i = 0; i < dataSource.Count; i++)
  779. {
  780. var item = dataSource[i];
  781. if (otherSlot.Contains(item) && !string.IsNullOrEmpty(item))
  782. {
  783. break;
  784. }
  785. if (string.IsNullOrEmpty(item))
  786. {
  787. continue;
  788. }
  789. minList.Add(i);
  790. }
  791. dataSource.Reverse();
  792. List<int> maxList = new List<int>();
  793. for (int i = 0; i < dataSource.Count; i++)
  794. {
  795. var item = dataSource[i];
  796. if (otherSlot.Contains(item) && !string.IsNullOrEmpty(item))
  797. {
  798. break;
  799. }
  800. if (string.IsNullOrEmpty(item))
  801. {
  802. continue;
  803. }
  804. maxList.Add(i);
  805. }
  806. return new Tuple<int, int>(minList.Count(), maxList.Count());
  807. }
  808. public void CancelClick()
  809. {
  810. if (DialogBox.ShowDialog(DialogButton.Yes | DialogButton.No, DialogType.CONFIRM, " You confirm that you want to unsave the recipe and exit the interface?") == DialogButton.No)
  811. return;
  812. ((Window)GetView()).Close();
  813. }
  814. public void SaveClick()
  815. {
  816. SetConfig();
  817. EndEdit();
  818. }
  819. private void SetConfig()
  820. {
  821. if (CurrentRecipe.ConfigItems != null && CurrentRecipe.ConfigItems.Count > 0)
  822. {
  823. if (CurrentRecipe.ConfigItems.Where(x => x.Name == "BoatTotalSlot").Count() > 0)
  824. {
  825. ((NumParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "BoatTotalSlot").FirstOrDefault()).Value = BoatTotalSlot;
  826. }
  827. if (CurrentRecipe.ConfigItems.Where(x => x.DisplayName == "UpperSDNum").Count() > 0)
  828. {
  829. ((NumParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "UpperSDNum").FirstOrDefault()).Value = UpperSDNum;
  830. }
  831. if (CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductNum").Count() > 0)
  832. {
  833. ((NumParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductNum").FirstOrDefault()).Value = ProductNum;
  834. }
  835. if (CurrentRecipe.ConfigItems.Where(x => x.Name == "MonitorNum1").Count() > 0)
  836. {
  837. ((NumParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "MonitorNum1").FirstOrDefault()).Value = ProductNum;
  838. }
  839. if (CurrentRecipe.ConfigItems.Where(x => x.Name == "MonitorNum2").Count() > 0)
  840. {
  841. ((NumParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "MonitorNum2").FirstOrDefault()).Value = ProductNum;
  842. }
  843. if (CurrentRecipe.ConfigItems.Where(x => x.Name == "LowerSDNum").Count() > 0)
  844. {
  845. ((NumParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "LowerSDNum").FirstOrDefault()).Value = LowerSDNum;
  846. }
  847. }
  848. if (CurrentRecipe.ConfigItems.Where(x => x.Name == "TopSlotNo").Count() > 0)
  849. {
  850. ((NumParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "TopSlotNo").FirstOrDefault()).Value = TopSlotNo;
  851. }
  852. if (CurrentRecipe.ConfigItems.Where(x => x.Name == "UpperSideDummyNum").Count() > 0)
  853. {
  854. ((NumParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "UpperSideDummyNum").FirstOrDefault()).Value = UpperSideDummyNum;
  855. }
  856. if (CurrentRecipe.ConfigItems.Where(x => x.Name == "BoatMapDecisionMethod").Count() > 0)
  857. {
  858. // IsDispTypeEnabled = ((NumParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "BoatMapDecisionMethod").FirstOrDefault()).Value == 0 ? true : false;
  859. }
  860. if (CurrentRecipe.ConfigItems.Where(x => x.Name == "LowerSideDummyNum").Count() > 0)
  861. {
  862. ((NumParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "LowerSideDummyNum").FirstOrDefault()).Value = LowerSideDummyNum;
  863. }
  864. if (CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductAndFill").Count() > 0)
  865. {
  866. ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductAndFill").FirstOrDefault()).Value = TotalWaferNumber.ToString();
  867. }
  868. if (CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductAndFillValue").Count() > 0)
  869. {
  870. ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductAndFillValue").FirstOrDefault()).Value = TotalWaferNumberValue;
  871. }
  872. if (CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferSupplement").Count() > 0)
  873. {
  874. ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferSupplement").FirstOrDefault()).Value = SetLayoutReplacement.ToString();
  875. }
  876. if (CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferSupplementValue").Count() > 0)
  877. {
  878. ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferSupplementValue").FirstOrDefault()).Value = SetLayoutReplacementValue;
  879. }
  880. if (CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferChargeMonitor1").Count() > 0)
  881. {
  882. ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferChargeMonitor1").FirstOrDefault()).Value = WaferChargeMonitor1.ToString();
  883. }
  884. if (CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferChargeMonitorValue1").Count() > 0)
  885. {
  886. ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferChargeMonitorValue1").FirstOrDefault()).Value = WaferChargeMonitorValue1;
  887. }
  888. if (CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferChargeMonitor2").Count() > 0)
  889. {
  890. ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferChargeMonitor2").FirstOrDefault()).Value = WaferChargeMonitor2.ToString();
  891. }
  892. if (CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferChargeMonitorValue2").Count() > 0)
  893. {
  894. ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferChargeMonitorValue2").FirstOrDefault()).Value = WaferChargeMonitorValue2;
  895. }
  896. if (CurrentRecipe.ConfigItems.Where(x => x.Name == "FillDummyTransfer").Count() > 0)
  897. {
  898. ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "FillDummyTransfer").FirstOrDefault()).Value = FillDummyTransferStr;
  899. }
  900. if (CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductZeroNotFill").Count() > 0)
  901. {
  902. ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductZeroNotFill").FirstOrDefault()).Value = ProductZeroStr;
  903. }
  904. if (CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductTransferPosition").Count() > 0)
  905. {
  906. ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductTransferPosition").FirstOrDefault()).Value = ProductTransferStr;
  907. }
  908. if (CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferDischargeMonitor1").Count() > 0)
  909. {
  910. ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferDischargeMonitor1").FirstOrDefault()).Value = DialogResultmonitor1.ToString();
  911. }
  912. if (CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferDischargeMonitor2").Count() > 0)
  913. {
  914. ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferDischargeMonitor2").FirstOrDefault()).Value = DialogResultmonitor2.ToString();
  915. }
  916. }
  917. public void EndEdit()
  918. {
  919. RecipePermissionSelectViewModel dialog = new RecipePermissionSelectViewModel("Save recipe and permission", "",CurrentRecipe.Description);
  920. WindowManager wm = new WindowManager();
  921. bool? dialogReturn = wm.ShowDialog(dialog);
  922. if (!dialogReturn.HasValue || !dialogReturn.Value)
  923. return;
  924. if (string.IsNullOrEmpty(CurrentRecipe.NormalSteps[0].DummyLowerSlot))
  925. {
  926. DialogBox.ShowWarning("DummyLowerSlot is empty,can not save!");
  927. return;
  928. }
  929. if (string.IsNullOrEmpty(CurrentRecipe.NormalSteps[0].DummyUpperSlot))
  930. {
  931. DialogBox.ShowWarning("DummyUpperSlot is empty,can not save!");
  932. return;
  933. }
  934. if (string.IsNullOrEmpty(CurrentRecipe.NormalSteps[0].CenteringSlotPosition))
  935. {
  936. DialogBox.ShowWarning("CenteringSlotPosition is empty,can not save!");
  937. return;
  938. }
  939. //if (string.IsNullOrEmpty(CurrentRecipe.NormalSteps[0].Pitch))
  940. //{
  941. // DialogBox.ShowWarning("Pitch is empty,can not save!");
  942. // return;
  943. //}
  944. if (string.IsNullOrEmpty(CurrentRecipe.NormalSteps[0].ProductPosition))
  945. {
  946. DialogBox.ShowWarning("ProductPosition is empty,can not save!");
  947. return;
  948. }
  949. if (string.IsNullOrEmpty(CurrentRecipe.NormalSteps[0].MonitorPosition))
  950. {
  951. DialogBox.ShowWarning("MonitorPosition is empty,can not save!");
  952. return;
  953. }
  954. if (string.IsNullOrEmpty(CurrentRecipe.NormalSteps[0].WhenCassetteInBatchAreShort))
  955. {
  956. DialogBox.ShowWarning("WhenCassetteInBatchAreShort is empty,can not save!");
  957. return;
  958. }
  959. if (string.IsNullOrEmpty(CurrentRecipe.NormalSteps[0].WhenPWaferShort))
  960. {
  961. DialogBox.ShowWarning("WhenPWaferShort is empty,can not save!");
  962. return;
  963. }
  964. if (string.IsNullOrEmpty(CurrentRecipe.NormalSteps[0].WhenWaferInCassetteAreShort))
  965. {
  966. DialogBox.ShowWarning("WhenWaferInCassetteAreShort is empty,can not save!");
  967. return;
  968. }
  969. if (string.IsNullOrEmpty(CurrentRecipe.NormalSteps[0].WhenEDAreShort))
  970. {
  971. DialogBox.ShowWarning("WhenEDAreShort is empty,can not save!");
  972. return;
  973. }
  974. if (string.IsNullOrEmpty(CurrentRecipe.NormalSteps[0].SDRule))
  975. {
  976. DialogBox.ShowWarning("SDRule is empty,can not save!");
  977. return;
  978. }
  979. if (string.IsNullOrEmpty(CurrentRecipe.NormalSteps[0].RuleOfSpaceInBoat))
  980. {
  981. DialogBox.ShowWarning("RuleOfSpaceInBoat is empty,can not save!");
  982. return;
  983. }
  984. CurrentRecipe.IsSavedDesc = false;
  985. this.CurrentRecipe.Revisor = BaseApp.Instance.UserContext.LoginName;
  986. this.CurrentRecipe.ReviseTime = DateTime.Now;
  987. this.CurrentRecipe.RecipeLevel = this.LevelDisplay;
  988. this.CurrentRecipe.Description = dialog.RecipeComment;
  989. this._recipeProvider.SaveRecipe(CurrentRecipe.PrefixPath, CurrentRecipe.Name, CurrentRecipe.GetXmlString());
  990. ((Window)GetView()).DialogResult = true;
  991. }
  992. public void Cancel()
  993. {
  994. if (DialogBox.ShowDialog(DialogButton.Yes | DialogButton.No, DialogType.CONFIRM, " You confirm that you want to unsave the recipe and exit the interface?") == DialogButton.No)
  995. return;
  996. ((Window)GetView()).Close();
  997. }
  998. public void EditModeSelectClick(string cmd)
  999. {
  1000. switch (cmd)
  1001. {
  1002. case "Before":
  1003. SetBeforeEdit();
  1004. break;
  1005. case "After":
  1006. SetAfterEdit();
  1007. break;
  1008. default:
  1009. break;
  1010. }
  1011. }
  1012. private void SetBeforeEdit()
  1013. { }
  1014. private void SetAfterEdit()
  1015. { }
  1016. private Visibility _istBoatMapLogicalVisibility;
  1017. public Visibility IstBoatMapLogicalVisibility
  1018. {
  1019. get => _istBoatMapLogicalVisibility;
  1020. set
  1021. {
  1022. _istBoatMapLogicalVisibility = value;
  1023. NotifyOfPropertyChange(nameof(IstBoatMapLogicalVisibility));
  1024. }
  1025. }
  1026. private Visibility _istBoatMapDirectVisibility = Visibility.Hidden;
  1027. public Visibility IstBoatMapDirectVisibility
  1028. {
  1029. get => _istBoatMapDirectVisibility;
  1030. set
  1031. {
  1032. _istBoatMapDirectVisibility = value;
  1033. NotifyOfPropertyChange(nameof(IstBoatMapDirectVisibility));
  1034. }
  1035. }
  1036. private bool _isDispTypeEnabled = true;
  1037. public bool IsDispTypeEnabled
  1038. {
  1039. get => _isDispTypeEnabled;
  1040. set
  1041. {
  1042. _isDispTypeEnabled = value;
  1043. NotifyOfPropertyChange(nameof(IsDispTypeEnabled));
  1044. }
  1045. }
  1046. private void SetBoatMapLogical()
  1047. {
  1048. IstBoatMapLogicalVisibility = Visibility.Visible;
  1049. IstBoatMapDirectVisibility = Visibility.Hidden;
  1050. IsDispTypeEnabled = true;
  1051. }
  1052. private void SetBoatMapDirect()
  1053. {
  1054. IstBoatMapLogicalVisibility = Visibility.Hidden;
  1055. IstBoatMapDirectVisibility = Visibility.Visible;
  1056. IsDispTypeEnabled = false;
  1057. }
  1058. public void BoatMapSelectClick(string cmd)
  1059. {
  1060. switch (cmd)
  1061. {
  1062. case "Logical":
  1063. SetBoatMapLogical();
  1064. break;
  1065. case "Direct":
  1066. SetBoatMapDirect();
  1067. break;
  1068. default:
  1069. break;
  1070. }
  1071. }
  1072. private Visibility _istDispTypeToNumber;
  1073. public Visibility IstDispTypeToNumber
  1074. {
  1075. get => _istDispTypeToNumber;
  1076. set
  1077. {
  1078. _istDispTypeToNumber = value;
  1079. NotifyOfPropertyChange(nameof(IstDispTypeToNumber));
  1080. }
  1081. }
  1082. private Visibility _istDispTypeToMap;
  1083. public Visibility IstDispTypeToMap
  1084. {
  1085. get => _istDispTypeToMap;
  1086. set
  1087. {
  1088. _istDispTypeToMap = value;
  1089. NotifyOfPropertyChange(nameof(IstDispTypeToMap));
  1090. }
  1091. }
  1092. private Visibility _istDispTypeToCarrier;
  1093. public Visibility IstDispTypeToCarrier
  1094. {
  1095. get => _istDispTypeToCarrier;
  1096. set
  1097. {
  1098. _istDispTypeToCarrier = value;
  1099. NotifyOfPropertyChange(nameof(IstDispTypeToCarrier));
  1100. }
  1101. }
  1102. private void SetDispTypeToNumber()
  1103. {
  1104. IstDispTypeToNumber = Visibility.Visible;
  1105. IstDispTypeToMap = Visibility.Hidden;
  1106. IstDispTypeToCarrier = Visibility.Hidden;
  1107. }
  1108. private void SetDispTypeToMap()
  1109. {
  1110. IstDispTypeToNumber = Visibility.Hidden;
  1111. IstDispTypeToMap = Visibility.Visible;
  1112. IstDispTypeToCarrier = Visibility.Hidden;
  1113. }
  1114. private void SetDispTypeToCarrier()
  1115. {
  1116. IstDispTypeToNumber = Visibility.Hidden;
  1117. IstDispTypeToMap = Visibility.Hidden;
  1118. IstDispTypeToCarrier = Visibility.Visible;
  1119. }
  1120. public void DispTypeSelectClick(string cmd)
  1121. {
  1122. switch (cmd)
  1123. {
  1124. case "Number":
  1125. SetDispTypeToNumber();
  1126. break;
  1127. case "Map":
  1128. SetDispTypeToMap();
  1129. break;
  1130. case "Carrier":
  1131. SetDispTypeToCarrier();
  1132. break;
  1133. default:
  1134. break;
  1135. }
  1136. }
  1137. }
  1138. }