AutoTransferClean.cs 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using Aitex.Core.RT.Routine;
  7. using EfemDualSchedulerLib.Schedulers;
  8. using MECF.Framework.Common.Equipment;
  9. using MECF.Framework.Common.Jobs;
  10. namespace EfemDualSchedulerLib
  11. {
  12. public partial class AutoTransfer
  13. {
  14. private bool _isInited;
  15. private void InitClean()
  16. {
  17. foreach (var pm in _lstPms)
  18. {
  19. pm.InitClean();
  20. }
  21. }
  22. private void ClearCleanInfo()
  23. {
  24. foreach (var pm in _lstPms)
  25. {
  26. pm.ResetClean(true, true, true);
  27. }
  28. }
  29. public void ResetIdleCleanTime(string module)
  30. {
  31. if (string.IsNullOrEmpty(module))
  32. {
  33. foreach (var schedulerPm in _lstPms)
  34. {
  35. schedulerPm.ResetIdleCleanTime();
  36. }
  37. }
  38. else
  39. {
  40. SchedulerPM pm = _lstPms.Find(x => x.Module.ToString() == module);
  41. if (pm != null)
  42. {
  43. pm.ResetIdleCleanTime();
  44. }
  45. }
  46. }
  47. public void ResetIdlePurgeTime(string module)
  48. {
  49. if (string.IsNullOrEmpty(module))
  50. {
  51. foreach (var schedulerPm in _lstPms)
  52. {
  53. schedulerPm.ResetIdlePurgeTime();
  54. }
  55. }
  56. else
  57. {
  58. SchedulerPM pm = _lstPms.Find(x => x.Module.ToString() == module);
  59. if (pm != null)
  60. {
  61. pm.ResetIdlePurgeTime();
  62. }
  63. }
  64. }
  65. public Result MonitorCleanTasks()
  66. {
  67. if (!_isInited)
  68. {
  69. _isInited = true;
  70. InitClean();
  71. }
  72. foreach (var pm in _lstPms)
  73. {
  74. pm.MonitorCleanTasks();
  75. }
  76. return Result.RUN;
  77. }
  78. private void PreJobClean(ControlJobInfo cj)
  79. {
  80. if (cj.IsPreJobCleanDone)
  81. return;
  82. cj.IsPreJobCleanDone = true;
  83. List<SchedulerPM> pms = GetPmNeeded(cj);
  84. foreach (var pm in pms)
  85. {
  86. pm.PreJobClean();
  87. }
  88. }
  89. //private void PreJobClean(ProcessJobInfo pj)
  90. //{
  91. // List<SchedulerPM> pms = GetPmNeeded(pj);
  92. // foreach (var pm in pms)
  93. // {
  94. // pm.PreJobClean();
  95. // }
  96. //}
  97. private void CompleteJobClean(ControlJobInfo cj)
  98. {
  99. List<SchedulerPM> pms = GetPmNeeded(cj);
  100. foreach (var pm in pms)
  101. {
  102. pm.CompleteJobClean();
  103. }
  104. }
  105. private List<SchedulerPM> GetPmNeeded(ControlJobInfo cj)
  106. {
  107. List<SchedulerPM> result = new List<SchedulerPM>();
  108. foreach (var pj in _lstProcessJobs)
  109. {
  110. if (pj.ControlJobName != cj.Name)
  111. continue;
  112. var seq = pj.Sequence;
  113. for (int i = 0; i < seq.Steps.Count; i++)
  114. {
  115. SequenceStepInfo stepInfo = seq.Steps[i];
  116. foreach (var module in stepInfo.StepModules)
  117. {
  118. if (ModuleHelper.IsPm(module))
  119. {
  120. var pm = _lstPms.Find(x => x.Module == module);
  121. if (pm != null && !result.Contains(pm))
  122. {
  123. result.Add(pm);
  124. }
  125. }
  126. }
  127. }
  128. }
  129. return result;
  130. }
  131. }
  132. }