GotoTask.cs 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. using Aitex.Core.Common;
  2. using Aitex.Core.RT.Device;
  3. using Aitex.Core.RT.Event;
  4. using Aitex.Core.RT.SCCore;
  5. using Aitex.Sorter.Common;
  6. using Efem;
  7. using Efem.Protocol;
  8. using MECF.Framework.Common.Equipment;
  9. using MECF.Framework.Common.SubstrateTrackings;
  10. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadPorts;
  11. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadPorts.LoadPortBase;
  12. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robot;
  13. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robots;
  14. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robots.RobotBase;
  15. namespace EFEM.RT.Tasks
  16. {
  17. public class GotoTask : RobotImp, ITask
  18. {
  19. //public int spd1ForPick => SC.GetValue<int>("Robot.Robot.GotoReadyXSpeedForPick");
  20. //public int ZForPick => SC.GetValue<int>("Robot.Robot.GotoReadyZDistanceForPick");
  21. //public int falg1 => SC.GetValue<int>("Robot.Robot.GotoReadyCICheckWaferForPlace");
  22. //public int falg4 => SC.GetValue<int>("Robot.Robot.GotoReadyXCheckWaferForPlace");
  23. //public int spd1ForPlace=> SC.GetValue<int>("Robot.Robot.GotoReadyXSpeedForPlace");
  24. //public int spd2ForPlace=> SC.GetValue<int>("Robot.Robot.GotoReadyCISpeedForPlace");
  25. //public int ZForPlace => SC.GetValue<int>("Robot.Robot.GotoReadyZDistanceForPlace");
  26. public bool EnableGotoReady
  27. {
  28. get
  29. {
  30. if (SC.ContainsItem("Robot.Robot.EnableGotoReady"))
  31. return SC.GetValue<bool>("Robot.Robot.EnableGotoReady");
  32. return true;
  33. }
  34. }
  35. public GotoTask()
  36. {
  37. }
  38. public bool Execute(out string result, params string[] args)
  39. {
  40. string device = DeviceName.Robot;
  41. IServerModule entity = GetEntity(device);
  42. ModuleName target = ModuleName.System;
  43. int slot = 1;
  44. if (!ParseMoveTarget(args[0], out target, out slot))
  45. {
  46. result = PARAM_NG;
  47. return false;
  48. }
  49. Hand arm = Hand.Blade2;
  50. if (!ParseMoveArm(args[1], out arm))
  51. {
  52. result = PARAM_NG;
  53. return false;
  54. }
  55. var isPick = true;
  56. isPick = !WaferManager.Instance.CheckHasWafer(ModuleName.Robot, arm == Hand.Blade2 ?1:0);
  57. if (MultiWaferSize && false)
  58. {
  59. if (args.Length < 2)
  60. {
  61. result = PARAM_NG;
  62. return false;
  63. }
  64. if (isPick)
  65. {
  66. if (!CheckWaferSize(args[2], target, slot - 1))
  67. {
  68. result = PARAM_NG;
  69. return false;
  70. }
  71. }
  72. else
  73. {
  74. if (!CheckWaferSize(args[2], ModuleName.Robot, 0))
  75. {
  76. result = PARAM_NG;
  77. return false;
  78. }
  79. }
  80. //if (ModuleHelper.IsLoadPort(target))
  81. //{
  82. // OpenStageWithWaferSizeLoadPort lp = DEVICE.GetDevice<OpenStageWithWaferSizeLoadPort>(target.ToString());
  83. // if (slot == 1 && lp.WaferSize == WaferSize.WS3)
  84. // {
  85. // EV.PostWarningLog("EFEM", $"{target} is 3', slot 1 is disabled");
  86. // result = PARAM_NG;
  87. // return false;
  88. // }
  89. //}
  90. }
  91. if (!Check<NoReadyPolicy>(device, out result))
  92. {
  93. return false;
  94. }
  95. if (!Check<NoInitCompletedPolicy>(device, out result))
  96. {
  97. return false;
  98. }
  99. if (!Check<NoOriginCompletedPolicy>(device, out result))
  100. {
  101. return false;
  102. }
  103. if (!Check<VacPolicy>(device, out result))
  104. {
  105. return false;
  106. }
  107. if (!Check<EMSPolicy>(device, out result))
  108. {
  109. return false;
  110. }
  111. if (!Check<ErrorPolicy>(device, out result))
  112. {
  113. return false;
  114. }
  115. if (!Check<BusyPolicy>(device, out result))
  116. {
  117. return false;
  118. }
  119. if (!Check<HoldPolicy>(device, out result))
  120. {
  121. return false;
  122. }
  123. if (!Check<RemovePolicy>(device, out result))
  124. {
  125. return false;
  126. }
  127. if (!Check<MaintenancePolicy>(device, out result))
  128. {
  129. return false;
  130. }
  131. if (!Check<LinkPolicy>(device, out result))
  132. {
  133. return false;
  134. }
  135. if (!Check<PowerDownPolicy>(device, out result))
  136. {
  137. return false;
  138. }
  139. RobotBaseDevice _device = DEVICE.GetDevice<RobotBaseDevice>(device);
  140. if (ModuleHelper.IsLoadPort(target))
  141. {
  142. LoadPortBaseDevice lp = DEVICE.GetDevice<LoadPortBaseDevice>(target.ToString());
  143. if (!lp.IsEnableTransferWafer(out string reason))
  144. {
  145. EV.PostWarningLog("EFEM", $"Can not goto, {reason}");
  146. result = "NOPOS";
  147. return false;
  148. }
  149. }
  150. if(!EnableGotoReady) return true;
  151. object[] objs;
  152. if (isPick)
  153. {
  154. // objs = new object[] { arm, target, slot - 1, RobotPostionEnum.PickReady, spd1ForPick, ZForPick };
  155. objs = new object[] { arm, target, slot - 1, RobotPostionEnum.PickReady};
  156. } else
  157. {
  158. // objs = new object[] { arm, target, slot - 1, RobotPostionEnum.PlaceReady, falg1, falg4, spd1ForPlace, spd2ForPlace, ZForPlace };
  159. objs = new object[] { arm, target, slot - 1, RobotPostionEnum.PlaceReady };
  160. }
  161. _device.GoTo(objs);
  162. return true;
  163. }
  164. public bool? Monitor(out string result, params string[] args)
  165. {
  166. result = string.Empty;
  167. RobotBaseDevice _device = DEVICE.GetDevice<RobotBaseDevice>(DeviceName.Robot);
  168. if (_device.IsError)
  169. {
  170. flag1 = ErrorCheckList1.VAC | ErrorCheckList1.AIR | ErrorCheckList1.STALL
  171. | ErrorCheckList1.LIMIT | ErrorCheckList1.SENSOR | ErrorCheckList1.POSITION | ErrorCheckList1.EMS
  172. | ErrorCheckList1.COMM | ErrorCheckList1.COMM2 | ErrorCheckList1.VACON | ErrorCheckList1.VACOFF
  173. | ErrorCheckList1.CLAMPON | ErrorCheckList1.CLAMPOF;
  174. flag2 = ErrorCheckList2.RRTWAF | ErrorCheckList2.CRSWAF | ErrorCheckList2.THICKWAF | ErrorCheckList2.THINWAF
  175. | ErrorCheckList2.DBLWAF | ErrorCheckList2.BAOWAF | ErrorCheckList2.COMMAND | ErrorCheckList2.PODNG
  176. | ErrorCheckList2.PODMISMATCH | ErrorCheckList2.VAC_S | ErrorCheckList2.CLAMP_S | ErrorCheckList2.SAFTY
  177. | ErrorCheckList2.LOCKNG | ErrorCheckList2.UNLOCKNG | ErrorCheckList2.L_KEY_LK | ErrorCheckList2.L_KEY_UL;
  178. flag3 = ErrorCheckList3.MAP_S | ErrorCheckList3.MAP_S1 | ErrorCheckList3.MAP_S2 | ErrorCheckList3.WAFLOST
  179. | ErrorCheckList3.ALIGNNG
  180. | ErrorCheckList3.DRIVER | ErrorCheckList3.DRPOWERDOWN | ErrorCheckList3.HARDWARE
  181. | ErrorCheckList3.INTERNAL | ErrorCheckList3.E84_TIMEOUTx | ErrorCheckList3.E84_CS_VALID | ErrorCheckList3.READFAIL;
  182. return CheckError(DeviceName.Robot, out result);
  183. }
  184. if (_device.IsReady())
  185. return true;
  186. return null;
  187. }
  188. }
  189. }