SchedulerFACallback.cs 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using Aitex.Core.RT.Event;
  7. using Aitex.Core.Util;
  8. using MECF.Framework.Common.Equipment;
  9. using MECF.Framework.Common.Jobs;
  10. using FurnaceRT.FAs;
  11. using Aitex.Core.RT.SCCore;
  12. using static MECF.Framework.Common.FAServices.Gem300Events;
  13. using MECF.Framework.Common.FAServices;
  14. using Aitex.Core.Common;
  15. using MECF.Framework.Common.SubstrateTrackings;
  16. using FabConnect.SecsGemInterface.Common;
  17. using Aitex.Core.RT.DataCenter;
  18. using MECF.Framework.FA.Core.FAControl;
  19. using FurnaceRT.Equipments.Systems;
  20. using Aitex.Core.RT.Log;
  21. using FurnaceRT.Equipments.PMs;
  22. namespace FurnaceRT.Equipments.Schedulers
  23. {
  24. public class SchedulerFACallback : ISchedulerFACallback
  25. {
  26. private Dictionary<ModuleName, string> PortJobStarted;
  27. private Dictionary<ModuleName, string> PortJobStopped;
  28. private Dictionary<ModuleName, string> PortJobPaused;
  29. private Dictionary<ModuleName, string> PortJobResumed;
  30. private Dictionary<ModuleName, string> PortJobAborted;
  31. private Dictionary<ModuleName, string> PortJobFinished;
  32. private Dictionary<ModuleName, string> PortJobFailed;
  33. private Dictionary<ModuleName, string> PortSequenceSelected;
  34. private Dictionary<ModuleName, string> PortSequenceSelectFailed;
  35. private Dictionary<ModuleName, string> PortId;
  36. public SchedulerFACallback()
  37. {
  38. PortJobStarted = new Dictionary<ModuleName, string>();
  39. PortJobStopped = new Dictionary<ModuleName, string>();
  40. PortJobPaused = new Dictionary<ModuleName, string>();
  41. PortJobResumed = new Dictionary<ModuleName, string>();
  42. PortJobAborted = new Dictionary<ModuleName, string>();
  43. PortJobFinished = new Dictionary<ModuleName, string>();
  44. PortJobFailed = new Dictionary<ModuleName, string>();
  45. PortSequenceSelected = new Dictionary<ModuleName, string>();
  46. PortSequenceSelectFailed = new Dictionary<ModuleName, string>();
  47. PortId = new Dictionary<ModuleName, string>();
  48. for (int i = 1; i < 45; i++)
  49. {
  50. if (!SC.ContainsItem($"System.Stocker.Stocker{i}WaferType"))
  51. continue;
  52. var module = ModuleHelper.Converter($"Stocker{i}");
  53. EV.Subscribe(new EventItem("Event", $"{module}JobStarted", $"{module}JobStarted"));
  54. EV.Subscribe(new EventItem("Event", $"{module}JobStopped", $"{module}JobStopped"));
  55. EV.Subscribe(new EventItem("Event", $"{module}JobPaused", $"{module}JobPaused"));
  56. EV.Subscribe(new EventItem("Event", $"{module}JobResumed", $"{module}JobResumed"));
  57. EV.Subscribe(new EventItem("Event", $"{module}JobAborted", $"{module}JobAborted"));
  58. EV.Subscribe(new EventItem("Event", $"{module}JobFinished", $"{module}JobFinished"));
  59. EV.Subscribe(new EventItem("Event", $"{module}JobFailed", $"{module}JobFailed"));
  60. EV.Subscribe(new EventItem("Event", $"{module}SequenceSelected", $"{module}SequenceSelected"));
  61. EV.Subscribe(new EventItem("Event", $"{module}SequenceSelectFailed", $"{module}SequenceSelectFailed"));
  62. EV.Subscribe(new EventItem("Event", UniversalEvents.EquipmentOFFLINE, $"EquipmentOFFLINE"));
  63. EV.Subscribe(new EventItem("Event", UniversalEvents.HOSTOFFLINE, $"HOSTOFFLINE"));
  64. EV.Subscribe(new EventItem("Event", UniversalEvents.ControlStateLOCAL, $"ControlStateLOCAL"));
  65. EV.Subscribe(new EventItem("Event", UniversalEvents.ControlStateREMOTE, $"ControlStateREMOTE"));
  66. EV.Subscribe(new EventItem("Event", UniversalEvents.ProcessingStarted, $"ProcessingStarted"));
  67. EV.Subscribe(new EventItem("Event", UniversalEvents.ProcessingCompleted, $"ProcessingCompleted"));
  68. EV.Subscribe(new EventItem("Event", UniversalEvents.ProcessingStopped, $"ProcessingStopped"));
  69. EV.Subscribe(new EventItem("Event", UniversalEvents.ProcessingStateChanged, $"ProcessingStateChanged"));
  70. EV.Subscribe(new EventItem("Event", UniversalEvents.EquipmentConstantChanged, $"EquipmentConstantChanged"));
  71. EV.Subscribe(new EventItem("Event", UniversalEvents.ProcessProgramChanged, $"ProcessProgramChanged"));
  72. EV.Subscribe(new EventItem("Event", UniversalEvents.ProcessProgramSelected, $"ProcessProgramSelected"));
  73. EV.Subscribe(new EventItem("Event", UniversalEvents.ProcessProgramCreated, $"ProcessProgramCreated"));
  74. EV.Subscribe(new EventItem("Event", UniversalEvents.SpoolingActivated, $"SpoolingActivated"));
  75. EV.Subscribe(new EventItem("Event", UniversalEvents.SpoolingDeactivated, $"SpoolingDeactivated"));
  76. EV.Subscribe(new EventItem("Event", UniversalEvents.SpoolingFailed, $"SpoolingFailed"));
  77. EV.Subscribe(new EventItem("Event", UniversalEvents.SpoolingFailed, $"SpoolingFailed"));
  78. EV.Subscribe(new EventItem("Event", UniversalEvents.ChargeStart, $"ChargeStart"));
  79. EV.Subscribe(new EventItem("Event", UniversalEvents.ChargeEnd, $"ChargeEnd"));
  80. EV.Subscribe(new EventItem("Event", UniversalEvents.DischargeStart, $"DischargeStart"));
  81. EV.Subscribe(new EventItem("Event", UniversalEvents.DischargeEnd, $"DischargeEnd"));
  82. EV.Subscribe(new EventItem("Event", UniversalEvents.BatchLocOccupied, $"BatchLocOccupied"));
  83. EV.Subscribe(new EventItem("Event", UniversalEvents.BatchLocUnOccupied, $"BatchLocUnOccupied"));
  84. EV.Subscribe(new EventItem("Event", UniversalEvents.CarrierInEnd, $"CarrierInEnd"));
  85. EV.Subscribe(new EventItem("Event", UniversalEvents.CarrierInStart, $"CarrierInStart"));
  86. EV.Subscribe(new EventItem("Event", UniversalEvents.CarrierOutStart, $"CarrierOutStart"));
  87. EV.Subscribe(new EventItem("Event", UniversalEvents.CarrierOutEnd, $"CarrierOutEnd"));
  88. EV.Subscribe(new EventItem("Event", UniversalEvents.SideDummyStateAlarm, $"SideDummyStateAlarm"));
  89. EV.Subscribe(new EventItem("Event", UniversalEvents.ExtraDummyStateAlarm, $"ExtraDummyStateAlarm"));
  90. EV.Subscribe(new EventItem("Event", UniversalEvents.SideDummyStateWarning, $"SideDummyStateWarning"));
  91. EV.Subscribe(new EventItem("Event", UniversalEvents.ExtraDummyStateWarning, $"ExtraDummyStateWarning"));
  92. EV.Subscribe(new EventItem("Event", UniversalEvents.RecipeCoolingStart, $"RecipeCoolingStart"));
  93. EV.Subscribe(new EventItem("Event", UniversalEvents.RecipeCoolingEnd, $"RecipeCoolingEnd"));
  94. PortId[module] = i.ToString();
  95. PortJobStarted[module] = $"{module}JobStarted";
  96. PortJobStopped[module] = $"{module}JobStopped";
  97. PortJobPaused[module] = $"{module}JobPaused";
  98. PortJobResumed[module] = $"{module}JobResumed";
  99. PortJobAborted[module] = $"{module}JobAborted";
  100. PortJobFinished[module] = $"{module}JobFinished";
  101. PortJobFailed[module] = $"{module}JobFailed";
  102. PortSequenceSelected[module] = $"{module}SequenceSelected";
  103. PortSequenceSelectFailed[module] = $"{module}SequenceSelectFailed";
  104. }
  105. }
  106. public void JobCreated(ControlJobInfo cj)
  107. {
  108. if (cj != null)
  109. {
  110. EV.Notify(Gem300Events.CJ_CREATED, new SerializableDictionary<string, object>()
  111. {
  112. {DataVariables.CJID, cj.Name},
  113. });
  114. }
  115. }
  116. public void JobCreated(ProcessJobInfo pj)
  117. {
  118. if (pj != null)
  119. {
  120. EV.Notify(Gem300Events.PJ_CREATED, new SerializableDictionary<string, object>()
  121. {
  122. {DataVariables.PRJobID, pj.Name},
  123. });
  124. }
  125. }
  126. public void JobCreateFailed(string module, string lotID, string jobID, string sequenceID)
  127. {
  128. ModuleName moduleName = ModuleHelper.Converter(module);
  129. EV.Notify(PortSequenceSelectFailed[moduleName], new SerializableDictionary<string, object>()
  130. {
  131. {DVIDName.LotID, lotID},
  132. {DVIDName.JobID, jobID},
  133. {DVIDName.PortID, PortId[moduleName] },
  134. {DVIDName.SequenceID, sequenceID }
  135. });
  136. }
  137. public void JobStarted(ControlJobInfo cj, ProcessJobInfo pj)
  138. {
  139. if (cj != null && pj != null)
  140. {
  141. foreach (var s in pj.Stockers)
  142. {
  143. var type = SC.GetStringValue($"System.Stocker.{s.Item1}WaferType");
  144. if (!string.IsNullOrEmpty(type) && (type.Contains("P") || type.Contains("M")))
  145. {
  146. ModuleName module = ModuleHelper.Converter(s.Item1);
  147. EV.Notify(PortJobStarted[module], new SerializableDictionary<string, object>()
  148. {
  149. {DVIDName.LotID, cj.LotName},
  150. {DVIDName.JobID, pj.ControlJobName},
  151. {DVIDName.PortID, PortId[module] },
  152. {DVIDName.SequenceID, pj.JobRecipe }
  153. });
  154. }
  155. }
  156. }
  157. }
  158. public void JobStopped(ControlJobInfo cj, ProcessJobInfo pj)
  159. {
  160. if (cj != null && pj != null)
  161. {
  162. foreach (var s in pj.Stockers)
  163. {
  164. var type = SC.GetStringValue($"System.Stocker.{s.Item1}WaferType");
  165. if (!string.IsNullOrEmpty(type) && (type.Contains("P") || type.Contains("M")))
  166. {
  167. ModuleName module = ModuleHelper.Converter(s.Item1);
  168. EV.Notify(PortJobStopped[module], new SerializableDictionary<string, object>()
  169. {
  170. {DVIDName.LotID, cj.LotName},
  171. {DVIDName.JobID, pj.ControlJobName},
  172. {DVIDName.PortID, PortId[module] },
  173. {DVIDName.SequenceID, pj.JobRecipe }
  174. });
  175. }
  176. }
  177. }
  178. }
  179. public void JobPaused(ControlJobInfo cj, ProcessJobInfo pj)
  180. {
  181. if (cj != null && pj != null)
  182. {
  183. foreach (var s in pj.Stockers)
  184. {
  185. var type = SC.GetStringValue($"System.Stocker.{s.Item1}WaferType");
  186. if (!string.IsNullOrEmpty(type) && (type.Contains("P") || type.Contains("M")))
  187. {
  188. ModuleName module = ModuleHelper.Converter(s.Item1);
  189. EV.Notify(PortJobPaused[module], new SerializableDictionary<string, object>()
  190. {
  191. {DVIDName.LotID, cj.LotName},
  192. {DVIDName.JobID, pj.ControlJobName},
  193. {DVIDName.PortID, PortId[module] },
  194. {DVIDName.SequenceID, pj.JobRecipe }
  195. });
  196. }
  197. }
  198. }
  199. }
  200. public void JobResumed(ControlJobInfo cj, ProcessJobInfo pj)
  201. {
  202. if (cj != null && pj != null)
  203. {
  204. foreach (var s in pj.Stockers)
  205. {
  206. var type = SC.GetStringValue($"System.Stocker.{s.Item1}WaferType");
  207. if (!string.IsNullOrEmpty(type) && (type.Contains("P") || type.Contains("M")))
  208. {
  209. ModuleName module = ModuleHelper.Converter(s.Item1);
  210. EV.Notify(PortJobResumed[module], new SerializableDictionary<string, object>()
  211. {
  212. {DVIDName.LotID, cj.LotName},
  213. {DVIDName.JobID, pj.ControlJobName},
  214. {DVIDName.PortID, PortId[module] },
  215. {DVIDName.SequenceID, pj.JobRecipe }
  216. });
  217. }
  218. }
  219. }
  220. }
  221. public void JobAborted(ControlJobInfo cj, ProcessJobInfo pj)
  222. {
  223. if (cj != null && pj != null)
  224. {
  225. foreach (var s in pj.Stockers)
  226. {
  227. var type = SC.GetStringValue($"System.Stocker.{s.Item1}WaferType");
  228. if (!string.IsNullOrEmpty(type) && (type.Contains("P") || type.Contains("M")))
  229. {
  230. ModuleName module = ModuleHelper.Converter(s.Item1);
  231. EV.Notify(PortJobAborted[module], new SerializableDictionary<string, object>()
  232. {
  233. {DVIDName.LotID, cj.LotName},
  234. {DVIDName.JobID, pj.ControlJobName},
  235. {DVIDName.PortID, PortId[module] },
  236. {DVIDName.SequenceID, pj.JobRecipe }
  237. });
  238. }
  239. }
  240. }
  241. }
  242. public void JobFinished(ControlJobInfo cj, ProcessJobInfo pj)
  243. {
  244. if (cj != null && pj != null)
  245. {
  246. foreach (var s in pj.Stockers)
  247. {
  248. var type = SC.GetStringValue($"System.Stocker.{s.Item1}WaferType");
  249. if (!string.IsNullOrEmpty(type) && (type.Contains("P") || type.Contains("M")))
  250. {
  251. ModuleName module = ModuleHelper.Converter(s.Item1);
  252. EV.Notify(PortJobFinished[module], new SerializableDictionary<string, object>()
  253. {
  254. {DVIDName.LotID, cj.LotName},
  255. {DVIDName.JobID, pj.ControlJobName},
  256. {DVIDName.PortID, PortId[module] },
  257. {DVIDName.SequenceID, pj.JobRecipe }
  258. });
  259. }
  260. }
  261. }
  262. }
  263. public void JobFailed(ControlJobInfo cj, ProcessJobInfo pj)
  264. {
  265. if (cj != null && pj != null)
  266. {
  267. foreach (var s in pj.Stockers)
  268. {
  269. var type = SC.GetStringValue($"System.Stocker.{s.Item1}WaferType");
  270. if (!string.IsNullOrEmpty(type) && (type.Contains("P") || type.Contains("M")))
  271. {
  272. ModuleName module = ModuleHelper.Converter(s.Item1);
  273. EV.Notify(PortJobFailed[module], new SerializableDictionary<string, object>()
  274. {
  275. {DVIDName.LotID, cj.LotName},
  276. {DVIDName.JobID, pj.ControlJobName},
  277. {DVIDName.PortID, PortId[module] },
  278. {DVIDName.SequenceID, pj.JobRecipe }
  279. });
  280. }
  281. }
  282. }
  283. }
  284. public void StartCharge(ProcessJobInfo pj)
  285. {
  286. List<string> crids = CarrierManager.Instance.GetStokerCarrierID();
  287. SECsDataItem data = new SECsDataItem(SECsFormat.List);
  288. foreach (var _id in crids)
  289. {
  290. data.Add("CarrierID", _id);
  291. }
  292. if (pj != null)
  293. {
  294. if (pj.IsEmptyLayout)
  295. return;
  296. EV.Notify(UniversalEvents.ChargeStart, new SerializableDictionary<string, object>()
  297. {
  298. {DataVariables.PRJobID, pj.Name},
  299. {DataVariables.BatchLocID, "BatchBuild1"},
  300. {DataVariables.BoatID, "Boat1"},
  301. {DataVariables.CarrierIDList, data},
  302. });
  303. }
  304. }
  305. public void EndCharge(ProcessJobInfo pj, List<string> _slotmap)
  306. {
  307. List<string> crids = CarrierManager.Instance.GetStokerCarrierID();
  308. SECsDataItem data = new SECsDataItem(SECsFormat.List);
  309. foreach (var _id in crids)
  310. {
  311. data.Add("CarrierID", _id);
  312. }
  313. if (pj != null)
  314. {
  315. if (pj.IsEmptyLayout)
  316. return;
  317. EV.Notify(UniversalEvents.ChargeEnd, new SerializableDictionary<string, object>()
  318. {
  319. {DataVariables.PRJobID, pj.Name},
  320. {DataVariables.BoatSlotMapList, _slotmap},
  321. {DataVariables.WaferIDList, _slotmap},
  322. {DataVariables.BatchLocID, "BatchBuild1"},
  323. {DataVariables.BoatID, "Boat1"},
  324. {DataVariables.CarrierIDList, data},
  325. });
  326. }
  327. }
  328. public void StartDischarge(ProcessJobInfo pj, List<string> _slotmap)
  329. {
  330. List<string> crids = CarrierManager.Instance.GetStokerCarrierID();
  331. SECsDataItem data = new SECsDataItem(SECsFormat.List);
  332. foreach (var _id in crids)
  333. {
  334. data.Add("CarrierID", _id);
  335. }
  336. if (pj != null)
  337. {
  338. if (pj.IsEmptyLayout)
  339. return;
  340. EV.Notify(UniversalEvents.DischargeStart, new SerializableDictionary<string, object>()
  341. {
  342. {DataVariables.PRJobID, pj.Name},
  343. {DataVariables.BoatSlotMapList, _slotmap},
  344. {DataVariables.WaferIDList, _slotmap},
  345. {DataVariables.BatchLocID, "BatchBuild1"},
  346. {DataVariables.BoatID, "Boat1"},
  347. {DataVariables.CarrierIDList, data},
  348. });
  349. }
  350. }
  351. public void EndDischarge(ProcessJobInfo pj)
  352. {
  353. if (pj != null)
  354. {
  355. if (pj.IsEmptyLayout)
  356. return;
  357. EV.Notify(UniversalEvents.DischargeEnd, new SerializableDictionary<string, object>()
  358. {
  359. {DataVariables.PRJobID, pj.Name},
  360. });
  361. }
  362. }
  363. public void CarrierInEnd(CarrierInfo carrier)
  364. {
  365. List<string> crids = CarrierManager.Instance.GetBufferMaterialInfo();
  366. SECsDataItem BufferMaterialInfos = new SECsDataItem(SECsFormat.List);
  367. SECsDataItem BufferMaterialInfo = new SECsDataItem(SECsFormat.List);
  368. foreach (var _id in crids)
  369. {
  370. BufferMaterialInfo = new SECsDataItem(SECsFormat.List);
  371. BufferMaterialInfo.Add("StockerName", _id.Split(';')[0], SECsFormat.Ascii);
  372. BufferMaterialInfo.Add("StockerCarrierID", _id.Split(';')[1].Replace("emptyid", ""), SECsFormat.Ascii);
  373. BufferMaterialInfos.Add(BufferMaterialInfo);
  374. }
  375. if (carrier != null)
  376. {
  377. EV.Notify(UniversalEvents.CarrierInEnd, new SerializableDictionary<string, object>()
  378. {
  379. {DataVariables.Usage, carrier.CarrierType.ToString()},
  380. {DataVariables.BufferCapacitiyList, GetBufferCapacitiyList()},
  381. {DataVariables.BufferMaterialInfo, BufferMaterialInfos},
  382. {DataVariables.CarrierID, carrier.CarrierId},
  383. });
  384. }
  385. }
  386. public void CarrierOutEnd(CarrierInfo carrier, string lpPortId)
  387. {
  388. (Singleton<EquipmentManager>.Instance.Modules[ModuleName.PM1] as PMModule).CarrierOutEnd(carrier, lpPortId);
  389. }
  390. public void CarrierInStart(CarrierType carrierType, string _carrierid)
  391. {
  392. List<string> crids = CarrierManager.Instance.GetBufferMaterialInfo();
  393. SECsDataItem BufferMaterialInfos = new SECsDataItem(SECsFormat.List);
  394. SECsDataItem BufferMaterialInfo = new SECsDataItem(SECsFormat.List);
  395. foreach (var _id in crids)
  396. {
  397. BufferMaterialInfo = new SECsDataItem(SECsFormat.List);
  398. BufferMaterialInfo.Add("StockerName", _id.Split(';')[0], SECsFormat.Ascii);
  399. BufferMaterialInfo.Add("StockerCarrierID", _id.Split(';')[1].Replace("emptyid", ""), SECsFormat.Ascii);
  400. BufferMaterialInfos.Add(BufferMaterialInfo);
  401. }
  402. EV.Notify(UniversalEvents.CarrierInStart, new SerializableDictionary<string, object>()
  403. {
  404. {DataVariables.Usage, carrierType.ToString()},
  405. {DataVariables.CarrierID, _carrierid},
  406. {DataVariables.BufferCapacitiyList, GetBufferCapacitiyList()},
  407. {DataVariables.BufferMaterialInfo, BufferMaterialInfos},
  408. });
  409. }
  410. public void CarrierOutStart(CarrierInfo carrier)
  411. {
  412. (Singleton<EquipmentManager>.Instance.Modules[ModuleName.PM1] as PMModule).CarrierOutStart(carrier);
  413. }
  414. public void JobCreated(ControlJobInfo cj, ProcessJobInfo pj)
  415. {
  416. }
  417. public void SideDummyStateAlarm(CarrierInfo carrier)
  418. {
  419. EV.Notify(UniversalEvents.SideDummyStateAlarm, new SerializableDictionary<string, object>()
  420. {
  421. {DataVariables.CarrierID, carrier.CarrierId},
  422. });
  423. }
  424. public void ExtraDummyStateAlarm(CarrierInfo carrier)
  425. {
  426. EV.Notify(UniversalEvents.ExtraDummyStateAlarm, new SerializableDictionary<string, object>()
  427. {
  428. {DataVariables.CarrierID, carrier.CarrierId},
  429. });
  430. }
  431. public void SideDummyStateWarning(CarrierInfo carrier)
  432. {
  433. EV.Notify(UniversalEvents.SideDummyStateWarning, new SerializableDictionary<string, object>()
  434. {
  435. {DataVariables.CarrierID, carrier.CarrierId},
  436. });
  437. }
  438. public void ExtraDummyStateWarning(CarrierInfo carrier)
  439. {
  440. EV.Notify(UniversalEvents.ExtraDummyStateWarning, new SerializableDictionary<string, object>()
  441. {
  442. {DataVariables.CarrierID, carrier.CarrierId},
  443. });
  444. }
  445. public void CarrierInEnd(ModuleName module)
  446. {
  447. var carrier = CarrierManager.Instance.GetCarrier(module, 0);
  448. if (carrier == null || carrier.IsEmpty)
  449. return;
  450. List<int> slotMapList = new List<int>();
  451. var wafers = WaferManager.Instance.GetWafers(module);
  452. if (wafers != null)
  453. {
  454. foreach (var wafer in wafers)
  455. {
  456. switch (wafer.Status)
  457. {
  458. case WaferStatus.Normal:
  459. slotMapList.Add(3);
  460. break;
  461. case WaferStatus.Empty:
  462. slotMapList.Add(1);
  463. break;
  464. case WaferStatus.Double:
  465. slotMapList.Add(2);
  466. break;
  467. case WaferStatus.Crossed:
  468. slotMapList.Add(4);
  469. break;
  470. case WaferStatus.Unknown:
  471. slotMapList.Add(5);
  472. break;
  473. }
  474. }
  475. }
  476. SerializableDictionary<string, object> dvid = new SerializableDictionary<string, object>();
  477. string slotMap = "";
  478. foreach (var item in slotMapList)
  479. {
  480. slotMap += item;
  481. }
  482. dvid["SlotMap"] = slotMap;
  483. dvid["SlotMapList"] = slotMapList;
  484. dvid["CarrierType"] = carrier.CarrierType;
  485. dvid["CarrierID"] = carrier.CarrierId;
  486. EV.Notify("SLOT_MAP_AVAILABLE", dvid);
  487. try
  488. {
  489. Singleton<FAJobController>.Instance.Eqp_NoteCarrierSlotMapRead(carrier.PortID, slotMap, carrier.CarrierId ?? "");
  490. }
  491. catch (Exception ex)
  492. {
  493. LOG.Info($"Eqp_NoteCarrierSlotMapRead:{ex}");
  494. }
  495. CarrierInEnd(carrier);
  496. }
  497. public SECsDataItem GetBufferCapacitiyList()
  498. {
  499. SECsDataItem bufinfo = new SECsDataItem(SECsFormat.List);
  500. bufinfo.Add("BUFPara", "Partition1");
  501. bufinfo.Add("BUFPara", "General");
  502. int emptyStocker = 0;
  503. int totalStocker = 0;
  504. foreach (var key in Singleton<EquipmentManager>.Instance.Modules.Keys)
  505. {
  506. if (ModuleHelper.IsStocker(key))
  507. totalStocker++;
  508. if (ModuleHelper.IsStocker(key) && CarrierManager.Instance.CheckNoCarrier(key, 0))
  509. {
  510. var has = false;
  511. foreach (var key1 in Singleton<EquipmentManager>.Instance.Modules.Keys)
  512. {
  513. if (CarrierManager.Instance.CheckHasCarrier(key1, 0) && CarrierManager.Instance.GetCarrier(key1, 0).InternalModuleName == key)
  514. {
  515. has = true;
  516. break;
  517. }
  518. }
  519. if (has)
  520. continue;
  521. emptyStocker++;
  522. }
  523. }
  524. bufinfo.Add("BUFPara", emptyStocker, SECsFormat.U1);
  525. bufinfo.Add("BUFPara", totalStocker, SECsFormat.U1);
  526. int unallocatedPartitionCapacity = 0;
  527. List<ModuleName> checkList = new List<ModuleName>()
  528. {
  529. ModuleName.LP1,
  530. ModuleName.LP2,
  531. ModuleName.FIMS1,
  532. ModuleName.FIMS2,
  533. };
  534. foreach (var module in checkList)
  535. {
  536. if (CarrierManager.Instance.CheckHasCarrier(module, 0))
  537. unallocatedPartitionCapacity++;
  538. }
  539. bufinfo.Add("BUFPara", unallocatedPartitionCapacity, SECsFormat.U1);
  540. return bufinfo;
  541. }
  542. public void RecipeCoolingStart(string module, ProcessJobInfo pj)
  543. {
  544. EV.Notify(UniversalEvents.RecipeCoolingStart, new SerializableDictionary<string, object>()
  545. {
  546. {DataVariables.PRJobID, pj.Name},
  547. {DVIDName.RecipeID, pj.ProcessRecipe},
  548. {DVIDName.StationName, module},
  549. });
  550. }
  551. public void RecipeCoolingEnd(string module, ProcessJobInfo pj)
  552. {
  553. EV.Notify(UniversalEvents.RecipeCoolingEnd, new SerializableDictionary<string, object>()
  554. {
  555. {DataVariables.PRJobID, pj.Name},
  556. {DVIDName.RecipeID, pj.ProcessRecipe},
  557. {DVIDName.StationName, module},
  558. });
  559. }
  560. public void CJPaused(ControlJobInfo cj, ProcessJobInfo pj)
  561. {
  562. if (cj != null)
  563. {
  564. EV.Notify(Gem300Events.CJ_PAUSED, new SerializableDictionary<string, object>()
  565. {
  566. {DataVariables.CJID, cj.Name},
  567. {DataVariables.PRJobID, cj.Name},
  568. });
  569. }
  570. }
  571. public void CJResume(ControlJobInfo cj, ProcessJobInfo pj)
  572. {
  573. if (cj != null)
  574. {
  575. EV.Notify(Gem300Events.CJ_RESUME, new SerializableDictionary<string, object>()
  576. {
  577. {DataVariables.CJID, cj.Name},
  578. {DataVariables.PRJobID, pj.Name},
  579. {DataVariables.RecID, pj.JobRecipe},
  580. });
  581. }
  582. }
  583. public void CJStop(ControlJobInfo cj, ProcessJobInfo pj)
  584. {
  585. if (cj != null)
  586. {
  587. EV.Notify(Gem300Events.CJ_STOPPED, new SerializableDictionary<string, object>()
  588. {
  589. {DataVariables.CJID, cj.Name},
  590. {DataVariables.PRJobID, pj.Name},
  591. {DataVariables.RecID, pj.JobRecipe},
  592. });
  593. }
  594. }
  595. public void CJAbort(ControlJobInfo cj, ProcessJobInfo pj)
  596. {
  597. if (cj != null)
  598. {
  599. EV.Notify(Gem300Events.CJ_ABORTED, new SerializableDictionary<string, object>()
  600. {
  601. {DataVariables.CJID, cj.Name},
  602. {DataVariables.PRJobID, pj.Name},
  603. {DataVariables.RecID, pj.JobRecipe},
  604. });
  605. }
  606. }
  607. }
  608. }