SchedulerAligner.cs 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. using Aitex.Core.RT.SCCore;
  2. using Aitex.Core.Util;
  3. using Aitex.Sorter.Common;
  4. using MECF.Framework.Common.DBCore;
  5. using MECF.Framework.Common.Equipment;
  6. using MECF.Framework.Common.Schedulers;
  7. using MECF.Framework.Common.SubstrateTrackings;
  8. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Aligners;
  9. using MECF.Framework.RT.ModuleLibrary.AlignerModules;
  10. using MECF.Framework.RT.ModuleLibrary.LPModules;
  11. using MECF.Framework.RT.ModuleLibrary.SystemModules;
  12. using static JetEfemLib.Efems.EfemModule;
  13. namespace EfemDualSchedulerLib.Schedulers
  14. {
  15. public class SchedulerAligner : SchedulerModule
  16. {
  17. public override bool IsAvailable
  18. {
  19. get { return _aligner.IsReady && _aligner.IsOnline && CheckTaskDone(); }
  20. }
  21. public override bool IsOnline
  22. {
  23. get { return _aligner.IsOnline; }
  24. }
  25. public override bool IsError
  26. {
  27. get { return _aligner.IsError; }
  28. }
  29. private AlignerModuleBase _aligner = null;
  30. private DeviceTimer _timerCooling = new DeviceTimer();
  31. private float _paramCoolingTime = 0;
  32. private EfemType _efemType;
  33. private double _angle;
  34. public SchedulerAligner(ModuleName module) : base(module.ToString())
  35. {
  36. _module = module.ToString();
  37. _aligner = EquipmentManager.Modules[module] as AlignerModuleBase;
  38. _efemType = (EfemType)SC.GetValueOrDefault<int>($"EFEM.EfemType");
  39. _angle = SC.GetValueOrDefault<double>("EFEM.Aligner.DefaultNotchDegree");
  40. System.Diagnostics.Trace.Assert(_aligner!=null);
  41. }
  42. public void NoteJobStart()
  43. {
  44. }
  45. public void NoteJobComplete()
  46. {
  47. }
  48. public bool Monitor()
  49. {
  50. return true;
  51. }
  52. public override bool IsReadyForPick(ModuleName robot, Hand blade, int slot)
  53. {
  54. return _aligner.CheckReadyForTransfer(robot, blade, slot, EnumTransferType.Pick, out _)
  55. && WaferManager.Instance.CheckHasWafer(ModuleHelper.Converter(_module), slot);
  56. }
  57. public override bool IsReadyForPlace(ModuleName robot, Hand blade, int slot)
  58. {
  59. return _aligner.CheckReadyForTransfer(robot, blade, slot, EnumTransferType.Place, out _)
  60. && WaferManager.Instance.CheckNoWafer(ModuleHelper.Converter(_module), slot);
  61. }
  62. public bool CheckTaskDone()
  63. {
  64. bool ret = false;
  65. switch (_task)
  66. {
  67. case TaskType.None:
  68. ret = true;
  69. break;
  70. case TaskType.Align:
  71. ret = _aligner.IsReady;
  72. break;
  73. //case TaskType.PrepareTransfer:
  74. // ret = _aligner.CheckReadyForTransfer(ModuleName.EfemRobot, Hand.Blade1, 0, EnumTransferType.Pick, out _);
  75. // break;
  76. case TaskType.Cooling:
  77. ret = _timerCooling.IsTimeout() && /* _entity.CheckAcked(_token) &&*/ _aligner.IsReady;
  78. break;
  79. }
  80. if (ret && _task != TaskType.None)
  81. {
  82. LogTaskDone(_task, "");
  83. _task = TaskType.None;
  84. }
  85. return ret;
  86. }
  87. internal bool CheckReadyRunJob()
  88. {
  89. return true;
  90. }
  91. internal bool CheckReadyTransfer()
  92. {
  93. return _aligner.CheckReadyForTransfer(ModuleName.EfemRobot, Hand.Blade1, 0, EnumTransferType.Pick, out _);
  94. }
  95. internal bool Align(string waferInnerId)
  96. {
  97. _task = TaskType.Align;
  98. if (_efemType == EfemType.FutureEfem3P)
  99. {
  100. LogTaskStart(_task, $"{Module} Aligning");
  101. WaferDataRecorder.SetWaferNotchAngle(waferInnerId, (float)_angle);
  102. return _aligner.Align(_angle);
  103. }
  104. return true;
  105. }
  106. public override bool Cooling(int coolingTime)
  107. {
  108. _task = TaskType.Cooling;
  109. LogTaskStart(_task, $"Cooling {coolingTime} seconds");
  110. _paramCoolingTime = coolingTime;
  111. _timerCooling.Start(_paramCoolingTime * 1000);
  112. return true;
  113. }
  114. }
  115. }