LoadPort.cs 50 KB

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