Sic10/SicRT/Equipments/Schedulers/SchedulerTMRobot.cs

102 lines
3.0 KiB
C#
Raw Normal View History

2023-11-23 16:22:14 +08:00
using Aitex.Core.Util;
2023-05-10 10:26:01 +08:00
using Aitex.Sorter.Common;
using SicRT.Modules.Schedulers;
using MECF.Framework.Common.Equipment;
using MECF.Framework.Common.SubstrateTrackings;
using SicModules.TMs;
2023-05-10 10:26:01 +08:00
using SicRT.Equipments.Systems;
namespace SicRT.Scheduler
{
2023-11-23 16:22:14 +08:00
public class SchedulerTMRobot : SchedulerModule
{
public override bool IsAvailable => _tmRobot.IsIdle && _tmRobot.IsOnline && CheckTaskDone();
2023-05-10 10:26:01 +08:00
2023-11-23 16:22:14 +08:00
public override bool IsOnline => _tmRobot.IsOnline;
2023-05-10 10:26:01 +08:00
2023-11-23 16:22:14 +08:00
public override bool IsError => _tmRobot.IsError;
2023-05-10 10:26:01 +08:00
2023-11-23 16:22:14 +08:00
private TMModuleBase _tmRobot = null;
2023-05-10 10:26:01 +08:00
2023-11-23 16:22:14 +08:00
private Hand _taskHand;
2023-05-10 10:26:01 +08:00
2023-11-23 16:22:14 +08:00
private ModuleName _target;
2023-05-10 10:26:01 +08:00
2023-11-23 16:22:14 +08:00
public bool IsInPumping => ((_task == TaskType.Pick || _task == TaskType.Place) &&
(_target == ModuleName.UnLoad || _target == ModuleName.LoadLock ||
_target == ModuleName.Load));
2023-05-10 10:26:01 +08:00
2023-11-23 16:22:14 +08:00
public SchedulerTMRobot() : base(ModuleName.TMRobot.ToString())
{
_tmRobot = Singleton<EquipmentManager>.Instance.Modules[ModuleName.TM] as TMModuleBase;
}
2023-05-10 10:26:01 +08:00
2023-11-23 16:22:14 +08:00
public bool IsReadyForPick(Hand blade)
{
return WaferManager.Instance.CheckNoWafer(ModuleName.TMRobot, (int)blade);
}
2023-05-10 10:26:01 +08:00
2023-11-23 16:22:14 +08:00
public bool IsReadyForPlace(Hand blade)
{
return WaferManager.Instance.CheckHasWafer(ModuleName.TMRobot, (int)blade);
}
2023-05-10 10:26:01 +08:00
2023-11-23 16:22:14 +08:00
public bool Pick(ModuleName target, int slot, Hand hand)
{
if (_tmRobot.Pick(target, hand, slot, out string reason))
{
_task = TaskType.Pick;
_taskHand = hand;
_target = target;
LogTaskStart(_task, $"{target}.{slot + 1}=>{Module}.{hand}");
2023-05-10 10:26:01 +08:00
}
return true;
}
2023-11-23 16:22:14 +08:00
public bool Place(ModuleName target, int slot, Hand hand)
{
if (_tmRobot.Place(target, hand, slot, out string reason))
{
_task = TaskType.Place;
_taskHand = hand;
_target = target;
LogTaskStart(_task, $"{Module}.{hand}=>{target}.{slot + 1}");
2023-05-10 10:26:01 +08:00
}
return true;
}
2023-11-23 16:22:14 +08:00
public bool Goto(ModuleName chamber, int slot, Hand hand)
{
return true;
}
public bool Monitor()
{
return true;
}
public bool CheckTaskDone()
{
var taskSucceed = false;
switch (_task)
{
case TaskType.None:
taskSucceed = true;
2023-11-23 16:22:14 +08:00
break;
case TaskType.Pick:
taskSucceed = WaferManager.Instance.CheckHasTray(ModuleName.TMRobot, (int)_taskHand);
2023-11-23 16:22:14 +08:00
break;
case TaskType.Place:
taskSucceed = WaferManager.Instance.CheckNoTray(ModuleName.TMRobot, (int)_taskHand);
2023-11-23 16:22:14 +08:00
break;
}
2023-05-10 10:26:01 +08:00
return SuperCheckTaskDone(taskSucceed, _tmRobot.IsIdle | _tmRobot.IsError);
}
2023-11-23 16:22:14 +08:00
}
2023-05-10 10:26:01 +08:00
}