using Aitex.Core.Common.DeviceData; using Aitex.Core.Util; using MECF.Framework.Common.Equipment; using MECF.Framework.Common.SubstrateTrackings; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Aitex.Core.RT.Device; using Aitex.Core.RT.Event; using Aitex.Core.RT.Log; using Aitex.Sorter.Common; using Virgo_DRT.Modules; using MECF.Framework.Common.Schedulers; using Virgo_DRT.Devices; namespace Virgo_DRT.Scheduler { public class SchedulerModule { protected enum TaskType { None, PrepareTransfer, Pick, Place, PickAndPlace, PostTransfer, Preprocess, Process, PostProcess, OpenCover, CloseCover, Load, Unload, Align, TransferTarget, Cooling, Heating, Map, } public ModuleName Module { get { return ModuleHelper.Converter(_module); } } public virtual bool IsAvailable { get; } public virtual bool IsOnline { get; } public virtual bool IsError { get; } protected string _module; protected TaskType _task = TaskType.None; protected EnumTransferType _inTransferType; protected int _inTransferSlot; protected ModuleName _inProcessRobot; public SchedulerModule(string module) { _module = module; } protected void LogTaskStart(TaskType cmd, string message) { EV.PostInfoLog("Scheduler", $"Task start:{_module}, {cmd}, {message}"); } protected void LogTaskDone(TaskType cmd, string message) { EV.PostInfoLog("Scheduler", $"Task done:{_module}, {cmd}, {message}"); } public void ResetTask() { _task = TaskType.None; } public bool WaitTransfer(ModuleName robot, EnumTransferType transferType, int slot) { _task = TaskType.TransferTarget; _inProcessRobot = robot; _inTransferType = transferType; _inTransferSlot = slot; LogTaskStart(_task, $"Note {robot} in transfer"); return true; } public bool IsWaitTransfer(ModuleName robot) { return _task == TaskType.TransferTarget && _inProcessRobot == robot; } public virtual bool StopWaitTransfer(ModuleName robot) { LogTaskDone(_task, $"Note {robot} transfer complete"); _inProcessRobot = ModuleName.System; _task = TaskType.None; return true; } public bool HasWafer(int slot) { return WaferManager.Instance.CheckHasWafer(ModuleHelper.Converter(_module), slot); } public bool NoWafer(int slot) { return WaferManager.Instance.CheckNoWafer(ModuleHelper.Converter(_module), slot); } public virtual bool IsReadyForPick(ModuleName robot, int slot) { return true; } public virtual bool IsReadyForPlace(ModuleName robot, int slot) { return true; } public virtual bool PrepareTransfer(ModuleName robot, EnumTransferType type, int slot) { return true; } public virtual bool PostTransfer(ModuleName robot, EnumTransferType type, int slot) { StopWaitTransfer(robot); return true; } public virtual bool PostTransfer(ModuleName robot ) { StopWaitTransfer(robot); return true; } public virtual bool Process(string recipeName, bool isCleanRecipe, bool withDummyWafer) { return true; } public virtual bool Cooling(int coolingTime) { return true; } public virtual bool Preheating(float temperature) { return true; } } }