JetEfemAligner.cs 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. using Aitex.Core.Common;
  2. using Aitex.Core.RT.Device;
  3. using Aitex.Core.RT.Event;
  4. using Aitex.Core.RT.SCCore;
  5. using Aitex.Core.Util;
  6. using Aitex.Sorter.Common;
  7. using MECF.Framework.Common.Equipment;
  8. using MECF.Framework.Common.Schedulers;
  9. using MECF.Framework.Common.SubstrateTrackings;
  10. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Aligners;
  11. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Efems.Rorzes;
  12. using MECF.Framework.RT.EquipmentLibrary.LogicUnits;
  13. using static JetEfemLib.Efems.EfemModule;
  14. namespace JetEfemLib.Aligners
  15. {
  16. public class FutureAligner : AlignerBase, ITransferTarget, IEfemAlignerCallback
  17. {
  18. private RorzeEfem _efem;
  19. private string _efemName;
  20. private bool _actionDone = false;
  21. private EfemType _efemType;
  22. public FutureAligner(string module, string name, string efemName):base(module, name, module, module)
  23. {
  24. base.Module = module;
  25. base.Name = name;
  26. base.Display = name;
  27. base.DeviceID = "";
  28. _efemName = efemName;
  29. _efemType = (EfemType)SC.GetValue<int>($"EFEM.EfemType");
  30. //IsMapWaferByLoadPort = false;
  31. }
  32. public override bool IsBusy
  33. {
  34. get
  35. {
  36. if (_efemType != EfemType.FutureEfem3P)
  37. return _efem.CheckIsBusy(ModuleHelper.Converter(Module)) && !_actionDone;
  38. else
  39. return _efem.CheckIsBusy(ModuleName.Aligner) && !_actionDone;
  40. }
  41. }
  42. public override bool Initialize()
  43. {
  44. if (_efem == null && !string.IsNullOrEmpty(_efemName))
  45. {
  46. _efem = DEVICE.GetDevice<RorzeEfem>(_efemName);
  47. _efem.SetAlignerCallback(ModuleHelper.Converter(Module), this);
  48. }
  49. //base.Initialize();
  50. return true;
  51. }
  52. private void _aligner_AlarmGenerated(string moduleName, EventLevel level, string message)
  53. {
  54. if (moduleName == Module)
  55. IsError = true;
  56. }
  57. public override bool Home(out string reason)
  58. {
  59. reason = string.Empty;
  60. if (!_efem.HomeWaferAligner(ModuleHelper.Converter(Module),out reason))
  61. {
  62. OnError();
  63. return false;
  64. }
  65. _actionDone = false;
  66. return true;
  67. }
  68. public override bool Align(double angle, out string reason)
  69. {
  70. reason = string.Empty;
  71. if (!_efem.AlignWafer(ModuleHelper.Converter(Module), angle, out reason))
  72. {
  73. OnError();
  74. return false;
  75. }
  76. _actionDone = false;
  77. return true;
  78. }
  79. public override bool Lift(string Position, out string reason)
  80. {
  81. reason = string.Empty;
  82. if(_efemType != EfemType.FutureEfem3P)
  83. {
  84. if (!_efem.Lift(ModuleHelper.Converter(Module), Position, out reason))
  85. {
  86. OnError();
  87. return false;
  88. }
  89. _actionDone = false;
  90. }
  91. else
  92. _actionDone = true;
  93. return true;
  94. }
  95. public override bool QueryWaferPresence(out string reason)
  96. {
  97. reason = string.Empty;
  98. if (!_efem.AlignerMapWaferPresence(out string slotMap, out reason))
  99. {
  100. return false;
  101. }
  102. //bool hasWafer = slotMap.Substring(0, 1) == "1";
  103. //if (hasWafer &&
  104. // WaferManager.Instance.CheckNoWafer(Module, 0))
  105. //{
  106. // EV.PostInfoLog(Module, $"found map wafer, created wafer at {Module}");
  107. // WaferManager.Instance.CreateWafer(ModuleHelper.Converter(Module), 0, WaferStatus.Normal);
  108. //}
  109. //if (!hasWafer &&
  110. // WaferManager.Instance.CheckHasWafer(ModuleHelper.Converter(Module), 0))
  111. //{
  112. // EV.PostInfoLog(Module, $"did not find wafer, delete wafer from {Module} ");
  113. // WaferManager.Instance.DeleteWafer(ModuleHelper.Converter(Module), 0);
  114. //}
  115. return true;
  116. }
  117. public bool PrepareTransfer(ModuleName robot, Hand blade, int[] targetSlot, EnumTransferType transferType, out string reason)
  118. {
  119. throw new System.NotImplementedException();
  120. }
  121. public bool TransferHandoff(ModuleName robot, Hand blade, int[] targetSlot, EnumTransferType transferType, out string reason)
  122. {
  123. throw new System.NotImplementedException();
  124. }
  125. public bool PostTransfer(ModuleName robot, Hand blade, int[] targetSlot, EnumTransferType transferType, out string reason)
  126. {
  127. throw new System.NotImplementedException();
  128. }
  129. public bool CheckReadyForTransfer(ModuleName robot, Hand blade, int targetSlot, EnumTransferType transferType,
  130. out string reason)
  131. {
  132. reason=string.Empty;
  133. if (transferType == EnumTransferType.Pick)
  134. {
  135. return WaferManager.Instance.CheckHasWafer(Module,targetSlot);
  136. }
  137. if (transferType == EnumTransferType.Place)
  138. {
  139. return WaferManager.Instance.CheckNoWafer(Module,targetSlot);
  140. }
  141. return false;
  142. }
  143. public bool NoteTransferStart(ModuleName robot, Hand blade, int targetSlot, EnumTransferType transferType, out string reason)
  144. {
  145. reason = string.Empty;
  146. return true;
  147. }
  148. public bool NoteTransferStop(ModuleName robot, Hand blade, int targetSlot, EnumTransferType transferType, out string reason)
  149. {
  150. reason = string.Empty;
  151. return true;
  152. }
  153. public void NoteTransferStart(ModuleName robot, Hand blade, int targetSlot, EnumTransferType transferType)
  154. {
  155. }
  156. public void NoteTransferStop(ModuleName robot, Hand blade, int targetSlot, EnumTransferType transferType)
  157. {
  158. }
  159. public void NoteComplete()
  160. {
  161. _actionDone = true;
  162. }
  163. public void NoteCancel(string error)
  164. {
  165. }
  166. }
  167. }