JetEfemBuffer.cs 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. using System;
  2. using System.Linq;
  3. using Aitex.Core.Common;
  4. using Aitex.Core.RT.Device;
  5. using Aitex.Core.RT.Event;
  6. using Aitex.Core.RT.SCCore;
  7. using Aitex.Core.Util;
  8. using Aitex.Sorter.Common;
  9. using MECF.Framework.Common.Equipment;
  10. using MECF.Framework.Common.Schedulers;
  11. using MECF.Framework.Common.SubstrateTrackings;
  12. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Aligners;
  13. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Efems.Rorzes;
  14. using MECF.Framework.RT.EquipmentLibrary.LogicUnits;
  15. namespace JetEfemLib.Aligners
  16. {
  17. public class FutureBuffer : BaseDevice, IDevice, IEfemBufferCallback
  18. {
  19. private RorzeEfem _efem;
  20. private string _efemName;
  21. public FutureBuffer(string module, string name, string efemName) : base(module, name, module, module)
  22. {
  23. base.Module = module;
  24. base.Name = name;
  25. base.Display = name;
  26. base.DeviceID = "";
  27. _efemName = efemName;
  28. //IsMapWaferByLoadPort = false;
  29. }
  30. public bool IsBusy
  31. {
  32. get
  33. {
  34. return _efem.CheckIsBusy(ModuleHelper.Converter(Module));
  35. }
  36. }
  37. public bool Home(out string reason)
  38. {
  39. reason = string.Empty;
  40. if (!_efem.HomeWaferAligner(ModuleHelper.Converter(Module), out reason))
  41. {
  42. return false;
  43. }
  44. return true;
  45. }
  46. public bool Initialize()
  47. {
  48. if (_efem == null && !string.IsNullOrEmpty(_efemName))
  49. {
  50. _efem = DEVICE.GetDevice<RorzeEfem>(_efemName);
  51. _efem.SetBufferCallback(ModuleHelper.Converter(Module), this);
  52. }
  53. //base.Initialize();
  54. return true;
  55. }
  56. public bool PrepareTransfer(ModuleName robot, Hand blade, int targetSlot, EnumTransferType transferType, out string reason)
  57. {
  58. throw new System.NotImplementedException();
  59. }
  60. public bool TransferHandoff(ModuleName robot, Hand blade, int targetSlot, EnumTransferType transferType, out string reason)
  61. {
  62. throw new System.NotImplementedException();
  63. }
  64. public bool PostTransfer(ModuleName robot, Hand blade, int targetSlot, EnumTransferType transferType, out string reason)
  65. {
  66. throw new System.NotImplementedException();
  67. }
  68. public bool CheckReadyForTransfer(ModuleName robot, Hand blade, int targetSlot, EnumTransferType transferType,
  69. out string reason)
  70. {
  71. reason = string.Empty;
  72. if (transferType == EnumTransferType.Pick)
  73. {
  74. return WaferManager.Instance.CheckHasWafer(Module, targetSlot);
  75. }
  76. if (transferType == EnumTransferType.Place)
  77. {
  78. return WaferManager.Instance.CheckNoWafer(Module, targetSlot);
  79. }
  80. return false;
  81. }
  82. public bool NoteTransferStart(ModuleName robot, Hand blade, int targetSlot, EnumTransferType transferType, out string reason)
  83. {
  84. reason = string.Empty;
  85. return true;
  86. }
  87. public bool NoteTransferStop(ModuleName robot, Hand blade, int targetSlot, EnumTransferType transferType, out string reason)
  88. {
  89. reason = string.Empty;
  90. return true;
  91. }
  92. public void NoteTransferStart(ModuleName robot, Hand blade, int targetSlot, EnumTransferType transferType)
  93. {
  94. }
  95. public void NoteTransferStop(ModuleName robot, Hand blade, int targetSlot, EnumTransferType transferType)
  96. {
  97. }
  98. public void NoteComplete()
  99. {
  100. }
  101. public void NoteCancel(string error)
  102. {
  103. }
  104. public virtual void NoteSlotMap(string slotMap)
  105. {
  106. slotMap = slotMap.Replace('3', '2');
  107. slotMap = slotMap.Replace('4', 'W');
  108. slotMap = slotMap.Replace('7', 'W');
  109. slotMap = slotMap.Replace('8', 'W');
  110. slotMap = slotMap.Replace('2', 'W');
  111. var _module = ModuleHelper.Converter(Module);
  112. for (int i = 0; i < slotMap.Length; i++)
  113. {
  114. // No wafer: "0", Wafer: "1", Crossed:"2", Undefined: "?", Overlapping wafers: "W"
  115. WaferInfo wafer = null;
  116. switch (slotMap[i])
  117. {
  118. case '0':
  119. WaferManager.Instance.DeleteWafer(_module, i);
  120. CarrierManager.Instance.UnregisterCarrierWafer(Name, i);
  121. break;
  122. case '1':
  123. if (!WaferManager.Instance.GetWafer(_module, i).IsEmpty)
  124. break;
  125. wafer = WaferManager.Instance.CreateWafer(_module, i, WaferStatus.Normal);
  126. WaferManager.Instance.UpdateWaferSize(_module, i, GetCurrentWaferSize());
  127. CarrierManager.Instance.RegisterCarrierWafer(Name, i, wafer);
  128. break;
  129. case '2':
  130. wafer = WaferManager.Instance.CreateWafer(_module, i, WaferStatus.Crossed);
  131. WaferManager.Instance.UpdateWaferSize(_module, i, GetCurrentWaferSize());
  132. CarrierManager.Instance.RegisterCarrierWafer(Name, i, wafer);
  133. //NotifyWaferError(Name, i, WaferStatus.Crossed);
  134. break;
  135. case 'W':
  136. wafer = WaferManager.Instance.CreateWafer(_module, i, WaferStatus.Double);
  137. WaferManager.Instance.UpdateWaferSize(_module, i, GetCurrentWaferSize());
  138. CarrierManager.Instance.RegisterCarrierWafer(Name, i, wafer);
  139. //NotifyWaferError(Name, i, WaferStatus.Double);
  140. break;
  141. case '?':
  142. wafer = WaferManager.Instance.CreateWafer(_module, i, WaferStatus.Unknown);
  143. WaferManager.Instance.UpdateWaferSize(_module, i, GetCurrentWaferSize());
  144. CarrierManager.Instance.RegisterCarrierWafer(Name, i, wafer);
  145. //NotifyWaferError(Name, i, WaferStatus.Unknown);
  146. break;
  147. }
  148. }
  149. string waferMap = "";
  150. foreach (var wafer in WaferManager.Instance.GetWafers(ModuleHelper.Converter(Module)))
  151. {
  152. waferMap += wafer.IsEmpty ? "0" : "1";
  153. }
  154. if (slotMap != waferMap)
  155. {
  156. EV.PostAlarmLog("EFEM", $"Map result : {slotMap} is not match {waferMap}");
  157. }
  158. else
  159. {
  160. EV.PostInfoLog("EFEM", $"Map result : {slotMap} is match {waferMap}");
  161. }
  162. }
  163. private WaferSize GetCurrentWaferSize()
  164. {
  165. if (SC.GetStringValue("EFEM.EfemRobot.DefaultMapWaferSize").Trim() == "8")
  166. return WaferSize.WS8;
  167. return WaferSize.WS12;
  168. }
  169. public void Monitor()
  170. {
  171. }
  172. public void Terminate()
  173. {
  174. }
  175. public void Reset()
  176. {
  177. }
  178. }
  179. }