Utils.cs 5.7 KB

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