SchedulerFACallback.cs 28 KB

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