SchedulerFACallback.cs 28 KB

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