MpntTask.cs 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. using Aitex.Core.RT.Device;
  2. using Aitex.Core.Util;
  3. using Aitex.Sorter.Common;
  4. using athosRT.Devices.EFEM.ABS;
  5. using athosRT.Modules;
  6. using athosRT.Modules.EFEMs.Tasks;
  7. using athosRT.tool;
  8. using MECF.Framework.Common.Equipment;
  9. using MECF.Framework.Common.SubstrateTrackings;
  10. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robots.RobotBase;
  11. using System;
  12. using System.Collections.Generic;
  13. using System.Linq;
  14. using System.Text;
  15. using System.Threading.Tasks;
  16. namespace athosRT.Devices.EFEM.Task
  17. {
  18. public class MpntTask : CheckImp, ITask
  19. {
  20. private bool ParseTaskEnum(string args, out MpntTaskEnum taskEnum)
  21. {
  22. taskEnum = MpntTaskEnum.ParamNg;
  23. string str = args;
  24. switch (str)
  25. {
  26. case "G1":
  27. taskEnum = MpntTaskEnum.G1;
  28. break;
  29. case "GB":
  30. taskEnum = MpntTaskEnum.GB;
  31. break;
  32. case "G4":
  33. taskEnum = MpntTaskEnum.G4;
  34. break;
  35. case "P1":
  36. taskEnum = MpntTaskEnum.P1;
  37. break;
  38. case "PB":
  39. taskEnum = MpntTaskEnum.PB;
  40. break;
  41. case "P4":
  42. taskEnum = MpntTaskEnum.P4;
  43. break;
  44. default:
  45. return false;
  46. }
  47. return true;
  48. }
  49. private bool IsGetCommand(MpntTaskEnum taskEnum) => taskEnum == MpntTaskEnum.G1 || taskEnum == MpntTaskEnum.GB || taskEnum == MpntTaskEnum.G4;
  50. public bool Execute(out string result, params string[] args)
  51. {
  52. string str = "Robot";
  53. this.GetEntity(str);
  54. ModuleName target = ModuleName.System;
  55. MpntTaskEnum taskEnum = MpntTaskEnum.ParamNg;
  56. int slot = 1;
  57. if (!this.ParseMoveTarget(args[0], out target, out slot))
  58. {
  59. result = "PARAM_NG";
  60. return false;
  61. }
  62. if (!this.ParseTaskEnum(args[1], out taskEnum))
  63. {
  64. result = "PARAM_NG";
  65. return false;
  66. }
  67. Hand arm = Hand.Blade2;
  68. if (!this.ParseMoveArm(args[2], out arm))
  69. {
  70. result = "PARAM_NG";
  71. return false;
  72. }
  73. if (!ModuleHelper.IsLoadLock(target))
  74. {
  75. result = "PARAM_NG";
  76. return false;
  77. }
  78. if (!this.Check<NoReadyPolicy>(str, out result) || !this.Check<NoInitCompletedPolicy>(str, out result) || !this.Check<NoOriginCompletedPolicy>(str, out result) || !this.Check<VacPolicy>(str, out result) || !this.Check<EMSPolicy>(str, out result) || !this.Check<ErrorPolicy>(str, out result))
  79. return false;
  80. if (!this.Check<BusyPolicy>(str, out result))
  81. {
  82. LogObject.Warning("MPNTTask " , str + " Busy");
  83. return false;
  84. }
  85. if (!this.Check<HoldPolicy>(str, out result) || !this.Check<RemovePolicy>(str, out result) || !this.Check<MaintenancePolicy>(str, out result) || !this.Check<LinkPolicy>(str, out result) || !this.Check<NoWaferMappingCompletedPolicy>(target.ToString(), out result) || !this.Check<NoPodPolicy>(target.ToString(), out result) || !this.Check<ClosePolicy>(target.ToString(), out result))
  86. return false;
  87. if (!ModuleHelper.IsLoadLock(target) && !Singleton<WaferManager>.Instance.CheckNoWafer(target, slot - 1))
  88. {
  89. result = "WAFER";
  90. return false;
  91. }
  92. if (!this.Check<PowerDownPolicy>(str, out result))
  93. return false;
  94. if (!Singleton<RouteManager1>.Instance.IsIdle)
  95. {
  96. LogObject.Warning("MpntTask", "MpntTask RouteManager is Busy");
  97. result = "BUSY";
  98. return false;
  99. }
  100. if (this.IsGetCommand(taskEnum))
  101. {
  102. if (taskEnum == MpntTaskEnum.GB)
  103. {
  104. switch (arm)
  105. {
  106. case Hand.Blade1:
  107. if (!Singleton<WaferManager>.Instance.CheckNoWafer(ModuleName.Robot, 0))
  108. {
  109. result = "WAFER";
  110. return false;
  111. }
  112. break;
  113. case Hand.Blade2:
  114. if (!Singleton<WaferManager>.Instance.CheckNoWafer(ModuleName.Robot, 1))
  115. {
  116. result = "WAFER";
  117. return false;
  118. }
  119. break;
  120. default:
  121. if (!Singleton<WaferManager>.Instance.CheckNoWafer(ModuleName.Robot, 0))
  122. {
  123. result = "WAFER";
  124. return false;
  125. }
  126. if (!Singleton<WaferManager>.Instance.CheckNoWafer(ModuleName.Robot, 1))
  127. {
  128. result = "WAFER";
  129. return false;
  130. }
  131. break;
  132. }
  133. }
  134. this._token = Singleton<RouteManager1>.Instance.Invoke("MPNTPick", new object[4]
  135. {
  136. (object) target.ToString(),
  137. (object) (slot - 1),
  138. (object) arm,
  139. (object) taskEnum
  140. });
  141. return true;
  142. }
  143. if (taskEnum == MpntTaskEnum.PB)
  144. {
  145. switch (arm)
  146. {
  147. case Hand.Blade1:
  148. if (!Singleton<WaferManager>.Instance.CheckHasWafer(ModuleName.Robot, 0))
  149. {
  150. result = "NONWAF";
  151. return false;
  152. }
  153. break;
  154. case Hand.Blade2:
  155. if (!Singleton<WaferManager>.Instance.CheckHasWafer(ModuleName.Robot, 1))
  156. {
  157. result = "NONWAF";
  158. return false;
  159. }
  160. break;
  161. default:
  162. if (!Singleton<WaferManager>.Instance.CheckHasWafer(ModuleName.Robot, 0))
  163. {
  164. result = "NONWAF";
  165. return false;
  166. }
  167. if (!Singleton<WaferManager>.Instance.CheckHasWafer(ModuleName.Robot, 1))
  168. {
  169. result = "NONWAF";
  170. return false;
  171. }
  172. break;
  173. }
  174. }
  175. this._token = Singleton<RouteManager1>.Instance.Invoke("MPNTPlace", new object[4]
  176. {
  177. (object) target.ToString(),
  178. (object) (slot - 1),
  179. (object) arm,
  180. (object) taskEnum
  181. });
  182. return true;
  183. }
  184. public bool? Monitor(out string result, params string[] args)
  185. {
  186. result = string.Empty;
  187. RobotBaseDevice device = DEVICE.GetDevice<RobotBaseDevice>("Robot");
  188. if (device.IsError)
  189. {
  190. this.flag1 = ErrorCheckList1.VAC | ErrorCheckList1.AIR | ErrorCheckList1.STALL | ErrorCheckList1.LIMIT | ErrorCheckList1.SENSOR | ErrorCheckList1.POSITION | ErrorCheckList1.EMS | ErrorCheckList1.COMM | ErrorCheckList1.COMM2 | ErrorCheckList1.VACON | ErrorCheckList1.VACOFF | ErrorCheckList1.CLAMPON | ErrorCheckList1.CLAMPOF;
  191. this.flag2 = ErrorCheckList2.RRTWAF | ErrorCheckList2.CRSWAF | ErrorCheckList2.THICKWAF | ErrorCheckList2.THINWAF | ErrorCheckList2.DBLWAF | ErrorCheckList2.BAOWAF | ErrorCheckList2.COMMAND | ErrorCheckList2.PODNG | ErrorCheckList2.PODMISMATCH | ErrorCheckList2.VAC_S | ErrorCheckList2.CLAMP_S | ErrorCheckList2.SAFTY | ErrorCheckList2.LOCKNG | ErrorCheckList2.UNLOCKNG | ErrorCheckList2.L_KEY_LK | ErrorCheckList2.L_KEY_UL;
  192. this.flag3 = ErrorCheckList3.MAP_S | ErrorCheckList3.MAP_S1 | ErrorCheckList3.MAP_S2 | ErrorCheckList3.WAFLOST | ErrorCheckList3.ALIGNNG | ErrorCheckList3.DRIVER | ErrorCheckList3.DRPOWERDOWN | ErrorCheckList3.HARDWARE | ErrorCheckList3.INTERNAL | ErrorCheckList3.E84_TIMEOUTx | ErrorCheckList3.E84_CS_VALID | ErrorCheckList3.READFAIL;
  193. return new bool?(this.CheckError("Robot", out result));
  194. }
  195. return Singleton<RouteManager1>.Instance.IsIdle && device.IsReady() && !device.IsBusy && Singleton<RouteManager1>.Instance.CheckAcked(this._token) ? new bool?(true) : new bool?();
  196. }
  197. }
  198. }