using Aitex.Core.Util; using Aitex.Sorter.Common; using MECF.Framework.Common.Equipment; using MECF.Framework.Common.SubstrateTrackings; using MECF.Framework.RT.ModuleLibrary.BufferModules; using MECF.Framework.RT.ModuleLibrary.SystemModules; namespace EfemDualSchedulerLib.Schedulers { public class SchedulerBuffer : SchedulerModule { public override bool IsAvailable { get { return _buffer.IsReady && _buffer.IsOnline && CheckTaskDone(); } } public override bool IsOnline { get { return _buffer.IsOnline; } } public override bool IsError { get { return _buffer.IsError; } } private BufferModuleBase _buffer = null; private DeviceTimer _timerCooling = new DeviceTimer(); private float _paramCoolingTime = 0; public SchedulerBuffer(ModuleName module) : base(module.ToString()) { _buffer = EquipmentManager.Modules[module] as BufferModuleBase; } public override bool IsReadyForPick(ModuleName robot, Hand hand, int slot) { return WaferManager.Instance.CheckHasWafer(ModuleHelper.Converter(_module), slot); } public override bool IsReadyForPlace(ModuleName robot, Hand hand, int slot) { return WaferManager.Instance.CheckNoWafer(ModuleHelper.Converter(_module), slot); } public override bool Cooling(int coolingTime) { _task = TaskType.Cooling; LogTaskStart(_task, $"Cooling {coolingTime} seconds" ); _paramCoolingTime = coolingTime; _timerCooling.Start(_paramCoolingTime * 1000); return true; } public bool Monitor() { return true; } public bool CheckTaskDone() { bool ret = false; switch (_task) { case TaskType.None: ret = true; break; case TaskType.Cooling: ret = _timerCooling.IsTimeout() && /* _entity.CheckAcked(_token) &&*/ _buffer.IsReady; break; } if (ret && _task != TaskType.None) { LogTaskDone(_task, ""); _task = TaskType.None; } return ret; } } }