SETMCycle.cs 48 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168
  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. if (RouteManager.IsATMMode)
  108. {
  109. if (!Singleton<RouteManager>.Instance.seTM.TMIsATM)
  110. {
  111. LOG.Write(eEvent.ERR_ROUTER, ModuleName.System, $"TM is not atm, Please vent it first!");
  112. return RState.Failed;
  113. }
  114. if (!Singleton<RouteManager>.Instance.seTM.VCEIsATM)
  115. {
  116. LOG.Write(eEvent.ERR_ROUTER, ModuleName.System, $"VCE is not atm, Please vent it first!");
  117. return RState.Failed;
  118. }
  119. }
  120. //sequenceCycle
  121. CycleIndex = 0;
  122. _pastWafer = 0;
  123. _currentWafer = 0;
  124. CycleNum = SC.GetValue<int>("System.CycleCount");
  125. _CycleWafers.Clear();
  126. IsSequenceCycle = true;
  127. ControlJobInfo cj = _lstControlJobs.Find(x => x.Name == jobName);
  128. if (cj == null)
  129. {
  130. LOG.Write(eEvent.WARN_ROUTER, ModuleName.System, $"start job rejected, not found job with id {jobName}");
  131. return RState.Failed;
  132. }
  133. if (cj.State == EnumControlJobState.WaitingForStart)
  134. {
  135. cj.SetState(EnumControlJobState.Executing);
  136. //PreJobClean(cj);
  137. cj.JetState = EnumJetCtrlJobState.Quequed;
  138. cj.StartTime = DateTime.Now;
  139. if (_IsFirstLot)
  140. {
  141. _dbCallback.LotCreated(cj);
  142. _IsFirstLot = false;
  143. }
  144. _faCallback.JobStarted(cj, GetFirstProcessJob(cj));
  145. int maxslot = 0;
  146. cj.LotWafers.ForEach(x => maxslot = x.OriginSlot > maxslot ? x.OriginSlot : maxslot);
  147. //waiting status means no use
  148. movingStatus = new List<MovingStatus>();
  149. movingStatus.AddRange(new MovingStatus[maxslot + 1]);
  150. for (int i = 0; i < movingStatus.Count; i++)
  151. movingStatus[i] = MovingStatus.Waiting;
  152. foreach (var wafer in cj.LotWafers)
  153. {
  154. WaferInfo currentWafer = WaferManager.Instance.GetWafer((ModuleName)wafer.OriginStation, wafer.OriginSlot);
  155. WaferManager.Instance.UpdateWaferProcessStatus((ModuleName)wafer.OriginStation, wafer.OriginSlot, EnumWaferProcessStatus.Idle);
  156. currentWafer.ProcessJob = _lstProcessJobs.Find(x => x.Sequence.Name == wafer.SequenceName);
  157. if (currentWafer.ProcessJob.Sequence.Steps[0].StepParameter.ContainsValue("VPA"))
  158. movingStatus[wafer.OriginSlot] = MovingStatus.WaitAlign;
  159. else
  160. movingStatus[wafer.OriginSlot] = MovingStatus.WaitProcess;
  161. }
  162. }
  163. if (!_cycleWatch.IsRunning)
  164. {
  165. _cycleWatch.Restart();
  166. }
  167. _starttime = DateTime.Now;
  168. _cycleState = RState.Running;
  169. return _cycleState;
  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. }