SchedulerFACallback.cs 16 KB

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