LoadPort.cs 49 KB

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