OpenTask.cs 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. using Aitex.Core.RT.Device;
  2. using Aitex.Core.Util;
  3. using Aitex.Sorter.Common;
  4. using Efem;
  5. using MECF.Framework.Common.Equipment;
  6. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadPorts;
  7. using System.Threading;
  8. using Efem.Protocol;
  9. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robot;
  10. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadPorts.LoadPortBase;
  11. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robots.RobotBase;
  12. using Aitex.Core.RT.SCCore;
  13. namespace EFEM.RT.Tasks
  14. {
  15. public class OpenTask : CheckImp, ITask
  16. {
  17. public OpenTask()
  18. {
  19. }
  20. public bool Execute(out string result, params string[] args)
  21. {
  22. string device = Args2Unit(args.Length > 0 ? args[0] : string.Empty);
  23. SystemServerModule entity = (SystemServerModule)GetEntity(DeviceName.System);
  24. if (entity == null)
  25. {
  26. result = PARAM_NG;
  27. return false;
  28. }
  29. if (!Check<NoReadyPolicy>(device, out result))
  30. {
  31. return false;
  32. }
  33. if (!Check<NoInitCompletedPolicy>(device, out result))
  34. {
  35. return false;
  36. }
  37. if (!Check<NoOriginCompletedPolicy>(device, out result))
  38. {
  39. return false;
  40. }
  41. if (!Check<VacPolicy>(device, out result))
  42. {
  43. return false;
  44. }
  45. if (!Check<AirPolicy>(device, out result))
  46. {
  47. return false;
  48. }
  49. if (!Check<EMSPolicy>(device, out result))
  50. {
  51. return false;
  52. }
  53. if (!Check<ErrorPolicy>(device, out result))
  54. {
  55. return false;
  56. }
  57. var LPRobotActionIntervene = SC.GetValue<bool>("System.LPRobotActionIntervene");
  58. if (LPRobotActionIntervene)
  59. {
  60. if (!Check<BusyPolicy>(device, out result))
  61. {
  62. return false;
  63. }
  64. }
  65. if (DeviceDefineManager.Instance.GetValue<bool>("WAFSHEnable") == false && LPRobotActionIntervene && !Check<BusyPolicy>(DeviceName.Robot, out result))
  66. {
  67. return false;
  68. }
  69. if (!Check<HoldPolicy>(device, out result))
  70. {
  71. return false;
  72. }
  73. if (!Check<RemovePolicy>(device, out result))
  74. {
  75. return false;
  76. }
  77. if (!Check<MaintenancePolicy>(device, out result))
  78. {
  79. return false;
  80. }
  81. if (!Check<LinkPolicy>(device, out result))
  82. {
  83. return false;
  84. }
  85. if (DeviceDefineManager.Instance.GetValue<bool>("WAFSHEnable") == false && !Check<ArmExtendPolicy>(device, out result))
  86. {
  87. return false;
  88. }
  89. if (!Check<PowerDownPolicy>(device, out result))
  90. {
  91. return false;
  92. }
  93. if (!Check<NoPosPolicy>(device, out result))
  94. {
  95. return false;
  96. }
  97. if (!Check<NoPodPolicy>(device, out result))
  98. {
  99. return false;
  100. }
  101. if (Check<ClosePolicy>(device, out result))
  102. {
  103. return false;
  104. }
  105. //if (DeviceDefineManager.Instance.GetValue<bool>("WAFSHEnable")==false)
  106. //{
  107. // result = "This device doesn't support mapping.";
  108. // return false;
  109. //}
  110. if (!DEVICE.GetDevice<LoadPortBaseDevice>(device).IsMapWaferByLoadPort && DeviceDefineManager.Instance.GetValue<bool>("WAFSHEnable") == false)
  111. {
  112. if (!entity.MapWafer(device, out result))
  113. {
  114. return false;
  115. }
  116. }
  117. else
  118. {
  119. LoadPortServerModule lpEntity = (LoadPortServerModule)GetEntity(device);
  120. if (lpEntity == null)
  121. {
  122. result = PARAM_NG;
  123. return false;
  124. }
  125. //if (!lpEntity.QueryWaferMap(out result))
  126. if (!lpEntity.Open(out result))
  127. {
  128. return false;
  129. }
  130. }
  131. return true;
  132. }
  133. public bool? Monitor(out string result, params string[] args)
  134. {
  135. result = string.Empty;
  136. string device = Args2Unit(args.Length > 0 ? args[0] : string.Empty);
  137. LoadPortBaseDevice _loadport = DEVICE.GetDevice<LoadPortBaseDevice>(device);
  138. RobotBaseDevice _robot = DEVICE.GetDevice<RobotBaseDevice>(DeviceName.Robot);
  139. if (_loadport.CurrentState == LoadPortStateEnum.Error && _loadport.MapError)
  140. {
  141. result = "Slot Map Error";
  142. return false;
  143. }
  144. if (_loadport.IsError || _robot.IsError)
  145. {
  146. flag1 = ErrorCheckList1.VAC | ErrorCheckList1.AIR | ErrorCheckList1.STALL
  147. | ErrorCheckList1.LIMIT | ErrorCheckList1.SENSOR | ErrorCheckList1.POSITION | ErrorCheckList1.EMS
  148. | ErrorCheckList1.COMM | ErrorCheckList1.COMM2 | ErrorCheckList1.VACON | ErrorCheckList1.VACOFF
  149. | ErrorCheckList1.CLAMPON | ErrorCheckList1.CLAMPOF;
  150. flag2 = ErrorCheckList2.RRTWAF | ErrorCheckList2.CRSWAF | ErrorCheckList2.THICKWAF | ErrorCheckList2.THINWAF
  151. | ErrorCheckList2.DBLWAF | ErrorCheckList2.BAOWAF | ErrorCheckList2.COMMAND | ErrorCheckList2.PODNG
  152. | ErrorCheckList2.PODMISMATCH | ErrorCheckList2.VAC_S | ErrorCheckList2.CLAMP_S | ErrorCheckList2.SAFTY
  153. | ErrorCheckList2.LOCKNG | ErrorCheckList2.UNLOCKNG | ErrorCheckList2.L_KEY_LK | ErrorCheckList2.L_KEY_UL;
  154. flag3 = ErrorCheckList3.MAP_S | ErrorCheckList3.MAP_S1 | ErrorCheckList3.MAP_S2 | ErrorCheckList3.WAFLOST
  155. | ErrorCheckList3.ALIGNNG
  156. | ErrorCheckList3.DRIVER | ErrorCheckList3.DRPOWERDOWN | ErrorCheckList3.HARDWARE
  157. | ErrorCheckList3.INTERNAL | ErrorCheckList3.E84_TIMEOUTx | ErrorCheckList3.E84_CS_VALID | ErrorCheckList3.READFAIL;
  158. return CheckError(device, out result);
  159. }
  160. SystemServerModule entity = (SystemServerModule)GetEntity(DeviceName.System);
  161. if (_loadport.IsReady() && _loadport.IsMapped&& !entity.Busy && _loadport.DockState== FoupDockState.Docked)
  162. {
  163. Singleton<EfemEntity>.Instance.SendMapEvent(_loadport);
  164. //if (_loadport.MapError)
  165. // _loadport.OnError("MappingError");
  166. return true;
  167. }
  168. return null;
  169. }
  170. public bool Ack(EfemCommandType type, EfemCommand cmd, params string[] args)
  171. {
  172. return cmd == EfemCommand.WAFSH;
  173. }
  174. }
  175. }