123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264 |
- using Aitex.Core.Common;
- using Aitex.Core.RT.Device;
- using Aitex.Core.RT.Event;
- using Aitex.Core.RT.Log;
- using Aitex.Core.RT.SCCore;
- using Aitex.Core.Util;
- using EFEM.RT.Modules;
- using Aitex.Sorter.Common;
- using System.Linq;
- using Efem;
- using MECF.Framework.Common.Equipment;
- using MECF.Framework.Common.SubstrateTrackings;
- using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadPorts;
- using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robot;
- using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robots.RobotBase;
- namespace EFEM.RT.Tasks
- {
- public class PickTask : RobotImp, ITask
- {
- 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;
- }
- Hand arm = Hand.Blade2;
- if (!ParseMoveArm(args[1], out arm))
- {
- EV.PostWarningLog("Server", $"{args[1]} not valid arm parameter");
- result = PARAM_NG;
- return false;
- }
- if (ModuleHelper.IsLoadLock(target) && !SC.GetValue<bool>("System.IsLoadLockEnableZMotion"))
- {
- EV.PostWarningLog("Server", $"not support LL z motion, can not LOAD {target}");
- result = PARAM_NG;
- return false;
- }
- if (MultiWaferSize)
- {
- if (args.Length < 2)
- {
- result = PARAM_NG;
- return false;
- }
- if (!CheckWaferSize(args[2], target, slot - 1))
- {
- result = PARAM_NG;
- return false;
- }
- //if (ModuleHelper.IsLoadPort(target))
- //{
- //OpenStageWithWaferSizeLoadPort lp = DEVICE.GetDevice<OpenStageWithWaferSizeLoadPort>(target.ToString());
- //var
- //if (slot == 1 && lp.WaferSize == WaferSize.WS3)
- //{
- // EV.PostWarningLog("EFEM", $"{target} is 3', slot 1 is disabled");
- // 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<DisablePolicy>(device, out result))
- {
- // LOG.Write($"PickTask {device} Busy");
- return false;
- }
- if (!Check<BusyPolicy>(device, out result))
- {
- LOG.Write($"PickTask {device} Busy");
- return false;
- }
- if (!Check<DisablePolicy>(target.ToString(), 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<NoWaferMappingCompletedPolicy>(target.ToString(), out result))
- {
- return false;
- }
- if (!Check<NoPodPolicy>(device, out result))
- {
- return false;
- }
- //do not check loadlock
- if (!ModuleHelper.IsBuffer(target))
- {
- if (!ModuleHelper.IsLoadLock(target)&& !Singleton<WaferManager>.Instance.CheckHasWafer(target, slot - 1))
- {
- result = "NONWAF";
- return false;
- }
- }
- if (ModuleHelper.IsLoadPort(target))
- {
- if (!Check<ErrorPolicy>(target.ToString(), out result))
- {
- return false;
- }
- }
- if (arm == Hand.Blade1)
- {
- if (!Singleton<WaferManager>.Instance.CheckNoWafer(ModuleName.Robot,0))
- {
- result = "WAFER";
- return false;
- }
- }
- else if (arm == Hand.Blade2)
- {
- if (!Singleton<WaferManager>.Instance.CheckNoWafer(ModuleName.Robot,1))
- {
- result = "WAFER";
- return false;
- }
- }
- else
- {
- if (!Singleton<WaferManager>.Instance.CheckNoWafer(ModuleName.Robot,0))
- {
- result = "WAFER";
- return false;
- }
- if (!Singleton<WaferManager>.Instance.CheckNoWafer(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<RouteManager>.Instance.IsIdle)
- {
- LOG.Write($"PickTask RouteManager is Busy");
- result = "BUSY";
- return false;
- }
- _token = Singleton<RouteManager>.Instance.Invoke("Pick", target.ToString(), slot - 1, arm);
- return true;
- }
- public bool? Monitor(out string result, params string[] args)
- {
- result = string.Empty;
- RobotBaseDevice _device = DEVICE.GetDevice<RobotBaseDevice>(DeviceName.Robot);
- if (_device.IsError|| Singleton<RouteManager>.Instance.IsError)
- {
- flag1 = ErrorCheckList1.VAC | ErrorCheckList1.AIR | ErrorCheckList1.STALL
- | ErrorCheckList1.LIMIT | ErrorCheckList1.SENSOR | ErrorCheckList1.POSITION | ErrorCheckList1.EMS
- | ErrorCheckList1.COMM | ErrorCheckList1.COMM2 | ErrorCheckList1.VACON | ErrorCheckList1.VACOFF
- | ErrorCheckList1.CLAMPON | ErrorCheckList1.CLAMPOF;
- flag2 = ErrorCheckList2.RRTWAF | ErrorCheckList2.CRSWAF | ErrorCheckList2.THICKWAF | ErrorCheckList2.THINWAF
- | ErrorCheckList2.DBLWAF | ErrorCheckList2.BAOWAF | ErrorCheckList2.COMMAND | ErrorCheckList2.PODNG
- | ErrorCheckList2.PODMISMATCH | ErrorCheckList2.VAC_S | ErrorCheckList2.CLAMP_S | ErrorCheckList2.SAFTY
- | ErrorCheckList2.LOCKNG | ErrorCheckList2.UNLOCKNG | ErrorCheckList2.L_KEY_LK | ErrorCheckList2.L_KEY_UL;
- flag3 = ErrorCheckList3.MAP_S | ErrorCheckList3.MAP_S1 | ErrorCheckList3.MAP_S2 | ErrorCheckList3.WAFLOST
- | ErrorCheckList3.ALIGNNG
- | ErrorCheckList3.DRIVER | ErrorCheckList3.DRPOWERDOWN | ErrorCheckList3.HARDWARE
- | ErrorCheckList3.INTERNAL | ErrorCheckList3.E84_TIMEOUTx | ErrorCheckList3.E84_CS_VALID | ErrorCheckList3.READFAIL;
- var ret= CheckError(DeviceName.Robot, out result);
- if (!ret)
- {
- result = "";
- if (Singleton<EfemEntity>.Instance.EventError != null)
- {
- var items = Singleton<EfemEntity>.Instance.EventError.ToList().Where(m => m.Source == "System" || m.Source == "Robot").Reverse().ToList();
- for(int i=0;i<items.Count;i++)
- {
- if(i<3)
- result += items[i].Description +"|";
- }
-
- }
-
- }
- return ret;
- }
-
- if (Singleton<RouteManager>.Instance.IsIdle&& _device.IsReady()&& Singleton<RouteManager>.Instance.CheckAcked(_token))
- return true;
- return null;
- }
- }
- }
|