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.Linq; using System.Windows.Controls; using System.Collections.ObjectModel; namespace FurnaceUI.Views.Recipes { public class RecipeLayoutBoatMapViewModel : FurnaceUIViewModelBase { #region properties 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 waferNumberED; public int WaferNumberED { get { return waferNumberED; } set { waferNumberED = value; NotifyOfPropertyChange(nameof(WaferNumberED)); } } private int waferNumberM; public int WaferNumberM { get { return waferNumberM; } set { waferNumberM = value; NotifyOfPropertyChange(nameof(WaferNumberM)); } } private int waferNumberAll; public int WaferNumberAll { get { return waferNumberAll; } set { waferNumberAll = value; NotifyOfPropertyChange(nameof(WaferNumberAll)); } } private int currentItemIndex; private bool productPositionAuto; public bool ProductPositionAuto { get { return productPositionAuto; } set { productPositionAuto = value; NotifyOfPropertyChange(nameof(ProductPositionAuto)); } } private bool productPositionSlot; public bool ProductPositionSlot { get { return productPositionSlot; } set { productPositionSlot = value; NotifyOfPropertyChange(nameof(ProductPositionSlot)); } } private bool monitorPositionAuto; public bool MonitorPositionAuto { get { return monitorPositionAuto; } set { monitorPositionAuto = value; NotifyOfPropertyChange(nameof(MonitorPositionAuto)); } } private bool monitorPositionSlot; public bool MonitorPositionSlot { get { return monitorPositionSlot; } set { monitorPositionSlot = value; NotifyOfPropertyChange(nameof(MonitorPositionSlot)); } } private bool spaceSlotEnabled; public bool SpaceSlotEnabled { get { return spaceSlotEnabled; } set { spaceSlotEnabled = value; NotifyOfPropertyChange(nameof(SpaceSlotEnabled)); } } public int CurrentItemIndex { get { return currentItemIndex; } set { currentItemIndex = value; SelecteSlot(); this.NotifyOfPropertyChange(nameof(CurrentItemIndex)); } } private RecipeProvider _recipeProvider = new RecipeProvider(); private SolidColorBrush _SDBk = new SolidColorBrush(Color.FromArgb(255, 251, 147, 85)); private SolidColorBrush _FDBk = new SolidColorBrush(Color.FromArgb(255, 170, 147, 255)); private SolidColorBrush _PBk = new SolidColorBrush(Color.FromArgb(255, 2, 255, 255)); private SolidColorBrush _M1Bk = new SolidColorBrush(Color.FromArgb(255, 3, 149, 255)); private SolidColorBrush _M2Bk = new SolidColorBrush(Color.FromArgb(255, 255, 111, 171)); private SolidColorBrush _DefaultdBk = new SolidColorBrush(Colors.White); #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)); } } private List _boatWafers = new List(); public List BoatWafers { get { _boatWafers.Clear(); foreach (var item in CurrentRecipe.ExpertSteps[0].Items) { _boatWafers.Add(item); } _boatWafers.Reverse(); return _boatWafers; } set { CurrentRecipe.ExpertSteps[0].Items = value; } } public bool IsEnable => CGlobal.RecipeLayoutEditViewEnable;//是否是View模式 public SlotType SelectSlotType { get; set; } = SlotType.Space; private int _cassetteSlotCount; private int _productSlotCount = 0; public int ProductSlotCount { get => _productSlotCount; set { _productSlotCount = value; NotifyOfPropertyChange(nameof(ProductSlotCount)); } } private int _monitor1SlotCount = 0; public int Monitor1SlotCount { get => _monitor1SlotCount; set { _monitor1SlotCount = value; NotifyOfPropertyChange(nameof(Monitor1SlotCount)); } } private int _monitor2SlotCount = 0; public int Monitor2SlotCount { get => _monitor2SlotCount; set { _monitor2SlotCount = value; NotifyOfPropertyChange(nameof(Monitor2SlotCount)); } } private int _sDDummySlotCount = 0; public int SDDummySlotCount { get => _sDDummySlotCount; set { _sDDummySlotCount = value; NotifyOfPropertyChange(nameof(SDDummySlotCount)); } } private int _fDDummySlotCount = 0; public int FDDummySlotCount { get => _fDDummySlotCount; set { _fDDummySlotCount = value; NotifyOfPropertyChange(nameof(FDDummySlotCount)); } } private int _noneSlotCount = 0; public int NoneSlotCount { get => _noneSlotCount; set { _noneSlotCount = value; NotifyOfPropertyChange(nameof(NoneSlotCount)); } } private bool _isSelectOnePiece=true; public bool IsSelectOnePiece { get => _isSelectOnePiece; set { _isSelectOnePiece = value; NotifyOfPropertyChange(nameof(IsSelectOnePiece)); } } public void SlotSelectTypeChecked(string cmd) { switch (cmd) { case "Zone": IsSelectOnePiece = false; break; case "1Piece": IsSelectOnePiece = true; break; default: break; } } public ObservableCollection listBoatWafers { get; set; } = new ObservableCollection(); public RecipeFormatBuilder ColumnBuilder { get; set; } public RecipeLayoutBoatMapViewModel(string strPrefixPath, string strName, RecipeFormatBuilder columnBuilder, string permission = "") { WaferNumberAll = (int)QueryDataClient.Instance.Service.GetConfig("Boat.SlotCount"); _cassetteSlotCount = (int)QueryDataClient.Instance.Service.GetConfig("System.CassetteSlotCount"); ColumnBuilder = columnBuilder; LoadData(strPrefixPath, strName, permission); ProductPositionAuto = NormalEntity.ProductPosition == "Auto"; ProductPositionSlot = NormalEntity.ProductPosition == "Slot"; MonitorPositionAuto = NormalEntity.MonitorPosition == "Auto"; MonitorPositionSlot = NormalEntity.MonitorPosition == "Slot"; NormalEntity.ProductPosition = "Slot"; NormalEntity.MonitorPosition = "Slot"; NormalEntity.DummyLowerSlot = "0"; NormalEntity.DummyUpperSlot = "0"; NormalEntity.CenteringSlotPosition = "0"; SpaceSlotEnabled = ProductPositionSlot || MonitorPositionSlot; } 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"); if (CurrentRecipe.ExpertSteps.Count == 0 || CurrentRecipe.ExpertSteps[0].Items.Count != WaferNumberAll) { CurrentRecipe.ExpertSteps.Clear(); RecipeLayoutEntityExpert expert = new RecipeLayoutEntityExpert(); CurrentRecipe.ExpertSteps.Add(expert); for (int i = 0; i < WaferNumberAll; 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); } } protected override void OnActivate() { base.OnActivate(); RefreshBoatWafers(); } private int oldCurrentItemIndex; private bool firstSelectCurrentItem = false; private SlotType oldSlotType = SlotType.Space; public void SelecteSlot() { if (IsSelectOnePiece) { SelecteOneSlot(); } else { SelecteMoreSlot(); } } private void SelecteOneSlot() { switch (SelectSlotType) { case SlotType.P: NormalEntity.ProductSlotNo = ProccessSlotNoPositionString("Add", NormalEntity.ProductSlotNo, currentItemIndex); NormalEntity.Monitor1SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor1SlotNo, currentItemIndex); NormalEntity.Monitor2SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor2SlotNo, currentItemIndex); NormalEntity.SDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.SDDummySlotNo, currentItemIndex); NormalEntity.FDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.FDDummySlotNo, currentItemIndex); CurrentRecipe.ExpertSteps[0].Items[currentItemIndex-1].BkColor = _PBk; CurrentRecipe.ExpertSteps[0].Items[currentItemIndex - 1].Description = "PD"; break; case SlotType.M1: NormalEntity.Monitor1SlotNo = ProccessSlotNoPositionString("Add", NormalEntity.Monitor1SlotNo, currentItemIndex); NormalEntity.Monitor2SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor2SlotNo, currentItemIndex); NormalEntity.ProductSlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.ProductSlotNo, currentItemIndex); NormalEntity.SDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.SDDummySlotNo, currentItemIndex); NormalEntity.FDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.FDDummySlotNo, currentItemIndex); CurrentRecipe.ExpertSteps[0].Items[currentItemIndex - 1].BkColor = _M1Bk; CurrentRecipe.ExpertSteps[0].Items[currentItemIndex - 1].Description = "M1"; break; case SlotType.M2: NormalEntity.Monitor2SlotNo = ProccessSlotNoPositionString("Add", NormalEntity.Monitor2SlotNo, currentItemIndex); NormalEntity.Monitor1SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor1SlotNo, currentItemIndex); NormalEntity.ProductSlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.ProductSlotNo, currentItemIndex); NormalEntity.SDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.SDDummySlotNo, currentItemIndex); NormalEntity.FDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.FDDummySlotNo, currentItemIndex); CurrentRecipe.ExpertSteps[0].Items[currentItemIndex - 1].BkColor = _M2Bk; CurrentRecipe.ExpertSteps[0].Items[currentItemIndex - 1].Description = "M2"; break; case SlotType.SD: NormalEntity.SDDummySlotNo = ProccessSlotNoPositionString("Add", NormalEntity.SDDummySlotNo, currentItemIndex); NormalEntity.ProductSlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.ProductSlotNo, currentItemIndex); NormalEntity.Monitor1SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor1SlotNo, currentItemIndex); NormalEntity.Monitor2SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor2SlotNo, currentItemIndex); NormalEntity.Monitor2SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor2SlotNo, currentItemIndex); NormalEntity.FDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.FDDummySlotNo, currentItemIndex); CurrentRecipe.ExpertSteps[0].Items[currentItemIndex - 1].BkColor = _SDBk; CurrentRecipe.ExpertSteps[0].Items[currentItemIndex - 1].Description = "SD"; break; case SlotType.FD: NormalEntity.FDDummySlotNo = ProccessSlotNoPositionString("Add", NormalEntity.FDDummySlotNo, currentItemIndex); NormalEntity.ProductSlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.ProductSlotNo, currentItemIndex); NormalEntity.Monitor1SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor1SlotNo, currentItemIndex); NormalEntity.Monitor2SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor2SlotNo, currentItemIndex); NormalEntity.SDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.SDDummySlotNo, currentItemIndex); CurrentRecipe.ExpertSteps[0].Items[currentItemIndex - 1].BkColor = _FDBk; CurrentRecipe.ExpertSteps[0].Items[currentItemIndex - 1].Description = "FD"; break; case SlotType.Space: NormalEntity.ProductSlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.ProductSlotNo, currentItemIndex); NormalEntity.Monitor1SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor1SlotNo, currentItemIndex); NormalEntity.Monitor2SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor2SlotNo, currentItemIndex); NormalEntity.SDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.SDDummySlotNo, currentItemIndex); NormalEntity.FDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.FDDummySlotNo, currentItemIndex); CurrentRecipe.ExpertSteps[0].Items[currentItemIndex - 1].BkColor = _DefaultdBk; CurrentRecipe.ExpertSteps[0].Items[currentItemIndex - 1].Description = "----"; break; } oldSlotType = SelectSlotType; oldCurrentItemIndex = currentItemIndex; this.RefreshBoatWafers(); } private void SelecteMoreSlot() { List listWafers = QueryDataClient.Instance.Service.GetLayoutRecipeContent(CurrentRecipe.GetXmlString(), WaferNumberAll.ToString(), _cassetteSlotCount.ToString()); int fristValue = currentItemIndex < oldCurrentItemIndex ? currentItemIndex : oldCurrentItemIndex; int endValue = currentItemIndex < oldCurrentItemIndex ? oldCurrentItemIndex : currentItemIndex; List tempWafers = new List(); if (currentItemIndex > oldCurrentItemIndex) { tempWafers = listWafers.TakeWhile((n, index) => index < endValue).SkipWhile((n, index) => index < fristValue).ToList(); } else { tempWafers = listWafers.TakeWhile((n, index) => index < endValue - 1).SkipWhile((n, index) => index < fristValue - 1).ToList(); } if (firstSelectCurrentItem == true && tempWafers.Count>1)//tempWafers.Where(x => !string.IsNullOrEmpty(x)).Count() == 0 && firstSelectCurrentItem == true { for (int i = fristValue; i < endValue; i++) { switch (SelectSlotType) { case SlotType.P: NormalEntity.ProductSlotNo = ProccessSlotNoPositionString("Add", NormalEntity.ProductSlotNo, i); NormalEntity.Monitor1SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor1SlotNo, i); NormalEntity.Monitor2SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor2SlotNo, i); NormalEntity.SDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.SDDummySlotNo, i); NormalEntity.FDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.FDDummySlotNo, i); CurrentRecipe.ExpertSteps[0].Items[currentItemIndex - 1].BkColor = _PBk; CurrentRecipe.ExpertSteps[0].Items[currentItemIndex - 1].Description = "PD"; break; case SlotType.M1: NormalEntity.Monitor1SlotNo = ProccessSlotNoPositionString("Add", NormalEntity.Monitor1SlotNo, i); NormalEntity.Monitor2SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor2SlotNo, i); NormalEntity.ProductSlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.ProductSlotNo, i); NormalEntity.SDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.SDDummySlotNo, i); NormalEntity.FDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.FDDummySlotNo, i); CurrentRecipe.ExpertSteps[0].Items[currentItemIndex - 1].BkColor = _M1Bk; CurrentRecipe.ExpertSteps[0].Items[currentItemIndex - 1].Description = "M1"; break; case SlotType.M2: NormalEntity.Monitor2SlotNo = ProccessSlotNoPositionString("Add", NormalEntity.Monitor2SlotNo, i); NormalEntity.Monitor1SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor1SlotNo, i); NormalEntity.ProductSlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.ProductSlotNo, i); NormalEntity.SDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.SDDummySlotNo, i); NormalEntity.FDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.FDDummySlotNo, i); CurrentRecipe.ExpertSteps[0].Items[currentItemIndex - 1].BkColor = _M2Bk; CurrentRecipe.ExpertSteps[0].Items[currentItemIndex - 1].Description = "M2"; break; case SlotType.SD: NormalEntity.SDDummySlotNo = ProccessSlotNoPositionString("Add", NormalEntity.SDDummySlotNo, i); NormalEntity.ProductSlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.ProductSlotNo, i); NormalEntity.Monitor1SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor1SlotNo, i); NormalEntity.Monitor2SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor2SlotNo, i); NormalEntity.FDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.FDDummySlotNo, i); CurrentRecipe.ExpertSteps[0].Items[currentItemIndex - 1].BkColor = _SDBk; CurrentRecipe.ExpertSteps[0].Items[currentItemIndex - 1].Description = "SD"; break; case SlotType.FD: NormalEntity.FDDummySlotNo = ProccessSlotNoPositionString("Add", NormalEntity.FDDummySlotNo, i); NormalEntity.ProductSlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.ProductSlotNo, i); NormalEntity.Monitor1SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor1SlotNo, i); NormalEntity.Monitor2SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor2SlotNo, i); NormalEntity.SDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.SDDummySlotNo, i); CurrentRecipe.ExpertSteps[0].Items[currentItemIndex - 1].BkColor = _FDBk; CurrentRecipe.ExpertSteps[0].Items[currentItemIndex - 1].Description = "FD"; break; case SlotType.Space: NormalEntity.ProductSlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.ProductSlotNo, i); NormalEntity.Monitor1SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor1SlotNo, i); NormalEntity.Monitor2SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor2SlotNo, i); NormalEntity.SDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.SDDummySlotNo, i); NormalEntity.FDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.FDDummySlotNo, i); CurrentRecipe.ExpertSteps[0].Items[currentItemIndex - 1].BkColor = _DefaultdBk; CurrentRecipe.ExpertSteps[0].Items[currentItemIndex - 1].Description = "----"; break; } } firstSelectCurrentItem = false; } else { switch (SelectSlotType) { case SlotType.P: NormalEntity.ProductSlotNo = ProccessSlotNoPositionString("Add", NormalEntity.ProductSlotNo, currentItemIndex); NormalEntity.Monitor1SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor1SlotNo, currentItemIndex); NormalEntity.Monitor2SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor2SlotNo, currentItemIndex); NormalEntity.SDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.SDDummySlotNo, currentItemIndex); NormalEntity.FDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.FDDummySlotNo, currentItemIndex); CurrentRecipe.ExpertSteps[0].Items[currentItemIndex - 1].BkColor = _PBk; CurrentRecipe.ExpertSteps[0].Items[currentItemIndex - 1].Description = "PD"; break; case SlotType.M1: NormalEntity.Monitor1SlotNo = ProccessSlotNoPositionString("Add", NormalEntity.Monitor1SlotNo, currentItemIndex); NormalEntity.Monitor2SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor2SlotNo, currentItemIndex); NormalEntity.ProductSlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.ProductSlotNo, currentItemIndex); NormalEntity.SDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.SDDummySlotNo, currentItemIndex); NormalEntity.FDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.FDDummySlotNo, currentItemIndex); CurrentRecipe.ExpertSteps[0].Items[currentItemIndex - 1].BkColor = _M1Bk; CurrentRecipe.ExpertSteps[0].Items[currentItemIndex - 1].Description = "M1"; break; case SlotType.M2: NormalEntity.Monitor1SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor1SlotNo, currentItemIndex); NormalEntity.Monitor2SlotNo = ProccessSlotNoPositionString("Add", NormalEntity.Monitor2SlotNo, currentItemIndex); NormalEntity.ProductSlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.ProductSlotNo, currentItemIndex); NormalEntity.SDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.SDDummySlotNo, currentItemIndex); NormalEntity.FDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.FDDummySlotNo, currentItemIndex); CurrentRecipe.ExpertSteps[0].Items[currentItemIndex - 1].BkColor = _M2Bk; CurrentRecipe.ExpertSteps[0].Items[currentItemIndex - 1].Description = "M2"; break; case SlotType.SD: NormalEntity.SDDummySlotNo = ProccessSlotNoPositionString("Add", NormalEntity.SDDummySlotNo, currentItemIndex); NormalEntity.ProductSlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.ProductSlotNo, currentItemIndex); NormalEntity.Monitor1SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor1SlotNo, currentItemIndex); NormalEntity.Monitor2SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor2SlotNo, currentItemIndex); NormalEntity.FDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.FDDummySlotNo, currentItemIndex); CurrentRecipe.ExpertSteps[0].Items[currentItemIndex - 1].BkColor = _SDBk; CurrentRecipe.ExpertSteps[0].Items[currentItemIndex - 1].Description = "SD"; break; case SlotType.FD: NormalEntity.FDDummySlotNo = ProccessSlotNoPositionString("Add", NormalEntity.FDDummySlotNo, currentItemIndex); NormalEntity.ProductSlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.ProductSlotNo, currentItemIndex); NormalEntity.Monitor1SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor1SlotNo, currentItemIndex); NormalEntity.Monitor2SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor2SlotNo, currentItemIndex); NormalEntity.SDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.SDDummySlotNo, currentItemIndex); CurrentRecipe.ExpertSteps[0].Items[currentItemIndex - 1].BkColor = _FDBk; CurrentRecipe.ExpertSteps[0].Items[currentItemIndex - 1].Description = "FD"; break; case SlotType.Space: NormalEntity.ProductSlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.ProductSlotNo, currentItemIndex); NormalEntity.Monitor1SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor1SlotNo, currentItemIndex); NormalEntity.Monitor2SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor2SlotNo, currentItemIndex); NormalEntity.SDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.SDDummySlotNo, currentItemIndex); NormalEntity.FDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.FDDummySlotNo, currentItemIndex); CurrentRecipe.ExpertSteps[0].Items[currentItemIndex - 1].BkColor = _DefaultdBk; CurrentRecipe.ExpertSteps[0].Items[currentItemIndex - 1].Description = "----"; break; } firstSelectCurrentItem = true; } oldCurrentItemIndex = currentItemIndex; this.RefreshBoatWafers(); } public void SetCommand(object obj) { WindowManager wm = new WindowManager(); switch (obj.ToString()) { case "AllClear": int index = 0; foreach (var item in BoatWafers) { CurrentRecipe.ExpertSteps[0].Items[index].BkColor = _DefaultdBk; CurrentRecipe.ExpertSteps[0].Items[index].Description = "----"; NormalEntity.ProductSlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.ProductSlotNo, index + 1); NormalEntity.Monitor1SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor1SlotNo, index + 1); NormalEntity.Monitor2SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor2SlotNo, index + 1); NormalEntity.SDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.SDDummySlotNo, index + 1); NormalEntity.FDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.FDDummySlotNo, index + 1); index++; } oldSlotType = SlotType.Space; break; case "Wafer Charge Rule": RecipeWaferChargeRuleViewModel viewWaferChargeRule = new RecipeWaferChargeRuleViewModel(); viewWaferChargeRule.NormalEntity = NormalEntity; wm.ShowDialogWithTitle(viewWaferChargeRule, null, obj.ToString()); break; case "SetAll": for (int i = 0; i < BoatWafers.Count; i++) { switch (SelectSlotType) { case SlotType.P: NormalEntity.ProductSlotNo = ProccessSlotNoPositionString("Add", NormalEntity.ProductSlotNo, i + 1); NormalEntity.Monitor1SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor1SlotNo, i + 1); NormalEntity.Monitor2SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor2SlotNo, i + 1); NormalEntity.SDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.SDDummySlotNo, i + 1); NormalEntity.FDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.FDDummySlotNo, i + 1); CurrentRecipe.ExpertSteps[0].Items[i].Description = "PD"; CurrentRecipe.ExpertSteps[0].Items[i].BkColor = _PBk; break; case SlotType.M1: NormalEntity.Monitor1SlotNo = ProccessSlotNoPositionString("Add", NormalEntity.Monitor1SlotNo, i + 1); NormalEntity.Monitor2SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor2SlotNo, i + 1); NormalEntity.ProductSlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.ProductSlotNo, i + 1); NormalEntity.SDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.SDDummySlotNo, i + 1); NormalEntity.FDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.FDDummySlotNo, i + 1); CurrentRecipe.ExpertSteps[0].Items[i].Description = "M1"; CurrentRecipe.ExpertSteps[0].Items[i].BkColor = _M1Bk; break; case SlotType.M2: NormalEntity.Monitor1SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor1SlotNo, i + 1); NormalEntity.Monitor2SlotNo = ProccessSlotNoPositionString("Add", NormalEntity.Monitor2SlotNo, i + 1); NormalEntity.ProductSlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.ProductSlotNo, i + 1); NormalEntity.SDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.SDDummySlotNo, i + 1); NormalEntity.FDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.FDDummySlotNo, i + 1); CurrentRecipe.ExpertSteps[0].Items[i].Description = "M2"; CurrentRecipe.ExpertSteps[0].Items[i].BkColor = _M2Bk; break; case SlotType.SD: NormalEntity.SDDummySlotNo = ProccessSlotNoPositionString("Add", NormalEntity.SDDummySlotNo, i + 1); NormalEntity.ProductSlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.ProductSlotNo, i + 1); NormalEntity.Monitor1SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor1SlotNo, i + 1); NormalEntity.Monitor2SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor2SlotNo, i + 1); NormalEntity.FDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.FDDummySlotNo, i + 1); CurrentRecipe.ExpertSteps[0].Items[i].Description = "SD"; CurrentRecipe.ExpertSteps[0].Items[i].BkColor = _SDBk; break; case SlotType.FD: NormalEntity.FDDummySlotNo = ProccessSlotNoPositionString("Add", NormalEntity.FDDummySlotNo, i + 1); NormalEntity.ProductSlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.ProductSlotNo, i + 1); NormalEntity.Monitor1SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor1SlotNo, i + 1); NormalEntity.Monitor2SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor2SlotNo, i + 1); NormalEntity.SDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.SDDummySlotNo, i + 1); CurrentRecipe.ExpertSteps[0].Items[i].Description = "FD"; CurrentRecipe.ExpertSteps[0].Items[i].BkColor = _FDBk; break; case SlotType.Space: NormalEntity.ProductSlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.ProductSlotNo, i + 1); NormalEntity.Monitor1SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor1SlotNo, i + 1); NormalEntity.Monitor2SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor2SlotNo, i + 1); NormalEntity.SDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.SDDummySlotNo, i + 1); NormalEntity.FDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.FDDummySlotNo, i + 1); CurrentRecipe.ExpertSteps[0].Items[i].Description = "----"; CurrentRecipe.ExpertSteps[0].Items[i].BkColor = _DefaultdBk; break; default: break; } } break; case "Set": if (fromIndex != 0 && toIndex != 0 && fromIndex <= toIndex) { for (int i = fromIndex - 1; i < toIndex; i++) { // BoatWafers[i].Description = SelectSlotType.ToString(); switch (SelectSlotType) { case SlotType.P: NormalEntity.ProductSlotNo = ProccessSlotNoPositionString("Add", NormalEntity.ProductSlotNo, i); NormalEntity.Monitor1SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor1SlotNo, i); NormalEntity.Monitor2SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor2SlotNo, i); NormalEntity.SDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.SDDummySlotNo, i); NormalEntity.FDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.FDDummySlotNo, i); CurrentRecipe.ExpertSteps[0].Items[i].Description = "PD"; CurrentRecipe.ExpertSteps[0].Items[i].BkColor = _PBk; break; case SlotType.M1: NormalEntity.Monitor1SlotNo = ProccessSlotNoPositionString("Add", NormalEntity.Monitor1SlotNo, i); NormalEntity.Monitor2SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor2SlotNo, i); NormalEntity.ProductSlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.ProductSlotNo, i); NormalEntity.SDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.SDDummySlotNo, i); NormalEntity.FDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.FDDummySlotNo, i); CurrentRecipe.ExpertSteps[0].Items[i].Description = "M1"; CurrentRecipe.ExpertSteps[0].Items[i].BkColor = _M1Bk; break; case SlotType.M2: NormalEntity.Monitor1SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor1SlotNo, i); NormalEntity.Monitor2SlotNo = ProccessSlotNoPositionString("Add", NormalEntity.Monitor2SlotNo, i); NormalEntity.ProductSlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.ProductSlotNo, i); NormalEntity.SDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.SDDummySlotNo, i); NormalEntity.FDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.FDDummySlotNo, i); CurrentRecipe.ExpertSteps[0].Items[i].Description = "M2"; CurrentRecipe.ExpertSteps[0].Items[i].BkColor = _M2Bk; break; case SlotType.SD: NormalEntity.SDDummySlotNo = ProccessSlotNoPositionString("Add", NormalEntity.SDDummySlotNo, i); NormalEntity.ProductSlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.ProductSlotNo, i); NormalEntity.Monitor1SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor1SlotNo, i); NormalEntity.Monitor2SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor2SlotNo, i); NormalEntity.FDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.FDDummySlotNo, i); CurrentRecipe.ExpertSteps[0].Items[i].Description = "SD"; CurrentRecipe.ExpertSteps[0].Items[i].BkColor = _SDBk; break; case SlotType.FD: NormalEntity.FDDummySlotNo = ProccessSlotNoPositionString("Add", NormalEntity.FDDummySlotNo, i); NormalEntity.ProductSlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.ProductSlotNo, i); NormalEntity.Monitor1SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor1SlotNo, i); NormalEntity.Monitor2SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor2SlotNo, i); NormalEntity.SDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.SDDummySlotNo, i); CurrentRecipe.ExpertSteps[0].Items[i].Description = "FD"; CurrentRecipe.ExpertSteps[0].Items[i].BkColor = _FDBk; break; case SlotType.Space: NormalEntity.ProductSlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.ProductSlotNo, i); NormalEntity.Monitor1SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor1SlotNo, i); NormalEntity.Monitor2SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor2SlotNo, i); NormalEntity.SDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.SDDummySlotNo, i); NormalEntity.FDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.FDDummySlotNo, i); CurrentRecipe.ExpertSteps[0].Items[i].Description = "----"; CurrentRecipe.ExpertSteps[0].Items[i].BkColor = _DefaultdBk; break; default: break; } } } break; } this.RefreshBoatWafers(); } private int fromIndex = 0; private int toIndex = 0; public void BoatWafersTextChanged(object sender) { //if (sender is TextBox) //{ // var boatWaferTxt = sender as TextBox; // switch (boatWaferTxt.Name) // { // case "TxtFrom": // fromIndex = int.Parse(boatWaferTxt.Text); // break; // case "TxtTo": // toIndex = int.Parse(boatWaferTxt.Text); // break; // default: // break; // } //} } private string ProccessSlotNoPositionString(string strType, string str, int iCurrentItemIndex) { if (iCurrentItemIndex <= 0) return str; if (string.IsNullOrEmpty(str)) { if (strType == "Add") { return iCurrentItemIndex.ToString(); } else if (strType == "Delete") { return str; } } List selectIndexNoStr = new List(str.Split(',')); List selectIndex = new List(); selectIndexNoStr.ForEach(x => { if (selectIndex.Where(value => value == int.Parse(x)).Count() == 0) { selectIndex.Add(int.Parse(x)); } } ); if (strType == "Add") { if (selectIndex.Where(value => value == iCurrentItemIndex).Count() == 0) { selectIndex.Add(iCurrentItemIndex); } } else { if (selectIndex.Where(value => value == iCurrentItemIndex).Count() != 0) { selectIndex.Remove(iCurrentItemIndex); } } selectIndex.Sort(); return string.Join(",", selectIndex); } public void RefreshBoatWafers() { List listWafers = QueryDataClient.Instance.Service.GetLayoutRecipeContent(CurrentRecipe.GetXmlString(), WaferNumberAll.ToString(), _cassetteSlotCount.ToString()); WaferNumberP = WaferNumberM = WaferNumberSD = WaferNumberED = 0; if (listWafers.Count <= 0 || (CurrentRecipe.ExpertSteps.Count <= 0 && CurrentRecipe.NormalSteps.Count <= 0)) return; CurrentRecipe.NormalSteps[0].ProductSlotNo = string.Empty; CurrentRecipe.NormalSteps[0].Monitor1SlotNo = string.Empty; for (int i = 0; i < listWafers.Count; i++) { CurrentRecipe.ExpertSteps[0].Items[i].Slot = i + 1; CurrentRecipe.ExpertSteps[0].Items[i].Description = listWafers[i].ToString() == "" ? "----" : listWafers[i].ToString(); switch (listWafers[i].ToString()) { case "PD": CurrentRecipe.NormalSteps[0].ProductSlotNo = ProccessSlotNoPositionString("Add", CurrentRecipe.NormalSteps[0].ProductSlotNo, i + 1); CurrentRecipe.ExpertSteps[0].Items[i].BkColor = _PBk; WaferNumberP++; break; case "M1": CurrentRecipe.NormalSteps[0].Monitor1SlotNo = ProccessSlotNoPositionString("Add", CurrentRecipe.NormalSteps[0].Monitor1SlotNo, i + 1); CurrentRecipe.ExpertSteps[0].Items[i].BkColor = _M1Bk; WaferNumberM++; break; case "M2": CurrentRecipe.NormalSteps[0].Monitor2SlotNo = ProccessSlotNoPositionString("Add", CurrentRecipe.NormalSteps[0].Monitor2SlotNo, i + 1); CurrentRecipe.ExpertSteps[0].Items[i].BkColor = _M2Bk; WaferNumberM++; break; case "SD": CurrentRecipe.NormalSteps[0].SDDummySlotNo = ProccessSlotNoPositionString("Add", CurrentRecipe.NormalSteps[0].SDDummySlotNo, i + 1); CurrentRecipe.ExpertSteps[0].Items[i].BkColor = _SDBk; WaferNumberSD++; break; case "FD": CurrentRecipe.NormalSteps[0].FDDummySlotNo = ProccessSlotNoPositionString("Add", CurrentRecipe.NormalSteps[0].FDDummySlotNo, i + 1); CurrentRecipe.ExpertSteps[0].Items[i].BkColor = _FDBk; WaferNumberED++; break; default: CurrentRecipe.ExpertSteps[0].Items[i].BkColor = _DefaultdBk; break; } } SDDummySlotCount = listWafers.Where(x => x == "SD").Count(); FDDummySlotCount = listWafers.Where(x => x == "FD").Count(); ProductSlotCount = listWafers.Where(x => x == "PD").Count(); Monitor1SlotCount = listWafers.Where(x => x == "M1").Count(); Monitor2SlotCount = listWafers.Where(x => x == "M2").Count(); NoneSlotCount = listWafers.Where(x => x == "----" || string.IsNullOrEmpty(x)).Count(); listBoatWafers.Clear(); listWafers.ForEach(x => listBoatWafers.Add(x)); ; } public void EndEdit() { //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].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; } RecipePermissionSelectViewModel dialog = new RecipePermissionSelectViewModel("Save recipe and permission", CurrentRecipe.RecipePermission); WindowManager wm = new WindowManager(); bool? dialogReturn = wm.ShowDialog(dialog); if (!dialogReturn.HasValue || !dialogReturn.Value) return; CurrentRecipe.IsSavedDesc = false; this.CurrentRecipe.Revisor = BaseApp.Instance.UserContext.LoginName; this.CurrentRecipe.ReviseTime = DateTime.Now; //this.CurrentRecipe.RecipeLevel = this.LevelDisplay; this.CurrentRecipe.RecipePermission = dialog.RecipePermission; this._recipeProvider.SaveRecipe(CurrentRecipe.PrefixPath, CurrentRecipe.Name, CurrentRecipe.GetXmlString()); ((Window)GetView()).DialogResult = true; } 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() { EndEdit(); } public void RdoChecked(string cmd) { SlotType slotType = SlotType.Space; Enum.TryParse(cmd, out slotType); SelectSlotType = slotType; } } public enum SlotType { SD, FD, P, M1, M2, Space } public class BoatWaferItem : NotifiableItem { private int _slot; public int Slot { get => _slot; set { _slot = value; InvokePropertyChanged("Slot"); } } private string _description; public string Description { get => _description; set { _description = value; InvokePropertyChanged("Description"); } } private bool _hasWafer; public bool HasWafer { get => _hasWafer; set { _hasWafer = value; InvokePropertyChanged("HasWafer"); } } private bool _noWafer; public bool NoWafer { get => _noWafer; set { _noWafer = value; InvokePropertyChanged("NoWafer"); } } private SolidColorBrush _bkColor; public SolidColorBrush BkColor { get => _bkColor; set { _bkColor = value; InvokePropertyChanged("BkColor"); } } } }