123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- 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;
- namespace MECF.Framework.Common.Jobs
- {
- [Serializable]
- [DataContract]
- public class SequenceInfo
- {
- [DataMember]
- public List<SequenceStepInfo> Steps { get; set; }
- [DataMember]
- public string Name { get; set; }
- [DataMember]
- public Guid InnerId { get; set; }
-
- public SequenceInfo(string name)
- {
- Name = name;
- InnerId = Guid.NewGuid();
- Steps = new List<SequenceStepInfo>();
- }
- }
- public class SequenceInfoHelper
- {
- public static SequenceInfo GetInfo(string seqFile)
- {
- SequenceInfo info = new SequenceInfo(seqFile);
- string content = RecipeFileManager.Instance.GetSequence(seqFile, false, 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;
- }
- foreach (var nodeModelChild in lstStepNode)
- {
- XmlElement nodeStep = nodeModelChild as XmlElement;
- SequenceStepInfo stepInfo = new SequenceStepInfo();
- foreach (XmlAttribute attr in nodeStep.Attributes)
- {
- if (attr.Name == "Position" || attr.Name=="LLSelection" || attr.Name == "PMSelection" || attr.Name == "PMSelection25")
- {
- if (attr.Value == "LL" || attr.Value=="PM")
- continue;
- if (!Enum.TryParse(attr.Value, out ModuleName _))
- continue;
- string[] pos = attr.Value.Split(',');
- if (pos.Length < 1)
- {
- LOG.Error($"{seqFile} Position {attr.Value} can not be empty");
- return null;
- }
- foreach (var po in pos)
- {
- 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 == "Recipe") || (attr.Name == "ProcessRecipe"))
- {
- stepInfo.RecipeName = attr.Value;
- continue;
- }
- stepInfo.StepParameter[attr.Name] = attr.Value;
- }
- info.Steps.Add(stepInfo);
- }
- }
- catch (Exception ex)
- {
- LOG.Write(ex);
- return null;
- }
- }
- return info;
- }
- }
- }
|