12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106 |
- using Aitex.Core.Common;
- using Aitex.Core.RT.Event;
- using Aitex.Sorter.Common;
- using MECF.Framework.Common.Communications;
- using MECF.Framework.Common.Device.Bases;
- using MECF.Framework.Common.Equipment;
- using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadPorts;
- using System.Collections.Generic;
- using System.Linq;
- using System.Threading.Tasks;
- using Aitex.Core.RT.Device;
- namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Efems.Rorzes
- {
- public abstract class RorzeEfemHandler : HandlerBase
- {
- public static Dictionary<string, ModuleName> ParameterModuleMap = new Dictionary<string, ModuleName>()
- {
- {"SYSTEM", ModuleName.System},
- {"System", ModuleName.System},
- {"ROB", ModuleName.EfemRobot},
- {"P1", ModuleName.LP1},
- {"P2", ModuleName.LP2},
- {"P3", ModuleName.LP3},
- {"P4", ModuleName.LP4},
- {"LLA", ModuleName.LL1},
- {"LLB", ModuleName.LL2},
- {"BF1", ModuleName.Buffer},
- {"ALIGN", ModuleName.Aligner},
- };
- public RorzeEfem Device { get; }
- public ModuleName Module
- {
- get { return _module; }
- }
- private ModuleName _module;
- private RorzeEfemMessageType _type;
- private RorzeEfemBasicMessage _basicMessage;
- private string _parameter;
- private bool _waitInfo;
- protected RorzeEfemHandler(RorzeEfem device, ModuleName module,
- RorzeEfemMessageType type, RorzeEfemBasicMessage basicMessage, string parameter, bool waitInfo)
- : base(BuildMessage(type, basicMessage, parameter))
- {
- Device = device;
- _module = module;
- _waitInfo = waitInfo;
- _basicMessage = basicMessage;
- _parameter = parameter;
- _type = type;
- }
- public static string BuildMessage(RorzeEfemMessageType type, RorzeEfemBasicMessage basicMessage, string parameter)
- {
- return string.IsNullOrEmpty(parameter) ? $"{type}:{basicMessage};\r" : $"{type}:{basicMessage}/{parameter};\r";
- }
- public override bool HandleMessage(MessageBase baseMessage, out bool transactionComplete)
- {
- transactionComplete = false;
- RorzeEfemMessage message = baseMessage as RorzeEfemMessage;
- if (!MatchMessage(message))
- return false;
- bool test = message.RawMessage.Contains("LIFT");
- if (message.MessageType == RorzeEfemMessageType.ACK)
- {
- OnAcked();
- if (!_waitInfo)
- {
- OnComplete();
- transactionComplete = true;
- }
- return true;
- }
- if (message.MessageType == RorzeEfemMessageType.INF)
- {
- transactionComplete = true;
- ProceedInfo(message);
- OnComplete();
- }
- if (message.MessageType == RorzeEfemMessageType.ABS)
- {
- transactionComplete = true;
- ProceedAbs(message);
- OnComplete();
- }
- if (message.MessageType == RorzeEfemMessageType.NAK)
- {
- transactionComplete = true;
- ProceedNak(message);
- OnComplete();
- }
- if (message.MessageType == RorzeEfemMessageType.CAN)
- {
- transactionComplete = true;
- ProceedCancel(message);
- OnComplete();
- }
- if(message.MessageType == RorzeEfemMessageType.EVT)
- {
- transactionComplete = true;
- ProceedEvent(message);
- }
- return true;
- }
- protected virtual void ProceedNak(RorzeEfemMessage message)
- {
- Device.NoteCancel(Module, $"Can not {Name}, " + RorzeEfemAbsError.GetError(message.NakFactor));
- }
- protected virtual void ProceedCancel(RorzeEfemMessage message)
- {
- Device.NoteCancel(Module, $"Can not {Name}, " + RorzeEfemAbsError.GetError(message.CanError));
- }
- protected virtual void ProceedAbs(RorzeEfemMessage message)
- {
- Device.NoteFailed(Module, $"Failed {Name}, " + RorzeEfemAbsError.GetError(message.AbsError));
- }
- protected virtual bool ProceedInfo(RorzeEfemMessage msg)
- {
- Device.NoteComplete(Module);
- return true;
- }
- protected virtual bool ProceedEvent(RorzeEfemMessage msg)
- {
- if (msg.IsEvent && ConvertParameterToModule(msg.MessagePart[2], out ModuleName target))
- {
- if(msg.MessagePart[1] == "MAPDT")
- Device.NoteWaferMapResult(target, msg.MessagePart[3]);
- else
- Device.NoteStateEvent(target, msg.MessagePart[3], msg.MessagePart[4]);
- }
- return true;
- }
- protected bool MatchMessage(RorzeEfemMessage msg)
- {
- if (msg.BasicMessage != _basicMessage || !msg.Parameter.Contains(_parameter))
- return false;
- return true;
- }
- public static string ConvertModuleToParameter(ModuleName module)
- {
- if (ParameterModuleMap.Values.Contains(module))
- {
- foreach (var moduleName in ParameterModuleMap)
- {
- if (moduleName.Value == module)
- return moduleName.Key;
- }
- }
- return "";
- }
- public static bool ConvertParameterToModule(string parameter, out ModuleName module)
- {
- if (ParameterModuleMap.ContainsKey(parameter))
- {
- module = ParameterModuleMap[parameter];
- return true;
- }
- module = ModuleName.System;
- return false;
- }
- }
- //READY
- public class RorzeEfemHandlerReady : RorzeEfemHandler
- {
- public RorzeEfemHandlerReady(RorzeEfem device, ModuleName module)
- : base(device, module, RorzeEfemMessageType.MOV, RorzeEfemBasicMessage.READY, ConvertModuleToParameter(module), true)
- {
- Name = $"Ready {module}";
- MutexId = -1;
- }
-
- public override bool HandleMessage(MessageBase baseMessage, out bool transactionComplete)
- {
- Device.NoteCommunicationReady();
- transactionComplete = true;
- return true;
- }
- }
- //INIT
- public class RorzeEfemHandlerInit : RorzeEfemHandler
- {
- public RorzeEfemHandlerInit(RorzeEfem device, ModuleName module)
- : base(device, module, RorzeEfemMessageType.MOV, RorzeEfemBasicMessage.INIT, ConvertModuleToParameter(module), true)
- {
- Name = $"Initialize {module}";
- MutexId = (int)module;
- }
- protected override bool ProceedInfo(RorzeEfemMessage msg)
- {
- if (Module == ModuleName.System)
- Device.NoteInitialized();
- Device.NoteComplete(Module);
- return true;
- }
- }
- //ORGSH
- public class RorzeEfemHandlerOrgsh : RorzeEfemHandler
- {
- public RorzeEfemHandlerOrgsh(RorzeEfem device, ModuleName module)
- : base(device, module, RorzeEfemMessageType.MOV, RorzeEfemBasicMessage.ORGSH, ConvertModuleToParameter(module), true)
- {
- Name = $"Home {module}";
- MutexId = (int)module;
- }
- public override bool HandleMessage(MessageBase baseMessage, out bool transactionComplete)
- {
- return base.HandleMessage(baseMessage, out transactionComplete);
- }
- }
- //LOCK
- public class RorzeEfemHandlerLock : RorzeEfemHandler
- {
- public RorzeEfemHandlerLock(RorzeEfem device, ModuleName module)
- : base(device, module, RorzeEfemMessageType.MOV, RorzeEfemBasicMessage.LOCK, ConvertModuleToParameter(module), true)
- {
- Name = RorzeEfemBasicMessage.LOCK.ToString();
- MutexId = (int)module;
- }
- public override bool HandleMessage(MessageBase baseMessage, out bool transactionComplete)
- {
- return base.HandleMessage(baseMessage, out transactionComplete);
- }
- }
- //UNLOCK
- public class RorzeEfemHandlerUnlock : RorzeEfemHandler
- {
- public RorzeEfemHandlerUnlock(RorzeEfem device, ModuleName module)
- : base(device, module, RorzeEfemMessageType.MOV, RorzeEfemBasicMessage.UNLOCK, ConvertModuleToParameter(module), true)
- {
- Name = RorzeEfemBasicMessage.UNLOCK.ToString();
- MutexId = (int)module;
- }
- public override bool HandleMessage(MessageBase baseMessage, out bool transactionComplete)
- {
- return base.HandleMessage(baseMessage, out transactionComplete);
- }
- }
- //DOCK
- public class RorzeEfemHandlerDock : RorzeEfemHandler
- {
- public RorzeEfemHandlerDock(RorzeEfem device, ModuleName module)
- : base(device, module, RorzeEfemMessageType.MOV, RorzeEfemBasicMessage.DOCK, ConvertModuleToParameter(module), true)
- {
- Name = RorzeEfemBasicMessage.DOCK.ToString();
- MutexId = (int)module;
- }
- public override bool HandleMessage(MessageBase baseMessage, out bool transactionComplete)
- {
- return base.HandleMessage(baseMessage, out transactionComplete);
- }
- }
- //UNDOCK
- public class RorzeEfemHandlerUndock : RorzeEfemHandler
- {
- public RorzeEfemHandlerUndock(RorzeEfem device, ModuleName module)
- : base(device, module, RorzeEfemMessageType.MOV, RorzeEfemBasicMessage.UNDOCK, ConvertModuleToParameter(module), true)
- {
- Name = RorzeEfemBasicMessage.UNDOCK.ToString();
- MutexId = (int)module;
- }
- public override bool HandleMessage(MessageBase baseMessage, out bool transactionComplete)
- {
- return base.HandleMessage(baseMessage, out transactionComplete);
- }
- }
- //OPEN
- public class RorzeEfemHandlerOpen : RorzeEfemHandler
- {
- public RorzeEfemHandlerOpen(RorzeEfem device, ModuleName module)
- : base(device, module, RorzeEfemMessageType.MOV, RorzeEfemBasicMessage.OPEN, ConvertModuleToParameter(module), true)
- {
- Name = RorzeEfemBasicMessage.OPEN.ToString();
- MutexId = (int)module;
- }
- public override bool HandleMessage(MessageBase baseMessage, out bool transactionComplete)
- {
- return base.HandleMessage(baseMessage, out transactionComplete);
- }
- }
- //CLOSE
- public class RorzeEfemHandlerClose : RorzeEfemHandler
- {
- public RorzeEfemHandlerClose(RorzeEfem device, ModuleName module)
- : base(device, module, RorzeEfemMessageType.MOV, RorzeEfemBasicMessage.CLOSE, ConvertModuleToParameter(module), true)
- {
- Name = RorzeEfemBasicMessage.CLOSE.ToString();
- MutexId = (int)module;
- }
- public override bool HandleMessage(MessageBase baseMessage, out bool transactionComplete)
- {
- return base.HandleMessage(baseMessage, out transactionComplete);
- }
- }
- //WAFSH
- public class RorzeEfemHandlerWafsh : RorzeEfemHandler
- {
- public RorzeEfemHandlerWafsh(RorzeEfem device, ModuleName target, bool mapByRobot)
- : base(device, mapByRobot ? ModuleName.EfemRobot : target, RorzeEfemMessageType.MOV, RorzeEfemBasicMessage.WAFSH, ConvertModuleToParameter(target), true)
- {
- Name = $"Map wafer of {target}";
- MutexId = mapByRobot ? (int)ModuleName.EfemRobot : (int)target;
- }
- public RorzeEfemHandlerWafsh(RorzeEfem device, ModuleName target, bool mapByRobot, int thicknessIndex)
- : base(device, mapByRobot ? ModuleName.EfemRobot : target, RorzeEfemMessageType.MOV, RorzeEfemBasicMessage.WAFSH, BuildParameter(target, thicknessIndex), true)
- {
- Name = $"Map wafer of {target}";
- MutexId = mapByRobot ? (int)ModuleName.EfemRobot : (int)target;
- }
- public static string BuildParameter(ModuleName target, int thicknessIndex)
- {
- string para1 = ConvertModuleToParameter(target);
- return $"{para1}/{thicknessIndex}";
- }
- public override bool HandleMessage(MessageBase baseMessage, out bool transactionComplete)
- {
- return base.HandleMessage(baseMessage, out transactionComplete);
- }
- }
- //MAPDT
- public class RorzeEfemHandlerMapdt : RorzeEfemHandler
- {
- private ModuleName _target;
- public RorzeEfemHandlerMapdt(RorzeEfem device, ModuleName target, bool mapByRobot)
- : base(device, mapByRobot ? ModuleName.EfemRobot : target, RorzeEfemMessageType.GET, RorzeEfemBasicMessage.MAPDT, ConvertModuleToParameter(target), true)
- {
- Name = $"Get wafer map result of {target}";
- _target = target;
- MutexId = mapByRobot ? (int)ModuleName.EfemRobot : (int)target;
- }
- protected override bool ProceedInfo(RorzeEfemMessage msg)
- {
- if (ConvertParameterToModule(msg.MessagePart[2], out ModuleName target))
- {
- Device.NoteWaferMapResult(target, msg.MessagePart[3]);
- }
- if (!msg.IsEvent)
- {
- Device.NoteComplete(Module);
- }
- return true;
- }
- public override bool HandleMessage(MessageBase baseMessage, out bool transactionComplete)
- {
- return base.HandleMessage(baseMessage, out transactionComplete);
- }
- }
- //GOTO
- public class RorzeEfemHandlerGoto : RorzeEfemHandler
- {
- public RorzeEfemHandlerGoto(RorzeEfem device, ModuleName target, int slot, Hand blade, bool isPick)
- : base(device, ModuleName.EfemRobot, RorzeEfemMessageType.MOV, RorzeEfemBasicMessage.GOTO, BuildParameter(target, slot, blade, isPick), true)
- {
- Name = $"Goto from {target} slot {slot + 1}";
- MutexId = (int)ModuleName.EfemRobot;
- }
- public static string BuildParameter(ModuleName target, int slot, Hand blade, bool isPick)
- {
- string para1 = ConvertModuleToParameter(target);
- string para2 = blade == Hand.Blade1 ? "ARM2" : (blade == Hand.Blade2 ? "ARM1" : "ARM3");
- string para3 = isPick ? "DOWN":"UP";
- return $"{para1}{slot + 1:D2}/{para2}/{para3}";
- }
- public override bool HandleMessage(MessageBase baseMessage, out bool transactionComplete)
- {
- return base.HandleMessage(baseMessage, out transactionComplete);
- }
- }
- //LOAD
- public class RorzeEfemHandlerLoad : RorzeEfemHandler
- {
- public RorzeEfemHandlerLoad(RorzeEfem device, ModuleName target, int slot, Hand blade, WaferSize waferSize)
- : base(device, ModuleName.EfemRobot, RorzeEfemMessageType.MOV, RorzeEfemBasicMessage.LOAD, BuildParameter(target, slot, blade, waferSize), true)
- {
- Name = $"Pick from {target} slot {slot + 1}";
- MutexId = (int)ModuleName.EfemRobot;
- }
- public static string BuildParameter(ModuleName target, int slot, Hand blade, WaferSize waferSize)
- {
- string para1 = ConvertModuleToParameter(target);
- string para2 = blade == Hand.Blade1 ? "ARM2" : (blade == Hand.Blade2 ? "ARM1" : "ARM3");
- string para3 = waferSize.ToString();
- if (ModuleHelper.IsAligner(target)|| ModuleHelper.IsCooling(target))
- {
- return $"{para1}/{para2}/{para3}";
- }
- return $"{para1}{slot + 1:D2}/{para2}/{para3}";
- }
- public override bool HandleMessage(MessageBase baseMessage, out bool transactionComplete)
- {
- return base.HandleMessage(baseMessage, out transactionComplete);
- }
- }
- //UNLOAD
- public class RorzeEfemHandlerUnload : RorzeEfemHandler
- {
- public RorzeEfemHandlerUnload(RorzeEfem device, ModuleName target, int slot, Hand blade, WaferSize waferSize)
- : base(device, ModuleName.EfemRobot, RorzeEfemMessageType.MOV, RorzeEfemBasicMessage.UNLOAD, BuildParameter(target, slot, blade, waferSize), true)
- {
- Name = $"Place to {target} slot {slot + 1}";
- MutexId = (int)ModuleName.EfemRobot;
- }
- public static string BuildParameter(ModuleName target, int slot, Hand blade, WaferSize waferSize)
- {
- string para1 = ConvertModuleToParameter(target);
- string para2 = blade == Hand.Blade1 ? "ARM2" : (blade == Hand.Blade2 ? "ARM1" : "ARM3");
- string para3 = waferSize.ToString();
- if (ModuleHelper.IsAligner(target) || ModuleHelper.IsCooling(target))
- {
- return $"{para1}/{para2}/{para3}";
- }
- return $"{para1}{slot + 1:D2}/{para2}/{para3}";
- }
- public override bool HandleMessage(MessageBase baseMessage, out bool transactionComplete)
- {
- return base.HandleMessage(baseMessage, out transactionComplete);
- }
- }
- //Grip
- public class RorzeEfemHandlerGrip : RorzeEfemHandler
- {
- public RorzeEfemHandlerGrip(RorzeEfem device, Hand blade, bool isGrip)
- : base(device, ModuleName.EfemRobot, RorzeEfemMessageType.SET, RorzeEfemBasicMessage.CLAMP, BuildParameter(blade, isGrip), true)
- {
- Name = $" EfemRobot {blade} Grip";
- MutexId = (int)ModuleName.EfemRobot;
- }
- public static string BuildParameter(Hand blade, bool isGrip)
- {
- string para1 = isGrip ? "ON" : "OFF";
- string para2 = blade == Hand.Blade1 ? "ARM2" : (blade == Hand.Blade2 ? "ARM1" : "ARM3");
-
- return $"{para2}/{para1}";
- }
- public override bool HandleMessage(MessageBase baseMessage, out bool transactionComplete)
- {
- return base.HandleMessage(baseMessage, out transactionComplete);
- }
- }
- //TRANS
- public class RorzeEfemHandlerTrans : RorzeEfemHandler
- {
- public RorzeEfemHandlerTrans(RorzeEfem device, ModuleName module)
- : base(device, module, RorzeEfemMessageType.MOV, RorzeEfemBasicMessage.TRANS, ConvertModuleToParameter(module), true)
- {
- Name = RorzeEfemBasicMessage.TRANS.ToString();
- MutexId = (int)ModuleName.EfemRobot;
- }
- public override bool HandleMessage(MessageBase baseMessage, out bool transactionComplete)
- {
- return base.HandleMessage(baseMessage, out transactionComplete);
- }
- }
- //CHANGE
- public class RorzeEfemHandlerChange : RorzeEfemHandler
- {
- public RorzeEfemHandlerChange(RorzeEfem device, ModuleName module)
- : base(device, module, RorzeEfemMessageType.MOV, RorzeEfemBasicMessage.CHANGE, ConvertModuleToParameter(module), true)
- {
- Name = RorzeEfemBasicMessage.CHANGE.ToString();
- MutexId = (int)ModuleName.EfemRobot;
- }
- public override bool HandleMessage(MessageBase baseMessage, out bool transactionComplete)
- {
- return base.HandleMessage(baseMessage, out transactionComplete);
- }
- }
- //ALIGN
- public class RorzeEfemHandlerAlign : RorzeEfemHandler
- {
- public RorzeEfemHandlerAlign(RorzeEfem device, ModuleName module, double angle)
- : base(device, module, RorzeEfemMessageType.MOV, RorzeEfemBasicMessage.ALIGN, $"A{angle.ToString("F1")}", true)
- {
- Name = RorzeEfemBasicMessage.ALIGN.ToString();
- MutexId = (int)ModuleName.Aligner;
- }
- public override bool HandleMessage(MessageBase baseMessage, out bool transactionComplete)
- {
- return base.HandleMessage(baseMessage, out transactionComplete);
- }
- }
- //LIFT
- public class RorzeEfemHandlerLift : RorzeEfemHandler
- {
- public RorzeEfemHandlerLift(RorzeEfem device, ModuleName module, string Position)
- : base(device, module, RorzeEfemMessageType.MOV, RorzeEfemBasicMessage.LIFT, $"{ConvertModuleToParameter(module)}/{Position}", true)
- {
- Name = RorzeEfemBasicMessage.LIFT.ToString();
- MutexId = (int)module;
- }
- public override bool HandleMessage(MessageBase baseMessage, out bool transactionComplete)
- {
- return base.HandleMessage(baseMessage, out transactionComplete);
- }
- }
- //HOME
- public class RorzeEfemHandlerHome : RorzeEfemHandler
- {
- public RorzeEfemHandlerHome(RorzeEfem device, ModuleName module)
- : base(device, module, RorzeEfemMessageType.MOV, RorzeEfemBasicMessage.HOME, ConvertModuleToParameter(module), true)
- {
- Name = RorzeEfemBasicMessage.HOME.ToString();
- MutexId = (int)module;
- }
- }
- //HOLD
- public class RorzeEfemHandlerHold : RorzeEfemHandler
- {
- public RorzeEfemHandlerHold(RorzeEfem device, ModuleName module)
- : base(device, module, RorzeEfemMessageType.MOV, RorzeEfemBasicMessage.HOLD, ConvertModuleToParameter(module), true)
- {
- Name = RorzeEfemBasicMessage.HOLD.ToString();
- MutexId = (int)module;
- }
- public override bool HandleMessage(MessageBase baseMessage, out bool transactionComplete)
- {
- return base.HandleMessage(baseMessage, out transactionComplete);
- }
- }
- //RESTR
- public class RorzeEfemHandlerRestr : RorzeEfemHandler
- {
- public RorzeEfemHandlerRestr(RorzeEfem device, ModuleName module)
- : base(device, module, RorzeEfemMessageType.MOV, RorzeEfemBasicMessage.RESTR, ConvertModuleToParameter(module), false)
- {
- Name = RorzeEfemBasicMessage.RESTR.ToString();
- }
- public override bool HandleMessage(MessageBase baseMessage, out bool transactionComplete)
- {
- return base.HandleMessage(baseMessage, out transactionComplete);
- }
- }
- //ABORT
- public class RorzeEfemHandlerAbort : RorzeEfemHandler
- {
- public RorzeEfemHandlerAbort(RorzeEfem device, ModuleName module)
- : base(device, module, RorzeEfemMessageType.MOV, RorzeEfemBasicMessage.ABORT, ConvertModuleToParameter(module), true)
- {
- Name = RorzeEfemBasicMessage.ABORT.ToString();
- MutexId = (int)module;
- }
- public override bool HandleMessage(MessageBase baseMessage, out bool transactionComplete)
- {
- return base.HandleMessage(baseMessage, out transactionComplete);
- }
- }
- //EMS
- public class RorzeEfemHandlerEms : RorzeEfemHandler
- {
- public RorzeEfemHandlerEms(RorzeEfem device, ModuleName module)
- : base(device, module, RorzeEfemMessageType.MOV, RorzeEfemBasicMessage.EMS, ConvertModuleToParameter(module), true)
- {
- Name = RorzeEfemBasicMessage.EMS.ToString();
- MutexId = (int)module;
- }
- public override bool HandleMessage(MessageBase baseMessage, out bool transactionComplete)
- {
- return base.HandleMessage(baseMessage, out transactionComplete);
- }
- }
- //ERROR
- public class RorzeEfemHandlerError : RorzeEfemHandler
- {
- public RorzeEfemHandlerError(RorzeEfem device, bool isQuery)
- : base(device, ModuleName.System, isQuery ? RorzeEfemMessageType.GET : RorzeEfemMessageType.SET, RorzeEfemBasicMessage.ERROR, isQuery ? "" : "CLEAR", isQuery)
- {
- Name = RorzeEfemBasicMessage.ERROR.ToString();
- }
- public override bool HandleMessage(MessageBase baseMessage, out bool transactionComplete)
- {
- return base.HandleMessage(baseMessage, out transactionComplete);
- }
- }
- //CLAMP
- public class RorzeEfemHandlerClamp : RorzeEfemHandler
- {
- public RorzeEfemHandlerClamp(RorzeEfem device, ModuleName module)
- : base(device, module, RorzeEfemMessageType.GET, RorzeEfemBasicMessage.CLAMP, ConvertModuleToParameter(module), true)
- {
- Name = RorzeEfemBasicMessage.CLAMP.ToString();
- MutexId = (int)module;
- }
- public override bool HandleMessage(MessageBase baseMessage, out bool transactionComplete)
- {
- return base.HandleMessage(baseMessage, out transactionComplete);
- }
- }
- //STATE
- public class RorzeEfemHandlerState : RorzeEfemHandler
- {
- private RorzeEfemStateType _state;
- public RorzeEfemHandlerState(RorzeEfem device, RorzeEfemStateType state)
- : base(device, ModuleName.System, RorzeEfemMessageType.GET, RorzeEfemBasicMessage.STATE, state.ToString(), true)
- {
- Name = "Query State";
- _state = state;
- MutexId = (int)ModuleName.System;
- }
- protected override bool ProceedInfo(RorzeEfemMessage msg)
- {
- if (_state == RorzeEfemStateType.TRACK)
- {
- Device.NoteWaferTrack(msg.MessagePart[3]);
- }
- //Device.NoteComplete(Module);
- return true;
- }
- }
- //LED
- public class RorzeEfemHandlerLed : RorzeEfemHandler
- {
- public RorzeEfemHandlerLed(RorzeEfem device, ModuleName module)
- : base(device, module, RorzeEfemMessageType.GET, RorzeEfemBasicMessage.LED, ConvertModuleToParameter(module), true)
- {
- Name = RorzeEfemBasicMessage.LED.ToString();
- }
- public override bool HandleMessage(MessageBase baseMessage, out bool transactionComplete)
- {
- return base.HandleMessage(baseMessage, out transactionComplete);
- }
- }
- //WORKCHK
- public class RorzeEfemHandlerWorkChk : RorzeEfemHandler
- {
- public RorzeEfemHandlerWorkChk(RorzeEfem device, ModuleName module)
- : base(device, module, RorzeEfemMessageType.MOV, RorzeEfemBasicMessage.WORKCHK, ConvertModuleToParameter(module), true)
- {
- Name = RorzeEfemBasicMessage.WORKCHK.ToString();
- }
- public override bool HandleMessage(MessageBase baseMessage, out bool transactionComplete)
- {
- return base.HandleMessage(baseMessage, out transactionComplete);
- }
- }
- //FFU
- public class RorzeEfemHandlerFfu : RorzeEfemHandler
- {
- public RorzeEfemHandlerFfu(RorzeEfem device, ModuleName module)
- : base(device, module, RorzeEfemMessageType.MOV, RorzeEfemBasicMessage.FFU, ConvertModuleToParameter(module), true)
- {
- Name = RorzeEfemBasicMessage.FFU.ToString();
- MutexId = (int)module;
- }
- public override bool HandleMessage(MessageBase baseMessage, out bool transactionComplete)
- {
- return base.HandleMessage(baseMessage, out transactionComplete);
- }
- }
- //WTYPE
- public class RorzeEfemHandlerWType : RorzeEfemHandler
- {
- public RorzeEfemHandlerWType(RorzeEfem device, ModuleName module)
- : base(device, module, RorzeEfemMessageType.GET, RorzeEfemBasicMessage.WTYPE, ConvertModuleToParameter(module), true)
- {
- Name = RorzeEfemBasicMessage.WTYPE.ToString();
- }
- public override bool HandleMessage(MessageBase baseMessage, out bool transactionComplete)
- {
- return base.HandleMessage(baseMessage, out transactionComplete);
- }
- }
- //PURGE
- public class RorzeEfemHandlerPurge : RorzeEfemHandler
- {
- public RorzeEfemHandlerPurge(RorzeEfem device, ModuleName module)
- : base(device, module, RorzeEfemMessageType.GET, RorzeEfemBasicMessage.PURGE, ConvertModuleToParameter(module), true)
- {
- Name = RorzeEfemBasicMessage.PURGE.ToString();
- }
- public override bool HandleMessage(MessageBase baseMessage, out bool transactionComplete)
- {
- return base.HandleMessage(baseMessage, out transactionComplete);
- }
- }
- //ADPLOCK
- public class RorzeEfemHandlerAdpLock : RorzeEfemHandler
- {
- public RorzeEfemHandlerAdpLock(RorzeEfem device, ModuleName module)
- : base(device, module, RorzeEfemMessageType.MOV, RorzeEfemBasicMessage.ADPLOCK, ConvertModuleToParameter(module), true)
- {
- Name = RorzeEfemBasicMessage.ADPLOCK.ToString();
- }
- public override bool HandleMessage(MessageBase baseMessage, out bool transactionComplete)
- {
- return base.HandleMessage(baseMessage, out transactionComplete);
- }
- }
- //ADPUNLOCK
- public class RorzeEfemHandlerAdpUnlock : RorzeEfemHandler
- {
- public RorzeEfemHandlerAdpUnlock(RorzeEfem device, ModuleName module)
- : base(device, module, RorzeEfemMessageType.MOV, RorzeEfemBasicMessage.ADPUNLOCK, ConvertModuleToParameter(module), true)
- {
- Name = RorzeEfemBasicMessage.ADPUNLOCK.ToString();
- }
- public override bool HandleMessage(MessageBase baseMessage, out bool transactionComplete)
- {
- return base.HandleMessage(baseMessage, out transactionComplete);
- }
- }
- //MODE
- public class RorzeEfemHandlerMode : RorzeEfemHandler
- {
- public RorzeEfemHandlerMode(RorzeEfem device, ModuleName module)
- : base(device, module, RorzeEfemMessageType.GET, RorzeEfemBasicMessage.MODE, ConvertModuleToParameter(module), true)
- {
- Name = RorzeEfemBasicMessage.MODE.ToString();
- MutexId = (int)module;
- }
- public override bool HandleMessage(MessageBase baseMessage, out bool transactionComplete)
- {
- return base.HandleMessage(baseMessage, out transactionComplete);
- }
- }
- //TRANSREQ
- public class RorzeEfemHandlerTransReq : RorzeEfemHandler
- {
- public RorzeEfemHandlerTransReq(RorzeEfem device, ModuleName module)
- : base(device, module, RorzeEfemMessageType.MOV, RorzeEfemBasicMessage.TRANSREQ, ConvertModuleToParameter(module), true)
- {
- Name = RorzeEfemBasicMessage.TRANSREQ.ToString();
- MutexId = (int)module;
- }
- public override bool HandleMessage(MessageBase baseMessage, out bool transactionComplete)
- {
- return base.HandleMessage(baseMessage, out transactionComplete);
- }
- }
- //SIGOUT
- public class RorzeEfemHandlerSigout : RorzeEfemHandler
- {
- public RorzeEfemHandlerSigout(RorzeEfem device, ModuleName module, IndicatorType type, IndicatorState state)
- : base(device, module, RorzeEfemMessageType.SET, RorzeEfemBasicMessage.SIGOUT, BuildParameter(module, type, state), false)
- {
- Name = $"Set Signal Tower";
- MutexId = -1;
- }
- public RorzeEfemHandlerSigout(RorzeEfem device, ModuleName module, LightType type, TowerLightStatus state)
- : base(device, module, RorzeEfemMessageType.SET, RorzeEfemBasicMessage.SIGOUT, BuildParameter(module, type, state), false)
- {
- Name = $"Set Signal Tower";
- MutexId = -1;
- }
- public static string BuildParameter(ModuleName target, IndicatorType type, IndicatorState state)
- {
- Dictionary<IndicatorType, string> mapLightType = new Dictionary<IndicatorType, string>()
- {
- {IndicatorType.AccessAuto, "AUTO"},
- {IndicatorType.AccessManual, "MANUAL"},
- {IndicatorType.Load, "LOAD"},
- {IndicatorType.Unload, "UNLOAD"},
- {IndicatorType.Presence, "PRESENCE"},
- {IndicatorType.Placement, "PLACEMENT"},
- {IndicatorType.Error, "ERROR"},
- {IndicatorType.Busy, "BUSY"},
- {IndicatorType.Complete, "COMPLETE"},
- };
- Dictionary<IndicatorState, string> mapLightState = new Dictionary<IndicatorState, string>()
- {
- {IndicatorState.ON, "ON"},
- {IndicatorState.OFF, "OFF"},
- {IndicatorState.BLINK, "BLINK"},
- };
- string par1 = ConvertModuleToParameter(target);
- string par2 = mapLightType[type];
- string par3 = mapLightState[state];
- return $"{par1}/{par2}/{par3}";
- }
- public static string BuildParameter(ModuleName target, LightType type, TowerLightStatus state)
- {
- if (type == LightType.Buzzer)
- {
- type = state == TowerLightStatus.Blinking ? LightType.Buzzer2 : LightType.Buzzer1;
- state = state == TowerLightStatus.Off ? TowerLightStatus.Off : TowerLightStatus.On;
- }
- Dictionary<LightType, string> mapLightType = new Dictionary<LightType, string>()
- {
- {LightType.Red, "RED"},
- {LightType.Yellow, "YELLOW"},
- {LightType.Green, "GREEN"},
- {LightType.Blue, "BLUE"},
- {LightType.White, "WHITE"},
- {LightType.Buzzer1, "BUZZER1"},
- {LightType.Buzzer2, "BUZZER2"},
- };
- Dictionary<TowerLightStatus, string> mapLightState = new Dictionary<TowerLightStatus, string>()
- {
- {TowerLightStatus.On, "ON"},
- {TowerLightStatus.Off, "OFF"},
- {TowerLightStatus.Blinking, "BLINK"},
- };
- string par1 = "STOWER";
- string par2 = mapLightType[type];
- string par3 = mapLightState[state];
- return $"{par1}/{par2}/{par3}";
- }
- public override bool HandleMessage(MessageBase baseMessage, out bool transactionComplete)
- {
- return base.HandleMessage(baseMessage, out transactionComplete);
- }
- protected override bool ProceedInfo(RorzeEfemMessage msg)
- {
- return true;
- }
- }
- /// <summary>
- /// SIGSTAT
- /// EVT:/SIGSTAT/PARAMETER/DATA1/DATA2
- /// </summary>
- public class RorzeEfemHandlerSigStat : RorzeEfemHandler
- {
- public RorzeEfemHandlerSigStat(RorzeEfem device, ModuleName module)
- : base(device, module, RorzeEfemMessageType.GET, RorzeEfemBasicMessage.SIGSTAT, ConvertModuleToParameter(module), true)
- {
- Name = RorzeEfemBasicMessage.SIGSTAT.ToString();
- MutexId = (int)module;
- }
- public override bool HandleMessage(MessageBase baseMessage, out bool transactionComplete)
- {
- if (baseMessage.IsEvent)
- {
- var msg = baseMessage as RorzeEfemMessage;
- if (!ConvertParameterToModule(msg.MessagePart[2], out ModuleName module))
- {
- EV.PostWarningLog(Device.Module, $"Parameter unrecognized, {msg.RawMessage}");
- }
- else
- {
- Task.Delay(1000).ContinueWith(x=> Device.NoteStateEvent(module, msg.MessagePart[3], msg.MessagePart[4]));
- }
- transactionComplete = true;
- return true;
- }
- return base.HandleMessage(baseMessage, out transactionComplete);
- }
- protected override bool ProceedInfo(RorzeEfemMessage msg)
- {
- if (ConvertParameterToModule(msg.MessagePart[2], out ModuleName target))
- {
- Task.Delay(1000).ContinueWith(x => Device.NoteStateEvent(target, msg.MessagePart[3], msg.MessagePart[4]));
- }
- if (!msg.IsEvent && ModuleHelper.IsLoadPort(Module))
- {
- Device.NoteComplete(Module);
- }
- return true;
- }
- }
- //CSTID
- public class RorzeEfemHandlerReadCstid : RorzeEfemHandler
- {
- public RorzeEfemHandlerReadCstid(RorzeEfem device, ModuleName module)
- : base(device, module, RorzeEfemMessageType.GET, RorzeEfemBasicMessage.CSTID, ConvertModuleToParameter(module), true)
- {
- Name = RorzeEfemBasicMessage.CSTID.ToString();
- MutexId = (int)module;
- }
- public override bool HandleMessage(MessageBase baseMessage, out bool transactionComplete)
- {
- return base.HandleMessage(baseMessage, out transactionComplete);
- }
- protected override bool ProceedInfo(RorzeEfemMessage msg)
- {
- if (ConvertParameterToModule(msg.MessagePart[2], out ModuleName target))
- {
- Device.NoteCarrierIDReadResult(target, string.Join(":", msg.MessagePart.Skip(3)));
- }
- if (!msg.IsEvent)
- {
- Device.NoteComplete(Module);
- }
- return true;
- }
- }
- public class RorzeEfemHandlerSetCstid : RorzeEfemHandler
- {
- public RorzeEfemHandlerSetCstid(RorzeEfem device, ModuleName module,string cstid)
- : base(device, module, RorzeEfemMessageType.SET, RorzeEfemBasicMessage.CSTID, $"{ConvertModuleToParameter(module)}/{cstid}", true)
- {
- Name = RorzeEfemBasicMessage.CSTID.ToString();
- MutexId = (int)module;
- }
- public override bool HandleMessage(MessageBase baseMessage, out bool transactionComplete)
- {
- return base.HandleMessage(baseMessage, out transactionComplete);
- }
- protected override bool ProceedInfo(RorzeEfemMessage msg)
- {
- if (ConvertParameterToModule(msg.MessagePart[2], out ModuleName target))
- {
- Device.NoteWRITETAGResult(target, string.Join(":", msg.MessagePart.Skip(3)));
- }
- if (!msg.IsEvent)
- {
- Device.NoteComplete(Module);
- }
- return true;
- }
- }
- //EVENT
- public class RorzeEfemHandlerEvent : RorzeEfemHandler
- {
- public RorzeEfemHandlerEvent(RorzeEfem device, ModuleName module, bool isSet = true)
- : base(device, module, isSet ? RorzeEfemMessageType.SET : RorzeEfemMessageType.GET, RorzeEfemBasicMessage.EVENT, ConvertModuleToParameter(module), true)
- {
- Name = RorzeEfemBasicMessage.EVENT.ToString();
- MutexId = (int)module;
- }
- public override bool HandleMessage(MessageBase baseMessage, out bool transactionComplete)
- {
- return base.HandleMessage(baseMessage, out transactionComplete);
- }
- }
- public class RorzeEfemHandlerGetMode : RorzeEfemHandler
- {
- public RorzeEfemHandlerGetMode(RorzeEfem device, ModuleName module) :
- base(device, module, RorzeEfemMessageType.GET, RorzeEfemBasicMessage.MODE, ConvertModuleToParameter(module), true)
- {
- Name = RorzeEfemBasicMessage.MODE.ToString();
- MutexId = (int)module;
- }
- public override bool HandleMessage(MessageBase baseMessage, out bool transactionComplete)
- {
- return base.HandleMessage(baseMessage, out transactionComplete);
- }
- protected override bool ProceedInfo(RorzeEfemMessage msg)
- {
- if (ConvertParameterToModule(msg.MessagePart[2], out ModuleName target))
- {
- Device.LoadPortAccessMode(target, string.Join(":", msg.MessagePart.Skip(3)));
- }
- if (!msg.IsEvent)
- {
- Device.NoteComplete(Module);
- }
- return true;
- }
- }
- public class RorzeEfemHandlerSetMode : RorzeEfemHandler
- {
- public RorzeEfemHandlerSetMode(RorzeEfem device, ModuleName module,string mode) :
- base(device, module, RorzeEfemMessageType.SET, RorzeEfemBasicMessage.MODE, $"{ConvertModuleToParameter(module)}/{mode}", false)
- {
- Name = RorzeEfemBasicMessage.MODE.ToString();
- MutexId = (int)module;
- }
- public override bool HandleMessage(MessageBase baseMessage, out bool transactionComplete)
- {
- bool result= base.HandleMessage(baseMessage, out transactionComplete);
- if(result)
- {
- Device.WriteLoadPortAccessSuccess(this.Module);
- }
- return result;
- }
- protected override bool ProceedInfo(RorzeEfemMessage msg)
- {
- return true;
- }
- }
- }
|