Utils.cs 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  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. sslot = "00";
  84. break;
  85. }
  86. return sslot;
  87. }
  88. public static string hand2string(Hand hand)
  89. {
  90. string st = "";
  91. if (SC.ContainsItem("Robot.BladeUpDownReverse") && SC.GetValue<bool>("Robot.BladeUpDownReverse"))
  92. {
  93. switch (hand)
  94. {
  95. case Hand.Blade1:
  96. st = "A"; //单手臂 下
  97. break;
  98. case Hand.Blade2:
  99. st = "B"; //4手臂 上
  100. break;
  101. case Hand.Both:
  102. st = "W";
  103. break;
  104. }
  105. }
  106. else
  107. {
  108. switch (hand)
  109. {
  110. case Hand.Blade1:
  111. st = "B"; //单手臂 下
  112. break;
  113. case Hand.Blade2:
  114. st = "A"; //4手臂 上
  115. break;
  116. case Hand.Both:
  117. st = "W";
  118. break;
  119. }
  120. }
  121. return st;
  122. }
  123. public static string NextMotion2String(Motion motion,Hand hand)
  124. {
  125. string st = "";
  126. switch (motion)
  127. {
  128. case Motion.Pick:
  129. st = string.Format("G{0}", hand2string(hand));
  130. break;
  131. case Motion.Place:
  132. st = string.Format("P{0}", hand2string(hand));
  133. break;
  134. case Motion.Exchange:
  135. st = string.Format("E{0}", hand2string(hand));
  136. break;
  137. default:
  138. st = "AL";
  139. break;
  140. }
  141. return st;
  142. }
  143. public static string Offset2String(int offset)
  144. {
  145. string st = "";
  146. if (offset >= 0)
  147. {
  148. st = string.Format("{0:D5}", offset);
  149. }
  150. else
  151. {
  152. st = string.Format("{0:D4}", offset);
  153. }
  154. return st;
  155. }
  156. }
  157. }