123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202 |
- using Aitex.Core.RT.Device;
- using Aitex.Core.RT.Log;
- using Aitex.Core.Util;
- using Aitex.Sorter.Common;
- using Aitex.Sorter.RT.EFEMs.Servers;
- using MECF.Framework.Common.Equipment;
- using MECF.Framework.Common.SubstrateTrackings;
- using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robot;
- namespace Aitex.Sorter.RT.EFEMs.Tasks
- {
- public class PickTask : RobotImp, ITask
- {
- Hand _arm = Hand.Blade2;
- public PickTask()
- {
- }
- public bool Execute(out string result, params string[] args)
- {
- string device = DeviceName.Robot;
- IServerModule entity = GetEntity(device);
- ModuleName target = ModuleName.System;
- int slot = 1;
- if (!ParseMoveTarget(args[0], out target, out slot))
- {
- result = PARAM_NG;
- return false;
- }
-
- if (!ParseMoveArm(args[1], out _arm))
- {
- result = PARAM_NG;
- return false;
- }
- if (!Check<NoReadyPolicy>(device, out result))
- {
- return false;
- }
- if (!Check<NoInitCompletedPolicy>(device, out result))
- {
- return false;
- }
- if (!Check<NoOriginCompletedPolicy>(device, out result))
- {
- return false;
- }
- if (!Check<VacPolicy>(device, out result))
- {
- return false;
- }
- if (!Check<EMSPolicy>(device, out result))
- {
- return false;
- }
- if (!Check<ErrorPolicy>(device, out result))
- {
- return false;
- }
- if (!Check<BusyPolicy>(device, out result))
- {
- LOG.Write($"PickTask {device} Busy");
- return false;
- }
- if (!Check<ClosePolicy>(device, out result))
- {
- return false;
- }
- if (!Check<NoWaferMappingCompletedPolicy>(device, out result))
- {
- return false;
- }
- if (!Check<NoPodPolicy>(device, out result))
- {
- return false;
- }
- //do not check loadlock
- if (!ModuleHelper.IsLoadLock(target) && !Singleton<WaferManager>.Instance.CheckHasWafer(target,slot-1))
- {
- result = "NONWAF";
- return false;
- }
- if (_arm == Hand.Blade1)
- {
- if (Singleton<WaferManager>.Instance.CheckHasWafer(ModuleName.Robot,0))
- {
- result = "WAFER";
- return false;
- }
- }
- else if (_arm == Hand.Blade2)
- {
- if (Singleton<WaferManager>.Instance.CheckHasWafer(ModuleName.Robot,1))
- {
- result = "WAFER";
- return false;
- }
- }
- else
- {
- if (Singleton<WaferManager>.Instance.CheckHasWafer(ModuleName.Robot,0))
- {
- result = "WAFER";
- return false;
- }
- if (Singleton<WaferManager>.Instance.CheckHasWafer(ModuleName.Robot,1))
- {
- result = "WAFER";
- return false;
- }
- }
-
- if (!Check<HoldPolicy>(device, out result))
- {
- return false;
- }
- if (!Check<RemovePolicy>(device, out result))
- {
- return false;
- }
- if (!Check<MaintenancePolicy>(device, out result))
- {
- return false;
- }
- if (!Check<LinkPolicy>(device, out result))
- {
- return false;
- }
- if (!Check<PowerDownPolicy>(device, out result))
- {
- return false;
- }
- if (Singleton<EfemEntity>.Instance.EfemDevice.IsError)
- {
- result = "ERROR";
- return false;
- }
- if (!Singleton<EfemEntity>.Instance.EfemDevice.IsIdle)
- {
- LOG.Write($"PickTask RouteManager is Busy");
- result = "BUSY";
- return false;
- }
- _token = Singleton<EfemEntity>.Instance.EfemDevice.Invoke("Pick", target.ToString(), slot - 1, _arm);
- return true;
- }
- public bool? Monitor(out string result, params string[] args)
- {
- result = string.Empty;
- if (Singleton<EfemEntity>.Instance.EfemDevice.CheckIsError(ModuleName.Robot))
- {
- string param1 = "";
- if (_arm == Hand.Blade1)
- {
- if (Singleton<WaferManager>.Instance.CheckHasWafer(ModuleName.Robot, 0))
- {
- param1 = "WAFER";
- }
- else
- {
- param1 = "NONWAF";
- }
- }
- else if (_arm == Hand.Blade2)
- {
- if (Singleton<WaferManager>.Instance.CheckHasWafer(ModuleName.Robot, 1))
- {
- param1 = "WAFER";
- }
- else
- {
- param1 = "NONWAF";
- }
- }
- result = $"ERROR|{param1}";
- return false;
- }
- if (Singleton<EfemEntity>.Instance.EfemDevice.CheckIsIdle(ModuleName.Robot)
- && Singleton<EfemEntity>.Instance.EfemDevice.CheckIsIdle(ModuleName.System)
- && Singleton<EfemEntity>.Instance.EfemDevice.CheckAcked(_token))
- return true;
- return null;
- }
- }
- }
|