SequenceInfo.cs 6.9 KB

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