| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985 | 
							- using Aitex.Core.RT.Log;
 
- using Aitex.Core.RT.SCCore;
 
- using Aitex.Core.Util;
 
- using Caliburn.Micro;
 
- using Caliburn.Micro.Core;
 
- using FurnaceUI.Common;
 
- using FurnaceUI.Models;
 
- using MECF.Framework.Common.DataCenter;
 
- using MECF.Framework.Common.OperationCenter;
 
- using MECF.Framework.Common.SubstrateTrackings;
 
- using MECF.Framework.UI.Client.CenterViews.Editors.Recipe;
 
- using MECF.Framework.UI.Client.CenterViews.Editors.Sequence;
 
- using OpenSEMI.ClientBase;
 
- using System;
 
- using System.Collections.Generic;
 
- using System.Collections.ObjectModel;
 
- using System.Linq;
 
- using System.Net.Sockets;
 
- using System.Text;
 
- using System.Threading.Tasks;
 
- using System.Windows;
 
- using System.Xml;
 
- namespace FurnaceUI.Views.Jobs
 
- {
 
-     public class CarrierInformation : PropertyChangedBase
 
-     {
 
-         private string _no;
 
-         public string No
 
-         {
 
-             get
 
-             {
 
-                 return _no;
 
-             }
 
-             set
 
-             {
 
-                 _no = value;
 
-                 NotifyOfPropertyChange("No");
 
-             }
 
-         }
 
-         private string _type;
 
-         public string Type
 
-         {
 
-             get
 
-             {
 
-                 return _type;
 
-             }
 
-             set
 
-             {
 
-                 _type = value;
 
-                 NotifyOfPropertyChange("Type");
 
-             }
 
-         }
 
-         private string _moduleName;
 
-         public string ModuleName
 
-         {
 
-             get
 
-             {
 
-                 return _moduleName;
 
-             }
 
-             set
 
-             {
 
-                 _moduleName = value;
 
-                 NotifyOfPropertyChange("ModuleName");
 
-             }
 
-         }
 
-         private string _carrierID;
 
-         public string CarrierID
 
-         {
 
-             get
 
-             {
 
-                 return _carrierID;
 
-             }
 
-             set
 
-             {
 
-                 _carrierID = value;
 
-                 NotifyOfPropertyChange("CarrierID");
 
-             }
 
-         }
 
-         private string _waferCount;
 
-         public string WaferCount
 
-         {
 
-             get => _waferCount;
 
-             set
 
-             {
 
-                 _waferCount = value;
 
-                 NotifyOfPropertyChange("WaferCount");
 
-             }
 
-         }
 
-         private string _existSlot;
 
-         public string ExistSlot
 
-         {
 
-             get => _existSlot;
 
-             set
 
-             {
 
-                 _existSlot = value;
 
-                 NotifyOfPropertyChange("ExistSlot");
 
-             }
 
-         }
 
-         private string _slotMap;
 
-         public string SlotMap
 
-         {
 
-             get => _slotMap;
 
-             set
 
-             {
 
-                 _slotMap = value;
 
-                 NotifyOfPropertyChange("SlotMap");
 
-             }
 
-         }
 
-         private string _strSlot;
 
-         public string StrSlot
 
-         {
 
-             get => _strSlot;
 
-             set
 
-             {
 
-                 _strSlot = value;
 
-                 NotifyOfPropertyChange(nameof(StrSlot));
 
-             }
 
-         }
 
-         private string _loadPortName;
 
-         public string LoadPortName
 
-         {
 
-             get => _loadPortName;
 
-             set
 
-             {
 
-                 _loadPortName = value;
 
-                 NotifyOfPropertyChange("LoadPortName");
 
-             }
 
-         }
 
-     }
 
-     public class JOBProcessStockViewModel : FurnaceModuleUIViewModelBase
 
-     {
 
-         public string PCarrierPara { get; set; }
 
-         public string M1CarrierPara { get; set; }
 
-         public string M2CarrierPara { get; set; }
 
-         public ObservableCollection<CarrierInformation> SelectCarrierList { get; set; } = new ObservableCollection<CarrierInformation>();
 
-         public ObservableCollection<CarrierInformation> SelectCarrierListTemp { get; set; } = new ObservableCollection<CarrierInformation>();
 
-         public Dictionary<string, object> SCValueDict = new Dictionary<string, object>();
 
-         private string _cjID;
 
-         public string CJID
 
-         {
 
-             get
 
-             {
 
-                 return _cjID;
 
-             }
 
-             set
 
-             {
 
-                 _cjID = value;
 
-                 NotifyOfPropertyChange("CJID");
 
-             }
 
-         }
 
-         private string _pjID;
 
-         public string PJID
 
-         {
 
-             get
 
-             {
 
-                 return _pjID;
 
-             }
 
-             set
 
-             {
 
-                 _pjID = value;
 
-                 NotifyOfPropertyChange("PJID");
 
-             }
 
-         }
 
-         public JOBProcessStockViewModel()
 
-         {
 
-         }
 
-         private readonly RecipeProvider _recipeProvider = new RecipeProvider();
 
-         public RecipeDataJob CurrentRecipe { get; set; } = new RecipeDataJob();
 
-         public string ExecCommand { get; set; }
 
-         public bool IsCheckButtonVisible { get; set; } = false;
 
-         public bool IsWithUnloadButtonVisible { get; set; }
 
-         public bool IsStockNumberChangeButtonVisible { get; set; }
 
-         public bool IsLotIDInputEnable { get; set; } = true;
 
-         private string _waferType = "P";
 
-         #region Stocker Carrier Info
 
-         [Subscription("Stocker1.Carrier")]
 
-         public CarrierInfo Stocker1CarrierData { get; set; }
 
-         [Subscription("Stocker2.Carrier")]
 
-         public CarrierInfo Stocker2CarrierData { get; set; }
 
-         [Subscription("Stocker3.Carrier")]
 
-         public CarrierInfo Stocker3CarrierData { get; set; }
 
-         [Subscription("Stocker4.Carrier")]
 
-         public CarrierInfo Stocker4CarrierData { get; set; }
 
-         [Subscription("Stocker5.Carrier")]
 
-         public CarrierInfo Stocker5CarrierData { get; set; }
 
-         [Subscription("Stocker6.Carrier")]
 
-         public CarrierInfo Stocker6CarrierData { get; set; }
 
-         [Subscription("Stocker7.Carrier")]
 
-         public CarrierInfo Stocker7CarrierData { get; set; }
 
-         [Subscription("Stocker8.Carrier")]
 
-         public CarrierInfo Stocker8CarrierData { get; set; }
 
-         [Subscription("Stocker9.Carrier")]
 
-         public CarrierInfo Stocker9CarrierData { get; set; }
 
-         [Subscription("Stocker10.Carrier")]
 
-         public CarrierInfo Stocker10CarrierData { get; set; }
 
-         [Subscription("Stocker11.Carrier")]
 
-         public CarrierInfo Stocker11CarrierData { get; set; }
 
-         [Subscription("Stocker12.Carrier")]
 
-         public CarrierInfo Stocker12CarrierData { get; set; }
 
-         [Subscription("Stocker13.Carrier")]
 
-         public CarrierInfo Stocker13CarrierData { get; set; }
 
-         [Subscription("Stocker14.Carrier")]
 
-         public CarrierInfo Stocker14CarrierData { get; set; }
 
-         [Subscription("Stocker15.Carrier")]
 
-         public CarrierInfo Stocker15CarrierData { get; set; }
 
-         [Subscription("Stocker16.Carrier")]
 
-         public CarrierInfo Stocker16CarrierData { get; set; }
 
-         [Subscription("Stocker17.Carrier")]
 
-         public CarrierInfo Stocker17CarrierData { get; set; }
 
-         [Subscription("Stocker18.Carrier")]
 
-         public CarrierInfo Stocker18CarrierData { get; set; }
 
-         [Subscription("Stocker19.Carrier")]
 
-         public CarrierInfo Stocker19CarrierData { get; set; }
 
-         [Subscription("Stocker20.Carrier")]
 
-         public CarrierInfo Stocker20CarrierData { get; set; }
 
-         [Subscription("Stocker21.Carrier")]
 
-         public CarrierInfo Stocker21CarrierData { get; set; }
 
-         #endregion
 
-         List<CarrierInfo> _carrierlist = new List<CarrierInfo>();
 
-         ObservableCollection<CarrierInfo> _stockerList = new ObservableCollection<CarrierInfo>();
 
-         protected override void OnInitialize()
 
-         {
 
-             base.OnInitialize();
 
-         }
 
-         protected override void InvokeAfterUpdateProperty(Dictionary<string, object> data)
 
-         {
 
-             base.InvokeAfterUpdateProperty(data);
 
-             _stockerList.Clear();
 
-             if (Stocker1CarrierData != null) { Stocker1CarrierData.StockerIndex = 1; _stockerList.Add(Stocker1CarrierData); }
 
-             if (Stocker2CarrierData != null) { Stocker2CarrierData.StockerIndex = 2; _stockerList.Add(Stocker2CarrierData); }
 
-             if (Stocker3CarrierData != null) { Stocker3CarrierData.StockerIndex = 3; _stockerList.Add(Stocker3CarrierData); }
 
-             if (Stocker4CarrierData != null) { Stocker4CarrierData.StockerIndex = 4; _stockerList.Add(Stocker4CarrierData); }
 
-             if (Stocker5CarrierData != null) { Stocker5CarrierData.StockerIndex = 5; _stockerList.Add(Stocker5CarrierData); }
 
-             if (Stocker6CarrierData != null) { Stocker6CarrierData.StockerIndex = 6; _stockerList.Add(Stocker6CarrierData); }
 
-             if (Stocker7CarrierData != null) { Stocker7CarrierData.StockerIndex = 7; _stockerList.Add(Stocker7CarrierData); }
 
-             if (Stocker8CarrierData != null) { Stocker8CarrierData.StockerIndex = 8; _stockerList.Add(Stocker8CarrierData); }
 
-             if (Stocker9CarrierData != null) { Stocker9CarrierData.StockerIndex = 9; _stockerList.Add(Stocker9CarrierData); }
 
-             if (Stocker10CarrierData != null) { Stocker10CarrierData.StockerIndex = 10; _stockerList.Add(Stocker10CarrierData); }
 
-             if (Stocker11CarrierData != null) { Stocker11CarrierData.StockerIndex = 11; _stockerList.Add(Stocker11CarrierData); }
 
-             if (Stocker12CarrierData != null) { Stocker12CarrierData.StockerIndex = 12; _stockerList.Add(Stocker12CarrierData); }
 
-             if (Stocker13CarrierData != null) { Stocker13CarrierData.StockerIndex = 13; _stockerList.Add(Stocker13CarrierData); }
 
-             if (Stocker14CarrierData != null) { Stocker14CarrierData.StockerIndex = 14; _stockerList.Add(Stocker14CarrierData); }
 
-             if (Stocker15CarrierData != null) { Stocker15CarrierData.StockerIndex = 15; _stockerList.Add(Stocker15CarrierData); }
 
-             if (Stocker16CarrierData != null) { Stocker16CarrierData.StockerIndex = 16; _stockerList.Add(Stocker16CarrierData); }
 
-             if (Stocker17CarrierData != null) { Stocker17CarrierData.StockerIndex = 17; _stockerList.Add(Stocker17CarrierData); }
 
-             if (Stocker18CarrierData != null) { Stocker18CarrierData.StockerIndex = 18; _stockerList.Add(Stocker18CarrierData); }
 
-         }
 
-         public void SwitchPage(string operation)
 
-         {
 
-             var windowManager = IoC.Get<IWindowManager>();
 
-             switch (operation)
 
-             {
 
-                 case "MaterialSelect":
 
-                     {
 
-                         LoadJOBTwoViewModel loadJobTwoViewModel = new LoadJOBTwoViewModel();
 
-                         loadJobTwoViewModel.PTypeRadioButtonVisibility = Visibility.Visible;
 
-                         loadJobTwoViewModel.MTypeRadioButtonVisibility = Visibility.Collapsed;
 
-                         loadJobTwoViewModel.SDTypeRadioButtonVisibility = Visibility.Collapsed;
 
-                         loadJobTwoViewModel.EDTypeRadioButtonVisibility = Visibility.Collapsed;
 
-                         loadJobTwoViewModel.ExecCommand = "Load";
 
-                         loadJobTwoViewModel.ExecText = "Accept";
 
-                         loadJobTwoViewModel.IsPChecked = true;
 
-                         loadJobTwoViewModel.IsMChecked = false;
 
-                         loadJobTwoViewModel.IsSetValue = true;
 
-                         loadJobTwoViewModel.IsExecuteRTCommand = false;
 
-                         loadJobTwoViewModel.CarrierInformationList.Clear();
 
-                         if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(loadJobTwoViewModel, null, "Material Select"))
 
-                         {
 
-                             //SelectCarrierList.Clear();
 
-                             for (int j = 0; j < SelectCarrierList.Count; j++)
 
-                             {
 
-                                 if (SelectCarrierList[j].Type.Contains("P"))
 
-                                 {
 
-                                     SelectCarrierList.RemoveAt(j);
 
-                                     j--;
 
-                                 }
 
-                             }
 
-                             if (string.IsNullOrEmpty(loadJobTwoViewModel.LoadJobPara))
 
-                                 return;
 
-                             PCarrierPara = loadJobTwoViewModel.LoadJobPara.TrimEnd(';');
 
-                             string[] Carriers = PCarrierPara.Split(':');
 
-                             CarrierInformation carrierInfo = new CarrierInformation();
 
-                             carrierInfo.No = Carriers[0].Replace("Stocker", "");
 
-                             var item = Carriers[1].Split(',');
 
-                             carrierInfo.Type = CarrierType.P.ToString();
 
-                             carrierInfo.ModuleName = item[0];
 
-                             carrierInfo.StrSlot = item[1];
 
-                             // carrierInfo.CarrierID = item[2];
 
-                             //carrierInfo.WaferCount = item[3];
 
-                             carrierInfo.ExistSlot = item[2];
 
-                             carrierInfo.SlotMap = item[3];
 
-                             carrierInfo.LoadPortName = item[4];
 
-                             SelectCarrierList.Add(carrierInfo);
 
-                         }
 
-                     }
 
-                     break;
 
-                 case "SelectM":
 
-                     {
 
-                         _carrierlist.Clear();
 
-                         foreach (var item in _stockerList)
 
-                         {
 
-                             string configType = (string)QueryDataClient.Instance.Service.GetConfig($"System.Stocker.Stocker{item.StockerIndex}WaferType");
 
-                             var boolM = configType.StartsWith(CarrierType.M.ToString()) && !item.IsEmpty;
 
-                             var boolNone = configType.StartsWith(CarrierType.None.ToString()) && !item.IsEmpty && item.CarrierType.ToString().Contains(CarrierType.M.ToString());
 
-                             if (boolNone || boolM)
 
-                             {
 
-                                 _carrierlist.Add(item);
 
-                             }
 
-                         }
 
-                         SelectMaterialViewModel selectmaterialViewModel = new SelectMaterialViewModel();
 
-                         selectmaterialViewModel.carrierlist = _carrierlist;
 
-                         selectmaterialViewModel.CarrierType = "M";
 
-                         selectmaterialViewModel.SelectCarrierItemList.Clear();
 
-                         foreach (var item in SelectCarrierList)
 
-                         {
 
-                             selectmaterialViewModel.SelectCarrierItemList.Add(new CarrierMaterialInformation()
 
-                             {
 
-                                 ModuleName = item.ModuleName,
 
-                                 No = item.No,
 
-                                 CarrierType = "M",
 
-                                 CarrierId = item.CarrierID,
 
-                             });
 
-                         };
 
-                         if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(selectmaterialViewModel, null, "Select M"))
 
-                         {
 
-                             int i = 0;
 
-                             for (int j = 0; j < SelectCarrierList.Count; j++)
 
-                             {
 
-                                 if (SelectCarrierList[j].Type.Contains(ConstantsCommon.M))
 
-                                 {
 
-                                     SelectCarrierList.RemoveAt(j);
 
-                                     j--;
 
-                                 }
 
-                             }
 
-                             M1CarrierPara = "";
 
-                             M2CarrierPara = "";
 
-                             foreach (CarrierMaterialInformation item in selectmaterialViewModel.SelectCarrierItemList)
 
-                             {
 
-                                 CarrierInformation carrierInfo = new CarrierInformation();
 
-                                 carrierInfo.No = item.No;
 
-                                 carrierInfo.Type = item.CarrierType;
 
-                                 carrierInfo.ModuleName = item.ModuleName;
 
-                                 carrierInfo.CarrierID = item.CarrierId;
 
-                                 carrierInfo.LoadPortName = "";
 
-                                 carrierInfo.StrSlot = item.StrSlot;
 
-                                 if (item.CarrierType == "M1")
 
-                                     M1CarrierPara += item.ModuleName + "," + (item.CarrierId == null ? "" : item.CarrierId) + "," + item.StrSlot + ";";
 
-                                 else if (item.CarrierType == "M2")
 
-                                     M2CarrierPara += item.ModuleName + "," + (item.CarrierId == null ? "" : item.CarrierId) + "," + item.StrSlot + ";";
 
-                                 SelectCarrierList.Add(carrierInfo);
 
-                             }
 
-                         }
 
-                     }
 
-                     break;
 
-             }
 
-         }
 
-         public void SelectJobRecipe()
 
-         {
 
-             RecipeSelectDialogViewModel dialog = new RecipeSelectDialogViewModel();
 
-             dialog.DisplayName = "Select Job Recipe";
 
-             var recipeProvider = new RecipeProvider();
 
-             var processType = QueryDataClient.Instance.Service.GetConfig("System.Recipe.SupportedJobType");
 
-             if (processType == null)
 
-             {
 
-                 processType = "Job Recipe";
 
-             }
 
-             var ProcessTypeFileList = new ObservableCollection<ProcessTypeFileItem>();
 
-             string[] recipeProcessType = ((string)processType).Split(',');
 
-             for (int i = 0; i < recipeProcessType.Length; i++)
 
-             {
 
-                 var type = new ProcessTypeFileItem();
 
-                 type.ProcessType = recipeProcessType[i];
 
-                 var prefix = $"Furnace\\{recipeProcessType[i]}";
 
-                 var recipes = recipeProvider.GetXmlRecipeList(prefix);
 
-                 type.FileListByProcessType = RecipeSequenceTreeBuilder.BuildFileNode(prefix, "", false, recipes)[0].Files;
 
-                 ProcessTypeFileList.Add(type);
 
-             }
 
-             dialog.ProcessTypeFileList = ProcessTypeFileList;
 
-             WindowManager wm = new WindowManager();
 
-             bool? bret = wm.ShowDialog(dialog);
 
-             if ((bool)bret)
 
-             {
 
-                 CurrentRecipe.Clear();
 
-                 CurrentRecipe.PrefixPath = $"Furnace\\{processType}";
 
-                 CurrentRecipe.Name = dialog.DialogResult;
 
-                 var recipeContent = _recipeProvider.LoadRecipe(CurrentRecipe.PrefixPath, CurrentRecipe.Name);
 
-                 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, "PM1");
 
-                 CheckIsExistRecipe(CurrentRecipe.ProcessRecipe, CurrentRecipe.LayoutRecipe);
 
-             }
 
-             //CheckIsExistRecipe(CurrentRecipe.ProcessRecipe, CurrentRecipe.LayoutRecipe);
 
-         }
 
-         private void CheckIsExistRecipe(string processName, string layoutName)
 
-         {
 
-             var processPrefixPath = $"Furnace\\Process";
 
-             var layoutPrefixPath = $"Furnace\\Layout";
 
-             var processContent = _recipeProvider.LoadRecipe(processPrefixPath, processName);
 
-             var layoutContent = _recipeProvider.LoadRecipe(layoutPrefixPath, layoutName);
 
-             if (string.IsNullOrEmpty(processContent))
 
-             {
 
-                 DialogBox.ShowWarning($"Process Recipe:{processName} is empty, please confirm the file is valid.");
 
-             }
 
-             if (string.IsNullOrEmpty(layoutContent))
 
-             {
 
-                 DialogBox.ShowWarning($"Layout Recipe:{layoutName} is empty, please confirm the file is valid.");
 
-             }
 
-         }
 
-         private void FromJobRecipeGetProcessAndLayout(string name, object processType)
 
-         {
 
-             CurrentRecipe.Clear();
 
-             CurrentRecipe.PrefixPath = $"Furnace\\{processType}";
 
-             CurrentRecipe.Name = name;
 
-             var recipeContent = _recipeProvider.LoadRecipe(CurrentRecipe.PrefixPath, CurrentRecipe.Name);
 
-             if (!string.IsNullOrEmpty(recipeContent))
 
-             {
 
-                 CurrentRecipe.RecipeChamberType = "OriginChamber";
 
-                 CurrentRecipe.InitData(CurrentRecipe.PrefixPath, CurrentRecipe.Name, recipeContent, "PM1");
 
-                 CurrentRecipe.ProcessRecipe = CurrentRecipe.ProcessRecipe.Substring(CurrentRecipe.ProcessRecipe.LastIndexOf("\\") + 1);
 
-                 CurrentRecipe.LayoutRecipe = CurrentRecipe.LayoutRecipe.Substring(CurrentRecipe.LayoutRecipe.LastIndexOf("\\") + 1);
 
-             }
 
-         }
 
-         protected override void OnViewLoaded(object view)
 
-         {
 
-             base.OnViewLoaded(view);
 
-             //GetValueSC();
 
-             GetDefault();
 
-         }
 
-         private void GetDefault()
 
-         {
 
-             //var loadJobPara = item.ModuleName + "," + item.CarrierId + "," + item.WaferCount + "," + item.ExistSlot + "," + item.SlotMap + "," + item.LoadPortName + ";";
 
-             if (SCValueDict.ContainsKey("CJID"))
 
-             {
 
-                 CJID = (string)SCValueDict["CJID"];
 
-             }
 
-             if (SCValueDict.ContainsKey("PJID"))
 
-             {
 
-                 PJID = (string)SCValueDict["PJID"];
 
-             }
 
-             if (SCValueDict.ContainsKey("JobRecipe"))
 
-             {
 
-                 CurrentRecipe.Name = (string)SCValueDict["JobRecipe"];
 
-                 var processType = QueryDataClient.Instance.Service.GetConfig("System.Recipe.SupportedJobType");
 
-                 if (processType == null)
 
-                 {
 
-                     processType = "Job Recipe";
 
-                 }
 
-                 if (!string.IsNullOrEmpty((string)SCValueDict["JobRecipe"]))
 
-                     FromJobRecipeGetProcessAndLayout((string)SCValueDict["JobRecipe"], processType);
 
-             }
 
-             //if (SCValueDict.ContainsKey("CarrierPara"))
 
-             //{
 
-             //    CurrentRecipe.ProcessRecipe = (string)SCValueDict["CarrierPara"];
 
-             //}
 
-             //if (SCValueDict.ContainsKey("mCarrierPara"))
 
-             //{
 
-             //    CurrentRecipe.LayoutRecipe = (string)SCValueDict["mCarrierPara"];
 
-             //}
 
-             if (SCValueDict.ContainsKey("CarrierPara") && !string.IsNullOrEmpty((string)SCValueDict["CarrierPara"]))
 
-             {
 
-                 PCarrierPara = (string)SCValueDict["CarrierPara"];
 
-                 SelectCarrierList.Clear();
 
-                 string[] strCarrierParas = ((string)SCValueDict["CarrierPara"]).Split(';');
 
-                 foreach (var item in strCarrierParas)
 
-                 {
 
-                     int index = 1;
 
-                     if (!string.IsNullOrEmpty(item))
 
-                     {
 
-                         string[] carrierInfos = item.Split(',');
 
-                         CarrierInformation carrierInformation = new CarrierInformation();
 
-                         carrierInformation.No = $"P{index}";
 
-                         carrierInformation.ModuleName = carrierInfos[0];
 
-                         carrierInformation.StrSlot = carrierInfos[1];
 
-                         //carrierInformation.CarrierID = carrierInfos[1];
 
-                         //carrierInformation.WaferCount = carrierInfos[2];
 
-                         carrierInformation.ExistSlot = carrierInfos[2];
 
-                         carrierInformation.SlotMap = carrierInfos[3];
 
-                         carrierInformation.Type = "P";
 
-                         carrierInformation.LoadPortName = carrierInfos[4];
 
-                         SelectCarrierList.Add(carrierInformation);
 
-                         index++;
 
-                     }
 
-                 }
 
-             }
 
-         }
 
-         public void EXECCmd(string cmdPar)
 
-         {
 
-             if (string.IsNullOrEmpty(CurrentRecipe.ProcessRecipe))
 
-             {
 
-                 DialogBox.ShowWarning("Process recipe is empty");
 
-                 return;
 
-             }
 
-             if (string.IsNullOrEmpty(CurrentRecipe.LayoutRecipe))
 
-             {
 
-                 DialogBox.ShowWarning("Layout recipe is empty");
 
-                 return;
 
-             }
 
-             if (string.IsNullOrEmpty(CurrentRecipe.CoolTime))
 
-             {
 
-                 DialogBox.ShowWarning("Cool time is empty");
 
-                 return;
 
-             }
 
-             if (string.IsNullOrEmpty(PJID))
 
-             {
 
-                 DialogBox.ShowWarning("PJ ID is empty");
 
-                 return;
 
-             }
 
-             if (string.IsNullOrEmpty(CJID))
 
-             {
 
-                 DialogBox.ShowWarning("CJ ID is empty");
 
-                 return;
 
-             }
 
-             if (!DialogBox.Confirm("Are you sure to execute?"))
 
-                 return;
 
-             //参数规则按照以下
 
-             string pCarrierPara = string.IsNullOrEmpty(PCarrierPara) ? "" : PCarrierPara.TrimEnd(';');
 
-             string m1CarrierPara = string.IsNullOrEmpty(M1CarrierPara) ? "" : M1CarrierPara.TrimEnd(';');
 
-             string m2CarrierPara = string.IsNullOrEmpty(M2CarrierPara) ? "" : M2CarrierPara.TrimEnd(';');
 
-             string cjID = CJID;//根据输入
 
-             string pjID = PJID;//根据输入
 
-             string pjVariable = "";//后续完善
 
-             Dictionary<string, object> param = new Dictionary<string, object>()
 
-             {
 
-                 {"PJID",pjID },
 
-                 {"CJID",cjID },
 
-                 {"JobRecipe", CurrentRecipe.Name },
 
-                 {"CarrierPara", pCarrierPara},
 
-                 {"m1CarrierPara", m1CarrierPara},
 
-                 {"m2CarrierPara", m2CarrierPara},
 
-                 {"PJVariable", pjVariable},
 
-                 {"WaferType", "P" }
 
-             };
 
-             InvokeClient.Instance.Service.DoOperation($"System.{ExecCommand}", param);
 
-             //SetValueToSC(param);
 
-             // PCarrierPara = "";
 
-             // MCarrierPara = "";
 
-             (GetView() as Window).Close();
 
-         }
 
-         private void SetValueToSC(Dictionary<string, object> param)
 
-         {
 
-             foreach (var item in param.Keys)
 
-             {
 
-                 InvokeClient.Instance.Service.DoOperation($"System.SetConfig", $"System.Job.JOBProcessStock.{item}", param[item]);
 
-             }
 
-         }
 
-         private void GetValueSC()
 
-         {
 
-             SCValueDict.Clear();
 
-             SCValueDict.Add("PJID", null);
 
-             SCValueDict.Add("CJID", null);
 
-             SCValueDict.Add("JobRecipe", null);
 
-             SCValueDict.Add("CarrierPara", null);
 
-             SCValueDict.Add("mCarrierPara", null);
 
-             SCValueDict.Add("PJVariable", null);
 
-             SCValueDict.Add("WaferType", null);
 
-             foreach (var item in SCValueDict.Keys.ToList())
 
-             {
 
-                 SCValueDict[item] = (string)QueryDataClient.Instance.Service.GetConfig($"System.Job.JOBProcessStock.{item}");
 
-             }
 
-         }
 
-         public void Check()
 
-         {
 
-             if (string.IsNullOrEmpty(CurrentRecipe.ProcessRecipe))
 
-             {
 
-                 DialogBox.ShowWarning("Process recipe is empty");
 
-                 return;
 
-             }
 
-             if (string.IsNullOrEmpty(CurrentRecipe.LayoutRecipe))
 
-             {
 
-                 DialogBox.ShowWarning("Layout recipe is empty");
 
-                 return;
 
-             }
 
-             if (string.IsNullOrEmpty(CurrentRecipe.CoolTime))
 
-             {
 
-                 DialogBox.ShowWarning("Cool time is empty");
 
-                 return;
 
-             }
 
-             Dictionary<string, object> param = new Dictionary<string, object>()
 
-             {
 
-                 {"WaferType","P" },
 
-                 {"Form","Normal" },
 
-                 {"JobRecipe", CurrentRecipe.Name },
 
-                 {"ProcessRecipe",CurrentRecipe.ProcessRecipe },
 
-                 {"LayoutRecipe",CurrentRecipe.LayoutRecipe },
 
-                 {"CoolTime",$"{CurrentRecipe.CoolTime}" },
 
-             };
 
-             InvokeClient.Instance.Service.DoOperation($"System.CheckProcess", param);
 
-         }
 
-         public void ClosedCmd(string cmdPar)
 
-         {
 
-             (GetView() as Window).Close();
 
-         }
 
-     }
 
-     public class RecipeDataJob : PropertyChangedBase
 
-     {
 
-         private string _prefixPath;
 
-         public string PrefixPath
 
-         {
 
-             get => _prefixPath;
 
-             set
 
-             {
 
-                 _prefixPath = value;
 
-                 NotifyOfPropertyChange(nameof(PrefixPath));
 
-             }
 
-         }
 
-         private string _name;
 
-         public string Name
 
-         {
 
-             get => _name;
 
-             set
 
-             {
 
-                 _name = value;
 
-                 NotifyOfPropertyChange(nameof(Name));
 
-             }
 
-         }
 
-         private string _createBy;
 
-         public string CreateBy
 
-         {
 
-             get => _createBy;
 
-             set
 
-             {
 
-                 _createBy = value;
 
-                 NotifyOfPropertyChange(nameof(CreateBy));
 
-             }
 
-         }
 
-         private string _createTime;
 
-         public string CreateTime
 
-         {
 
-             get => _createTime;
 
-             set
 
-             {
 
-                 _createTime = value;
 
-                 NotifyOfPropertyChange(nameof(CreateTime));
 
-             }
 
-         }
 
-         private string _lastReviseBy;
 
-         public string LastReviseBy
 
-         {
 
-             get => _lastReviseBy;
 
-             set
 
-             {
 
-                 _lastReviseBy = value;
 
-                 NotifyOfPropertyChange(nameof(LastReviseBy));
 
-             }
 
-         }
 
-         private string _lastRevisionTime;
 
-         public string LastRevisionTime
 
-         {
 
-             get => _lastRevisionTime;
 
-             set
 
-             {
 
-                 _lastRevisionTime = value;
 
-                 NotifyOfPropertyChange(nameof(LastRevisionTime));
 
-             }
 
-         }
 
-         private string _description;
 
-         public string Description
 
-         {
 
-             get => _description;
 
-             set
 
-             {
 
-                 _description = value;
 
-                 NotifyOfPropertyChange(nameof(Description));
 
-             }
 
-         }
 
-         private string _recipePermission;
 
-         public string RecipePermission
 
-         {
 
-             get { return this._recipePermission; }
 
-             set
 
-             {
 
-                 this._recipePermission = value;
 
-                 this.NotifyOfPropertyChange("RecipePermisson");
 
-             }
 
-         }
 
-         private string _recipeLevel;
 
-         public string RecipeLevel
 
-         {
 
-             get { return this._recipeLevel; }
 
-             set
 
-             {
 
-                 this._recipeLevel = value;
 
-                 this.NotifyOfPropertyChange("RecipeLevel");
 
-             }
 
-         }
 
-         private string _processRecipe;
 
-         public string ProcessRecipe
 
-         {
 
-             get => _processRecipe;
 
-             set
 
-             {
 
-                 _processRecipe = value;
 
-                 NotifyOfPropertyChange(nameof(ProcessRecipe));
 
-             }
 
-         }
 
-         private string _layoutRecipe;
 
-         public string LayoutRecipe
 
-         {
 
-             get => _layoutRecipe;
 
-             set
 
-             {
 
-                 _layoutRecipe = value;
 
-                 NotifyOfPropertyChange(nameof(LayoutRecipe));
 
-             }
 
-         }
 
-         private string _coolTime;
 
-         public string CoolTime
 
-         {
 
-             get => _coolTime;
 
-             set
 
-             {
 
-                 _coolTime = value;
 
-                 NotifyOfPropertyChange(nameof(CoolTime));
 
-             }
 
-         }
 
-         private string _recipeChamberType;
 
-         public string RecipeChamberType
 
-         {
 
-             get => _recipeChamberType;
 
-             set
 
-             {
 
-                 _recipeChamberType = value;
 
-                 NotifyOfPropertyChange(nameof(RecipeChamberType));
 
-             }
 
-         }
 
-         private string _recipeVersion;
 
-         public string RecipeVersion
 
-         {
 
-             get => _recipeVersion;
 
-             set
 
-             {
 
-                 _recipeVersion = value;
 
-                 NotifyOfPropertyChange(nameof(RecipeVersion));
 
-             }
 
-         }
 
-         private XmlDocument _doc;
 
-         private string _module;
 
-         private RecipeProvider _recipeProvider = new RecipeProvider();
 
-         public RecipeDataJob()
 
-         {
 
-             _doc = new XmlDocument();
 
-         }
 
-         public void Clear()
 
-         {
 
-             CreateBy = "";
 
-             CreateTime = "";
 
-             LastReviseBy = "";
 
-             LastRevisionTime = "";
 
-             Description = "";
 
-             RecipeChamberType = "";
 
-             RecipeVersion = "";
 
-             _module = "";
 
-         }
 
-         public void InitData(string prefixPath, string recipeName, string recipeContent, string module)
 
-         {
 
-             PrefixPath = prefixPath;
 
-             Name = recipeName;
 
-             _module = module;
 
-             try
 
-             {
 
-                 _doc = new XmlDocument();
 
-                 _doc.LoadXml(recipeContent);
 
-                 if (!LoadHeader(_doc.SelectSingleNode("Aitex/TableRecipeData")))
 
-                     return;
 
-                 XmlNode nodeModule;
 
-                 nodeModule = _doc.SelectSingleNode("Aitex/TableRecipeData");
 
-                 XmlElement stepNode = nodeModule as XmlElement;
 
-                 foreach (XmlAttribute att in stepNode.Attributes)
 
-                 {
 
-                     switch (att.Name)
 
-                     {
 
-                         case "CreatedBy":
 
-                             CreateBy = att.Value;
 
-                             break;
 
-                         case "CreationTime":
 
-                             CreateTime = att.Value;
 
-                             break;
 
-                         case "LastRevisedBy":
 
-                             LastReviseBy = att.Value;
 
-                             break;
 
-                         case "LastRevisionTime":
 
-                             LastRevisionTime = att.Value;
 
-                             break;
 
-                         case "Description":
 
-                             Description = att.Value;
 
-                             break;
 
-                     }
 
-                 }
 
-                 nodeModule = _doc.SelectSingleNode($"Aitex/TableRecipeData/Module[@Name='{module}']/Step");
 
-                 if (nodeModule == null)
 
-                     return;
 
-                 stepNode = nodeModule as XmlElement;
 
-                 foreach (XmlAttribute att in stepNode.Attributes)
 
-                 {
 
-                     switch (att.Name)
 
-                     {
 
-                         case "ProcessRecipe":
 
-                             ProcessRecipe = att.Value;
 
-                             break;
 
-                         case "LayoutRecipe":
 
-                             LayoutRecipe = att.Value;
 
-                             break;
 
-                         case "CoolTime":
 
-                             CoolTime = att.Value;
 
-                             break;
 
-                     }
 
-                 }
 
-             }
 
-             catch (Exception ex)
 
-             {
 
-                 LOG.Write(ex);
 
-             }
 
-         }
 
-         public string GetXmlString()
 
-         {
 
-             try
 
-             {
 
-                 XmlElement nodeData = _doc.SelectSingleNode($"Aitex/TableRecipeData") as XmlElement;
 
-                 if (string.IsNullOrEmpty(LastReviseBy))
 
-                     nodeData.SetAttribute("LastRevisedBy", LastReviseBy);
 
-                 if (string.IsNullOrEmpty(LastRevisionTime))
 
-                     nodeData.SetAttribute("LastRevisionTime", LastRevisionTime);
 
-                 if (string.IsNullOrEmpty(Description))
 
-                     nodeData.SetAttribute("Description", Description);
 
-                 if (string.IsNullOrEmpty(RecipeChamberType))
 
-                     nodeData.SetAttribute("RecipeChamberType", RecipeChamberType);
 
-                 if (string.IsNullOrEmpty(RecipePermission))
 
-                     nodeData.SetAttribute("RecipePermission", RecipePermission);
 
-                 if (string.IsNullOrEmpty(RecipeLevel))
 
-                     nodeData.SetAttribute("RecipeLevel", RecipeLevel);
 
-                 XmlNode nodeModule = _doc.SelectSingleNode($"Aitex/TableRecipeData/Module[@Name='{_module}']");
 
-                 if (nodeModule == null)
 
-                 {
 
-                     nodeModule = _doc.CreateElement("Module");
 
-                     nodeData.AppendChild(nodeModule);
 
-                 }
 
-                 nodeModule.RemoveAll();
 
-                 (nodeModule as XmlElement).SetAttribute("Name", _module);
 
-                 XmlElement nodeStep = _doc.CreateElement("Step");
 
-                 nodeStep.SetAttribute("ProcessRecipe", ProcessRecipe);
 
-                 nodeStep.SetAttribute("LayoutRecipe", LayoutRecipe);
 
-                 nodeStep.SetAttribute("CoolTime", CoolTime);
 
-                 nodeModule.AppendChild(nodeStep);
 
-             }
 
-             catch (Exception ex)
 
-             {
 
-                 LOG.Write(ex);
 
-                 return _doc.OuterXml;
 
-             }
 
-             return _doc.OuterXml;
 
-         }
 
-         private bool LoadHeader(XmlNode nodeHeader)
 
-         {
 
-             if (nodeHeader == null)
 
-                 return false;
 
-             if (nodeHeader.Attributes["CreatedBy"] != null)
 
-                 CreateBy = nodeHeader.Attributes["CreatedBy"].Value;
 
-             if (nodeHeader.Attributes["CreationTime"] != null)
 
-                 CreateTime = nodeHeader.Attributes["CreationTime"].Value;
 
-             if (nodeHeader.Attributes["LastRevisedBy"] != null)
 
-                 LastReviseBy = nodeHeader.Attributes["LastRevisedBy"].Value;
 
-             if (nodeHeader.Attributes["LastRevisionTime"] != null)
 
-                 LastRevisionTime = nodeHeader.Attributes["LastRevisionTime"].Value;
 
-             if (nodeHeader.Attributes["Description"] != null)
 
-                 Description = nodeHeader.Attributes["Description"].Value;
 
-             string chamberType = string.Empty;
 
-             if (nodeHeader.Attributes["RecipeChamberType"] != null)
 
-                 chamberType = nodeHeader.Attributes["RecipeChamberType"].Value;
 
-             if (!string.IsNullOrEmpty(chamberType) && chamberType != RecipeChamberType)
 
-             {
 
-                 LOG.Write($"{chamberType} is not accordance with {RecipeChamberType}");
 
-                 return false;
 
-             }
 
-             return true;
 
-         }
 
-     }
 
- }
 
 
  |