| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273 | 
							
- using Caliburn.Micro;
 
- using MECF.Framework.Common.CommonData;
 
- using MECF.Framework.Common.DataCenter;
 
- using MECF.Framework.UI.Client.CenterViews.Editors.Recipe;
 
- using MECF.Framework.UI.Client.ClientBase;
 
- using OpenSEMI.ClientBase;
 
- using System;
 
- using System.Collections.Generic;
 
- using System.Windows;
 
- using System.Windows.Media;
 
- using FurnaceUI.Models;
 
- using FurnaceUI.Views.Editors;
 
- using System.Windows.Controls;
 
- using FurnaceUI.Views.DataLog;
 
- using System.Linq;
 
- using RecipeEditorLib.RecipeModel.Params;
 
- using System.Collections.ObjectModel;
 
- using FurnaceUI.Client.Dialog;
 
- using SciChart.Core.Extensions;
 
- namespace FurnaceUI.Views.Recipes
 
- {
 
-     public class RecipeLayoutEditViewModel : FurnaceUIViewModelBase
 
-     {
 
-         #region properties
 
-         private string _recipeName;
 
-         public string RecipeName
 
-         {
 
-             get => _recipeName;
 
-             set
 
-             {
 
-                 _recipeName = value;
 
-                 NotifyOfPropertyChange(nameof(RecipeName));
 
-             }
 
-         }
 
-         public int FoupListMaxValue { get; set; }
 
-         private int waferNumberP;
 
-         public int WaferNumberP { get { return waferNumberP; } set { waferNumberP = value; NotifyOfPropertyChange(nameof(waferNumberP)); } }
 
-         private int waferNumberSD;
 
-         public int WaferNumberSD { get { return waferNumberSD; } set { waferNumberSD = value; NotifyOfPropertyChange(nameof(waferNumberSD)); } }
 
-         private int waferNumberM;
 
-         public int WaferNumberM { get { return waferNumberM; } set { waferNumberM = value; NotifyOfPropertyChange(nameof(waferNumberM)); } }
 
-         private int currentItemIndex;
 
-         private string SelectedSlotType { get; set; }
 
-         private RecipeProvider _recipeProvider = new RecipeProvider();
 
-         private SolidColorBrush _DefaultdBk = new SolidColorBrush(Colors.White);
 
-         private SolidColorBrush _PBk = new SolidColorBrush(Colors.SkyBlue);
 
-         private SolidColorBrush _SDBk = new SolidColorBrush(Colors.White);
 
-         private SolidColorBrush _EDBk = new SolidColorBrush(Colors.Yellow);
 
-         private SolidColorBrush _MBk = new SolidColorBrush(Colors.Pink);
 
-         private SolidColorBrush _XDBk = new SolidColorBrush(Colors.White);
 
-         private SolidColorBrush _TBk = new SolidColorBrush(Colors.DarkGreen);
 
-         #endregion
 
-         public RecipeDataLayout CurrentRecipe { get; set; } = new RecipeDataLayout();
 
-         public RecipeLayoutEntityNormal NormalEntity { get { return CurrentRecipe.NormalSteps[0]; } set { CurrentRecipe.NormalSteps[0] = value; this.NotifyOfPropertyChange(nameof(NormalEntity)); } }
 
-         public List<BoatWaferItem> BoatWafers { get { return CurrentRecipe.ExpertSteps[0].Items; } set { CurrentRecipe.ExpertSteps[0].Items = value; } }
 
-         private bool _IsStandardPitchEnabled = true;
 
-         public bool IsStandardPitchEnabled
 
-         {
 
-             get => _IsStandardPitchEnabled;
 
-             set
 
-             {
 
-                 _IsStandardPitchEnabled = value;
 
-                 NotifyOfPropertyChange(nameof(IsStandardPitchEnabled));
 
-             }
 
-         }
 
-         private bool _IsDoublePitchEnabled;
 
-         public bool IsDoublePitchEnabled
 
-         {
 
-             get => _IsDoublePitchEnabled;
 
-             set
 
-             {
 
-                 _IsDoublePitchEnabled = value;
 
-                 NotifyOfPropertyChange(nameof(IsDoublePitchEnabled));
 
-             }
 
-         }
 
-         private bool _IsTriplePitchEnabled;
 
-         public bool IsTriplePitchEnabled
 
-         {
 
-             get => _IsTriplePitchEnabled;
 
-             set
 
-             {
 
-                 _IsTriplePitchEnabled = value;
 
-                 NotifyOfPropertyChange(nameof(IsTriplePitchEnabled));
 
-             }
 
-         }
 
-         public bool IsEnable => CGlobal.RecipeLayoutEditViewEnable;//是否是View模式
 
-         private int _cassetteSlotCount;
 
-         private TotalWaferNumberMode _totalWaferNumber = TotalWaferNumberMode.Total;
 
-         public TotalWaferNumberMode TotalWaferNumber
 
-         {
 
-             get => _totalWaferNumber;
 
-             set
 
-             {
 
-                 _totalWaferNumber = value;
 
-                 NotifyOfPropertyChange(nameof(TotalWaferNumber));
 
-             }
 
-         }
 
-         private string _totalWaferNumberValue = "";
 
-         public string TotalWaferNumberValue
 
-         {
 
-             get => _totalWaferNumberValue;
 
-             set
 
-             {
 
-                 _totalWaferNumberValue = value;
 
-                 NotifyOfPropertyChange(nameof(TotalWaferNumberValue));
 
-             }
 
-         }
 
-         private LayoutReplacement _setLayoutReplacement = LayoutReplacement.Upper;
 
-         public LayoutReplacement SetLayoutReplacement
 
-         {
 
-             get => _setLayoutReplacement;
 
-             set
 
-             {
 
-                 _setLayoutReplacement = value;
 
-                 NotifyOfPropertyChange(nameof(SetLayoutReplacement));
 
-             }
 
-         }
 
-         private string _setLayoutReplacementValue = "";
 
-         public string SetLayoutReplacementValue
 
-         {
 
-             get => _setLayoutReplacementValue;
 
-             set
 
-             {
 
-                 _setLayoutReplacementValue = value;
 
-                 NotifyOfPropertyChange(nameof(SetLayoutReplacementValue));
 
-             }
 
-         }
 
-         private MonitorTransferType _waferChargeMonitor1 = MonitorTransferType.AutoLayout;
 
-         public MonitorTransferType WaferChargeMonitor1
 
-         {
 
-             get => _waferChargeMonitor1;
 
-             set
 
-             {
 
-                 _waferChargeMonitor1 = value;
 
-                 NotifyOfPropertyChange(nameof(WaferChargeMonitor1));
 
-             }
 
-         }
 
-         private string _waferChargeMonitorValue1 = "";
 
-         public string WaferChargeMonitorValue1
 
-         {
 
-             get => _waferChargeMonitorValue1;
 
-             set
 
-             {
 
-                 _waferChargeMonitorValue1 = value;
 
-                 NotifyOfPropertyChange(nameof(WaferChargeMonitorValue1));
 
-             }
 
-         }
 
-         private MonitorTransferType _waferChargeMonitor2 = MonitorTransferType.AutoLayout;
 
-         public MonitorTransferType WaferChargeMonitor2
 
-         {
 
-             get => _waferChargeMonitor2;
 
-             set
 
-             {
 
-                 _waferChargeMonitor2 = value;
 
-                 NotifyOfPropertyChange(nameof(WaferChargeMonitor2));
 
-             }
 
-         }
 
-         private string _waferChargeMonitorValue2 = "";
 
-         public string WaferChargeMonitorValue2
 
-         {
 
-             get => _waferChargeMonitorValue2;
 
-             set
 
-             {
 
-                 _waferChargeMonitorValue2 = value;
 
-                 NotifyOfPropertyChange(nameof(WaferChargeMonitorValue2));
 
-             }
 
-         }
 
-         private string _fillDummyTransferStr = "None";
 
-         public string FillDummyTransferStr
 
-         {
 
-             get => _fillDummyTransferStr;
 
-             set
 
-             {
 
-                 _fillDummyTransferStr = value;
 
-                 NotifyOfPropertyChange(nameof(FillDummyTransferStr));
 
-             }
 
-         }
 
-         private string _productZeroStr;
 
-         public string ProductZeroStr
 
-         {
 
-             get => _productZeroStr;
 
-             set
 
-             {
 
-                 _productZeroStr = value;
 
-                 NotifyOfPropertyChange(nameof(ProductZeroStr));
 
-             }
 
-         }
 
-         private string _ProductTransferStr;
 
-         public string ProductTransferStr
 
-         {
 
-             get => _ProductTransferStr;
 
-             set
 
-             {
 
-                 _ProductTransferStr = value;
 
-                 NotifyOfPropertyChange(nameof(ProductTransferStr));
 
-             }
 
-         }
 
-         private MonitorReturnType _dialogResultmonitor1 = MonitorReturnType.ChargeSlot;
 
-         public MonitorReturnType DialogResultmonitor1
 
-         {
 
-             get => _dialogResultmonitor1;
 
-             set
 
-             {
 
-                 _dialogResultmonitor1 = value;
 
-                 NotifyOfPropertyChange(nameof(DialogResultmonitor1));
 
-             }
 
-         }
 
-         private MonitorReturnType _dialogResultmonitor2 = MonitorReturnType.ChargeSlot;
 
-         public MonitorReturnType DialogResultmonitor2
 
-         {
 
-             get => _dialogResultmonitor2;
 
-             set
 
-             {
 
-                 _dialogResultmonitor2 = value;
 
-                 NotifyOfPropertyChange(nameof(DialogResultmonitor2));
 
-             }
 
-         }
 
-         private string _yAxisModeStr = "Normal";
 
-         public string YAxisModeStr
 
-         {
 
-             get => _yAxisModeStr;
 
-             set
 
-             {
 
-                 _yAxisModeStr = value;
 
-                 NotifyOfPropertyChange(nameof(YAxisModeStr));
 
-             }
 
-         }
 
-         private int _topSlotNo = 149;
 
-         public int TopSlotNo
 
-         {
 
-             get => _topSlotNo;
 
-             set
 
-             {
 
-                 _topSlotNo = value;
 
-                 NotifyOfPropertyChange(nameof(TopSlotNo));
 
-             }
 
-         }
 
-         private int _upperSideDummyNum = 3;
 
-         public int UpperSideDummyNum
 
-         {
 
-             get => _upperSideDummyNum;
 
-             set
 
-             {
 
-                 _upperSideDummyNum = value;
 
-                 NotifyOfPropertyChange(nameof(UpperSideDummyNum));
 
-             }
 
-         }
 
-         private int _boatTotalSlot = 143;
 
-         public int BoatTotalSlot
 
-         {
 
-             get => _boatTotalSlot;
 
-             set
 
-             {
 
-                 _boatTotalSlot = value;
 
-                 NotifyOfPropertyChange(nameof(BoatTotalSlot));
 
-             }
 
-         }
 
-         private int _upperSDNum = 0;
 
-         public int UpperSDNum
 
-         {
 
-             get => _upperSDNum;
 
-             set
 
-             {
 
-                 _upperSDNum = value;
 
-                 NotifyOfPropertyChange(nameof(UpperSDNum));
 
-             }
 
-         }
 
-         private int _productNum = 0;
 
-         public int ProductNum
 
-         {
 
-             get => _productNum;
 
-             set
 
-             {
 
-                 _productNum = value;
 
-                 NotifyOfPropertyChange(nameof(ProductNum));
 
-             }
 
-         }
 
-         private int _monitorNum1 = 0;
 
-         public int MonitorNum1
 
-         {
 
-             get => _monitorNum1;
 
-             set
 
-             {
 
-                 _monitorNum1 = value;
 
-                 NotifyOfPropertyChange(nameof(MonitorNum1));
 
-             }
 
-         }
 
-         private int _monitorNum2 = 0;
 
-         public int MonitorNum2
 
-         {
 
-             get => _monitorNum2;
 
-             set
 
-             {
 
-                 _monitorNum2 = value;
 
-                 NotifyOfPropertyChange(nameof(MonitorNum2));
 
-             }
 
-         }
 
-         private int _lowerSDNum = 0;
 
-         public int LowerSDNum
 
-         {
 
-             get => _lowerSDNum;
 
-             set
 
-             {
 
-                 _lowerSDNum = value;
 
-                 NotifyOfPropertyChange(nameof(LowerSDNum));
 
-             }
 
-         }
 
-         private int _lowerSideDummyNum = 9;
 
-         public int LowerSideDummyNum
 
-         {
 
-             get => _lowerSideDummyNum;
 
-             set
 
-             {
 
-                 _lowerSideDummyNum = value;
 
-                 NotifyOfPropertyChange(nameof(LowerSideDummyNum));
 
-             }
 
-         }
 
-         private List<string> _boatMapWafers = new List<string>();
 
-         public List<string> BoatMapWafers
 
-         {
 
-             get => _boatMapWafers;
 
-             set
 
-             {
 
-                 _boatMapWafers = value;
 
-                 NotifyOfPropertyChange(nameof(BoatMapWafers));
 
-             }
 
-         }
 
-         public RecipeFormatBuilder ColumnBuilder { get; set; }
 
-         public RecipeLayoutEditViewModel(string strPrefixPath, string strName, RecipeFormatBuilder columnBuilder, string permission = "")
 
-         {
 
-             FoupListMaxValue = (int)QueryDataClient.Instance.Service.GetConfig("Boat.SlotCount");
 
-             _cassetteSlotCount = (int)QueryDataClient.Instance.Service.GetConfig("System.CassetteSlotCount");
 
-             RecipeName = strName;
 
-             ColumnBuilder = columnBuilder;
 
-             LoadData(strPrefixPath, strName, permission);
 
-         }
 
-         private void LoadData(string strPrefixPath, string strName, string permission)
 
-         {
 
-             CurrentRecipe.Clear();
 
-             CurrentRecipe.PrefixPath = strPrefixPath;
 
-             CurrentRecipe.Name = strName;
 
-             CurrentRecipe.RecipePermission = permission;
 
-             var recipeContent = _recipeProvider.LoadRecipe(strPrefixPath, strName);
 
-             if (string.IsNullOrEmpty(recipeContent))
 
-             {
 
-                 System.Windows.MessageBox.Show($"{CurrentRecipe.PrefixPath}\\{CurrentRecipe.Name} is empty, please confirm the file is valid.");
 
-                 return;
 
-             }
 
-             CurrentRecipe.RecipeChamberType = "OriginChamber";
 
-             CurrentRecipe.InitData(CurrentRecipe.PrefixPath, CurrentRecipe.Name, recipeContent, ColumnBuilder.Configs, "PM1");
 
-             var waferNumberAll = (int)QueryDataClient.Instance.Service.GetConfig("Boat.SlotCount");
 
-             var cassetteSlotCount = (int)QueryDataClient.Instance.Service.GetConfig("System.CassetteSlotCount");
 
-             List<string> listWafers = QueryDataClient.Instance.Service.GetLayoutRecipeContent(CurrentRecipe.GetXmlString(), waferNumberAll.ToString(), cassetteSlotCount.ToString());
 
-             BoatMapWafers = listWafers;
 
-             if (CurrentRecipe.ExpertSteps.Count == 0 || CurrentRecipe.ExpertSteps[0].Items.Count <= 0)
 
-             {
 
-                 RecipeLayoutEntityExpert expert = new RecipeLayoutEntityExpert();
 
-                 CurrentRecipe.ExpertSteps.Add(expert);
 
-                 for (int i = 0; i < FoupListMaxValue; i++)
 
-                 {
 
-                     BoatWaferItem item = new BoatWaferItem() { Slot = i + 1, Description = $"" };
 
-                     CurrentRecipe.ExpertSteps[0].Items.Add(item);
 
-                 }
 
-             }
 
-             if (CurrentRecipe.NormalSteps.Count == 0 || CurrentRecipe.ExpertSteps[0].Items.Count <= 0)
 
-             {
 
-                 RecipeLayoutEntityNormal normal = new RecipeLayoutEntityNormal();
 
-                 CurrentRecipe.NormalSteps.Add(normal);
 
-             }
 
-             if (CurrentRecipe.ConfigItems != null && CurrentRecipe.ConfigItems.Count > 0)
 
-             {
 
-                 var asd = CurrentRecipe.ConfigItems.Select(a => a.Name).ToList();
 
-                 if (CurrentRecipe.ConfigItems.Where(x => x.Name == "BoatTotalSlot").Count() > 0)
 
-                 {
 
-                     BoatTotalSlot = ((NumParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "BoatTotalSlot").FirstOrDefault()).Value;
 
-                 }
 
-                 if (CurrentRecipe.ConfigItems.Where(x => x.Name == "UpperSDNum").Count() > 0)
 
-                 {
 
-                     UpperSDNum = ((NumParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "UpperSDNum").FirstOrDefault()).Value;
 
-                 }
 
-                 if (CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductNum").Count() > 0)
 
-                 {
 
-                     ProductNum = ((NumParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductNum").FirstOrDefault()).Value;
 
-                 }
 
-                 if (CurrentRecipe.ConfigItems.Where(x => x.Name == "MonitorNum1").Count() > 0)
 
-                 {
 
-                     ProductNum = ((NumParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "MonitorNum1").FirstOrDefault()).Value;
 
-                 }
 
-                 if (CurrentRecipe.ConfigItems.Where(x => x.Name == "MonitorNum2").Count() > 0)
 
-                 {
 
-                     ProductNum = ((NumParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "MonitorNum2").FirstOrDefault()).Value;
 
-                 }
 
-                 if (CurrentRecipe.ConfigItems.Where(x => x.Name == "LowerSDNum").Count() > 0)
 
-                 {
 
-                     LowerSDNum = ((NumParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "LowerSDNum").FirstOrDefault()).Value;
 
-                 }
 
-                 if (CurrentRecipe.ConfigItems.Where(x => x.Name == "TopSlotNo").Count() > 0)
 
-                 {
 
-                     TopSlotNo = ((NumParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "TopSlotNo").FirstOrDefault()).Value;
 
-                 }
 
-                 if (CurrentRecipe.ConfigItems.Where(x => x.Name == "UpperSideDummyNum").Count() > 0)
 
-                 {
 
-                     UpperSideDummyNum = ((NumParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "UpperSideDummyNum").FirstOrDefault()).Value;
 
-                 }
 
-                 if (CurrentRecipe.ConfigItems.Where(x => x.Name == "BoatMapDecisionMethod").Count() > 0)
 
-                 {
 
-                     IsDispTypeEnabled = ((NumParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "BoatMapDecisionMethod").FirstOrDefault()).Value == 0 ? true : false;
 
-                 }
 
-                 if (CurrentRecipe.ConfigItems.Where(x => x.Name == "LowerSideDummyNum").Count() > 0)
 
-                 {
 
-                     LowerSideDummyNum = ((NumParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "LowerSideDummyNum").FirstOrDefault()).Value;
 
-                 }
 
-                 if (CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductAndFill").Count() > 0)
 
-                 {
 
-                     if (string.IsNullOrEmpty(((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductAndFill").FirstOrDefault()).Value))
 
-                     {
 
-                         TotalWaferNumber = TotalWaferNumberMode.Total;
 
-                     }
 
-                     else
 
-                     {
 
-                         TotalWaferNumber = (TotalWaferNumberMode)Enum.Parse(typeof(TotalWaferNumberMode), ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductAndFill").FirstOrDefault()).Value);
 
-                     }
 
-                 }
 
-                 if (CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductAndFillValue").Count() > 0)
 
-                 {
 
-                     if (!string.IsNullOrEmpty(((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductAndFillValue").FirstOrDefault()).Value))
 
-                     {
 
-                         TotalWaferNumberValue = ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductAndFillValue").FirstOrDefault()).Value;
 
-                     }
 
-                 }
 
-                 if (CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferSupplement").Count() > 0)
 
-                 {
 
-                     if (string.IsNullOrEmpty(((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferSupplement").FirstOrDefault()).Value))
 
-                     {
 
-                         SetLayoutReplacement = LayoutReplacement.Upper;
 
-                     }
 
-                     else
 
-                     {
 
-                         SetLayoutReplacement = (LayoutReplacement)Enum.Parse(typeof(LayoutReplacement), ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferSupplement").FirstOrDefault()).Value);
 
-                     }
 
-                 }
 
-                 if (CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferSupplementValue").Count() > 0)
 
-                 {
 
-                     if (!string.IsNullOrEmpty(((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferSupplementValue").FirstOrDefault()).Value))
 
-                     {
 
-                         SetLayoutReplacementValue = ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferSupplementValue").FirstOrDefault()).Value;
 
-                     }
 
-                 }
 
-                 if (CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferChargeMonitor1").Count() > 0)
 
-                 {
 
-                     if (string.IsNullOrEmpty(((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferChargeMonitor1").FirstOrDefault()).Value))
 
-                     {
 
-                         WaferChargeMonitor1 = MonitorTransferType.AutoLayout;
 
-                     }
 
-                     else
 
-                     {
 
-                         WaferChargeMonitor1 = (MonitorTransferType)Enum.Parse(typeof(MonitorTransferType), ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferChargeMonitor1").FirstOrDefault()).Value);
 
-                     }
 
-                 }
 
-                 if (CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferChargeMonitorValue1").Count() > 0)
 
-                 {
 
-                     if (!string.IsNullOrEmpty(((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferChargeMonitorValue1").FirstOrDefault()).Value))
 
-                     {
 
-                         WaferChargeMonitorValue1 = ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferChargeMonitorValue1").FirstOrDefault()).Value;
 
-                     }
 
-                 }
 
-                 if (CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferChargeMonitor2").Count() > 0)
 
-                 {
 
-                     if (string.IsNullOrEmpty(((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferChargeMonitor2").FirstOrDefault()).Value))
 
-                     {
 
-                         WaferChargeMonitor2 = MonitorTransferType.AutoLayout;
 
-                     }
 
-                     else
 
-                     {
 
-                         WaferChargeMonitor2 = (MonitorTransferType)Enum.Parse(typeof(MonitorTransferType), ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferChargeMonitor2").FirstOrDefault()).Value);
 
-                     }
 
-                 }
 
-                 if (CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferChargeMonitorValue2").Count() > 0)
 
-                 {
 
-                     if (!string.IsNullOrEmpty(((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferChargeMonitorValue2").FirstOrDefault()).Value))
 
-                     {
 
-                         WaferChargeMonitorValue2 = ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferChargeMonitorValue2").FirstOrDefault()).Value;
 
-                     }
 
-                 }
 
-                 if (CurrentRecipe.ConfigItems.Where(x => x.Name == "FillDummyTransfer").Count() > 0)
 
-                 {
 
-                     if (string.IsNullOrEmpty(((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "FillDummyTransfer").FirstOrDefault()).Value))
 
-                     {
 
-                         FillDummyTransferStr = "None";
 
-                     }
 
-                     else
 
-                     {
 
-                         FillDummyTransferStr = ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "FillDummyTransfer").FirstOrDefault()).Value;
 
-                     }
 
-                 }
 
-                 if (CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductZeroNotFill").Count() > 0)
 
-                 {
 
-                     if (string.IsNullOrEmpty(((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductZeroNotFill").FirstOrDefault()).Value))
 
-                     {
 
-                         ProductZeroStr = "None";
 
-                     }
 
-                     else
 
-                     {
 
-                         ProductZeroStr = ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductZeroNotFill").FirstOrDefault()).Value;
 
-                     }
 
-                 }
 
-                 if (CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductTransferPosition").Count() > 0)
 
-                 {
 
-                     if (string.IsNullOrEmpty(((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductTransferPosition").FirstOrDefault()).Value))
 
-                     {
 
-                         ProductTransferStr = "None";
 
-                     }
 
-                     else
 
-                     {
 
-                         ProductTransferStr = ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductTransferPosition").FirstOrDefault()).Value;
 
-                     }
 
-                 }
 
-                 if (CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferDischargeMonitor1").Count() > 0)
 
-                 {
 
-                     if (string.IsNullOrEmpty(((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferDischargeMonitor1").FirstOrDefault()).Value))
 
-                     {
 
-                         DialogResultmonitor1 = MonitorReturnType.ChargeSlot;
 
-                     }
 
-                     else
 
-                     {
 
-                         DialogResultmonitor1 = (MonitorReturnType)Enum.Parse(typeof(MonitorReturnType), ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferDischargeMonitor1").FirstOrDefault()).Value);
 
-                     }
 
-                 }
 
-                 if (CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferDischargeMonitor2").Count() > 0)
 
-                 {
 
-                     if (string.IsNullOrEmpty(((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferDischargeMonitor2").FirstOrDefault()).Value))
 
-                     {
 
-                         DialogResultmonitor2 = MonitorReturnType.ChargeSlot;
 
-                     }
 
-                     else
 
-                     {
 
-                         DialogResultmonitor2 = (MonitorReturnType)Enum.Parse(typeof(MonitorReturnType), ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferDischargeMonitor2").FirstOrDefault()).Value);
 
-                     }
 
-                 }
 
-             }
 
-             if (null != BoatMapWafers && BoatMapWafers.Count > 0)
 
-             {
 
-                 var data = ComputSD(BoatMapWafers);
 
-                 UpperSDNum = listWafers.Where(x => x == "SD").Count();
 
-                 LowerSDNum = listWafers.Where(x => x == "FD").Count();
 
-                 ProductNum = listWafers.Where(x => !string.IsNullOrEmpty(x) && x.StartsWith("P")).Count();
 
-                 MonitorNum1 = listWafers.Where(x => x == "M1").Count();
 
-                 MonitorNum2 = listWafers.Where(x => x == "M2").Count();
 
-             }
 
-         }
 
-         protected override void OnActivate()
 
-         {
 
-             base.OnActivate();
 
-         }
 
-         public void SetCommand(object obj)
 
-         {
 
-             WindowManager wm = new WindowManager();
 
-             switch (obj.ToString())
 
-             {
 
-                 case "Product Pos":
 
-                     RecipeProductPosViewModel viewProduct = new RecipeProductPosViewModel();
 
-                     viewProduct.NormalEntity = NormalEntity;
 
-                     wm.ShowDialogWithTitle(viewProduct, null, obj.ToString());
 
-                     SelectedSlotType = "";
 
-                     break;
 
-                 case "Monitor Pos":
 
-                     RecipeMonitorPosViewModel viewMonitor = new RecipeMonitorPosViewModel();
 
-                     viewMonitor.NormalEntity = NormalEntity;
 
-                     wm.ShowDialogWithTitle(viewMonitor, null, obj.ToString());
 
-                     SelectedSlotType = obj.ToString();
 
-                     break;
 
-                 case "All Clear":
 
-                     NormalEntity = new RecipeLayoutEntityNormal()
 
-                     {
 
-                         WhenPWaferShort = NormalEntity.WhenPWaferShort,
 
-                         SDRule = NormalEntity.SDRule,
 
-                         WhenCassetteInBatchAreShort = NormalEntity.WhenCassetteInBatchAreShort,
 
-                         WhenWaferInCassetteAreShort = NormalEntity.WhenWaferInCassetteAreShort,
 
-                         WhenEDAreShort = NormalEntity.WhenEDAreShort,
 
-                         RuleOfSpaceInBoat = NormalEntity.RuleOfSpaceInBoat,
 
-                     };
 
-                     foreach (var item in BoatWafers)
 
-                     {
 
-                         item.Description = "";
 
-                     }
 
-                     SelectedSlotType = obj.ToString();
 
-                     break;
 
-                 case "Wafer Charge Rule":
 
-                     RecipeWaferChargeRuleViewModel viewWaferChargeRule = new RecipeWaferChargeRuleViewModel();
 
-                     viewWaferChargeRule.NormalEntity = NormalEntity;
 
-                     wm.ShowDialogWithTitle(viewWaferChargeRule, null, obj.ToString());
 
-                     SelectedSlotType = obj.ToString();
 
-                     break;
 
-                 case "Product":
 
-                     //NormalEntity.ProductSlotNo = ProccessSlotNoPositionString("Add",NormalEntity.ProductSlotNo,currentItemIndex);
 
-                     //NormalEntity.MonitorSlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.MonitorSlotNo,currentItemIndex);
 
-                     SelectedSlotType = obj.ToString();
 
-                     break;
 
-                 case "Monitor":
 
-                     //NormalEntity.MonitorSlotNo = ProccessSlotNoPositionString("Add",NormalEntity.MonitorSlotNo, currentItemIndex);
 
-                     //NormalEntity.ProductSlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.ProductSlotNo, currentItemIndex);
 
-                     SelectedSlotType = obj.ToString();
 
-                     break;
 
-                 case "Space":
 
-                     //NormalEntity.ProductSlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.ProductSlotNo, currentItemIndex);
 
-                     //NormalEntity.MonitorSlotNo = ProccessSlotNoPositionString("Delete",NormalEntity.MonitorSlotNo, currentItemIndex);
 
-                     SelectedSlotType = obj.ToString();
 
-                     break;
 
-             }
 
-         }
 
-         private string ProccessSlotNoPositionString(string strType, string str, int iCurrentItemIndex)
 
-         {
 
-             string strRet = "";
 
-             if (iCurrentItemIndex <= 0) return strRet;
 
-             string strOrgTemp = "," + str;
 
-             string strDesTemp = "," + iCurrentItemIndex;
 
-             string strComTemp = "," + iCurrentItemIndex + ",";
 
-             if (strType == "Add")
 
-             {
 
-                 if (!strOrgTemp.Contains(strComTemp))
 
-                     strOrgTemp = strOrgTemp + strDesTemp;
 
-             }
 
-             else
 
-             {
 
-                 if (strOrgTemp.Contains(strDesTemp))
 
-                     strOrgTemp = strOrgTemp.Replace(strDesTemp, "");
 
-             }
 
-             strRet = strOrgTemp;
 
-             for (int i = 0; i < 2; i++)
 
-             {
 
-                 if (strRet.StartsWith(","))
 
-                     strRet = strRet.Substring(1);
 
-             }
 
-             return strRet;
 
-         }
 
-         public void TextSelectCmdMouseDown(string cmd, object sender)
 
-         {
 
-             var colsender = (TextBox)sender;
 
-             WindowManager wm = new WindowManager();
 
-             switch (cmd)
 
-             {
 
-                 case "TotalWaferNumber":
 
-                     RecipeLayoutSetTotalWaferNumberViewModel recipeLayoutSetTotalWaferNumberViewModel = new RecipeLayoutSetTotalWaferNumberViewModel();
 
-                     recipeLayoutSetTotalWaferNumberViewModel.TotalWaferNumber = TotalWaferNumber;
 
-                     recipeLayoutSetTotalWaferNumberViewModel.ReturnValue = TotalWaferNumberValue;
 
-                     bool? dialogReturn = wm.ShowDialogWithTitle(recipeLayoutSetTotalWaferNumberViewModel, null, "WAP Logic Design");
 
-                     if ((bool)dialogReturn)
 
-                     {
 
-                         TotalWaferNumber = recipeLayoutSetTotalWaferNumberViewModel.DialogResultTotalWaferNumberMode;
 
-                         TotalWaferNumberValue = recipeLayoutSetTotalWaferNumberViewModel.ReturnValue;
 
-                     }
 
-                     break;
 
-                 case "Replacement":
 
-                     RecipeLayoutSetReplacementViewModel recipeLayoutSetReplacementViewModel = new RecipeLayoutSetReplacementViewModel();
 
-                     recipeLayoutSetReplacementViewModel.SetLayoutReplacement = SetLayoutReplacement;
 
-                     dialogReturn = wm.ShowDialogWithTitle(recipeLayoutSetReplacementViewModel, null, "File Wafer Replacement");
 
-                     if ((bool)dialogReturn)
 
-                     {
 
-                         SetLayoutReplacement = recipeLayoutSetReplacementViewModel.DialogResultLayoutReplacement;
 
-                     }
 
-                     break;
 
-                 case "WaferChargeMonitor1":
 
-                     RecipeLayoutSetMonitorTransferViewModel recipeLayoutSetMonitorTransferViewModel1 = new RecipeLayoutSetMonitorTransferViewModel();
 
-                     recipeLayoutSetMonitorTransferViewModel1.WaferChargeMonitor = WaferChargeMonitor1;
 
-                     recipeLayoutSetMonitorTransferViewModel1.WaferChargeMonitorValue = WaferChargeMonitorValue1;
 
-                     dialogReturn = wm.ShowDialogWithTitle(recipeLayoutSetMonitorTransferViewModel1, null, "Monitor Transfer1");
 
-                     if ((bool)dialogReturn)
 
-                     {
 
-                         WaferChargeMonitor1 = recipeLayoutSetMonitorTransferViewModel1.DialogResultMonitorTransferType;
 
-                         WaferChargeMonitorValue1 = recipeLayoutSetMonitorTransferViewModel1.ReturnString;
 
-                     }
 
-                     break;
 
-                 case "WaferChargeMonitor2":
 
-                     RecipeLayoutSetMonitorTransferViewModel recipeLayoutSetMonitorTransferViewModel2 = new RecipeLayoutSetMonitorTransferViewModel();
 
-                     recipeLayoutSetMonitorTransferViewModel2.WaferChargeMonitor = WaferChargeMonitor2;
 
-                     dialogReturn = wm.ShowDialogWithTitle(recipeLayoutSetMonitorTransferViewModel2, null, "Monitor Transfer2");
 
-                     if ((bool)dialogReturn)
 
-                     {
 
-                         WaferChargeMonitor2 = recipeLayoutSetMonitorTransferViewModel2.DialogResultMonitorTransferType;
 
-                         WaferChargeMonitorValue2 = recipeLayoutSetMonitorTransferViewModel2.ReturnString;
 
-                     }
 
-                     break;
 
-                 case "MonitorReturn1":
 
-                     RecipeLayoutSetMonitorReturnViewModel recipeLayoutSetMonitorReturnViewModel = new RecipeLayoutSetMonitorReturnViewModel();
 
-                     recipeLayoutSetMonitorReturnViewModel.DialogResultmonitor = DialogResultmonitor1;
 
-                     dialogReturn = wm.ShowDialogWithTitle(recipeLayoutSetMonitorReturnViewModel, null, "Monitor Return1");
 
-                     if ((bool)dialogReturn)
 
-                     {
 
-                         DialogResultmonitor1 = recipeLayoutSetMonitorReturnViewModel.DialogResultmonitor;
 
-                     }
 
-                     break;
 
-                 case "MonitorReturn2":
 
-                     RecipeLayoutSetMonitorReturnViewModel recipeLayoutSetMonitorReturnViewModel2 = new RecipeLayoutSetMonitorReturnViewModel();
 
-                     recipeLayoutSetMonitorReturnViewModel2.DialogResultmonitor = DialogResultmonitor2;
 
-                     dialogReturn = wm.ShowDialogWithTitle(recipeLayoutSetMonitorReturnViewModel2, null, "Monitor Return2");
 
-                     if ((bool)dialogReturn)
 
-                     {
 
-                         DialogResultmonitor2 = recipeLayoutSetMonitorReturnViewModel2.DialogResultmonitor;
 
-                     }
 
-                     break;
 
-                 case "FillDummyTransfer":
 
-                     RecipeLayoutSetFillDummyTransferViewModel recipeLayoutSetFillDummyTransferViewModel = new RecipeLayoutSetFillDummyTransferViewModel();
 
-                     recipeLayoutSetFillDummyTransferViewModel.FillDummyTransferStr = FillDummyTransferStr;
 
-                     dialogReturn = wm.ShowDialogWithTitle(recipeLayoutSetFillDummyTransferViewModel, null, "Fill Dummy Transfer");
 
-                     if ((bool)dialogReturn)
 
-                     {
 
-                         FillDummyTransferStr = recipeLayoutSetFillDummyTransferViewModel.DialogResultString;
 
-                     }
 
-                     break;
 
-                 case "ProductZero":
 
-                     SelectExistViewModel selectExistViewModel = new SelectExistViewModel();
 
-                     selectExistViewModel.ProductZeroStr = ProductZeroStr;
 
-                     dialogReturn = wm.ShowDialogWithTitle(selectExistViewModel, null, "Select");
 
-                     if ((bool)dialogReturn)
 
-                     {
 
-                         ProductZeroStr = selectExistViewModel.DialogResultString;
 
-                     }
 
-                     break;
 
-                 case "ProductTransfer":
 
-                     RecipeLayoutSetProductTransferViewModel recipeLayoutSetProductTransferViewModel = new RecipeLayoutSetProductTransferViewModel();
 
-                     recipeLayoutSetProductTransferViewModel.ProductTransferStr = ProductTransferStr;
 
-                     dialogReturn = wm.ShowDialogWithTitle(recipeLayoutSetProductTransferViewModel, null, "Product Transfer Position");
 
-                     if ((bool)dialogReturn)
 
-                     {
 
-                         ProductTransferStr = recipeLayoutSetProductTransferViewModel.DialogResultString;
 
-                     }
 
-                     break;
 
-                 case "Replacement1":
 
-                     RecipeLayoutMonitorWaferReplaceViewModel recipeLayoutMonitorWaferReplaceViewModel = new RecipeLayoutMonitorWaferReplaceViewModel();
 
-                     dialogReturn = wm.ShowDialogWithTitle(recipeLayoutMonitorWaferReplaceViewModel, null, "Monitor Wafer Replace");
 
-                     colsender.Text = recipeLayoutMonitorWaferReplaceViewModel.MonitorWaferFillReplace;
 
-                     break;
 
-                 case "Replacement2":
 
-                     RecipeLayoutMonitorWaferReplaceViewModel recipeLayoutMonitorWaferReplaceViewModel2 = new RecipeLayoutMonitorWaferReplaceViewModel();
 
-                     dialogReturn = wm.ShowDialogWithTitle(recipeLayoutMonitorWaferReplaceViewModel2, null, "Monitor Wafer Replace");
 
-                     colsender.Text = recipeLayoutMonitorWaferReplaceViewModel2.MonitorWaferFillReplace;
 
-                     break;
 
-                 case "YAxisMode":
 
-                     SelectExpandViewModel selectExpandViewModel = new SelectExpandViewModel();
 
-                     dialogReturn = wm.ShowDialogWithTitle(selectExpandViewModel, null, "Select");
 
-                     if ((bool)dialogReturn)
 
-                     {
 
-                         YAxisModeStr = selectExpandViewModel.DialogResultString;
 
-                     }
 
-                     break;
 
-                 default:
 
-                     break;
 
-             }
 
-         }
 
-         public void BoatMapMouseDown()
 
-         {
 
-             WindowManager wm = new WindowManager();
 
-             if (CurrentRecipe != null)
 
-             {
 
-                 RecipeLayoutBoatMapViewModel recipeLayoutBoatMapViewModel = new RecipeLayoutBoatMapViewModel(CurrentRecipe.PrefixPath, CurrentRecipe.Name, ColumnBuilder);
 
-                 var dialogReturn = wm.ShowDialogWithTitle(recipeLayoutBoatMapViewModel, null, "Boat Map Direct Edit");
 
-                 if ((bool)dialogReturn)
 
-                 {
 
-                     BoatMapWafers = recipeLayoutBoatMapViewModel.listBoatWafers.ToList();
 
-                     CurrentRecipe = recipeLayoutBoatMapViewModel.CurrentRecipe;
 
-                     //ProductNum = recipeLayoutBoatMapViewModel.ProductSlotCount;
 
-                     //MonitorNum1 = recipeLayoutBoatMapViewModel.Monitor1SlotCount;
 
-                     //MonitorNum2 = recipeLayoutBoatMapViewModel.Monitor2SlotCount;
 
-                     //var data = ComputSD(BoatMapWafers);
 
-                     //LowerSDNum = data.Item1;
 
-                     //UpperSDNum = data.Item2;
 
-                     var data = ComputSD(BoatMapWafers);
 
-                     UpperSDNum = recipeLayoutBoatMapViewModel.listBoatWafers.Where(x => x == "SD").Count();
 
-                     LowerSDNum = recipeLayoutBoatMapViewModel.listBoatWafers.Where(x => x == "FD").Count();
 
-                     ProductNum = recipeLayoutBoatMapViewModel.listBoatWafers.Where(x => x.StartsWith("P")).Count();
 
-                     MonitorNum1 = recipeLayoutBoatMapViewModel.listBoatWafers.Where(x => x == "M1").Count();
 
-                     MonitorNum2 = recipeLayoutBoatMapViewModel.listBoatWafers.Where(x => x == "M2").Count();
 
-                 }
 
-             }
 
-         }
 
-         private Tuple<int, int> ComputSD(List<string> dataSource)
 
-         {
 
-             List<string> otherSlot = dataSource.Where(a => a != "SD" && !string.IsNullOrEmpty(a)).ToList().Distinct().ToList();
 
-             if (dataSource == null || dataSource.Count == 0)
 
-             {
 
-                 return new Tuple<int, int>(0, 0);
 
-             }
 
-             List<int> minList = new List<int>();
 
-             for (int i = 0; i < dataSource.Count; i++)
 
-             {
 
-                 var item = dataSource[i];
 
-                 if (otherSlot.Contains(item) && !string.IsNullOrEmpty(item))
 
-                 {
 
-                     break;
 
-                 }
 
-                 if (string.IsNullOrEmpty(item))
 
-                 {
 
-                     continue;
 
-                 }
 
-                 minList.Add(i);
 
-             }
 
-             dataSource.Reverse();
 
-             List<int> maxList = new List<int>();
 
-             for (int i = 0; i < dataSource.Count; i++)
 
-             {
 
-                 var item = dataSource[i];
 
-                 if (otherSlot.Contains(item) && !string.IsNullOrEmpty(item))
 
-                 {
 
-                     break;
 
-                 }
 
-                 if (string.IsNullOrEmpty(item))
 
-                 {
 
-                     continue;
 
-                 }
 
-                 maxList.Add(i);
 
-             }
 
-             return new Tuple<int, int>(minList.Count(), maxList.Count());
 
-         }
 
-         public void CancelClick()
 
-         {
 
-             if (DialogBox.ShowDialog(DialogButton.Yes | DialogButton.No, DialogType.CONFIRM, " You confirm that you want to unsave the recipe and exit the interface?") == DialogButton.No)
 
-                 return;
 
-             ((Window)GetView()).Close();
 
-         }
 
-         public void SaveClick()
 
-         {
 
-             SetConfig();
 
-             EndEdit();
 
-         }
 
-         private void SetConfig()
 
-         {
 
-             if (CurrentRecipe.ConfigItems != null && CurrentRecipe.ConfigItems.Count > 0)
 
-             {
 
-                 if (CurrentRecipe.ConfigItems.Where(x => x.Name == "BoatTotalSlot").Count() > 0)
 
-                 {
 
-                     ((NumParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "BoatTotalSlot").FirstOrDefault()).Value = BoatTotalSlot;
 
-                 }
 
-                 if (CurrentRecipe.ConfigItems.Where(x => x.DisplayName == "UpperSDNum").Count() > 0)
 
-                 {
 
-                     ((NumParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "UpperSDNum").FirstOrDefault()).Value = UpperSDNum;
 
-                 }
 
-                 if (CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductNum").Count() > 0)
 
-                 {
 
-                     ((NumParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductNum").FirstOrDefault()).Value = ProductNum;
 
-                 }
 
-                 if (CurrentRecipe.ConfigItems.Where(x => x.Name == "MonitorNum1").Count() > 0)
 
-                 {
 
-                     ((NumParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "MonitorNum1").FirstOrDefault()).Value = ProductNum;
 
-                 }
 
-                 if (CurrentRecipe.ConfigItems.Where(x => x.Name == "MonitorNum2").Count() > 0)
 
-                 {
 
-                     ((NumParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "MonitorNum2").FirstOrDefault()).Value = ProductNum;
 
-                 }
 
-                 if (CurrentRecipe.ConfigItems.Where(x => x.Name == "LowerSDNum").Count() > 0)
 
-                 {
 
-                     ((NumParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "LowerSDNum").FirstOrDefault()).Value = LowerSDNum;
 
-                 }
 
-             }
 
-             if (CurrentRecipe.ConfigItems.Where(x => x.Name == "TopSlotNo").Count() > 0)
 
-             {
 
-                 ((NumParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "TopSlotNo").FirstOrDefault()).Value = TopSlotNo;
 
-             }
 
-             if (CurrentRecipe.ConfigItems.Where(x => x.Name == "UpperSideDummyNum").Count() > 0)
 
-             {
 
-                 ((NumParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "UpperSideDummyNum").FirstOrDefault()).Value = UpperSideDummyNum;
 
-             }
 
-             if (CurrentRecipe.ConfigItems.Where(x => x.Name == "BoatMapDecisionMethod").Count() > 0)
 
-             {
 
-                 //  IsDispTypeEnabled = ((NumParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "BoatMapDecisionMethod").FirstOrDefault()).Value == 0 ? true : false;
 
-             }
 
-             if (CurrentRecipe.ConfigItems.Where(x => x.Name == "LowerSideDummyNum").Count() > 0)
 
-             {
 
-                 ((NumParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "LowerSideDummyNum").FirstOrDefault()).Value = LowerSideDummyNum;
 
-             }
 
-             if (CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductAndFill").Count() > 0)
 
-             {
 
-                 ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductAndFill").FirstOrDefault()).Value = TotalWaferNumber.ToString();
 
-             }
 
-             if (CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductAndFillValue").Count() > 0)
 
-             {
 
-                 ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductAndFillValue").FirstOrDefault()).Value = TotalWaferNumberValue;
 
-             }
 
-             if (CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferSupplement").Count() > 0)
 
-             {
 
-                 ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferSupplement").FirstOrDefault()).Value = SetLayoutReplacement.ToString();
 
-             }
 
-             if (CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferSupplementValue").Count() > 0)
 
-             {
 
-                 ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferSupplementValue").FirstOrDefault()).Value = SetLayoutReplacementValue;
 
-             }
 
-             if (CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferChargeMonitor1").Count() > 0)
 
-             {
 
-                 ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferChargeMonitor1").FirstOrDefault()).Value = WaferChargeMonitor1.ToString();
 
-             }
 
-             if (CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferChargeMonitorValue1").Count() > 0)
 
-             {
 
-                 ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferChargeMonitorValue1").FirstOrDefault()).Value = WaferChargeMonitorValue1;
 
-             }
 
-             if (CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferChargeMonitor2").Count() > 0)
 
-             {
 
-                 ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferChargeMonitor2").FirstOrDefault()).Value = WaferChargeMonitor2.ToString();
 
-             }
 
-             if (CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferChargeMonitorValue2").Count() > 0)
 
-             {
 
-                 ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferChargeMonitorValue2").FirstOrDefault()).Value = WaferChargeMonitorValue2;
 
-             }
 
-             if (CurrentRecipe.ConfigItems.Where(x => x.Name == "FillDummyTransfer").Count() > 0)
 
-             {
 
-                 ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "FillDummyTransfer").FirstOrDefault()).Value = FillDummyTransferStr;
 
-             }
 
-             if (CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductZeroNotFill").Count() > 0)
 
-             {
 
-                 ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductZeroNotFill").FirstOrDefault()).Value = ProductZeroStr;
 
-             }
 
-             if (CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductTransferPosition").Count() > 0)
 
-             {
 
-                 ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductTransferPosition").FirstOrDefault()).Value = ProductTransferStr;
 
-             }
 
-             if (CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferDischargeMonitor1").Count() > 0)
 
-             {
 
-                 ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferDischargeMonitor1").FirstOrDefault()).Value = DialogResultmonitor1.ToString();
 
-             }
 
-             if (CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferDischargeMonitor2").Count() > 0)
 
-             {
 
-                 ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferDischargeMonitor2").FirstOrDefault()).Value = DialogResultmonitor2.ToString();
 
-             }
 
-         }
 
-         public void EndEdit()
 
-         {
 
-             RecipePermissionSelectViewModel dialog = new RecipePermissionSelectViewModel("Save recipe and permission", "", CurrentRecipe.Description);
 
-             WindowManager wm = new WindowManager();
 
-             bool? dialogReturn = wm.ShowDialog(dialog);
 
-             if (!dialogReturn.HasValue || !dialogReturn.Value)
 
-                 return;
 
-             if (string.IsNullOrEmpty(CurrentRecipe.NormalSteps[0].DummyLowerSlot))
 
-             {
 
-                 DialogBox.ShowWarning("DummyLowerSlot is empty,can not save!");
 
-                 return;
 
-             }
 
-             if (string.IsNullOrEmpty(CurrentRecipe.NormalSteps[0].DummyUpperSlot))
 
-             {
 
-                 DialogBox.ShowWarning("DummyUpperSlot is empty,can not save!");
 
-                 return;
 
-             }
 
-             if (string.IsNullOrEmpty(CurrentRecipe.NormalSteps[0].CenteringSlotPosition))
 
-             {
 
-                 DialogBox.ShowWarning("CenteringSlotPosition is empty,can not save!");
 
-                 return;
 
-             }
 
-             //if (string.IsNullOrEmpty(CurrentRecipe.NormalSteps[0].Pitch))
 
-             //{
 
-             //    DialogBox.ShowWarning("Pitch is empty,can not save!");
 
-             //    return;
 
-             //}
 
-             if (string.IsNullOrEmpty(CurrentRecipe.NormalSteps[0].ProductPosition))
 
-             {
 
-                 DialogBox.ShowWarning("ProductPosition is empty,can not save!");
 
-                 return;
 
-             }
 
-             if (string.IsNullOrEmpty(CurrentRecipe.NormalSteps[0].MonitorPosition))
 
-             {
 
-                 DialogBox.ShowWarning("MonitorPosition is empty,can not save!");
 
-                 return;
 
-             }
 
-             if (string.IsNullOrEmpty(CurrentRecipe.NormalSteps[0].WhenCassetteInBatchAreShort))
 
-             {
 
-                 DialogBox.ShowWarning("WhenCassetteInBatchAreShort is empty,can not save!");
 
-                 return;
 
-             }
 
-             if (string.IsNullOrEmpty(CurrentRecipe.NormalSteps[0].WhenPWaferShort))
 
-             {
 
-                 DialogBox.ShowWarning("WhenPWaferShort is empty,can not save!");
 
-                 return;
 
-             }
 
-             if (string.IsNullOrEmpty(CurrentRecipe.NormalSteps[0].WhenWaferInCassetteAreShort))
 
-             {
 
-                 DialogBox.ShowWarning("WhenWaferInCassetteAreShort is empty,can not save!");
 
-                 return;
 
-             }
 
-             if (string.IsNullOrEmpty(CurrentRecipe.NormalSteps[0].WhenEDAreShort))
 
-             {
 
-                 DialogBox.ShowWarning("WhenEDAreShort is empty,can not save!");
 
-                 return;
 
-             }
 
-             if (string.IsNullOrEmpty(CurrentRecipe.NormalSteps[0].SDRule))
 
-             {
 
-                 DialogBox.ShowWarning("SDRule is empty,can not save!");
 
-                 return;
 
-             }
 
-             if (string.IsNullOrEmpty(CurrentRecipe.NormalSteps[0].RuleOfSpaceInBoat))
 
-             {
 
-                 DialogBox.ShowWarning("RuleOfSpaceInBoat is empty,can not save!");
 
-                 return;
 
-             }
 
-             CurrentRecipe.IsSavedDesc = false;
 
-             this.CurrentRecipe.Revisor = BaseApp.Instance.UserContext.LoginName;
 
-             this.CurrentRecipe.ReviseTime = DateTime.Now;
 
-             this.CurrentRecipe.RecipeLevel = this.LevelDisplay;
 
-             this.CurrentRecipe.Description = dialog.RecipeComment;
 
-             this._recipeProvider.SaveRecipe(CurrentRecipe.PrefixPath, CurrentRecipe.Name, CurrentRecipe.GetXmlString());
 
-             ((Window)GetView()).DialogResult = true;
 
-         }
 
-         public void Cancel()
 
-         {
 
-             if (DialogBox.ShowDialog(DialogButton.Yes | DialogButton.No, DialogType.CONFIRM, " You confirm that you want to unsave the recipe and exit the interface?") == DialogButton.No)
 
-                 return;
 
-             ((Window)GetView()).Close();
 
-         }
 
-         public void EditModeSelectClick(string cmd)
 
-         {
 
-             switch (cmd)
 
-             {
 
-                 case "Before":
 
-                     SetBeforeEdit();
 
-                     break;
 
-                 case "After":
 
-                     SetAfterEdit();
 
-                     break;
 
-                 default:
 
-                     break;
 
-             }
 
-         }
 
-         private void SetBeforeEdit()
 
-         { }
 
-         private void SetAfterEdit()
 
-         { }
 
-         private Visibility _istBoatMapLogicalVisibility;
 
-         public Visibility IstBoatMapLogicalVisibility
 
-         {
 
-             get => _istBoatMapLogicalVisibility;
 
-             set
 
-             {
 
-                 _istBoatMapLogicalVisibility = value;
 
-                 NotifyOfPropertyChange(nameof(IstBoatMapLogicalVisibility));
 
-             }
 
-         }
 
-         private Visibility _istBoatMapDirectVisibility = Visibility.Hidden;
 
-         public Visibility IstBoatMapDirectVisibility
 
-         {
 
-             get => _istBoatMapDirectVisibility;
 
-             set
 
-             {
 
-                 _istBoatMapDirectVisibility = value;
 
-                 NotifyOfPropertyChange(nameof(IstBoatMapDirectVisibility));
 
-             }
 
-         }
 
-         private bool _isDispTypeEnabled = true;
 
-         public bool IsDispTypeEnabled
 
-         {
 
-             get => _isDispTypeEnabled;
 
-             set
 
-             {
 
-                 _isDispTypeEnabled = value;
 
-                 NotifyOfPropertyChange(nameof(IsDispTypeEnabled));
 
-             }
 
-         }
 
-         private void SetBoatMapLogical()
 
-         {
 
-             IstBoatMapLogicalVisibility = Visibility.Visible;
 
-             IstBoatMapDirectVisibility = Visibility.Hidden;
 
-             IsDispTypeEnabled = true;
 
-         }
 
-         private void SetBoatMapDirect()
 
-         {
 
-             IstBoatMapLogicalVisibility = Visibility.Hidden;
 
-             IstBoatMapDirectVisibility = Visibility.Visible;
 
-             IsDispTypeEnabled = false;
 
-         }
 
-         public void BoatMapSelectClick(string cmd)
 
-         {
 
-             switch (cmd)
 
-             {
 
-                 case "Logical":
 
-                     SetBoatMapLogical();
 
-                     break;
 
-                 case "Direct":
 
-                     SetBoatMapDirect();
 
-                     break;
 
-                 default:
 
-                     break;
 
-             }
 
-         }
 
-         private Visibility _istDispTypeToNumber;
 
-         public Visibility IstDispTypeToNumber
 
-         {
 
-             get => _istDispTypeToNumber;
 
-             set
 
-             {
 
-                 _istDispTypeToNumber = value;
 
-                 NotifyOfPropertyChange(nameof(IstDispTypeToNumber));
 
-             }
 
-         }
 
-         private Visibility _istDispTypeToMap;
 
-         public Visibility IstDispTypeToMap
 
-         {
 
-             get => _istDispTypeToMap;
 
-             set
 
-             {
 
-                 _istDispTypeToMap = value;
 
-                 NotifyOfPropertyChange(nameof(IstDispTypeToMap));
 
-             }
 
-         }
 
-         private Visibility _istDispTypeToCarrier;
 
-         public Visibility IstDispTypeToCarrier
 
-         {
 
-             get => _istDispTypeToCarrier;
 
-             set
 
-             {
 
-                 _istDispTypeToCarrier = value;
 
-                 NotifyOfPropertyChange(nameof(IstDispTypeToCarrier));
 
-             }
 
-         }
 
-         private void SetDispTypeToNumber()
 
-         {
 
-             IstDispTypeToNumber = Visibility.Visible;
 
-             IstDispTypeToMap = Visibility.Hidden;
 
-             IstDispTypeToCarrier = Visibility.Hidden;
 
-         }
 
-         private void SetDispTypeToMap()
 
-         {
 
-             IstDispTypeToNumber = Visibility.Hidden;
 
-             IstDispTypeToMap = Visibility.Visible;
 
-             IstDispTypeToCarrier = Visibility.Hidden;
 
-         }
 
-         private void SetDispTypeToCarrier()
 
-         {
 
-             IstDispTypeToNumber = Visibility.Hidden;
 
-             IstDispTypeToMap = Visibility.Hidden;
 
-             IstDispTypeToCarrier = Visibility.Visible;
 
-         }
 
-         public void DispTypeSelectClick(string cmd)
 
-         {
 
-             switch (cmd)
 
-             {
 
-                 case "Number":
 
-                     SetDispTypeToNumber();
 
-                     break;
 
-                 case "Map":
 
-                     SetDispTypeToMap();
 
-                     break;
 
-                 case "Carrier":
 
-                     SetDispTypeToCarrier();
 
-                     break;
 
-                 default:
 
-                     break;
 
-             }
 
-         }
 
-     }
 
- }
 
 
  |