RecipeLayoutEditViewModel.cs 56 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273
  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. UpperSDNum = listWafers.Where(x => x == "SD").Count();
  545. LowerSDNum = listWafers.Where(x => x == "FD").Count();
  546. ProductNum = listWafers.Where(x => x.StartsWith("P")).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. var data = ComputSD(BoatMapWafers);
  768. UpperSDNum = recipeLayoutBoatMapViewModel.listBoatWafers.Where(x => x == "SD").Count();
  769. LowerSDNum = recipeLayoutBoatMapViewModel.listBoatWafers.Where(x => x == "FD").Count();
  770. ProductNum = recipeLayoutBoatMapViewModel.listBoatWafers.Where(x => x.StartsWith("P")).Count();
  771. MonitorNum1 = recipeLayoutBoatMapViewModel.listBoatWafers.Where(x => x == "M1").Count();
  772. MonitorNum2 = recipeLayoutBoatMapViewModel.listBoatWafers.Where(x => x == "M2").Count();
  773. }
  774. }
  775. }
  776. private Tuple<int, int> ComputSD(List<string> dataSource)
  777. {
  778. List<string> otherSlot = dataSource.Where(a => a != "SD" && !string.IsNullOrEmpty(a)).ToList().Distinct().ToList();
  779. if (dataSource == null || dataSource.Count == 0)
  780. {
  781. return new Tuple<int, int>(0, 0);
  782. }
  783. List<int> minList = new List<int>();
  784. for (int i = 0; i < dataSource.Count; i++)
  785. {
  786. var item = dataSource[i];
  787. if (otherSlot.Contains(item) && !string.IsNullOrEmpty(item))
  788. {
  789. break;
  790. }
  791. if (string.IsNullOrEmpty(item))
  792. {
  793. continue;
  794. }
  795. minList.Add(i);
  796. }
  797. dataSource.Reverse();
  798. List<int> maxList = new List<int>();
  799. for (int i = 0; i < dataSource.Count; i++)
  800. {
  801. var item = dataSource[i];
  802. if (otherSlot.Contains(item) && !string.IsNullOrEmpty(item))
  803. {
  804. break;
  805. }
  806. if (string.IsNullOrEmpty(item))
  807. {
  808. continue;
  809. }
  810. maxList.Add(i);
  811. }
  812. return new Tuple<int, int>(minList.Count(), maxList.Count());
  813. }
  814. public void CancelClick()
  815. {
  816. if (DialogBox.ShowDialog(DialogButton.Yes | DialogButton.No, DialogType.CONFIRM, " You confirm that you want to unsave the recipe and exit the interface?") == DialogButton.No)
  817. return;
  818. ((Window)GetView()).Close();
  819. }
  820. public void SaveClick()
  821. {
  822. SetConfig();
  823. EndEdit();
  824. }
  825. private void SetConfig()
  826. {
  827. if (CurrentRecipe.ConfigItems != null && CurrentRecipe.ConfigItems.Count > 0)
  828. {
  829. if (CurrentRecipe.ConfigItems.Where(x => x.Name == "BoatTotalSlot").Count() > 0)
  830. {
  831. ((NumParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "BoatTotalSlot").FirstOrDefault()).Value = BoatTotalSlot;
  832. }
  833. if (CurrentRecipe.ConfigItems.Where(x => x.DisplayName == "UpperSDNum").Count() > 0)
  834. {
  835. ((NumParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "UpperSDNum").FirstOrDefault()).Value = UpperSDNum;
  836. }
  837. if (CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductNum").Count() > 0)
  838. {
  839. ((NumParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductNum").FirstOrDefault()).Value = ProductNum;
  840. }
  841. if (CurrentRecipe.ConfigItems.Where(x => x.Name == "MonitorNum1").Count() > 0)
  842. {
  843. ((NumParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "MonitorNum1").FirstOrDefault()).Value = ProductNum;
  844. }
  845. if (CurrentRecipe.ConfigItems.Where(x => x.Name == "MonitorNum2").Count() > 0)
  846. {
  847. ((NumParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "MonitorNum2").FirstOrDefault()).Value = ProductNum;
  848. }
  849. if (CurrentRecipe.ConfigItems.Where(x => x.Name == "LowerSDNum").Count() > 0)
  850. {
  851. ((NumParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "LowerSDNum").FirstOrDefault()).Value = LowerSDNum;
  852. }
  853. }
  854. if (CurrentRecipe.ConfigItems.Where(x => x.Name == "TopSlotNo").Count() > 0)
  855. {
  856. ((NumParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "TopSlotNo").FirstOrDefault()).Value = TopSlotNo;
  857. }
  858. if (CurrentRecipe.ConfigItems.Where(x => x.Name == "UpperSideDummyNum").Count() > 0)
  859. {
  860. ((NumParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "UpperSideDummyNum").FirstOrDefault()).Value = UpperSideDummyNum;
  861. }
  862. if (CurrentRecipe.ConfigItems.Where(x => x.Name == "BoatMapDecisionMethod").Count() > 0)
  863. {
  864. // IsDispTypeEnabled = ((NumParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "BoatMapDecisionMethod").FirstOrDefault()).Value == 0 ? true : false;
  865. }
  866. if (CurrentRecipe.ConfigItems.Where(x => x.Name == "LowerSideDummyNum").Count() > 0)
  867. {
  868. ((NumParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "LowerSideDummyNum").FirstOrDefault()).Value = LowerSideDummyNum;
  869. }
  870. if (CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductAndFill").Count() > 0)
  871. {
  872. ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductAndFill").FirstOrDefault()).Value = TotalWaferNumber.ToString();
  873. }
  874. if (CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductAndFillValue").Count() > 0)
  875. {
  876. ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductAndFillValue").FirstOrDefault()).Value = TotalWaferNumberValue;
  877. }
  878. if (CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferSupplement").Count() > 0)
  879. {
  880. ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferSupplement").FirstOrDefault()).Value = SetLayoutReplacement.ToString();
  881. }
  882. if (CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferSupplementValue").Count() > 0)
  883. {
  884. ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferSupplementValue").FirstOrDefault()).Value = SetLayoutReplacementValue;
  885. }
  886. if (CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferChargeMonitor1").Count() > 0)
  887. {
  888. ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferChargeMonitor1").FirstOrDefault()).Value = WaferChargeMonitor1.ToString();
  889. }
  890. if (CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferChargeMonitorValue1").Count() > 0)
  891. {
  892. ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferChargeMonitorValue1").FirstOrDefault()).Value = WaferChargeMonitorValue1;
  893. }
  894. if (CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferChargeMonitor2").Count() > 0)
  895. {
  896. ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferChargeMonitor2").FirstOrDefault()).Value = WaferChargeMonitor2.ToString();
  897. }
  898. if (CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferChargeMonitorValue2").Count() > 0)
  899. {
  900. ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferChargeMonitorValue2").FirstOrDefault()).Value = WaferChargeMonitorValue2;
  901. }
  902. if (CurrentRecipe.ConfigItems.Where(x => x.Name == "FillDummyTransfer").Count() > 0)
  903. {
  904. ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "FillDummyTransfer").FirstOrDefault()).Value = FillDummyTransferStr;
  905. }
  906. if (CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductZeroNotFill").Count() > 0)
  907. {
  908. ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductZeroNotFill").FirstOrDefault()).Value = ProductZeroStr;
  909. }
  910. if (CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductTransferPosition").Count() > 0)
  911. {
  912. ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductTransferPosition").FirstOrDefault()).Value = ProductTransferStr;
  913. }
  914. if (CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferDischargeMonitor1").Count() > 0)
  915. {
  916. ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferDischargeMonitor1").FirstOrDefault()).Value = DialogResultmonitor1.ToString();
  917. }
  918. if (CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferDischargeMonitor2").Count() > 0)
  919. {
  920. ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferDischargeMonitor2").FirstOrDefault()).Value = DialogResultmonitor2.ToString();
  921. }
  922. }
  923. public void EndEdit()
  924. {
  925. RecipePermissionSelectViewModel dialog = new RecipePermissionSelectViewModel("Save recipe and permission", "", CurrentRecipe.Description);
  926. WindowManager wm = new WindowManager();
  927. bool? dialogReturn = wm.ShowDialog(dialog);
  928. if (!dialogReturn.HasValue || !dialogReturn.Value)
  929. return;
  930. if (string.IsNullOrEmpty(CurrentRecipe.NormalSteps[0].DummyLowerSlot))
  931. {
  932. DialogBox.ShowWarning("DummyLowerSlot is empty,can not save!");
  933. return;
  934. }
  935. if (string.IsNullOrEmpty(CurrentRecipe.NormalSteps[0].DummyUpperSlot))
  936. {
  937. DialogBox.ShowWarning("DummyUpperSlot is empty,can not save!");
  938. return;
  939. }
  940. if (string.IsNullOrEmpty(CurrentRecipe.NormalSteps[0].CenteringSlotPosition))
  941. {
  942. DialogBox.ShowWarning("CenteringSlotPosition is empty,can not save!");
  943. return;
  944. }
  945. //if (string.IsNullOrEmpty(CurrentRecipe.NormalSteps[0].Pitch))
  946. //{
  947. // DialogBox.ShowWarning("Pitch is empty,can not save!");
  948. // return;
  949. //}
  950. if (string.IsNullOrEmpty(CurrentRecipe.NormalSteps[0].ProductPosition))
  951. {
  952. DialogBox.ShowWarning("ProductPosition is empty,can not save!");
  953. return;
  954. }
  955. if (string.IsNullOrEmpty(CurrentRecipe.NormalSteps[0].MonitorPosition))
  956. {
  957. DialogBox.ShowWarning("MonitorPosition is empty,can not save!");
  958. return;
  959. }
  960. if (string.IsNullOrEmpty(CurrentRecipe.NormalSteps[0].WhenCassetteInBatchAreShort))
  961. {
  962. DialogBox.ShowWarning("WhenCassetteInBatchAreShort is empty,can not save!");
  963. return;
  964. }
  965. if (string.IsNullOrEmpty(CurrentRecipe.NormalSteps[0].WhenPWaferShort))
  966. {
  967. DialogBox.ShowWarning("WhenPWaferShort is empty,can not save!");
  968. return;
  969. }
  970. if (string.IsNullOrEmpty(CurrentRecipe.NormalSteps[0].WhenWaferInCassetteAreShort))
  971. {
  972. DialogBox.ShowWarning("WhenWaferInCassetteAreShort is empty,can not save!");
  973. return;
  974. }
  975. if (string.IsNullOrEmpty(CurrentRecipe.NormalSteps[0].WhenEDAreShort))
  976. {
  977. DialogBox.ShowWarning("WhenEDAreShort is empty,can not save!");
  978. return;
  979. }
  980. if (string.IsNullOrEmpty(CurrentRecipe.NormalSteps[0].SDRule))
  981. {
  982. DialogBox.ShowWarning("SDRule is empty,can not save!");
  983. return;
  984. }
  985. if (string.IsNullOrEmpty(CurrentRecipe.NormalSteps[0].RuleOfSpaceInBoat))
  986. {
  987. DialogBox.ShowWarning("RuleOfSpaceInBoat is empty,can not save!");
  988. return;
  989. }
  990. CurrentRecipe.IsSavedDesc = false;
  991. this.CurrentRecipe.Revisor = BaseApp.Instance.UserContext.LoginName;
  992. this.CurrentRecipe.ReviseTime = DateTime.Now;
  993. this.CurrentRecipe.RecipeLevel = this.LevelDisplay;
  994. this.CurrentRecipe.Description = dialog.RecipeComment;
  995. this._recipeProvider.SaveRecipe(CurrentRecipe.PrefixPath, CurrentRecipe.Name, CurrentRecipe.GetXmlString());
  996. ((Window)GetView()).DialogResult = true;
  997. }
  998. public void Cancel()
  999. {
  1000. if (DialogBox.ShowDialog(DialogButton.Yes | DialogButton.No, DialogType.CONFIRM, " You confirm that you want to unsave the recipe and exit the interface?") == DialogButton.No)
  1001. return;
  1002. ((Window)GetView()).Close();
  1003. }
  1004. public void EditModeSelectClick(string cmd)
  1005. {
  1006. switch (cmd)
  1007. {
  1008. case "Before":
  1009. SetBeforeEdit();
  1010. break;
  1011. case "After":
  1012. SetAfterEdit();
  1013. break;
  1014. default:
  1015. break;
  1016. }
  1017. }
  1018. private void SetBeforeEdit()
  1019. { }
  1020. private void SetAfterEdit()
  1021. { }
  1022. private Visibility _istBoatMapLogicalVisibility;
  1023. public Visibility IstBoatMapLogicalVisibility
  1024. {
  1025. get => _istBoatMapLogicalVisibility;
  1026. set
  1027. {
  1028. _istBoatMapLogicalVisibility = value;
  1029. NotifyOfPropertyChange(nameof(IstBoatMapLogicalVisibility));
  1030. }
  1031. }
  1032. private Visibility _istBoatMapDirectVisibility = Visibility.Hidden;
  1033. public Visibility IstBoatMapDirectVisibility
  1034. {
  1035. get => _istBoatMapDirectVisibility;
  1036. set
  1037. {
  1038. _istBoatMapDirectVisibility = value;
  1039. NotifyOfPropertyChange(nameof(IstBoatMapDirectVisibility));
  1040. }
  1041. }
  1042. private bool _isDispTypeEnabled = true;
  1043. public bool IsDispTypeEnabled
  1044. {
  1045. get => _isDispTypeEnabled;
  1046. set
  1047. {
  1048. _isDispTypeEnabled = value;
  1049. NotifyOfPropertyChange(nameof(IsDispTypeEnabled));
  1050. }
  1051. }
  1052. private void SetBoatMapLogical()
  1053. {
  1054. IstBoatMapLogicalVisibility = Visibility.Visible;
  1055. IstBoatMapDirectVisibility = Visibility.Hidden;
  1056. IsDispTypeEnabled = true;
  1057. }
  1058. private void SetBoatMapDirect()
  1059. {
  1060. IstBoatMapLogicalVisibility = Visibility.Hidden;
  1061. IstBoatMapDirectVisibility = Visibility.Visible;
  1062. IsDispTypeEnabled = false;
  1063. }
  1064. public void BoatMapSelectClick(string cmd)
  1065. {
  1066. switch (cmd)
  1067. {
  1068. case "Logical":
  1069. SetBoatMapLogical();
  1070. break;
  1071. case "Direct":
  1072. SetBoatMapDirect();
  1073. break;
  1074. default:
  1075. break;
  1076. }
  1077. }
  1078. private Visibility _istDispTypeToNumber;
  1079. public Visibility IstDispTypeToNumber
  1080. {
  1081. get => _istDispTypeToNumber;
  1082. set
  1083. {
  1084. _istDispTypeToNumber = value;
  1085. NotifyOfPropertyChange(nameof(IstDispTypeToNumber));
  1086. }
  1087. }
  1088. private Visibility _istDispTypeToMap;
  1089. public Visibility IstDispTypeToMap
  1090. {
  1091. get => _istDispTypeToMap;
  1092. set
  1093. {
  1094. _istDispTypeToMap = value;
  1095. NotifyOfPropertyChange(nameof(IstDispTypeToMap));
  1096. }
  1097. }
  1098. private Visibility _istDispTypeToCarrier;
  1099. public Visibility IstDispTypeToCarrier
  1100. {
  1101. get => _istDispTypeToCarrier;
  1102. set
  1103. {
  1104. _istDispTypeToCarrier = value;
  1105. NotifyOfPropertyChange(nameof(IstDispTypeToCarrier));
  1106. }
  1107. }
  1108. private void SetDispTypeToNumber()
  1109. {
  1110. IstDispTypeToNumber = Visibility.Visible;
  1111. IstDispTypeToMap = Visibility.Hidden;
  1112. IstDispTypeToCarrier = Visibility.Hidden;
  1113. }
  1114. private void SetDispTypeToMap()
  1115. {
  1116. IstDispTypeToNumber = Visibility.Hidden;
  1117. IstDispTypeToMap = Visibility.Visible;
  1118. IstDispTypeToCarrier = Visibility.Hidden;
  1119. }
  1120. private void SetDispTypeToCarrier()
  1121. {
  1122. IstDispTypeToNumber = Visibility.Hidden;
  1123. IstDispTypeToMap = Visibility.Hidden;
  1124. IstDispTypeToCarrier = Visibility.Visible;
  1125. }
  1126. public void DispTypeSelectClick(string cmd)
  1127. {
  1128. switch (cmd)
  1129. {
  1130. case "Number":
  1131. SetDispTypeToNumber();
  1132. break;
  1133. case "Map":
  1134. SetDispTypeToMap();
  1135. break;
  1136. case "Carrier":
  1137. SetDispTypeToCarrier();
  1138. break;
  1139. default:
  1140. break;
  1141. }
  1142. }
  1143. }
  1144. }