123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312 |
- using Aitex.Core.Common;
- using Aitex.Core.RT.Device;
- using Aitex.Core.Util;
- using Aitex.Sorter.Common;
- using athosRT.Devices.EFEM.ABS;
- using MECF.Framework.Common.Equipment;
- using MECF.Framework.Common.SubstrateTrackings;
- using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadPorts;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using EV = athosRT.tool.EV;
- namespace athosRT.Devices.EFEM.Task
- {
- public class CheckImp
- {
- protected ErrorCheckList1 flag1 = 0;
- protected ErrorCheckList2 flag2 = 0;
- protected ErrorCheckList3 flag3 = 0;
- protected int LoadPortQuantity = Singleton<DeviceDefineManager>.Instance.GetValue<int>(nameof(LoadPortQuantity)).GetValueOrDefault();
- protected int LoadLockQuantity = Singleton<DeviceDefineManager>.Instance.GetValue<int>(nameof(LoadLockQuantity)).GetValueOrDefault();
- protected bool AlignerInstalled = Singleton<DeviceDefineManager>.Instance.GetValue<bool>(nameof(AlignerInstalled)).GetValueOrDefault();
- protected bool CoolingBufferInstalled = Singleton<DeviceDefineManager>.Instance.GetValue<bool>(nameof(CoolingBufferInstalled)).GetValueOrDefault();
- protected bool RobotIsSingleArm = Singleton<DeviceDefineManager>.Instance.GetValue<bool>(nameof(RobotIsSingleArm)).GetValueOrDefault();
- protected bool MultiWaferSize = Singleton<DeviceDefineManager>.Instance.GetValue<bool>(nameof(MultiWaferSize)).GetValueOrDefault();
- public const string PARAM_NG = "PARAM_NG";
- protected int _token;
- public bool HasInfoMessage { get; set; }
- public CheckImp() => HasInfoMessage = true;
- public bool CheckError(string device, out string reason)
- {
- //44个policy 额滴神啊
- //44个policy 只有3个包含真正的判断的check 其他都是空的 3个分别是EMSPolicy、VacPolicy、AirPolicy
- //剩余一些信号可能要加 所以要将IO信号、task等搞清楚 方便修改、添加条件
- //if ( flag1.HasFlag(ErrorCheckList1.VAC) && !Check<VacPolicy>(device, out reason)
- // || flag1.HasFlag(ErrorCheckList1.AIR) && !Check<AirPolicy>(device, out reason)
- // || flag1.HasFlag(ErrorCheckList1.STALL) && !Check<StallPolicy>(device, out reason)
- // || flag1.HasFlag(ErrorCheckList1.LIMIT) && !Check<LIMITPolicy>(device, out reason)
- // || flag1.HasFlag(ErrorCheckList1.SENSOR) && !Check<SENSORPolicy>(device, out reason)
- // || flag1.HasFlag(ErrorCheckList1.POSITION) && !Check<POSITIONPolicy>(device, out reason)
- // || flag1.HasFlag(ErrorCheckList1.EMS) && !Check<EMSPolicy>(device, out reason)
- // || flag1.HasFlag(ErrorCheckList1.COMM) && !Check<COMMPolicy>(device, out reason)
- // || flag1.HasFlag(ErrorCheckList1.COMM2) && !Check<COMM2Policy>(device, out reason)
- // || flag1.HasFlag(ErrorCheckList1.VACON) && !Check<VACONPolicy>(device, out reason)
- // || flag1.HasFlag(ErrorCheckList1.VACOFF) && !Check<VACOFPolicy>(device, out reason)
- // || flag1.HasFlag(ErrorCheckList1.CLAMPON) && !Check<CLAMPONPolicy>(device, out reason)
- // || flag1.HasFlag(ErrorCheckList1.CLAMPOF) && !Check<CLAMPOFPolicy>(device, out reason)
- // || flag2.HasFlag(ErrorCheckList2.RRTWAF) && !Check<PRTWAFPolicy>(device, out reason)
- // || flag2.HasFlag(ErrorCheckList2.CRSWAF) && !Check<CRSWAFPolicy>(device, out reason)
- // || flag2.HasFlag(ErrorCheckList2.THICKWAF) && !Check<THICKWAFPolicy>(device, out reason)
- // || flag2.HasFlag(ErrorCheckList2.THINWAF) && !Check<THINWAFPolicy>(device, out reason)
- // || flag2.HasFlag(ErrorCheckList2.DBLWAF) && !Check<DBLWAFPolicy>(device, out reason)
- // || flag2.HasFlag(ErrorCheckList2.BAOWAF) && !Check<BOWWAFPolicy>(device, out reason)
- // || flag2.HasFlag(ErrorCheckList2.COMMAND) && !Check<COMMANDPolicy>(device, out reason)
- // || flag2.HasFlag(ErrorCheckList2.PODNG) && !Check<PODNGPolicy>(device, out reason)
- // || flag2.HasFlag(ErrorCheckList2.PODMISMATCH) && !Check<PODMISMATCHPolicy>(device, out reason)
- // || flag2.HasFlag(ErrorCheckList2.VAC_S) && !Check<VAC_SPolicy>(device, out reason)
- // || flag2.HasFlag(ErrorCheckList2.CLAMP_S) && !Check<CLAMP_SPolicy>(device, out reason)
- // || flag2.HasFlag(ErrorCheckList2.SAFTY) && !Check<SAFTYPolicy>(device, out reason)
- // || flag2.HasFlag(ErrorCheckList2.LOCKNG) && !Check<LOCKNGPolicy>(device, out reason)
- // || flag2.HasFlag(ErrorCheckList2.UNLOCKNG) && !Check<UNLOCKNGPolicy>(device, out reason)
- // || flag2.HasFlag(ErrorCheckList2.L_KEY_LK) && !Check<L_KEY_LKPolicy>(device, out reason)
- // || flag2.HasFlag(ErrorCheckList2.L_KEY_UL) && !Check<L_KEY_ULPolicy>(device, out reason)
- // || flag3.HasFlag(ErrorCheckList3.MAP_S) && !Check<MAP_SPolicy>(device, out reason)
- // || flag3.HasFlag(ErrorCheckList3.MAP_S1) && !Check<MAP_S1Policy>(device, out reason)
- // || flag3.HasFlag(ErrorCheckList3.MAP_S2) && !Check<MAP_S2Policy>(device, out reason)
- // || flag3.HasFlag(ErrorCheckList3.WAFLOST) && !Check<WAFLOSTPolicy>(device, out reason)
- // || flag3.HasFlag(ErrorCheckList3.ALIGNNG) && !Check<ALIGNNGPolicy>(device, out reason)
- // || flag3.HasFlag(ErrorCheckList3.PODNG) && !Check<PODNGPolicy>(device, out reason)
- // || flag3.HasFlag(ErrorCheckList3.PODMISMATCH) && !Check<PODMISMATCHPolicy>(device, out reason)
- // || flag3.HasFlag(ErrorCheckList3.VAC_S) && !Check<VAC_SPolicy>(device, out reason)
- // || flag3.HasFlag(ErrorCheckList3.CLAMP_S) && !Check<CLAMP_SPolicy>(device, out reason)
- // || flag3.HasFlag(ErrorCheckList3.DRIVER) && !Check<DRIVERPolicy>(device, out reason)
- // || flag3.HasFlag(ErrorCheckList3.DRPOWERDOWN) && !Check<DRPOWERDOWNPolicy>(device, out reason)
- // || flag3.HasFlag(ErrorCheckList3.HARDWARE) && !Check<HARDWAREPolicy>(device, out reason)
- // || flag3.HasFlag(ErrorCheckList3.INTERNAL) && !Check<INTERNALPolicy>(device, out reason)
- // || flag3.HasFlag(ErrorCheckList3.E84_TIMEOUTx) && !Check<E84_TIMEOUTxPolicy>(device, out reason)
- // || flag3.HasFlag(ErrorCheckList3.E84_CS_VALID) && !Check<E84_CS_VALIDPolicy>(device, out reason)
- // || flag3.HasFlag(ErrorCheckList3.READFAIL) && !Check<READFAILPolicy>(device, out reason))
- if (flag1.HasFlag(ErrorCheckList1.VAC) && !Check<VacPolicy>(device, out reason)
- || flag1.HasFlag(ErrorCheckList1.AIR) && !Check<AirPolicy>(device, out reason)
- || flag1.HasFlag(ErrorCheckList1.EMS) && !Check<EMSPolicy>(device, out reason)
- )
- return false;
- reason = "UNDEFINITION";
- return true;
- }
- public bool Check<T>(string device, out string reason) where T : class, IPolicy, new()
- {
- reason = string.Empty;
- return Singleton<T>.Instance.Check(device, out reason);
- }
- //用来判断传入的字符串 符合开头/结尾/包含中间参数的情况
- protected string Args2Unit(string args)
- {
- string str = string.Empty;
- if (string.IsNullOrEmpty(args) || args.StartsWith("ALL") || args.StartsWith("SYSTEM"))
- str = "System";
- else if (args.StartsWith("ROB"))
- str = "Robot";
- else if (args.StartsWith("ALIGN"))
- {
- if (AlignerInstalled)
- str = "Aligner";
- else if (CoolingBufferInstalled)
- {
- if (args.EndsWith("ALIGN1") || args.EndsWith("ALIGN"))
- str = "CoolingBuffer1";
- else if (args.EndsWith("ALIGN2"))
- str = "CoolingBuffer2";
- else if (args.EndsWith("ALIGN3"))
- str = "Aligner1";
- else if (args.EndsWith("ALIGN4"))
- str = "Aligner2";
- }
- }
- else if (args.Equals("P1") && LoadPortQuantity > 0)
- str = "LP1";
- else if (args.Equals("P2") && LoadPortQuantity > 1)
- str = "LP2";
- else if (args.Equals("P3") && LoadPortQuantity > 2)
- str = "LP3";
- else if (args.Equals("P4") && LoadPortQuantity > 3)
- str = "LP4";
- else if (args.Equals("P5") && LoadPortQuantity > 4)
- str = "LP5";
- else if (args.Equals("P6") && LoadPortQuantity > 5)
- str = "LP6";
- else if (args.Equals("P7") && LoadPortQuantity > 6)
- str = "LP7";
- else if (args.Equals("P8") && LoadPortQuantity > 7)
- str = "LP8";
- else if (args.Equals("P9") && LoadPortQuantity > 8)
- str = "LP9";
- else if (args.Equals("P10") && LoadPortQuantity > 9)
- str = "LP10";
- else if ((args.Equals("LLA") || args.StartsWith("LLLA")) && LoadLockQuantity > 0)
- str = "LoadlockA";
- else if ((args.Equals("LLB") || args.StartsWith("LLLB")) && LoadLockQuantity > 1)
- str = "LoadlockB";
- else if (args.Equals("LLC") && LoadLockQuantity > 2)
- str = "LoadlockC";
- else if (args.Equals("LLD") && LoadLockQuantity > 3)
- str = "LoadlockD";
- else if (args.Equals("STOWER"))
- str = "SignalTower";
- return str;
- }
- //与上差不多 但会将modulename通过外部变量target传回去
- protected bool ParseMoveTarget(string args, out ModuleName target, out int slot)
- {
- target = ModuleName.System;
- slot = 1;
- if (args.StartsWith("ALIGN"))
- {
- if (AlignerInstalled)
- {
- target = ModuleName.Aligner;
- slot = 1;
- }
- else if (CoolingBufferInstalled)
- {
- if (args.EndsWith("ALIGN1") || args.EndsWith("ALIGN"))
- {
- target = ModuleName.CoolingBuffer1;
- slot = 1;
- }
- else if (args.EndsWith("ALIGN2"))
- {
- target = ModuleName.CoolingBuffer2;
- slot = 1;
- }
- else if (args.EndsWith("ALIGN3"))
- {
- target = ModuleName.Aligner1;
- slot = 1;
- }
- else if (args.EndsWith("ALIGN4"))
- {
- target = ModuleName.Aligner2;
- slot = 1;
- }
- }
- return true;
- }
- if (args.StartsWith("P1") && LoadPortQuantity > 0)
- {
- target = ModuleName.LP1;
- if (int.TryParse(args.Replace("P1", ""), out slot))
- return true;
- }
- else if (args.StartsWith("P2") && LoadPortQuantity > 1)
- {
- target = ModuleName.LP2;
- if (int.TryParse(args.Replace("P2", ""), out slot))
- return true;
- }
- else if (args.StartsWith("P3") && LoadPortQuantity > 2)
- {
- target = ModuleName.LP3;
- if (int.TryParse(args.Replace("P3", ""), out slot))
- return true;
- }
- else if (args.StartsWith("P4") && LoadPortQuantity > 3)
- {
- target = ModuleName.LP4;
- if (int.TryParse(args.Replace("P4", ""), out slot))
- return true;
- }
- if (args.StartsWith("BUFFER"))
- {
- target = ModuleName.Buffer;
- if (int.TryParse(args.Replace("BUFFER", ""), out slot))
- return true;
- }
- else if (args.StartsWith("LLLA") || args.StartsWith("LLA"))
- {
- target = ModuleName.LL1;
- string s = args.Replace("LLLA", "").Replace("LLA", "");
- if (string.IsNullOrEmpty(s))
- {
- slot = 1;
- return true;
- }
- if (int.TryParse(s, out slot))
- return true;
- }
- else if (args.StartsWith("LLLB") || args.StartsWith("LLB"))
- {
- target = ModuleName.LL2;
- string s = args.Replace("LLLB", "").Replace("LLB", "");
- if (string.IsNullOrEmpty(s))
- {
- slot = 1;
- return true;
- }
- if (int.TryParse(s, out slot))
- return true;
- }
- return false;
- }
- //与上是差不多 但目标是输出Robot的arm
- protected bool ParseMoveArm(string args, out Hand arm)
- {
- arm = Hand.Blade2;
- string str = args;
- if (!(str == "ARM1"))
- {
- if (!(str == "ARM2"))
- {
- if (!(str == "ARM3"))
- return false;
- arm = Hand.Both;
- }
- else
- arm = Hand.Blade1;
- }
- else
- arm = Hand.Blade2;
- return !RobotIsSingleArm || arm == 0;
- }
- protected bool CheckWaferSize(string waferSize, ModuleName target, int slot)
- {
- WaferSize result;
- if (!Enum.TryParse<WaferSize>(waferSize, out result))
- {
- EV.PostWarningLog("EFEM", waferSize + " is not a valid size type");
- return false;
- }
- if (ModuleHelper.IsLoadPort(target))
- {
- OpenStageWithWaferSizeLoadPort device = DEVICE.GetDevice<OpenStageWithWaferSizeLoadPort>(target.ToString());
- if (device.CassetteState == LoadportCassetteState.Normal && device.WaferSize != result)
- {
- EV.PostWarningLog("EFEM", string.Format("{0} is not match target {1}", (object)device.WaferSize, (object)result));
- return false;
- }
- }
- else if (Singleton<WaferManager>.Instance.CheckHasWafer(target, slot) && Singleton<WaferManager>.Instance.GetWaferSize(target, slot) != result)
- {
- EV.PostWarningLog("EFEM", string.Format("{0} is not match target {1}", (object)Singleton<WaferManager>.Instance.GetWaferSize(target, slot), (object)result));
- return false;
- }
- return true;
- }
- protected bool CheckIsPort(string device) => device == "LP1" || device == "LP2" || device == "LP3" || device == "LP4";
- protected bool CheckIsTower(string device) => device == "SignalTower";
- //获取实例化的Entity
- protected IServerModule GetEntity(string name)
- {
- IServerModule entity = Singleton<EntityFactory>.Instance.GetEntity(name);
- return entity.Name == "Aligner" && !AlignerInstalled ? null : entity;
- }
- }
- }
|