SchedulerFACallback.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  1. using System.Collections.Generic;
  2. using Aitex.Core.Common;
  3. using Aitex.Core.RT.Event;
  4. using Aitex.Core.Util;
  5. using MECF.Framework.Common.Equipment;
  6. using MECF.Framework.Common.FAServices;
  7. using MECF.Framework.Common.Jobs;
  8. using MECF.Framework.Common.SubstrateTrackings;
  9. namespace EfemDualSchedulerLib.Schedulers
  10. {
  11. public class SchedulerFACallback : ISchedulerFACallback
  12. {
  13. private const string PortJobStarted = "PortJobStarted";
  14. private const string PortJobStopped = "PortJobStopped";
  15. private const string PortJobPaused = "PortJobPaused";
  16. private const string PortJobResumed = "PortJobResumed";
  17. private const string PortJobAborted = "PortJobAborted";
  18. private const string PortJobFinished = "PortJobFinished";
  19. private const string PortJobFailed = "PortJobFailed";
  20. private const string PortSequenceSelected = "PortSequenceSelected";
  21. private const string PortSequenceSelectFailed = "PortSequenceSelectFailed";
  22. private const string PortJobWaferStart = "PortJobWaferStart";
  23. private const string PortJobWaferEnd = "PortJobWaferEnd";
  24. //private const string Port1JobStarted = "Port1JobStarted";
  25. //private const string Port1JobStopped = "Port1JobStopped";
  26. //private const string Port1JobPaused = "Port1JobPaused";
  27. //private const string Port1JobResumed = "Port1JobResumed";
  28. //private const string Port1JobAborted = "Port1JobAborted";
  29. //private const string Port1JobFinished = "Port1JobFinished";
  30. //private const string Port1JobFailed = "Port1JobFailed";
  31. //private const string Port1SequenceSelected = "Port1SequenceSelected";
  32. //private const string Port1SequenceSelectFailed = "Port1SequenceSelectFailed";
  33. //private const string Port1JobWaferStart = "Port1JobWaferStart";
  34. //private const string Port1JobWaferEnd = "Port1JobWaferEnd";
  35. //private const string Port2JobStarted = "Port2JobStarted";
  36. //private const string Port2JobStopped = "Port2JobStopped";
  37. //private const string Port2JobPaused = "Port2JobPaused";
  38. //private const string Port2JobResumed = "Port2JobResumed";
  39. //private const string Port2JobAborted = "Port2JobAborted";
  40. //private const string Port2JobFinished = "Port2JobFinished";
  41. //private const string Port2JobFailed = "Port2JobFailed";
  42. //private const string Port2SequenceSelected = "Port2SequenceSelected";
  43. //private const string Port2SequenceSelectFailed = "Port2SequenceSelectFailed";
  44. //private const string Port2JobWaferStart = "Port2JobWaferStart";
  45. //private const string Port2JobWaferEnd = "Port2JobWaferEnd";
  46. //private Dictionary<ModuleName, string> PortJobWaferStart = new Dictionary<ModuleName, string>()
  47. //{
  48. // {ModuleName.LP1, Port1JobWaferStart},
  49. // {ModuleName.LP2, Port2JobWaferStart},
  50. //};
  51. //private Dictionary<ModuleName, string> PortJobWaferEnd = new Dictionary<ModuleName, string>()
  52. //{
  53. // {ModuleName.LP1, Port1JobWaferEnd},
  54. // {ModuleName.LP2, Port2JobWaferEnd},
  55. //};
  56. //private Dictionary<ModuleName, string> PortJobStarted = new Dictionary<ModuleName, string>()
  57. //{
  58. // {ModuleName.LP1, Port1JobStarted},
  59. // {ModuleName.LP2, Port2JobStarted},
  60. //};
  61. //private Dictionary<ModuleName, string> PortJobStopped = new Dictionary<ModuleName, string>()
  62. //{
  63. // {ModuleName.LP1, Port1JobStopped},
  64. // {ModuleName.LP2, Port2JobStopped},
  65. //};
  66. //private Dictionary<ModuleName, string> PortJobPaused = new Dictionary<ModuleName, string>()
  67. //{
  68. // {ModuleName.LP1, Port1JobPaused},
  69. // {ModuleName.LP2, Port2JobPaused},
  70. //};
  71. //private Dictionary<ModuleName, string> PortJobResumed = new Dictionary<ModuleName, string>()
  72. //{
  73. // {ModuleName.LP1, Port1JobResumed},
  74. // {ModuleName.LP2, Port2JobResumed},
  75. //};
  76. //private Dictionary<ModuleName, string> PortJobAborted = new Dictionary<ModuleName, string>()
  77. //{
  78. // {ModuleName.LP1, Port1JobAborted},
  79. // {ModuleName.LP2, Port2JobAborted},
  80. //};
  81. //private Dictionary<ModuleName, string> PortJobFinished = new Dictionary<ModuleName, string>()
  82. //{
  83. // {ModuleName.LP1, Port1JobFinished},
  84. // {ModuleName.LP2, Port2JobFinished},
  85. //};
  86. //private Dictionary<ModuleName, string> PortJobFailed = new Dictionary<ModuleName, string>()
  87. //{
  88. // {ModuleName.LP1, Port1JobFailed},
  89. // {ModuleName.LP2, Port2JobFailed},
  90. //};
  91. //private Dictionary<ModuleName, string> PortSequenceSelected = new Dictionary<ModuleName, string>()
  92. //{
  93. // {ModuleName.LP1, Port1SequenceSelected},
  94. // {ModuleName.LP2, Port2SequenceSelected},
  95. //};
  96. //private Dictionary<ModuleName, string> PortSequenceSelectFailed = new Dictionary<ModuleName, string>()
  97. //{
  98. // {ModuleName.LP1, Port1SequenceSelectFailed},
  99. // {ModuleName.LP2, Port2SequenceSelectFailed},
  100. //};
  101. private Dictionary<ModuleName, string> PortId = new Dictionary<ModuleName, string>()
  102. {
  103. {ModuleName.LP1, "1"},
  104. {ModuleName.LP2, "2"},
  105. };
  106. public SchedulerFACallback()
  107. {
  108. EV.Subscribe(new EventItem("Event", PortJobStarted, PortJobStarted));
  109. EV.Subscribe(new EventItem("Event", PortJobStopped, PortJobStopped));
  110. EV.Subscribe(new EventItem("Event", PortJobPaused, PortJobPaused));
  111. EV.Subscribe(new EventItem("Event", PortJobResumed, PortJobResumed));
  112. EV.Subscribe(new EventItem("Event", PortJobAborted, PortJobAborted));
  113. EV.Subscribe(new EventItem("Event", PortJobFinished, PortJobFinished));
  114. EV.Subscribe(new EventItem("Event", PortJobFailed, PortJobFailed));
  115. EV.Subscribe(new EventItem("Event", PortSequenceSelected, PortSequenceSelected));
  116. EV.Subscribe(new EventItem("Event", PortSequenceSelectFailed, PortSequenceSelectFailed));
  117. EV.Subscribe(new EventItem("Event", PortJobWaferStart, PortJobWaferStart));
  118. EV.Subscribe(new EventItem("Event", PortJobWaferEnd, PortJobWaferEnd));
  119. //EV.Subscribe(new EventItem("Event", Port1JobStarted, Port1JobStarted));
  120. //EV.Subscribe(new EventItem("Event", Port1JobStopped, Port1JobStopped));
  121. //EV.Subscribe(new EventItem("Event", Port1JobPaused, Port1JobPaused));
  122. //EV.Subscribe(new EventItem("Event", Port1JobResumed, Port1JobResumed));
  123. //EV.Subscribe(new EventItem("Event", Port1JobAborted, Port1JobAborted));
  124. //EV.Subscribe(new EventItem("Event", Port1JobFinished, Port1JobFinished));
  125. //EV.Subscribe(new EventItem("Event", Port1JobFailed, Port1JobFailed));
  126. //EV.Subscribe(new EventItem("Event", Port1SequenceSelected, Port1SequenceSelected));
  127. //EV.Subscribe(new EventItem("Event", Port1SequenceSelectFailed, Port1SequenceSelectFailed));
  128. //EV.Subscribe(new EventItem("Event", Port1JobWaferStart, Port1JobWaferStart));
  129. //EV.Subscribe(new EventItem("Event", Port1JobWaferEnd, Port1JobWaferEnd));
  130. //EV.Subscribe(new EventItem("Event", Port2JobStarted, Port2JobStarted));
  131. //EV.Subscribe(new EventItem("Event", Port2JobStopped, Port2JobStopped));
  132. //EV.Subscribe(new EventItem("Event", Port2JobPaused, Port2JobPaused));
  133. //EV.Subscribe(new EventItem("Event", Port2JobResumed, Port2JobResumed));
  134. //EV.Subscribe(new EventItem("Event", Port2JobAborted, Port2JobAborted));
  135. //EV.Subscribe(new EventItem("Event", Port2JobFinished, Port2JobFinished));
  136. //EV.Subscribe(new EventItem("Event", Port2JobFailed, Port2JobFailed));
  137. //EV.Subscribe(new EventItem("Event", Port2SequenceSelected, Port2SequenceSelected));
  138. //EV.Subscribe(new EventItem("Event", Port2SequenceSelectFailed, Port2SequenceSelectFailed));
  139. //EV.Subscribe(new EventItem("Event", Port2JobWaferStart, Port2JobWaferStart));
  140. //EV.Subscribe(new EventItem("Event", Port2JobWaferEnd, Port2JobWaferEnd));
  141. }
  142. public void JobCreated(ControlJobInfo cj, ProcessJobInfo pj)
  143. {
  144. ModuleName module = ModuleHelper.Converter(cj.Module);
  145. EV.Notify(PortSequenceSelected, new SerializableDictionary<string, string>()
  146. {
  147. {DataVariables.LotID, pj.LotName},
  148. {DataVariables.JobID, pj.ControlJobName},
  149. {DataVariables.PortID, PortId[module] },
  150. {DataVariables.SequenceID, pj.Sequence.Name }
  151. });
  152. }
  153. public void JobCreateFailed(string module, string lotID, string jobID, string sequenceID)
  154. {
  155. ModuleName moduleName = ModuleHelper.Converter(module);
  156. EV.Notify(PortSequenceSelectFailed, new SerializableDictionary<string, string>()
  157. {
  158. {DataVariables.LotID, lotID},
  159. {DataVariables.JobID, jobID},
  160. {DataVariables.PortID, PortId[moduleName] },
  161. {DataVariables.SequenceID, sequenceID }
  162. });
  163. }
  164. public void JobStarted(ControlJobInfo cj, ProcessJobInfo pj)
  165. {
  166. ModuleName module = ModuleHelper.Converter(cj.Module);
  167. EV.Notify(PortJobStarted, new SerializableDictionary<string, string>()
  168. {
  169. {DataVariables.LotID, pj.LotName},
  170. {DataVariables.JobID, pj.ControlJobName},
  171. {DataVariables.PortID, PortId[module] },
  172. {DataVariables.SequenceID, pj.Sequence.Name }
  173. });
  174. }
  175. public void JobStopped(ControlJobInfo cj, ProcessJobInfo pj)
  176. {
  177. ModuleName module = ModuleHelper.Converter(cj.Module);
  178. EV.Notify(PortJobStopped, new SerializableDictionary<string, string>()
  179. {
  180. {DataVariables.LotID, pj.LotName},
  181. {DataVariables.JobID, pj.ControlJobName},
  182. {DataVariables.PortID, PortId[module] },
  183. {DataVariables.SequenceID, pj.Sequence.Name }
  184. });
  185. }
  186. public void JobPaused(ControlJobInfo cj, ProcessJobInfo pj)
  187. {
  188. ModuleName module = ModuleHelper.Converter(cj.Module);
  189. EV.Notify(PortJobPaused, new SerializableDictionary<string, string>()
  190. {
  191. {DataVariables.LotID, pj.LotName},
  192. {DataVariables.JobID, pj.ControlJobName},
  193. {DataVariables.PortID, PortId[module] },
  194. {DataVariables.SequenceID, pj.Sequence.Name }
  195. });
  196. }
  197. public void JobResumed(ControlJobInfo cj, ProcessJobInfo pj)
  198. {
  199. ModuleName module = ModuleHelper.Converter(cj.Module);
  200. EV.Notify(PortJobResumed, new SerializableDictionary<string, string>()
  201. {
  202. {DataVariables.LotID, pj.LotName},
  203. {DataVariables.JobID, pj.ControlJobName},
  204. {DataVariables.PortID, PortId[module] },
  205. {DataVariables.SequenceID, pj.Sequence.Name }
  206. });
  207. }
  208. public void JobAborted(ControlJobInfo cj, ProcessJobInfo pj)
  209. {
  210. ModuleName module = ModuleHelper.Converter(cj.Module);
  211. EV.Notify(PortJobAborted, new SerializableDictionary<string, string>()
  212. {
  213. {DataVariables.LotID, cj.LotName},
  214. {DataVariables.JobID, cj.Name},
  215. {DataVariables.PortID, PortId[module] },
  216. {DataVariables.SequenceID, "" }
  217. });
  218. }
  219. public void JobFinished(ControlJobInfo cj, ProcessJobInfo pj)
  220. {
  221. ModuleName module = ModuleHelper.Converter(cj.Module);
  222. int count = pj.SlotWafers.Count;
  223. EV.Notify(PortJobFinished, new SerializableDictionary<string, string>()
  224. {
  225. {DataVariables.LotID, pj.LotName},
  226. {DataVariables.JobID, pj.ControlJobName},
  227. {DataVariables.PortID, PortId[module] },
  228. {DataVariables.SequenceID, pj.Sequence.Name },
  229. {DataVariables.ProcessedWaferCount, count.ToString() },
  230. });
  231. }
  232. public void JobFailed(ControlJobInfo cj, ProcessJobInfo pj)
  233. {
  234. ModuleName module = ModuleHelper.Converter(cj.Module);
  235. EV.Notify(PortJobFailed, new SerializableDictionary<string, string>()
  236. {
  237. {DataVariables.LotID, pj.LotName},
  238. {DataVariables.JobID, pj.ControlJobName},
  239. {DataVariables.PortID, PortId[module] },
  240. {DataVariables.SequenceID, pj.Sequence.Name }
  241. });
  242. }
  243. public void JobWaferStart(ControlJobInfo cj, ProcessJobInfo pj, string module1, int slotID)
  244. {
  245. ModuleName module = ModuleHelper.Converter(cj.Module);
  246. EV.Notify(PortJobWaferStart, new SerializableDictionary<string, string>()
  247. {
  248. {DataVariables.LotID, pj.LotName},
  249. {DataVariables.JobID, pj.ControlJobName},
  250. {DataVariables.PortID, PortId[module] },
  251. {DataVariables.SlotID, (slotID+1).ToString() }
  252. });
  253. }
  254. public void JobWaferEnd(ControlJobInfo cj, ProcessJobInfo pj, string module1, int slotID)
  255. {
  256. ModuleName module = ModuleHelper.Converter(cj.Module);
  257. WaferInfo wafer = WaferManager.Instance.GetWafer(ModuleHelper.Converter(module1), slotID);
  258. EV.Notify(PortJobWaferEnd, new SerializableDictionary<string, string>()
  259. {
  260. {DataVariables.LotID, pj.LotName},
  261. {DataVariables.JobID, pj.ControlJobName},
  262. {DataVariables.PortID, PortId[module] },
  263. {DataVariables.SlotID, (slotID+1).ToString() },
  264. {DataVariables.WaferProcessResult, (wafer.ProcessState==EnumWaferProcessStatus.Failed ? 0:1).ToString()}
  265. });
  266. }
  267. }
  268. }