123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Runtime.Serialization;
- using System.Xml;
- using Aitex.Core.RT.Log;
- using Aitex.Core.RT.RecipeCenter;
- using MECF.Framework.Common.Equipment;
- using SciChart.Core.Extensions;
- using Venus_Unity;
- namespace MECF.Framework.Common.Jobs
- {
- public enum JobRecipeType
- {
- PreLotClean,
- Process,
- WTWClean,
- PostLotClean
- }
- public enum SequenceLLInOutPath
- {
- AInBOut,
- BInAOut,
- DInDOut,
- AInAOut,
- BInBOut,
- }
- [Serializable]
- [DataContract]
- public class SequenceInfo
- {
- [DataMember]
- public List<SequenceStepInfo> Steps { get; set; }
- [DataMember]
- public string Name { get; set; }
- //[DataMember]
- //public string PreWaferCleanRecipe { get; set; }
- //[DataMember]
- //public string PostWaferCleanRecipe { get; set; }
- [DataMember]
- public string WTWCleanRecipe { get; set; }
- [DataMember]
- public List<ModuleName> PMs { get; set; }
- [DataMember]
- public string ThicknessType { get; set; }
- [DataMember]
- public Guid InnerId { get; set; }
- [DataMember]
- public SequenceLLInOutPath LLInOutPath { get; set; }
- [DataMember]
- public int LLDelayTime { get; set; }
- public SequenceInfo(string name)
- {
- Name = name;
- InnerId = Guid.NewGuid();
- LLInOutPath = SequenceLLInOutPath.DInDOut;
- LLDelayTime = 0;
- Steps = new List<SequenceStepInfo>();
- }
- public string GetRecipe(ModuleName pm)
- {
- if (!ModuleHelper.IsPm(pm))
- return string.Empty;
- string attr = $"{pm}Recipe";
- foreach (var step in Steps)
- {
- if (step.StepModules.Contains(pm))
- {
- return (string)step.StepParameter[attr];
- }
- }
- return string.Empty;
- }
- public string GetPreCleanRecipe(ModuleName pm)
- {
- if (!ModuleHelper.IsPm(pm))
- return string.Empty;
- string attr = $"{pm}PreLotClean";
- foreach (var step in Steps)
- {
- if (step.StepModules.Contains(pm) && step.StepParameter.ContainsKey(attr))
- {
- return (string)step.StepParameter[attr];
- }
- }
- return string.Empty;
- }
- public string GetWTWCleanRecipe(ModuleName pm)
- {
- if (!ModuleHelper.IsPm(pm))
- return string.Empty;
- string attr = $"{pm}WTWClean";
- foreach (var step in Steps)
- {
- if (step.StepModules.Contains(pm) && step.StepParameter.ContainsKey(attr))
- {
- return (string)step.StepParameter[attr];
- }
- }
- return string.Empty;
- }
- public string GetPostCleanRecipe(ModuleName pm)
- {
- if (!ModuleHelper.IsPm(pm))
- return string.Empty;
- string attr = $"{pm}PostLotClean";
- foreach (var step in Steps)
- {
- if (step.StepModules.Contains(pm) && step.StepParameter.ContainsKey(attr))
- {
- return (string)step.StepParameter[attr];
- }
- }
- return string.Empty;
- }
- // public string GetRecipe(ModuleName pm, JobRecipeType jobRecipeType)
- // {
- // if (!ModuleHelper.IsPm(pm))
- // return string.Empty;
- // string attr = $"{pm}Recipe";
- // foreach (var step in Steps)
- // {
- // if (step.StepModules.Contains(pm))
- // {
- // string recipeInfoString = (string)step.StepParameter[attr];
- // var recipeInfoDictionary= SerializeHelper.Instance.StringToDictionary(recipeInfoString);
- // if (recipeInfoDictionary.Keys.Contains(jobRecipeType.ToString()))
- // {
- // return recipeInfoDictionary[jobRecipeType.ToString()];
- // }
- // }
- // }
- // return string.Empty;
- // }
- //}
- }
- public class SequenceInfoHelper
- {
- public static SequenceInfo GetInfo(string seqFile)
- {
- SequenceInfo info = new SequenceInfo(seqFile);
- info.PMs = new List<ModuleName>();
- string content = RecipeFileManager.Instance.GetSequenceAndTryAppendLL(seqFile, false);
- if (!string.IsNullOrEmpty(content))
- {
- try
- {
- XmlDocument dom = new XmlDocument();
- dom.LoadXml(content);
- XmlNodeList lstStepNode = dom.SelectNodes("Aitex/TableSequenceData/Step");
- if (lstStepNode == null)
- {
- //LOG.Error($"{seqFile} has no step");
- return null;
- }
- var nodeData = dom.SelectSingleNode("Aitex/TableSequenceData");
- if (nodeData != null)
- {
- var node = nodeData as XmlElement;
- info.ThicknessType = node.GetAttribute("ThicknessType");
- }
- foreach (var nodeModelChild in lstStepNode)
- {
- XmlElement nodeStep = nodeModelChild as XmlElement;
- SequenceStepInfo stepInfo = new SequenceStepInfo();
- foreach (XmlAttribute attr in nodeStep.Attributes)
- {
- stepInfo.StepParameter[attr.Name] = attr.Value;
- if (attr.Name == "Position" || attr.Name == "LLSelection" || attr.Name == "PMSelection")
- {
- if (attr.Value == "LL" || attr.Value == "PM")
- continue;
- string[] pos = attr.Value.Split(',');
- if (pos.Length < 1)
- {
- LOG.Write(eEvent.WARN_SEQUENCE, ModuleName.System, $"{seqFile} Position {attr.Value} can not be empty");
- return null;
- }
- foreach (var po in pos)
- {
- if (po.IsEmpty())
- continue;
- if (attr.Name == "PMSelection")
- {
- info.PMs.Add(ModuleHelper.Converter(po));
- }
- if (po == "Cooling")
- {
- stepInfo.StepModules.AddIfNotContains(ModuleName.Cooling1);
- stepInfo.StepModules.AddIfNotContains(ModuleName.Cooling2);
- continue;
- }
- if (po == "Aligner")
- {
- stepInfo.StepModules.AddIfNotContains(ModuleName.Aligner1);
- stepInfo.StepModules.AddIfNotContains(ModuleName.Aligner2);
- continue;
- }
- ModuleName module = ModuleHelper.Converter(po);
- if (module == ModuleName.System)
- {
- //LOG.Error($"{seqFile} Position {po} not valid");
- return null;
- }
- stepInfo.StepModules.Add(module);
- }
- continue;
- }
- if (attr.Name == "PMARecipe")
- {
- }
- if (attr.Name == "WTWClean")
- {
- info.WTWCleanRecipe = attr.Value;
- }
- //if (attr.Name == "PreClean")
- //{
- // info.PreWaferCleanRecipe = attr.Value;
- //}
- //if (attr.Name == "PostClean")
- //{
- // info.PostWaferCleanRecipe = attr.Value;
- //}
- }
- info.Steps.Add(stepInfo);
- }
- // Loadlock Single In Single Out property check
- var llSteps = info.Steps.FindAll(item => item.StepModules.Contains(ModuleName.LLA) || item.StepModules.Contains(ModuleName.LLB));
- if (llSteps.Count == 2)
- {
- if (llSteps[0].StepModules.Count == 1 && llSteps[1].StepModules.Count == 1)
- {
- if (llSteps[0].StepModules[0] != llSteps[1].StepModules[0])
- {
- info.LLInOutPath = llSteps[0].StepModules[0] == ModuleName.LLA ? SequenceLLInOutPath.AInBOut : SequenceLLInOutPath.BInAOut;
- }
- else
- {
- info.LLInOutPath = llSteps[0].StepModules[0] == ModuleName.LLA ? SequenceLLInOutPath.AInAOut : SequenceLLInOutPath.BInBOut;
- }
- }
- if (llSteps[1].StepParameter.ContainsKey("LLDelayTime"))
- {
- if (int.TryParse((string)llSteps[1].StepParameter["LLDelayTime"], out int delay))
- {
- info.LLDelayTime = delay;
- }
- }
- }
- }
- catch (Exception ex)
- {
- LOG.WriteExeption(ex);
- return null;
- }
- return info;
- }
- else
- {
- return null;
- }
- }
- public static SequenceInfo KeplerGetInfo(string seqFile)
- {
- SequenceInfo info = new SequenceInfo(seqFile);
- info.PMs = new List<ModuleName>();
- string content = RecipeFileManager.Instance.GetSequenceAndTryAppendLL(seqFile, false);
- if (!string.IsNullOrEmpty(content))
- {
- try
- {
- XmlDocument dom = new XmlDocument();
- dom.LoadXml(content);
- XmlNodeList lstStepNode = dom.SelectNodes("Aitex/TableSequenceData/Step");
- if (lstStepNode == null)
- {
- //LOG.Error($"{seqFile} has no step");
- return null;
- }
- var nodeData = dom.SelectSingleNode("Aitex/TableSequenceData");
- if (nodeData != null)
- {
- var node = nodeData as XmlElement;
- info.ThicknessType = node.GetAttribute("ThicknessType");
- }
- foreach (var nodeModelChild in lstStepNode)
- {
- XmlElement nodeStep = nodeModelChild as XmlElement;
- SequenceStepInfo stepInfo = new SequenceStepInfo();
- foreach (XmlAttribute attr in nodeStep.Attributes)
- {
- if (attr.Name == "PMARecipe" || attr.Name == "PMBRecipe" || attr.Name == "PMCRecipe" || attr.Name == "PMDRecipe")
- {
- string module = attr.Name.Substring(0, 3);
- var dictionarys = SerializeHelper.Instance.StringToDictionary(attr.Value);
- foreach (var dictionary in dictionarys)
- {
- string key;
- if (dictionary.Key == "Process")
- {
- key = $"{module}Recipe";
- }
- else
- {
- key = $"{module}{dictionary.Key}";
- }
- stepInfo.StepParameter[key] = dictionary.Value;
- }
- }
- else
- {
- stepInfo.StepParameter[attr.Name] = attr.Value;
- }
- if (attr.Name == "Position" || attr.Name == "LLSelection" || attr.Name == "PMSelection")
- {
- if (attr.Value == "LL" || attr.Value == "PM")
- continue;
- string[] pos = attr.Value.Split(',');
- if (pos.Length < 1)
- {
- LOG.Write(eEvent.WARN_SEQUENCE, ModuleName.System, $"{seqFile} Position {attr.Value} can not be empty");
- return null;
- }
- foreach (var po in pos)
- {
- if (po.IsEmpty())
- continue;
- if (attr.Name == "PMSelection")
- {
- info.PMs.Add(ModuleHelper.Converter(po));
- }
- if (po == "Cooling")
- {
- stepInfo.StepModules.AddIfNotContains(ModuleName.Cooling1);
- stepInfo.StepModules.AddIfNotContains(ModuleName.Cooling2);
- continue;
- }
- if (po == "Aligner")
- {
- stepInfo.StepModules.AddIfNotContains(ModuleName.Aligner1);
- stepInfo.StepModules.AddIfNotContains(ModuleName.Aligner2);
- continue;
- }
- ModuleName module = ModuleHelper.Converter(po);
- if (module == ModuleName.System)
- {
- //LOG.Error($"{seqFile} Position {po} not valid");
- return null;
- }
- stepInfo.StepModules.Add(module);
- }
- continue;
- }
- //if (attr.Name == "PMARecipe")
- //{
- //}
- //if (attr.Name == "WTWClean")
- //{
- // info.WTWCleanRecipe = attr.Value;
- //}
- //if (attr.Name == "PreClean")
- //{
- // info.PreWaferCleanRecipe = attr.Value;
- //}
- //if (attr.Name == "PostClean")
- //{
- // info.PostWaferCleanRecipe = attr.Value;
- //}
- }
- info.Steps.Add(stepInfo);
- }
- // Loadlock Single In Single Out property check
- var llSteps = info.Steps.FindAll(item => item.StepModules.Contains(ModuleName.LLA) || item.StepModules.Contains(ModuleName.LLB));
- if (llSteps.Count == 2)
- {
- if (llSteps[0].StepModules.Count == 1 && llSteps[1].StepModules.Count == 1)
- {
- if (llSteps[0].StepModules[0] != llSteps[1].StepModules[0])
- {
- info.LLInOutPath = llSteps[0].StepModules[0] == ModuleName.LLA ? SequenceLLInOutPath.AInBOut : SequenceLLInOutPath.BInAOut;
- }
- else
- {
- info.LLInOutPath = llSteps[0].StepModules[0] == ModuleName.LLA ? SequenceLLInOutPath.AInAOut : SequenceLLInOutPath.BInBOut;
- }
- }
- if (llSteps[1].StepParameter.ContainsKey("LLDelayTime"))
- {
- if (int.TryParse((string)llSteps[1].StepParameter["LLDelayTime"], out int delay))
- {
- info.LLDelayTime = delay;
- }
- }
- }
- }
- catch (Exception ex)
- {
- LOG.WriteExeption(ex);
- return null;
- }
- return info;
- }
- else
- {
- return null;
- }
- }
- }
- }
|