TransferTask.cs 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. using Aitex.Core.RT.Device;
  2. using Aitex.Core.RT.Routine;
  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 TransferTask : RobotImp, ITask
  12. {
  13. public TransferTask()
  14. {
  15. }
  16. public bool Execute(out string result, params string[] args)
  17. {
  18. string device = DeviceName.Robot;
  19. IServerModule entity = GetEntity(device);
  20. ModuleName source = ModuleName.System;
  21. int sourceSlot = 1;
  22. if (!ParseMoveTarget(args[0], out source, out sourceSlot))
  23. {
  24. result = PARAM_NG;
  25. return false;
  26. }
  27. Hand placearm = Hand.Blade2;
  28. if (!ParseMoveArm(args[1], out placearm))
  29. {
  30. result = PARAM_NG;
  31. return false;
  32. }
  33. Hand pickarm = Hand.Blade2;
  34. if (!ParseMoveArm(args[2], out pickarm))
  35. {
  36. result = PARAM_NG;
  37. return false;
  38. }
  39. ModuleName destination = ModuleName.System;
  40. int destinationSlot = 1;
  41. if (!ParseMoveTarget(args[3], out destination, out destinationSlot))
  42. {
  43. result = PARAM_NG;
  44. return false;
  45. }
  46. if (!Check<NoReadyPolicy>(device, out result))
  47. {
  48. return false;
  49. }
  50. if (!Check<NoInitCompletedPolicy>(device, out result))
  51. {
  52. return false;
  53. }
  54. if (!Check<NoOriginCompletedPolicy>(device, out result))
  55. {
  56. return false;
  57. }
  58. if (!Check<VacPolicy>(device, out result))
  59. {
  60. return false;
  61. }
  62. if (!Check<EMSPolicy>(device, out result))
  63. {
  64. return false;
  65. }
  66. if (!Check<ErrorPolicy>(device, out result))
  67. {
  68. return false;
  69. }
  70. if (ModuleHelper.IsLoadPort(source))
  71. {
  72. if (!Check<NoWaferMappingCompletedPolicy>(source.ToString(), out result))
  73. {
  74. return false;
  75. }
  76. }
  77. if (ModuleHelper.IsLoadPort(destination))
  78. {
  79. if (!Check<NoWaferMappingCompletedPolicy>(destination.ToString(), out result))
  80. {
  81. return false;
  82. }
  83. }
  84. if (!ModuleHelper.IsLoadLock(destination) && !Singleton<WaferManager>.Instance.CheckNoWafer(destination,destinationSlot - 1))
  85. {
  86. result = "WAFER";
  87. return false;
  88. }
  89. if (!ModuleHelper.IsLoadLock(source) && !Singleton<WaferManager>.Instance.CheckHasWafer(source,sourceSlot - 1))
  90. {
  91. result = "NONWAF";
  92. return false;
  93. }
  94. if (!Check<BusyPolicy>(device, out result))
  95. {
  96. return false;
  97. }
  98. if (!Check<HoldPolicy>(device, out result))
  99. {
  100. return false;
  101. }
  102. if (!Check<RemovePolicy>(device, out result))
  103. {
  104. return false;
  105. }
  106. if (!Check<MaintenancePolicy>(device, out result))
  107. {
  108. return false;
  109. }
  110. if (!Check<LinkPolicy>(device, out result))
  111. {
  112. return false;
  113. }
  114. if (!Check<PowerDownPolicy>(device, out result))
  115. {
  116. return false;
  117. }
  118. if (!Check<NoWaferMappingCompletedPolicy>(source.ToString(), out result) || !Check<NoWaferMappingCompletedPolicy>(destination.ToString(), out result))
  119. {
  120. return false;
  121. }
  122. if (!Check<NoPodPolicy>(source.ToString(), out result) || !Check<NoPodPolicy>(destination.ToString(), out result))
  123. {
  124. return false;
  125. }
  126. if (!Check<ClosePolicy>(source.ToString(), out result) || !Check<ClosePolicy>(destination.ToString(), out result))
  127. {
  128. return false;
  129. }
  130. //MoveType type = MoveType.Move;
  131. //MoveOption option = MoveOption)args[1];
  132. //Hand blade = (Hand)args[2];
  133. //ModuleName schamber1 = (ModuleName)args[3];
  134. //int sslot1 = (int)args[4];
  135. //ModuleName dchamber1 = (ModuleName)args[5];
  136. //int dslot1 = (int)args[6];
  137. //ModuleName schamber2 = (ModuleName)args[3];
  138. //int sslot2 = (int)args[4];
  139. //ModuleName dchamber2 = (ModuleName)args[5];
  140. //int dslot2 = (int)args[6];
  141. //if (type != MoveType.Move)
  142. //{
  143. // schamber2 = (ModuleName)args[7];
  144. // sslot2 = (int)args[8];
  145. // dchamber2 = (ModuleName)args[9];
  146. // dslot2 = (int)args[10];
  147. //}
  148. object[] parameters = new object[10];
  149. parameters[0] = MoveType.Move;
  150. parameters[1] = MoveOption.None;
  151. parameters[2] = pickarm;
  152. parameters[3] = source;
  153. parameters[4] = sourceSlot - 1;
  154. parameters[5] = destination;
  155. parameters[6] = destinationSlot - 1;
  156. Singleton<EfemEntity>.Instance.EfemDevice.InvokeMoveWafer("MoveWafer", parameters);
  157. return true;
  158. }
  159. public bool? Monitor(out string result, params string[] args)
  160. {
  161. result = string.Empty;
  162. if (Singleton<EfemEntity>.Instance.EfemDevice.IsError)
  163. {
  164. result = "ERROR";
  165. return false;
  166. }
  167. if (Singleton<EfemEntity>.Instance.EfemDevice.IsIdle &&
  168. Singleton<EfemEntity>.Instance.EfemDevice.CheckAcked(_token))
  169. {
  170. return true;
  171. }
  172. return null;
  173. }
  174. }
  175. }