Utils.cs 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using Aitex.Core.RT.SCCore;
  6. using Aitex.Sorter.Common;
  7. using MECF.Framework.Common.Equipment;
  8. namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robot.NX100
  9. {
  10. public class ProtocolTag
  11. {
  12. public const string tag_end = "\r";
  13. public const string tag_cmd_start = "$";
  14. public const string cmd_token = ",";
  15. public const string resp_tag_normal = "$";
  16. public const string resp_tag_error = "?";
  17. public const string resp_tag_excute = "!";
  18. public const string resp_tag_event = ">";
  19. public const string resp_evt_error = "100";
  20. }
  21. public class RobotConvertor
  22. {
  23. public static string chamber2staion(ModuleName chamber)
  24. {
  25. string st = "";
  26. switch (chamber)
  27. {
  28. case ModuleName.LP1:
  29. st = "C1";
  30. break;
  31. case ModuleName.LP2:
  32. st = "C2";
  33. break;
  34. case ModuleName.LP3:
  35. st = "C3";
  36. break;
  37. case ModuleName.LP4:
  38. st = "C4";
  39. break;
  40. case ModuleName.LP5:
  41. st = "C5";
  42. break;
  43. case ModuleName.LP6:
  44. st = "C6";
  45. break;
  46. case ModuleName.LP7:
  47. st = "C7";
  48. break;
  49. case ModuleName.LP8:
  50. st = "C8";
  51. break;
  52. case ModuleName.LP9:
  53. st = "C9";
  54. break;
  55. case ModuleName.LP10:
  56. st = "CA";
  57. break;
  58. case ModuleName.Aligner:
  59. st = "P1";
  60. break;
  61. }
  62. return st;
  63. }
  64. public static string chamberSlot2Slot(ModuleName chamber, int slot)
  65. {
  66. string sslot = "";
  67. switch (chamber)
  68. {
  69. case ModuleName.LP1:
  70. case ModuleName.LP2:
  71. case ModuleName.LP3:
  72. case ModuleName.LP4:
  73. case ModuleName.LP5:
  74. case ModuleName.LP6:
  75. case ModuleName.LP7:
  76. case ModuleName.LP8:
  77. case ModuleName.LP9:
  78. case ModuleName.LP10:
  79. sslot = string.Format("{0:D2}", slot + 1);
  80. break;
  81. case ModuleName.Aligner:
  82. case ModuleName.Robot:
  83. case ModuleName.PMA:
  84. case ModuleName.PMB:
  85. case ModuleName.PMC:
  86. case ModuleName.PMD:
  87. case ModuleName.PME:
  88. case ModuleName.PMF:
  89. sslot = "00";
  90. break;
  91. }
  92. return sslot;
  93. }
  94. public static string hand2string(Hand hand)
  95. {
  96. string st = "";
  97. if (SC.ContainsItem("Robot.BladeUpDownReverse") && SC.GetValue<bool>("Robot.BladeUpDownReverse"))
  98. {
  99. switch (hand)
  100. {
  101. case Hand.Blade1:
  102. st = "A"; //单手臂 下
  103. break;
  104. case Hand.Blade2:
  105. st = "B"; //4手臂 上
  106. break;
  107. case Hand.Both:
  108. st = "W";
  109. break;
  110. }
  111. }
  112. else
  113. {
  114. switch (hand)
  115. {
  116. case Hand.Blade1:
  117. st = "B"; //单手臂 下
  118. break;
  119. case Hand.Blade2:
  120. st = "A"; //4手臂 上
  121. break;
  122. case Hand.Both:
  123. st = "W";
  124. break;
  125. }
  126. }
  127. return st;
  128. }
  129. public static string NextMotion2String(Motion motion,Hand hand)
  130. {
  131. string st = "";
  132. switch (motion)
  133. {
  134. case Motion.Pick:
  135. st = string.Format("G{0}", hand2string(hand));
  136. break;
  137. case Motion.Place:
  138. st = string.Format("P{0}", hand2string(hand));
  139. break;
  140. case Motion.Exchange:
  141. st = string.Format("E{0}", hand2string(hand));
  142. break;
  143. default:
  144. st = "AL";
  145. break;
  146. }
  147. return st;
  148. }
  149. public static string Offset2String(int offset)
  150. {
  151. string st = "";
  152. if (offset >= 0)
  153. {
  154. st = string.Format("{0:D5}", offset);
  155. }
  156. else
  157. {
  158. st = string.Format("{0:D4}", offset);
  159. }
  160. return st;
  161. }
  162. }
  163. }