SchedulerFACallback.cs 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650
  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. EV.Notify(UniversalEvents.ChargeStart, new SerializableDictionary<string, object>()
  295. {
  296. {DataVariables.PRJobID, pj.Name},
  297. {DataVariables.BatchLocID, "BatchBuild1"},
  298. {DataVariables.BoatID, "Boat1"},
  299. {DataVariables.CarrierIDList, data},
  300. });
  301. }
  302. }
  303. public void EndCharge(ProcessJobInfo pj, List<string> _slotmap)
  304. {
  305. List<string> crids = CarrierManager.Instance.GetStokerCarrierID();
  306. SECsDataItem data = new SECsDataItem(SECsFormat.List);
  307. foreach (var _id in crids)
  308. {
  309. data.Add("CarrierID", _id);
  310. }
  311. if (pj != null)
  312. {
  313. EV.Notify(UniversalEvents.ChargeEnd, new SerializableDictionary<string, object>()
  314. {
  315. {DataVariables.PRJobID, pj.Name},
  316. {DataVariables.BoatSlotMapList, _slotmap},
  317. {DataVariables.WaferIDList, _slotmap},
  318. {DataVariables.BatchLocID, "BatchBuild1"},
  319. {DataVariables.BoatID, "Boat1"},
  320. {DataVariables.CarrierIDList, data},
  321. });
  322. }
  323. }
  324. public void StartDischarge(ProcessJobInfo pj, List<string> _slotmap)
  325. {
  326. List<string> crids = CarrierManager.Instance.GetStokerCarrierID();
  327. SECsDataItem data = new SECsDataItem(SECsFormat.List);
  328. foreach (var _id in crids)
  329. {
  330. data.Add("CarrierID", _id);
  331. }
  332. if (pj != null)
  333. {
  334. EV.Notify(UniversalEvents.DischargeStart, new SerializableDictionary<string, object>()
  335. {
  336. {DataVariables.PRJobID, pj.Name},
  337. {DataVariables.BoatSlotMapList, _slotmap},
  338. {DataVariables.WaferIDList, _slotmap},
  339. {DataVariables.BatchLocID, "BatchBuild1"},
  340. {DataVariables.BoatID, "Boat1"},
  341. {DataVariables.CarrierIDList, data},
  342. });
  343. }
  344. }
  345. public void EndDischarge(ProcessJobInfo pj)
  346. {
  347. if (pj != null)
  348. {
  349. EV.Notify(UniversalEvents.DischargeEnd, new SerializableDictionary<string, object>()
  350. {
  351. {DataVariables.PRJobID, pj.Name},
  352. });
  353. }
  354. }
  355. public void CarrierInEnd(CarrierInfo carrier)
  356. {
  357. List<string> crids = CarrierManager.Instance.GetBufferMaterialInfo();
  358. SECsDataItem BufferMaterialInfos = new SECsDataItem(SECsFormat.List);
  359. SECsDataItem BufferMaterialInfo = new SECsDataItem(SECsFormat.List);
  360. foreach (var _id in crids)
  361. {
  362. BufferMaterialInfo = new SECsDataItem(SECsFormat.List);
  363. BufferMaterialInfo.Add("StockerName", _id.Split(';')[0], SECsFormat.Ascii);
  364. BufferMaterialInfo.Add("StockerCarrierID", _id.Split(';')[1].Replace("emptyid", ""), SECsFormat.Ascii);
  365. BufferMaterialInfos.Add(BufferMaterialInfo);
  366. }
  367. if (carrier != null)
  368. {
  369. EV.Notify(UniversalEvents.CarrierInEnd, new SerializableDictionary<string, object>()
  370. {
  371. {DataVariables.Usage, carrier.CarrierType.ToString()},
  372. {DataVariables.BufferCapacitiyList, GetBufferCapacitiyList()},
  373. {DataVariables.BufferMaterialInfo, BufferMaterialInfos},
  374. {DataVariables.CarrierID, carrier.CarrierId},
  375. });
  376. }
  377. }
  378. public void CarrierOutEnd(CarrierInfo carrier, string lpPortId)
  379. {
  380. (Singleton<EquipmentManager>.Instance.Modules[ModuleName.PM1] as PMModule).CarrierOutEnd(carrier, lpPortId);
  381. }
  382. public void CarrierInStart(CarrierType carrierType, string _carrierid)
  383. {
  384. List<string> crids = CarrierManager.Instance.GetBufferMaterialInfo();
  385. SECsDataItem BufferMaterialInfos = new SECsDataItem(SECsFormat.List);
  386. SECsDataItem BufferMaterialInfo = new SECsDataItem(SECsFormat.List);
  387. foreach (var _id in crids)
  388. {
  389. BufferMaterialInfo = new SECsDataItem(SECsFormat.List);
  390. BufferMaterialInfo.Add("StockerName", _id.Split(';')[0], SECsFormat.Ascii);
  391. BufferMaterialInfo.Add("StockerCarrierID", _id.Split(';')[1].Replace("emptyid", ""), SECsFormat.Ascii);
  392. BufferMaterialInfos.Add(BufferMaterialInfo);
  393. }
  394. EV.Notify(UniversalEvents.CarrierInStart, new SerializableDictionary<string, object>()
  395. {
  396. {DataVariables.Usage, carrierType.ToString()},
  397. {DataVariables.CarrierID, _carrierid},
  398. {DataVariables.BufferCapacitiyList, GetBufferCapacitiyList()},
  399. {DataVariables.BufferMaterialInfo, BufferMaterialInfos},
  400. });
  401. }
  402. public void CarrierOutStart(CarrierInfo carrier)
  403. {
  404. (Singleton<EquipmentManager>.Instance.Modules[ModuleName.PM1] as PMModule).CarrierOutStart(carrier);
  405. }
  406. public void JobCreated(ControlJobInfo cj, ProcessJobInfo pj)
  407. {
  408. }
  409. public void SideDummyStateAlarm(CarrierInfo carrier)
  410. {
  411. EV.Notify(UniversalEvents.SideDummyStateAlarm, new SerializableDictionary<string, object>()
  412. {
  413. {DataVariables.CarrierID, carrier.CarrierId},
  414. });
  415. }
  416. public void ExtraDummyStateAlarm(CarrierInfo carrier)
  417. {
  418. EV.Notify(UniversalEvents.ExtraDummyStateAlarm, new SerializableDictionary<string, object>()
  419. {
  420. {DataVariables.CarrierID, carrier.CarrierId},
  421. });
  422. }
  423. public void SideDummyStateWarning(CarrierInfo carrier)
  424. {
  425. EV.Notify(UniversalEvents.SideDummyStateWarning, new SerializableDictionary<string, object>()
  426. {
  427. {DataVariables.CarrierID, carrier.CarrierId},
  428. });
  429. }
  430. public void ExtraDummyStateWarning(CarrierInfo carrier)
  431. {
  432. EV.Notify(UniversalEvents.ExtraDummyStateWarning, new SerializableDictionary<string, object>()
  433. {
  434. {DataVariables.CarrierID, carrier.CarrierId},
  435. });
  436. }
  437. public void CarrierInEnd(ModuleName module)
  438. {
  439. var carrier = CarrierManager.Instance.GetCarrier(module, 0);
  440. if (carrier == null || carrier.IsEmpty)
  441. return;
  442. List<int> slotMapList = new List<int>();
  443. var wafers = WaferManager.Instance.GetWafers(module);
  444. if (wafers != null)
  445. {
  446. foreach (var wafer in wafers)
  447. {
  448. switch (wafer.Status)
  449. {
  450. case WaferStatus.Normal:
  451. slotMapList.Add(3);
  452. break;
  453. case WaferStatus.Empty:
  454. slotMapList.Add(1);
  455. break;
  456. case WaferStatus.Double:
  457. slotMapList.Add(2);
  458. break;
  459. case WaferStatus.Crossed:
  460. slotMapList.Add(4);
  461. break;
  462. case WaferStatus.Unknown:
  463. slotMapList.Add(5);
  464. break;
  465. }
  466. }
  467. }
  468. SerializableDictionary<string, object> dvid = new SerializableDictionary<string, object>();
  469. string slotMap = "";
  470. foreach (var item in slotMapList)
  471. {
  472. slotMap += item;
  473. }
  474. dvid["SlotMap"] = slotMap;
  475. dvid["SlotMapList"] = slotMapList;
  476. dvid["CarrierType"] = carrier.CarrierType;
  477. dvid["CarrierID"] = carrier.CarrierId;
  478. EV.Notify("SLOT_MAP_AVAILABLE", dvid);
  479. try
  480. {
  481. Singleton<FAJobController>.Instance.Eqp_NoteCarrierSlotMapRead(carrier.PortID, slotMap, carrier.CarrierId ?? "");
  482. }
  483. catch (Exception ex)
  484. {
  485. LOG.Info($"Eqp_NoteCarrierSlotMapRead:{ex}");
  486. }
  487. CarrierInEnd(carrier);
  488. }
  489. public SECsDataItem GetBufferCapacitiyList()
  490. {
  491. SECsDataItem bufinfo = new SECsDataItem(SECsFormat.List);
  492. bufinfo.Add("BUFPara", "Partition1");
  493. bufinfo.Add("BUFPara", "General");
  494. int emptyStocker = 0;
  495. int totalStocker = 0;
  496. foreach (var key in Singleton<EquipmentManager>.Instance.Modules.Keys)
  497. {
  498. if (ModuleHelper.IsStocker(key))
  499. totalStocker++;
  500. if (ModuleHelper.IsStocker(key) && CarrierManager.Instance.CheckNoCarrier(key, 0))
  501. {
  502. var has = false;
  503. foreach (var key1 in Singleton<EquipmentManager>.Instance.Modules.Keys)
  504. {
  505. if (CarrierManager.Instance.CheckHasCarrier(key1, 0) && CarrierManager.Instance.GetCarrier(key1, 0).InternalModuleName == key)
  506. {
  507. has = true;
  508. break;
  509. }
  510. }
  511. if (has)
  512. continue;
  513. emptyStocker++;
  514. }
  515. }
  516. bufinfo.Add("BUFPara", emptyStocker, SECsFormat.U1);
  517. bufinfo.Add("BUFPara", totalStocker, SECsFormat.U1);
  518. int unallocatedPartitionCapacity = 0;
  519. List<ModuleName> checkList = new List<ModuleName>()
  520. {
  521. ModuleName.LP1,
  522. ModuleName.LP2,
  523. ModuleName.FIMS1,
  524. ModuleName.FIMS2,
  525. };
  526. foreach (var module in checkList)
  527. {
  528. if (CarrierManager.Instance.CheckHasCarrier(module, 0))
  529. unallocatedPartitionCapacity++;
  530. }
  531. bufinfo.Add("BUFPara", unallocatedPartitionCapacity, SECsFormat.U1);
  532. return bufinfo;
  533. }
  534. public void RecipeCoolingStart(string module, ProcessJobInfo pj)
  535. {
  536. EV.Notify(UniversalEvents.RecipeCoolingStart, new SerializableDictionary<string, object>()
  537. {
  538. {DataVariables.PRJobID, pj.Name},
  539. {DVIDName.RecipeID, pj.ProcessRecipe},
  540. {DVIDName.StationName, module},
  541. });
  542. }
  543. public void RecipeCoolingEnd(string module, ProcessJobInfo pj)
  544. {
  545. EV.Notify(UniversalEvents.RecipeCoolingEnd, new SerializableDictionary<string, object>()
  546. {
  547. {DataVariables.PRJobID, pj.Name},
  548. {DVIDName.RecipeID, pj.ProcessRecipe},
  549. {DVIDName.StationName, module},
  550. });
  551. }
  552. public void CJPaused(ControlJobInfo cj, ProcessJobInfo pj)
  553. {
  554. if (cj != null)
  555. {
  556. EV.Notify(Gem300Events.CJ_PAUSED, new SerializableDictionary<string, object>()
  557. {
  558. {DataVariables.CJID, cj.Name},
  559. {DataVariables.PRJobID, cj.Name},
  560. });
  561. }
  562. }
  563. public void CJResume(ControlJobInfo cj, ProcessJobInfo pj)
  564. {
  565. if (cj != null)
  566. {
  567. EV.Notify(Gem300Events.CJ_RESUME, new SerializableDictionary<string, object>()
  568. {
  569. {DataVariables.CJID, cj.Name},
  570. {DataVariables.PRJobID, pj.Name},
  571. {DataVariables.RecID, pj.JobRecipe},
  572. });
  573. }
  574. }
  575. public void CJStop(ControlJobInfo cj, ProcessJobInfo pj)
  576. {
  577. if (cj != null)
  578. {
  579. EV.Notify(Gem300Events.CJ_STOPPED, new SerializableDictionary<string, object>()
  580. {
  581. {DataVariables.CJID, cj.Name},
  582. {DataVariables.PRJobID, pj.Name},
  583. {DataVariables.RecID, pj.JobRecipe},
  584. });
  585. }
  586. }
  587. public void CJAbort(ControlJobInfo cj, ProcessJobInfo pj)
  588. {
  589. if (cj != null)
  590. {
  591. EV.Notify(Gem300Events.CJ_ABORTED, new SerializableDictionary<string, object>()
  592. {
  593. {DataVariables.CJID, cj.Name},
  594. {DataVariables.PRJobID, pj.Name},
  595. {DataVariables.RecID, pj.JobRecipe},
  596. });
  597. }
  598. }
  599. }
  600. }