123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197 |
- using Aitex.Core.RT.Device;
- using Aitex.Core.Util;
- using Aitex.Sorter.Common;
- using Efem;
- using MECF.Framework.Common.Equipment;
- using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadPorts;
- using System.Threading;
- using Efem.Protocol;
- using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robot;
- using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadPorts.LoadPortBase;
- using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robots.RobotBase;
- using Aitex.Core.RT.SCCore;
- namespace EFEM.RT.Tasks
- {
- public class OpenTask : CheckImp, ITask
- {
- public OpenTask()
- {
- }
- public bool Execute(out string result, params string[] args)
- {
- string device = Args2Unit(args.Length > 0 ? args[0] : string.Empty);
- SystemServerModule entity = (SystemServerModule)GetEntity(DeviceName.System);
- if (entity == null)
- {
- 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<AirPolicy>(device, out result))
- {
- return false;
- }
- if (!Check<EMSPolicy>(device, out result))
- {
- return false;
- }
- if (!Check<ErrorPolicy>(device, out result))
- {
- return false;
- }
- var LPRobotActionIntervene = SC.GetValue<bool>("System.LPRobotActionIntervene");
- if (LPRobotActionIntervene)
- {
- if (!Check<BusyPolicy>(device, out result))
- {
- return false;
- }
- }
- if (DeviceDefineManager.Instance.GetValue<bool>("WAFSHEnable") == false && LPRobotActionIntervene && !Check<BusyPolicy>(DeviceName.Robot, 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 (DeviceDefineManager.Instance.GetValue<bool>("WAFSHEnable") == false && !Check<ArmExtendPolicy>(device, out result))
- {
- return false;
- }
- if (!Check<PowerDownPolicy>(device, out result))
- {
- return false;
- }
- if (!Check<NoPosPolicy>(device, out result))
- {
- return false;
- }
- if (!Check<NoPodPolicy>(device, out result))
- {
- return false;
- }
- if (Check<ClosePolicy>(device, out result))
- {
- return false;
- }
- //if (DeviceDefineManager.Instance.GetValue<bool>("WAFSHEnable")==false)
- //{
- // result = "This device doesn't support mapping.";
- // return false;
- //}
- if (!DEVICE.GetDevice<LoadPortBaseDevice>(device).IsMapWaferByLoadPort && DeviceDefineManager.Instance.GetValue<bool>("WAFSHEnable") == false)
- {
- if (!entity.MapWafer(device, out result))
- {
- return false;
- }
- }
- else
- {
- LoadPortServerModule lpEntity = (LoadPortServerModule)GetEntity(device);
- if (lpEntity == null)
- {
- result = PARAM_NG;
- return false;
- }
- //if (!lpEntity.QueryWaferMap(out result))
- if (!lpEntity.Open(out result))
- {
- return false;
- }
- }
- return true;
- }
- public bool? Monitor(out string result, params string[] args)
- {
- result = string.Empty;
- string device = Args2Unit(args.Length > 0 ? args[0] : string.Empty);
- LoadPortBaseDevice _loadport = DEVICE.GetDevice<LoadPortBaseDevice>(device);
- RobotBaseDevice _robot = DEVICE.GetDevice<RobotBaseDevice>(DeviceName.Robot);
- if (_loadport.CurrentState == LoadPortStateEnum.Error && _loadport.MapError)
- {
- result = "Slot Map Error";
- return false;
- }
- if (_loadport.IsError || _robot.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;
- return CheckError(device, out result);
- }
- SystemServerModule entity = (SystemServerModule)GetEntity(DeviceName.System);
- if (_loadport.IsReady() && _loadport.IsMapped&& !entity.Busy && _loadport.DockState== FoupDockState.Docked)
- {
- Singleton<EfemEntity>.Instance.SendMapEvent(_loadport);
- //if (_loadport.MapError)
- // _loadport.OnError("MappingError");
- return true;
- }
- return null;
- }
- public bool Ack(EfemCommandType type, EfemCommand cmd, params string[] args)
- {
- return cmd == EfemCommand.WAFSH;
- }
- }
- }
|