LoadPort.cs 68 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076
  1. using Aitex.Core.Common;
  2. using Aitex.Core.RT.DataCenter;
  3. using Aitex.Core.RT.Device;
  4. using Aitex.Core.RT.Device.Unit;
  5. using Aitex.Core.RT.Event;
  6. using Aitex.Core.RT.OperationCenter;
  7. using Aitex.Core.RT.SCCore;
  8. using Aitex.Core.Util;
  9. using Aitex.Sorter.Common;
  10. using MECF.Framework.Common.Equipment;
  11. using MECF.Framework.Common.SubstrateTrackings;
  12. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.CarrierIdReaders.CarrierIDReaderBase;
  13. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadPorts.TDK;
  14. using System;
  15. using System.Collections.Generic;
  16. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadPorts.LoadPortBase;
  17. using static Aitex.Core.RT.Device.Unit.IOE84Passive;
  18. namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadPorts
  19. {
  20. public enum IndicatorType
  21. {
  22. Load,
  23. Unload,
  24. Presence,
  25. Placement,
  26. Alarm,
  27. AccessManual,
  28. AccessAuto,
  29. Status1,
  30. Status2,
  31. Manual,
  32. Auto,
  33. Reserve,
  34. Error,
  35. Access,
  36. Busy,
  37. Complete,
  38. }
  39. public enum E84PioPosition
  40. {
  41. Floor = 0,
  42. Middle = 1,
  43. Overhead = 2
  44. }
  45. public enum E84PioSignalAtoP
  46. {
  47. VALID = 1,
  48. CS_0 = 2,
  49. CS_1 = 3,
  50. TR_REQ = 4,
  51. BUSY = 5,
  52. COMPT = 6,
  53. CONT = 7,
  54. AM_AVBL = 8
  55. }
  56. public enum E84PioSignalPtoA
  57. {
  58. L_REQ = 11,
  59. U_REQ = 12,
  60. READY = 13,
  61. HO_AVBL = 14,
  62. ES = 15,
  63. VA = 16,
  64. VS_0 = 17,
  65. VS_1 = 18
  66. }
  67. public interface IE87CallBack
  68. {
  69. void CarrierArrive();
  70. void CarrerRemove(string carrierID);
  71. void CarrierIDReadSuccess(string carrierID);
  72. void CarrierIDReadFail();
  73. void MappingComplete(string carrierID, string slotmap);
  74. void LoadStart();
  75. void LoadportError(string errorcode);
  76. void LoadComplete();
  77. void UnLoadStart();
  78. void UnloadComplete();
  79. void OnLPHomed();
  80. void OnE84HandoffStart(bool isload);
  81. void OnE84HandoffComplete(bool isload);
  82. }
  83. public interface IE84CallBack
  84. {
  85. void SetHoAutoControl(bool value);
  86. void SetHoAvailable(bool value);
  87. void SetE84SignalState(E84PassiveSignal signal, bool value);
  88. bool GetE84SignalState(E84SignalID signal);
  89. void SetFoupStatus(bool foupon);
  90. void SetReadyTransferStatus(bool ready);
  91. E84State GetCurrentE84State();
  92. void Stop();
  93. void Reset();
  94. void ResetE84();
  95. void Complete();
  96. event Action<string> OnE84HandOffStart;
  97. event Action<string> OnE84HandOffComplete;
  98. event Action<E84Timeout, string> OnE84HandOffTimeout;
  99. event Action<E84SignalID, bool> OnE84ActiveSignalChange;
  100. event Action<E84SignalID, bool> OnE84PassiveSignalChange;
  101. }
  102. public abstract class LoadPort : BaseDevice, ILoadPort
  103. {
  104. public event Action<bool> ActionDone;
  105. public IndicatorState IndicatiorLoad { get; set; }
  106. public IndicatorState IndicatiorUnload { get; set; }
  107. public IndicatorState IndicatiorPresence { get; set; }
  108. public IndicatorState IndicatorAlarm { get; set; }
  109. public IndicatorState IndicatiorPlacement { get; set; }
  110. public IndicatorState IndicatiorOpAccess { get; set; }
  111. public IndicatorState IndicatiorAccessAuto { get; set; }
  112. public IndicatorState IndicatiorAccessManual { get; set; }
  113. public IndicatorState IndicatiorStatus1 { get; set; }
  114. public IndicatorState IndicatiorStatus2 { get; set; }
  115. public IndicatorState IndicatiorManualMode { get; set; }
  116. public IndicatorState IndicatiorClampUnclamp { get; set; }
  117. public IndicatorState IndicatiorDockUndock { get; set; }
  118. #region E84 Active IndicatorState
  119. public IndicatorState IndicatorVALID { get; set; }
  120. public IndicatorState IndicatorCS0 { get; set; }
  121. public IndicatorState IndicatorCS1 { get; set; }
  122. public IndicatorState IndicatorTR_REQ{ get; set; }
  123. public IndicatorState IndicatorBUSY { get; set; }
  124. public IndicatorState IndicatorCOMPT { get; set; }
  125. public IndicatorState IndicatorCONT { get; set; }
  126. #endregion
  127. #region E84 Passive IndicatorState
  128. public IndicatorState IndicatorL_REQ { get; set; }
  129. public IndicatorState IndicatorU_REQ { get; set; }
  130. public IndicatorState IndicatorREADY { get; set; }
  131. public IndicatorState IndicatorHO_AVBL { get; set; }
  132. public IndicatorState IndicatorES { get; set; }
  133. #endregion
  134. public static Dictionary<IndicatorType, Indicator> LoadPortIndicatorLightMap =
  135. new Dictionary<IndicatorType, Indicator>()
  136. {
  137. {IndicatorType.Load, Indicator.LOAD},
  138. {IndicatorType.Unload, Indicator.UNLOAD},
  139. {IndicatorType.AccessAuto, Indicator.ACCESSAUTO },
  140. {IndicatorType.AccessManual, Indicator.ACCESSMANUL},
  141. {IndicatorType.Alarm, Indicator.ALARM},
  142. {IndicatorType.Presence, Indicator.PRESENCE},
  143. {IndicatorType.Placement, Indicator.PLACEMENT},
  144. {IndicatorType.Status1, Indicator.RESERVE1},
  145. {IndicatorType.Status2, Indicator.RESERVE2},
  146. };
  147. public IndicatorState[] IndicatorStateFeedback { get; set; }
  148. public virtual FoupClampState ClampState { get; set; }
  149. public virtual FoupDockState DockState { get; set; }
  150. public virtual FoupDoorState DoorState { get; set; }
  151. public virtual CasstleType CasstleType { get; set; }
  152. public string SlotMap
  153. {
  154. get { return GetSlotMap(); }
  155. }
  156. //Hirata
  157. public int WaferCount { get; set; }
  158. public virtual bool IsError { get; set; }
  159. public virtual bool IsBusy { get; set; }
  160. public virtual bool IsIdle { get; set; }
  161. public virtual bool IsMoving { get; set; }
  162. public virtual bool IsInfoPadAOn { get; set; }
  163. public virtual bool IsInfoPadBOn { get; set; }
  164. public virtual bool IsInfoPadCOn { get; set; }
  165. public virtual bool IsInfoPadDOn { get; set; }
  166. public virtual bool IsWaferProtrude { get; set; }
  167. public virtual bool IsMonitorProtrude { get; set; } = false;
  168. public virtual string InfoPadCarrierType { get; set; } = "";
  169. public virtual string InfoPadCarrierTypeInformation
  170. {
  171. get
  172. {
  173. if (_isPresent)
  174. return ("Index:" + InfoPadCarrierIndex.ToString() + "\r\n"
  175. + "Type:" + InfoPadCarrierType + "\r\n"
  176. + "Size:" + GetCurrentWaferSize().ToString());
  177. return "";
  178. }
  179. }
  180. public virtual int InfoPadCarrierIndex { get; set; } = -1;
  181. public virtual LoadportCassetteState CassetteState
  182. {
  183. get;
  184. set;
  185. }
  186. public WaferSize Size
  187. {
  188. get
  189. {
  190. IoWaferSizeDetector detector = DEVICE.GetDevice<IoWaferSizeDetector>($"{Name}WaferDetector");
  191. if (detector != null)
  192. return detector.Value;
  193. int carrierIndex = SC.ContainsItem($"CarrierInfo.{Name}CarrierIndex") ?
  194. SC.GetValue<int>($"CarrierInfo.{Name}CarrierIndex") : 0;
  195. WaferSize wsize = SC.ContainsItem($"CarrierInfo.CarrierWaferSize{carrierIndex}") ?
  196. (WaferSize)SC.GetValue<int>($"CarrierInfo.CarrierWaferSize{carrierIndex}") : WaferSize.WS12;
  197. return wsize;
  198. }
  199. }
  200. public virtual WaferSize GetCurrentWaferSize()
  201. {
  202. return Size;
  203. }
  204. public bool IsMapWaferByLoadPort { get; set; }
  205. public EnumLoadPortType PortType { get; set; }
  206. public bool Initalized { get; set; }
  207. public bool IsPresent
  208. {
  209. get { return _isPresent; }
  210. }
  211. public bool IsPlacement
  212. {
  213. get { return _isPlaced; }
  214. }
  215. public bool IsMapped
  216. {
  217. get { return _isMapped; }
  218. }
  219. public bool IsComplete { get; set; }
  220. public bool IsAccessSwPressed
  221. {
  222. get { return _isAccessSwPressed; }
  223. }
  224. public bool Error { get; set; }
  225. public string ErrorCode { get; set; }
  226. public bool MapError { get; set; }
  227. public bool ReadCarrierIDError { get; set; }
  228. public bool ExecuteError { get; set; } = false;
  229. /// <summary>
  230. /// 是否处于FOSB模式
  231. /// </summary>
  232. public bool IsFOSBMode { get; set; }
  233. public TDKY_AxisPos DockPOS { get; set; } = TDKY_AxisPos.Unknown;
  234. public TDKZ_AxisPos DoorPOS { get; set; } = TDKZ_AxisPos.Unknown;
  235. public DeviceState State
  236. {
  237. get
  238. {
  239. if (!Initalized)
  240. {
  241. return DeviceState.Unknown;
  242. }
  243. if (Error || ExecuteError || MapError || ReadCarrierIDError)
  244. {
  245. return DeviceState.Error;
  246. }
  247. if (IsBusy)
  248. return DeviceState.Busy;
  249. return DeviceState.Idle;
  250. }
  251. }
  252. public string CarrierId
  253. {
  254. get { return _carrierId; }
  255. }
  256. public string LPLotID
  257. {
  258. get { return _lplotID; }
  259. }
  260. public string RfId
  261. {
  262. get { return _rfid; }
  263. }
  264. public RD_TRIG PresentTrig
  265. {
  266. get { return _presentTrig; }
  267. }
  268. public RD_TRIG PlacedtTrig
  269. {
  270. get { return _placetTrig; }
  271. }
  272. public RD_TRIG AccessSwPressedTrig
  273. {
  274. get { return _accessSwPressedTrig; }
  275. }
  276. public RD_TRIG ClampedTrig
  277. {
  278. get { return _clampTrig; }
  279. }
  280. public RD_TRIG DockTrig
  281. {
  282. get { return _dockTrig; }
  283. }
  284. public RD_TRIG DoorTrig
  285. {
  286. get { return _doorTrig; }
  287. }
  288. public string AccessMode
  289. {
  290. get { return _accessMode; }
  291. }
  292. public string SmartTag { get; set; }
  293. protected bool _isPresent;
  294. protected bool _isPlaced;
  295. protected bool _isDocked;
  296. protected bool _isAccessSwPressed;
  297. protected string _carrierId = "";
  298. protected string _lotId = "";
  299. protected string _rfid;
  300. protected string _lplotID;
  301. protected string _accessMode;
  302. protected bool _isLoaded { get; set; }
  303. protected bool _isMapped;
  304. private ModuleName _module;
  305. public ModuleName LPModuleName => _module;
  306. //private ModuleStateEnum _state;
  307. private readonly RD_TRIG _presentTrig = new RD_TRIG();
  308. private readonly RD_TRIG _placetTrig = new RD_TRIG();
  309. private readonly RD_TRIG _accessSwPressedTrig = new RD_TRIG();
  310. private readonly RD_TRIG _clampTrig = new RD_TRIG();
  311. private readonly RD_TRIG _dockTrig = new RD_TRIG();
  312. private readonly RD_TRIG _doorTrig = new RD_TRIG();
  313. public R_TRIG TrigWaferProtrude = new R_TRIG();
  314. private List<List<string>> _waferId = new List<List<string>>();
  315. private int _slotNumber;
  316. public string PortId
  317. {
  318. get; private set;
  319. }
  320. public string PortCategory
  321. {
  322. get
  323. {
  324. return (SC.ContainsItem($"LoadPort.LoadPort{PortId}CarrierLabel") ?
  325. SC.GetStringValue($"LoadPort.LoadPort{PortId}CarrierLabel") : "");
  326. }
  327. }
  328. ModuleName[] PortModuleNames = new[]
  329. {
  330. ModuleName.LP1,ModuleName.LP2,ModuleName.LP3,ModuleName.LP4,ModuleName.LP5,
  331. ModuleName.LP6,ModuleName.LP7,ModuleName.LP8,ModuleName.LP9,ModuleName.LP10,
  332. ModuleName.Cassette,
  333. ModuleName.CassAL, ModuleName.CassAR, ModuleName.CassBL, ModuleName.CassBR,
  334. };
  335. private string EventCarrierArrived = "CARRIER_ARRIVED";
  336. private string EventCarrierIdRead = "CARRIER_ID_READ";
  337. private string EventCarrierIdReadFailed = "CARRIER_ID_READ_FAILED";
  338. private string EventCarrierIdWrite = "CARRIER_ID_WRITE";
  339. protected string EventCarrierIdWriteFailed = "CARRIER_ID_WRITE_FAILED";
  340. protected string EventSlotMapAvailable = "SLOT_MAP_AVAILABLE";
  341. private string EventCarrierRemoved = "CARRIER_REMOVED";
  342. private string EventCarrierUnloaded = "CARRIER_UNLOADED";
  343. public string EventCarrierLoaded = "CARRIER_LOADED";
  344. public string EventPortClamped = "PortClamped";
  345. public string EventPortUnClamped = "PortUnClamped";
  346. private string EventLPHomed = "LP_HOMED";
  347. protected string PORT_ID = "PORT_ID";
  348. protected string CAR_ID = "CAR_ID";
  349. protected string SLOT_MAP = "SLOT_MAP";
  350. protected string PORT_CTGRY = "PORT_CTGRY";
  351. protected string RF_ID = "RF_ID";
  352. protected string PORT_CARRIER_TYPE = "PORT_CARRIER_TYPE";
  353. private string EventRfIdRead = "RF_ID_READ";
  354. private string EventRfIdReadFailed = "RF_ID_READ_FAILED";
  355. private string EventRfIdWrite = "RF_ID_WRITE";
  356. private string EventRfIdWriteFailed = "RF_ID_WRITE_FAILED";
  357. public string AlarmLoadPortError { get => _module + "Error"; }
  358. public string AlarmLoadPortMappingError { get => _module + "MappingError"; }
  359. public string AlarmCarrierIDReadError { get => _module + "CarrierIDReadFail"; }
  360. private IE87CallBack _lpcallback = null;
  361. public IE87CallBack LPCallBack
  362. {
  363. get { return _lpcallback; }
  364. set { _lpcallback = value; }
  365. }
  366. private IE84CallBack _lpE84Callback = null;
  367. public IE84CallBack LPE84Callback
  368. {
  369. get { return _lpE84Callback; }
  370. set { _lpE84Callback = value; }
  371. }
  372. private ICarrierIDReader _carrierIDReadercallback = null;
  373. public ICarrierIDReader CarrierIDReaderCallBack
  374. {
  375. get { return _carrierIDReadercallback; }
  376. set { _carrierIDReadercallback = value; }
  377. }
  378. public LoadPort(int slotNumber = 25)
  379. {
  380. _slotNumber = slotNumber;
  381. }
  382. public LoadPort(string module, string name, int slotNumber = 25) : base(module, name, name, "")
  383. {
  384. _slotNumber = slotNumber;
  385. }
  386. public virtual bool IsAutoClampOnFoupOn
  387. {
  388. get
  389. {
  390. if (SC.ContainsItem($"LoadPort.LP{PortId}.AutoClampOnFoupOn"))
  391. return SC.GetValue<bool>($"LoadPort.LP{PortId}.AutoClampOnFoupOn");
  392. return false;
  393. }
  394. }
  395. public virtual bool Initialize()
  396. {
  397. for (int i = 0; i < 25; i++)
  398. {
  399. _waferId.Add(new List<string>()
  400. {
  401. i.ToString("D2"),"","",""
  402. });
  403. }
  404. if (!Enum.TryParse(Name, out ModuleName m))
  405. Enum.TryParse(Module, out m);
  406. _module = m;
  407. if ((int)_module >= 97)
  408. PortId = ((int)_module - 96).ToString();
  409. else
  410. PortId = ((int)_module).ToString();
  411. DoorState = FoupDoorState.Unknown;
  412. WaferManager.Instance.SubscribeLocation(_module, _slotNumber);
  413. CarrierManager.Instance.SubscribeLocation(_module.ToString());
  414. DATA.Subscribe(Name, "IsPresent", () => _isPresent);
  415. DATA.Subscribe(Name, "IsPlaced", () => _isPlaced);
  416. DATA.Subscribe(Name, "IsClamped", () => ClampState == FoupClampState.Close);
  417. DATA.Subscribe(Name, "IsLoaded", () => _isLoaded);
  418. DATA.Subscribe(Name, "IsDocked", () => DockState == FoupDockState.Docked);
  419. DATA.Subscribe(Name, "IsDoorOpen", () => DoorState == FoupDoorState.Open);
  420. DATA.Subscribe(Name, "ModuleState", () => "Idle");
  421. DATA.Subscribe(Name, "CarrierId", () => _carrierId);
  422. DATA.Subscribe(Name, "LPLotID", () => _lplotID);
  423. DATA.Subscribe(Name,"SmartTag", () => SmartTag);
  424. DATA.Subscribe(Name, "IsMapped", () => _isMapped);
  425. DATA.Subscribe($"{Name}.LoadportState", () => State);
  426. DATA.Subscribe($"{Name}.LoadportBusy", () => IsBusy);
  427. DATA.Subscribe($"{Name}.LoadportError", () => ErrorCode);
  428. DATA.Subscribe($"{Name}.CassetteState", () => CassetteState);
  429. DATA.Subscribe($"{Name}.FoupClampState", () => ClampState);
  430. DATA.Subscribe($"{Name}.FoupDockState", () => DockState);
  431. DATA.Subscribe($"{Name}.FoupDoorState", () => DoorState);
  432. DATA.Subscribe($"{Name}.SlotMap", () => SlotMap);
  433. DATA.Subscribe($"{Name}.IndicatiorLoad", () => IndicatiorLoad);
  434. DATA.Subscribe($"{Name}.IndicatiorUnload", () => IndicatiorUnload);
  435. DATA.Subscribe($"{Name}.IndicatiorPresence", () => IndicatiorPresence);
  436. DATA.Subscribe($"{Name}.IndicatiorPlacement", () => IndicatiorPlacement);
  437. DATA.Subscribe($"{Name}.IndicatiorAlarm", () => IndicatorAlarm);
  438. DATA.Subscribe($"{Name}.IndicatiorAccessAuto", () => IndicatiorAccessAuto);
  439. DATA.Subscribe($"{Name}.IndicatiorAccessManual", () => IndicatiorAccessManual);
  440. DATA.Subscribe($"{Name}.IndicatiorOpAccess", () => IndicatiorOpAccess);
  441. DATA.Subscribe($"{Name}.IndicatiorStatus1", () => IndicatiorStatus1);
  442. DATA.Subscribe($"{Name}.IndicatiorStatus2", () => IndicatiorStatus2);
  443. #region E84 active indicator
  444. DATA.Subscribe($"{Name}.Valid", () => IndicatorVALID==IndicatorState.ON);
  445. DATA.Subscribe($"{Name}.CS0",()=>IndicatorCS0 == IndicatorState.ON);
  446. DATA.Subscribe($"{Name}.CS1", () => IndicatorCS1 == IndicatorState.ON);
  447. DATA.Subscribe($"{Name}.TransferRequest", () => IndicatorTR_REQ == IndicatorState.ON);
  448. DATA.Subscribe($"{Name}.Busy", () => IndicatorBUSY == IndicatorState.ON);
  449. DATA.Subscribe($"{Name}.TransferComplete", () => IndicatorCOMPT == IndicatorState.ON);
  450. DATA.Subscribe($"{Name}.CONT", () => IndicatorCONT == IndicatorState.ON);
  451. #endregion
  452. #region E84 Passive Indicator
  453. DATA.Subscribe($"{Name}.LoadRequest", () => IndicatorL_REQ == IndicatorState.ON);
  454. DATA.Subscribe($"{Name}.UnloadRequest", () => IndicatorU_REQ == IndicatorState.ON);
  455. DATA.Subscribe($"{Name}.ReadyToTransfer", () => IndicatorREADY == IndicatorState.ON);
  456. DATA.Subscribe($"{Name}.HandoffAvailable", () => IndicatorHO_AVBL == IndicatorState.ON);
  457. DATA.Subscribe($"{Name}.ES", () => IndicatorES==IndicatorState.ON );
  458. #endregion
  459. DATA.Subscribe($"{Name}.CasstleType", () => (int)CasstleType);
  460. DATA.Subscribe($"{Name}.InfoPadCarrierType", () => InfoPadCarrierType);
  461. DATA.Subscribe($"{Name}.InfoPadCarrierTypeInformation", () => InfoPadCarrierTypeInformation);
  462. DATA.Subscribe($"{Name}.InfoPadCarrierIndex", () => InfoPadCarrierIndex);
  463. DATA.Subscribe($"{Name}.IsError", () => State == DeviceState.Error);
  464. //if (PortStateVariableNames.Length > _lpIndex)
  465. // DATA.Subscribe(PortStateVariableNames[_lpIndex], () => (_isPlaced && _isPresent) ? "1" : "0");
  466. //if (PortSlotMapVariableNames.Length > _lpIndex)
  467. // DATA.Subscribe(PortSlotMapVariableNames[_lpIndex], () => SlotMap);
  468. //if (PortWaferIdVariableNames.Length > _lpIndex)
  469. // DATA.Subscribe(PortWaferIdVariableNames[_lpIndex], UpdatedWaferIdList);
  470. EV.Subscribe(new EventItem("Event", EventCarrierArrived, "Carrier arrived"));
  471. EV.Subscribe(new EventItem("Event", EventCarrierRemoved, "Carrier removed"));
  472. EV.Subscribe(new EventItem("Event", EventCarrierIdRead, "Carrier ID read"));
  473. EV.Subscribe(new EventItem("Event", EventCarrierIdReadFailed, "Carrier ID read failed"));
  474. EV.Subscribe(new EventItem("Event", EventCarrierIdWrite, "Carrier ID write"));
  475. EV.Subscribe(new EventItem("Event", EventCarrierIdWriteFailed, "Carrier ID write failed"));
  476. EV.Subscribe(new EventItem("Event", EventSlotMapAvailable, "Slot map available"));
  477. EV.Subscribe(new EventItem("Event", EventCarrierUnloaded, "Carrier unloaded"));
  478. EV.Subscribe(new EventItem("Event", EventCarrierLoaded, "Carrier loaded"));
  479. EV.Subscribe(new EventItem("Event", EventRfIdRead, "Carrier RFID read"));
  480. EV.Subscribe(new EventItem("Event", EventRfIdReadFailed, "Carrier RFID read failed"));
  481. EV.Subscribe(new EventItem("Event", EventRfIdWrite, "Carrier RFID write"));
  482. EV.Subscribe(new EventItem("Event", EventRfIdWriteFailed, "Carrier RFID write failed"));
  483. EV.Subscribe(new EventItem("Event", EventPortClamped, "Port was clamped."));
  484. EV.Subscribe(new EventItem("Event", EventPortUnClamped, "Port was unclamped."));
  485. EV.Subscribe(new EventItem("Event", AlarmLoadPortError, $"Load Port {Name}error", EventLevel.Alarm, EventType.EventUI_Notify));
  486. EV.Subscribe(new EventItem("Event", AlarmLoadPortMappingError, $"Load Port {Name} mapping error", EventLevel.Alarm, EventType.EventUI_Notify));
  487. EV.Subscribe(new EventItem("Event", AlarmCarrierIDReadError, $"Load Port {Name} read carrierID error", EventLevel.Alarm, EventType.EventUI_Notify));
  488. //}
  489. IsIdle = true;
  490. //_state = ModuleStateEnum.Idle;
  491. IndicatorStateFeedback = new IndicatorState[20];
  492. if (_lpE84Callback != null)
  493. {
  494. _lpE84Callback.OnE84ActiveSignalChange += _lpE84Callback_OnE84ActiveSignalChange;
  495. _lpE84Callback.OnE84PassiveSignalChange += _lpE84Callback_OnE84PassiveSignalChange;
  496. _lpE84Callback.OnE84HandOffComplete += _lpE84Callback_OnE84HandOffComplete;
  497. _lpE84Callback.OnE84HandOffStart += _lpE84Callback_OnE84HandOffStart;
  498. _lpE84Callback.OnE84HandOffTimeout += _lpE84Callback_OnE84HandOffTimeout;
  499. }
  500. RegisterOperation();
  501. return true;
  502. }
  503. private void _lpE84Callback_OnE84PassiveSignalChange(E84SignalID arg2, bool arg3)
  504. {
  505. ;
  506. }
  507. private void _lpE84Callback_OnE84HandOffTimeout(E84Timeout arg2, string arg3)
  508. {
  509. ;
  510. }
  511. private void _lpE84Callback_OnE84HandOffStart(string arg2)
  512. {
  513. OnE84HandOffStart(arg2 == "Load");
  514. }
  515. private void _lpE84Callback_OnE84HandOffComplete(string arg2)
  516. {
  517. OnE84HandOffComplete(arg2 == "Load");
  518. }
  519. private void _lpE84Callback_OnE84ActiveSignalChange(E84SignalID arg2, bool arg3)
  520. {
  521. ;
  522. }
  523. public virtual bool Connect()
  524. {
  525. return true;
  526. }
  527. public virtual bool IsAutoReadCarrierID
  528. {
  529. get
  530. {
  531. return SC.ContainsItem($"LoadPort.{_module}.EnableAutoCarrierIdRead") ?
  532. SC.GetValue<bool>($"LoadPort.{_module}.EnableAutoCarrierIdRead") : true;
  533. }
  534. }
  535. public virtual bool IsBypassCarrierIDReader
  536. {
  537. get
  538. {
  539. return SC.ContainsItem($"LoadPort.{_module}.BypassCarrierIDReader") ?
  540. SC.GetValue<bool>($"LoadPort.{_module}.BypassCarrierIDReader") : false;
  541. }
  542. }
  543. private void RegisterOperation()
  544. {
  545. OP.Subscribe($"{Name}.LoadportHome", (string cmd, object[] param) =>
  546. {
  547. if (!Home(out string reason))
  548. {
  549. EV.PostWarningLog(Module, $"{Name} can not start home, {reason}");
  550. return false;
  551. }
  552. EV.PostInfoLog(Module, $"{Name} start home");
  553. return true;
  554. });
  555. OP.Subscribe($"{Name}.LoadportReset", (string cmd, object[] param) =>
  556. {
  557. if (!ClearError(out string reason))
  558. {
  559. EV.PostWarningLog(Module, $"{Name} can not reset, {reason}");
  560. return false;
  561. }
  562. EV.PostInfoLog(Module, $"{Name} start reset");
  563. return true;
  564. });
  565. OP.Subscribe($"{Name}.LoadportStop", (string cmd, object[] param) =>
  566. {
  567. if (!Stop(out string reason))
  568. {
  569. EV.PostWarningLog(Module, $"{Name} can not stop, {reason}");
  570. return false;
  571. }
  572. EV.PostInfoLog(Module, $"{Name} stop");
  573. return true;
  574. });
  575. OP.Subscribe($"{Name}.LoadportLoad", (string cmd, object[] param) =>
  576. {
  577. if (!Load(out string reason))
  578. {
  579. EV.PostWarningLog(Module, $"{Name} can not load, {reason}");
  580. return false;
  581. }
  582. EV.PostInfoLog(Module, $"{Name} start load");
  583. return true;
  584. });
  585. OP.Subscribe($"{Name}.LoadportLoadWithoutMap", (string cmd, object[] param) =>
  586. {
  587. if (!LoadWithoutMap(out string reason))
  588. {
  589. EV.PostWarningLog(Module, $"{Name} can not load without map, {reason}");
  590. return false;
  591. }
  592. EV.PostInfoLog(Module, $"{Name} start load without map");
  593. return true;
  594. });
  595. OP.Subscribe($"{Name}.LoadportLoadWithMap", (string cmd, object[] param) =>
  596. {
  597. if (!Load(out string reason))
  598. {
  599. EV.PostWarningLog(Module, $"{Name} can not load with map, {reason}");
  600. return false;
  601. }
  602. if (!QueryWaferMap(out reason))
  603. {
  604. EV.PostWarningLog(Module, $"{Name} can not map, {reason}");
  605. return false;
  606. }
  607. EV.PostInfoLog(Module, $"{Name} start load with map");
  608. return true;
  609. });
  610. OP.Subscribe($"{Name}.LoadportUnload", (string cmd, object[] param) =>
  611. {
  612. if (!Unload(out string reason))
  613. {
  614. EV.PostWarningLog(Module, $"{Name} can not unload, {reason}");
  615. return false;
  616. }
  617. EV.PostInfoLog(Module, $"{Name} start unload");
  618. return true;
  619. });
  620. OP.Subscribe($"{Name}.LoadportClamp", (string cmd, object[] param) =>
  621. {
  622. if (!Clamp(out string reason))
  623. {
  624. EV.PostWarningLog(Module, $"{Name} can not clamp, {reason}");
  625. return false;
  626. }
  627. EV.PostInfoLog(Module, $"{Name} start clamp");
  628. return true;
  629. });
  630. OP.Subscribe($"{Name}.LoadportUnclamp", (string cmd, object[] param) =>
  631. {
  632. if (!Unclamp(out string reason))
  633. {
  634. EV.PostWarningLog(Module, $"{Name} can not unclamp, {reason}");
  635. return false;
  636. }
  637. EV.PostInfoLog(Module, $"{Name} start unclamp");
  638. return true;
  639. });
  640. OP.Subscribe($"{Name}.LoadportOpenDoor", (string cmd, object[] param) =>
  641. {
  642. if (!OpenDoor(out string reason))
  643. {
  644. EV.PostWarningLog(Module, $"{Name} can not open door, {reason}");
  645. return false;
  646. }
  647. EV.PostInfoLog(Module, $"{Name} start open door");
  648. return true;
  649. });
  650. OP.Subscribe($"{Name}.LoadportOpenDoorNoMap", (string cmd, object[] param) =>
  651. {
  652. if (!OpenDoorNoMap(out string reason))
  653. {
  654. EV.PostWarningLog(Module, $"{Name} can not open door, {reason}");
  655. return false;
  656. }
  657. EV.PostInfoLog(Module, $"{Name} start open door");
  658. return true;
  659. });
  660. OP.Subscribe($"{Name}.LoadportCloseDoor", (string cmd, object[] param) =>
  661. {
  662. if (!CloseDoor(out string reason))
  663. {
  664. EV.PostWarningLog(Module, $"{Name} can not close door, {reason}");
  665. return false;
  666. }
  667. EV.PostInfoLog(Module, $"{Name} start close door");
  668. return true;
  669. });
  670. OP.Subscribe($"{Name}.LoadportDock", (string cmd, object[] param) =>
  671. {
  672. if (!Dock(out string reason))
  673. {
  674. EV.PostWarningLog(Module, $"{Name} can not dock, {reason}");
  675. return false;
  676. }
  677. EV.PostInfoLog(Module, $"{Name} start dock");
  678. return true;
  679. });
  680. OP.Subscribe($"{Name}.LoadportUndock", (string cmd, object[] param) =>
  681. {
  682. if (!Undock(out string reason))
  683. {
  684. EV.PostWarningLog(Module, $"{Name} can not undock, {reason}");
  685. return false;
  686. }
  687. EV.PostInfoLog(Module, $"{Name} start undock");
  688. return true;
  689. });
  690. OP.Subscribe($"{Name}.LoadportQueryState", (string cmd, object[] param) =>
  691. {
  692. if (!QueryState(out string reason))
  693. {
  694. EV.PostWarningLog(Module, $"{Name} can not query state, {reason}");
  695. return false;
  696. }
  697. EV.PostInfoLog(Module, $"{Name} start query state");
  698. return true;
  699. });
  700. OP.Subscribe($"{Name}.LoadportQueryLED", (string cmd, object[] param) =>
  701. {
  702. if (!QueryIndicator(out string reason))
  703. {
  704. EV.PostWarningLog(Module, $"{Name} can not query led state, {reason}");
  705. return false;
  706. }
  707. EV.PostInfoLog(Module, $"{Name} start query led state");
  708. return true;
  709. });
  710. OP.Subscribe($"{Name}.LoadportSetLED", (string cmd, object[] param) =>
  711. {
  712. int light = (int)param[0];
  713. int state = (int)param[1];
  714. if (!SetIndicator((Indicator)light, (IndicatorState)state, out string reason))
  715. {
  716. EV.PostWarningLog(Module, $"{Name} can not set led state, {reason}");
  717. return true;
  718. }
  719. EV.PostInfoLog(Module, $"{Name} start set led state");
  720. return true;
  721. });
  722. OP.Subscribe($"{Name}.LoadportMap", (string cmd, object[] param) =>
  723. {
  724. if (!QueryWaferMap(out string reason))
  725. {
  726. EV.PostWarningLog(Module, $"{Name} can not map, {reason}");
  727. return false;
  728. }
  729. EV.PostInfoLog(Module, $"{Name} start map");
  730. return true;
  731. });
  732. OP.Subscribe($"{Name}.SetCassetteType", (string cmd, object[] param) =>
  733. {
  734. if (!SetCassetteType(param, out string reason))
  735. {
  736. EV.PostWarningLog(Module, $"{Name} can not set type, {reason}");
  737. return false;
  738. }
  739. EV.PostInfoLog(Module, $"{Name} cassette type have set to {CasstleType}");
  740. return true;
  741. });
  742. OP.Subscribe($"{Name}.LoadportForceHome", (string cmd, object[] param) =>
  743. {
  744. if (!ForceHome(out string reason))
  745. {
  746. EV.PostWarningLog(Module, $"{Name} can not start force home, {reason}");
  747. return false;
  748. }
  749. EV.PostInfoLog(Module, $"{Name} start force home");
  750. return true;
  751. });
  752. OP.Subscribe($"{Name}.LoadportFOSBMode", (string cmd, object[] param) =>
  753. {
  754. if (!FOSBMode(out string reason))
  755. {
  756. EV.PostWarningLog(Module, $"{Name} can not change to FOSB mode, {reason}");
  757. return false;
  758. }
  759. IsFOSBMode = true;
  760. EV.PostInfoLog(Module, $"{Name} changed to FOSB mode");
  761. return true;
  762. });
  763. OP.Subscribe($"{Name}.LoadportFOUPMode", (string cmd, object[] param) =>
  764. {
  765. if (!FOUPMode(out string reason))
  766. {
  767. EV.PostWarningLog(Module, $"{Name} can not change to FOSB mode, {reason}");
  768. return false;
  769. }
  770. IsFOSBMode = true;
  771. EV.PostInfoLog(Module, $"{Name} changed to FOSB mode");
  772. return true;
  773. });
  774. OP.Subscribe($"{Name}.LoadportQueryFOSBMode", (string cmd, object[] param) =>
  775. {
  776. if (!QueryFOSBMode(out string reason))
  777. {
  778. EV.PostWarningLog(Module, $"{Name} can not change to FOUP mode, {reason}");
  779. return false;
  780. }
  781. IsFOSBMode = false;
  782. EV.PostInfoLog(Module, $"{Name} changed to FOSB mode");
  783. return true;
  784. });
  785. OP.Subscribe($"{Name}.SetLoadportLotID", (string cmd, object[] param) =>
  786. {
  787. if (!SetLotID(param, out string reason))
  788. {
  789. return false;
  790. }
  791. EV.PostInfoLog(Module, $"{Name} set lotID for loadport.");
  792. return true;
  793. });
  794. }
  795. private bool SetLotID(object[] param, out string reason)
  796. {
  797. reason = "";
  798. if (param == null || param.Length == 0) return false;
  799. _lplotID = param[0].ToString();
  800. return true;
  801. }
  802. private bool SetCassetteType(object[] param, out string reason)
  803. {
  804. reason = "";
  805. if (param.Length != 1)
  806. {
  807. reason = "Invalid setting parameter.";
  808. return false;
  809. }
  810. CasstleType = (CasstleType)int.Parse(param[0].ToString());
  811. return true;
  812. }
  813. public virtual bool FALoad(out string reason)
  814. {
  815. reason = "";
  816. return true;
  817. }
  818. public virtual bool FAUnload(out string reason)
  819. {
  820. reason = "";
  821. return true;
  822. }
  823. public virtual bool Load(out string reason)
  824. {
  825. reason = "";
  826. return true;
  827. }
  828. public virtual bool LoadWithoutMap(out string reason)
  829. {
  830. reason = "";
  831. return true;
  832. }
  833. public virtual bool QueryWaferMap(out string reason)
  834. {
  835. reason = "";
  836. return true;
  837. }
  838. public virtual bool GetMapInfo(out string reason)
  839. {
  840. reason = "";
  841. return true;
  842. }
  843. public virtual bool SetWaferMap(out string reason)
  844. {
  845. reason = "";
  846. return true;
  847. }
  848. public virtual bool QueryFOSBMode(out string reason)
  849. {
  850. reason = "";
  851. return true;
  852. }
  853. /// <summary>
  854. /// FOSB模式下的Dock指令
  855. /// </summary>
  856. /// <param name="reason"></param>
  857. /// <returns></returns>
  858. public virtual bool FOSBDock(out string reason)
  859. {
  860. reason = "";
  861. return true;
  862. }
  863. /// <summary>
  864. /// FOSB模式下的FOSBUnDock指令
  865. /// </summary>
  866. /// <param name="reason"></param>
  867. /// <returns></returns>
  868. public virtual bool FOSBUnDock(out string reason)
  869. {
  870. reason = "";
  871. return true;
  872. }
  873. /// <summary>
  874. /// FOSB模式下的开门指令
  875. /// </summary>
  876. /// <param name="reason"></param>
  877. /// <returns></returns>
  878. public virtual bool FOSBDoorOpen(out string reason)
  879. {
  880. reason = "";
  881. return true;
  882. }
  883. /// <summary>
  884. /// FOSB模式下的关门指令
  885. /// </summary>
  886. /// <param name="reason"></param>
  887. /// <returns></returns>
  888. public virtual bool FOSBDoorClose(out string reason)
  889. {
  890. reason = "";
  891. return true;
  892. }
  893. /// <summary>
  894. /// FOSB模式下的门下移指令
  895. /// </summary>
  896. /// <param name="reason"></param>
  897. /// <returns></returns>
  898. public virtual bool FOSBDoorDown(out string reason)
  899. {
  900. reason = "";
  901. return true;
  902. }
  903. /// <summary>
  904. /// FOSB模式下的门上移指令
  905. /// </summary>
  906. /// <param name="reason"></param>
  907. /// <returns></returns>
  908. public virtual bool FOSBDoorUp(out string reason)
  909. {
  910. reason = "";
  911. return true;
  912. }
  913. public virtual bool SetIndicator(IndicatorType light, IndicatorState state)
  914. {
  915. if (LoadPortIndicatorLightMap.ContainsKey(light))
  916. {
  917. SetIndicator(LoadPortIndicatorLightMap[light], state, out string _);
  918. return true;
  919. }
  920. EV.PostWarningLog(Module, $"Not supported indicator {light}");
  921. return false;
  922. }
  923. public IndicatorState GetIndicator(IndicatorType light)
  924. {
  925. if (LoadPortIndicatorLightMap.ContainsKey(light))
  926. {
  927. return IndicatorStateFeedback[(int)LoadPortIndicatorLightMap[light]];
  928. }
  929. EV.PostWarningLog(Module, $"Not supported indicator {light}");
  930. return IndicatorState.OFF;
  931. }
  932. public virtual bool SetE84Available(out string reason)
  933. {
  934. if (_lpE84Callback != null)
  935. {
  936. _lpE84Callback.SetHoAutoControl(false);
  937. _lpE84Callback.SetHoAvailable(true);
  938. }
  939. reason = "";
  940. return true;
  941. }
  942. public virtual bool SetE84Unavailable(out string reason)
  943. {
  944. if (_lpE84Callback != null)
  945. {
  946. _lpE84Callback.SetHoAutoControl(false);
  947. _lpE84Callback.SetHoAvailable(false);
  948. }
  949. reason = "";
  950. return true;
  951. }
  952. public virtual bool SetIndicator(Indicator light, IndicatorState state, out string reason)
  953. {
  954. reason = "";
  955. return true;
  956. }
  957. public virtual bool QueryIndicator(out string reason)
  958. {
  959. reason = "";
  960. return true;
  961. }
  962. public virtual bool QueryState(out string reason)
  963. {
  964. reason = "";
  965. return true;
  966. }
  967. public virtual bool Undock(out string reason)
  968. {
  969. reason = "";
  970. return true;
  971. }
  972. public virtual bool Dock(out string reason)
  973. {
  974. reason = "";
  975. return true;
  976. }
  977. public virtual bool CloseDoor(out string reason)
  978. {
  979. reason = "";
  980. return true;
  981. }
  982. public virtual bool OpenDoor(out string reason)
  983. {
  984. reason = "";
  985. return true;
  986. }
  987. public virtual bool OpenDoorNoMap(out string reason)
  988. {
  989. reason = "";
  990. return true;
  991. }
  992. public virtual bool OpenDoorAndMap(out string reason)
  993. {
  994. reason = "";
  995. return true;
  996. }
  997. public virtual bool Unclamp(out string reason)
  998. {
  999. reason = "";
  1000. return true;
  1001. }
  1002. public virtual bool Clamp(out string reason)
  1003. {
  1004. reason = "";
  1005. return true;
  1006. }
  1007. public virtual bool Unload(out string reason)
  1008. {
  1009. reason = "";
  1010. return true;
  1011. }
  1012. public virtual bool Stop(out string reason)
  1013. {
  1014. reason = "";
  1015. return true;
  1016. }
  1017. public virtual bool ClearError(out string reason)
  1018. {
  1019. reason = "";
  1020. return true;
  1021. }
  1022. public virtual bool Init(out string reason)
  1023. {
  1024. reason = "";
  1025. return true;
  1026. }
  1027. public virtual bool Home(out string reason)
  1028. {
  1029. reason = "";
  1030. return true;
  1031. }
  1032. public virtual bool ForceHome(out string reason)
  1033. {
  1034. reason = "";
  1035. return true;
  1036. }
  1037. public virtual bool FOSBMode(out string reason)
  1038. {
  1039. reason = "";
  1040. return true;
  1041. }
  1042. public virtual bool FOUPMode(out string reason)
  1043. {
  1044. reason = "";
  1045. return true;
  1046. }
  1047. public virtual bool ReadRfId(out string reason)
  1048. {
  1049. reason = "";
  1050. return true;
  1051. }
  1052. public virtual bool ReadRfid(int startpage, int length, out string reason)
  1053. {
  1054. reason = "";
  1055. return true;
  1056. }
  1057. public virtual bool WriteRfId(string cid, out string reason)
  1058. {
  1059. reason = "";
  1060. return true;
  1061. }
  1062. public virtual bool WriteRfid(string cid, int startpage, int length, out string reason)
  1063. {
  1064. reason = "";
  1065. return true;
  1066. }
  1067. public virtual bool ChangeAccessMode(bool auto, out string reason)
  1068. {
  1069. reason = "";
  1070. return true;
  1071. }
  1072. public virtual bool GetAccessMode(out string reason)
  1073. {
  1074. reason = "";
  1075. return true;
  1076. }
  1077. //public virtual bool ChangeTransferState(LoadPortTransferState newState, out string reason)
  1078. //{
  1079. // reason = "";
  1080. // return true;
  1081. //}
  1082. public virtual bool SetServiceCommand(bool inService, out string reason)
  1083. {
  1084. reason = "";
  1085. return true;
  1086. }
  1087. public virtual bool GetE84HandoffActiveSignalState(E84PioPosition piopostion, E84PioSignalAtoP AtoPsignal)
  1088. {
  1089. if (_lpE84Callback == null) return false;
  1090. switch (AtoPsignal)
  1091. {
  1092. case E84PioSignalAtoP.AM_AVBL:
  1093. return _lpE84Callback.GetE84SignalState(E84SignalID.AM_AVBL);
  1094. case E84PioSignalAtoP.BUSY:
  1095. return _lpE84Callback.GetE84SignalState(E84SignalID.BUSY);
  1096. case E84PioSignalAtoP.COMPT:
  1097. return _lpE84Callback.GetE84SignalState(E84SignalID.COMPT);
  1098. case E84PioSignalAtoP.CONT:
  1099. return _lpE84Callback.GetE84SignalState(E84SignalID.CONT);
  1100. case E84PioSignalAtoP.CS_0:
  1101. return _lpE84Callback.GetE84SignalState(E84SignalID.CS_0);
  1102. case E84PioSignalAtoP.CS_1:
  1103. return _lpE84Callback.GetE84SignalState(E84SignalID.CS_1);
  1104. case E84PioSignalAtoP.TR_REQ:
  1105. return _lpE84Callback.GetE84SignalState(E84SignalID.TR_REQ);
  1106. case E84PioSignalAtoP.VALID:
  1107. return _lpE84Callback.GetE84SignalState(E84SignalID.VALID);
  1108. default:
  1109. return false;
  1110. }
  1111. }
  1112. public virtual bool GetE84HandoffPassiveSignalState(E84PioPosition piopostion, E84PioSignalPtoA PtoAsignal)
  1113. {
  1114. if (_lpE84Callback == null) return false;
  1115. switch (PtoAsignal)
  1116. {
  1117. case E84PioSignalPtoA.ES:
  1118. return _lpE84Callback.GetE84SignalState(E84SignalID.ES);
  1119. case E84PioSignalPtoA.HO_AVBL:
  1120. return _lpE84Callback.GetE84SignalState(E84SignalID.HO_AVBL);
  1121. case E84PioSignalPtoA.L_REQ:
  1122. return _lpE84Callback.GetE84SignalState(E84SignalID.L_REQ);
  1123. case E84PioSignalPtoA.READY:
  1124. return _lpE84Callback.GetE84SignalState(E84SignalID.READY);
  1125. case E84PioSignalPtoA.U_REQ:
  1126. return _lpE84Callback.GetE84SignalState(E84SignalID.U_REQ);
  1127. default:
  1128. return false;
  1129. }
  1130. }
  1131. public virtual void SetE84HandoffSignalState(E84PioPosition piopostion, E84PioSignalPtoA PtoAsignal, bool state)
  1132. {
  1133. if (_lpE84Callback == null) return;
  1134. switch (PtoAsignal)
  1135. {
  1136. case E84PioSignalPtoA.ES:
  1137. _lpE84Callback.SetE84SignalState(E84PassiveSignal.ES, state);
  1138. break;
  1139. case E84PioSignalPtoA.HO_AVBL:
  1140. _lpE84Callback.SetE84SignalState(E84PassiveSignal.HOAvbl, state);
  1141. break;
  1142. case E84PioSignalPtoA.L_REQ:
  1143. _lpE84Callback.SetE84SignalState(E84PassiveSignal.LoadReq, state);
  1144. break;
  1145. case E84PioSignalPtoA.READY:
  1146. _lpE84Callback.SetE84SignalState(E84PassiveSignal.Ready, state);
  1147. break;
  1148. case E84PioSignalPtoA.U_REQ:
  1149. _lpE84Callback.SetE84SignalState(E84PassiveSignal.UnloadReq, state);
  1150. break;
  1151. default:
  1152. break;
  1153. }
  1154. }
  1155. public virtual void Monitor()
  1156. {
  1157. _presentTrig.CLK = _isPresent;
  1158. _placetTrig.CLK = _isPlaced;
  1159. _dockTrig.CLK = _isDocked;
  1160. _clampTrig.CLK = ClampState == FoupClampState.Close;
  1161. _doorTrig.CLK = DoorState == FoupDoorState.Close;
  1162. _accessSwPressedTrig.CLK = _isAccessSwPressed;
  1163. if (_lpE84Callback != null)
  1164. {
  1165. _lpE84Callback.SetFoupStatus(_isPlaced);
  1166. _lpE84Callback.SetReadyTransferStatus((ClampState == FoupClampState.Open) &&
  1167. (DockState == FoupDockState.Undocked) && Initalized);
  1168. }
  1169. }
  1170. public virtual void Reset()
  1171. {
  1172. Error = false;
  1173. ExecuteError = false;
  1174. MapError = false;
  1175. ReadCarrierIDError = false;
  1176. if (_carrierIDReadercallback != null)
  1177. _carrierIDReadercallback.Reset();
  1178. }
  1179. public virtual void Terminate()
  1180. {
  1181. }
  1182. private List<List<string>> UpdatedWaferIdList()
  1183. {
  1184. WaferInfo[] wafers = WaferManager.Instance.GetWafers(_module);
  1185. for (int i = 0; i < wafers.Length; i++)
  1186. {
  1187. _waferId[i][1] = wafers[i].LaserMarker;
  1188. _waferId[i][2] = wafers[i].T7Code;
  1189. _waferId[i][3] = wafers[i].WaferID;
  1190. }
  1191. return _waferId;
  1192. }
  1193. public virtual bool IsEnableMapWafer(out string reason)
  1194. {
  1195. reason = string.Empty;
  1196. if (!IsIdle)
  1197. {
  1198. reason = "Cassette is busy";
  1199. return false;
  1200. }
  1201. if (!IsPlacement)
  1202. {
  1203. reason = "Cassette not properly placed";
  1204. return false;
  1205. }
  1206. if (IsWaferProtrude)
  1207. {
  1208. reason = "Found wafer protrude";
  1209. return false;
  1210. }
  1211. if (CassetteState != LoadportCassetteState.Normal)
  1212. {
  1213. reason = "Cassette is abnormal";
  1214. return false;
  1215. }
  1216. return IsPlacement && !IsWaferProtrude;
  1217. }
  1218. public abstract bool IsEnableMapWafer();
  1219. public abstract bool IsEnableTransferWafer();
  1220. public abstract bool IsEnableTransferWafer(out string reason);
  1221. public virtual bool IsEnableLoad()
  1222. {
  1223. return _isPresent && _isPlaced;
  1224. }
  1225. public virtual void ResetData()
  1226. {
  1227. _isMapped=false;
  1228. }
  1229. private CarrierOnLPState _CarrierOnState { get; set; } = CarrierOnLPState.Unknow;
  1230. protected void ConfirmAddCarrier()
  1231. {
  1232. if (_isPresent && _isPlaced)
  1233. {
  1234. if (_CarrierOnState != CarrierOnLPState.On)
  1235. {
  1236. CarrierManager.Instance.CreateCarrier(Name);
  1237. _CarrierOnState = CarrierOnLPState.On;
  1238. SerializableDictionary<string, string> dvid = new SerializableDictionary<string, string>();
  1239. dvid[PORT_ID] = PortId;
  1240. dvid["PortID"] = PortId;
  1241. dvid[PORT_CTGRY] = PortCategory;
  1242. dvid[PORT_CARRIER_TYPE] = InfoPadCarrierType;
  1243. EV.Notify(EventCarrierArrived, dvid);
  1244. if (_lpcallback != null) _lpcallback.CarrierArrive();
  1245. if (IsAutoClampOnFoupOn)
  1246. Clamp(out _);
  1247. if (IsAutoReadCarrierID)
  1248. ReadRfId(out _);
  1249. }
  1250. IsComplete = false;
  1251. }
  1252. }
  1253. protected void ConfirmRemoveCarrier()
  1254. {
  1255. if (!_isPlaced)
  1256. {
  1257. WaferManager.Instance.DeleteWafer(ModuleHelper.Converter(Name), 0, _slotNumber);
  1258. CarrierManager.Instance.DeleteCarrier(Name);
  1259. if (_CarrierOnState == CarrierOnLPState.On)
  1260. {
  1261. _CarrierOnState = CarrierOnLPState.Off;
  1262. SerializableDictionary<string, string> dvid = new SerializableDictionary<string, string>();
  1263. dvid[PORT_ID] = PortId;
  1264. dvid["PortID"] = PortId;
  1265. dvid[PORT_CTGRY] = PortCategory;
  1266. dvid[CAR_ID] = _carrierId ?? "";
  1267. dvid["CarrierID"] = _carrierId ?? "";
  1268. EV.Notify(EventCarrierRemoved, dvid);
  1269. if (_lpcallback != null) _lpcallback.CarrerRemove(_carrierId);
  1270. }
  1271. IsComplete = false;
  1272. _isMapped = false;
  1273. _carrierId = "";
  1274. }
  1275. }
  1276. public void OnSlotMapRead(string _slotMap)
  1277. {
  1278. for (int i = 0; i < _slotNumber; i++)
  1279. {
  1280. // No wafer: "0", Wafer: "1", Crossed:"2", Undefined: "?", Overlapping wafers: "W"
  1281. WaferInfo wafer = null;
  1282. switch (_slotMap[i])
  1283. {
  1284. case '0':
  1285. WaferManager.Instance.DeleteWafer(_module, i);
  1286. CarrierManager.Instance.UnregisterCarrierWafer(Name, i);
  1287. break;
  1288. case '1':
  1289. wafer = WaferManager.Instance.CreateWafer(_module, i, WaferStatus.Normal);
  1290. WaferManager.Instance.UpdateWaferSize(_module, i, GetCurrentWaferSize());
  1291. CarrierManager.Instance.RegisterCarrierWafer(Name, i, wafer);
  1292. break;
  1293. case '2':
  1294. wafer = WaferManager.Instance.CreateWafer(_module, i, WaferStatus.Crossed);
  1295. WaferManager.Instance.UpdateWaferSize(_module, i, GetCurrentWaferSize());
  1296. CarrierManager.Instance.RegisterCarrierWafer(Name, i, wafer);
  1297. //NotifyWaferError(Name, i, WaferStatus.Crossed);
  1298. break;
  1299. case 'W':
  1300. wafer = WaferManager.Instance.CreateWafer(_module, i, WaferStatus.Double);
  1301. WaferManager.Instance.UpdateWaferSize(_module, i, GetCurrentWaferSize());
  1302. CarrierManager.Instance.RegisterCarrierWafer(Name, i, wafer);
  1303. //NotifyWaferError(Name, i, WaferStatus.Double);
  1304. break;
  1305. case '?':
  1306. wafer = WaferManager.Instance.CreateWafer(_module, i, WaferStatus.Unknown);
  1307. WaferManager.Instance.UpdateWaferSize(_module, i, GetCurrentWaferSize());
  1308. CarrierManager.Instance.RegisterCarrierWafer(Name, i, wafer);
  1309. //NotifyWaferError(Name, i, WaferStatus.Unknown);
  1310. break;
  1311. }
  1312. }
  1313. SerializableDictionary<string, string> dvid = new SerializableDictionary<string, string>();
  1314. dvid[SLOT_MAP] = _slotMap;
  1315. dvid["SlotMap"] = _slotMap;
  1316. dvid[PORT_ID] = PortId;
  1317. dvid["PortID"] = PortId;
  1318. dvid[PORT_CTGRY] = PortCategory;
  1319. dvid[CAR_ID] = CarrierId ?? "";
  1320. dvid["CarrierID"] = CarrierId ?? "";
  1321. EV.Notify(EventSlotMapAvailable, dvid);
  1322. if (_slotMap.Contains("2"))
  1323. {
  1324. MapError = true;
  1325. Error = true;
  1326. EV.Notify(AlarmLoadPortMappingError, new SerializableDictionary<string, object> {
  1327. {"AlarmText","Mapped Crossed wafer." }
  1328. });
  1329. EV.PostAlarmLog(_module.ToString(), "Mapped Crossed wafer.");
  1330. }
  1331. if (_slotMap.Contains("W"))
  1332. {
  1333. MapError = true;
  1334. Error = true;
  1335. EV.Notify(AlarmLoadPortMappingError, new SerializableDictionary<string, object> {
  1336. {"AlarmText","Mapped Double wafer." }
  1337. });
  1338. EV.PostAlarmLog(_module.ToString(), "Mapped Double wafer.");
  1339. }
  1340. if (_slotMap.Contains("?"))
  1341. {
  1342. MapError = true;
  1343. Error = true;
  1344. EV.Notify(AlarmLoadPortMappingError, new SerializableDictionary<string, object> {
  1345. {"AlarmText","Mapped Unknown wafer." }
  1346. });
  1347. EV.PostAlarmLog(_module.ToString(), "Mapped Unknown wafer.");
  1348. }
  1349. if (_lpcallback != null) _lpcallback.MappingComplete(_carrierId, _slotMap);
  1350. _isMapped = true;
  1351. }
  1352. private string GetSlotMap()
  1353. {
  1354. WaferInfo[] wafers = WaferManager.Instance.GetWafers(ModuleHelper.Converter(Name));
  1355. string slot = "";
  1356. for (int i = 0; i < _slotNumber && i < wafers.Length; i++)
  1357. {
  1358. slot += wafers[i].IsEmpty ? "0" : "1";
  1359. }
  1360. return slot;
  1361. }
  1362. public bool IsWaferEnableTransfer()
  1363. {
  1364. WaferInfo[] wafers = WaferManager.Instance.GetWafers(ModuleHelper.Converter(Name));
  1365. foreach (WaferInfo wafer in wafers)
  1366. {
  1367. if (wafer.Status == WaferStatus.Crossed || wafer.Status == WaferStatus.Double)
  1368. {
  1369. EV.PostWarningLog(Name, $"At least one wafer is {wafer.Status.ToString()}.");
  1370. return false;
  1371. }
  1372. }
  1373. return true;
  1374. }
  1375. /// <summary>
  1376. /// 获取LP中空缺Slot
  1377. /// </summary>
  1378. /// <returns>返回一个list, 顺序为从下到上.(0-25)</returns>
  1379. public List<int> GetEmptySlot()
  1380. {
  1381. List<int> slot = new List<int>();
  1382. if (IsMapped)
  1383. {
  1384. WaferInfo[] wafers = WaferManager.Instance.GetWafers(ModuleHelper.Converter(Name));
  1385. for (int i = 0; i < _slotNumber; i++)
  1386. {
  1387. if (wafers[i].IsEmpty)
  1388. slot.Add(i);
  1389. }
  1390. return slot;
  1391. }
  1392. else
  1393. {
  1394. return null;
  1395. }
  1396. }
  1397. public virtual bool ReadCarrierID(int offset = 0, int length = 16)
  1398. {
  1399. if (_carrierIDReadercallback != null)
  1400. return _carrierIDReadercallback.ReadCarrierID(offset, length);
  1401. return false;
  1402. }
  1403. public virtual bool WriteCarrierID(string carrierID, int offset = 0, int length = 16)
  1404. {
  1405. if (_carrierIDReadercallback != null)
  1406. return _carrierIDReadercallback.WriteCarrierID(offset, length, carrierID);
  1407. return false;
  1408. }
  1409. public void OnCarrierIdRead(string data)
  1410. {
  1411. if (_isPlaced && _isPresent)
  1412. {
  1413. _carrierId = "";
  1414. var items = data.Split(new string[] { " ", "\t", "\r", "\n" }, StringSplitOptions.RemoveEmptyEntries);
  1415. foreach (var item in items)
  1416. {
  1417. if (item.StartsWith("CST:") && item.Length > 4)
  1418. _carrierId = item.Substring(4).Trim();
  1419. if (item.StartsWith("LOT:") && item.Length > 4)
  1420. _lotId = item.Substring(4).Trim();
  1421. }
  1422. if (string.IsNullOrEmpty(_carrierId))
  1423. {
  1424. _carrierId = data;
  1425. }
  1426. SmartTag = data;
  1427. SerializableDictionary<string, string> dvid = new SerializableDictionary<string, string>();
  1428. dvid["CarrierID"] = _carrierId ?? "";
  1429. dvid[CAR_ID] = _carrierId ?? "";
  1430. dvid[PORT_ID] = PortId;
  1431. dvid["PortID"] = PortId;
  1432. dvid["SmartTag"] = SmartTag;
  1433. dvid[PORT_CTGRY] = PortCategory;
  1434. dvid[PORT_CARRIER_TYPE] = InfoPadCarrierType;
  1435. EV.Notify(EventCarrierIdRead, dvid);
  1436. CarrierManager.Instance.UpdateCarrierId(Name, _carrierId);
  1437. CarrierManager.Instance.UpdateCarrierLot(Name, _lotId);
  1438. if (_lpcallback != null) _lpcallback.CarrierIDReadSuccess(_carrierId);
  1439. ReadCarrierIDError = false;
  1440. }
  1441. else
  1442. {
  1443. EV.PostWarningLog(Module, $"No FOUP found, carrier id {data} not saved");
  1444. }
  1445. }
  1446. public void OnCarrierIdRead(ModuleName module, string name, string code)
  1447. {
  1448. OnCarrierIdRead(code);
  1449. }
  1450. public void ProceedSetCarrierID(string cid)
  1451. {
  1452. _carrierId = cid;
  1453. SerializableDictionary<string, string> dvid = new SerializableDictionary<string, string>();
  1454. //dvid[CAR_ID] = cid ?? "";
  1455. dvid["CarrierID"] = cid ?? "";
  1456. dvid["PortID"] = PortId;
  1457. dvid[PORT_CTGRY] = PortCategory;
  1458. EV.Notify(EventCarrierIdWrite, dvid);
  1459. CarrierManager.Instance.UpdateCarrierId(Name, cid);
  1460. }
  1461. public void OnCarrierIdWrite(ModuleName module, string name, string id)
  1462. {
  1463. OnCarrierIdWrite(id);
  1464. }
  1465. public void OnCarrierIdWrite(string carrierId)
  1466. {
  1467. if (_isPlaced && _isPresent)
  1468. {
  1469. SerializableDictionary<string, string> dvid = new SerializableDictionary<string, string>();
  1470. dvid[CAR_ID] = carrierId ?? "";
  1471. dvid["CarrierID"] = carrierId ?? "";
  1472. dvid[PORT_ID] = PortId;
  1473. dvid[PORT_CTGRY] = PortCategory;
  1474. EV.Notify(EventCarrierIdWrite, dvid);
  1475. }
  1476. else
  1477. {
  1478. EV.PostWarningLog(Module, $"No FOUP found, carrier id {carrierId} not saved");
  1479. }
  1480. }
  1481. public void OnCarrierIdReadFailed(ModuleName module, string name)
  1482. {
  1483. OnCarrierIdReadFailed();
  1484. }
  1485. public void OnCarrierIdReadFailed()
  1486. {
  1487. if (_isPlaced && _isPresent)
  1488. {
  1489. _carrierId = "";
  1490. SerializableDictionary<string, string> dvid = new SerializableDictionary<string, string>();
  1491. dvid[PORT_ID] = PortId;
  1492. dvid["PortID"] = PortId;
  1493. dvid[PORT_CTGRY] = PortCategory;
  1494. EV.Notify(EventCarrierIdReadFailed, dvid);
  1495. if (_lpcallback != null) _lpcallback.CarrierIDReadFail();
  1496. EV.Notify(AlarmCarrierIDReadError, new SerializableDictionary<string, object> {
  1497. {"AlarmText","CarrierID read fail." }
  1498. });
  1499. //ReadCarrierIDError = true;
  1500. }
  1501. else
  1502. {
  1503. EV.PostWarningLog(Module, "No FOUP found, carrier id read is not valid");
  1504. }
  1505. }
  1506. public void OnCarrierIdWriteFailed(ModuleName module, string name)
  1507. {
  1508. OnCarrierIdWriteFailed();
  1509. }
  1510. public void OnCarrierIdWriteFailed()
  1511. {
  1512. if (_isPlaced && _isPresent)
  1513. {
  1514. SerializableDictionary<string, string> dvid = new SerializableDictionary<string, string>();
  1515. dvid[PORT_ID] = PortId;
  1516. dvid[PORT_CTGRY] = PortCategory;
  1517. EV.Notify(EventCarrierIdWriteFailed, dvid);
  1518. }
  1519. else
  1520. {
  1521. EV.PostWarningLog(Module, "No FOUP found, carrier id not valid");
  1522. }
  1523. }
  1524. public void OnCarrierIdRead(ModuleName module, string carrierId)
  1525. {
  1526. OnCarrierIdRead(carrierId);
  1527. }
  1528. public void OnCarrierIdReadFailed(ModuleName module)
  1529. {
  1530. OnCarrierIdReadFailed();
  1531. }
  1532. public void OnCarrierIdWrite(ModuleName module, string carrierId)
  1533. {
  1534. OnCarrierIdWrite(carrierId);
  1535. }
  1536. public void OnCarrierIdWriteFailed(ModuleName module)
  1537. {
  1538. OnCarrierIdWriteFailed();
  1539. }
  1540. public void OnRfIdRead(ModuleName module, string rfid)
  1541. {
  1542. if (_isPlaced && _isPresent)
  1543. {
  1544. _rfid = rfid;
  1545. SerializableDictionary<string, string> dvid = new SerializableDictionary<string, string>();
  1546. dvid[CAR_ID] = _carrierId ?? "";
  1547. dvid["CarrierID"] = _carrierId ?? "";
  1548. dvid[PORT_ID] = PortId;
  1549. dvid[PORT_CTGRY] = PortCategory;
  1550. dvid[RF_ID] = rfid ?? "";
  1551. EV.Notify(EventRfIdRead, dvid);
  1552. CarrierManager.Instance.UpdateRfId(Name, rfid);
  1553. ReadCarrierIDError = false;
  1554. }
  1555. else
  1556. {
  1557. EV.PostWarningLog(Module, "No FOUP found, rf id read not valid");
  1558. }
  1559. }
  1560. public void OnRfIdReadFailed(ModuleName module)
  1561. {
  1562. if (_isPlaced && _isPresent)
  1563. {
  1564. _rfid = "";
  1565. SerializableDictionary<string, string> dvid = new SerializableDictionary<string, string>();
  1566. dvid[CAR_ID] = _carrierId ?? "";
  1567. dvid["CarrierID"] = _carrierId ?? "";
  1568. dvid[PORT_ID] = PortId;
  1569. dvid[PORT_CTGRY] = PortCategory;
  1570. EV.Notify(EventRfIdReadFailed, dvid);
  1571. }
  1572. else
  1573. {
  1574. EV.PostWarningLog(Module, "No FOUP found, rf id read is not valid");
  1575. }
  1576. }
  1577. public void OnRfIdWrite(ModuleName module, string rfid)
  1578. {
  1579. if (_isPlaced && _isPresent)
  1580. {
  1581. _rfid = rfid;
  1582. SerializableDictionary<string, string> dvid = new SerializableDictionary<string, string>();
  1583. dvid[CAR_ID] = _carrierId ?? "";
  1584. dvid["CarrierID"] = _carrierId ?? "";
  1585. dvid[PORT_ID] = PortId;
  1586. dvid[PORT_CTGRY] = PortCategory;
  1587. dvid[RF_ID] = rfid ?? "";
  1588. EV.Notify(EventRfIdWrite, dvid);
  1589. CarrierManager.Instance.UpdateRfId(Name, rfid);
  1590. }
  1591. else
  1592. {
  1593. EV.PostWarningLog(Module, "No FOUP found, rf id write not valid");
  1594. }
  1595. }
  1596. public void OnRfIdWriteFailed(ModuleName module)
  1597. {
  1598. if (_isPlaced && _isPresent)
  1599. {
  1600. _rfid = "";
  1601. SerializableDictionary<string, string> dvid = new SerializableDictionary<string, string>();
  1602. dvid[CAR_ID] = _carrierId ?? "";
  1603. dvid["CarrierID"] = _carrierId ?? "";
  1604. dvid[PORT_ID] = PortId;
  1605. dvid[PORT_CTGRY] = PortCategory;
  1606. dvid[RF_ID] = "";
  1607. //EV.PostWarningLog(Module, "Write RFID failed.");
  1608. EV.Notify(EventRfIdWriteFailed, dvid);
  1609. }
  1610. else
  1611. {
  1612. EV.PostWarningLog(Module, "No FOUP found, rf id write not valid");
  1613. }
  1614. }
  1615. public void LoadPortAccessMode(string accessMode)
  1616. {
  1617. this._accessMode = accessMode;
  1618. }
  1619. /// <summary>
  1620. /// 开始加载
  1621. /// </summary>
  1622. public void OnLoadStart()
  1623. {
  1624. if (_isPlaced)
  1625. {
  1626. if (_lpcallback != null) _lpcallback.LoadStart();
  1627. }
  1628. }
  1629. public void OnLoaded()
  1630. {
  1631. var dvid = new SerializableDictionary<string, string>
  1632. {
  1633. [CAR_ID] = _carrierId ?? "",
  1634. ["CarrierID"] = _carrierId ?? "",
  1635. ["PortID"] = PortId,
  1636. [PORT_ID] = PortId
  1637. };
  1638. _isLoaded = true;
  1639. EV.Notify(EventCarrierLoaded, dvid);
  1640. if (_lpcallback != null) _lpcallback.LoadComplete();
  1641. //}
  1642. }
  1643. /// <summary>
  1644. /// 开始加载
  1645. /// </summary>
  1646. public void OnUnLoadStart()
  1647. {
  1648. if (_isLoaded)
  1649. {
  1650. if (_lpcallback != null) _lpcallback.UnLoadStart();
  1651. }
  1652. }
  1653. public void OnUnloaded()
  1654. {
  1655. var dvid = new SerializableDictionary<string, string>();
  1656. dvid[PORT_CTGRY] = PortCategory;
  1657. dvid[PORT_ID] = PortId;
  1658. dvid["PortID"] = PortId;
  1659. dvid[CAR_ID] = _carrierId ?? "";
  1660. dvid["CarrierID"] = _carrierId ?? "";
  1661. EV.Notify(EventCarrierUnloaded, dvid);
  1662. //}
  1663. DockState = FoupDockState.Undocked;
  1664. if (_lpcallback != null) _lpcallback.UnloadComplete();
  1665. _isLoaded = false;
  1666. _isMapped = false;
  1667. }
  1668. public void OnE84HandOffStart(bool isload)
  1669. {
  1670. if (_lpcallback != null) _lpcallback.OnE84HandoffStart(isload);
  1671. }
  1672. public void OnE84HandOffComplete(bool isload)
  1673. {
  1674. if (_lpcallback != null) _lpcallback.OnE84HandoffComplete(isload);
  1675. }
  1676. public void OnFosbUndock()
  1677. {
  1678. var dvid = new SerializableDictionary<string, string>();
  1679. dvid[PORT_CTGRY] = PortCategory;
  1680. dvid[PORT_ID] = PortId;
  1681. dvid[CAR_ID] = _carrierId ?? "";
  1682. dvid["CarrierID"] = _carrierId ?? "";
  1683. EV.Notify(EventCarrierUnloaded, dvid);
  1684. //}
  1685. if (_lpcallback != null) _lpcallback.UnloadComplete();
  1686. }
  1687. public void OnHomed()
  1688. {
  1689. //for (int i = 0; i < _slotNumber; i++)
  1690. //{
  1691. WaferManager.Instance.DeleteWafer(ModuleHelper.Converter(Name), 0, _slotNumber);
  1692. //}
  1693. _isMapped = false;
  1694. var dvid = new SerializableDictionary<string, object>();
  1695. dvid[PORT_CTGRY] = PortCategory;
  1696. dvid[PORT_ID] = PortId;
  1697. dvid[CAR_ID] = _carrierId ?? "";
  1698. dvid["CarrierID"] = _carrierId ?? "";
  1699. EV.Notify(EventLPHomed);
  1700. if (_lpcallback != null) _lpcallback.OnLPHomed();
  1701. _isLoaded = false;
  1702. }
  1703. public void OnCloseDoor()
  1704. {
  1705. WaferManager.Instance.DeleteWafer(ModuleHelper.Converter(Name), 0, _slotNumber);
  1706. _isMapped = false;
  1707. }
  1708. public void OnError(string error = "")
  1709. {
  1710. EV.Notify($"{_module}{AlarmLoadPortError}", new SerializableDictionary<string, object> {
  1711. {"AlarmText",error }
  1712. });
  1713. if (ActionDone != null)
  1714. ActionDone(false);
  1715. }
  1716. protected void SetPresent(bool isPresent)
  1717. {
  1718. _isPresent = isPresent;
  1719. if (_isPresent)
  1720. {
  1721. //ConfirmAddCarrier();
  1722. }
  1723. else
  1724. {
  1725. //ConfirmRemoveCarrier();
  1726. }
  1727. }
  1728. protected void SetPlaced(bool isPlaced)
  1729. {
  1730. _isPlaced = isPlaced;
  1731. if (isPlaced)
  1732. {
  1733. ConfirmAddCarrier();
  1734. }
  1735. else if(!isPlaced)
  1736. {
  1737. ConfirmRemoveCarrier();
  1738. }
  1739. }
  1740. public void OnActionDone(bool result)
  1741. {
  1742. if (ActionDone != null)
  1743. ActionDone(result);
  1744. }
  1745. }
  1746. }