SchedulerFACallback.cs 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625
  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.RecipeStop, $"RecipeStop"));
  93. EV.Subscribe(new EventItem("Event", UniversalEvents.RecipeHold, $"RecipeHold"));
  94. EV.Subscribe(new EventItem("Event", UniversalEvents.RecipeRelease, $"RecipeRelease"));
  95. EV.Subscribe(new EventItem("Event", UniversalEvents.RecipeJumpStep, $"RecipeJumpStep"));
  96. EV.Subscribe(new EventItem("Event", UniversalEvents.RecipeJumpEnd, $"RecipeJumpEnd"));
  97. EV.Subscribe(new EventItem("Event", UniversalEvents.RecipeAbort, $"RecipeAbort"));
  98. EV.Subscribe(new EventItem("Event", UniversalEvents.CallAlarmRecipe, $"CallAlarmRecipe"));
  99. EV.Subscribe(new EventItem("Event", UniversalEvents.CallAbortRecipe, $"CallAbortRecipe"));
  100. EV.Subscribe(new EventItem("Event", UniversalEvents.RunResetRecipe, $"RunResetRecipe"));
  101. EV.Subscribe(new EventItem("Event", UniversalEvents.RecipeStepSkip, $"RecipeStepSkip"));
  102. PortId[module] = i.ToString();
  103. PortJobStarted[module] = $"{module}JobStarted";
  104. PortJobStopped[module] = $"{module}JobStopped";
  105. PortJobPaused[module] = $"{module}JobPaused";
  106. PortJobResumed[module] = $"{module}JobResumed";
  107. PortJobAborted[module] = $"{module}JobAborted";
  108. PortJobFinished[module] = $"{module}JobFinished";
  109. PortJobFailed[module] = $"{module}JobFailed";
  110. PortSequenceSelected[module] = $"{module}SequenceSelected";
  111. PortSequenceSelectFailed[module] = $"{module}SequenceSelectFailed";
  112. }
  113. }
  114. public void JobCreated(ControlJobInfo cj)
  115. {
  116. if (cj != null)
  117. {
  118. EV.Notify(Gem300Events.CJ_CREATED, new SerializableDictionary<string, object>()
  119. {
  120. {DataVariables.CJID, cj.Name},
  121. });
  122. }
  123. }
  124. public void JobCreated(ProcessJobInfo pj)
  125. {
  126. if (pj != null)
  127. {
  128. EV.Notify(Gem300Events.PJ_CREATED, new SerializableDictionary<string, object>()
  129. {
  130. {DataVariables.PRJobID, pj.Name},
  131. });
  132. }
  133. }
  134. public void JobCreateFailed(string module, string lotID, string jobID, string sequenceID)
  135. {
  136. ModuleName moduleName = ModuleHelper.Converter(module);
  137. EV.Notify(PortSequenceSelectFailed[moduleName], new SerializableDictionary<string, object>()
  138. {
  139. {DVIDName.LotID, lotID},
  140. {DVIDName.JobID, jobID},
  141. {DVIDName.PortID, PortId[moduleName] },
  142. {DVIDName.SequenceID, sequenceID }
  143. });
  144. }
  145. public void JobStarted(ControlJobInfo cj, ProcessJobInfo pj)
  146. {
  147. if (cj != null && pj != null)
  148. {
  149. foreach (var s in pj.Stockers)
  150. {
  151. var type = SC.GetStringValue($"System.Stocker.{s.Item1}WaferType");
  152. if (!string.IsNullOrEmpty(type) && (type.Contains("P") || type.Contains("M")))
  153. {
  154. ModuleName module = ModuleHelper.Converter(s.Item1);
  155. EV.Notify(PortJobStarted[module], new SerializableDictionary<string, object>()
  156. {
  157. {DVIDName.LotID, cj.LotName},
  158. {DVIDName.JobID, pj.ControlJobName},
  159. {DVIDName.PortID, PortId[module] },
  160. {DVIDName.SequenceID, pj.JobRecipe }
  161. });
  162. }
  163. }
  164. }
  165. }
  166. public void JobStopped(ControlJobInfo cj, ProcessJobInfo pj)
  167. {
  168. if (cj != null && pj != null)
  169. {
  170. foreach (var s in pj.Stockers)
  171. {
  172. var type = SC.GetStringValue($"System.Stocker.{s.Item1}WaferType");
  173. if (!string.IsNullOrEmpty(type) && (type.Contains("P") || type.Contains("M")))
  174. {
  175. ModuleName module = ModuleHelper.Converter(s.Item1);
  176. EV.Notify(PortJobStopped[module], new SerializableDictionary<string, object>()
  177. {
  178. {DVIDName.LotID, cj.LotName},
  179. {DVIDName.JobID, pj.ControlJobName},
  180. {DVIDName.PortID, PortId[module] },
  181. {DVIDName.SequenceID, pj.JobRecipe }
  182. });
  183. }
  184. }
  185. }
  186. }
  187. public void JobPaused(ControlJobInfo cj, ProcessJobInfo pj)
  188. {
  189. if (cj != null && pj != null)
  190. {
  191. foreach (var s in pj.Stockers)
  192. {
  193. var type = SC.GetStringValue($"System.Stocker.{s.Item1}WaferType");
  194. if (!string.IsNullOrEmpty(type) && (type.Contains("P") || type.Contains("M")))
  195. {
  196. ModuleName module = ModuleHelper.Converter(s.Item1);
  197. EV.Notify(PortJobPaused[module], new SerializableDictionary<string, object>()
  198. {
  199. {DVIDName.LotID, cj.LotName},
  200. {DVIDName.JobID, pj.ControlJobName},
  201. {DVIDName.PortID, PortId[module] },
  202. {DVIDName.SequenceID, pj.JobRecipe }
  203. });
  204. }
  205. }
  206. }
  207. }
  208. public void JobResumed(ControlJobInfo cj, ProcessJobInfo pj)
  209. {
  210. if (cj != null && pj != null)
  211. {
  212. foreach (var s in pj.Stockers)
  213. {
  214. var type = SC.GetStringValue($"System.Stocker.{s.Item1}WaferType");
  215. if (!string.IsNullOrEmpty(type) && (type.Contains("P") || type.Contains("M")))
  216. {
  217. ModuleName module = ModuleHelper.Converter(s.Item1);
  218. EV.Notify(PortJobResumed[module], new SerializableDictionary<string, object>()
  219. {
  220. {DVIDName.LotID, cj.LotName},
  221. {DVIDName.JobID, pj.ControlJobName},
  222. {DVIDName.PortID, PortId[module] },
  223. {DVIDName.SequenceID, pj.JobRecipe }
  224. });
  225. }
  226. }
  227. }
  228. }
  229. public void JobAborted(ControlJobInfo cj, ProcessJobInfo pj)
  230. {
  231. if (cj != null && pj != null)
  232. {
  233. foreach (var s in pj.Stockers)
  234. {
  235. var type = SC.GetStringValue($"System.Stocker.{s.Item1}WaferType");
  236. if (!string.IsNullOrEmpty(type) && (type.Contains("P") || type.Contains("M")))
  237. {
  238. ModuleName module = ModuleHelper.Converter(s.Item1);
  239. EV.Notify(PortJobAborted[module], new SerializableDictionary<string, object>()
  240. {
  241. {DVIDName.LotID, cj.LotName},
  242. {DVIDName.JobID, pj.ControlJobName},
  243. {DVIDName.PortID, PortId[module] },
  244. {DVIDName.SequenceID, pj.JobRecipe }
  245. });
  246. }
  247. }
  248. }
  249. }
  250. public void JobFinished(ControlJobInfo cj, ProcessJobInfo pj)
  251. {
  252. if (cj != null && pj != null)
  253. {
  254. foreach (var s in pj.Stockers)
  255. {
  256. var type = SC.GetStringValue($"System.Stocker.{s.Item1}WaferType");
  257. if (!string.IsNullOrEmpty(type) && (type.Contains("P") || type.Contains("M")))
  258. {
  259. ModuleName module = ModuleHelper.Converter(s.Item1);
  260. EV.Notify(PortJobFinished[module], new SerializableDictionary<string, object>()
  261. {
  262. {DVIDName.LotID, cj.LotName},
  263. {DVIDName.JobID, pj.ControlJobName},
  264. {DVIDName.PortID, PortId[module] },
  265. {DVIDName.SequenceID, pj.JobRecipe }
  266. });
  267. }
  268. }
  269. }
  270. }
  271. public void JobFailed(ControlJobInfo cj, ProcessJobInfo pj)
  272. {
  273. if (cj != null && pj != null)
  274. {
  275. foreach (var s in pj.Stockers)
  276. {
  277. var type = SC.GetStringValue($"System.Stocker.{s.Item1}WaferType");
  278. if (!string.IsNullOrEmpty(type) && (type.Contains("P") || type.Contains("M")))
  279. {
  280. ModuleName module = ModuleHelper.Converter(s.Item1);
  281. EV.Notify(PortJobFailed[module], new SerializableDictionary<string, object>()
  282. {
  283. {DVIDName.LotID, cj.LotName},
  284. {DVIDName.JobID, pj.ControlJobName},
  285. {DVIDName.PortID, PortId[module] },
  286. {DVIDName.SequenceID, pj.JobRecipe }
  287. });
  288. }
  289. }
  290. }
  291. }
  292. public void StartCharge(ProcessJobInfo pj)
  293. {
  294. List<string> crids = CarrierManager.Instance.GetStokerCarrierID();
  295. SECsDataItem data = new SECsDataItem(SECsFormat.List);
  296. foreach (var _id in crids)
  297. {
  298. data.Add("CarrierID", _id);
  299. }
  300. if (pj != null)
  301. {
  302. EV.Notify(UniversalEvents.ChargeStart, new SerializableDictionary<string, object>()
  303. {
  304. {DataVariables.PRJobID, pj.Name},
  305. {DataVariables.BatchLocID, "BatchBuild1"},
  306. {DataVariables.BoatID, "Boat1"},
  307. {DataVariables.CarrierIDList, data},
  308. });
  309. }
  310. }
  311. public void EndCharge(ProcessJobInfo pj, List<string> _slotmap)
  312. {
  313. List<string> crids = CarrierManager.Instance.GetStokerCarrierID();
  314. SECsDataItem data = new SECsDataItem(SECsFormat.List);
  315. foreach (var _id in crids)
  316. {
  317. data.Add("CarrierID", _id);
  318. }
  319. if (pj != null)
  320. {
  321. EV.Notify(UniversalEvents.ChargeEnd, new SerializableDictionary<string, object>()
  322. {
  323. {DataVariables.PRJobID, pj.Name},
  324. {DataVariables.BoatSlotMapList, _slotmap},
  325. {DataVariables.WaferIDList, _slotmap},
  326. {DataVariables.BatchLocID, "BatchBuild1"},
  327. {DataVariables.BoatID, "Boat1"},
  328. {DataVariables.CarrierIDList, data},
  329. });
  330. }
  331. }
  332. public void StartDischarge(ProcessJobInfo pj, List<string> _slotmap)
  333. {
  334. List<string> crids = CarrierManager.Instance.GetStokerCarrierID();
  335. SECsDataItem data = new SECsDataItem(SECsFormat.List);
  336. foreach (var _id in crids)
  337. {
  338. data.Add("CarrierID", _id);
  339. }
  340. if (pj != null)
  341. {
  342. EV.Notify(UniversalEvents.DischargeStart, new SerializableDictionary<string, object>()
  343. {
  344. {DataVariables.PRJobID, pj.Name},
  345. {DataVariables.BoatSlotMapList, _slotmap},
  346. {DataVariables.WaferIDList, _slotmap},
  347. {DataVariables.BatchLocID, "BatchBuild1"},
  348. {DataVariables.BoatID, "Boat1"},
  349. {DataVariables.CarrierIDList, data},
  350. });
  351. }
  352. }
  353. public void EndDischarge(ProcessJobInfo pj)
  354. {
  355. if (pj != null)
  356. {
  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 CJPaused(ControlJobInfo cj, ProcessJobInfo pj)
  543. {
  544. if (cj != null)
  545. {
  546. EV.Notify(Gem300Events.CJ_PAUSED, new SerializableDictionary<string, object>()
  547. {
  548. {DataVariables.CJID, cj.Name},
  549. {DataVariables.PRJobID, cj.Name},
  550. });
  551. }
  552. }
  553. public void CJResume(ControlJobInfo cj, ProcessJobInfo pj)
  554. {
  555. if (cj != null)
  556. {
  557. EV.Notify(Gem300Events.CJ_RESUME, new SerializableDictionary<string, object>()
  558. {
  559. {DataVariables.CJID, cj.Name},
  560. {DataVariables.PRJobID, pj.Name},
  561. });
  562. }
  563. }
  564. public void CJAbort(ControlJobInfo cj, ProcessJobInfo pj)
  565. {
  566. if (cj != null)
  567. {
  568. EV.Notify(Gem300Events.CJ_ABORTED, new SerializableDictionary<string, object>()
  569. {
  570. {DataVariables.CJID, cj.Name},
  571. {DataVariables.PRJobID, pj.Name},
  572. });
  573. }
  574. }
  575. }
  576. }