SETMCycle.cs 47 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146
  1. using Aitex.Core.Common;
  2. using Aitex.Core.RT.DataCenter;
  3. using Aitex.Core.RT.Fsm;
  4. using Aitex.Core.RT.Log;
  5. using Aitex.Core.RT.RecipeCenter;
  6. using Aitex.Core.RT.Routine;
  7. using Aitex.Core.RT.SCCore;
  8. using Aitex.Core.Util;
  9. using Aitex.Sorter.Common;
  10. using MECF.Framework.Common.Equipment;
  11. using MECF.Framework.Common.Jobs;
  12. using MECF.Framework.Common.Schedulers;
  13. using MECF.Framework.Common.SubstrateTrackings;
  14. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robot;
  15. using System;
  16. using System.Collections.Generic;
  17. using System.Diagnostics;
  18. using System.Linq;
  19. using System.Text;
  20. using System.Threading.Tasks;
  21. using Venus_Core;
  22. using Venus_RT.Modules.Schedulers;
  23. using Venus_RT.Scheduler;
  24. using static Aitex.Core.Util.SubscriptionAttribute;
  25. namespace Venus_RT.Modules
  26. {
  27. public class SETMCycle : ModuleRoutineBase, IRoutine
  28. {
  29. enum TMCycleStep
  30. {
  31. Start,
  32. ReturnBack,
  33. Cycling,
  34. End,
  35. }
  36. private List<ControlJobInfo> _lstControlJobs = new List<ControlJobInfo>();
  37. private List<ProcessJobInfo> _lstProcessJobs = new List<ProcessJobInfo>();
  38. private Dictionary<ModuleName, SchedulerModule> dictSchedulers = new Dictionary<ModuleName, SchedulerModule>();
  39. private List<ModuleName> tmCycleRoutine = new List<ModuleName>()
  40. {
  41. ModuleName.VCE1,
  42. ModuleName.PMA,
  43. ModuleName.PMB,
  44. ModuleName.PMC,
  45. ModuleName.VCE1
  46. };
  47. private int CycleNum = 0;
  48. private bool _isCycleMode;
  49. private ModuleName _sourceModule = ModuleName.VCE1;
  50. private ModuleName _destinationModule = ModuleName.VCE1;
  51. private int _sourceSlotNumber = 25;
  52. //private int _destinationSlotNumber = 25;
  53. private SchedulerSETMRobot _TMRobot = (SchedulerSETMRobot)Singleton<TransferModule>.Instance.GetScheduler(ModuleName.SETM);
  54. private SchedulerFACallback _faCallback;
  55. private SchedulerDBCallback _dbCallback;
  56. //private readonly int INVALID_SLOT = -1;
  57. private Queue<MoveItem> _runningItems = new Queue<MoveItem>();
  58. private Queue<MoveItem> _CycleWafers = new Queue<MoveItem>();
  59. private RState _cycleState = RState.Init;
  60. private Stopwatch _cycleWatch = new Stopwatch();
  61. private List<MoveItem> _moveQueue = new List<MoveItem>();
  62. private List<MovingStatus> movingStatus = new List<MovingStatus>();
  63. private double _throughput = 0;
  64. private DateTime _starttime;
  65. public int? CycleIndex;
  66. private int CycledWafer => _currentWafer + _pastWafer;
  67. private int _currentWafer;
  68. private int _pastWafer;
  69. private bool _IsFirstLot = true;
  70. private bool IsSequenceCycle = false; //判断是否跑货
  71. #region 构造函数
  72. public SETMCycle(ModuleName module) : base(module)
  73. {
  74. Name = "TM Cycle";
  75. void _initMoudle(ModuleName name, SchedulerModule sche)
  76. {
  77. if (ModuleHelper.IsInstalled(name))
  78. {
  79. dictSchedulers[name] = sche;
  80. }
  81. }
  82. _initMoudle(ModuleName.VCE1, new SchedulerVCE(ModuleName.VCE1));
  83. _initMoudle(ModuleName.PMA, new SchedulerPM(ModuleName.PMA));
  84. _initMoudle(ModuleName.PMB, new SchedulerPM(ModuleName.PMB));
  85. _initMoudle(ModuleName.PMC, new SchedulerPM(ModuleName.PMC));
  86. _initMoudle(ModuleName.PMD, new SchedulerPM(ModuleName.PMD));
  87. _faCallback = new SchedulerFACallback();
  88. _dbCallback = new SchedulerDBCallback();
  89. _currentWafer = 0;
  90. _pastWafer = 0;
  91. DATA.Subscribe("SEScheduler.CycledWafer", ()=> CycledWafer );
  92. DATA.Subscribe("SEScheduler.CycleSetPoint", ()=> CycleNum);
  93. DATA.Subscribe("SEScheduler.CycleCount", ()=> CycleIndex);
  94. DATA.Subscribe("SEScheduler.ThroughPut", ()=> _throughput);
  95. DATA.Subscribe("Scheduler.CurrentRecipeList", ()=> _lstProcessJobs);
  96. }
  97. #endregion
  98. #region Cycle
  99. //run货模式
  100. public RState StartJob(string jobName)
  101. {
  102. if (_TMRobot.IsVCESlitDoorClosed)
  103. {
  104. LOG.Write(eEvent.ERR_ROUTER, ModuleName.System, $"VCE SlitDoor is Close cannot run!");
  105. return RState.Failed;
  106. }
  107. //sequenceCycle
  108. CycleIndex = 0;
  109. _pastWafer = 0;
  110. _currentWafer = 0;
  111. CycleNum = SC.GetValue<int>("System.CycleCount");
  112. _CycleWafers.Clear();
  113. IsSequenceCycle = true;
  114. ControlJobInfo cj = _lstControlJobs.Find(x => x.Name == jobName);
  115. if (cj == null)
  116. {
  117. LOG.Write(eEvent.WARN_ROUTER, ModuleName.System, $"start job rejected, not found job with id {jobName}");
  118. return RState.Failed;
  119. }
  120. if (cj.State == EnumControlJobState.WaitingForStart)
  121. {
  122. cj.SetState(EnumControlJobState.Executing);
  123. //PreJobClean(cj);
  124. cj.JetState = EnumJetCtrlJobState.Quequed;
  125. cj.StartTime = DateTime.Now;
  126. if (_IsFirstLot)
  127. {
  128. _dbCallback.LotCreated(cj);
  129. _IsFirstLot = false;
  130. }
  131. _faCallback.JobStarted(cj, GetFirstProcessJob(cj));
  132. int maxslot = 0;
  133. cj.LotWafers.ForEach(x => maxslot = x.OriginSlot > maxslot ? x.OriginSlot : maxslot);
  134. //waiting status means no use
  135. movingStatus = new List<MovingStatus>();
  136. movingStatus.AddRange(new MovingStatus[maxslot + 1]);
  137. for (int i = 0; i < movingStatus.Count; i++)
  138. movingStatus[i] = MovingStatus.Waiting;
  139. foreach (var wafer in cj.LotWafers)
  140. {
  141. WaferInfo currentWafer = WaferManager.Instance.GetWafer((ModuleName)wafer.OriginStation, wafer.OriginSlot);
  142. WaferManager.Instance.UpdateWaferProcessStatus((ModuleName)wafer.OriginStation, wafer.OriginSlot, EnumWaferProcessStatus.Idle);
  143. currentWafer.ProcessJob = _lstProcessJobs.Find(x => x.Sequence.Name == wafer.SequenceName);
  144. if (currentWafer.ProcessJob.Sequence.Steps[0].StepParameter.ContainsValue("VPA"))
  145. movingStatus[wafer.OriginSlot] = MovingStatus.WaitAlign;
  146. else
  147. movingStatus[wafer.OriginSlot] = MovingStatus.WaitProcess;
  148. }
  149. }
  150. if (!_cycleWatch.IsRunning)
  151. {
  152. _cycleWatch.Restart();
  153. }
  154. _starttime = DateTime.Now;
  155. _cycleState = RState.Running;
  156. return _cycleState;
  157. }
  158. //processJob(sequence num) ControlJob(1)
  159. public void CreateJob(Dictionary<string, object> param)
  160. {
  161. _isCycleMode = SC.GetValue<bool>("System.IsCycleMode");
  162. CycleNum = _isCycleMode ? SC.GetValue<int>("System.CycleCount") : 0;
  163. string[] slotSequence = (string[])param["SlotSequence"];
  164. string jobId = (string)param["JobId"];
  165. string module = (string)param["Module"];
  166. string lotId = jobId;
  167. if (param.ContainsKey("LotId"))
  168. lotId = (string)param["LotId"];
  169. if (!ModuleHelper.IsVCE(ModuleHelper.Converter(module)))
  170. {
  171. LOG.Write(eEvent.WARN_ROUTER, ModuleName.System, $"{module} should be VCE");
  172. _faCallback.JobCreateFailed(module, lotId, jobId, "");
  173. return;
  174. }
  175. if (string.IsNullOrEmpty(jobId))
  176. {
  177. jobId = "CJ_Local_" + module;
  178. }
  179. if (_lstControlJobs.Exists(x => x.Name == jobId))
  180. {
  181. LOG.Write(eEvent.WARN_ROUTER, ModuleName.System, $"{jobId} already created");
  182. _faCallback.JobCreateFailed(module, lotId, jobId, "");
  183. return;
  184. }
  185. ControlJobInfo cj = new ControlJobInfo();
  186. cj.Name = jobId;
  187. cj.Module = module;
  188. cj.LotName = lotId;
  189. cj.LotInnerId = Guid.NewGuid();
  190. cj.LotWafers = new List<WaferInfo>();
  191. cj.SetState(EnumControlJobState.WaitingForStart);
  192. cj.JetState = EnumJetCtrlJobState.Created;
  193. Dictionary<string, bool[]> seqSlot = new Dictionary<string, bool[]>();
  194. Dictionary<string, List<Tuple<ModuleName, int>>> seqSlotWafers = new Dictionary<string, List<Tuple<ModuleName, int>>>();
  195. Dictionary<string, string> indexSequence = new Dictionary<string, string>();
  196. bool enableGroupBySequence = SC.GetValue<bool>("Scheduler.GroupWaferBySequence");
  197. for (int i = 0; i < SC.GetValue<int>("VCE1.SlotNumber"); i++)
  198. {
  199. if (string.IsNullOrEmpty(slotSequence[i]) || string.IsNullOrEmpty(slotSequence[i].Trim()))
  200. continue;
  201. string groupName = enableGroupBySequence ? slotSequence[i].Trim() : i.ToString();
  202. indexSequence[groupName] = slotSequence[i];
  203. if (!seqSlot.ContainsKey(groupName))
  204. {
  205. seqSlot[groupName] = new bool[SC.GetValue<int>("VCE1.SlotNumber")];
  206. }
  207. if (!seqSlotWafers.ContainsKey(groupName))
  208. {
  209. seqSlotWafers[groupName] = new List<Tuple<ModuleName, int>>();
  210. }
  211. seqSlot[groupName][i] = true;
  212. if (!WaferManager.Instance.CheckHasWafer(module, i))
  213. {
  214. LOG.Write(eEvent.WARN_ROUTER, ModuleName.System, $"job wafer: {module} slot {i + 1} not in the carrier");
  215. return;
  216. }
  217. if (!WaferManager.Instance.CheckWafer(ModuleHelper.Converter(module), i, WaferStatus.Normal))
  218. {
  219. LOG.Write(eEvent.WARN_ROUTER, ModuleName.System, $"job wafer: {module} slot {i + 1} status is {WaferManager.Instance.GetWafer(ModuleHelper.Converter(module), i).Status}");
  220. _faCallback.JobCreateFailed(module, lotId, jobId, "");
  221. return;
  222. }
  223. if (WaferManager.Instance.GetWafer(ModuleHelper.Converter(module), i).ProcessState != EnumWaferProcessStatus.Idle)
  224. {
  225. LOG.Write(eEvent.WARN_ROUTER, ModuleName.System, $"job wafer: {module} slot {i + 1} process status is {WaferManager.Instance.GetWafer(ModuleHelper.Converter(module), i).ProcessState}");
  226. _faCallback.JobCreateFailed(module, lotId, jobId, "");
  227. return;
  228. }
  229. cj.LotWafers.Add(WaferManager.Instance.GetWafer(ModuleHelper.Converter(module), i));
  230. WaferManager.Instance.GetWafer(ModuleHelper.Converter(module), i).SequenceName = slotSequence[i];
  231. seqSlotWafers[groupName].Add(Tuple.Create(ModuleHelper.Converter(module), i));
  232. cj.JobWaferSize = WaferManager.Instance.GetWafer(ModuleHelper.Converter(module), i).Size;
  233. LOG.Write(eEvent.EV_ROUTER, ModuleName.System, $"Assigned wafer job, wafer {module}.{i + 1}, sequence: {slotSequence[i]}");
  234. }
  235. if (seqSlotWafers.Count == 0)
  236. {
  237. LOG.Write(eEvent.WARN_ROUTER, ModuleName.System, $"job has not assign wafer");
  238. _faCallback.JobCreateFailed(module, lotId, jobId, "");
  239. return;
  240. }
  241. List<ProcessJobInfo> pjs = new List<ProcessJobInfo>();
  242. string[] seqs = seqSlot.Keys.ToArray();
  243. for (int i = 0; i < seqs.Length; i++)
  244. {
  245. ProcessJobInfo pj = new ProcessJobInfo();
  246. pj.Name = jobId + "_" + (i + 1);
  247. pj.Sequence = SequenceInfoHelper.GetInfo(indexSequence[seqs[i]]);
  248. pj.ControlJobName = cj.Name;
  249. pj.LotName = lotId;
  250. pj.SlotWafers = seqSlotWafers[seqs[i]];
  251. pj.SetState(EnumProcessJobState.Queued);
  252. if (!CheckSequencePmReady(pj.Sequence, null, out _, out string reason))
  253. {
  254. LOG.Write(eEvent.WARN_ROUTER, ModuleName.System, $"no valid chamber for the {reason}");
  255. _faCallback.JobCreateFailed(module, lotId, jobId, "");
  256. return;
  257. }
  258. if (!RouteManager.IsATMMode && !CheckSequenceRecipeFileValid(pj.Sequence, out reason))
  259. {
  260. LOG.Write(eEvent.WARN_ROUTER, ModuleName.System, $"recipe file not valid in the sequence, {reason}");
  261. _faCallback.JobCreateFailed(module, lotId, jobId, "");
  262. return;
  263. }
  264. pjs.Add(pj);
  265. }
  266. _dbCallback.LotUpdate(cj);
  267. foreach (var pj in pjs)
  268. {
  269. cj.ProcessJobNameList.Add(pj.Name);
  270. _lstProcessJobs.Add(pj);
  271. }
  272. _lstControlJobs.Add(cj);
  273. }
  274. public void AbortJob(string jobName)
  275. {
  276. }
  277. public RState Start(params object[] objs)
  278. {
  279. if (_TMRobot.IsVCESlitDoorClosed)
  280. {
  281. LOG.Write(eEvent.ERR_ROUTER, ModuleName.System, $"VCE SlitDoor is Close cannot run!");
  282. return RState.Failed;
  283. }
  284. //普通Cycle
  285. if (objs.Length == 2)
  286. {
  287. var modules = ((string[])objs[0]).ToList();
  288. if (modules.Count >= 2)
  289. tmCycleRoutine.Clear();
  290. foreach (var mod in modules)
  291. {
  292. try
  293. {
  294. ModuleName module = ModuleHelper.Converter(mod);
  295. tmCycleRoutine.Add(module);
  296. }
  297. catch (Exception ex)
  298. {
  299. LOG.Write(eEvent.ERR_ROUTER, ModuleName.System, $"Invalid module string: {mod}, Exception:{ex}");
  300. return RState.Failed;
  301. }
  302. }
  303. CycleNum = (int)objs[1];
  304. CycleNum = SC.GetValue<int>("System.CycleCount");
  305. _CycleWafers.Clear();
  306. CycleIndex = 0;
  307. for (int i = 0; i < _sourceSlotNumber; i++)
  308. {
  309. if (WaferManager.Instance.CheckHasWafer(_sourceModule, i))
  310. _CycleWafers.Enqueue(new MoveItem(_sourceModule, i, _destinationModule, i, Hand.None));
  311. }
  312. IsSequenceCycle = false;
  313. _cycleState = RState.Running;
  314. }
  315. else
  316. {
  317. LOG.Write(eEvent.ERR_TM,Module,"Invalid parameter for cycle!");
  318. _cycleState = RState.Failed;
  319. }
  320. return _cycleState;
  321. }
  322. public RState Monitor()
  323. {
  324. if (_cycleState == RState.Running)
  325. {
  326. //run sequence
  327. if (IsSequenceCycle)
  328. {
  329. CheckCycleDone();
  330. SETMRobotTask();
  331. SERunTMRobotTask();
  332. SEPMTask();
  333. }
  334. //only TMCycle
  335. else
  336. {
  337. Cycling();
  338. //PMProcess();
  339. }
  340. }
  341. return _cycleState;
  342. }
  343. #endregion
  344. #region 推进|检查|计数
  345. private void CheckCycleDone()
  346. {
  347. //how to calculate current wafer? => _currentWafer
  348. //1. wafer in vce
  349. //2. wafer is Idle
  350. _currentWafer = 0;
  351. for (int index = 0; index < movingStatus.Count;++index)
  352. {
  353. if(WaferManager.Instance.CheckHasWafer(ModuleName.VCE1,index) && movingStatus[index] == MovingStatus.Idle)
  354. _currentWafer ++;
  355. }
  356. //throughput = CycledWafer/time, time(h)
  357. _throughput = Math.Round(CycledWafer / (DateTime.Now - _starttime).TotalSeconds * 3600,2);
  358. //how to confirm a sequence is over?
  359. //3、wafer is all in vce
  360. //2、all status is over => idle
  361. //1、TMRobot and PM is available
  362. if (_TMRobot.IsAvailable && AllPMIsAvailable() && ALLStatusIsOver() && WaferAllInVCE())
  363. {
  364. ++CycleIndex;
  365. if (CycleIndex >= CycleNum)
  366. {
  367. _lstControlJobs.Find(lcj => lcj.State == EnumControlJobState.Executing).SetState(EnumControlJobState.WaitingForStart);
  368. _cycleState = RState.End;
  369. }
  370. else
  371. {
  372. _pastWafer += _currentWafer;
  373. ControlJobInfo cj = _lstControlJobs.Find(lcj => lcj.State == EnumControlJobState.Executing);
  374. _currentWafer = 0;
  375. int maxslot = 0;
  376. cj.LotWafers.ForEach(x => maxslot = x.OriginSlot > maxslot ? x.OriginSlot : maxslot);
  377. //waiting status means no use
  378. movingStatus = new List<MovingStatus>();
  379. movingStatus.AddRange(new MovingStatus[maxslot + 1]);
  380. for (int i = 0; i < movingStatus.Count; i++)
  381. movingStatus[i] = MovingStatus.Waiting;
  382. foreach (var wafer in cj.LotWafers)
  383. {
  384. WaferInfo currentWafer = WaferManager.Instance.GetWafer((ModuleName)wafer.OriginStation, wafer.OriginSlot);
  385. WaferManager.Instance.UpdateWaferProcessStatus((ModuleName)wafer.OriginStation, wafer.OriginSlot, EnumWaferProcessStatus.Idle);
  386. currentWafer.ProcessJob = _lstProcessJobs.Find(x => x.Sequence.Name == wafer.SequenceName);
  387. if (currentWafer.ProcessJob.Sequence.Steps[0].StepParameter.ContainsValue("VPA"))
  388. movingStatus[wafer.OriginSlot] = MovingStatus.WaitAlign;
  389. else
  390. movingStatus[wafer.OriginSlot] = MovingStatus.WaitProcess;
  391. }
  392. }
  393. }
  394. }
  395. //movingStatus is all Idle or no use
  396. private bool ALLStatusIsOver()
  397. {
  398. bool flag = true;
  399. movingStatus.ForEach(x => flag = (x == MovingStatus.Idle || x == MovingStatus.Waiting) && flag) ;
  400. return flag;
  401. }
  402. private bool WaferAllInVCE()
  403. {
  404. ControlJobInfo cj = _lstControlJobs.Find(lcj => lcj.State == EnumControlJobState.Executing);
  405. bool flag = true;
  406. cj.LotWafers.ForEach(wafer => flag = WaferManager.Instance.CheckHasWafer((ModuleName)wafer.OriginStation, wafer.OriginSlot) && flag);
  407. return flag;
  408. }
  409. private bool AllPMIsAvailable()
  410. {
  411. foreach (KeyValuePair<ModuleName,SchedulerModule> pair in dictSchedulers)
  412. if (ModuleHelper.IsPm(pair.Key) && !pair.Value.IsAvailable)
  413. return false;
  414. return true;
  415. }
  416. private void SERunTMRobotTask()
  417. {
  418. if (_TMRobot.IsAvailable)
  419. {
  420. if (_moveQueue.Count > 0 &&_TMRobot.PostMoveItems(_moveQueue.ToArray()))
  421. {
  422. foreach (var item in _moveQueue)
  423. {
  424. var wafer = WaferManager.Instance.GetWafer(item.SourceModule, item.SourceSlot);
  425. if (wafer.IsEmpty)
  426. {
  427. // post alarm
  428. _cycleState = RState.Failed;
  429. LOG.Write(eEvent.ERR_ROUTER, ModuleName.System, $"Cannot run TM moving task as Get {item.SourceModule}{item.SourceModule} Wafer Info failed");
  430. return;
  431. }
  432. }
  433. _moveQueue.Clear();
  434. }
  435. }
  436. }
  437. private void SERunPMTask()
  438. {
  439. }
  440. private void SETMRobotTask()
  441. {
  442. //tm is free
  443. if (_TMRobot.IsAvailable)
  444. {
  445. CheckWaferFromVceNeedAlign();
  446. PrepareWaferOnRBToPM();
  447. GetBackWafer();
  448. GetNextWaferPickFromVCE();
  449. }
  450. }
  451. private void SEPMTask()
  452. {
  453. //foreach all pms and the wafer's receipe
  454. foreach (KeyValuePair<ModuleName,SchedulerModule> dict in dictSchedulers)
  455. {
  456. //pm has wafer && pm is available => find the wafer's receipe
  457. if (ModuleHelper.IsPm(dict.Key))
  458. {
  459. if (dict.Value.IsAvailable)
  460. {
  461. foreach (var ctrljob in _lstControlJobs)
  462. {
  463. //Port is run
  464. if (ctrljob.State == EnumControlJobState.Executing)
  465. {
  466. if (WaferManager.Instance.CheckHasWafer(dict.Key, 0))
  467. {
  468. WaferInfo currentWafer = WaferManager.Instance.GetWafer(dict.Key, 0);
  469. switch (movingStatus[currentWafer.OriginSlot])
  470. {
  471. case MovingStatus.WaitProcess:
  472. dict.Value.EventWaferArrived?.Invoke(this, new WaferMoveArgs(ModuleName.TMRobot, 0, dict.Key, 0));
  473. movingStatus[currentWafer.OriginSlot] = MovingStatus.StartProcess;
  474. break;
  475. case MovingStatus.Processing:
  476. movingStatus[currentWafer.OriginSlot] = MovingStatus.Idle;
  477. break;
  478. case MovingStatus.StartProcess:
  479. movingStatus[currentWafer.OriginSlot] = MovingStatus.Processing;
  480. break;
  481. default:
  482. break;
  483. }
  484. }
  485. }
  486. }
  487. }
  488. }
  489. }
  490. }
  491. //get the wafer need back
  492. private void GetBackWafer()
  493. {
  494. //find
  495. foreach (KeyValuePair<ModuleName, SchedulerModule> dict in dictSchedulers)
  496. {
  497. //pm has wafer && pm is available => find the wafer's receipe
  498. if (ModuleHelper.IsPm(dict.Key) && WaferManager.Instance.CheckHasWafer(dict.Key, 0) && WaferManager.Instance.CheckNoWafer(ModuleName.VPA, 0))
  499. {
  500. WaferInfo currentWafer = WaferManager.Instance.GetWafer(dict.Key, 0);
  501. //if the wafer has been processed, we need to pickfrom it.
  502. if (dict.Value.IsAvailable && movingStatus[currentWafer.OriginSlot] == MovingStatus.Idle && _TMRobot.IsAvailable)
  503. {
  504. _moveQueue.Add(new MoveItem(dict.Key,0, (ModuleName)currentWafer.OriginStation, currentWafer.OriginSlot,0));
  505. //one hand has wafer
  506. if (WaferManager.Instance.CheckHasWafer(ModuleName.TMRobot, 0)
  507. && movingStatus[WaferManager.Instance.GetWafer(ModuleName.TMRobot, 0).OriginSlot] == MovingStatus.WaitProcess
  508. && WaferManager.Instance.CheckNoWafer(ModuleName.TMRobot, 1))
  509. {
  510. WaferInfo wafer = WaferManager.Instance.GetWafer(ModuleName.TMRobot, 0);
  511. if (wafer.ProcessJob.Sequence.PMs.Contains(dict.Key))
  512. {
  513. _moveQueue.Add(new MoveItem(ModuleName.TMRobot,0,dict.Key,0,0));
  514. }
  515. }
  516. else if (WaferManager.Instance.CheckHasWafer(ModuleName.TMRobot, 1)
  517. && movingStatus[WaferManager.Instance.GetWafer(ModuleName.TMRobot, 1).OriginSlot] == MovingStatus.WaitProcess
  518. && WaferManager.Instance.CheckNoWafer(ModuleName.TMRobot, 0))
  519. {
  520. WaferInfo wafer = WaferManager.Instance.GetWafer(ModuleName.TMRobot, 1);
  521. if (wafer.ProcessJob.Sequence.PMs.Contains(dict.Key))
  522. {
  523. _moveQueue.Add(new MoveItem(ModuleName.TMRobot, 1, dict.Key, 0, (Hand)1));
  524. }
  525. }
  526. return;
  527. }
  528. }
  529. }
  530. }
  531. //get the wafer need Pick From vce
  532. private void GetNextWaferPickFromVCE()
  533. {
  534. if (_TMRobot.IsAvailable)
  535. {
  536. Dictionary<int, ModuleName> nextslot = new Dictionary<int, ModuleName>();
  537. foreach (var ctrljob in _lstControlJobs)
  538. {
  539. //Port is run
  540. if (ctrljob.State == EnumControlJobState.Executing)
  541. {
  542. bool nohastowaitpm = false;
  543. foreach (WaferInfo wafer in ctrljob.LotWafers)
  544. {
  545. //if need pm available =>pick 2
  546. if (!wafer.IsEmpty
  547. && SequenceNeedPMsAvailable(_lstProcessJobs.Find(x => x.Sequence.Name == wafer.SequenceName).Sequence.PMs)
  548. && ModuleHelper.IsVCE((ModuleName)wafer.OriginStation)
  549. && (movingStatus[wafer.OriginSlot] == MovingStatus.WaitProcess))
  550. {
  551. nohastowaitpm = true;
  552. ModuleName _destination = SearchPM(_lstProcessJobs.Find(x => x.Sequence.Name == wafer.SequenceName).Sequence.PMs, nextslot);
  553. nextslot.Add(wafer.OriginSlot, _destination);
  554. _moveQueue.Add(new MoveItem(ModuleName.VCE1, wafer.OriginSlot, _destination, 0, 0));
  555. if (nextslot.Count >= 2 || _moveQueue.Count >= 4)
  556. {
  557. return;
  558. }
  559. }
  560. //if need align available => pick 2
  561. if (!wafer.IsEmpty
  562. && WaferManager.Instance.CheckNoWafer(ModuleName.VPA, 0)
  563. && ModuleHelper.IsVCE((ModuleName)wafer.OriginStation)
  564. && SequenceNeedPMsAvailable(_lstProcessJobs.Find(x => x.Sequence.Name == wafer.SequenceName).Sequence.PMs)
  565. && (movingStatus[wafer.OriginSlot] == MovingStatus.WaitAlign))
  566. {
  567. nohastowaitpm = true;
  568. ModuleName _destination = ModuleName.TMRobot;
  569. //double pick
  570. if (WaferManager.Instance.CheckNoWafer(ModuleName.TMRobot, 0) && WaferManager.Instance.CheckNoWafer(ModuleName.TMRobot, 1))
  571. {
  572. nextslot.Add(wafer.OriginSlot, _destination);
  573. _moveQueue.Add(new MoveItem(ModuleName.VCE1, wafer.OriginSlot, _destination, 0, 0));
  574. }
  575. if (nextslot.Count >= 2 || _moveQueue.Count >= 4)
  576. {
  577. return;
  578. }
  579. }
  580. }
  581. //if all need PM unavailable =>pick 1 wait for swap
  582. //or 1 can input pm => pick 2, A in pm ,B wait for swap
  583. if (nextslot.Count == 0 || nohastowaitpm && nextslot.Count == 1
  584. && WaferManager.Instance.CheckNoWafer(ModuleName.TMRobot,0)
  585. && WaferManager.Instance.CheckNoWafer(ModuleName.TMRobot,1)
  586. && WaferManager.Instance.CheckNoWafer(ModuleName.VPA, 0))
  587. {
  588. foreach (WaferInfo wafer in ctrljob.LotWafers)
  589. {
  590. if (wafer.NextSequenceStep == 0 && !wafer.IsEmpty
  591. && ModuleHelper.IsVCE((ModuleName)wafer.SourceStation))
  592. {
  593. ModuleName _destination = _lstProcessJobs.Find(x => x.Sequence.Name == wafer.SequenceName).Sequence.PMs[0];
  594. nextslot.Add(wafer.SourceSlot, _destination);
  595. foreach (KeyValuePair<int, ModuleName> slot in nextslot)
  596. {
  597. _moveQueue.Add(new MoveItem(ModuleName.VCE1, slot.Key, slot.Value, 0, 0));
  598. }
  599. return;
  600. }
  601. if (movingStatus[wafer.OriginSlot] == MovingStatus.WaitAlign && !wafer.IsEmpty
  602. && WaferManager.Instance.CheckHasWafer((ModuleName)wafer.OriginStation, wafer.OriginSlot)
  603. && WaferManager.Instance.CheckNoWafer(ModuleName.TMRobot, 0)
  604. && WaferManager.Instance.CheckNoWafer(ModuleName.TMRobot, 1)
  605. && _moveQueue.Count == 0
  606. )
  607. {
  608. //ModuleName _destination = ModuleName.TMRobot;
  609. _moveQueue.Add(new MoveItem((ModuleName)wafer.OriginStation, wafer.OriginSlot, ModuleName.TMRobot, 0, 0));
  610. return;
  611. }
  612. }
  613. }
  614. }
  615. }
  616. return;
  617. }
  618. }
  619. private void PrepareWaferOnRBToPM()
  620. {
  621. //tm robot has wafer and wait for process which means have to go to PM
  622. if (WaferManager.Instance.CheckHasWafer(ModuleName.TMRobot, 0)
  623. && movingStatus[WaferManager.Instance.GetWafer(ModuleName.TMRobot, 0).OriginSlot] == MovingStatus.WaitProcess
  624. )
  625. {
  626. //find PM has no wafer
  627. WaferInfo wafer = WaferManager.Instance.GetWafer(ModuleName.TMRobot, 0);
  628. if (SequenceNeedPMsAvailable(wafer.ProcessJob.Sequence.PMs))
  629. {
  630. ModuleName _destination = SearchPM(wafer.ProcessJob.Sequence.PMs, new Dictionary<int, ModuleName>());
  631. if (ModuleHelper.IsPm(_destination) && _TMRobot.IsAvailable)
  632. {
  633. _moveQueue.Add(new MoveItem(ModuleName.TMRobot, 0, _destination, 0, 0));
  634. SERunTMRobotTask();
  635. return;
  636. }
  637. }
  638. }
  639. if (WaferManager.Instance.CheckHasWafer(ModuleName.TMRobot, 1)
  640. && movingStatus[WaferManager.Instance.GetWafer(ModuleName.TMRobot, 1).OriginSlot] == MovingStatus.WaitProcess)
  641. {
  642. WaferInfo wafer = WaferManager.Instance.GetWafer(ModuleName.TMRobot, 1);
  643. if (SequenceNeedPMsAvailable(wafer.ProcessJob.Sequence.PMs))
  644. {
  645. ModuleName _destination = SearchPM(wafer.ProcessJob.Sequence.PMs, new Dictionary<int, ModuleName>());
  646. if (ModuleHelper.IsPm(_destination) && _TMRobot.IsAvailable)
  647. {
  648. _moveQueue.Add(new MoveItem(ModuleName.TMRobot, 1, _destination, 0, (Hand)1));
  649. SERunTMRobotTask();
  650. return;
  651. }
  652. }
  653. }
  654. }
  655. private void CheckWaferFromVceNeedAlign()
  656. {
  657. //if has wafer and need align and align is empty => goto PA
  658. if (WaferManager.Instance.CheckHasWafer(ModuleName.TMRobot,0)
  659. && movingStatus[WaferManager.Instance.GetWafer(ModuleName.TMRobot, 0).OriginSlot] == MovingStatus.WaitAlign
  660. && WaferManager.Instance.CheckNoWafer(ModuleName.VPA, 0)
  661. &&_TMRobot.IsAvailable)
  662. {
  663. _moveQueue.Add(new MoveItem(ModuleName.TMRobot, 0,ModuleName.VPA, 0, 0));
  664. movingStatus[WaferManager.Instance.GetWafer(ModuleName.TMRobot, 0).OriginSlot] = MovingStatus.StartAlign;
  665. SERunTMRobotTask();
  666. return;
  667. }
  668. if (WaferManager.Instance.CheckHasWafer(ModuleName.TMRobot, 1)
  669. && movingStatus[WaferManager.Instance.GetWafer(ModuleName.TMRobot, 1).OriginSlot] == MovingStatus.WaitAlign
  670. && WaferManager.Instance.CheckNoWafer(ModuleName.VPA, 0)
  671. && _TMRobot.IsAvailable)
  672. {
  673. _moveQueue.Add(new MoveItem(ModuleName.TMRobot, 1, ModuleName.VPA, 0, (Hand)1));
  674. movingStatus[WaferManager.Instance.GetWafer(ModuleName.TMRobot, 1).OriginSlot] = MovingStatus.StartAlign;
  675. SERunTMRobotTask();
  676. return;
  677. }
  678. //PA has wafer need align =>
  679. if (WaferManager.Instance.CheckHasWafer(ModuleName.VPA, 0) && _TMRobot.IsAvailable)
  680. {
  681. WaferInfo currentwafer = WaferManager.Instance.GetWafer(ModuleName.VPA, 0);
  682. switch (movingStatus[currentwafer.OriginSlot])
  683. {
  684. case MovingStatus.StartAlign:
  685. if(_TMRobot.IsAvailable)
  686. {
  687. float angle = float.Parse(currentwafer.ProcessJob.Sequence.Steps[0].StepParameter["AlignAngle"].ToString());
  688. _TMRobot.Align(angle);
  689. movingStatus[currentwafer.OriginSlot] = MovingStatus.Aligning;
  690. SERunTMRobotTask();
  691. return;
  692. }
  693. break;
  694. case MovingStatus.Aligning:
  695. movingStatus[currentwafer.OriginSlot] = MovingStatus.WaitProcess;
  696. if (WaferManager.Instance.CheckNoWafer(ModuleName.TMRobot, 0) && _TMRobot.IsAvailable)
  697. {
  698. _moveQueue.Add(new MoveItem(ModuleName.VPA, 0, ModuleName.TMRobot, 0, 0));
  699. SERunTMRobotTask();
  700. return;
  701. }
  702. if (WaferManager.Instance.CheckNoWafer(ModuleName.TMRobot, 1) && _TMRobot.IsAvailable)
  703. {
  704. _moveQueue.Add(new MoveItem(ModuleName.VPA, 0, ModuleName.TMRobot, 1, (Hand)1));
  705. SERunTMRobotTask();
  706. return;
  707. }
  708. break;
  709. }
  710. }
  711. }
  712. private void PrepareTMMoveitems()
  713. {
  714. }
  715. private void Cycling()
  716. {
  717. //所有的PM都Idle TM都空闲的情况
  718. if (IsAllNeedPMsAvailabe() && IsModuleAvailable(_destinationModule) && IsModuleAvailable(_sourceModule) && _TMRobot.IsAvailable)
  719. {
  720. //如果PM没有wafer tm也闲置 但Cycle数量未达到目标
  721. if (!PMsHasWafers() && _TMRobot.IsAvailable && _CycleWafers.Count == 0)
  722. {
  723. ++CycleIndex;
  724. if (CycleIndex < CycleNum)
  725. {
  726. for (int i = 0; i < _sourceSlotNumber; i++)
  727. {
  728. if (WaferManager.Instance.CheckHasWafer(_sourceModule, i))
  729. _CycleWafers.Enqueue(new MoveItem(_sourceModule, i, _destinationModule, i, Hand.None));
  730. }
  731. }
  732. else
  733. {
  734. _cycleState = RState.End;
  735. return;
  736. }
  737. }
  738. //wafer返回
  739. if (PMsHasWafers())
  740. {
  741. var pmSlots = GetReadyOutPMs();
  742. //var inSlots = GetReadyInSlot(_destinationModule, _destinationSlotNumber);
  743. for (int i = 0; i < pmSlots.Count ; i++)
  744. {
  745. WaferInfo _endwafer = WaferManager.Instance.GetWafer(pmSlots[i], 0);
  746. int _endslot = _endwafer.OriginSlot;
  747. _runningItems.Enqueue(new MoveItem(pmSlots[i], 0, _destinationModule, _endslot, Hand.Both));
  748. }
  749. }
  750. else
  751. {
  752. //进腔环节 可在此处根据PM的角度 增加进入角度
  753. //三个腔体的进入方式
  754. var InPMs = GetReadyInPMs();
  755. if (_CycleWafers.Count > 0 && InPMs.Count >= 1)
  756. {
  757. var item = _CycleWafers.Dequeue();
  758. _runningItems.Enqueue(new MoveItem(item.SourceModule, item.SourceSlot, InPMs[0], 0, Hand.Both));
  759. }
  760. if (_CycleWafers.Count > 0 && InPMs.Count >= 2)
  761. {
  762. var item = _CycleWafers.Dequeue();
  763. _runningItems.Enqueue(new MoveItem(item.SourceModule, item.SourceSlot, InPMs[1], 0, Hand.Both));
  764. }
  765. if (_CycleWafers.Count > 0 && InPMs.Count >= 3)
  766. {
  767. var item = _CycleWafers.Dequeue();
  768. _runningItems.Enqueue(new MoveItem(item.SourceModule, item.SourceSlot, InPMs[2], 0, Hand.Both));
  769. }
  770. }
  771. if (_runningItems.Count > 0)
  772. {
  773. if (_TMRobot.PostMoveItems(_runningItems.ToArray()))
  774. _runningItems.Clear();
  775. }
  776. }
  777. //存在PM可用
  778. //else if (IsExistPMsAvailabe() && IsModuleAvailable(_destinationModule) && IsModuleAvailable(_sourceModule) && _TMRobot.IsAvailable)
  779. //{
  780. // //获得可以用的chamber 向里面传片
  781. //}
  782. }
  783. private void PMProcess()
  784. {
  785. //foreach (ModuleName chamber in tmCycleRoutine)
  786. //{
  787. // if (ModuleHelper.IsPm(chamber) && WaferManager.Instance.CheckHasWafer(chamber, 0) && ModuleHelper.IsInstalled(chamber))
  788. // {
  789. // WaferInfo info = WaferManager.Instance.GetWafer(chamber, 0);
  790. //
  791. // dictSchedulers[chamber].EventWaferArrived?.Invoke(this, new WaferMoveArgs(ModuleName.TMRobot, 0, chamber, 0));
  792. // }
  793. //}
  794. }
  795. public void Abort()
  796. {
  797. CycleIndex = null;
  798. _runningItems.Clear();
  799. _CycleWafers.Clear();
  800. _moveQueue.Clear();
  801. movingStatus.Clear();
  802. foreach(var cj in _lstControlJobs.FindAll(x => x.State == EnumControlJobState.Executing))
  803. cj.SetState(EnumControlJobState.WaitingForStart);
  804. _TMRobot._entityTaskToken = (int)FSM_MSG.NONE;
  805. _cycleState = RState.End;
  806. }
  807. #endregion
  808. #region 搜索函数
  809. //回到的槽位确认 采用补进方式即自底向上填
  810. private List<int> GetReadyInSlot(ModuleName module, int slotCount)
  811. {
  812. List<int> slots = new List<int>();
  813. for (int i = 0; i < slotCount; i++)
  814. {
  815. if (WaferManager.Instance.CheckNoWafer(module, i))
  816. slots.Add(i);
  817. if (slots.Count >= 2)
  818. return slots;
  819. }
  820. return slots;
  821. }
  822. //确认
  823. private List<int> GetReadyOutSlot(ModuleName module, int slotCount)
  824. {
  825. List<int> slots = new List<int>();
  826. for (int i = 0; i < slotCount; i++)
  827. {
  828. if (WaferManager.Instance.CheckHasWafer(module, i))
  829. slots.Add(i);
  830. if (slots.Count >= 2)
  831. return slots;
  832. }
  833. return slots;
  834. }
  835. //确认PM是否可用 且没有wafer
  836. private List<ModuleName> GetReadyInPMs()
  837. {
  838. List<ModuleName> inpm = new List<ModuleName>();
  839. foreach (var module in tmCycleRoutine)
  840. {
  841. if (ModuleHelper.IsPm(module))
  842. {
  843. if (IsModuleAvailable(module) && WaferManager.Instance.CheckNoWafer(module, 0))
  844. {
  845. inpm.Add(module);
  846. if (inpm.Count >= 3)
  847. break;
  848. }
  849. }
  850. }
  851. return inpm;
  852. }
  853. private List<ModuleName> GetReadyOutPMs()
  854. {
  855. List<ModuleName> outpm = new List<ModuleName>();
  856. foreach (var module in tmCycleRoutine)
  857. {
  858. if (ModuleHelper.IsPm(module))
  859. {
  860. if (IsModuleAvailable(module) && WaferManager.Instance.CheckHasWafer(module, 0))
  861. {
  862. outpm.Add(module);
  863. if (outpm.Count >= 3)
  864. break;
  865. }
  866. }
  867. }
  868. return outpm;
  869. }
  870. //PM有wafer
  871. private bool PMsHasWafers()
  872. {
  873. foreach (var module in tmCycleRoutine)
  874. {
  875. if (ModuleHelper.IsPm(module) && ModuleHelper.IsInstalled(module))
  876. {
  877. if (WaferManager.Instance.CheckHasWafer(module, 0))
  878. return true;
  879. }
  880. }
  881. return false;
  882. }
  883. //PM全可用
  884. private bool IsAllNeedPMsAvailabe()
  885. {
  886. foreach (var module in tmCycleRoutine)
  887. {
  888. if (ModuleHelper.IsPm(module) && ModuleHelper.IsInstalled(module))
  889. {
  890. if (!IsModuleAvailable(module))
  891. return false;
  892. }
  893. }
  894. return true;
  895. }
  896. //PM存在可用
  897. private bool SequenceNeedPMsAvailable(List<ModuleName> needPMs)
  898. {
  899. foreach (var module in needPMs)
  900. {
  901. if (ModuleHelper.IsPm(module) && ModuleHelper.IsInstalled(module))
  902. {
  903. if (IsModuleAvailable(module) && WaferManager.Instance.CheckNoWafer(module,0))
  904. return true;
  905. }
  906. }
  907. return false;
  908. }
  909. private ModuleName SearchPM(List<ModuleName> needPMs,Dictionary<int,ModuleName> PMsChoice)
  910. {
  911. foreach (var module in needPMs)
  912. {
  913. if (ModuleHelper.IsPm(module) && ModuleHelper.IsInstalled(module))
  914. {
  915. if (IsModuleAvailable(module) && !PMsChoice.ContainsValue(module) && WaferManager.Instance.CheckNoWafer(module,0))
  916. return module;
  917. }
  918. }
  919. return ModuleName.TMRobot;
  920. }
  921. private bool IsModuleAvailable(ModuleName module)
  922. {
  923. return dictSchedulers.Keys.Contains(module) && dictSchedulers[module].IsAvailable;
  924. }
  925. //检查需要使用的pm
  926. private bool CheckSequencePmReady(SequenceInfo seq, List<ModuleName> pmOccupied, out List<ModuleName> pmUsed, out string reason)
  927. {
  928. pmUsed = new List<ModuleName>();
  929. reason = "";
  930. bool pmIsReady = true;
  931. for (int i = 0; i < seq.Steps.Count; i++)
  932. {
  933. SequenceStepInfo stepInfo = seq.Steps[i];
  934. bool hasPm = false;
  935. foreach (var module in stepInfo.StepModules)
  936. {
  937. if (!ModuleHelper.IsPm(module))
  938. {
  939. hasPm = true;
  940. break;
  941. }
  942. if (ModuleHelper.IsInstalled(module) && (pmOccupied == null || !pmOccupied.Contains(module)))
  943. {
  944. hasPm = true;
  945. }
  946. if (!pmUsed.Contains(module))
  947. pmUsed.Add(module);
  948. }
  949. if (pmIsReady && !hasPm)
  950. {
  951. reason = $"Step {i + 1} no valid PM, " + string.Join("|", stepInfo.StepModules);
  952. pmIsReady = false;
  953. }
  954. }
  955. return pmIsReady;
  956. }
  957. //检查是否又对应PM的recipe
  958. private bool CheckSequenceRecipeFileValid(SequenceInfo seq, out string reason)
  959. {
  960. for (int i = 0; i < seq.Steps.Count; i++)
  961. {
  962. SequenceStepInfo stepInfo = seq.Steps[i];
  963. foreach (var module in stepInfo.StepModules)
  964. {
  965. if (ModuleHelper.IsPm(module))
  966. {
  967. string attr = $"{module}Recipe";
  968. if (stepInfo.StepParameter.ContainsKey(attr)
  969. && !string.IsNullOrEmpty((string)stepInfo.StepParameter[attr]))
  970. {
  971. var recipeName = (string)stepInfo.StepParameter[attr];
  972. if (!string.IsNullOrEmpty(recipeName))
  973. {
  974. var recipeContent =
  975. RecipeFileManager.Instance.LoadRecipe($"{module}", recipeName, false, "Process");
  976. if (string.IsNullOrEmpty(recipeContent))
  977. {
  978. reason = $"Can not find recipe file{recipeName}";
  979. return false;
  980. }
  981. }
  982. }
  983. }
  984. }
  985. }
  986. reason = "";
  987. return true;
  988. }
  989. //找到对应sequence
  990. public ProcessJobInfo GetFirstProcessJob(ControlJobInfo cj)
  991. {
  992. foreach (var pj in _lstProcessJobs)
  993. {
  994. if (pj.ControlJobName == cj.Name)
  995. return pj;
  996. }
  997. return null;
  998. }
  999. #endregion
  1000. }
  1001. }