SchedulerPM.cs 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Diagnostics;
  4. using System.Linq;
  5. using Aitex.Core.Common;
  6. using Aitex.Core.RT.DataCenter;
  7. using Aitex.Core.RT.Event;
  8. using Aitex.Core.RT.Fsm;
  9. using Aitex.Core.RT.Log;
  10. using Aitex.Core.RT.OperationCenter;
  11. using Aitex.Core.RT.SCCore;
  12. using Aitex.Core.Util;
  13. using Aitex.Sorter.Common;
  14. using MECF.Framework.Common.DataCenter;
  15. using MECF.Framework.Common.Equipment;
  16. using MECF.Framework.Common.Schedulers;
  17. using MECF.Framework.Common.SubstrateTrackings;
  18. using MECF.Framework.RT.ModuleLibrary.PMModules;
  19. using MECF.Framework.RT.ModuleLibrary.SystemModules;
  20. namespace EfemDualSchedulerLib.Schedulers
  21. {
  22. public class SchedulerPM : SchedulerModule
  23. {
  24. public override bool IsAvailable
  25. {
  26. get
  27. {
  28. if (!SC.IsATMMode)
  29. return _pm.IsReady && _pm.IsOnline && CheckTaskDone() && !_waitCompletejobClean;
  30. return _pm.IsReady && _pm.IsOnline && CheckTaskDone();
  31. }
  32. }
  33. public override bool IsOnline
  34. {
  35. get { return _pm.IsOnline; }
  36. }
  37. public override bool IsError
  38. {
  39. get { return _pm.IsError; }
  40. }
  41. public bool IsIdle
  42. {
  43. get { return _pm.IsReady && _pm.IsOnline && CheckTaskDone(); }
  44. }
  45. private PMModuleBase _pm = null;
  46. private double _paramTemp1;
  47. private double _paramTemp2;
  48. private ModuleName _taskRobot;
  49. private EnumTransferType _taskTransferType;
  50. private int[] _taskSlot;
  51. private DeviceTimer _timer = new DeviceTimer();
  52. protected readonly string _statNamePM1ProcessedWaferCount;
  53. protected readonly string _statNamePM2ProcessedWaferCount;
  54. protected readonly string _statNamePM1ProcessTime;
  55. protected readonly string _statNamePM2ProcessTime;
  56. public RD_TRIG IdlePurgeTrig { get; set; } = new RD_TRIG();
  57. public Stopwatch IdlePurgeTimer { get; set; } = new Stopwatch();
  58. public int IdlePurgeTime { get; set; }
  59. public int IdlePurgeNextRunTime { get; set; }
  60. public RD_TRIG IdleCleanTrig { get; set; } = new RD_TRIG();
  61. public Stopwatch IdleCleanTimer { get; set; } = new Stopwatch();
  62. public int IdleCleanTime { get; set; }
  63. public int IdleCleanNextRunTime { get; set; }
  64. private bool _waitPreJobClean;
  65. private bool _waitCompletejobClean;
  66. private R_TRIG _trigIdleCleanFailed = new R_TRIG();
  67. private R_TRIG _trigIdlePurgeFailed = new R_TRIG();
  68. public RD_TRIG PreJobCleanTrig { get; set; } = new RD_TRIG();
  69. public Stopwatch PreJobCleanTimer { get; set; } = new Stopwatch();
  70. public int PreJobCleanTime { get; set; }
  71. //protected readonly string _statNameRFTime;
  72. //protected readonly string _statNameMWTime;
  73. public SchedulerPM(ModuleName chamber) : base(chamber.ToString())
  74. {
  75. _pm = EquipmentManager.Modules[chamber] as PMModuleBase;
  76. _pm.IsOnline = true;
  77. _statNamePM1ProcessedWaferCount = $"{chamber}.ProcessedWaferCount1";
  78. _statNamePM2ProcessedWaferCount = $"{chamber}.ProcessedWaferCount2";
  79. _statNamePM1ProcessTime = $"{chamber}.ProcessTime1";
  80. _statNamePM2ProcessTime = $"{chamber}.ProcessTime2";
  81. //_statNameRFTime = $"{chamber}.RFTime";
  82. //_statNameMWTime = $"{chamber}.MWTime";
  83. System.Diagnostics.Trace.Assert(_pm != null);
  84. }
  85. public bool CheckTempReady(double temp1, double temp2)
  86. {
  87. return _pm.CheckTempReady(temp1, temp2);
  88. }
  89. public bool CheckTransferTempReady(double temp1, double temp2)
  90. {
  91. return _pm.CheckTransferTempReady(temp1, temp2);
  92. }
  93. public bool CheckTemp1Alarm(double recipeTemp1)
  94. {
  95. return _pm.CheckTemp1Alarm(recipeTemp1);
  96. }
  97. public bool CheckTemp2Alarm(double recipeTemp2)
  98. {
  99. return _pm.CheckTemp2Alarm(recipeTemp2);
  100. }
  101. public override bool IsReadyForPick(ModuleName robot, Hand blade, int slot)
  102. {
  103. return _pm.CheckReadyForTransfer(robot, blade, slot, EnumTransferType.Pick, out _)
  104. && WaferManager.Instance.CheckHasWafer(ModuleHelper.Converter(_module), slot);
  105. }
  106. public override bool IsReadyForPlace(ModuleName robot, Hand blade, int slot)
  107. {
  108. return _pm.CheckReadyForTransfer(robot, blade, slot, EnumTransferType.Place, out _)
  109. && WaferManager.Instance.CheckNoWafer(ModuleHelper.Converter(_module), slot);
  110. }
  111. public override bool PrepareTransfer(ModuleName robot, EnumTransferType type, int[] slot)
  112. {
  113. _task = TaskType.PrepareTransfer;
  114. _taskRobot = robot;
  115. _taskSlot = slot;
  116. _taskTransferType = type;
  117. if (!_pm.PrepareTransfer(robot, Hand.Blade1, slot, type, 0, 0, false, out string reason))
  118. {
  119. LOG.Write(reason);
  120. return false;
  121. }
  122. Array.ForEach(slot,p=> LogTaskStart(_task, $"{robot} {type} slot {p + 1}"));
  123. return true;
  124. }
  125. public bool Preheating(double temperature1, double temperature2)
  126. {
  127. _task = TaskType.Heating;
  128. _paramTemp1 = temperature1;
  129. _paramTemp2 = temperature2;
  130. if (_pm.InvokePreHeat(temperature1, temperature2))
  131. {
  132. LOG.Write("Can not PreHeat");
  133. return false;
  134. }
  135. LogTaskStart(_task, $"preheat to {temperature1},{temperature2}");
  136. return true;
  137. }
  138. //public bool IsPrepareTransfer(ModuleName robot, EnumTransferType type, int slot)
  139. //{
  140. // return _task == TaskType.PrepareTransfer && _taskRobot == robot && _taskSlot == slot &&
  141. // _taskTransferType == type;
  142. //}
  143. public override bool Process(string recipeName, bool isCleanRecipe, bool withWafer)
  144. {
  145. _task = TaskType.Process;
  146. //if (SC.GetValue<bool>("System.IsATMMode"))
  147. //{
  148. // _timer.Start(SC.GetValue<int>("System.ATMProcessDelayTime") * 1000);
  149. // //_entityTaskToken = (int)FSM_MSG.TIMER;
  150. // WaferManager.Instance.GetWafer(Module, 0).ProcessState = EnumWaferProcessStatus.InProcess;
  151. // WaferManager.Instance.GetWafer(Module, 1).ProcessState = EnumWaferProcessStatus.InProcess;
  152. //}
  153. //else
  154. {
  155. if (!_pm.Process(recipeName, isCleanRecipe, withWafer, out string reason))
  156. {
  157. LOG.Write(reason);
  158. return false;
  159. }
  160. }
  161. if (HasWafer(0))
  162. UpdatePM1Stats_data(recipeName, isCleanRecipe);
  163. if (HasWafer(1))
  164. UpdatePM2Stats_data(recipeName, isCleanRecipe);
  165. LogTaskStart(_task, $"recipe: {recipeName}, clean: {isCleanRecipe}, with wafer: {withWafer}");
  166. return true;
  167. }
  168. public virtual void UpdatePM1Stats_data(string recipeName, bool isClean)
  169. {
  170. if (!isClean)
  171. {
  172. int value1 = StatsDataManager.Instance.Increase(_statNamePM1ProcessedWaferCount);
  173. int value2 = StatsDataManager.Instance.Increase(_statNamePM1ProcessTime);
  174. LOG.Write($"{_statNamePM1ProcessedWaferCount} counter increase 1 to {value1}");
  175. LOG.Write($"{_statNamePM1ProcessTime} counter increase 1 to {value2}");
  176. }
  177. }
  178. public virtual void UpdatePM2Stats_data(string recipeName, bool isClean)
  179. {
  180. if (!isClean)
  181. {
  182. int value1 = StatsDataManager.Instance.Increase(_statNamePM2ProcessedWaferCount);
  183. int value2 = StatsDataManager.Instance.Increase(_statNamePM2ProcessTime);
  184. LOG.Write($"{_statNamePM2ProcessedWaferCount} counter increase 1 to {value1}");
  185. LOG.Write($"{_statNamePM2ProcessTime} counter increase 1 to {value2}");
  186. }
  187. }
  188. public bool CheckTaskDone()
  189. {
  190. bool ret = false;
  191. switch (_task)
  192. {
  193. case TaskType.None:
  194. ret = true;
  195. break;
  196. case TaskType.PrepareTransfer:
  197. ret = _taskSlot.All(p => _pm.CheckReadyForTransfer(_taskRobot, Hand.Blade1, p, _taskTransferType, out _));
  198. break;
  199. case TaskType.Heating:
  200. ret = CheckTempReady(_paramTemp1, _paramTemp2);
  201. break;
  202. case TaskType.Process:
  203. case TaskType.IdlePurgeProcess:
  204. case TaskType.IdleCleanProcess:
  205. case TaskType.PreJobProcess:
  206. case TaskType.CompleteJobProcess:
  207. //if (SC.GetValue<bool>("System.IsATMMode"))
  208. //{
  209. // ret = _timer.IsTimeout();
  210. // if (ret)
  211. // {
  212. // WaferManager.Instance.GetWafer(Module, 0).ProcessState = EnumWaferProcessStatus.Completed;
  213. // WaferManager.Instance.GetWafer(Module, 1).ProcessState = EnumWaferProcessStatus.Completed;
  214. // }
  215. //}
  216. //else
  217. {
  218. ret = _pm.IsReady;
  219. }
  220. break;
  221. }
  222. if (ret && _task != TaskType.None)
  223. {
  224. LogTaskDone(_task, "");
  225. _task = TaskType.None;
  226. }
  227. return ret;
  228. }
  229. public bool CheckInProcess()
  230. {
  231. return _task == TaskType.Process;
  232. }
  233. public bool CloseSlitValve()
  234. {
  235. return _pm.CloseSlitValve(out _);
  236. }
  237. public bool CheckSlitValveClose()
  238. {
  239. return _pm.CheckSlitValveClose();
  240. }
  241. public bool Monitor()
  242. {
  243. return true;
  244. }
  245. #region clean task
  246. public void InitClean()
  247. {
  248. DATA.Subscribe($"{Module}.IdlePurgeNextRunTime", () => IdlePurgeNextRunTime);
  249. DATA.Subscribe($"{Module}.IdleCleanNextRunTime", () => IdleCleanNextRunTime);
  250. OP.Subscribe($"{Module}.ResetIdlePurgeTime", (string cmd, object[] args) =>
  251. {
  252. ResetIdlePurgeTime();
  253. return true;
  254. });
  255. OP.Subscribe($"{Module}.ResetIdleCleanTime", (string cmd, object[] args) =>
  256. {
  257. ResetIdleCleanTime();
  258. return true;
  259. });
  260. }
  261. internal void ResetIdlePurgeTime()
  262. {
  263. IdlePurgeTimer.Restart();
  264. }
  265. internal void ResetIdleCleanTime()
  266. {
  267. IdleCleanTimer.Restart();
  268. }
  269. public bool ResetClean(bool resetPurge, bool resetClean, bool jobClean)
  270. {
  271. if (resetPurge)
  272. {
  273. IdlePurgeTrig.RST = true;
  274. IdlePurgeTimer.Stop();
  275. IdlePurgeTime = 0;
  276. }
  277. if (resetClean)
  278. {
  279. IdleCleanTrig.RST = true;
  280. IdleCleanTimer.Stop();
  281. IdleCleanTime = 0;
  282. }
  283. if (jobClean)
  284. {
  285. _waitPreJobClean = false;
  286. _waitCompletejobClean = false;
  287. PreJobCleanTrig.RST = true;
  288. PreJobCleanTimer.Stop();
  289. }
  290. return true;
  291. }
  292. public void MonitorCleanTasks()
  293. {
  294. if (SC.IsATMMode)
  295. return;
  296. var hasWafer = WaferManager.Instance.CheckHasWafer(Module, 0) || WaferManager.Instance.CheckHasWafer(Module, 1);
  297. var enablePurge = false;//SC.GetValue<bool>($"{Module}.IdlePurge.IsEnabled");
  298. var enableClean = SC.GetValue<bool>($"{Module}.IdleClean.IsEnabled");
  299. #region Idle Purge
  300. IdlePurgeTrig.CLK = (IsIdle || _task != TaskType.IdlePurgeProcess) && enablePurge && !hasWafer;
  301. if (IdlePurgeTrig.R)
  302. {
  303. LOG.Write($"{Module} idle purge start calc elapse time");
  304. IdlePurgeTimer.Restart();
  305. }
  306. if (IdlePurgeTrig.T)
  307. {
  308. LOG.Write($"{Module} idle purge stopped calc elapse time");
  309. ResetClean(true, false, false);
  310. }
  311. if (IdlePurgeTimer.IsRunning)
  312. {
  313. IdlePurgeTime = (int)IdlePurgeTimer.ElapsedMilliseconds / 1000;
  314. int idlePurgeTimeSetPoint = SC.GetValue<int>($"{Module}.IdlePurge.IdlePurgeTime");
  315. var nextRunTime = idlePurgeTimeSetPoint - IdlePurgeTime;
  316. if (nextRunTime < 0)
  317. nextRunTime = 0;
  318. if (enablePurge)
  319. {
  320. if (nextRunTime <= 0 && IsAvailable)
  321. {
  322. var recipe = SC.GetStringValue($"{Module}.IdlePurge.IdlePurgeRecipe");
  323. if (string.IsNullOrEmpty(recipe))
  324. {
  325. _trigIdlePurgeFailed.CLK = true;
  326. LOG.Write($"{Module} Idle purge can not run, recipe is empty");
  327. ResetClean(true, false, false);
  328. }
  329. else if (hasWafer)
  330. {
  331. _trigIdlePurgeFailed.CLK = true;
  332. LOG.Write($"{Module} Idle purge can not run, has wafer");
  333. ResetClean(true, false, false);
  334. }
  335. else
  336. {
  337. _trigIdlePurgeFailed.CLK = false;
  338. LOG.Write($"{Module} Start run idle purge recipe {recipe}");
  339. IdlePurgeProcess("ALD\\Process\\" + recipe);
  340. }
  341. if (_trigIdlePurgeFailed.Q)
  342. {
  343. EV.PostWarningLog(Module.ToString(), "Can not run idle purge recipe");
  344. }
  345. }
  346. }
  347. else
  348. {
  349. nextRunTime = 0;
  350. }
  351. IdlePurgeNextRunTime = nextRunTime;
  352. }
  353. else
  354. {
  355. IdlePurgeNextRunTime = 0;
  356. }
  357. #endregion
  358. #region Idle Clean
  359. IdleCleanTrig.CLK = (IsIdle || _task != TaskType.IdleCleanProcess) && enableClean && !hasWafer;
  360. if (IdleCleanTrig.R)
  361. {
  362. LOG.Write($"{Module} idle clean start calc elapse time");
  363. IdleCleanTimer.Restart();
  364. }
  365. if (IdleCleanTrig.T)
  366. {
  367. LOG.Write($"{Module} idle clean stopped calc elapse time");
  368. ResetClean(false, true, false);
  369. }
  370. if (IdleCleanTimer.IsRunning)
  371. {
  372. IdleCleanTime = (int)IdleCleanTimer.ElapsedMilliseconds / 1000;
  373. int idleCleanTimeSetPoint = SC.GetValue<int>($"{Module}.IdleClean.IdleCleanTime");
  374. var nextRunTime = idleCleanTimeSetPoint - IdleCleanTime;
  375. if (nextRunTime < 0)
  376. nextRunTime = 0;
  377. if (enableClean)
  378. {
  379. if (nextRunTime <= 0 && IsAvailable)
  380. {
  381. var recipe = SC.GetStringValue($"{Module}.IdleClean.IdleCleanRecipe");
  382. if (string.IsNullOrEmpty(recipe))
  383. {
  384. _trigIdleCleanFailed.CLK = true;
  385. LOG.Write($"{Module} Idle clean can not run, recipe is empty");
  386. ResetClean(false, true, false);
  387. }
  388. else if (hasWafer)
  389. {
  390. _trigIdleCleanFailed.CLK = true;
  391. LOG.Write($"{Module} Idle clean can not run, has wafer");
  392. ResetClean(false, true, false);
  393. }
  394. else
  395. {
  396. _trigIdleCleanFailed.CLK = false;
  397. LOG.Write($"{Module} Start run idle Clean recipe {recipe}");
  398. IdleCleanProcess($"{Module}\\" + recipe);
  399. }
  400. if (_trigIdleCleanFailed.Q)
  401. {
  402. EV.PostWarningLog(Module.ToString(), "Can not run idle clean recipe");
  403. }
  404. }
  405. }
  406. else
  407. {
  408. nextRunTime = 0;
  409. }
  410. IdleCleanNextRunTime = nextRunTime;
  411. }
  412. else
  413. {
  414. IdleCleanNextRunTime = 0;
  415. }
  416. #endregion
  417. #region PreJob Clean
  418. var enableJobClean = SC.GetValue<bool>($"{Module}.JobClean.IsEnabled");
  419. var enablePreJobClean = SC.GetValue<bool>($"{Module}.JobClean.EnablePreJobClean");
  420. var enableCompleteJobClean = SC.GetValue<bool>($"{Module}.JobClean.EnableCompleteJobClean");
  421. if (enableJobClean && enableCompleteJobClean && _waitCompletejobClean && IsIdle)
  422. {
  423. var recipe = SC.GetStringValue($"{Module}.JobClean.CompleteJobCleanRecipe");
  424. if (string.IsNullOrEmpty(recipe))
  425. {
  426. EV.PostWarningLog(Module.ToString(), "complete job clean can not run, recipe is empty");
  427. }
  428. else if (hasWafer)
  429. {
  430. EV.PostWarningLog(Module.ToString(), "complete job clean can not run, has wafer");
  431. }
  432. else
  433. {
  434. EV.PostInfoLog(Module.ToString(), $"Start run complete job clean recipe {recipe}");
  435. CompleteJobProcess($"{Module}\\" + recipe);
  436. }
  437. _waitCompletejobClean = false;
  438. }
  439. PreJobCleanTrig.CLK = enableJobClean && enablePreJobClean && IsIdle;
  440. if (PreJobCleanTrig.R)
  441. {
  442. PreJobCleanTimer.Restart();
  443. }
  444. if (PreJobCleanTrig.T)
  445. {
  446. ResetClean(false, false, true);
  447. }
  448. if (enableJobClean && enablePreJobClean && _waitPreJobClean && PreJobCleanTimer.IsRunning && IsIdle)
  449. {
  450. PreJobCleanTime = (int)PreJobCleanTimer.ElapsedMilliseconds / 1000;
  451. int PreJobCleanIdleTimeSP = SC.GetValue<int>($"{Module}.JobClean.IdleCleanTime");
  452. if (PreJobCleanTime >= PreJobCleanIdleTimeSP)
  453. {
  454. var recipe = SC.GetStringValue($"{Module}.JobClean.PreJobCleanRecipe");
  455. if (string.IsNullOrEmpty(recipe))
  456. {
  457. EV.PostWarningLog(Module.ToString(), "pre job clean can not run, recipe is empty");
  458. }
  459. else if (hasWafer)
  460. {
  461. EV.PostWarningLog(Module.ToString(), "pre job clean can not run, has wafer");
  462. }
  463. else
  464. {
  465. EV.PostInfoLog(Module.ToString(), $"Start run pre job clean recipe {recipe}");
  466. PreJobProcess($"{Module}\\" + recipe);
  467. }
  468. }
  469. }
  470. #endregion
  471. }
  472. public bool IdlePurgeProcess(string recipeName)
  473. {
  474. _task = TaskType.IdlePurgeProcess;
  475. if (!_pm.Process(recipeName, true, false, out string reason))
  476. {
  477. LOG.Write(reason);
  478. return false;
  479. }
  480. LogTaskStart(_task, $"recipe: {recipeName}, clean: {true}, with wafer: {false}");
  481. return true;
  482. }
  483. public bool IdleCleanProcess(string recipeName)
  484. {
  485. _task = TaskType.IdleCleanProcess;
  486. if (!_pm.Process(recipeName, true, false, out string reason))
  487. {
  488. LOG.Write(reason);
  489. return false;
  490. }
  491. LogTaskStart(_task, $"recipe: {recipeName}, clean: {true}, with wafer: {false}");
  492. return true;
  493. }
  494. public void PreJobClean()
  495. {
  496. var enableJobClean = SC.GetValue<bool>($"{Module}.JobClean.IsEnabled");
  497. var enablePreJobClean = SC.GetValue<bool>($"{Module}.JobClean.EnablePreJobClean");
  498. var enableCompleteJobClean = SC.GetValue<bool>($"{Module}.JobClean.EnableCompleteJobClean");
  499. _waitPreJobClean = enableJobClean && enablePreJobClean;
  500. }
  501. public bool PreJobProcess(string recipeName)
  502. {
  503. _task = TaskType.PreJobProcess;
  504. if (!_pm.Process(recipeName, true, false, out string reason))
  505. {
  506. LOG.Write(reason);
  507. return false;
  508. }
  509. LogTaskStart(_task, $"recipe: {recipeName}, clean: {true}, with wafer: {false}");
  510. return true;
  511. }
  512. public void CompleteJobClean()
  513. {
  514. var enableJobClean = SC.GetValue<bool>($"{Module}.JobClean.IsEnabled");
  515. var enablePreJobClean = SC.GetValue<bool>($"{Module}.JobClean.EnablePreJobClean");
  516. var enableCompleteJobClean = SC.GetValue<bool>($"{Module}.JobClean.EnableCompleteJobClean");
  517. _waitCompletejobClean = enableJobClean && enableCompleteJobClean;
  518. }
  519. public bool CompleteJobProcess(string recipeName)
  520. {
  521. _task = TaskType.CompleteJobProcess;
  522. if (!_pm.Process(recipeName, true, false, out string reason))
  523. {
  524. LOG.Write(reason);
  525. return false;
  526. }
  527. LogTaskStart(_task, $"recipe: {recipeName}, clean: {true}, with wafer: {false}");
  528. return true;
  529. }
  530. #endregion
  531. /// <summary>
  532. /// 检查参数代表的wafer下一站是否是本模块
  533. /// </summary>
  534. /// <param name="module"> 已有wafer的Module</param>
  535. /// <param name="slot"> 已有wafer的Slot</param>
  536. /// <returns></returns>
  537. public override bool CheckWaferNextStepIsThisModule(ModuleName module, int slot)
  538. {
  539. if (!WaferManager.Instance.CheckHasWafer(module, slot))
  540. return false;
  541. WaferInfo wafer = WaferManager.Instance.GetWafer(module, slot);
  542. if (wafer.ProcessJob == null || wafer.ProcessJob.Sequence == null)
  543. return false;
  544. if (wafer.NextSequenceStep >= wafer.ProcessJob.Sequence.Steps.Count)
  545. return false;
  546. if (!wafer.ProcessJob.Sequence.Steps[wafer.NextSequenceStep].StepModules.Contains(module))
  547. return false;
  548. return true;
  549. }
  550. /// <summary>
  551. /// 检查参数代表的wafer下一站是否是本模块thisSlot
  552. /// </summary>
  553. /// <param name="module"> 已有wafer的Module</param>
  554. /// <param name="slot"> 已有wafer的Slot</param>
  555. /// <param name="thisSlot"> 本模块slot位置</param>
  556. /// <returns></returns>
  557. public override bool CheckWaferNextStepIsThisModuleSlot(ModuleName module, int slot, int thisSlot)
  558. {
  559. if (!WaferManager.Instance.CheckHasWafer(module, slot))
  560. return false;
  561. WaferInfo wafer = WaferManager.Instance.GetWafer(module, slot);
  562. if (wafer.ProcessJob == null || wafer.ProcessJob.Sequence == null)
  563. return false;
  564. if (wafer.NextSequenceStep >= wafer.ProcessJob.Sequence.Steps.Count)
  565. return false;
  566. if (!wafer.ProcessJob.Sequence.Steps[wafer.NextSequenceStep].StepModules.Contains(module))
  567. return false;
  568. if (!wafer.ProcessJob.Sequence.Steps[wafer.NextSequenceStep].StepParameter["SlotSelection"].ToString().Contains(thisSlot.ToString()))
  569. return false;
  570. return true;
  571. }
  572. /// <summary>
  573. /// 判断下一步的模块是否有Wafer
  574. /// </summary>
  575. /// <param name="slot"></param>
  576. /// <returns></returns>
  577. public override bool CheckWaferNextStepModuleNoWafer(int slot, bool needIgnoreRobot = true)
  578. {
  579. if (!WaferManager.Instance.CheckHasWafer(Module, slot))
  580. return false;
  581. WaferInfo wafer = WaferManager.Instance.GetWafer(Module, slot);
  582. if (wafer.ProcessJob == null || wafer.ProcessJob.Sequence == null)
  583. return false;
  584. var step = wafer.NextSequenceStep;
  585. if (step >= wafer.ProcessJob.Sequence.Steps.Count)
  586. return false;
  587. List<ModuleName> lstModuleName = wafer.ProcessJob.Sequence.Steps[wafer.NextSequenceStep].StepModules;
  588. if (lstModuleName.Count > 0)
  589. {
  590. if (needIgnoreRobot && lstModuleName.Any(x => x == ModuleName.EfemRobot || x == ModuleName.TMRobot))
  591. {
  592. step += 1;
  593. if (step >= wafer.ProcessJob.Sequence.Steps.Count)
  594. return false;
  595. lstModuleName = wafer.ProcessJob.Sequence.Steps[step].StepModules;
  596. }
  597. for (int i = 0; i < lstModuleName.Count; i++)
  598. {
  599. var moduleName = lstModuleName[i];
  600. if (ModuleHelper.IsPm(moduleName))
  601. {
  602. var stepParameters = wafer.ProcessJob.Sequence.Steps[step].StepParameter;
  603. if(stepParameters != null && stepParameters.Count > 0 && stepParameters.ContainsKey(moduleName.ToString()))
  604. {
  605. var slotList = stepParameters[moduleName.ToString()].ToString().Split(',');
  606. if(slotList != null)
  607. {
  608. foreach(var slotIndex in slotList)
  609. {
  610. if (WaferManager.Instance.CheckNoWafer(moduleName, Convert.ToInt32(slotIndex)))
  611. {
  612. return true;
  613. }
  614. }
  615. }
  616. }
  617. }
  618. }
  619. }
  620. return false;
  621. }
  622. }
  623. }