123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076 |
- using Aitex.Core.Common;
- using Aitex.Core.RT.DataCenter;
- using Aitex.Core.RT.Device;
- using Aitex.Core.RT.Device.Unit;
- using Aitex.Core.RT.Event;
- using Aitex.Core.RT.OperationCenter;
- using Aitex.Core.RT.SCCore;
- using Aitex.Core.Util;
- using Aitex.Sorter.Common;
- using MECF.Framework.Common.Equipment;
- using MECF.Framework.Common.SubstrateTrackings;
- using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.CarrierIdReaders.CarrierIDReaderBase;
- using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadPorts.TDK;
- using System;
- using System.Collections.Generic;
- using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadPorts.LoadPortBase;
- using static Aitex.Core.RT.Device.Unit.IOE84Passive;
- namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadPorts
- {
- public enum IndicatorType
- {
- Load,
- Unload,
- Presence,
- Placement,
- Alarm,
- AccessManual,
- AccessAuto,
- Status1,
- Status2,
- Manual,
- Auto,
- Reserve,
- Error,
- Access,
- Busy,
- Complete,
- }
- public enum E84PioPosition
- {
- Floor = 0,
- Middle = 1,
- Overhead = 2
- }
- public enum E84PioSignalAtoP
- {
- VALID = 1,
- CS_0 = 2,
- CS_1 = 3,
- TR_REQ = 4,
- BUSY = 5,
- COMPT = 6,
- CONT = 7,
- AM_AVBL = 8
- }
- public enum E84PioSignalPtoA
- {
- L_REQ = 11,
- U_REQ = 12,
- READY = 13,
- HO_AVBL = 14,
- ES = 15,
- VA = 16,
- VS_0 = 17,
- VS_1 = 18
- }
- public interface IE87CallBack
- {
- void CarrierArrive();
- void CarrerRemove(string carrierID);
- void CarrierIDReadSuccess(string carrierID);
- void CarrierIDReadFail();
- void MappingComplete(string carrierID, string slotmap);
- void LoadStart();
- void LoadportError(string errorcode);
- void LoadComplete();
- void UnLoadStart();
- void UnloadComplete();
- void OnLPHomed();
- void OnE84HandoffStart(bool isload);
- void OnE84HandoffComplete(bool isload);
- }
- public interface IE84CallBack
- {
- void SetHoAutoControl(bool value);
- void SetHoAvailable(bool value);
- void SetE84SignalState(E84PassiveSignal signal, bool value);
- bool GetE84SignalState(E84SignalID signal);
- void SetFoupStatus(bool foupon);
- void SetReadyTransferStatus(bool ready);
- E84State GetCurrentE84State();
- void Stop();
- void Reset();
- void ResetE84();
- void Complete();
- event Action<string> OnE84HandOffStart;
- event Action<string> OnE84HandOffComplete;
- event Action<E84Timeout, string> OnE84HandOffTimeout;
- event Action<E84SignalID, bool> OnE84ActiveSignalChange;
- event Action<E84SignalID, bool> OnE84PassiveSignalChange;
- }
- public abstract class LoadPort : BaseDevice, ILoadPort
- {
- public event Action<bool> ActionDone;
- public IndicatorState IndicatiorLoad { get; set; }
- public IndicatorState IndicatiorUnload { get; set; }
- public IndicatorState IndicatiorPresence { get; set; }
- public IndicatorState IndicatorAlarm { get; set; }
- public IndicatorState IndicatiorPlacement { get; set; }
- public IndicatorState IndicatiorOpAccess { get; set; }
- public IndicatorState IndicatiorAccessAuto { get; set; }
- public IndicatorState IndicatiorAccessManual { get; set; }
- public IndicatorState IndicatiorStatus1 { get; set; }
- public IndicatorState IndicatiorStatus2 { get; set; }
- public IndicatorState IndicatiorManualMode { get; set; }
- public IndicatorState IndicatiorClampUnclamp { get; set; }
- public IndicatorState IndicatiorDockUndock { get; set; }
- #region E84 Active IndicatorState
- public IndicatorState IndicatorVALID { get; set; }
- public IndicatorState IndicatorCS0 { get; set; }
- public IndicatorState IndicatorCS1 { get; set; }
- public IndicatorState IndicatorTR_REQ{ get; set; }
- public IndicatorState IndicatorBUSY { get; set; }
- public IndicatorState IndicatorCOMPT { get; set; }
- public IndicatorState IndicatorCONT { get; set; }
- #endregion
- #region E84 Passive IndicatorState
- public IndicatorState IndicatorL_REQ { get; set; }
- public IndicatorState IndicatorU_REQ { get; set; }
- public IndicatorState IndicatorREADY { get; set; }
- public IndicatorState IndicatorHO_AVBL { get; set; }
- public IndicatorState IndicatorES { get; set; }
- #endregion
- public static Dictionary<IndicatorType, Indicator> LoadPortIndicatorLightMap =
- new Dictionary<IndicatorType, Indicator>()
- {
- {IndicatorType.Load, Indicator.LOAD},
- {IndicatorType.Unload, Indicator.UNLOAD},
- {IndicatorType.AccessAuto, Indicator.ACCESSAUTO },
- {IndicatorType.AccessManual, Indicator.ACCESSMANUL},
- {IndicatorType.Alarm, Indicator.ALARM},
- {IndicatorType.Presence, Indicator.PRESENCE},
- {IndicatorType.Placement, Indicator.PLACEMENT},
- {IndicatorType.Status1, Indicator.RESERVE1},
- {IndicatorType.Status2, Indicator.RESERVE2},
- };
- public IndicatorState[] IndicatorStateFeedback { get; set; }
- public virtual FoupClampState ClampState { get; set; }
- public virtual FoupDockState DockState { get; set; }
- public virtual FoupDoorState DoorState { get; set; }
- public virtual CasstleType CasstleType { get; set; }
- public string SlotMap
- {
- get { return GetSlotMap(); }
- }
- //Hirata
- public int WaferCount { get; set; }
- public virtual bool IsError { get; set; }
- public virtual bool IsBusy { get; set; }
- public virtual bool IsIdle { get; set; }
- public virtual bool IsMoving { get; set; }
- public virtual bool IsInfoPadAOn { get; set; }
- public virtual bool IsInfoPadBOn { get; set; }
- public virtual bool IsInfoPadCOn { get; set; }
- public virtual bool IsInfoPadDOn { get; set; }
- public virtual bool IsWaferProtrude { get; set; }
- public virtual bool IsMonitorProtrude { get; set; } = false;
- public virtual string InfoPadCarrierType { get; set; } = "";
- public virtual string InfoPadCarrierTypeInformation
- {
- get
- {
- if (_isPresent)
- return ("Index:" + InfoPadCarrierIndex.ToString() + "\r\n"
- + "Type:" + InfoPadCarrierType + "\r\n"
- + "Size:" + GetCurrentWaferSize().ToString());
- return "";
- }
- }
- public virtual int InfoPadCarrierIndex { get; set; } = -1;
- public virtual LoadportCassetteState CassetteState
- {
- get;
- set;
- }
- public WaferSize Size
- {
- get
- {
- IoWaferSizeDetector detector = DEVICE.GetDevice<IoWaferSizeDetector>($"{Name}WaferDetector");
- if (detector != null)
- return detector.Value;
- int carrierIndex = SC.ContainsItem($"CarrierInfo.{Name}CarrierIndex") ?
- SC.GetValue<int>($"CarrierInfo.{Name}CarrierIndex") : 0;
- WaferSize wsize = SC.ContainsItem($"CarrierInfo.CarrierWaferSize{carrierIndex}") ?
- (WaferSize)SC.GetValue<int>($"CarrierInfo.CarrierWaferSize{carrierIndex}") : WaferSize.WS12;
- return wsize;
- }
- }
- public virtual WaferSize GetCurrentWaferSize()
- {
- return Size;
- }
- public bool IsMapWaferByLoadPort { get; set; }
- public EnumLoadPortType PortType { get; set; }
- public bool Initalized { get; set; }
- public bool IsPresent
- {
- get { return _isPresent; }
- }
- public bool IsPlacement
- {
- get { return _isPlaced; }
- }
- public bool IsMapped
- {
- get { return _isMapped; }
- }
- public bool IsComplete { get; set; }
- public bool IsAccessSwPressed
- {
- get { return _isAccessSwPressed; }
- }
- public bool Error { get; set; }
- public string ErrorCode { get; set; }
- public bool MapError { get; set; }
- public bool ReadCarrierIDError { get; set; }
- public bool ExecuteError { get; set; } = false;
- /// <summary>
- /// 是否处于FOSB模式
- /// </summary>
- public bool IsFOSBMode { get; set; }
- public TDKY_AxisPos DockPOS { get; set; } = TDKY_AxisPos.Unknown;
- public TDKZ_AxisPos DoorPOS { get; set; } = TDKZ_AxisPos.Unknown;
- public DeviceState State
- {
- get
- {
- if (!Initalized)
- {
- return DeviceState.Unknown;
- }
- if (Error || ExecuteError || MapError || ReadCarrierIDError)
- {
- return DeviceState.Error;
- }
- if (IsBusy)
- return DeviceState.Busy;
- return DeviceState.Idle;
- }
- }
- public string CarrierId
- {
- get { return _carrierId; }
- }
- public string LPLotID
- {
- get { return _lplotID; }
- }
- public string RfId
- {
- get { return _rfid; }
- }
- public RD_TRIG PresentTrig
- {
- get { return _presentTrig; }
- }
- public RD_TRIG PlacedtTrig
- {
- get { return _placetTrig; }
- }
- public RD_TRIG AccessSwPressedTrig
- {
- get { return _accessSwPressedTrig; }
- }
- public RD_TRIG ClampedTrig
- {
- get { return _clampTrig; }
- }
- public RD_TRIG DockTrig
- {
- get { return _dockTrig; }
- }
- public RD_TRIG DoorTrig
- {
- get { return _doorTrig; }
- }
- public string AccessMode
- {
- get { return _accessMode; }
- }
- public string SmartTag { get; set; }
- protected bool _isPresent;
- protected bool _isPlaced;
- protected bool _isDocked;
- protected bool _isAccessSwPressed;
- protected string _carrierId = "";
- protected string _lotId = "";
- protected string _rfid;
- protected string _lplotID;
- protected string _accessMode;
- protected bool _isLoaded { get; set; }
- protected bool _isMapped;
- private ModuleName _module;
- public ModuleName LPModuleName => _module;
- //private ModuleStateEnum _state;
- private readonly RD_TRIG _presentTrig = new RD_TRIG();
- private readonly RD_TRIG _placetTrig = new RD_TRIG();
- private readonly RD_TRIG _accessSwPressedTrig = new RD_TRIG();
- private readonly RD_TRIG _clampTrig = new RD_TRIG();
- private readonly RD_TRIG _dockTrig = new RD_TRIG();
- private readonly RD_TRIG _doorTrig = new RD_TRIG();
- public R_TRIG TrigWaferProtrude = new R_TRIG();
- private List<List<string>> _waferId = new List<List<string>>();
- private int _slotNumber;
- public string PortId
- {
- get; private set;
- }
- public string PortCategory
- {
- get
- {
- return (SC.ContainsItem($"LoadPort.LoadPort{PortId}CarrierLabel") ?
- SC.GetStringValue($"LoadPort.LoadPort{PortId}CarrierLabel") : "");
- }
- }
- ModuleName[] PortModuleNames = new[]
- {
- ModuleName.LP1,ModuleName.LP2,ModuleName.LP3,ModuleName.LP4,ModuleName.LP5,
- ModuleName.LP6,ModuleName.LP7,ModuleName.LP8,ModuleName.LP9,ModuleName.LP10,
- ModuleName.Cassette,
- ModuleName.CassAL, ModuleName.CassAR, ModuleName.CassBL, ModuleName.CassBR,
- };
- private string EventCarrierArrived = "CARRIER_ARRIVED";
- private string EventCarrierIdRead = "CARRIER_ID_READ";
- private string EventCarrierIdReadFailed = "CARRIER_ID_READ_FAILED";
- private string EventCarrierIdWrite = "CARRIER_ID_WRITE";
- protected string EventCarrierIdWriteFailed = "CARRIER_ID_WRITE_FAILED";
- protected string EventSlotMapAvailable = "SLOT_MAP_AVAILABLE";
- private string EventCarrierRemoved = "CARRIER_REMOVED";
- private string EventCarrierUnloaded = "CARRIER_UNLOADED";
- public string EventCarrierLoaded = "CARRIER_LOADED";
- public string EventPortClamped = "PortClamped";
- public string EventPortUnClamped = "PortUnClamped";
- private string EventLPHomed = "LP_HOMED";
- protected string PORT_ID = "PORT_ID";
- protected string CAR_ID = "CAR_ID";
- protected string SLOT_MAP = "SLOT_MAP";
- protected string PORT_CTGRY = "PORT_CTGRY";
- protected string RF_ID = "RF_ID";
- protected string PORT_CARRIER_TYPE = "PORT_CARRIER_TYPE";
- private string EventRfIdRead = "RF_ID_READ";
- private string EventRfIdReadFailed = "RF_ID_READ_FAILED";
- private string EventRfIdWrite = "RF_ID_WRITE";
- private string EventRfIdWriteFailed = "RF_ID_WRITE_FAILED";
- public string AlarmLoadPortError { get => _module + "Error"; }
- public string AlarmLoadPortMappingError { get => _module + "MappingError"; }
- public string AlarmCarrierIDReadError { get => _module + "CarrierIDReadFail"; }
- private IE87CallBack _lpcallback = null;
- public IE87CallBack LPCallBack
- {
- get { return _lpcallback; }
- set { _lpcallback = value; }
- }
- private IE84CallBack _lpE84Callback = null;
- public IE84CallBack LPE84Callback
- {
- get { return _lpE84Callback; }
- set { _lpE84Callback = value; }
- }
- private ICarrierIDReader _carrierIDReadercallback = null;
- public ICarrierIDReader CarrierIDReaderCallBack
- {
- get { return _carrierIDReadercallback; }
- set { _carrierIDReadercallback = value; }
- }
- public LoadPort(int slotNumber = 25)
- {
- _slotNumber = slotNumber;
- }
- public LoadPort(string module, string name, int slotNumber = 25) : base(module, name, name, "")
- {
- _slotNumber = slotNumber;
- }
- public virtual bool IsAutoClampOnFoupOn
- {
- get
- {
- if (SC.ContainsItem($"LoadPort.LP{PortId}.AutoClampOnFoupOn"))
- return SC.GetValue<bool>($"LoadPort.LP{PortId}.AutoClampOnFoupOn");
- return false;
- }
- }
- public virtual bool Initialize()
- {
- for (int i = 0; i < 25; i++)
- {
- _waferId.Add(new List<string>()
- {
- i.ToString("D2"),"","",""
- });
- }
- if (!Enum.TryParse(Name, out ModuleName m))
- Enum.TryParse(Module, out m);
- _module = m;
- if ((int)_module >= 97)
- PortId = ((int)_module - 96).ToString();
- else
- PortId = ((int)_module).ToString();
- DoorState = FoupDoorState.Unknown;
- WaferManager.Instance.SubscribeLocation(_module, _slotNumber);
- CarrierManager.Instance.SubscribeLocation(_module.ToString());
- DATA.Subscribe(Name, "IsPresent", () => _isPresent);
- DATA.Subscribe(Name, "IsPlaced", () => _isPlaced);
- DATA.Subscribe(Name, "IsClamped", () => ClampState == FoupClampState.Close);
- DATA.Subscribe(Name, "IsLoaded", () => _isLoaded);
- DATA.Subscribe(Name, "IsDocked", () => DockState == FoupDockState.Docked);
- DATA.Subscribe(Name, "IsDoorOpen", () => DoorState == FoupDoorState.Open);
- DATA.Subscribe(Name, "ModuleState", () => "Idle");
- DATA.Subscribe(Name, "CarrierId", () => _carrierId);
- DATA.Subscribe(Name, "LPLotID", () => _lplotID);
- DATA.Subscribe(Name,"SmartTag", () => SmartTag);
- DATA.Subscribe(Name, "IsMapped", () => _isMapped);
- DATA.Subscribe($"{Name}.LoadportState", () => State);
- DATA.Subscribe($"{Name}.LoadportBusy", () => IsBusy);
- DATA.Subscribe($"{Name}.LoadportError", () => ErrorCode);
- DATA.Subscribe($"{Name}.CassetteState", () => CassetteState);
- DATA.Subscribe($"{Name}.FoupClampState", () => ClampState);
- DATA.Subscribe($"{Name}.FoupDockState", () => DockState);
- DATA.Subscribe($"{Name}.FoupDoorState", () => DoorState);
- DATA.Subscribe($"{Name}.SlotMap", () => SlotMap);
- DATA.Subscribe($"{Name}.IndicatiorLoad", () => IndicatiorLoad);
- DATA.Subscribe($"{Name}.IndicatiorUnload", () => IndicatiorUnload);
- DATA.Subscribe($"{Name}.IndicatiorPresence", () => IndicatiorPresence);
- DATA.Subscribe($"{Name}.IndicatiorPlacement", () => IndicatiorPlacement);
- DATA.Subscribe($"{Name}.IndicatiorAlarm", () => IndicatorAlarm);
- DATA.Subscribe($"{Name}.IndicatiorAccessAuto", () => IndicatiorAccessAuto);
- DATA.Subscribe($"{Name}.IndicatiorAccessManual", () => IndicatiorAccessManual);
- DATA.Subscribe($"{Name}.IndicatiorOpAccess", () => IndicatiorOpAccess);
- DATA.Subscribe($"{Name}.IndicatiorStatus1", () => IndicatiorStatus1);
- DATA.Subscribe($"{Name}.IndicatiorStatus2", () => IndicatiorStatus2);
- #region E84 active indicator
- DATA.Subscribe($"{Name}.Valid", () => IndicatorVALID==IndicatorState.ON);
- DATA.Subscribe($"{Name}.CS0",()=>IndicatorCS0 == IndicatorState.ON);
- DATA.Subscribe($"{Name}.CS1", () => IndicatorCS1 == IndicatorState.ON);
- DATA.Subscribe($"{Name}.TransferRequest", () => IndicatorTR_REQ == IndicatorState.ON);
- DATA.Subscribe($"{Name}.Busy", () => IndicatorBUSY == IndicatorState.ON);
- DATA.Subscribe($"{Name}.TransferComplete", () => IndicatorCOMPT == IndicatorState.ON);
- DATA.Subscribe($"{Name}.CONT", () => IndicatorCONT == IndicatorState.ON);
- #endregion
- #region E84 Passive Indicator
- DATA.Subscribe($"{Name}.LoadRequest", () => IndicatorL_REQ == IndicatorState.ON);
- DATA.Subscribe($"{Name}.UnloadRequest", () => IndicatorU_REQ == IndicatorState.ON);
- DATA.Subscribe($"{Name}.ReadyToTransfer", () => IndicatorREADY == IndicatorState.ON);
- DATA.Subscribe($"{Name}.HandoffAvailable", () => IndicatorHO_AVBL == IndicatorState.ON);
- DATA.Subscribe($"{Name}.ES", () => IndicatorES==IndicatorState.ON );
- #endregion
- DATA.Subscribe($"{Name}.CasstleType", () => (int)CasstleType);
- DATA.Subscribe($"{Name}.InfoPadCarrierType", () => InfoPadCarrierType);
- DATA.Subscribe($"{Name}.InfoPadCarrierTypeInformation", () => InfoPadCarrierTypeInformation);
- DATA.Subscribe($"{Name}.InfoPadCarrierIndex", () => InfoPadCarrierIndex);
- DATA.Subscribe($"{Name}.IsError", () => State == DeviceState.Error);
- //if (PortStateVariableNames.Length > _lpIndex)
- // DATA.Subscribe(PortStateVariableNames[_lpIndex], () => (_isPlaced && _isPresent) ? "1" : "0");
- //if (PortSlotMapVariableNames.Length > _lpIndex)
- // DATA.Subscribe(PortSlotMapVariableNames[_lpIndex], () => SlotMap);
- //if (PortWaferIdVariableNames.Length > _lpIndex)
- // DATA.Subscribe(PortWaferIdVariableNames[_lpIndex], UpdatedWaferIdList);
- EV.Subscribe(new EventItem("Event", EventCarrierArrived, "Carrier arrived"));
- EV.Subscribe(new EventItem("Event", EventCarrierRemoved, "Carrier removed"));
- EV.Subscribe(new EventItem("Event", EventCarrierIdRead, "Carrier ID read"));
- EV.Subscribe(new EventItem("Event", EventCarrierIdReadFailed, "Carrier ID read failed"));
- EV.Subscribe(new EventItem("Event", EventCarrierIdWrite, "Carrier ID write"));
- EV.Subscribe(new EventItem("Event", EventCarrierIdWriteFailed, "Carrier ID write failed"));
- EV.Subscribe(new EventItem("Event", EventSlotMapAvailable, "Slot map available"));
- EV.Subscribe(new EventItem("Event", EventCarrierUnloaded, "Carrier unloaded"));
- EV.Subscribe(new EventItem("Event", EventCarrierLoaded, "Carrier loaded"));
- EV.Subscribe(new EventItem("Event", EventRfIdRead, "Carrier RFID read"));
- EV.Subscribe(new EventItem("Event", EventRfIdReadFailed, "Carrier RFID read failed"));
- EV.Subscribe(new EventItem("Event", EventRfIdWrite, "Carrier RFID write"));
- EV.Subscribe(new EventItem("Event", EventRfIdWriteFailed, "Carrier RFID write failed"));
- EV.Subscribe(new EventItem("Event", EventPortClamped, "Port was clamped."));
- EV.Subscribe(new EventItem("Event", EventPortUnClamped, "Port was unclamped."));
- EV.Subscribe(new EventItem("Event", AlarmLoadPortError, $"Load Port {Name}error", EventLevel.Alarm, EventType.EventUI_Notify));
- EV.Subscribe(new EventItem("Event", AlarmLoadPortMappingError, $"Load Port {Name} mapping error", EventLevel.Alarm, EventType.EventUI_Notify));
- EV.Subscribe(new EventItem("Event", AlarmCarrierIDReadError, $"Load Port {Name} read carrierID error", EventLevel.Alarm, EventType.EventUI_Notify));
- //}
- IsIdle = true;
- //_state = ModuleStateEnum.Idle;
- IndicatorStateFeedback = new IndicatorState[20];
- if (_lpE84Callback != null)
- {
- _lpE84Callback.OnE84ActiveSignalChange += _lpE84Callback_OnE84ActiveSignalChange;
- _lpE84Callback.OnE84PassiveSignalChange += _lpE84Callback_OnE84PassiveSignalChange;
- _lpE84Callback.OnE84HandOffComplete += _lpE84Callback_OnE84HandOffComplete;
- _lpE84Callback.OnE84HandOffStart += _lpE84Callback_OnE84HandOffStart;
- _lpE84Callback.OnE84HandOffTimeout += _lpE84Callback_OnE84HandOffTimeout;
- }
- RegisterOperation();
- return true;
- }
- private void _lpE84Callback_OnE84PassiveSignalChange(E84SignalID arg2, bool arg3)
- {
- ;
- }
- private void _lpE84Callback_OnE84HandOffTimeout(E84Timeout arg2, string arg3)
- {
- ;
- }
- private void _lpE84Callback_OnE84HandOffStart(string arg2)
- {
- OnE84HandOffStart(arg2 == "Load");
- }
- private void _lpE84Callback_OnE84HandOffComplete(string arg2)
- {
- OnE84HandOffComplete(arg2 == "Load");
- }
- private void _lpE84Callback_OnE84ActiveSignalChange(E84SignalID arg2, bool arg3)
- {
- ;
- }
- public virtual bool Connect()
- {
- return true;
- }
- public virtual bool IsAutoReadCarrierID
- {
- get
- {
- return SC.ContainsItem($"LoadPort.{_module}.EnableAutoCarrierIdRead") ?
- SC.GetValue<bool>($"LoadPort.{_module}.EnableAutoCarrierIdRead") : true;
- }
- }
- public virtual bool IsBypassCarrierIDReader
- {
- get
- {
- return SC.ContainsItem($"LoadPort.{_module}.BypassCarrierIDReader") ?
- SC.GetValue<bool>($"LoadPort.{_module}.BypassCarrierIDReader") : false;
- }
- }
- private void RegisterOperation()
- {
- OP.Subscribe($"{Name}.LoadportHome", (string cmd, object[] param) =>
- {
- if (!Home(out string reason))
- {
- EV.PostWarningLog(Module, $"{Name} can not start home, {reason}");
- return false;
- }
- EV.PostInfoLog(Module, $"{Name} start home");
- return true;
- });
- OP.Subscribe($"{Name}.LoadportReset", (string cmd, object[] param) =>
- {
- if (!ClearError(out string reason))
- {
- EV.PostWarningLog(Module, $"{Name} can not reset, {reason}");
- return false;
- }
- EV.PostInfoLog(Module, $"{Name} start reset");
- return true;
- });
- OP.Subscribe($"{Name}.LoadportStop", (string cmd, object[] param) =>
- {
- if (!Stop(out string reason))
- {
- EV.PostWarningLog(Module, $"{Name} can not stop, {reason}");
- return false;
- }
- EV.PostInfoLog(Module, $"{Name} stop");
- return true;
- });
- OP.Subscribe($"{Name}.LoadportLoad", (string cmd, object[] param) =>
- {
- if (!Load(out string reason))
- {
- EV.PostWarningLog(Module, $"{Name} can not load, {reason}");
- return false;
- }
- EV.PostInfoLog(Module, $"{Name} start load");
- return true;
- });
- OP.Subscribe($"{Name}.LoadportLoadWithoutMap", (string cmd, object[] param) =>
- {
- if (!LoadWithoutMap(out string reason))
- {
- EV.PostWarningLog(Module, $"{Name} can not load without map, {reason}");
- return false;
- }
- EV.PostInfoLog(Module, $"{Name} start load without map");
- return true;
- });
- OP.Subscribe($"{Name}.LoadportLoadWithMap", (string cmd, object[] param) =>
- {
- if (!Load(out string reason))
- {
- EV.PostWarningLog(Module, $"{Name} can not load with map, {reason}");
- return false;
- }
- if (!QueryWaferMap(out reason))
- {
- EV.PostWarningLog(Module, $"{Name} can not map, {reason}");
- return false;
- }
- EV.PostInfoLog(Module, $"{Name} start load with map");
- return true;
- });
- OP.Subscribe($"{Name}.LoadportUnload", (string cmd, object[] param) =>
- {
- if (!Unload(out string reason))
- {
- EV.PostWarningLog(Module, $"{Name} can not unload, {reason}");
- return false;
- }
- EV.PostInfoLog(Module, $"{Name} start unload");
- return true;
- });
- OP.Subscribe($"{Name}.LoadportClamp", (string cmd, object[] param) =>
- {
- if (!Clamp(out string reason))
- {
- EV.PostWarningLog(Module, $"{Name} can not clamp, {reason}");
- return false;
- }
- EV.PostInfoLog(Module, $"{Name} start clamp");
- return true;
- });
- OP.Subscribe($"{Name}.LoadportUnclamp", (string cmd, object[] param) =>
- {
- if (!Unclamp(out string reason))
- {
- EV.PostWarningLog(Module, $"{Name} can not unclamp, {reason}");
- return false;
- }
- EV.PostInfoLog(Module, $"{Name} start unclamp");
- return true;
- });
- OP.Subscribe($"{Name}.LoadportOpenDoor", (string cmd, object[] param) =>
- {
- if (!OpenDoor(out string reason))
- {
- EV.PostWarningLog(Module, $"{Name} can not open door, {reason}");
- return false;
- }
- EV.PostInfoLog(Module, $"{Name} start open door");
- return true;
- });
- OP.Subscribe($"{Name}.LoadportOpenDoorNoMap", (string cmd, object[] param) =>
- {
- if (!OpenDoorNoMap(out string reason))
- {
- EV.PostWarningLog(Module, $"{Name} can not open door, {reason}");
- return false;
- }
- EV.PostInfoLog(Module, $"{Name} start open door");
- return true;
- });
- OP.Subscribe($"{Name}.LoadportCloseDoor", (string cmd, object[] param) =>
- {
- if (!CloseDoor(out string reason))
- {
- EV.PostWarningLog(Module, $"{Name} can not close door, {reason}");
- return false;
- }
- EV.PostInfoLog(Module, $"{Name} start close door");
- return true;
- });
- OP.Subscribe($"{Name}.LoadportDock", (string cmd, object[] param) =>
- {
- if (!Dock(out string reason))
- {
- EV.PostWarningLog(Module, $"{Name} can not dock, {reason}");
- return false;
- }
- EV.PostInfoLog(Module, $"{Name} start dock");
- return true;
- });
- OP.Subscribe($"{Name}.LoadportUndock", (string cmd, object[] param) =>
- {
- if (!Undock(out string reason))
- {
- EV.PostWarningLog(Module, $"{Name} can not undock, {reason}");
- return false;
- }
- EV.PostInfoLog(Module, $"{Name} start undock");
- return true;
- });
- OP.Subscribe($"{Name}.LoadportQueryState", (string cmd, object[] param) =>
- {
- if (!QueryState(out string reason))
- {
- EV.PostWarningLog(Module, $"{Name} can not query state, {reason}");
- return false;
- }
- EV.PostInfoLog(Module, $"{Name} start query state");
- return true;
- });
- OP.Subscribe($"{Name}.LoadportQueryLED", (string cmd, object[] param) =>
- {
- if (!QueryIndicator(out string reason))
- {
- EV.PostWarningLog(Module, $"{Name} can not query led state, {reason}");
- return false;
- }
- EV.PostInfoLog(Module, $"{Name} start query led state");
- return true;
- });
- OP.Subscribe($"{Name}.LoadportSetLED", (string cmd, object[] param) =>
- {
- int light = (int)param[0];
- int state = (int)param[1];
- if (!SetIndicator((Indicator)light, (IndicatorState)state, out string reason))
- {
- EV.PostWarningLog(Module, $"{Name} can not set led state, {reason}");
- return true;
- }
- EV.PostInfoLog(Module, $"{Name} start set led state");
- return true;
- });
- OP.Subscribe($"{Name}.LoadportMap", (string cmd, object[] param) =>
- {
- if (!QueryWaferMap(out string reason))
- {
- EV.PostWarningLog(Module, $"{Name} can not map, {reason}");
- return false;
- }
- EV.PostInfoLog(Module, $"{Name} start map");
- return true;
- });
- OP.Subscribe($"{Name}.SetCassetteType", (string cmd, object[] param) =>
- {
- if (!SetCassetteType(param, out string reason))
- {
- EV.PostWarningLog(Module, $"{Name} can not set type, {reason}");
- return false;
- }
- EV.PostInfoLog(Module, $"{Name} cassette type have set to {CasstleType}");
- return true;
- });
- OP.Subscribe($"{Name}.LoadportForceHome", (string cmd, object[] param) =>
- {
- if (!ForceHome(out string reason))
- {
- EV.PostWarningLog(Module, $"{Name} can not start force home, {reason}");
- return false;
- }
- EV.PostInfoLog(Module, $"{Name} start force home");
- return true;
- });
- OP.Subscribe($"{Name}.LoadportFOSBMode", (string cmd, object[] param) =>
- {
- if (!FOSBMode(out string reason))
- {
- EV.PostWarningLog(Module, $"{Name} can not change to FOSB mode, {reason}");
- return false;
- }
- IsFOSBMode = true;
- EV.PostInfoLog(Module, $"{Name} changed to FOSB mode");
- return true;
- });
- OP.Subscribe($"{Name}.LoadportFOUPMode", (string cmd, object[] param) =>
- {
- if (!FOUPMode(out string reason))
- {
- EV.PostWarningLog(Module, $"{Name} can not change to FOSB mode, {reason}");
- return false;
- }
- IsFOSBMode = true;
- EV.PostInfoLog(Module, $"{Name} changed to FOSB mode");
- return true;
- });
- OP.Subscribe($"{Name}.LoadportQueryFOSBMode", (string cmd, object[] param) =>
- {
- if (!QueryFOSBMode(out string reason))
- {
- EV.PostWarningLog(Module, $"{Name} can not change to FOUP mode, {reason}");
- return false;
- }
- IsFOSBMode = false;
- EV.PostInfoLog(Module, $"{Name} changed to FOSB mode");
- return true;
- });
- OP.Subscribe($"{Name}.SetLoadportLotID", (string cmd, object[] param) =>
- {
- if (!SetLotID(param, out string reason))
- {
- return false;
- }
- EV.PostInfoLog(Module, $"{Name} set lotID for loadport.");
- return true;
- });
- }
- private bool SetLotID(object[] param, out string reason)
- {
- reason = "";
- if (param == null || param.Length == 0) return false;
- _lplotID = param[0].ToString();
- return true;
- }
- private bool SetCassetteType(object[] param, out string reason)
- {
- reason = "";
- if (param.Length != 1)
- {
- reason = "Invalid setting parameter.";
- return false;
- }
- CasstleType = (CasstleType)int.Parse(param[0].ToString());
- return true;
- }
- public virtual bool FALoad(out string reason)
- {
- reason = "";
- return true;
- }
- public virtual bool FAUnload(out string reason)
- {
- reason = "";
- return true;
- }
- public virtual bool Load(out string reason)
- {
- reason = "";
- return true;
- }
- public virtual bool LoadWithoutMap(out string reason)
- {
- reason = "";
- return true;
- }
- public virtual bool QueryWaferMap(out string reason)
- {
- reason = "";
- return true;
- }
- public virtual bool GetMapInfo(out string reason)
- {
- reason = "";
- return true;
- }
- public virtual bool SetWaferMap(out string reason)
- {
- reason = "";
- return true;
- }
- public virtual bool QueryFOSBMode(out string reason)
- {
- reason = "";
- return true;
- }
- /// <summary>
- /// FOSB模式下的Dock指令
- /// </summary>
- /// <param name="reason"></param>
- /// <returns></returns>
- public virtual bool FOSBDock(out string reason)
- {
- reason = "";
- return true;
- }
- /// <summary>
- /// FOSB模式下的FOSBUnDock指令
- /// </summary>
- /// <param name="reason"></param>
- /// <returns></returns>
- public virtual bool FOSBUnDock(out string reason)
- {
- reason = "";
- return true;
- }
- /// <summary>
- /// FOSB模式下的开门指令
- /// </summary>
- /// <param name="reason"></param>
- /// <returns></returns>
- public virtual bool FOSBDoorOpen(out string reason)
- {
- reason = "";
- return true;
- }
- /// <summary>
- /// FOSB模式下的关门指令
- /// </summary>
- /// <param name="reason"></param>
- /// <returns></returns>
- public virtual bool FOSBDoorClose(out string reason)
- {
- reason = "";
- return true;
- }
- /// <summary>
- /// FOSB模式下的门下移指令
- /// </summary>
- /// <param name="reason"></param>
- /// <returns></returns>
- public virtual bool FOSBDoorDown(out string reason)
- {
- reason = "";
- return true;
- }
- /// <summary>
- /// FOSB模式下的门上移指令
- /// </summary>
- /// <param name="reason"></param>
- /// <returns></returns>
- public virtual bool FOSBDoorUp(out string reason)
- {
- reason = "";
- return true;
- }
- public virtual bool SetIndicator(IndicatorType light, IndicatorState state)
- {
- if (LoadPortIndicatorLightMap.ContainsKey(light))
- {
- SetIndicator(LoadPortIndicatorLightMap[light], state, out string _);
- return true;
- }
- EV.PostWarningLog(Module, $"Not supported indicator {light}");
- return false;
- }
- public IndicatorState GetIndicator(IndicatorType light)
- {
- if (LoadPortIndicatorLightMap.ContainsKey(light))
- {
- return IndicatorStateFeedback[(int)LoadPortIndicatorLightMap[light]];
- }
- EV.PostWarningLog(Module, $"Not supported indicator {light}");
- return IndicatorState.OFF;
- }
- public virtual bool SetE84Available(out string reason)
- {
- if (_lpE84Callback != null)
- {
- _lpE84Callback.SetHoAutoControl(false);
- _lpE84Callback.SetHoAvailable(true);
- }
- reason = "";
- return true;
- }
- public virtual bool SetE84Unavailable(out string reason)
- {
- if (_lpE84Callback != null)
- {
- _lpE84Callback.SetHoAutoControl(false);
- _lpE84Callback.SetHoAvailable(false);
- }
- reason = "";
- return true;
- }
- public virtual bool SetIndicator(Indicator light, IndicatorState state, out string reason)
- {
- reason = "";
- return true;
- }
- public virtual bool QueryIndicator(out string reason)
- {
- reason = "";
- return true;
- }
- public virtual bool QueryState(out string reason)
- {
- reason = "";
- return true;
- }
- public virtual bool Undock(out string reason)
- {
- reason = "";
- return true;
- }
- public virtual bool Dock(out string reason)
- {
- reason = "";
- return true;
- }
- public virtual bool CloseDoor(out string reason)
- {
- reason = "";
- return true;
- }
- public virtual bool OpenDoor(out string reason)
- {
- reason = "";
- return true;
- }
- public virtual bool OpenDoorNoMap(out string reason)
- {
- reason = "";
- return true;
- }
- public virtual bool OpenDoorAndMap(out string reason)
- {
- reason = "";
- return true;
- }
- public virtual bool Unclamp(out string reason)
- {
- reason = "";
- return true;
- }
- public virtual bool Clamp(out string reason)
- {
- reason = "";
- return true;
- }
- public virtual bool Unload(out string reason)
- {
- reason = "";
- return true;
- }
- public virtual bool Stop(out string reason)
- {
- reason = "";
- return true;
- }
- public virtual bool ClearError(out string reason)
- {
- reason = "";
- return true;
- }
- public virtual bool Init(out string reason)
- {
- reason = "";
- return true;
- }
- public virtual bool Home(out string reason)
- {
- reason = "";
- return true;
- }
- public virtual bool ForceHome(out string reason)
- {
- reason = "";
- return true;
- }
- public virtual bool FOSBMode(out string reason)
- {
- reason = "";
- return true;
- }
- public virtual bool FOUPMode(out string reason)
- {
- reason = "";
- return true;
- }
- public virtual bool ReadRfId(out string reason)
- {
- reason = "";
- return true;
- }
- public virtual bool ReadRfid(int startpage, int length, out string reason)
- {
- reason = "";
- return true;
- }
- public virtual bool WriteRfId(string cid, out string reason)
- {
- reason = "";
- return true;
- }
- public virtual bool WriteRfid(string cid, int startpage, int length, out string reason)
- {
- reason = "";
- return true;
- }
- public virtual bool ChangeAccessMode(bool auto, out string reason)
- {
- reason = "";
- return true;
- }
- public virtual bool GetAccessMode(out string reason)
- {
- reason = "";
- return true;
- }
- //public virtual bool ChangeTransferState(LoadPortTransferState newState, out string reason)
- //{
- // reason = "";
- // return true;
- //}
- public virtual bool SetServiceCommand(bool inService, out string reason)
- {
- reason = "";
- return true;
- }
- public virtual bool GetE84HandoffActiveSignalState(E84PioPosition piopostion, E84PioSignalAtoP AtoPsignal)
- {
- if (_lpE84Callback == null) return false;
- switch (AtoPsignal)
- {
- case E84PioSignalAtoP.AM_AVBL:
- return _lpE84Callback.GetE84SignalState(E84SignalID.AM_AVBL);
- case E84PioSignalAtoP.BUSY:
- return _lpE84Callback.GetE84SignalState(E84SignalID.BUSY);
- case E84PioSignalAtoP.COMPT:
- return _lpE84Callback.GetE84SignalState(E84SignalID.COMPT);
- case E84PioSignalAtoP.CONT:
- return _lpE84Callback.GetE84SignalState(E84SignalID.CONT);
- case E84PioSignalAtoP.CS_0:
- return _lpE84Callback.GetE84SignalState(E84SignalID.CS_0);
- case E84PioSignalAtoP.CS_1:
- return _lpE84Callback.GetE84SignalState(E84SignalID.CS_1);
- case E84PioSignalAtoP.TR_REQ:
- return _lpE84Callback.GetE84SignalState(E84SignalID.TR_REQ);
- case E84PioSignalAtoP.VALID:
- return _lpE84Callback.GetE84SignalState(E84SignalID.VALID);
- default:
- return false;
- }
- }
- public virtual bool GetE84HandoffPassiveSignalState(E84PioPosition piopostion, E84PioSignalPtoA PtoAsignal)
- {
- if (_lpE84Callback == null) return false;
- switch (PtoAsignal)
- {
- case E84PioSignalPtoA.ES:
- return _lpE84Callback.GetE84SignalState(E84SignalID.ES);
- case E84PioSignalPtoA.HO_AVBL:
- return _lpE84Callback.GetE84SignalState(E84SignalID.HO_AVBL);
- case E84PioSignalPtoA.L_REQ:
- return _lpE84Callback.GetE84SignalState(E84SignalID.L_REQ);
- case E84PioSignalPtoA.READY:
- return _lpE84Callback.GetE84SignalState(E84SignalID.READY);
- case E84PioSignalPtoA.U_REQ:
- return _lpE84Callback.GetE84SignalState(E84SignalID.U_REQ);
- default:
- return false;
- }
- }
- public virtual void SetE84HandoffSignalState(E84PioPosition piopostion, E84PioSignalPtoA PtoAsignal, bool state)
- {
- if (_lpE84Callback == null) return;
- switch (PtoAsignal)
- {
- case E84PioSignalPtoA.ES:
- _lpE84Callback.SetE84SignalState(E84PassiveSignal.ES, state);
- break;
- case E84PioSignalPtoA.HO_AVBL:
- _lpE84Callback.SetE84SignalState(E84PassiveSignal.HOAvbl, state);
- break;
- case E84PioSignalPtoA.L_REQ:
- _lpE84Callback.SetE84SignalState(E84PassiveSignal.LoadReq, state);
- break;
- case E84PioSignalPtoA.READY:
- _lpE84Callback.SetE84SignalState(E84PassiveSignal.Ready, state);
- break;
- case E84PioSignalPtoA.U_REQ:
- _lpE84Callback.SetE84SignalState(E84PassiveSignal.UnloadReq, state);
- break;
- default:
- break;
- }
- }
- public virtual void Monitor()
- {
- _presentTrig.CLK = _isPresent;
- _placetTrig.CLK = _isPlaced;
- _dockTrig.CLK = _isDocked;
- _clampTrig.CLK = ClampState == FoupClampState.Close;
- _doorTrig.CLK = DoorState == FoupDoorState.Close;
- _accessSwPressedTrig.CLK = _isAccessSwPressed;
- if (_lpE84Callback != null)
- {
- _lpE84Callback.SetFoupStatus(_isPlaced);
- _lpE84Callback.SetReadyTransferStatus((ClampState == FoupClampState.Open) &&
- (DockState == FoupDockState.Undocked) && Initalized);
- }
- }
- public virtual void Reset()
- {
- Error = false;
- ExecuteError = false;
- MapError = false;
- ReadCarrierIDError = false;
- if (_carrierIDReadercallback != null)
- _carrierIDReadercallback.Reset();
- }
- public virtual void Terminate()
- {
- }
- private List<List<string>> UpdatedWaferIdList()
- {
- WaferInfo[] wafers = WaferManager.Instance.GetWafers(_module);
- for (int i = 0; i < wafers.Length; i++)
- {
- _waferId[i][1] = wafers[i].LaserMarker;
- _waferId[i][2] = wafers[i].T7Code;
- _waferId[i][3] = wafers[i].WaferID;
- }
- return _waferId;
- }
- public virtual bool IsEnableMapWafer(out string reason)
- {
- reason = string.Empty;
- if (!IsIdle)
- {
- reason = "Cassette is busy";
- return false;
- }
- if (!IsPlacement)
- {
- reason = "Cassette not properly placed";
- return false;
- }
- if (IsWaferProtrude)
- {
- reason = "Found wafer protrude";
- return false;
- }
- if (CassetteState != LoadportCassetteState.Normal)
- {
- reason = "Cassette is abnormal";
- return false;
- }
- return IsPlacement && !IsWaferProtrude;
- }
- public abstract bool IsEnableMapWafer();
- public abstract bool IsEnableTransferWafer();
- public abstract bool IsEnableTransferWafer(out string reason);
- public virtual bool IsEnableLoad()
- {
- return _isPresent && _isPlaced;
- }
- public virtual void ResetData()
- {
- _isMapped=false;
- }
- private CarrierOnLPState _CarrierOnState { get; set; } = CarrierOnLPState.Unknow;
- protected void ConfirmAddCarrier()
- {
- if (_isPresent && _isPlaced)
- {
- if (_CarrierOnState != CarrierOnLPState.On)
- {
- CarrierManager.Instance.CreateCarrier(Name);
- _CarrierOnState = CarrierOnLPState.On;
- SerializableDictionary<string, string> dvid = new SerializableDictionary<string, string>();
- dvid[PORT_ID] = PortId;
- dvid["PortID"] = PortId;
- dvid[PORT_CTGRY] = PortCategory;
- dvid[PORT_CARRIER_TYPE] = InfoPadCarrierType;
- EV.Notify(EventCarrierArrived, dvid);
- if (_lpcallback != null) _lpcallback.CarrierArrive();
- if (IsAutoClampOnFoupOn)
- Clamp(out _);
- if (IsAutoReadCarrierID)
- ReadRfId(out _);
- }
- IsComplete = false;
- }
- }
- protected void ConfirmRemoveCarrier()
- {
- if (!_isPlaced)
- {
- WaferManager.Instance.DeleteWafer(ModuleHelper.Converter(Name), 0, _slotNumber);
- CarrierManager.Instance.DeleteCarrier(Name);
- if (_CarrierOnState == CarrierOnLPState.On)
- {
- _CarrierOnState = CarrierOnLPState.Off;
- SerializableDictionary<string, string> dvid = new SerializableDictionary<string, string>();
- dvid[PORT_ID] = PortId;
- dvid["PortID"] = PortId;
- dvid[PORT_CTGRY] = PortCategory;
- dvid[CAR_ID] = _carrierId ?? "";
- dvid["CarrierID"] = _carrierId ?? "";
- EV.Notify(EventCarrierRemoved, dvid);
- if (_lpcallback != null) _lpcallback.CarrerRemove(_carrierId);
- }
- IsComplete = false;
- _isMapped = false;
- _carrierId = "";
- }
- }
- public void OnSlotMapRead(string _slotMap)
- {
- for (int i = 0; i < _slotNumber; i++)
- {
- // No wafer: "0", Wafer: "1", Crossed:"2", Undefined: "?", Overlapping wafers: "W"
- WaferInfo wafer = null;
- switch (_slotMap[i])
- {
- case '0':
- WaferManager.Instance.DeleteWafer(_module, i);
- CarrierManager.Instance.UnregisterCarrierWafer(Name, i);
- break;
- case '1':
- wafer = WaferManager.Instance.CreateWafer(_module, i, WaferStatus.Normal);
- WaferManager.Instance.UpdateWaferSize(_module, i, GetCurrentWaferSize());
- CarrierManager.Instance.RegisterCarrierWafer(Name, i, wafer);
- break;
- case '2':
- wafer = WaferManager.Instance.CreateWafer(_module, i, WaferStatus.Crossed);
- WaferManager.Instance.UpdateWaferSize(_module, i, GetCurrentWaferSize());
- CarrierManager.Instance.RegisterCarrierWafer(Name, i, wafer);
- //NotifyWaferError(Name, i, WaferStatus.Crossed);
- break;
- case 'W':
- wafer = WaferManager.Instance.CreateWafer(_module, i, WaferStatus.Double);
- WaferManager.Instance.UpdateWaferSize(_module, i, GetCurrentWaferSize());
- CarrierManager.Instance.RegisterCarrierWafer(Name, i, wafer);
- //NotifyWaferError(Name, i, WaferStatus.Double);
- break;
- case '?':
- wafer = WaferManager.Instance.CreateWafer(_module, i, WaferStatus.Unknown);
- WaferManager.Instance.UpdateWaferSize(_module, i, GetCurrentWaferSize());
- CarrierManager.Instance.RegisterCarrierWafer(Name, i, wafer);
- //NotifyWaferError(Name, i, WaferStatus.Unknown);
- break;
- }
- }
- SerializableDictionary<string, string> dvid = new SerializableDictionary<string, string>();
- dvid[SLOT_MAP] = _slotMap;
- dvid["SlotMap"] = _slotMap;
- dvid[PORT_ID] = PortId;
- dvid["PortID"] = PortId;
- dvid[PORT_CTGRY] = PortCategory;
- dvid[CAR_ID] = CarrierId ?? "";
- dvid["CarrierID"] = CarrierId ?? "";
- EV.Notify(EventSlotMapAvailable, dvid);
- if (_slotMap.Contains("2"))
- {
- MapError = true;
- Error = true;
- EV.Notify(AlarmLoadPortMappingError, new SerializableDictionary<string, object> {
- {"AlarmText","Mapped Crossed wafer." }
- });
- EV.PostAlarmLog(_module.ToString(), "Mapped Crossed wafer.");
- }
- if (_slotMap.Contains("W"))
- {
- MapError = true;
- Error = true;
- EV.Notify(AlarmLoadPortMappingError, new SerializableDictionary<string, object> {
- {"AlarmText","Mapped Double wafer." }
- });
- EV.PostAlarmLog(_module.ToString(), "Mapped Double wafer.");
- }
- if (_slotMap.Contains("?"))
- {
- MapError = true;
- Error = true;
- EV.Notify(AlarmLoadPortMappingError, new SerializableDictionary<string, object> {
- {"AlarmText","Mapped Unknown wafer." }
- });
- EV.PostAlarmLog(_module.ToString(), "Mapped Unknown wafer.");
- }
- if (_lpcallback != null) _lpcallback.MappingComplete(_carrierId, _slotMap);
- _isMapped = true;
- }
- private string GetSlotMap()
- {
- WaferInfo[] wafers = WaferManager.Instance.GetWafers(ModuleHelper.Converter(Name));
- string slot = "";
- for (int i = 0; i < _slotNumber && i < wafers.Length; i++)
- {
- slot += wafers[i].IsEmpty ? "0" : "1";
- }
- return slot;
- }
- public bool IsWaferEnableTransfer()
- {
- WaferInfo[] wafers = WaferManager.Instance.GetWafers(ModuleHelper.Converter(Name));
- foreach (WaferInfo wafer in wafers)
- {
- if (wafer.Status == WaferStatus.Crossed || wafer.Status == WaferStatus.Double)
- {
- EV.PostWarningLog(Name, $"At least one wafer is {wafer.Status.ToString()}.");
- return false;
- }
- }
- return true;
- }
- /// <summary>
- /// 获取LP中空缺Slot
- /// </summary>
- /// <returns>返回一个list, 顺序为从下到上.(0-25)</returns>
- public List<int> GetEmptySlot()
- {
- List<int> slot = new List<int>();
- if (IsMapped)
- {
- WaferInfo[] wafers = WaferManager.Instance.GetWafers(ModuleHelper.Converter(Name));
- for (int i = 0; i < _slotNumber; i++)
- {
- if (wafers[i].IsEmpty)
- slot.Add(i);
- }
- return slot;
- }
- else
- {
- return null;
- }
- }
- public virtual bool ReadCarrierID(int offset = 0, int length = 16)
- {
- if (_carrierIDReadercallback != null)
- return _carrierIDReadercallback.ReadCarrierID(offset, length);
- return false;
- }
- public virtual bool WriteCarrierID(string carrierID, int offset = 0, int length = 16)
- {
- if (_carrierIDReadercallback != null)
- return _carrierIDReadercallback.WriteCarrierID(offset, length, carrierID);
- return false;
- }
- public void OnCarrierIdRead(string data)
- {
- if (_isPlaced && _isPresent)
- {
- _carrierId = "";
- var items = data.Split(new string[] { " ", "\t", "\r", "\n" }, StringSplitOptions.RemoveEmptyEntries);
-
- foreach (var item in items)
- {
- if (item.StartsWith("CST:") && item.Length > 4)
- _carrierId = item.Substring(4).Trim();
- if (item.StartsWith("LOT:") && item.Length > 4)
- _lotId = item.Substring(4).Trim();
- }
- if (string.IsNullOrEmpty(_carrierId))
- {
- _carrierId = data;
- }
- SmartTag = data;
- SerializableDictionary<string, string> dvid = new SerializableDictionary<string, string>();
- dvid["CarrierID"] = _carrierId ?? "";
- dvid[CAR_ID] = _carrierId ?? "";
- dvid[PORT_ID] = PortId;
- dvid["PortID"] = PortId;
- dvid["SmartTag"] = SmartTag;
- dvid[PORT_CTGRY] = PortCategory;
- dvid[PORT_CARRIER_TYPE] = InfoPadCarrierType;
- EV.Notify(EventCarrierIdRead, dvid);
- CarrierManager.Instance.UpdateCarrierId(Name, _carrierId);
- CarrierManager.Instance.UpdateCarrierLot(Name, _lotId);
- if (_lpcallback != null) _lpcallback.CarrierIDReadSuccess(_carrierId);
- ReadCarrierIDError = false;
- }
- else
- {
- EV.PostWarningLog(Module, $"No FOUP found, carrier id {data} not saved");
- }
- }
- public void OnCarrierIdRead(ModuleName module, string name, string code)
- {
- OnCarrierIdRead(code);
- }
- public void ProceedSetCarrierID(string cid)
- {
- _carrierId = cid;
- SerializableDictionary<string, string> dvid = new SerializableDictionary<string, string>();
- //dvid[CAR_ID] = cid ?? "";
- dvid["CarrierID"] = cid ?? "";
- dvid["PortID"] = PortId;
- dvid[PORT_CTGRY] = PortCategory;
- EV.Notify(EventCarrierIdWrite, dvid);
- CarrierManager.Instance.UpdateCarrierId(Name, cid);
- }
- public void OnCarrierIdWrite(ModuleName module, string name, string id)
- {
- OnCarrierIdWrite(id);
- }
- public void OnCarrierIdWrite(string carrierId)
- {
- if (_isPlaced && _isPresent)
- {
- SerializableDictionary<string, string> dvid = new SerializableDictionary<string, string>();
- dvid[CAR_ID] = carrierId ?? "";
- dvid["CarrierID"] = carrierId ?? "";
- dvid[PORT_ID] = PortId;
- dvid[PORT_CTGRY] = PortCategory;
- EV.Notify(EventCarrierIdWrite, dvid);
- }
- else
- {
- EV.PostWarningLog(Module, $"No FOUP found, carrier id {carrierId} not saved");
- }
- }
- public void OnCarrierIdReadFailed(ModuleName module, string name)
- {
- OnCarrierIdReadFailed();
- }
- public void OnCarrierIdReadFailed()
- {
- if (_isPlaced && _isPresent)
- {
- _carrierId = "";
- SerializableDictionary<string, string> dvid = new SerializableDictionary<string, string>();
- dvid[PORT_ID] = PortId;
- dvid["PortID"] = PortId;
- dvid[PORT_CTGRY] = PortCategory;
- EV.Notify(EventCarrierIdReadFailed, dvid);
- if (_lpcallback != null) _lpcallback.CarrierIDReadFail();
- EV.Notify(AlarmCarrierIDReadError, new SerializableDictionary<string, object> {
- {"AlarmText","CarrierID read fail." }
- });
- //ReadCarrierIDError = true;
- }
- else
- {
- EV.PostWarningLog(Module, "No FOUP found, carrier id read is not valid");
- }
- }
- public void OnCarrierIdWriteFailed(ModuleName module, string name)
- {
- OnCarrierIdWriteFailed();
- }
- public void OnCarrierIdWriteFailed()
- {
- if (_isPlaced && _isPresent)
- {
- SerializableDictionary<string, string> dvid = new SerializableDictionary<string, string>();
- dvid[PORT_ID] = PortId;
- dvid[PORT_CTGRY] = PortCategory;
- EV.Notify(EventCarrierIdWriteFailed, dvid);
- }
- else
- {
- EV.PostWarningLog(Module, "No FOUP found, carrier id not valid");
- }
- }
- public void OnCarrierIdRead(ModuleName module, string carrierId)
- {
- OnCarrierIdRead(carrierId);
- }
- public void OnCarrierIdReadFailed(ModuleName module)
- {
- OnCarrierIdReadFailed();
- }
- public void OnCarrierIdWrite(ModuleName module, string carrierId)
- {
- OnCarrierIdWrite(carrierId);
- }
- public void OnCarrierIdWriteFailed(ModuleName module)
- {
- OnCarrierIdWriteFailed();
- }
- public void OnRfIdRead(ModuleName module, string rfid)
- {
- if (_isPlaced && _isPresent)
- {
- _rfid = rfid;
- SerializableDictionary<string, string> dvid = new SerializableDictionary<string, string>();
- dvid[CAR_ID] = _carrierId ?? "";
- dvid["CarrierID"] = _carrierId ?? "";
- dvid[PORT_ID] = PortId;
- dvid[PORT_CTGRY] = PortCategory;
- dvid[RF_ID] = rfid ?? "";
- EV.Notify(EventRfIdRead, dvid);
- CarrierManager.Instance.UpdateRfId(Name, rfid);
- ReadCarrierIDError = false;
- }
- else
- {
- EV.PostWarningLog(Module, "No FOUP found, rf id read not valid");
- }
- }
- public void OnRfIdReadFailed(ModuleName module)
- {
- if (_isPlaced && _isPresent)
- {
- _rfid = "";
- SerializableDictionary<string, string> dvid = new SerializableDictionary<string, string>();
- dvid[CAR_ID] = _carrierId ?? "";
- dvid["CarrierID"] = _carrierId ?? "";
- dvid[PORT_ID] = PortId;
- dvid[PORT_CTGRY] = PortCategory;
- EV.Notify(EventRfIdReadFailed, dvid);
- }
- else
- {
- EV.PostWarningLog(Module, "No FOUP found, rf id read is not valid");
- }
- }
- public void OnRfIdWrite(ModuleName module, string rfid)
- {
- if (_isPlaced && _isPresent)
- {
- _rfid = rfid;
- SerializableDictionary<string, string> dvid = new SerializableDictionary<string, string>();
- dvid[CAR_ID] = _carrierId ?? "";
- dvid["CarrierID"] = _carrierId ?? "";
- dvid[PORT_ID] = PortId;
- dvid[PORT_CTGRY] = PortCategory;
- dvid[RF_ID] = rfid ?? "";
- EV.Notify(EventRfIdWrite, dvid);
- CarrierManager.Instance.UpdateRfId(Name, rfid);
- }
- else
- {
- EV.PostWarningLog(Module, "No FOUP found, rf id write not valid");
- }
- }
- public void OnRfIdWriteFailed(ModuleName module)
- {
- if (_isPlaced && _isPresent)
- {
- _rfid = "";
- SerializableDictionary<string, string> dvid = new SerializableDictionary<string, string>();
- dvid[CAR_ID] = _carrierId ?? "";
- dvid["CarrierID"] = _carrierId ?? "";
- dvid[PORT_ID] = PortId;
- dvid[PORT_CTGRY] = PortCategory;
- dvid[RF_ID] = "";
- //EV.PostWarningLog(Module, "Write RFID failed.");
- EV.Notify(EventRfIdWriteFailed, dvid);
- }
- else
- {
- EV.PostWarningLog(Module, "No FOUP found, rf id write not valid");
- }
- }
- public void LoadPortAccessMode(string accessMode)
- {
- this._accessMode = accessMode;
- }
- /// <summary>
- /// 开始加载
- /// </summary>
- public void OnLoadStart()
- {
- if (_isPlaced)
- {
- if (_lpcallback != null) _lpcallback.LoadStart();
- }
- }
- public void OnLoaded()
- {
- var dvid = new SerializableDictionary<string, string>
- {
- [CAR_ID] = _carrierId ?? "",
- ["CarrierID"] = _carrierId ?? "",
- ["PortID"] = PortId,
- [PORT_ID] = PortId
- };
- _isLoaded = true;
- EV.Notify(EventCarrierLoaded, dvid);
- if (_lpcallback != null) _lpcallback.LoadComplete();
- //}
- }
- /// <summary>
- /// 开始加载
- /// </summary>
- public void OnUnLoadStart()
- {
- if (_isLoaded)
- {
- if (_lpcallback != null) _lpcallback.UnLoadStart();
- }
- }
- public void OnUnloaded()
- {
- var dvid = new SerializableDictionary<string, string>();
- dvid[PORT_CTGRY] = PortCategory;
- dvid[PORT_ID] = PortId;
- dvid["PortID"] = PortId;
- dvid[CAR_ID] = _carrierId ?? "";
- dvid["CarrierID"] = _carrierId ?? "";
- EV.Notify(EventCarrierUnloaded, dvid);
- //}
- DockState = FoupDockState.Undocked;
- if (_lpcallback != null) _lpcallback.UnloadComplete();
- _isLoaded = false;
- _isMapped = false;
- }
- public void OnE84HandOffStart(bool isload)
- {
- if (_lpcallback != null) _lpcallback.OnE84HandoffStart(isload);
- }
- public void OnE84HandOffComplete(bool isload)
- {
- if (_lpcallback != null) _lpcallback.OnE84HandoffComplete(isload);
- }
- public void OnFosbUndock()
- {
- var dvid = new SerializableDictionary<string, string>();
- dvid[PORT_CTGRY] = PortCategory;
- dvid[PORT_ID] = PortId;
- dvid[CAR_ID] = _carrierId ?? "";
- dvid["CarrierID"] = _carrierId ?? "";
- EV.Notify(EventCarrierUnloaded, dvid);
- //}
- if (_lpcallback != null) _lpcallback.UnloadComplete();
- }
- public void OnHomed()
- {
- //for (int i = 0; i < _slotNumber; i++)
- //{
- WaferManager.Instance.DeleteWafer(ModuleHelper.Converter(Name), 0, _slotNumber);
- //}
- _isMapped = false;
- var dvid = new SerializableDictionary<string, object>();
- dvid[PORT_CTGRY] = PortCategory;
- dvid[PORT_ID] = PortId;
- dvid[CAR_ID] = _carrierId ?? "";
- dvid["CarrierID"] = _carrierId ?? "";
- EV.Notify(EventLPHomed);
- if (_lpcallback != null) _lpcallback.OnLPHomed();
- _isLoaded = false;
- }
- public void OnCloseDoor()
- {
- WaferManager.Instance.DeleteWafer(ModuleHelper.Converter(Name), 0, _slotNumber);
- _isMapped = false;
- }
- public void OnError(string error = "")
- {
- EV.Notify($"{_module}{AlarmLoadPortError}", new SerializableDictionary<string, object> {
- {"AlarmText",error }
- });
- if (ActionDone != null)
- ActionDone(false);
- }
- protected void SetPresent(bool isPresent)
- {
- _isPresent = isPresent;
- if (_isPresent)
- {
- //ConfirmAddCarrier();
- }
- else
- {
- //ConfirmRemoveCarrier();
- }
- }
- protected void SetPlaced(bool isPlaced)
- {
- _isPlaced = isPlaced;
- if (isPlaced)
- {
- ConfirmAddCarrier();
- }
- else if(!isPlaced)
- {
- ConfirmRemoveCarrier();
- }
- }
- public void OnActionDone(bool result)
- {
- if (ActionDone != null)
- ActionDone(result);
- }
- }
- }
|