| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221 | using System;using System.Collections.Generic;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;namespace MECF.Framework.Common.Jobs{    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 PreCleanRecipe { get; set; }        [DataMember]        public string WTWCleanRecipe { get; set; }        [DataMember]        public string PostCleanRecipe { 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; }         public SequenceInfo(string name)        {            Name = name;            InnerId = Guid.NewGuid();            LLInOutPath =  SequenceLLInOutPath.DInDOut;            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 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 == "AlignerAngle")                            {                                if (!double.TryParse(attr.Value, out double angle))                                {                                    //LOG.Error($"{seqFile} AlignAngle {attr.Value} not valid");                                    return null;                                }                                stepInfo.AlignAngle = angle;                                continue;                            }                            if(attr.Name == "PreClean")                            {                                info.PreCleanRecipe = attr.Value;                            }                            if(attr.Name == "WTWClean")                            {                                info.WTWCleanRecipe = attr.Value;                            }                            if(attr.Name == "PostClean")                            {                                info.PostCleanRecipe = 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) &&                         (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;                        }                    }                }                catch (Exception ex)                {                    LOG.WriteExeption(ex);                    return null;                }            }            return info;        }    }}
 |