LoadPort.cs 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446
  1. using Aitex.Core.Common;
  2. using Aitex.Core.RT.DataCenter;
  3. using Aitex.Core.RT.Device;
  4. using Aitex.Core.RT.Event;
  5. using Aitex.Core.RT.OperationCenter;
  6. using Aitex.Core.RT.SCCore;
  7. using Aitex.Core.Util;
  8. using Aitex.Sorter.Common;
  9. using MECF.Framework.Common.Equipment;
  10. using MECF.Framework.Common.SubstrateTrackings;
  11. using MECF.Framework.RT.Core.Equipments;
  12. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadPorts.TDK;
  13. using System;
  14. using System.Collections.Generic;
  15. namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadPorts
  16. {
  17. public enum IndicatorType
  18. {
  19. Load,
  20. Unload,
  21. Presence,
  22. Placement,
  23. Alarm,
  24. Access,
  25. Status1,
  26. Status2,
  27. }
  28. public abstract class LoadPort : BaseDevice, IDevice
  29. {
  30. public IndicatorState IndicatiorLoad { get; set; }
  31. public IndicatorState IndicatiorUnload { get; set; }
  32. public IndicatorState IndicatiorPresence { get; set; }
  33. public IndicatorState IndicatorAlarm { get; set; }
  34. public IndicatorState IndicatiorPlacement { get; set; }
  35. public IndicatorState IndicatiorOpAccess { get; set; }
  36. public IndicatorState IndicatiorStatus1 { get; set; }
  37. public IndicatorState IndicatiorStatus2 { get; set; }
  38. public virtual FoupClampState ClampState { get; set; }
  39. public virtual FoupDoorState DoorState { get; set; }
  40. public virtual CasstleType CasstleType { get; set; }
  41. public string SlotMap
  42. {
  43. get { return GetSlotMap(); }
  44. }
  45. public virtual bool IsBusy { get; set; }
  46. public virtual bool IsIdle { get; set; }
  47. public virtual bool IsMoving { get; set; }
  48. public virtual LoadportCassetteState CassetteState
  49. {
  50. get;
  51. set;
  52. }
  53. public bool IsMapWaferByLoadPort { get; set; }
  54. public EnumLoadPortType PortType { get; set; }
  55. public bool Initalized { get; set; }
  56. public bool IsPresent
  57. {
  58. get { return _isPresent; }
  59. }
  60. public bool IsPlacement
  61. {
  62. get { return _isPlaced; }
  63. }
  64. public bool IsMapped
  65. {
  66. get { return _isMapped; }
  67. }
  68. public bool Error { get; set; }
  69. public string ErrorCode { get; set; }
  70. /// <summary>
  71. /// 是否处于FOSB模式
  72. /// </summary>
  73. public bool IsFOSBMode { get; set; }
  74. public DeviceState State
  75. {
  76. get
  77. {
  78. if (!Initalized)
  79. {
  80. return DeviceState.Unknown;
  81. }
  82. if (Error)
  83. {
  84. return DeviceState.Error;
  85. }
  86. if (IsBusy)
  87. return DeviceState.Busy;
  88. return DeviceState.Idle;
  89. }
  90. }
  91. public string CarrierId
  92. {
  93. get { return _carrierId; }
  94. }
  95. public string RfId
  96. {
  97. get { return _rfid; }
  98. }
  99. protected bool _isPresent;
  100. protected bool _isPlaced;
  101. protected string _carrierId;
  102. protected string _rfid;
  103. protected bool _isMapped;
  104. private ModuleName _module;
  105. private ModuleStateEnum _state;
  106. private List<List<string>> _waferId = new List<List<string>>();
  107. private static bool _isIndependentCEID = SC.ContainsItem("Fa.IndependentCEIDForLp") ? SC.GetValue<bool>("Fa.IndependentCEIDForLp") : false;
  108. public string PortId
  109. {
  110. get { return (_lpIndex + 1).ToString(); }
  111. }
  112. public string PortCategory
  113. {
  114. get
  115. {
  116. if (SC.GetConfigItem(PortLabelScNames[_lpIndex]) == null)
  117. return "";
  118. return SC.GetStringValue(PortLabelScNames[_lpIndex]);
  119. }
  120. }
  121. string[] PortStateVariableNames = new[]
  122. {
  123. "CARRIER_PORT1_STATE", "CARRIER_PORT2_STATE", "CARRIER_PORT3_STATE",
  124. "CARRIER_PORT4_STATE", "CARRIER_PORT5_STATE", "CARRIER_PORT6_STATE", "CARRIER_PORT7_STATE",
  125. "CARRIER_PORT8_STATE", "CARRIER_PORT9_STATE", "CARRIER_PORT10_STATE"
  126. };
  127. ModuleName[] PortModuleNames = new[]
  128. {
  129. ModuleName.LP1,ModuleName.LP2,ModuleName.LP3,ModuleName.LP4,ModuleName.LP5,
  130. ModuleName.LP6,ModuleName.LP7,ModuleName.LP8,ModuleName.LP9,ModuleName.LP10,
  131. };
  132. string[] PortSlotMapVariableNames = new[]
  133. {
  134. "CARRIER_PORT1_CURRENT_SLOTMAP", "CARRIER_PORT2_CURRENT_SLOTMAP", "CARRIER_PORT3_CURRENT_SLOTMAP",
  135. "CARRIER_PORT4_CURRENT_SLOTMAP", "CARRIER_PORT5_CURRENT_SLOTMAP", "CARRIER_PORT6_CURRENT_SLOTMAP", "CARRIER_PORT7_CURRENT_SLOTMAP",
  136. "CARRIER_PORT8_CURRENT_SLOTMAP", "CARRIER_PORT9_CURRENT_SLOTMAP", "CARRIER_PORT10_CURRENT_SLOTMAP"
  137. };
  138. string[] PortWaferIdVariableNames = new[]
  139. {
  140. "CARRIER_PORT1_CURRENT_WAFERID", "CARRIER_PORT2_CURRENT_WAFERID", "CARRIER_PORT3_CURRENT_WAFERID",
  141. "CARRIER_PORT4_CURRENT_WAFERID", "CARRIER_PORT5_CURRENT_WAFERID", "CARRIER_PORT6_CURRENT_WAFERID", "CARRIER_PORT7_CURRENT_WAFERID",
  142. "CARRIER_PORT8_CURRENT_WAFERID", "CARRIER_PORT9_CURRENT_WAFERID", "CARRIER_PORT10_CURRENT_WAFERID"
  143. };
  144. private string[] PortLabelScNames = new[]
  145. {
  146. "LoadPort.LoadPort1CarrierLabel","LoadPort.LoadPort2CarrierLabel","LoadPort.LoadPort3CarrierLabel","LoadPort.LoadPort4CarrierLabel",
  147. "LoadPort.LoadPort5CarrierLabel","LoadPort.LoadPort6CarrierLabel","LoadPort.LoadPort7CarrierLabel","LoadPort.LoadPort8CarrierLabel",
  148. "LoadPort.LoadPort9CarrierLabel","LoadPort.LoadPort10CarrierLabel",
  149. };
  150. private int _lpIndex = -1;
  151. private string EventCarrierArrived = "CARRIER_ARRIVED";
  152. private string EventCarrierIdRead = "CARRIER_ID_READ";
  153. private string EventCarrierIdReadFailed = "CARRIER_ID_READ_FAILED";
  154. private string EventCarrierIdWrite = "CARRIER_ID_WRITE";
  155. private string EventCarrierIdWriteFailed = "CARRIER_ID_WRITE_FAILED";
  156. private string EventSlotMapAvailable = "SLOT_MAP_AVAILABLE";
  157. private string EventCarrierRemoved = "CARRIER_REMOVED";
  158. private string EventCarrierUnloaded = "CARRIER_UNLOADED";
  159. private string EventCarrierloaded = "CARRIR_DOCK_COMPLETE";
  160. private string PORT_ID = "PORT_ID";
  161. private string CAR_ID = "CAR_ID";
  162. private string SLOT_MAP = "SLOT_MAP";
  163. private string PORT_CTGRY = "PORT_CTGRY";
  164. private string RF_ID = "RF_ID";
  165. private string EventRfIdRead = "RF_ID_READ";
  166. private string EventRfIdReadFailed = "RF_ID_READ_FAILED";
  167. private string EventRfIdWrite = "RF_ID_WRITE";
  168. #pragma warning disable 414
  169. private string EventRfIdWriteFailed = "RF_ID_WRITE_FAILED";
  170. #pragma warning restore 414
  171. private string AlarmCarrierPortError = "CarrierPortError";
  172. public LoadPort(string module, string name) : base(module, name, name, "")
  173. {
  174. for (int i = 0; i < 25; i++)
  175. {
  176. _waferId.Add(new List<string>()
  177. {
  178. i.ToString("D2"),"","",""
  179. });
  180. }
  181. if (!Enum.TryParse(name, out ModuleName m))
  182. Enum.TryParse(module, out m);
  183. _module = m;
  184. _lpIndex = Array.IndexOf(PortModuleNames, _module);
  185. DoorState = FoupDoorState.Unknown;
  186. System.Diagnostics.Trace.Assert(_lpIndex != -1);
  187. }
  188. public virtual bool Initialize()
  189. {
  190. WaferManager.Instance.SubscribeLocation(_module, 25);
  191. CarrierManager.Instance.SubscribeLocation(_module.ToString());
  192. DATA.Subscribe(Name, "IsPresent", () => _isPresent);
  193. DATA.Subscribe(Name, "IsPlaced", () => _isPlaced);
  194. DATA.Subscribe(Name, "ModuleState", () => _state.ToString());
  195. DATA.Subscribe(Name, "CarrierId", () => _carrierId);
  196. DATA.Subscribe(Name, "IsMapped", () => _isMapped);
  197. DATA.Subscribe($"{Name}.LoadportState", () => State);
  198. DATA.Subscribe($"{Name}.LoadportBusy", () => IsBusy);
  199. DATA.Subscribe($"{Name}.LoadportError", () => ErrorCode);
  200. DATA.Subscribe($"{Name}.CassetteState", () => CassetteState);
  201. DATA.Subscribe($"{Name}.FoupClampState", () => ClampState);
  202. DATA.Subscribe($"{Name}.FoupDoorState", () => DoorState);
  203. DATA.Subscribe($"{Name}.SlotMap", () => SlotMap);
  204. DATA.Subscribe($"{Name}.IndicatiorLoad", () => IndicatiorLoad);
  205. DATA.Subscribe($"{Name}.IndicatiorUnload", () => IndicatiorUnload);
  206. DATA.Subscribe($"{Name}.IndicatiorPresence", () => IndicatiorPresence);
  207. DATA.Subscribe($"{Name}.IndicatiorPlacement", () => IndicatiorPlacement);
  208. DATA.Subscribe($"{Name}.IndicatiorAlarm", () => IndicatorAlarm);
  209. DATA.Subscribe($"{Name}.IndicatiorOpAccess", () => IndicatiorOpAccess);
  210. DATA.Subscribe($"{Name}.IndicatiorStatus1", () => IndicatiorStatus1);
  211. DATA.Subscribe($"{Name}.IndicatiorStatus2", () => IndicatiorStatus2);
  212. DATA.Subscribe($"{Name}.CasstleType", () => CasstleType);
  213. DATA.Subscribe(PortStateVariableNames[_lpIndex], () => (_isPlaced && _isPresent) ? "1" : "0");
  214. DATA.Subscribe(PortSlotMapVariableNames[_lpIndex], () => SlotMap);
  215. DATA.Subscribe(PortWaferIdVariableNames[_lpIndex], UpdatedWaferIdList);
  216. if (_isIndependentCEID)
  217. {
  218. EV.Subscribe(new EventItem("Event", $"{_module}_{EventCarrierArrived}", "Carrier arrived"));
  219. EV.Subscribe(new EventItem("Event", $"{_module}_{EventCarrierRemoved}", "Carrier removed"));
  220. EV.Subscribe(new EventItem("Event", $"{_module}_{EventCarrierIdRead}", "Carrier ID read"));
  221. EV.Subscribe(new EventItem("Event", $"{_module}_{EventCarrierIdReadFailed}", "Carrier ID read failed"));
  222. EV.Subscribe(new EventItem("Event", $"{_module}_CAR_ID_WRITE_SUCCESSFULLY", "Carrier ID write"));
  223. EV.Subscribe(new EventItem("Event", $"{_module}_CAR_ID_WRITE_FAIL", "Carrier ID write failed"));
  224. EV.Subscribe(new EventItem("Event", $"{_module}_{EventSlotMapAvailable}", "Slot map available"));
  225. EV.Subscribe(new EventItem("Event", $"{_module}_{EventCarrierUnloaded}", "Carrier unloaded"));
  226. EV.Subscribe(new EventItem("Event", $"{_module}_CARRIR_LOAD_COMPLETE", "Carrier loaded"));
  227. EV.Subscribe(new EventItem("Event", $"{_module}_{EventRfIdRead}", "Carrier RFID read"));
  228. EV.Subscribe(new EventItem("Event", $"{_module}_{EventRfIdReadFailed}", "Carrier RFID read failed"));
  229. EV.Subscribe(new EventItem("Event", $"{_module}_{EventRfIdWrite}", "Carrier RFID write"));
  230. EV.Subscribe(new EventItem("Event", $"{_module}_{AlarmCarrierPortError}", "Carrier Port error", EventLevel.Alarm, EventType.HostNotification));
  231. }
  232. else
  233. {
  234. EV.Subscribe(new EventItem("Event", EventCarrierArrived, "Carrier arrived"));
  235. EV.Subscribe(new EventItem("Event", EventCarrierRemoved, "Carrier removed"));
  236. EV.Subscribe(new EventItem("Event", EventCarrierIdRead, "Carrier ID read"));
  237. EV.Subscribe(new EventItem("Event", EventCarrierIdReadFailed, "Carrier ID read failed"));
  238. EV.Subscribe(new EventItem("Event", EventCarrierIdWrite, "Carrier ID write"));
  239. EV.Subscribe(new EventItem("Event", EventCarrierIdWriteFailed, "Carrier ID write failed"));
  240. EV.Subscribe(new EventItem("Event", EventSlotMapAvailable, "Slot map available"));
  241. EV.Subscribe(new EventItem("Event", EventCarrierUnloaded, "Carrier unloaded"));
  242. EV.Subscribe(new EventItem("Event", EventCarrierloaded, "Carrier loaded"));
  243. EV.Subscribe(new EventItem("Event", EventRfIdRead, "Carrier RFID read"));
  244. EV.Subscribe(new EventItem("Event", EventRfIdReadFailed, "Carrier RFID read failed"));
  245. EV.Subscribe(new EventItem("Event", EventRfIdWrite, "Carrier RFID write"));
  246. EV.Subscribe(new EventItem("Event", AlarmCarrierPortError, "Carrier Port error", EventLevel.Alarm, EventType.HostNotification));
  247. }
  248. IsIdle = true;
  249. _state = ModuleStateEnum.Idle;
  250. RegisterOperation();
  251. return true;
  252. }
  253. public virtual bool Connect()
  254. {
  255. return true;
  256. }
  257. private void RegisterOperation()
  258. {
  259. OP.Subscribe($"{Name}.LoadportHome", (string cmd, object[] param) =>
  260. {
  261. if (!Home(out string reason))
  262. {
  263. EV.PostWarningLog(Module, $"{Name} can not start home, {reason}");
  264. return false;
  265. }
  266. EV.PostInfoLog(Module, $"{Name} start home");
  267. return true;
  268. });
  269. OP.Subscribe($"{Name}.LoadportReset", (string cmd, object[] param) =>
  270. {
  271. if (!ClearError(out string reason))
  272. {
  273. EV.PostWarningLog(Module, $"{Name} can not reset, {reason}");
  274. return false;
  275. }
  276. EV.PostInfoLog(Module, $"{Name} start reset");
  277. return true;
  278. });
  279. OP.Subscribe($"{Name}.LoadportStop", (string cmd, object[] param) =>
  280. {
  281. if (!Stop(out string reason))
  282. {
  283. EV.PostWarningLog(Module, $"{Name} can not stop, {reason}");
  284. return false;
  285. }
  286. EV.PostInfoLog(Module, $"{Name} stop");
  287. return true;
  288. });
  289. OP.Subscribe($"{Name}.LoadportLoad", (string cmd, object[] param) =>
  290. {
  291. if (!Load(out string reason))
  292. {
  293. EV.PostWarningLog(Module, $"{Name} can not load, {reason}");
  294. return false;
  295. }
  296. EV.PostInfoLog(Module, $"{Name} start load");
  297. return true;
  298. });
  299. OP.Subscribe($"{Name}.LoadportLoadWithoutMap", (string cmd, object[] param) =>
  300. {
  301. if (!LoadWithoutMap(out string reason))
  302. {
  303. EV.PostWarningLog(Module, $"{Name} can not load without map, {reason}");
  304. return false;
  305. }
  306. EV.PostInfoLog(Module, $"{Name} start load without map");
  307. return true;
  308. });
  309. OP.Subscribe($"{Name}.LoadportLoadWithMap", (string cmd, object[] param) =>
  310. {
  311. if (!Load(out string reason))
  312. {
  313. EV.PostWarningLog(Module, $"{Name} can not load with map, {reason}");
  314. return false;
  315. }
  316. if (!QueryWaferMap(out reason))
  317. {
  318. EV.PostWarningLog(Module, $"{Name} can not map, {reason}");
  319. return false;
  320. }
  321. EV.PostInfoLog(Module, $"{Name} start load with map");
  322. return true;
  323. });
  324. OP.Subscribe($"{Name}.LoadportUnload", (string cmd, object[] param) =>
  325. {
  326. if (!Unload(out string reason))
  327. {
  328. EV.PostWarningLog(Module, $"{Name} can not unload, {reason}");
  329. return false;
  330. }
  331. EV.PostInfoLog(Module, $"{Name} start unload");
  332. return true;
  333. });
  334. OP.Subscribe($"{Name}.LoadportClamp", (string cmd, object[] param) =>
  335. {
  336. if (!Clamp(out string reason))
  337. {
  338. EV.PostWarningLog(Module, $"{Name} can not clamp, {reason}");
  339. return false;
  340. }
  341. EV.PostInfoLog(Module, $"{Name} start clamp");
  342. return true;
  343. });
  344. OP.Subscribe($"{Name}.LoadportUnclamp", (string cmd, object[] param) =>
  345. {
  346. if (!Unclamp(out string reason))
  347. {
  348. EV.PostWarningLog(Module, $"{Name} can not unclamp, {reason}");
  349. return false;
  350. }
  351. EV.PostInfoLog(Module, $"{Name} start unclamp");
  352. return true;
  353. });
  354. OP.Subscribe($"{Name}.LoadportOpenDoor", (string cmd, object[] param) =>
  355. {
  356. if (!OpenDoor(out string reason))
  357. {
  358. EV.PostWarningLog(Module, $"{Name} can not open door, {reason}");
  359. return false;
  360. }
  361. EV.PostInfoLog(Module, $"{Name} start open door");
  362. return true;
  363. });
  364. OP.Subscribe($"{Name}.LoadportOpenDoorNoMap", (string cmd, object[] param) =>
  365. {
  366. if (!OpenDoorNoMap(out string reason))
  367. {
  368. EV.PostWarningLog(Module, $"{Name} can not open door, {reason}");
  369. return false;
  370. }
  371. EV.PostInfoLog(Module, $"{Name} start open door");
  372. return true;
  373. });
  374. OP.Subscribe($"{Name}.LoadportCloseDoor", (string cmd, object[] param) =>
  375. {
  376. if (!CloseDoor(out string reason))
  377. {
  378. EV.PostWarningLog(Module, $"{Name} can not close door, {reason}");
  379. return false;
  380. }
  381. EV.PostInfoLog(Module, $"{Name} start close door");
  382. return true;
  383. });
  384. OP.Subscribe($"{Name}.LoadportDock", (string cmd, object[] param) =>
  385. {
  386. if (!Dock(out string reason))
  387. {
  388. EV.PostWarningLog(Module, $"{Name} can not dock, {reason}");
  389. return false;
  390. }
  391. EV.PostInfoLog(Module, $"{Name} start dock");
  392. return true;
  393. });
  394. OP.Subscribe($"{Name}.LoadportUndock", (string cmd, object[] param) =>
  395. {
  396. if (!Undock(out string reason))
  397. {
  398. EV.PostWarningLog(Module, $"{Name} can not undock, {reason}");
  399. return false;
  400. }
  401. EV.PostInfoLog(Module, $"{Name} start undock");
  402. return true;
  403. });
  404. OP.Subscribe($"{Name}.LoadportQueryState", (string cmd, object[] param) =>
  405. {
  406. if (!QueryState(out string reason))
  407. {
  408. EV.PostWarningLog(Module, $"{Name} can not query state, {reason}");
  409. return false;
  410. }
  411. EV.PostInfoLog(Module, $"{Name} start query state");
  412. return true;
  413. });
  414. OP.Subscribe($"{Name}.LoadportQueryLED", (string cmd, object[] param) =>
  415. {
  416. if (!QueryIndicator(out string reason))
  417. {
  418. EV.PostWarningLog(Module, $"{Name} can not query led state, {reason}");
  419. return false;
  420. }
  421. EV.PostInfoLog(Module, $"{Name} start query led state");
  422. return true;
  423. });
  424. OP.Subscribe($"{Name}.LoadportSetLED", (string cmd, object[] param) =>
  425. {
  426. int light = (int)param[0];
  427. int state = (int)param[1];
  428. if (!SetIndicator((Indicator)light, (IndicatorState)state, out string reason))
  429. {
  430. EV.PostWarningLog(Module, $"{Name} can not set led state, {reason}");
  431. return true;
  432. }
  433. EV.PostInfoLog(Module, $"{Name} start set led state");
  434. return true;
  435. });
  436. OP.Subscribe($"{Name}.LoadportMap", (string cmd, object[] param) =>
  437. {
  438. if (!QueryWaferMap(out string reason))
  439. {
  440. EV.PostWarningLog(Module, $"{Name} can not map, {reason}");
  441. return false;
  442. }
  443. EV.PostInfoLog(Module, $"{Name} start map");
  444. return true;
  445. });
  446. OP.Subscribe($"{Name}.SetCassetteType", (string cmd, object[] param) =>
  447. {
  448. if (!SetCassetteType(param, out string reason))
  449. {
  450. EV.PostWarningLog(Module, $"{Name} can not set type, {reason}");
  451. return false;
  452. }
  453. EV.PostInfoLog(Module, $"{Name} cassette type have set to {CasstleType}");
  454. return true;
  455. });
  456. OP.Subscribe($"{Name}.LoadportForceHome", (string cmd, object[] param) =>
  457. {
  458. if (!ForceHome(out string reason))
  459. {
  460. EV.PostWarningLog(Module, $"{Name} can not start force home, {reason}");
  461. return false;
  462. }
  463. EV.PostInfoLog(Module, $"{Name} start force home");
  464. return true;
  465. });
  466. OP.Subscribe($"{Name}.LoadportFOSBMode", (string cmd, object[] param) =>
  467. {
  468. if (!FOSBMode(out string reason))
  469. {
  470. EV.PostWarningLog(Module, $"{Name} can not change to FOSB mode, {reason}");
  471. return false;
  472. }
  473. IsFOSBMode = true;
  474. EV.PostInfoLog(Module, $"{Name} changed to FOSB mode");
  475. return true;
  476. });
  477. OP.Subscribe($"{Name}.LoadportFOUPMode", (string cmd, object[] param) =>
  478. {
  479. if (!FOUPMode(out string reason))
  480. {
  481. EV.PostWarningLog(Module, $"{Name} can not change to FOSB mode, {reason}");
  482. return false;
  483. }
  484. IsFOSBMode = true;
  485. EV.PostInfoLog(Module, $"{Name} changed to FOSB mode");
  486. return true;
  487. });
  488. OP.Subscribe($"{Name}.LoadportQueryFOSBMode", (string cmd, object[] param) =>
  489. {
  490. if (!QueryFOSBMode(out string reason))
  491. {
  492. EV.PostWarningLog(Module, $"{Name} can not change to FOUP mode, {reason}");
  493. return false;
  494. }
  495. IsFOSBMode = false;
  496. EV.PostInfoLog(Module, $"{Name} changed to FOSB mode");
  497. return true;
  498. });
  499. }
  500. private bool SetCassetteType(object[] param, out string reason)
  501. {
  502. reason = "";
  503. if (param.Length != 1)
  504. {
  505. reason = "Invalid setting parameter.";
  506. return false;
  507. }
  508. CasstleType = (CasstleType)int.Parse(param[0].ToString());
  509. return true;
  510. }
  511. public virtual bool Load(out string reason)
  512. {
  513. reason = "";
  514. return true;
  515. }
  516. public virtual bool LoadWithoutMap(out string reason)
  517. {
  518. reason = "";
  519. return true;
  520. }
  521. public virtual bool QueryWaferMap(out string reason)
  522. {
  523. reason = "";
  524. return true;
  525. }
  526. public virtual bool QueryFOSBMode(out string reason)
  527. {
  528. reason = "";
  529. return true;
  530. }
  531. /// <summary>
  532. /// FOSB模式下的Dock指令
  533. /// </summary>
  534. /// <param name="reason"></param>
  535. /// <returns></returns>
  536. public virtual bool FOSBDock(out string reason)
  537. {
  538. reason = "";
  539. return true;
  540. }
  541. /// <summary>
  542. /// FOSB模式下的FOSBUnDock指令
  543. /// </summary>
  544. /// <param name="reason"></param>
  545. /// <returns></returns>
  546. public virtual bool FOSBUnDock(out string reason)
  547. {
  548. reason = "";
  549. return true;
  550. }
  551. /// <summary>
  552. /// FOSB模式下的开门指令
  553. /// </summary>
  554. /// <param name="reason"></param>
  555. /// <returns></returns>
  556. public virtual bool FOSBDoorOpen(out string reason)
  557. {
  558. reason = "";
  559. return true;
  560. }
  561. /// <summary>
  562. /// FOSB模式下的关门指令
  563. /// </summary>
  564. /// <param name="reason"></param>
  565. /// <returns></returns>
  566. public virtual bool FOSBDoorClose(out string reason)
  567. {
  568. reason = "";
  569. return true;
  570. }
  571. /// <summary>
  572. /// FOSB模式下的门下移指令
  573. /// </summary>
  574. /// <param name="reason"></param>
  575. /// <returns></returns>
  576. public virtual bool FOSBDoorDown(out string reason)
  577. {
  578. reason = "";
  579. return true;
  580. }
  581. /// <summary>
  582. /// FOSB模式下的门上移指令
  583. /// </summary>
  584. /// <param name="reason"></param>
  585. /// <returns></returns>
  586. public virtual bool FOSBDoorUp(out string reason)
  587. {
  588. reason = "";
  589. return true;
  590. }
  591. public bool SetIndicator(IndicatorType light, IndicatorState state)
  592. {
  593. switch (light)
  594. {
  595. case IndicatorType.Load:
  596. SetIndicator(Indicator.LOAD, state, out string _);
  597. break;
  598. case IndicatorType.Unload:
  599. SetIndicator(Indicator.UNLOAD, state, out string _);
  600. break;
  601. case IndicatorType.Access:
  602. SetIndicator(Indicator.OPACCESS, state, out string _);
  603. break;
  604. case IndicatorType.Alarm:
  605. SetIndicator(Indicator.ALARM, state, out string _);
  606. break;
  607. case IndicatorType.Presence:
  608. SetIndicator(Indicator.PRESENCE, state, out string _);
  609. break;
  610. case IndicatorType.Placement:
  611. SetIndicator(Indicator.PLACEMENT, state, out string _);
  612. break;
  613. case IndicatorType.Status1:
  614. SetIndicator(Indicator.STATUS1, state, out string _);
  615. break;
  616. case IndicatorType.Status2:
  617. SetIndicator(Indicator.STATUS2, state, out string _);
  618. break;
  619. default:
  620. EV.PostWarningLog(Module, $"Not supported indicator {light}");
  621. return false;
  622. }
  623. return true;
  624. }
  625. public virtual bool SetIndicator(Indicator light, IndicatorState state, out string reason)
  626. {
  627. reason = "";
  628. return true;
  629. }
  630. public virtual bool QueryIndicator(out string reason)
  631. {
  632. reason = "";
  633. return true;
  634. }
  635. public virtual bool QueryState(out string reason)
  636. {
  637. reason = "";
  638. return true;
  639. }
  640. public virtual bool Undock(out string reason)
  641. {
  642. reason = "";
  643. return true;
  644. }
  645. public virtual bool Dock(out string reason)
  646. {
  647. reason = "";
  648. return true;
  649. }
  650. public virtual bool CloseDoor(out string reason)
  651. {
  652. reason = "";
  653. return true;
  654. }
  655. public virtual bool OpenDoor(out string reason)
  656. {
  657. reason = "";
  658. return true;
  659. }
  660. public virtual bool OpenDoorNoMap(out string reason)
  661. {
  662. reason = "";
  663. return true;
  664. }
  665. public virtual bool OpenDoorAndMap(out string reason)
  666. {
  667. reason = "";
  668. return true;
  669. }
  670. public virtual bool Unclamp(out string reason)
  671. {
  672. reason = "";
  673. return true;
  674. }
  675. public virtual bool Clamp(out string reason)
  676. {
  677. reason = "";
  678. return true;
  679. }
  680. public virtual bool Unload(out string reason)
  681. {
  682. reason = "";
  683. return true;
  684. }
  685. public virtual bool Stop(out string reason)
  686. {
  687. reason = "";
  688. return true;
  689. }
  690. public virtual bool ClearError(out string reason)
  691. {
  692. reason = "";
  693. return true;
  694. }
  695. public virtual bool Home(out string reason)
  696. {
  697. reason = "";
  698. return true;
  699. }
  700. public virtual bool ForceHome(out string reason)
  701. {
  702. reason = "";
  703. return true;
  704. }
  705. public virtual bool FOSBMode(out string reason)
  706. {
  707. reason = "";
  708. return true;
  709. }
  710. public virtual bool FOUPMode(out string reason)
  711. {
  712. reason = "";
  713. return true;
  714. }
  715. public virtual void Monitor()
  716. {
  717. }
  718. public virtual void Reset()
  719. {
  720. }
  721. public virtual void Terminate()
  722. {
  723. }
  724. private List<List<string>> UpdatedWaferIdList()
  725. {
  726. WaferInfo[] wafers = WaferManager.Instance.GetWafers(_module);
  727. for (int i = 0; i < wafers.Length; i++)
  728. {
  729. _waferId[i][1] = wafers[i].LaserMarker;
  730. _waferId[i][2] = wafers[i].T7Code;
  731. _waferId[i][3] = wafers[i].WaferID;
  732. }
  733. return _waferId;
  734. }
  735. public abstract bool IsEnableMapWafer();
  736. public abstract bool IsEnableTransferWafer();
  737. public abstract bool IsEnableTransferWafer(out string reason);
  738. public virtual bool IsEnableLoad()
  739. {
  740. return _isPresent && _isPlaced;
  741. }
  742. protected void ConfirmAddCarrier()
  743. {
  744. if (_isPresent && _isPlaced)
  745. {
  746. CarrierManager.Instance.CreateCarrier(Name);
  747. if (_isIndependentCEID)
  748. {
  749. var dvid1 = new SerializableDictionary<string, string>
  750. {
  751. [$"{PORT_ID}_{_module}"] = PortId,
  752. [$"{PORT_CTGRY}_{_module}"] = PortCategory
  753. };
  754. EV.Notify($"{_module}_{EventCarrierArrived}", dvid1);
  755. }
  756. else
  757. {
  758. SerializableDictionary<string, string> dvid = new SerializableDictionary<string, string>();
  759. dvid[PORT_ID] = PortId;
  760. dvid[PORT_CTGRY] = PortCategory;
  761. EV.Notify(EventCarrierArrived, dvid);
  762. }
  763. }
  764. }
  765. protected void ConfirmRemoveCarrier()
  766. {
  767. if (!_isPresent && !_isPlaced)
  768. {
  769. for (int i = 0; i < 25; i++)
  770. {
  771. WaferManager.Instance.DeleteWafer(ModuleHelper.Converter(Name), 0, 25);
  772. }
  773. CarrierManager.Instance.DeleteCarrier(Name);
  774. if (_isIndependentCEID)
  775. {
  776. var dvid1 = new SerializableDictionary<string, string>
  777. {
  778. [$"{PORT_ID}_{_module}"] = PortId,
  779. [$"{CAR_ID}_{_module}"] = _carrierId ?? ""
  780. };
  781. EV.Notify($"{_module}_{EventCarrierRemoved}", dvid1);
  782. }
  783. else
  784. {
  785. SerializableDictionary<string, string> dvid = new SerializableDictionary<string, string>();
  786. dvid[PORT_ID] = PortId;
  787. dvid[PORT_CTGRY] = PortCategory;
  788. dvid[CAR_ID] = _carrierId ?? "";
  789. EV.Notify(EventCarrierRemoved, dvid);
  790. }
  791. _isMapped = false;
  792. _carrierId = "";
  793. }
  794. }
  795. public void OnSlotMapRead(string slotMap)
  796. {
  797. for (int i = 0; i < 25; i++)
  798. {
  799. // No wafer: "0", Wafer: "1", Crossed:"2", Undefined: "?", Overlapping wafers: "W"
  800. WaferInfo wafer = null;
  801. switch (slotMap[i])
  802. {
  803. case '0':
  804. WaferManager.Instance.DeleteWafer(_module, i);
  805. CarrierManager.Instance.UnregisterCarrierWafer(Name, i);
  806. break;
  807. case '1':
  808. wafer = WaferManager.Instance.CreateWafer(_module, i, WaferStatus.Normal);
  809. CarrierManager.Instance.RegisterCarrierWafer(Name, i, wafer);
  810. break;
  811. case '2':
  812. wafer = WaferManager.Instance.CreateWafer(_module, i, WaferStatus.Crossed);
  813. CarrierManager.Instance.RegisterCarrierWafer(Name, i, wafer);
  814. //NotifyWaferError(Name, i, WaferStatus.Crossed);
  815. break;
  816. case 'W':
  817. wafer = WaferManager.Instance.CreateWafer(_module, i, WaferStatus.Double);
  818. CarrierManager.Instance.RegisterCarrierWafer(Name, i, wafer);
  819. //NotifyWaferError(Name, i, WaferStatus.Double);
  820. break;
  821. case '?':
  822. wafer = WaferManager.Instance.CreateWafer(_module, i, WaferStatus.Unknown);
  823. CarrierManager.Instance.RegisterCarrierWafer(Name, i, wafer);
  824. //NotifyWaferError(Name, i, WaferStatus.Unknown);
  825. break;
  826. }
  827. }
  828. if (_isIndependentCEID)
  829. {
  830. var dvid1 = new SerializableDictionary<string, string>
  831. {
  832. [$"{SLOT_MAP}_{_module}"] = SlotMap,
  833. [$"{PORT_ID}_{_module}"] = PortId,
  834. [$"{PORT_CTGRY}_{_module}"] = PortCategory,
  835. [$"{CAR_ID}_{_module}"] = _carrierId ?? ""
  836. };
  837. EV.Notify($"{_module}_{EventSlotMapAvailable}", dvid1);
  838. }
  839. else
  840. {
  841. SerializableDictionary<string, string> dvid = new SerializableDictionary<string, string>();
  842. dvid[SLOT_MAP] = SlotMap;
  843. dvid[PORT_ID] = PortId;
  844. dvid[PORT_CTGRY] = PortCategory;
  845. dvid[CAR_ID] = CarrierId == null ? "" : CarrierId;
  846. EV.Notify(EventSlotMapAvailable, dvid);
  847. }
  848. _isMapped = true;
  849. }
  850. private string GetSlotMap()
  851. {
  852. WaferInfo[] wafers = WaferManager.Instance.GetWafers(ModuleHelper.Converter(Name));
  853. string slot = "";
  854. for (int i = 0; i < 25; i++)
  855. {
  856. slot += wafers[i].IsEmpty ? "0" : "1";
  857. }
  858. return slot;
  859. }
  860. /// <summary>
  861. /// 获取LP中空缺Slot
  862. /// </summary>
  863. /// <returns>返回一个list, 顺序为从下到上.(0-25)</returns>
  864. public List<int> GetEmptySlot()
  865. {
  866. List<int> slot = new List<int>();
  867. if (IsMapped)
  868. {
  869. WaferInfo[] wafers = WaferManager.Instance.GetWafers(ModuleHelper.Converter(Name));
  870. for (int i = 0; i < 25; i++)
  871. {
  872. if (wafers[i].IsEmpty)
  873. slot.Add(i);
  874. }
  875. return slot;
  876. }
  877. else
  878. {
  879. return null;
  880. }
  881. }
  882. public void OnCarrierIdRead(ModuleName module, string name, string carrierId)
  883. {
  884. if (_isPlaced && _isPresent)
  885. {
  886. _carrierId = carrierId;
  887. if (_isIndependentCEID)
  888. {
  889. var dvid1 = new SerializableDictionary<string, string>
  890. {
  891. [$"{CAR_ID}_{_module}"] = _carrierId ?? "",
  892. [$"{PORT_ID}_{_module}"] = PortId,
  893. [$"{PORT_CTGRY}_{_module}"] = PortCategory
  894. };
  895. EV.Notify($"{_module}_{EventCarrierIdRead}", dvid1);
  896. }
  897. else
  898. {
  899. SerializableDictionary<string, string> dvid = new SerializableDictionary<string, string>();
  900. dvid[CAR_ID] = carrierId ?? "";
  901. dvid[PORT_ID] = PortId;
  902. dvid[PORT_CTGRY] = PortCategory;
  903. EV.Notify(EventCarrierIdRead, dvid);
  904. }
  905. CarrierManager.Instance.UpdateCarrierId(Name, carrierId);
  906. }
  907. else
  908. {
  909. EV.PostWarningLog(Module, $"No FOUP found, carrier id {carrierId} not saved");
  910. }
  911. }
  912. public void OnCarrierIdWrite(ModuleName module, string name, string carrierId)
  913. {
  914. if (_isPlaced && _isPresent)
  915. {
  916. //_carrierId = carrierId;
  917. if (_isIndependentCEID)
  918. {
  919. var dvid1 = new SerializableDictionary<string, string>
  920. {
  921. [$"{CAR_ID}_{_module}"] = carrierId ?? "",
  922. [$"{PORT_ID}_{_module}"] = PortId
  923. };
  924. EV.Notify($"{_module}_CAR_ID_WRITE_SUCCESSFULLY", dvid1);
  925. }
  926. else
  927. {
  928. SerializableDictionary<string, string> dvid = new SerializableDictionary<string, string>();
  929. dvid[CAR_ID] = carrierId ?? "";
  930. dvid[PORT_ID] = PortId;
  931. dvid[PORT_CTGRY] = PortCategory;
  932. EV.Notify(EventCarrierIdWrite, dvid);
  933. }
  934. }
  935. else
  936. {
  937. EV.PostWarningLog(Module, $"No FOUP found, carrier id {carrierId} not saved");
  938. }
  939. }
  940. public void OnCarrierIdReadFailed(ModuleName module, string name)
  941. {
  942. if (_isPlaced && _isPresent)
  943. {
  944. _carrierId = "";
  945. if (_isIndependentCEID)
  946. {
  947. var dvid1 = new SerializableDictionary<string, string>
  948. {
  949. [$"{PORT_ID}_{_module}"] = PortId,
  950. [$"{PORT_CTGRY}_{_module}"] = PortCategory
  951. };
  952. EV.Notify($"{_module}_{EventCarrierIdReadFailed}", dvid1);
  953. }
  954. else
  955. {
  956. SerializableDictionary<string, string> dvid = new SerializableDictionary<string, string>();
  957. dvid[PORT_ID] = PortId;
  958. dvid[PORT_CTGRY] = PortCategory;
  959. EV.Notify(EventCarrierIdReadFailed, dvid);
  960. }
  961. }
  962. else
  963. {
  964. EV.PostWarningLog(Module, "No FOUP found, carrier id read is not valid");
  965. }
  966. }
  967. public void OnCarrierIdWriteFailed(ModuleName module, string name)
  968. {
  969. if (_isPlaced && _isPresent)
  970. {
  971. //_carrierId = "";
  972. if (_isIndependentCEID)
  973. {
  974. var dvid1 = new SerializableDictionary<string, string>
  975. {
  976. [$"{PORT_ID}_{_module}"] = PortId,
  977. [$"{PORT_CTGRY}_{_module}"] = PortCategory,
  978. [$"{CAR_ID}_{_module}"] = _carrierId ?? ""
  979. };
  980. EV.Notify($"{_module}_CAR_ID_WRITE_FAIL", dvid1);
  981. }
  982. else
  983. {
  984. SerializableDictionary<string, string> dvid = new SerializableDictionary<string, string>();
  985. dvid[PORT_ID] = PortId;
  986. dvid[PORT_CTGRY] = PortCategory;
  987. EV.Notify(EventCarrierIdWriteFailed, dvid);
  988. }
  989. }
  990. else
  991. {
  992. EV.PostWarningLog(Module, "No FOUP found, carrier id not valid");
  993. }
  994. }
  995. public void OnCarrierIdRead(ModuleName module, string carrierId)
  996. {
  997. OnCarrierIdRead(module, "", carrierId);
  998. }
  999. public void OnCarrierIdReadFailed(ModuleName module)
  1000. {
  1001. OnCarrierIdReadFailed(module, "");
  1002. }
  1003. public void OnCarrierIdWrite(ModuleName module, string carrierId)
  1004. {
  1005. OnCarrierIdWrite(module, "", carrierId);
  1006. }
  1007. public void OnCarrierIdWriteFailed(ModuleName module)
  1008. {
  1009. OnCarrierIdWriteFailed(module, "");
  1010. }
  1011. public void OnRfIdRead(ModuleName module, string rfid)
  1012. {
  1013. if (_isPlaced && _isPresent)
  1014. {
  1015. _rfid = rfid;
  1016. if (_isIndependentCEID)
  1017. {
  1018. var dvid1 = new SerializableDictionary<string, string>
  1019. {
  1020. [$"{CAR_ID}_{_module}"] = _carrierId ?? "",
  1021. [$"{PORT_ID}_{_module}"] = PortId,
  1022. [$"{PORT_CTGRY}_{_module}"] = PortCategory,
  1023. [$"{RF_ID}_{_module}"] = rfid ?? ""
  1024. };
  1025. EV.Notify($"{_module}_{EventRfIdRead}", dvid1);
  1026. }
  1027. else
  1028. {
  1029. SerializableDictionary<string, string> dvid = new SerializableDictionary<string, string>();
  1030. dvid[CAR_ID] = _carrierId ?? "";
  1031. dvid[PORT_ID] = PortId;
  1032. dvid[PORT_CTGRY] = PortCategory;
  1033. dvid[RF_ID] = rfid ?? "";
  1034. EV.Notify(EventRfIdRead, dvid);
  1035. }
  1036. CarrierManager.Instance.UpdateRfId(Name, rfid);
  1037. }
  1038. else
  1039. {
  1040. EV.PostWarningLog(Module, "No FOUP found, rf id read not valid");
  1041. }
  1042. }
  1043. public void OnRfIdReadFailed(ModuleName module)
  1044. {
  1045. if (_isPlaced && _isPresent)
  1046. {
  1047. _rfid = "";
  1048. if (_isIndependentCEID)
  1049. {
  1050. var dvid1 = new SerializableDictionary<string, string>
  1051. {
  1052. [$"{CAR_ID}_{_module}"] = _carrierId ?? "",
  1053. [$"{PORT_ID}_{_module}"] = PortId,
  1054. [$"{PORT_CTGRY}_{_module}"] = PortCategory
  1055. };
  1056. EV.Notify($"{_module}_{EventRfIdReadFailed}", dvid1);
  1057. }
  1058. else
  1059. {
  1060. SerializableDictionary<string, string> dvid = new SerializableDictionary<string, string>();
  1061. dvid[CAR_ID] = _carrierId ?? "";
  1062. dvid[PORT_ID] = PortId;
  1063. dvid[PORT_CTGRY] = PortCategory;
  1064. EV.Notify(EventRfIdReadFailed, dvid);
  1065. }
  1066. }
  1067. else
  1068. {
  1069. EV.PostWarningLog(Module, "No FOUP found, rf id read is not valid");
  1070. }
  1071. }
  1072. public void OnRfIdWrite(ModuleName module, string rfid)
  1073. {
  1074. if (_isPlaced && _isPresent)
  1075. {
  1076. _rfid = rfid;
  1077. if (_isIndependentCEID)
  1078. {
  1079. var dvid1 = new SerializableDictionary<string, string>
  1080. {
  1081. [$"{CAR_ID}_{_module}"] = _carrierId ?? "",
  1082. [$"{PORT_ID}_{_module}"] = PortId,
  1083. [$"{PORT_CTGRY}_{_module}"] = PortCategory,
  1084. [$"{RF_ID}_{_module}"] = rfid ?? ""
  1085. };
  1086. EV.Notify($"{_module}_{EventRfIdWrite}", dvid1);
  1087. }
  1088. else
  1089. {
  1090. SerializableDictionary<string, string> dvid = new SerializableDictionary<string, string>();
  1091. dvid[CAR_ID] = _carrierId ?? "";
  1092. dvid[PORT_ID] = PortId;
  1093. dvid[PORT_CTGRY] = PortCategory;
  1094. dvid[RF_ID] = rfid ?? "";
  1095. EV.Notify(EventRfIdWrite, dvid);
  1096. }
  1097. CarrierManager.Instance.UpdateRfId(Name, rfid);
  1098. }
  1099. else
  1100. {
  1101. EV.PostWarningLog(Module, "No FOUP found, rf id write not valid");
  1102. }
  1103. }
  1104. public void OnRfIdWriteFailed(ModuleName module)
  1105. {
  1106. if (_isPlaced && _isPresent)
  1107. {
  1108. _rfid = "";
  1109. if (_isIndependentCEID)
  1110. {
  1111. var dvid1 = new SerializableDictionary<string, string>
  1112. {
  1113. [$"{CAR_ID}_{_module}"] = _carrierId ?? "",
  1114. [$"{PORT_ID}_{_module}"] = PortId,
  1115. [$"{PORT_CTGRY}_{_module}"] = PortCategory,
  1116. [$"{RF_ID}_{_module}"] = ""
  1117. };
  1118. EV.Notify($"{_module}_{EventRfIdWrite}", dvid1);
  1119. }
  1120. else
  1121. {
  1122. SerializableDictionary<string, string> dvid = new SerializableDictionary<string, string>();
  1123. dvid[CAR_ID] = _carrierId ?? "";
  1124. dvid[PORT_ID] = PortId;
  1125. dvid[PORT_CTGRY] = PortCategory;
  1126. dvid[RF_ID] = "";
  1127. //EV.PostWarningLog(Module, "Write RFID failed.");
  1128. EV.Notify(EventRfIdWrite, dvid);
  1129. }
  1130. }
  1131. else
  1132. {
  1133. EV.PostWarningLog(Module, "No FOUP found, rf id write not valid");
  1134. }
  1135. }
  1136. public void OnLoaded()
  1137. {
  1138. if (_isIndependentCEID)
  1139. {
  1140. var dvid1 = new SerializableDictionary<string, string>
  1141. {
  1142. [$"{CAR_ID}_{_module}"] = _carrierId ?? "",
  1143. [$"{PORT_ID}_{_module}"] = PortId
  1144. };
  1145. EV.Notify($"{_module}_CARRIR_LOAD_COMPLETE", dvid1);
  1146. }
  1147. else
  1148. {
  1149. var dvid = new SerializableDictionary<string, string>
  1150. {
  1151. [CAR_ID] = _carrierId ?? "",
  1152. [PORT_ID] = PortId
  1153. };
  1154. EV.Notify(EventCarrierloaded, dvid);
  1155. }
  1156. }
  1157. public void OnUnloaded()
  1158. {
  1159. if (_isIndependentCEID)
  1160. {
  1161. var dvid1 = new SerializableDictionary<string, string>
  1162. {
  1163. [$"{PORT_CTGRY}_{_module}"] = PortCategory,
  1164. [$"{PORT_ID}_{_module}"] = PortId,
  1165. [$"{CAR_ID}_{_module}"] = _carrierId ?? "",
  1166. [$"{SLOT_MAP}_{_module}"] = SlotMap,
  1167. [$"LOT_ID_{_module}"] = CarrierManager.Instance.GetLotIdByLoadPort(_module.ToString())
  1168. };
  1169. EV.Notify($"{_module}_{EventCarrierUnloaded}", dvid1);
  1170. }
  1171. else
  1172. {
  1173. var dvid = new SerializableDictionary<string, string>();
  1174. dvid[PORT_CTGRY] = PortCategory;
  1175. dvid[PORT_ID] = PortId;
  1176. dvid[CAR_ID] = _carrierId ?? "";
  1177. EV.Notify(EventCarrierUnloaded, dvid);
  1178. }
  1179. for (int i = 0; i < 25; i++)
  1180. {
  1181. WaferManager.Instance.DeleteWafer(ModuleHelper.Converter(Name), 0, 25);
  1182. }
  1183. _isMapped = false;
  1184. }
  1185. public void OnHomed()
  1186. {
  1187. for (int i = 0; i < 25; i++)
  1188. {
  1189. WaferManager.Instance.DeleteWafer(ModuleHelper.Converter(Name), 0, 25);
  1190. }
  1191. _isMapped = false;
  1192. }
  1193. public void OnCloseDoor()
  1194. {
  1195. for (int i = 0; i < 25; i++)
  1196. {
  1197. WaferManager.Instance.DeleteWafer(ModuleHelper.Converter(Name), 0, 25);
  1198. }
  1199. _isMapped = false;
  1200. }
  1201. public void OnError()
  1202. {
  1203. EV.Notify(AlarmCarrierPortError);
  1204. EV.Notify($"{_module}_{AlarmCarrierPortError}");
  1205. }
  1206. protected void SetPresent(bool isPresent)
  1207. {
  1208. _isPresent = isPresent;
  1209. if (_isPresent)
  1210. {
  1211. ConfirmAddCarrier();
  1212. }
  1213. else
  1214. {
  1215. ConfirmRemoveCarrier();
  1216. }
  1217. }
  1218. protected void SetPlaced(bool isPlaced)
  1219. {
  1220. _isPlaced = isPlaced;
  1221. if (_isPlaced)
  1222. {
  1223. ConfirmAddCarrier();
  1224. }
  1225. else
  1226. {
  1227. ConfirmRemoveCarrier();
  1228. }
  1229. }
  1230. }
  1231. }