FurtureBuffer.cs 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  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 FutureEfemLib.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 Initialize()
  38. {
  39. if (_efem == null && !string.IsNullOrEmpty(_efemName))
  40. {
  41. _efem = DEVICE.GetDevice<RorzeEfem>(_efemName);
  42. _efem.SetBufferCallback(ModuleHelper.Converter(Module), this);
  43. }
  44. //base.Initialize();
  45. return true;
  46. }
  47. public bool PrepareTransfer(ModuleName robot, Hand blade, int targetSlot, EnumTransferType transferType, out string reason)
  48. {
  49. throw new System.NotImplementedException();
  50. }
  51. public bool TransferHandoff(ModuleName robot, Hand blade, int targetSlot, EnumTransferType transferType, out string reason)
  52. {
  53. throw new System.NotImplementedException();
  54. }
  55. public bool PostTransfer(ModuleName robot, Hand blade, int targetSlot, EnumTransferType transferType, out string reason)
  56. {
  57. throw new System.NotImplementedException();
  58. }
  59. public bool CheckReadyForTransfer(ModuleName robot, Hand blade, int targetSlot, EnumTransferType transferType,
  60. out string reason)
  61. {
  62. reason = string.Empty;
  63. if (transferType == EnumTransferType.Pick)
  64. {
  65. return WaferManager.Instance.CheckHasWafer(Module, targetSlot);
  66. }
  67. if (transferType == EnumTransferType.Place)
  68. {
  69. return WaferManager.Instance.CheckNoWafer(Module, targetSlot);
  70. }
  71. return false;
  72. }
  73. public bool NoteTransferStart(ModuleName robot, Hand blade, int targetSlot, EnumTransferType transferType, out string reason)
  74. {
  75. reason = string.Empty;
  76. return true;
  77. }
  78. public bool NoteTransferStop(ModuleName robot, Hand blade, int targetSlot, EnumTransferType transferType, out string reason)
  79. {
  80. reason = string.Empty;
  81. return true;
  82. }
  83. public void NoteTransferStart(ModuleName robot, Hand blade, int targetSlot, EnumTransferType transferType)
  84. {
  85. }
  86. public void NoteTransferStop(ModuleName robot, Hand blade, int targetSlot, EnumTransferType transferType)
  87. {
  88. }
  89. public void NoteComplete()
  90. {
  91. }
  92. public void NoteCancel(string error)
  93. {
  94. }
  95. public virtual void NoteSlotMap(string slotMap)
  96. {
  97. slotMap = slotMap.Replace('3', '2');
  98. slotMap = slotMap.Replace('4', 'W');
  99. slotMap = slotMap.Replace('7', 'W');
  100. slotMap = slotMap.Replace('8', 'W');
  101. slotMap = slotMap.Replace('2', 'W');
  102. var _module = ModuleHelper.Converter(Module);
  103. for (int i = 0; i < slotMap.Length; i++)
  104. {
  105. // No wafer: "0", Wafer: "1", Crossed:"2", Undefined: "?", Overlapping wafers: "W"
  106. WaferInfo wafer = null;
  107. switch (slotMap[i])
  108. {
  109. case '0':
  110. WaferManager.Instance.DeleteWafer(_module, i);
  111. CarrierManager.Instance.UnregisterCarrierWafer(Name, i);
  112. break;
  113. case '1':
  114. if (!WaferManager.Instance.GetWafer(_module, i).IsEmpty)
  115. break;
  116. wafer = WaferManager.Instance.CreateWafer(_module, i, WaferStatus.Normal);
  117. WaferManager.Instance.UpdateWaferSize(_module, i, GetCurrentWaferSize());
  118. CarrierManager.Instance.RegisterCarrierWafer(Name, i, wafer);
  119. break;
  120. case '2':
  121. wafer = WaferManager.Instance.CreateWafer(_module, i, WaferStatus.Crossed);
  122. WaferManager.Instance.UpdateWaferSize(_module, i, GetCurrentWaferSize());
  123. CarrierManager.Instance.RegisterCarrierWafer(Name, i, wafer);
  124. //NotifyWaferError(Name, i, WaferStatus.Crossed);
  125. break;
  126. case 'W':
  127. wafer = WaferManager.Instance.CreateWafer(_module, i, WaferStatus.Double);
  128. WaferManager.Instance.UpdateWaferSize(_module, i, GetCurrentWaferSize());
  129. CarrierManager.Instance.RegisterCarrierWafer(Name, i, wafer);
  130. //NotifyWaferError(Name, i, WaferStatus.Double);
  131. break;
  132. case '?':
  133. wafer = WaferManager.Instance.CreateWafer(_module, i, WaferStatus.Unknown);
  134. WaferManager.Instance.UpdateWaferSize(_module, i, GetCurrentWaferSize());
  135. CarrierManager.Instance.RegisterCarrierWafer(Name, i, wafer);
  136. //NotifyWaferError(Name, i, WaferStatus.Unknown);
  137. break;
  138. }
  139. }
  140. string waferMap = "";
  141. foreach (var wafer in WaferManager.Instance.GetWafers(ModuleHelper.Converter(Module)))
  142. {
  143. waferMap += wafer.IsEmpty ? "0" : "1";
  144. }
  145. if (slotMap != waferMap)
  146. {
  147. EV.PostAlarmLog("EFEM", $"Map result : {slotMap} is not match {waferMap}");
  148. }
  149. else
  150. {
  151. EV.PostInfoLog("EFEM", $"Map result : {slotMap} is match {waferMap}");
  152. }
  153. }
  154. private WaferSize GetCurrentWaferSize()
  155. {
  156. if (SC.GetStringValue("EFEM.EfemRobot.DefaultMapWaferSize").Trim() == "8")
  157. return WaferSize.WS8;
  158. return WaferSize.WS12;
  159. }
  160. public void Monitor()
  161. {
  162. }
  163. public void Terminate()
  164. {
  165. }
  166. public void Reset()
  167. {
  168. }
  169. }
  170. }