PlaceTask.cs 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. using Aitex.Core.RT.Device;
  2. using Aitex.Core.RT.Log;
  3. using Aitex.Core.Util;
  4. using Aitex.Sorter.Common;
  5. using Aitex.Sorter.RT.EFEMs.Servers;
  6. using MECF.Framework.Common.Equipment;
  7. using MECF.Framework.Common.SubstrateTrackings;
  8. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robot;
  9. namespace Aitex.Sorter.RT.EFEMs.Tasks
  10. {
  11. public class PlaceTask : RobotImp, ITask
  12. {
  13. Hand _arm = Hand.Blade2;
  14. public PlaceTask()
  15. {
  16. }
  17. public bool Execute(out string result, params string[] args)
  18. {
  19. string device = DeviceName.Robot;
  20. IServerModule entity = GetEntity(device);
  21. ModuleName target = ModuleName.System;
  22. int slot = 1;
  23. if (!ParseMoveTarget(args[0], out target, out slot))
  24. {
  25. result = PARAM_NG;
  26. return false;
  27. }
  28. if (!ParseMoveArm(args[1], out _arm))
  29. {
  30. result = PARAM_NG;
  31. return false;
  32. }
  33. if (!Check<NoReadyPolicy>(device, out result))
  34. {
  35. return false;
  36. }
  37. if (!Check<NoInitCompletedPolicy>(device, out result))
  38. {
  39. return false;
  40. }
  41. if (!Check<NoOriginCompletedPolicy>(device, out result))
  42. {
  43. return false;
  44. }
  45. if (!Check<VacPolicy>(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. if (!Check<BusyPolicy>(device, out result))
  58. {
  59. LOG.Write($"PlaceTask {device} Busy");
  60. return false;
  61. }
  62. if (!Check<HoldPolicy>(device, out result))
  63. {
  64. return false;
  65. }
  66. if (!Check<RemovePolicy>(device, out result))
  67. {
  68. return false;
  69. }
  70. if (!Check<MaintenancePolicy>(device, out result))
  71. {
  72. return false;
  73. }
  74. if (!Check<LinkPolicy>(device, out result))
  75. {
  76. return false;
  77. }
  78. if (!Check<NoWaferMappingCompletedPolicy>(target.ToString(), out result))
  79. {
  80. return false;
  81. }
  82. if (!Check<NoPodPolicy>(target.ToString(), out result))
  83. {
  84. return false;
  85. }
  86. if (!Check<ClosePolicy>(target.ToString(), out result))
  87. {
  88. return false;
  89. }
  90. //do not check loadlock
  91. if (!ModuleHelper.IsLoadLock(target) && !Singleton<WaferManager>.Instance.CheckNoWafer(target,slot-1))
  92. {
  93. result = "WAFER";
  94. return false;
  95. }
  96. if (_arm == Hand.Blade1)
  97. {
  98. if (!Singleton<WaferManager>.Instance.CheckHasWafer(ModuleName.Robot,0))
  99. {
  100. result = "NONWAF";
  101. return false;
  102. }
  103. }
  104. else if (_arm == Hand.Blade2)
  105. {
  106. if (!Singleton<WaferManager>.Instance.CheckHasWafer(ModuleName.Robot,1))
  107. {
  108. result = "NONWAF";
  109. return false;
  110. }
  111. }
  112. else
  113. {
  114. if (!Singleton<WaferManager>.Instance.CheckHasWafer(ModuleName.Robot,0))
  115. {
  116. result = "NONWAF";
  117. return false;
  118. }
  119. if (!Singleton<WaferManager>.Instance.CheckHasWafer(ModuleName.Robot,1))
  120. {
  121. result = "NONWAF";
  122. return false;
  123. }
  124. }
  125. if (!Check<PowerDownPolicy>(device, out result))
  126. {
  127. return false;
  128. }
  129. if (Singleton<EfemEntity>.Instance.EfemDevice.IsError)
  130. {
  131. result = "ERROR";
  132. return false;
  133. }
  134. if (!Singleton<EfemEntity>.Instance.EfemDevice.IsIdle)
  135. {
  136. LOG.Write($"PlaceTask RouteManager is Busy");
  137. result = "BUSY";
  138. return false;
  139. }
  140. _token = Singleton<EfemEntity>.Instance.EfemDevice.Invoke("Place", target.ToString(), slot - 1, _arm);
  141. return true;
  142. }
  143. public bool? Monitor(out string result, params string[] args)
  144. {
  145. result = string.Empty;
  146. if (Singleton<EfemEntity>.Instance.EfemDevice.CheckIsError(ModuleName.Robot))
  147. {
  148. string param1 = "";
  149. if (_arm == Hand.Blade1)
  150. {
  151. if (Singleton<WaferManager>.Instance.CheckHasWafer(ModuleName.Robot, 0))
  152. {
  153. param1 = "WAFER";
  154. }
  155. else
  156. {
  157. param1 = "NONWAF";
  158. }
  159. }
  160. else if (_arm == Hand.Blade2)
  161. {
  162. if (Singleton<WaferManager>.Instance.CheckHasWafer(ModuleName.Robot, 1))
  163. {
  164. param1 = "WAFER";
  165. }
  166. else
  167. {
  168. param1 = "NONWAF";
  169. }
  170. }
  171. result = $"ERROR|{param1}";
  172. return false;
  173. }
  174. if (Singleton<EfemEntity>.Instance.EfemDevice.CheckIsIdle(ModuleName.Robot)
  175. && Singleton<EfemEntity>.Instance.EfemDevice.CheckIsIdle(ModuleName.System)
  176. && Singleton<EfemEntity>.Instance.EfemDevice.CheckAcked(_token))
  177. return true;
  178. return null;
  179. }
  180. }
  181. }