JOBProcessStockViewModel.cs 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985
  1. using Aitex.Core.RT.Log;
  2. using Aitex.Core.RT.SCCore;
  3. using Aitex.Core.Util;
  4. using Caliburn.Micro;
  5. using Caliburn.Micro.Core;
  6. using FurnaceUI.Common;
  7. using FurnaceUI.Models;
  8. using MECF.Framework.Common.DataCenter;
  9. using MECF.Framework.Common.OperationCenter;
  10. using MECF.Framework.Common.SubstrateTrackings;
  11. using MECF.Framework.UI.Client.CenterViews.Editors.Recipe;
  12. using MECF.Framework.UI.Client.CenterViews.Editors.Sequence;
  13. using OpenSEMI.ClientBase;
  14. using System;
  15. using System.Collections.Generic;
  16. using System.Collections.ObjectModel;
  17. using System.Linq;
  18. using System.Net.Sockets;
  19. using System.Text;
  20. using System.Threading.Tasks;
  21. using System.Windows;
  22. using System.Xml;
  23. namespace FurnaceUI.Views.Jobs
  24. {
  25. public class CarrierInformation : PropertyChangedBase
  26. {
  27. private string _no;
  28. public string No
  29. {
  30. get
  31. {
  32. return _no;
  33. }
  34. set
  35. {
  36. _no = value;
  37. NotifyOfPropertyChange("No");
  38. }
  39. }
  40. private string _type;
  41. public string Type
  42. {
  43. get
  44. {
  45. return _type;
  46. }
  47. set
  48. {
  49. _type = value;
  50. NotifyOfPropertyChange("Type");
  51. }
  52. }
  53. private string _moduleName;
  54. public string ModuleName
  55. {
  56. get
  57. {
  58. return _moduleName;
  59. }
  60. set
  61. {
  62. _moduleName = value;
  63. NotifyOfPropertyChange("ModuleName");
  64. }
  65. }
  66. private string _carrierID;
  67. public string CarrierID
  68. {
  69. get
  70. {
  71. return _carrierID;
  72. }
  73. set
  74. {
  75. _carrierID = value;
  76. NotifyOfPropertyChange("CarrierID");
  77. }
  78. }
  79. private string _waferCount;
  80. public string WaferCount
  81. {
  82. get => _waferCount;
  83. set
  84. {
  85. _waferCount = value;
  86. NotifyOfPropertyChange("WaferCount");
  87. }
  88. }
  89. private string _existSlot;
  90. public string ExistSlot
  91. {
  92. get => _existSlot;
  93. set
  94. {
  95. _existSlot = value;
  96. NotifyOfPropertyChange("ExistSlot");
  97. }
  98. }
  99. private string _slotMap;
  100. public string SlotMap
  101. {
  102. get => _slotMap;
  103. set
  104. {
  105. _slotMap = value;
  106. NotifyOfPropertyChange("SlotMap");
  107. }
  108. }
  109. private string _strSlot;
  110. public string StrSlot
  111. {
  112. get => _strSlot;
  113. set
  114. {
  115. _strSlot = value;
  116. NotifyOfPropertyChange(nameof(StrSlot));
  117. }
  118. }
  119. private string _loadPortName;
  120. public string LoadPortName
  121. {
  122. get => _loadPortName;
  123. set
  124. {
  125. _loadPortName = value;
  126. NotifyOfPropertyChange("LoadPortName");
  127. }
  128. }
  129. }
  130. public class JOBProcessStockViewModel : FurnaceModuleUIViewModelBase
  131. {
  132. public string PCarrierPara { get; set; }
  133. public string M1CarrierPara { get; set; }
  134. public string M2CarrierPara { get; set; }
  135. public ObservableCollection<CarrierInformation> SelectCarrierList { get; set; } = new ObservableCollection<CarrierInformation>();
  136. public ObservableCollection<CarrierInformation> SelectCarrierListTemp { get; set; } = new ObservableCollection<CarrierInformation>();
  137. public Dictionary<string, object> SCValueDict = new Dictionary<string, object>();
  138. private string _cjID;
  139. public string CJID
  140. {
  141. get
  142. {
  143. return _cjID;
  144. }
  145. set
  146. {
  147. _cjID = value;
  148. NotifyOfPropertyChange("CJID");
  149. }
  150. }
  151. private string _pjID;
  152. public string PJID
  153. {
  154. get
  155. {
  156. return _pjID;
  157. }
  158. set
  159. {
  160. _pjID = value;
  161. NotifyOfPropertyChange("PJID");
  162. }
  163. }
  164. public JOBProcessStockViewModel()
  165. {
  166. }
  167. private readonly RecipeProvider _recipeProvider = new RecipeProvider();
  168. public RecipeDataJob CurrentRecipe { get; set; } = new RecipeDataJob();
  169. public string ExecCommand { get; set; }
  170. public bool IsCheckButtonVisible { get; set; } = false;
  171. public bool IsWithUnloadButtonVisible { get; set; }
  172. public bool IsStockNumberChangeButtonVisible { get; set; }
  173. public bool IsLotIDInputEnable { get; set; } = true;
  174. private string _waferType = "P";
  175. #region Stocker Carrier Info
  176. [Subscription("Stocker1.Carrier")]
  177. public CarrierInfo Stocker1CarrierData { get; set; }
  178. [Subscription("Stocker2.Carrier")]
  179. public CarrierInfo Stocker2CarrierData { get; set; }
  180. [Subscription("Stocker3.Carrier")]
  181. public CarrierInfo Stocker3CarrierData { get; set; }
  182. [Subscription("Stocker4.Carrier")]
  183. public CarrierInfo Stocker4CarrierData { get; set; }
  184. [Subscription("Stocker5.Carrier")]
  185. public CarrierInfo Stocker5CarrierData { get; set; }
  186. [Subscription("Stocker6.Carrier")]
  187. public CarrierInfo Stocker6CarrierData { get; set; }
  188. [Subscription("Stocker7.Carrier")]
  189. public CarrierInfo Stocker7CarrierData { get; set; }
  190. [Subscription("Stocker8.Carrier")]
  191. public CarrierInfo Stocker8CarrierData { get; set; }
  192. [Subscription("Stocker9.Carrier")]
  193. public CarrierInfo Stocker9CarrierData { get; set; }
  194. [Subscription("Stocker10.Carrier")]
  195. public CarrierInfo Stocker10CarrierData { get; set; }
  196. [Subscription("Stocker11.Carrier")]
  197. public CarrierInfo Stocker11CarrierData { get; set; }
  198. [Subscription("Stocker12.Carrier")]
  199. public CarrierInfo Stocker12CarrierData { get; set; }
  200. [Subscription("Stocker13.Carrier")]
  201. public CarrierInfo Stocker13CarrierData { get; set; }
  202. [Subscription("Stocker14.Carrier")]
  203. public CarrierInfo Stocker14CarrierData { get; set; }
  204. [Subscription("Stocker15.Carrier")]
  205. public CarrierInfo Stocker15CarrierData { get; set; }
  206. [Subscription("Stocker16.Carrier")]
  207. public CarrierInfo Stocker16CarrierData { get; set; }
  208. [Subscription("Stocker17.Carrier")]
  209. public CarrierInfo Stocker17CarrierData { get; set; }
  210. [Subscription("Stocker18.Carrier")]
  211. public CarrierInfo Stocker18CarrierData { get; set; }
  212. [Subscription("Stocker19.Carrier")]
  213. public CarrierInfo Stocker19CarrierData { get; set; }
  214. [Subscription("Stocker20.Carrier")]
  215. public CarrierInfo Stocker20CarrierData { get; set; }
  216. [Subscription("Stocker21.Carrier")]
  217. public CarrierInfo Stocker21CarrierData { get; set; }
  218. #endregion
  219. List<CarrierInfo> _carrierlist = new List<CarrierInfo>();
  220. ObservableCollection<CarrierInfo> _stockerList = new ObservableCollection<CarrierInfo>();
  221. protected override void OnInitialize()
  222. {
  223. base.OnInitialize();
  224. }
  225. protected override void InvokeAfterUpdateProperty(Dictionary<string, object> data)
  226. {
  227. base.InvokeAfterUpdateProperty(data);
  228. _stockerList.Clear();
  229. if (Stocker1CarrierData != null) { Stocker1CarrierData.StockerIndex = 1; _stockerList.Add(Stocker1CarrierData); }
  230. if (Stocker2CarrierData != null) { Stocker2CarrierData.StockerIndex = 2; _stockerList.Add(Stocker2CarrierData); }
  231. if (Stocker3CarrierData != null) { Stocker3CarrierData.StockerIndex = 3; _stockerList.Add(Stocker3CarrierData); }
  232. if (Stocker4CarrierData != null) { Stocker4CarrierData.StockerIndex = 4; _stockerList.Add(Stocker4CarrierData); }
  233. if (Stocker5CarrierData != null) { Stocker5CarrierData.StockerIndex = 5; _stockerList.Add(Stocker5CarrierData); }
  234. if (Stocker6CarrierData != null) { Stocker6CarrierData.StockerIndex = 6; _stockerList.Add(Stocker6CarrierData); }
  235. if (Stocker7CarrierData != null) { Stocker7CarrierData.StockerIndex = 7; _stockerList.Add(Stocker7CarrierData); }
  236. if (Stocker8CarrierData != null) { Stocker8CarrierData.StockerIndex = 8; _stockerList.Add(Stocker8CarrierData); }
  237. if (Stocker9CarrierData != null) { Stocker9CarrierData.StockerIndex = 9; _stockerList.Add(Stocker9CarrierData); }
  238. if (Stocker10CarrierData != null) { Stocker10CarrierData.StockerIndex = 10; _stockerList.Add(Stocker10CarrierData); }
  239. if (Stocker11CarrierData != null) { Stocker11CarrierData.StockerIndex = 11; _stockerList.Add(Stocker11CarrierData); }
  240. if (Stocker12CarrierData != null) { Stocker12CarrierData.StockerIndex = 12; _stockerList.Add(Stocker12CarrierData); }
  241. if (Stocker13CarrierData != null) { Stocker13CarrierData.StockerIndex = 13; _stockerList.Add(Stocker13CarrierData); }
  242. if (Stocker14CarrierData != null) { Stocker14CarrierData.StockerIndex = 14; _stockerList.Add(Stocker14CarrierData); }
  243. if (Stocker15CarrierData != null) { Stocker15CarrierData.StockerIndex = 15; _stockerList.Add(Stocker15CarrierData); }
  244. if (Stocker16CarrierData != null) { Stocker16CarrierData.StockerIndex = 16; _stockerList.Add(Stocker16CarrierData); }
  245. if (Stocker17CarrierData != null) { Stocker17CarrierData.StockerIndex = 17; _stockerList.Add(Stocker17CarrierData); }
  246. if (Stocker18CarrierData != null) { Stocker18CarrierData.StockerIndex = 18; _stockerList.Add(Stocker18CarrierData); }
  247. }
  248. public void SwitchPage(string operation)
  249. {
  250. var windowManager = IoC.Get<IWindowManager>();
  251. switch (operation)
  252. {
  253. case "MaterialSelect":
  254. {
  255. LoadJOBTwoViewModel loadJobTwoViewModel = new LoadJOBTwoViewModel();
  256. loadJobTwoViewModel.PTypeRadioButtonVisibility = Visibility.Visible;
  257. loadJobTwoViewModel.MTypeRadioButtonVisibility = Visibility.Collapsed;
  258. loadJobTwoViewModel.SDTypeRadioButtonVisibility = Visibility.Collapsed;
  259. loadJobTwoViewModel.EDTypeRadioButtonVisibility = Visibility.Collapsed;
  260. loadJobTwoViewModel.ExecCommand = "Load";
  261. loadJobTwoViewModel.ExecText = "Accept";
  262. loadJobTwoViewModel.IsPChecked = true;
  263. loadJobTwoViewModel.IsMChecked = false;
  264. loadJobTwoViewModel.IsSetValue = true;
  265. loadJobTwoViewModel.IsExecuteRTCommand = false;
  266. loadJobTwoViewModel.CarrierInformationList.Clear();
  267. if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(loadJobTwoViewModel, null, "Material Select"))
  268. {
  269. //SelectCarrierList.Clear();
  270. for (int j = 0; j < SelectCarrierList.Count; j++)
  271. {
  272. if (SelectCarrierList[j].Type.Contains("P"))
  273. {
  274. SelectCarrierList.RemoveAt(j);
  275. j--;
  276. }
  277. }
  278. if (string.IsNullOrEmpty(loadJobTwoViewModel.LoadJobPara))
  279. return;
  280. PCarrierPara = loadJobTwoViewModel.LoadJobPara.TrimEnd(';');
  281. string[] Carriers = PCarrierPara.Split(':');
  282. CarrierInformation carrierInfo = new CarrierInformation();
  283. carrierInfo.No = Carriers[0].Replace("Stocker", "");
  284. var item = Carriers[1].Split(',');
  285. carrierInfo.Type = CarrierType.P.ToString();
  286. carrierInfo.ModuleName = item[0];
  287. carrierInfo.StrSlot = item[1];
  288. // carrierInfo.CarrierID = item[2];
  289. //carrierInfo.WaferCount = item[3];
  290. carrierInfo.ExistSlot = item[2];
  291. carrierInfo.SlotMap = item[3];
  292. carrierInfo.LoadPortName = item[4];
  293. SelectCarrierList.Add(carrierInfo);
  294. }
  295. }
  296. break;
  297. case "SelectM":
  298. {
  299. _carrierlist.Clear();
  300. foreach (var item in _stockerList)
  301. {
  302. string configType = (string)QueryDataClient.Instance.Service.GetConfig($"System.Stocker.Stocker{item.StockerIndex}WaferType");
  303. var boolM = configType.StartsWith(CarrierType.M.ToString()) && !item.IsEmpty;
  304. var boolNone = configType.StartsWith(CarrierType.None.ToString()) && !item.IsEmpty && item.CarrierType.ToString().Contains(CarrierType.M.ToString());
  305. if (boolNone || boolM)
  306. {
  307. _carrierlist.Add(item);
  308. }
  309. }
  310. SelectMaterialViewModel selectmaterialViewModel = new SelectMaterialViewModel();
  311. selectmaterialViewModel.carrierlist = _carrierlist;
  312. selectmaterialViewModel.CarrierType = "M";
  313. selectmaterialViewModel.SelectCarrierItemList.Clear();
  314. foreach (var item in SelectCarrierList)
  315. {
  316. selectmaterialViewModel.SelectCarrierItemList.Add(new CarrierMaterialInformation()
  317. {
  318. ModuleName = item.ModuleName,
  319. No = item.No,
  320. CarrierType = "M",
  321. CarrierId = item.CarrierID,
  322. });
  323. };
  324. if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(selectmaterialViewModel, null, "Select M"))
  325. {
  326. int i = 0;
  327. for (int j = 0; j < SelectCarrierList.Count; j++)
  328. {
  329. if (SelectCarrierList[j].Type.Contains(ConstantsCommon.M))
  330. {
  331. SelectCarrierList.RemoveAt(j);
  332. j--;
  333. }
  334. }
  335. M1CarrierPara = "";
  336. M2CarrierPara = "";
  337. foreach (CarrierMaterialInformation item in selectmaterialViewModel.SelectCarrierItemList)
  338. {
  339. CarrierInformation carrierInfo = new CarrierInformation();
  340. carrierInfo.No = item.No;
  341. carrierInfo.Type = item.CarrierType;
  342. carrierInfo.ModuleName = item.ModuleName;
  343. carrierInfo.CarrierID = item.CarrierId;
  344. carrierInfo.LoadPortName = "";
  345. carrierInfo.StrSlot = item.StrSlot;
  346. if (item.CarrierType == "M1")
  347. M1CarrierPara += item.ModuleName + "," + (item.CarrierId == null ? "" : item.CarrierId) + "," + item.StrSlot + ";";
  348. else if (item.CarrierType == "M2")
  349. M2CarrierPara += item.ModuleName + "," + (item.CarrierId == null ? "" : item.CarrierId) + "," + item.StrSlot + ";";
  350. SelectCarrierList.Add(carrierInfo);
  351. }
  352. }
  353. }
  354. break;
  355. }
  356. }
  357. public void SelectJobRecipe()
  358. {
  359. RecipeSelectDialogViewModel dialog = new RecipeSelectDialogViewModel();
  360. dialog.DisplayName = "Select Job Recipe";
  361. var recipeProvider = new RecipeProvider();
  362. var processType = QueryDataClient.Instance.Service.GetConfig("System.Recipe.SupportedJobType");
  363. if (processType == null)
  364. {
  365. processType = "Job Recipe";
  366. }
  367. var ProcessTypeFileList = new ObservableCollection<ProcessTypeFileItem>();
  368. string[] recipeProcessType = ((string)processType).Split(',');
  369. for (int i = 0; i < recipeProcessType.Length; i++)
  370. {
  371. var type = new ProcessTypeFileItem();
  372. type.ProcessType = recipeProcessType[i];
  373. var prefix = $"Furnace\\{recipeProcessType[i]}";
  374. var recipes = recipeProvider.GetXmlRecipeList(prefix);
  375. type.FileListByProcessType = RecipeSequenceTreeBuilder.BuildFileNode(prefix, "", false, recipes)[0].Files;
  376. ProcessTypeFileList.Add(type);
  377. }
  378. dialog.ProcessTypeFileList = ProcessTypeFileList;
  379. WindowManager wm = new WindowManager();
  380. bool? bret = wm.ShowDialog(dialog);
  381. if ((bool)bret)
  382. {
  383. CurrentRecipe.Clear();
  384. CurrentRecipe.PrefixPath = $"Furnace\\{processType}";
  385. CurrentRecipe.Name = dialog.DialogResult;
  386. var recipeContent = _recipeProvider.LoadRecipe(CurrentRecipe.PrefixPath, CurrentRecipe.Name);
  387. if (string.IsNullOrEmpty(recipeContent))
  388. {
  389. System.Windows.MessageBox.Show($"{CurrentRecipe.PrefixPath}\\{CurrentRecipe.Name} is empty, please confirm the file is valid.");
  390. return;
  391. }
  392. CurrentRecipe.RecipeChamberType = "OriginChamber";
  393. CurrentRecipe.InitData(CurrentRecipe.PrefixPath, CurrentRecipe.Name, recipeContent, "PM1");
  394. CheckIsExistRecipe(CurrentRecipe.ProcessRecipe, CurrentRecipe.LayoutRecipe);
  395. }
  396. //CheckIsExistRecipe(CurrentRecipe.ProcessRecipe, CurrentRecipe.LayoutRecipe);
  397. }
  398. private void CheckIsExistRecipe(string processName, string layoutName)
  399. {
  400. var processPrefixPath = $"Furnace\\Process";
  401. var layoutPrefixPath = $"Furnace\\Layout";
  402. var processContent = _recipeProvider.LoadRecipe(processPrefixPath, processName);
  403. var layoutContent = _recipeProvider.LoadRecipe(layoutPrefixPath, layoutName);
  404. if (string.IsNullOrEmpty(processContent))
  405. {
  406. DialogBox.ShowWarning($"Process Recipe:{processName} is empty, please confirm the file is valid.");
  407. }
  408. if (string.IsNullOrEmpty(layoutContent))
  409. {
  410. DialogBox.ShowWarning($"Layout Recipe:{layoutName} is empty, please confirm the file is valid.");
  411. }
  412. }
  413. private void FromJobRecipeGetProcessAndLayout(string name, object processType)
  414. {
  415. CurrentRecipe.Clear();
  416. CurrentRecipe.PrefixPath = $"Furnace\\{processType}";
  417. CurrentRecipe.Name = name;
  418. var recipeContent = _recipeProvider.LoadRecipe(CurrentRecipe.PrefixPath, CurrentRecipe.Name);
  419. if (!string.IsNullOrEmpty(recipeContent))
  420. {
  421. CurrentRecipe.RecipeChamberType = "OriginChamber";
  422. CurrentRecipe.InitData(CurrentRecipe.PrefixPath, CurrentRecipe.Name, recipeContent, "PM1");
  423. CurrentRecipe.ProcessRecipe = CurrentRecipe.ProcessRecipe.Substring(CurrentRecipe.ProcessRecipe.LastIndexOf("\\") + 1);
  424. CurrentRecipe.LayoutRecipe = CurrentRecipe.LayoutRecipe.Substring(CurrentRecipe.LayoutRecipe.LastIndexOf("\\") + 1);
  425. }
  426. }
  427. protected override void OnViewLoaded(object view)
  428. {
  429. base.OnViewLoaded(view);
  430. //GetValueSC();
  431. GetDefault();
  432. }
  433. private void GetDefault()
  434. {
  435. //var loadJobPara = item.ModuleName + "," + item.CarrierId + "," + item.WaferCount + "," + item.ExistSlot + "," + item.SlotMap + "," + item.LoadPortName + ";";
  436. if (SCValueDict.ContainsKey("CJID"))
  437. {
  438. CJID = (string)SCValueDict["CJID"];
  439. }
  440. if (SCValueDict.ContainsKey("PJID"))
  441. {
  442. PJID = (string)SCValueDict["PJID"];
  443. }
  444. if (SCValueDict.ContainsKey("JobRecipe"))
  445. {
  446. CurrentRecipe.Name = (string)SCValueDict["JobRecipe"];
  447. var processType = QueryDataClient.Instance.Service.GetConfig("System.Recipe.SupportedJobType");
  448. if (processType == null)
  449. {
  450. processType = "Job Recipe";
  451. }
  452. if (!string.IsNullOrEmpty((string)SCValueDict["JobRecipe"]))
  453. FromJobRecipeGetProcessAndLayout((string)SCValueDict["JobRecipe"], processType);
  454. }
  455. //if (SCValueDict.ContainsKey("CarrierPara"))
  456. //{
  457. // CurrentRecipe.ProcessRecipe = (string)SCValueDict["CarrierPara"];
  458. //}
  459. //if (SCValueDict.ContainsKey("mCarrierPara"))
  460. //{
  461. // CurrentRecipe.LayoutRecipe = (string)SCValueDict["mCarrierPara"];
  462. //}
  463. if (SCValueDict.ContainsKey("CarrierPara") && !string.IsNullOrEmpty((string)SCValueDict["CarrierPara"]))
  464. {
  465. PCarrierPara = (string)SCValueDict["CarrierPara"];
  466. SelectCarrierList.Clear();
  467. string[] strCarrierParas = ((string)SCValueDict["CarrierPara"]).Split(';');
  468. foreach (var item in strCarrierParas)
  469. {
  470. int index = 1;
  471. if (!string.IsNullOrEmpty(item))
  472. {
  473. string[] carrierInfos = item.Split(',');
  474. CarrierInformation carrierInformation = new CarrierInformation();
  475. carrierInformation.No = $"P{index}";
  476. carrierInformation.ModuleName = carrierInfos[0];
  477. carrierInformation.StrSlot = carrierInfos[1];
  478. //carrierInformation.CarrierID = carrierInfos[1];
  479. //carrierInformation.WaferCount = carrierInfos[2];
  480. carrierInformation.ExistSlot = carrierInfos[2];
  481. carrierInformation.SlotMap = carrierInfos[3];
  482. carrierInformation.Type = "P";
  483. carrierInformation.LoadPortName = carrierInfos[4];
  484. SelectCarrierList.Add(carrierInformation);
  485. index++;
  486. }
  487. }
  488. }
  489. }
  490. public void EXECCmd(string cmdPar)
  491. {
  492. if (string.IsNullOrEmpty(CurrentRecipe.ProcessRecipe))
  493. {
  494. DialogBox.ShowWarning("Process recipe is empty");
  495. return;
  496. }
  497. if (string.IsNullOrEmpty(CurrentRecipe.LayoutRecipe))
  498. {
  499. DialogBox.ShowWarning("Layout recipe is empty");
  500. return;
  501. }
  502. if (string.IsNullOrEmpty(CurrentRecipe.CoolTime))
  503. {
  504. DialogBox.ShowWarning("Cool time is empty");
  505. return;
  506. }
  507. if (string.IsNullOrEmpty(PJID))
  508. {
  509. DialogBox.ShowWarning("PJ ID is empty");
  510. return;
  511. }
  512. if (string.IsNullOrEmpty(CJID))
  513. {
  514. DialogBox.ShowWarning("CJ ID is empty");
  515. return;
  516. }
  517. if (!DialogBox.Confirm("Are you sure to execute?"))
  518. return;
  519. //参数规则按照以下
  520. string pCarrierPara = string.IsNullOrEmpty(PCarrierPara) ? "" : PCarrierPara.TrimEnd(';');
  521. string m1CarrierPara = string.IsNullOrEmpty(M1CarrierPara) ? "" : M1CarrierPara.TrimEnd(';');
  522. string m2CarrierPara = string.IsNullOrEmpty(M2CarrierPara) ? "" : M2CarrierPara.TrimEnd(';');
  523. string cjID = CJID;//根据输入
  524. string pjID = PJID;//根据输入
  525. string pjVariable = "";//后续完善
  526. Dictionary<string, object> param = new Dictionary<string, object>()
  527. {
  528. {"PJID",pjID },
  529. {"CJID",cjID },
  530. {"JobRecipe", CurrentRecipe.Name },
  531. {"CarrierPara", pCarrierPara},
  532. {"m1CarrierPara", m1CarrierPara},
  533. {"m2CarrierPara", m2CarrierPara},
  534. {"PJVariable", pjVariable},
  535. {"WaferType", "P" }
  536. };
  537. InvokeClient.Instance.Service.DoOperation($"System.{ExecCommand}", param);
  538. //SetValueToSC(param);
  539. // PCarrierPara = "";
  540. // MCarrierPara = "";
  541. (GetView() as Window).Close();
  542. }
  543. private void SetValueToSC(Dictionary<string, object> param)
  544. {
  545. foreach (var item in param.Keys)
  546. {
  547. InvokeClient.Instance.Service.DoOperation($"System.SetConfig", $"System.Job.JOBProcessStock.{item}", param[item]);
  548. }
  549. }
  550. private void GetValueSC()
  551. {
  552. SCValueDict.Clear();
  553. SCValueDict.Add("PJID", null);
  554. SCValueDict.Add("CJID", null);
  555. SCValueDict.Add("JobRecipe", null);
  556. SCValueDict.Add("CarrierPara", null);
  557. SCValueDict.Add("mCarrierPara", null);
  558. SCValueDict.Add("PJVariable", null);
  559. SCValueDict.Add("WaferType", null);
  560. foreach (var item in SCValueDict.Keys.ToList())
  561. {
  562. SCValueDict[item] = (string)QueryDataClient.Instance.Service.GetConfig($"System.Job.JOBProcessStock.{item}");
  563. }
  564. }
  565. public void Check()
  566. {
  567. if (string.IsNullOrEmpty(CurrentRecipe.ProcessRecipe))
  568. {
  569. DialogBox.ShowWarning("Process recipe is empty");
  570. return;
  571. }
  572. if (string.IsNullOrEmpty(CurrentRecipe.LayoutRecipe))
  573. {
  574. DialogBox.ShowWarning("Layout recipe is empty");
  575. return;
  576. }
  577. if (string.IsNullOrEmpty(CurrentRecipe.CoolTime))
  578. {
  579. DialogBox.ShowWarning("Cool time is empty");
  580. return;
  581. }
  582. Dictionary<string, object> param = new Dictionary<string, object>()
  583. {
  584. {"WaferType","P" },
  585. {"Form","Normal" },
  586. {"JobRecipe", CurrentRecipe.Name },
  587. {"ProcessRecipe",CurrentRecipe.ProcessRecipe },
  588. {"LayoutRecipe",CurrentRecipe.LayoutRecipe },
  589. {"CoolTime",$"{CurrentRecipe.CoolTime}" },
  590. };
  591. InvokeClient.Instance.Service.DoOperation($"System.CheckProcess", param);
  592. }
  593. public void ClosedCmd(string cmdPar)
  594. {
  595. (GetView() as Window).Close();
  596. }
  597. }
  598. public class RecipeDataJob : PropertyChangedBase
  599. {
  600. private string _prefixPath;
  601. public string PrefixPath
  602. {
  603. get => _prefixPath;
  604. set
  605. {
  606. _prefixPath = value;
  607. NotifyOfPropertyChange(nameof(PrefixPath));
  608. }
  609. }
  610. private string _name;
  611. public string Name
  612. {
  613. get => _name;
  614. set
  615. {
  616. _name = value;
  617. NotifyOfPropertyChange(nameof(Name));
  618. }
  619. }
  620. private string _createBy;
  621. public string CreateBy
  622. {
  623. get => _createBy;
  624. set
  625. {
  626. _createBy = value;
  627. NotifyOfPropertyChange(nameof(CreateBy));
  628. }
  629. }
  630. private string _createTime;
  631. public string CreateTime
  632. {
  633. get => _createTime;
  634. set
  635. {
  636. _createTime = value;
  637. NotifyOfPropertyChange(nameof(CreateTime));
  638. }
  639. }
  640. private string _lastReviseBy;
  641. public string LastReviseBy
  642. {
  643. get => _lastReviseBy;
  644. set
  645. {
  646. _lastReviseBy = value;
  647. NotifyOfPropertyChange(nameof(LastReviseBy));
  648. }
  649. }
  650. private string _lastRevisionTime;
  651. public string LastRevisionTime
  652. {
  653. get => _lastRevisionTime;
  654. set
  655. {
  656. _lastRevisionTime = value;
  657. NotifyOfPropertyChange(nameof(LastRevisionTime));
  658. }
  659. }
  660. private string _description;
  661. public string Description
  662. {
  663. get => _description;
  664. set
  665. {
  666. _description = value;
  667. NotifyOfPropertyChange(nameof(Description));
  668. }
  669. }
  670. private string _recipePermission;
  671. public string RecipePermission
  672. {
  673. get { return this._recipePermission; }
  674. set
  675. {
  676. this._recipePermission = value;
  677. this.NotifyOfPropertyChange("RecipePermisson");
  678. }
  679. }
  680. private string _recipeLevel;
  681. public string RecipeLevel
  682. {
  683. get { return this._recipeLevel; }
  684. set
  685. {
  686. this._recipeLevel = value;
  687. this.NotifyOfPropertyChange("RecipeLevel");
  688. }
  689. }
  690. private string _processRecipe;
  691. public string ProcessRecipe
  692. {
  693. get => _processRecipe;
  694. set
  695. {
  696. _processRecipe = value;
  697. NotifyOfPropertyChange(nameof(ProcessRecipe));
  698. }
  699. }
  700. private string _layoutRecipe;
  701. public string LayoutRecipe
  702. {
  703. get => _layoutRecipe;
  704. set
  705. {
  706. _layoutRecipe = value;
  707. NotifyOfPropertyChange(nameof(LayoutRecipe));
  708. }
  709. }
  710. private string _coolTime;
  711. public string CoolTime
  712. {
  713. get => _coolTime;
  714. set
  715. {
  716. _coolTime = value;
  717. NotifyOfPropertyChange(nameof(CoolTime));
  718. }
  719. }
  720. private string _recipeChamberType;
  721. public string RecipeChamberType
  722. {
  723. get => _recipeChamberType;
  724. set
  725. {
  726. _recipeChamberType = value;
  727. NotifyOfPropertyChange(nameof(RecipeChamberType));
  728. }
  729. }
  730. private string _recipeVersion;
  731. public string RecipeVersion
  732. {
  733. get => _recipeVersion;
  734. set
  735. {
  736. _recipeVersion = value;
  737. NotifyOfPropertyChange(nameof(RecipeVersion));
  738. }
  739. }
  740. private XmlDocument _doc;
  741. private string _module;
  742. private RecipeProvider _recipeProvider = new RecipeProvider();
  743. public RecipeDataJob()
  744. {
  745. _doc = new XmlDocument();
  746. }
  747. public void Clear()
  748. {
  749. CreateBy = "";
  750. CreateTime = "";
  751. LastReviseBy = "";
  752. LastRevisionTime = "";
  753. Description = "";
  754. RecipeChamberType = "";
  755. RecipeVersion = "";
  756. _module = "";
  757. }
  758. public void InitData(string prefixPath, string recipeName, string recipeContent, string module)
  759. {
  760. PrefixPath = prefixPath;
  761. Name = recipeName;
  762. _module = module;
  763. try
  764. {
  765. _doc = new XmlDocument();
  766. _doc.LoadXml(recipeContent);
  767. if (!LoadHeader(_doc.SelectSingleNode("Aitex/TableRecipeData")))
  768. return;
  769. XmlNode nodeModule;
  770. nodeModule = _doc.SelectSingleNode("Aitex/TableRecipeData");
  771. XmlElement stepNode = nodeModule as XmlElement;
  772. foreach (XmlAttribute att in stepNode.Attributes)
  773. {
  774. switch (att.Name)
  775. {
  776. case "CreatedBy":
  777. CreateBy = att.Value;
  778. break;
  779. case "CreationTime":
  780. CreateTime = att.Value;
  781. break;
  782. case "LastRevisedBy":
  783. LastReviseBy = att.Value;
  784. break;
  785. case "LastRevisionTime":
  786. LastRevisionTime = att.Value;
  787. break;
  788. case "Description":
  789. Description = att.Value;
  790. break;
  791. }
  792. }
  793. nodeModule = _doc.SelectSingleNode($"Aitex/TableRecipeData/Module[@Name='{module}']/Step");
  794. if (nodeModule == null)
  795. return;
  796. stepNode = nodeModule as XmlElement;
  797. foreach (XmlAttribute att in stepNode.Attributes)
  798. {
  799. switch (att.Name)
  800. {
  801. case "ProcessRecipe":
  802. ProcessRecipe = att.Value;
  803. break;
  804. case "LayoutRecipe":
  805. LayoutRecipe = att.Value;
  806. break;
  807. case "CoolTime":
  808. CoolTime = att.Value;
  809. break;
  810. }
  811. }
  812. }
  813. catch (Exception ex)
  814. {
  815. LOG.Write(ex);
  816. }
  817. }
  818. public string GetXmlString()
  819. {
  820. try
  821. {
  822. XmlElement nodeData = _doc.SelectSingleNode($"Aitex/TableRecipeData") as XmlElement;
  823. if (string.IsNullOrEmpty(LastReviseBy))
  824. nodeData.SetAttribute("LastRevisedBy", LastReviseBy);
  825. if (string.IsNullOrEmpty(LastRevisionTime))
  826. nodeData.SetAttribute("LastRevisionTime", LastRevisionTime);
  827. if (string.IsNullOrEmpty(Description))
  828. nodeData.SetAttribute("Description", Description);
  829. if (string.IsNullOrEmpty(RecipeChamberType))
  830. nodeData.SetAttribute("RecipeChamberType", RecipeChamberType);
  831. if (string.IsNullOrEmpty(RecipePermission))
  832. nodeData.SetAttribute("RecipePermission", RecipePermission);
  833. if (string.IsNullOrEmpty(RecipeLevel))
  834. nodeData.SetAttribute("RecipeLevel", RecipeLevel);
  835. XmlNode nodeModule = _doc.SelectSingleNode($"Aitex/TableRecipeData/Module[@Name='{_module}']");
  836. if (nodeModule == null)
  837. {
  838. nodeModule = _doc.CreateElement("Module");
  839. nodeData.AppendChild(nodeModule);
  840. }
  841. nodeModule.RemoveAll();
  842. (nodeModule as XmlElement).SetAttribute("Name", _module);
  843. XmlElement nodeStep = _doc.CreateElement("Step");
  844. nodeStep.SetAttribute("ProcessRecipe", ProcessRecipe);
  845. nodeStep.SetAttribute("LayoutRecipe", LayoutRecipe);
  846. nodeStep.SetAttribute("CoolTime", CoolTime);
  847. nodeModule.AppendChild(nodeStep);
  848. }
  849. catch (Exception ex)
  850. {
  851. LOG.Write(ex);
  852. return _doc.OuterXml;
  853. }
  854. return _doc.OuterXml;
  855. }
  856. private bool LoadHeader(XmlNode nodeHeader)
  857. {
  858. if (nodeHeader == null)
  859. return false;
  860. if (nodeHeader.Attributes["CreatedBy"] != null)
  861. CreateBy = nodeHeader.Attributes["CreatedBy"].Value;
  862. if (nodeHeader.Attributes["CreationTime"] != null)
  863. CreateTime = nodeHeader.Attributes["CreationTime"].Value;
  864. if (nodeHeader.Attributes["LastRevisedBy"] != null)
  865. LastReviseBy = nodeHeader.Attributes["LastRevisedBy"].Value;
  866. if (nodeHeader.Attributes["LastRevisionTime"] != null)
  867. LastRevisionTime = nodeHeader.Attributes["LastRevisionTime"].Value;
  868. if (nodeHeader.Attributes["Description"] != null)
  869. Description = nodeHeader.Attributes["Description"].Value;
  870. string chamberType = string.Empty;
  871. if (nodeHeader.Attributes["RecipeChamberType"] != null)
  872. chamberType = nodeHeader.Attributes["RecipeChamberType"].Value;
  873. if (!string.IsNullOrEmpty(chamberType) && chamberType != RecipeChamberType)
  874. {
  875. LOG.Write($"{chamberType} is not accordance with {RecipeChamberType}");
  876. return false;
  877. }
  878. return true;
  879. }
  880. }
  881. }