SequenceInfo.cs 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Runtime.Serialization;
  4. using System.Xml;
  5. using Aitex.Core.RT.Log;
  6. using Aitex.Core.RT.RecipeCenter;
  7. using MECF.Framework.Common.Equipment;
  8. using SciChart.Core.Extensions;
  9. namespace MECF.Framework.Common.Jobs
  10. {
  11. public enum SequenceLLInOutPath
  12. {
  13. AInBOut,
  14. BInAOut,
  15. DInDOut,
  16. }
  17. [Serializable]
  18. [DataContract]
  19. public class SequenceInfo
  20. {
  21. [DataMember]
  22. public List<SequenceStepInfo> Steps { get; set; }
  23. [DataMember]
  24. public string Name { get; set; }
  25. [DataMember]
  26. public string ThicknessType { get; set; }
  27. [DataMember]
  28. public Guid InnerId { get; set; }
  29. [DataMember]
  30. public SequenceLLInOutPath LLInOutPath { get; set; }
  31. public SequenceInfo(string name)
  32. {
  33. Name = name;
  34. InnerId = Guid.NewGuid();
  35. LLInOutPath = SequenceLLInOutPath.DInDOut;
  36. Steps = new List<SequenceStepInfo>();
  37. }
  38. }
  39. public class SequenceInfoHelper
  40. {
  41. public static SequenceInfo GetInfo(string seqFile)
  42. {
  43. SequenceInfo info = new SequenceInfo(seqFile);
  44. string content = RecipeFileManager.Instance.GetSequenceAndTryAppendLL(seqFile, false);
  45. if (!string.IsNullOrEmpty(content))
  46. {
  47. try
  48. {
  49. XmlDocument dom = new XmlDocument();
  50. dom.LoadXml(content);
  51. XmlNodeList lstStepNode = dom.SelectNodes("Aitex/TableSequenceData/Step");
  52. if (lstStepNode == null)
  53. {
  54. //LOG.Error($"{seqFile} has no step");
  55. return null;
  56. }
  57. var nodeData = dom.SelectSingleNode("Aitex/TableSequenceData");
  58. if (nodeData != null)
  59. {
  60. var node = nodeData as XmlElement;
  61. info.ThicknessType = node.GetAttribute("ThicknessType");
  62. }
  63. foreach (var nodeModelChild in lstStepNode)
  64. {
  65. XmlElement nodeStep = nodeModelChild as XmlElement;
  66. SequenceStepInfo stepInfo = new SequenceStepInfo();
  67. foreach (XmlAttribute attr in nodeStep.Attributes)
  68. {
  69. stepInfo.StepParameter[attr.Name] = attr.Value;
  70. if (attr.Name == "Position" || attr.Name=="LLSelection" || attr.Name == "PMSelection")
  71. {
  72. if (attr.Value == "LL" || attr.Value=="PM")
  73. continue;
  74. string[] pos = attr.Value.Split(',');
  75. if (pos.Length < 1)
  76. {
  77. LOG.Write(eEvent.WARN_SEQUENCE, ModuleName.System, $"{seqFile} Position {attr.Value} can not be empty");
  78. return null;
  79. }
  80. foreach (var po in pos)
  81. {
  82. if (po.IsEmpty())
  83. continue;
  84. if (po == "Cooling" )
  85. {
  86. stepInfo.StepModules.AddIfNotContains(ModuleName.Cooling1);
  87. stepInfo.StepModules.AddIfNotContains(ModuleName.Cooling2);
  88. continue;
  89. }
  90. if (po == "Aligner")
  91. {
  92. stepInfo.StepModules.AddIfNotContains(ModuleName.Aligner1);
  93. stepInfo.StepModules.AddIfNotContains(ModuleName.Aligner2);
  94. continue;
  95. }
  96. ModuleName module = ModuleHelper.Converter(po);
  97. if (module == ModuleName.System)
  98. {
  99. //LOG.Error($"{seqFile} Position {po} not valid");
  100. return null;
  101. }
  102. stepInfo.StepModules.Add(module);
  103. }
  104. continue;
  105. }
  106. if (attr.Name == "AlignerAngle")
  107. {
  108. if (!double.TryParse(attr.Value, out double angle))
  109. {
  110. //LOG.Error($"{seqFile} AlignAngle {attr.Value} not valid");
  111. return null;
  112. }
  113. stepInfo.AlignAngle = angle;
  114. continue;
  115. }
  116. }
  117. info.Steps.Add(stepInfo);
  118. }
  119. // Loadlock Single In Single Out property check
  120. var llSteps = info.Steps.FindAll(item => item.StepModules.Contains(ModuleName.LLA) || item.StepModules.Contains(ModuleName.LLB));
  121. if ((llSteps.Count == 2) &&
  122. (llSteps[0].StepModules.Count == 1 && llSteps[1].StepModules.Count == 1) &&
  123. (llSteps[0].StepModules[0] != llSteps[1].StepModules[0]))
  124. {
  125. info.LLInOutPath = llSteps[0].StepModules[0] == ModuleName.LLA ? SequenceLLInOutPath.AInBOut : SequenceLLInOutPath.BInAOut;
  126. }
  127. }
  128. catch (Exception ex)
  129. {
  130. LOG.WriteExeption(ex);
  131. return null;
  132. }
  133. }
  134. return info;
  135. }
  136. }
  137. }