ReadWaferIDRecipe.cs 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. using Aitex.Core.RT.Log;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using System.Xml.Linq;
  8. namespace Aitex.Sorter.RT.Module.Recipe
  9. {
  10. public class ReadWaferIDRecipe
  11. {
  12. public bool IsPreAlign;
  13. public double PreAlignAngle;
  14. public bool IsReadLaserMarker1;
  15. public bool IsVerifyLaserMarker1;
  16. public bool IsVerifyChecksumLaserMarker1;
  17. public int LaserMarkerWaferReaderIndex1;
  18. public bool IsReadLaserMarker2;
  19. public bool IsVerifyLaserMarker2;
  20. public bool IsVerifyChecksumLaserMarker2;
  21. public int LaserMarkerWaferReaderIndex2;
  22. public List<string> OcrReaderJob1;
  23. public List<string> OcrReaderJob2;
  24. public bool IsPostAlign;
  25. public double PostAlignAngle;
  26. public bool IsTurnOver;
  27. public bool IsTurnOverBeforeAlign;
  28. public bool IsVerifyLaserMarkLength;
  29. public int LaserMarkLength;
  30. public bool IsVerifyLaserMarkSlotForNCD;
  31. public int SlotStartPositionForNCD;
  32. public bool IsVerifyWithHostDefine;
  33. public string RecipeName { get; set; }
  34. public ReadWaferIDRecipe(string content, string recipename)
  35. {
  36. try
  37. {
  38. RecipeName = recipename;
  39. var doc = XDocument.Parse(content);
  40. var node = doc.Root.Element("AitexSorterHostUsageRecipe");
  41. if (node == null)
  42. {
  43. LOG.Write(string.Format("recipe not valid"));
  44. return;
  45. }
  46. string value = node.Attribute("PreAlignAngle").Value;
  47. double doubleValue;
  48. double.TryParse(value, out doubleValue);
  49. PreAlignAngle = doubleValue;
  50. value = node.Attribute("IsReadLaserMarker1").Value;
  51. bool boolValue;
  52. bool.TryParse(value, out boolValue);
  53. IsReadLaserMarker1 = boolValue;
  54. if (node.Attribute("IsAlign") != null)
  55. {
  56. value = node.Attribute("IsAlign").Value;
  57. bool.TryParse(value, out boolValue);
  58. IsPreAlign = boolValue;
  59. }
  60. value = node.Attribute("IsVerifyLaserMarker1").Value;
  61. bool.TryParse(value, out boolValue);
  62. IsVerifyLaserMarker1 = boolValue;
  63. value = node.Attribute("IsVerifyChecksumLaserMarker1").Value;
  64. bool.TryParse(value, out boolValue);
  65. IsVerifyChecksumLaserMarker1 = boolValue;
  66. value = node.Attribute("LaserMarkerWaferReaderIndex1").Value;
  67. int intValue;
  68. int.TryParse(value, out intValue);
  69. LaserMarkerWaferReaderIndex1 = intValue;
  70. value = node.Attribute("IsReadLaserMarker2").Value;
  71. bool.TryParse(value, out boolValue);
  72. IsReadLaserMarker2 = boolValue;
  73. value = node.Attribute("IsVerifyLaserMarker2").Value;
  74. bool.TryParse(value, out boolValue);
  75. IsVerifyLaserMarker2 = boolValue;
  76. value = node.Attribute("IsVerifyChecksumLaserMarker2").Value;
  77. bool.TryParse(value, out boolValue);
  78. IsVerifyChecksumLaserMarker2 = boolValue;
  79. value = node.Attribute("LaserMarkerWaferReaderIndex2").Value;
  80. int.TryParse(value, out intValue);
  81. LaserMarkerWaferReaderIndex2 = intValue;
  82. value = node.Attribute("IsPostAlign").Value;
  83. bool.TryParse(value, out boolValue);
  84. IsPostAlign = boolValue;
  85. value = node.Attribute("IsTurnOver").Value;
  86. bool.TryParse(value, out boolValue);
  87. IsTurnOver = boolValue;
  88. PostAlignAngle = PreAlignAngle;
  89. if (node.Attribute("PostAlignAngle") != null)
  90. {
  91. value = node.Attribute("PostAlignAngle").Value;
  92. double.TryParse(value, out doubleValue);
  93. PostAlignAngle = doubleValue;
  94. }
  95. if (node.Attribute("IsTurnOverBeforeAlign") != null)
  96. {
  97. value = node.Attribute("IsTurnOverBeforeAlign").Value;
  98. bool.TryParse(value, out boolValue);
  99. IsTurnOverBeforeAlign = boolValue;
  100. }
  101. if (node.Attribute("IsVerifyLaserMarkLength") != null)
  102. {
  103. value = node.Attribute("IsVerifyLaserMarkLength").Value;
  104. bool.TryParse(value, out boolValue);
  105. IsVerifyLaserMarkLength = boolValue;
  106. }
  107. if (node.Attribute("IntVerifyLaserMarkerLength") != null)
  108. {
  109. value = node.Attribute("IntVerifyLaserMarkerLength").Value;
  110. int.TryParse(value, out intValue);
  111. LaserMarkLength = intValue;
  112. }
  113. if (node.Attribute("IsVerifySlotPositionInLaserMarker") != null)
  114. {
  115. value = node.Attribute("IsVerifySlotPositionInLaserMarker").Value;
  116. bool.TryParse(value, out boolValue);
  117. IsVerifyLaserMarkSlotForNCD = boolValue;
  118. }
  119. if (node.Attribute("IntVerifySlotPositionInLaserMark") != null)
  120. {
  121. value = node.Attribute("IntVerifySlotPositionInLaserMark").Value;
  122. int.TryParse(value, out intValue);
  123. SlotStartPositionForNCD = intValue;
  124. }
  125. if (node.Attribute("IsVerifyWithHostDefine") != null)
  126. {
  127. value = node.Attribute("IsVerifyWithHostDefine").Value;
  128. bool.TryParse(value, out boolValue);
  129. IsVerifyWithHostDefine = boolValue;
  130. }
  131. value = node.Attribute("OcrReaderJob1").Value;
  132. var arr = value.Split(new char[] { ';' }, System.StringSplitOptions.RemoveEmptyEntries);
  133. OcrReaderJob1 = arr.ToList();
  134. value = node.Attribute("OcrReaderJob2").Value;
  135. arr = value.Split(new char[] { ';' }, System.StringSplitOptions.RemoveEmptyEntries);
  136. OcrReaderJob2 = arr.ToList();
  137. }
  138. catch (Exception ex)
  139. {
  140. LOG.Write(ex);
  141. }
  142. }
  143. public ReadWaferIDRecipe()
  144. {
  145. RecipeName = "";
  146. }
  147. }
  148. }