QueryWaferMappingTask.cs 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using Aitex.Core.RT.Device;
  7. using Aitex.Core.Util;
  8. using EFEM.RT.Modules;
  9. using MECF.Framework.Common.Equipment;
  10. using MECF.Framework.Common.SubstrateTrackings;
  11. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.BufferStations;
  12. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadPorts;
  13. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadPorts.LoadPortBase;
  14. namespace EFEM.RT.Tasks
  15. {
  16. public class QueryWaferMappingTask : CheckImp, ITask
  17. {
  18. public QueryWaferMappingTask()
  19. {
  20. }
  21. public bool Execute(out string result, params string[] args)
  22. {
  23. string device = Args2Unit(args.Length > 0 ? args[0] : string.Empty);
  24. if (ModuleHelper.IsLoadPort(ModuleHelper.Converter(device)))
  25. {
  26. LoadPortServerModule entity = (LoadPortServerModule)GetEntity(device);
  27. if (entity == null)
  28. {
  29. result = PARAM_NG;
  30. return false;
  31. }
  32. }
  33. if (ModuleHelper.IsBuffer(ModuleHelper.Converter(device)))
  34. {
  35. BufferStationServerModule entity = (BufferStationServerModule)GetEntity(device);
  36. if (entity == null)
  37. {
  38. result = PARAM_NG;
  39. return false;
  40. }
  41. }
  42. if (!Check<NoReadyPolicy>(device, out result))
  43. {
  44. return false;
  45. }
  46. if (!Check<NoInitCompletedPolicy>(device, out result))
  47. {
  48. return false;
  49. }
  50. if (!Check<NoOriginCompletedPolicy>(device, out result))
  51. {
  52. return false;
  53. }
  54. if (!Check<HoldPolicy>(device, out result))
  55. {
  56. return false;
  57. }
  58. if (!Check<EMSPolicy>(device, out result))
  59. {
  60. return false;
  61. }
  62. if (!Check<ErrorPolicy>(device, out result))
  63. {
  64. return false;
  65. }
  66. if (!Check<BusyPolicy>(device, out result))
  67. {
  68. return false;
  69. }
  70. if (!Check<MaintenancePolicy>(device, out result))
  71. {
  72. return false;
  73. }
  74. if (ModuleHelper.IsBuffer(ModuleHelper.Converter(device)))
  75. {
  76. if (DEVICE.GetDevice<BufferStation>(device).IsNeedMap && !Check<NoWaferMappingCompletedPolicy>(device, out result))
  77. {
  78. return false;
  79. }
  80. result = "";
  81. return true;
  82. }
  83. if (!Check<RemovePolicy>(device, out result))
  84. {
  85. return false;
  86. }
  87. if (!Check<LinkPolicy>(device, out result))
  88. {
  89. return false;
  90. }
  91. if (!Check<NoPodPolicy>(device, out result))
  92. {
  93. return false;
  94. }
  95. if (!Check<ClosePolicy>(device, out result))
  96. {
  97. return false;
  98. }
  99. if (!Check<NoWaferMappingCompletedPolicy>(device, out result))
  100. {
  101. return false;
  102. }
  103. return true;
  104. }
  105. public bool? Monitor(out string result, params string[] args)
  106. {
  107. result = string.Empty;
  108. string device = Args2Unit(args.Length > 0 ? args[0] : string.Empty);
  109. Enum.TryParse(device, out ModuleName station);
  110. if (ModuleHelper.IsBuffer(station))
  111. {
  112. //Singleton<RouteManager>.Instance.MapBuffer();
  113. //var wafers = WaferManager.Instance.GetWafers(station);
  114. //foreach (var t in wafers)
  115. //{
  116. // result += t.IsEmpty ? "0" : "1";
  117. //}
  118. BufferStation _buffer = DEVICE.GetDevice<BufferStation>(device);
  119. if (!_buffer.IsNeedMap || _buffer.IsMapped)
  120. {
  121. result = _buffer.SlotMap;
  122. Singleton<EfemEntity>.Instance.SendMapEvent(_buffer);
  123. return true;
  124. }
  125. return true;
  126. }
  127. LoadPortBaseDevice _device = DEVICE.GetDevice<LoadPortBaseDevice>(device);
  128. if (_device.IsError)
  129. {
  130. flag1 = ErrorCheckList1.VAC | ErrorCheckList1.AIR | ErrorCheckList1.STALL
  131. | ErrorCheckList1.LIMIT | ErrorCheckList1.SENSOR | ErrorCheckList1.POSITION | ErrorCheckList1.EMS
  132. | ErrorCheckList1.COMM | ErrorCheckList1.COMM2 | ErrorCheckList1.VACON | ErrorCheckList1.VACOFF
  133. | ErrorCheckList1.CLAMPON | ErrorCheckList1.CLAMPOF;
  134. flag2 = ErrorCheckList2.RRTWAF | ErrorCheckList2.CRSWAF | ErrorCheckList2.THICKWAF | ErrorCheckList2.THINWAF
  135. | ErrorCheckList2.DBLWAF | ErrorCheckList2.BAOWAF | ErrorCheckList2.COMMAND | ErrorCheckList2.PODNG
  136. | ErrorCheckList2.PODMISMATCH | ErrorCheckList2.VAC_S | ErrorCheckList2.CLAMP_S | ErrorCheckList2.SAFTY
  137. | ErrorCheckList2.LOCKNG | ErrorCheckList2.UNLOCKNG | ErrorCheckList2.L_KEY_LK | ErrorCheckList2.L_KEY_UL;
  138. flag3 = ErrorCheckList3.MAP_S | ErrorCheckList3.MAP_S1 | ErrorCheckList3.MAP_S2 | ErrorCheckList3.WAFLOST
  139. | ErrorCheckList3.ALIGNNG
  140. | ErrorCheckList3.DRIVER | ErrorCheckList3.DRPOWERDOWN | ErrorCheckList3.HARDWARE
  141. | ErrorCheckList3.INTERNAL | ErrorCheckList3.E84_TIMEOUTx | ErrorCheckList3.E84_CS_VALID | ErrorCheckList3.READFAIL;
  142. return CheckError(device, out result);
  143. }
  144. if (_device.IsReady() && _device.IsMapped)
  145. {
  146. result = _device.SlotMap;
  147. Singleton<EfemEntity>.Instance.SendMapEvent(_device);
  148. return true;
  149. }
  150. return null;
  151. }
  152. }
  153. }