TransferTask.cs 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  1. using Aitex.Core.Common;
  2. using Aitex.Core.RT.Device;
  3. using Aitex.Core.RT.Event;
  4. using Aitex.Core.RT.Routine;
  5. using Aitex.Core.RT.SCCore;
  6. using Aitex.Core.Util;
  7. using EFEM.RT.Modules;
  8. using Aitex.Sorter.Common;
  9. using Efem;
  10. using MECF.Framework.Common.Equipment;
  11. using MECF.Framework.Common.SubstrateTrackings;
  12. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadPorts;
  13. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robot;
  14. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robots.RobotBase;
  15. namespace EFEM.RT.Tasks
  16. {
  17. public class TransferTask : RobotImp, ITask
  18. {
  19. public TransferTask()
  20. {
  21. }
  22. public bool Execute(out string result, params string[] args)
  23. {
  24. string device = DeviceName.Robot;
  25. IServerModule entity = GetEntity(device);
  26. ModuleName source = ModuleName.System;
  27. int sourceSlot = 1;
  28. if (!ParseMoveTarget(args[0], out source, out sourceSlot))
  29. {
  30. result = PARAM_NG;
  31. return false;
  32. }
  33. Hand placearm = Hand.Blade2;
  34. if (!ParseMoveArm(args[1], out placearm))
  35. {
  36. result = PARAM_NG;
  37. return false;
  38. }
  39. Hand pickarm = Hand.Blade2;
  40. if (!ParseMoveArm(args[2], out pickarm))
  41. {
  42. result = PARAM_NG;
  43. return false;
  44. }
  45. ModuleName destination = ModuleName.System;
  46. int destinationSlot = 1;
  47. if (!ParseMoveTarget(args[3], out destination, out destinationSlot))
  48. {
  49. result = PARAM_NG;
  50. return false;
  51. }
  52. if (ModuleHelper.IsLoadPort(destination))
  53. {
  54. OpenStageWithWaferSizeLoadPort lp = DEVICE.GetDevice<OpenStageWithWaferSizeLoadPort>(destination.ToString());
  55. if (destinationSlot == 1 && lp.WaferSize == WaferSize.WS3)
  56. {
  57. EV.PostWarningLog("EFEM", $"{destination} is 3', slot 1 is disabled");
  58. result = PARAM_NG;
  59. return false;
  60. }
  61. }
  62. if (ModuleHelper.IsLoadPort(source))
  63. {
  64. OpenStageWithWaferSizeLoadPort lp = DEVICE.GetDevice<OpenStageWithWaferSizeLoadPort>(source.ToString());
  65. if (sourceSlot == 1 && lp.WaferSize == WaferSize.WS3)
  66. {
  67. EV.PostWarningLog("EFEM", $"{source} is 3', slot 1 is disabled");
  68. result = PARAM_NG;
  69. return false;
  70. }
  71. }
  72. if (ModuleHelper.IsLoadLock(source) && !SC.GetValue<bool>("System.IsLoadLockEnableZMotion"))
  73. {
  74. EV.PostWarningLog("Server", $"not support LL z motion, can not TRANS {source}");
  75. result = PARAM_NG;
  76. return false;
  77. }
  78. if (ModuleHelper.IsLoadLock(destination) && !SC.GetValue<bool>("System.IsLoadLockEnableZMotion"))
  79. {
  80. EV.PostWarningLog("Server", $"not support LL z motion, can not TRANS {destination}");
  81. result = PARAM_NG;
  82. return false;
  83. }
  84. if (!Check<NoReadyPolicy>(device, out result))
  85. {
  86. return false;
  87. }
  88. if (!Check<NoInitCompletedPolicy>(device, out result))
  89. {
  90. return false;
  91. }
  92. if (!Check<NoOriginCompletedPolicy>(device, out result))
  93. {
  94. return false;
  95. }
  96. if (!Check<VacPolicy>(device, out result))
  97. {
  98. return false;
  99. }
  100. if (!Check<EMSPolicy>(device, out result))
  101. {
  102. return false;
  103. }
  104. if (!Check<ErrorPolicy>(device, out result))
  105. {
  106. return false;
  107. }
  108. if (ModuleHelper.IsLoadPort(source))
  109. {
  110. if (!Check<NoWaferMappingCompletedPolicy>(source.ToString(), out result))
  111. {
  112. return false;
  113. }
  114. }
  115. if (ModuleHelper.IsLoadPort(destination))
  116. {
  117. if (!Check<NoWaferMappingCompletedPolicy>(destination.ToString(), out result))
  118. {
  119. return false;
  120. }
  121. }
  122. if (!ModuleHelper.IsLoadLock(destination) && !Singleton<WaferManager>.Instance.CheckNoWafer(destination, destinationSlot - 1))
  123. {
  124. result = "WAFER";
  125. return false;
  126. }
  127. if (!ModuleHelper.IsLoadLock(source) && !Singleton<WaferManager>.Instance.CheckHasWafer(source, sourceSlot - 1))
  128. {
  129. result = "NONWAF";
  130. return false;
  131. }
  132. if (!Check<BusyPolicy>(device, out result))
  133. {
  134. return false;
  135. }
  136. if (!Check<HoldPolicy>(device, out result))
  137. {
  138. return false;
  139. }
  140. if (!Check<RemovePolicy>(device, out result))
  141. {
  142. return false;
  143. }
  144. if (!Check<MaintenancePolicy>(device, out result))
  145. {
  146. return false;
  147. }
  148. if (!Check<LinkPolicy>(device, out result))
  149. {
  150. return false;
  151. }
  152. if (!Check<PowerDownPolicy>(device, out result))
  153. {
  154. return false;
  155. }
  156. if (!Check<NoWaferMappingCompletedPolicy>(source.ToString(), out result) || !Check<NoWaferMappingCompletedPolicy>(destination.ToString(), out result))
  157. {
  158. return false;
  159. }
  160. if (!Check<NoPodPolicy>(source.ToString(), out result) || !Check<NoPodPolicy>(destination.ToString(), out result))
  161. {
  162. return false;
  163. }
  164. if (!Check<ClosePolicy>(source.ToString(), out result) || !Check<ClosePolicy>(destination.ToString(), out result))
  165. {
  166. return false;
  167. }
  168. //MoveType type = MoveType.Move;
  169. //MoveOption option = MoveOption)args[1];
  170. //Hand blade = (Hand)args[2];
  171. //ModuleName schamber1 = (ModuleName)args[3];
  172. //int sslot1 = (int)args[4];
  173. //ModuleName dchamber1 = (ModuleName)args[5];
  174. //int dslot1 = (int)args[6];
  175. //ModuleName schamber2 = (ModuleName)args[3];
  176. //int sslot2 = (int)args[4];
  177. //ModuleName dchamber2 = (ModuleName)args[5];
  178. //int dslot2 = (int)args[6];
  179. //if (type != MoveType.Move)
  180. //{
  181. // schamber2 = (ModuleName)args[7];
  182. // sslot2 = (int)args[8];
  183. // dchamber2 = (ModuleName)args[9];
  184. // dslot2 = (int)args[10];
  185. //}
  186. object[] parameters = new object[7];
  187. parameters[0] = MoveType.Move;
  188. parameters[1] = MoveOption.None;
  189. parameters[2] = pickarm;
  190. parameters[3] = source;
  191. parameters[4] = sourceSlot - 1;
  192. parameters[5] = destination;
  193. parameters[6] = destinationSlot - 1;
  194. Singleton<RouteManager>.Instance.InvokeMoveWafer("MoveWafer", parameters);
  195. return true;
  196. }
  197. public bool? Monitor(out string result, params string[] args)
  198. {
  199. result = string.Empty;
  200. RobotBaseDevice _device = DEVICE.GetDevice<RobotBaseDevice>(DeviceName.Robot);
  201. if (Singleton<RouteManager>.Instance.GetTaskState("MoveWafer") == Result.FAIL)
  202. {
  203. result = "MoveFailed";
  204. return false;
  205. }
  206. if (_device.IsError)
  207. {
  208. flag1 = ErrorCheckList1.VAC | ErrorCheckList1.AIR | ErrorCheckList1.STALL
  209. | ErrorCheckList1.LIMIT | ErrorCheckList1.SENSOR | ErrorCheckList1.POSITION | ErrorCheckList1.EMS
  210. | ErrorCheckList1.COMM | ErrorCheckList1.COMM2 | ErrorCheckList1.VACON | ErrorCheckList1.VACOFF
  211. | ErrorCheckList1.CLAMPON | ErrorCheckList1.CLAMPOF;
  212. flag2 = ErrorCheckList2.RRTWAF | ErrorCheckList2.CRSWAF | ErrorCheckList2.THICKWAF | ErrorCheckList2.THINWAF
  213. | ErrorCheckList2.DBLWAF | ErrorCheckList2.BAOWAF | ErrorCheckList2.COMMAND | ErrorCheckList2.PODNG
  214. | ErrorCheckList2.PODMISMATCH | ErrorCheckList2.VAC_S | ErrorCheckList2.CLAMP_S | ErrorCheckList2.SAFTY
  215. | ErrorCheckList2.LOCKNG | ErrorCheckList2.UNLOCKNG | ErrorCheckList2.L_KEY_LK | ErrorCheckList2.L_KEY_UL;
  216. flag3 = ErrorCheckList3.MAP_S | ErrorCheckList3.MAP_S1 | ErrorCheckList3.MAP_S2 | ErrorCheckList3.WAFLOST
  217. | ErrorCheckList3.ALIGNNG
  218. | ErrorCheckList3.DRIVER | ErrorCheckList3.DRPOWERDOWN | ErrorCheckList3.HARDWARE
  219. | ErrorCheckList3.INTERNAL | ErrorCheckList3.E84_TIMEOUTx | ErrorCheckList3.E84_CS_VALID | ErrorCheckList3.READFAIL;
  220. return CheckError(DeviceName.Robot, out result);
  221. }
  222. if (Singleton<RouteManager>.Instance.Running && !Singleton<RouteManager>.Instance.IsRunning)
  223. return true;
  224. return null;
  225. }
  226. }
  227. }