SETMCycle.cs 47 KB

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