123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- using Aitex.Core.RT.Device;
- using Aitex.Core.RT.Event;
- using Aitex.Core.Util;
- using Aitex.Sorter.Common;
- using Aitex.Sorter.RT.EFEMs.Servers;
- using MECF.Framework.Common.Equipment;
- using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robot;
- namespace Aitex.Sorter.RT.EFEMs.Tasks
- {
- public class GotoTask : RobotImp, ITask
- {
- public GotoTask()
- {
- }
- 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))
- {
- result = PARAM_NG;
- return false;
- }
- //for goto, only assign lower arm
- if (arm == Hand.Both)
- arm = Hand.Blade1;
- MovePosition pos = MovePosition.UP;
- if (!ParseMovePosition(args[2], out pos))
- {
- result = PARAM_NG;
- return false;
- }
-
- var isPick = true;
- isPick = pos == MovePosition.DOWN;
- 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))
- {
- 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;
- }
- _token = Singleton<EfemEntity>.Instance.EfemDevice.Invoke("Goto", 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))
- {
- result = "ERROR";
- 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;
- }
- }
- }
|