SequenceInfo.cs 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  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. string content = RecipeFileManager.Instance.GetSequenceAndTryAppendLL(seqFile, false);
  69. if (!string.IsNullOrEmpty(content))
  70. {
  71. try
  72. {
  73. XmlDocument dom = new XmlDocument();
  74. dom.LoadXml(content);
  75. XmlNodeList lstStepNode = dom.SelectNodes("Aitex/TableSequenceData/Step");
  76. if (lstStepNode == null)
  77. {
  78. //LOG.Error($"{seqFile} has no step");
  79. return null;
  80. }
  81. var nodeData = dom.SelectSingleNode("Aitex/TableSequenceData");
  82. if (nodeData != null)
  83. {
  84. var node = nodeData as XmlElement;
  85. info.ThicknessType = node.GetAttribute("ThicknessType");
  86. }
  87. foreach (var nodeModelChild in lstStepNode)
  88. {
  89. XmlElement nodeStep = nodeModelChild as XmlElement;
  90. SequenceStepInfo stepInfo = new SequenceStepInfo();
  91. foreach (XmlAttribute attr in nodeStep.Attributes)
  92. {
  93. stepInfo.StepParameter[attr.Name] = attr.Value;
  94. if (attr.Name == "Position" || attr.Name=="LLSelection" || attr.Name == "PMSelection")
  95. {
  96. if (attr.Value == "LL" || attr.Value=="PM")
  97. continue;
  98. string[] pos = attr.Value.Split(',');
  99. if (pos.Length < 1)
  100. {
  101. LOG.Write(eEvent.WARN_SEQUENCE, ModuleName.System, $"{seqFile} Position {attr.Value} can not be empty");
  102. return null;
  103. }
  104. foreach (var po in pos)
  105. {
  106. if (po.IsEmpty())
  107. continue;
  108. if (po == "Cooling" )
  109. {
  110. stepInfo.StepModules.AddIfNotContains(ModuleName.Cooling1);
  111. stepInfo.StepModules.AddIfNotContains(ModuleName.Cooling2);
  112. continue;
  113. }
  114. if (po == "Aligner")
  115. {
  116. stepInfo.StepModules.AddIfNotContains(ModuleName.Aligner1);
  117. stepInfo.StepModules.AddIfNotContains(ModuleName.Aligner2);
  118. continue;
  119. }
  120. ModuleName module = ModuleHelper.Converter(po);
  121. if (module == ModuleName.System)
  122. {
  123. //LOG.Error($"{seqFile} Position {po} not valid");
  124. return null;
  125. }
  126. stepInfo.StepModules.Add(module);
  127. }
  128. continue;
  129. }
  130. if (attr.Name == "AlignerAngle")
  131. {
  132. if (!double.TryParse(attr.Value, out double angle))
  133. {
  134. //LOG.Error($"{seqFile} AlignAngle {attr.Value} not valid");
  135. return null;
  136. }
  137. stepInfo.AlignAngle = angle;
  138. continue;
  139. }
  140. if(attr.Name == "PreClean")
  141. {
  142. info.PreCleanRecipe = attr.Value;
  143. }
  144. if(attr.Name == "WTWClean")
  145. {
  146. info.WTWCleanRecipe = attr.Value;
  147. }
  148. if(attr.Name == "PostClean")
  149. {
  150. info.PostCleanRecipe = attr.Value;
  151. }
  152. }
  153. info.Steps.Add(stepInfo);
  154. }
  155. // Loadlock Single In Single Out property check
  156. var llSteps = info.Steps.FindAll(item => item.StepModules.Contains(ModuleName.LLA) || item.StepModules.Contains(ModuleName.LLB));
  157. if ((llSteps.Count == 2) &&
  158. (llSteps[0].StepModules.Count == 1 && llSteps[1].StepModules.Count == 1))
  159. {
  160. if (llSteps[0].StepModules[0] != llSteps[1].StepModules[0])
  161. {
  162. info.LLInOutPath = llSteps[0].StepModules[0] == ModuleName.LLA ? SequenceLLInOutPath.AInBOut : SequenceLLInOutPath.BInAOut;
  163. }
  164. else
  165. {
  166. info.LLInOutPath = llSteps[0].StepModules[0] == ModuleName.LLA ? SequenceLLInOutPath.AInAOut : SequenceLLInOutPath.BInBOut;
  167. }
  168. }
  169. }
  170. catch (Exception ex)
  171. {
  172. LOG.WriteExeption(ex);
  173. return null;
  174. }
  175. }
  176. return info;
  177. }
  178. }
  179. }