SequenceInfo.cs 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  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. AInAOut,
  17. BInBOut,
  18. }
  19. [Serializable]
  20. [DataContract]
  21. public class SequenceInfo
  22. {
  23. [DataMember]
  24. public List<SequenceStepInfo> Steps { get; set; }
  25. [DataMember]
  26. public string Name { get; set; }
  27. [DataMember]
  28. public string PreCleanRecipe { get; set; }
  29. [DataMember]
  30. public string WTWCleanRecipe { get; set; }
  31. [DataMember]
  32. public string PostCleanRecipe { get; set; }
  33. [DataMember]
  34. public List<ModuleName> PMs { get; set; }
  35. [DataMember]
  36. public string ThicknessType { get; set; }
  37. [DataMember]
  38. public Guid InnerId { get; set; }
  39. [DataMember]
  40. public SequenceLLInOutPath LLInOutPath { get; set; }
  41. public SequenceInfo(string name)
  42. {
  43. Name = name;
  44. InnerId = Guid.NewGuid();
  45. LLInOutPath = SequenceLLInOutPath.DInDOut;
  46. Steps = new List<SequenceStepInfo>();
  47. }
  48. public string GetRecipe(ModuleName pm)
  49. {
  50. if (!ModuleHelper.IsPm(pm))
  51. return string.Empty;
  52. string attr = $"{pm}Recipe";
  53. foreach (var step in Steps)
  54. {
  55. if(step.StepModules.Contains(pm))
  56. {
  57. return (string)step.StepParameter[attr];
  58. }
  59. }
  60. return string.Empty;
  61. }
  62. }
  63. public class SequenceInfoHelper
  64. {
  65. public static SequenceInfo GetInfo(string seqFile)
  66. {
  67. SequenceInfo info = new SequenceInfo(seqFile);
  68. info.PMs = new List<ModuleName>();
  69. string content = RecipeFileManager.Instance.GetSequenceAndTryAppendLL(seqFile, false);
  70. if (!string.IsNullOrEmpty(content))
  71. {
  72. try
  73. {
  74. XmlDocument dom = new XmlDocument();
  75. dom.LoadXml(content);
  76. XmlNodeList lstStepNode = dom.SelectNodes("Aitex/TableSequenceData/Step");
  77. if (lstStepNode == null)
  78. {
  79. //LOG.Error($"{seqFile} has no step");
  80. return null;
  81. }
  82. var nodeData = dom.SelectSingleNode("Aitex/TableSequenceData");
  83. if (nodeData != null)
  84. {
  85. var node = nodeData as XmlElement;
  86. info.ThicknessType = node.GetAttribute("ThicknessType");
  87. }
  88. foreach (var nodeModelChild in lstStepNode)
  89. {
  90. XmlElement nodeStep = nodeModelChild as XmlElement;
  91. SequenceStepInfo stepInfo = new SequenceStepInfo();
  92. foreach (XmlAttribute attr in nodeStep.Attributes)
  93. {
  94. stepInfo.StepParameter[attr.Name] = attr.Value;
  95. if (attr.Name == "Position" || attr.Name=="LLSelection" || attr.Name == "PMSelection")
  96. {
  97. if (attr.Value == "LL" || attr.Value=="PM")
  98. continue;
  99. string[] pos = attr.Value.Split(',');
  100. if (pos.Length < 1)
  101. {
  102. LOG.Write(eEvent.WARN_SEQUENCE, ModuleName.System, $"{seqFile} Position {attr.Value} can not be empty");
  103. return null;
  104. }
  105. foreach (var po in pos)
  106. {
  107. if (po.IsEmpty())
  108. continue;
  109. if(attr.Name == "PMSelection")
  110. {
  111. info.PMs.Add(ModuleHelper.Converter(po));
  112. }
  113. if (po == "Cooling" )
  114. {
  115. stepInfo.StepModules.AddIfNotContains(ModuleName.Cooling1);
  116. stepInfo.StepModules.AddIfNotContains(ModuleName.Cooling2);
  117. continue;
  118. }
  119. if (po == "Aligner")
  120. {
  121. stepInfo.StepModules.AddIfNotContains(ModuleName.Aligner1);
  122. stepInfo.StepModules.AddIfNotContains(ModuleName.Aligner2);
  123. continue;
  124. }
  125. ModuleName module = ModuleHelper.Converter(po);
  126. if (module == ModuleName.System)
  127. {
  128. //LOG.Error($"{seqFile} Position {po} not valid");
  129. return null;
  130. }
  131. stepInfo.StepModules.Add(module);
  132. }
  133. continue;
  134. }
  135. if (attr.Name == "AlignerAngle")
  136. {
  137. if (!double.TryParse(attr.Value, out double angle))
  138. {
  139. //LOG.Error($"{seqFile} AlignAngle {attr.Value} not valid");
  140. return null;
  141. }
  142. stepInfo.AlignAngle = angle;
  143. continue;
  144. }
  145. if(attr.Name == "PreClean")
  146. {
  147. info.PreCleanRecipe = attr.Value;
  148. }
  149. if(attr.Name == "WTWClean")
  150. {
  151. info.WTWCleanRecipe = attr.Value;
  152. }
  153. if(attr.Name == "PostClean")
  154. {
  155. info.PostCleanRecipe = attr.Value;
  156. }
  157. }
  158. info.Steps.Add(stepInfo);
  159. }
  160. // Loadlock Single In Single Out property check
  161. var llSteps = info.Steps.FindAll(item => item.StepModules.Contains(ModuleName.LLA) || item.StepModules.Contains(ModuleName.LLB));
  162. if ((llSteps.Count == 2) &&
  163. (llSteps[0].StepModules.Count == 1 && llSteps[1].StepModules.Count == 1))
  164. {
  165. if (llSteps[0].StepModules[0] != llSteps[1].StepModules[0])
  166. {
  167. info.LLInOutPath = llSteps[0].StepModules[0] == ModuleName.LLA ? SequenceLLInOutPath.AInBOut : SequenceLLInOutPath.BInAOut;
  168. }
  169. else
  170. {
  171. info.LLInOutPath = llSteps[0].StepModules[0] == ModuleName.LLA ? SequenceLLInOutPath.AInAOut : SequenceLLInOutPath.BInBOut;
  172. }
  173. }
  174. }
  175. catch (Exception ex)
  176. {
  177. LOG.WriteExeption(ex);
  178. return null;
  179. }
  180. }
  181. return info;
  182. }
  183. }
  184. }