StandardHotRunRecipeRoutine.cs 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. using Aitex.Core.RT.Device;
  2. using Aitex.Core.RT.Log;
  3. using Aitex.Core.RT.Routine;
  4. using CyberX8_Core;
  5. using CyberX8_RT.Devices.Metal;
  6. using CyberX8_RT.Modules.Metal;
  7. using MECF.Framework.Common.CommonData;
  8. using MECF.Framework.Common.CommonData.Metal;
  9. using MECF.Framework.Common.CommonData.PowerSupplier;
  10. using MECF.Framework.Common.CommonData.SRD;
  11. using MECF.Framework.Common.Device.PowerSupplier;
  12. using MECF.Framework.Common.RecipeCenter;
  13. using MECF.Framework.Common.Routine;
  14. using MECF.Framework.Common.Utilities;
  15. using System;
  16. using System.Collections.Generic;
  17. using System.Linq;
  18. using System.Text;
  19. using System.Threading.Tasks;
  20. namespace CyberX8_RT.Modules.Metal
  21. {
  22. public class StandardHotRunRecipeRoutine : RoutineBase, IRoutine
  23. {
  24. private enum RecipeStep
  25. {
  26. WaferHolderClampOn,
  27. RunRecipe,
  28. RunRecipeWait,
  29. WaferHolderUnclampOn,
  30. End
  31. }
  32. #region 常量
  33. private const int ALL_DAY_MILLOSECONDS = 24 * 60 * 60 * 1000;
  34. #endregion
  35. #region 内部变量
  36. /// <summary>
  37. /// recipe
  38. /// </summary>
  39. private DepRecipe _recipe;
  40. /// <summary>
  41. /// 单面
  42. /// </summary>
  43. private string _side;
  44. /// <summary>
  45. /// Metal设备
  46. /// </summary>
  47. private StandardHotMetalDevice _device;
  48. /// <summary>
  49. /// RunRecipe routine
  50. /// </summary>
  51. private ReservoirRunRecipeRoutine _runRecipeRoutine;
  52. #endregion
  53. #region 属性
  54. /// <summary>
  55. /// A面电量
  56. /// </summary>
  57. public double AnodeAUsage { get { return _runRecipeRoutine.AnodeAUsage; } }
  58. /// <summary>
  59. /// B面电量
  60. /// </summary>
  61. public double AnodeBUsage { get { return _runRecipeRoutine.AnodeBUsage; } }
  62. /// <summary>
  63. /// LotTrack数据
  64. /// </summary>
  65. public List<MetalLotTrackData> MetalLotTrackDatas { get { return _runRecipeRoutine.MetalLotTrackDatas; } }
  66. /// <summary>
  67. /// LotTrack文件头数据
  68. /// </summary>
  69. public LotTrackFileHeaderCommonData MetalLotTrackHeaderDatas { get { return _runRecipeRoutine.MetalLotTrackHeaderDatas; } }
  70. #endregion
  71. /// <summary>
  72. /// 构造函数
  73. /// </summary>
  74. /// <param name="module"></param>
  75. public StandardHotRunRecipeRoutine(string module) : base(module)
  76. {
  77. _runRecipeRoutine = new ReservoirRunRecipeRoutine(module);
  78. }
  79. /// <summary>
  80. /// 中止
  81. /// </summary>
  82. public void Abort()
  83. {
  84. _runRecipeRoutine.Abort();
  85. Runner.Stop("Manual Abort");
  86. }
  87. /// <summary>
  88. /// 监控
  89. /// </summary>
  90. /// <returns></returns>
  91. public RState Monitor()
  92. {
  93. Runner.Run(RecipeStep.WaferHolderClampOn, () => _device.WaferHolderClampOn("", null), () => _device.MetalDeviceData.WaferHolderClamp, _delay_1s)
  94. .Run(RecipeStep.RunRecipe, () => _runRecipeRoutine.Start(new object[] { _recipe, _side }) == RState.Running, _delay_1ms)
  95. .WaitWithStopCondition(RecipeStep.RunRecipeWait, () => CommonFunction.CheckRoutineEndState(_runRecipeRoutine), CheckRunRecipeStopStatus, ALL_DAY_MILLOSECONDS)
  96. .Run(RecipeStep.WaferHolderUnclampOn, () => _device.WaferHolderClampOff("", null), () => !_device.MetalDeviceData.WaferHolderClamp, _delay_1s)
  97. .End(RecipeStep.End, NullFun, _delay_1ms);
  98. return Runner.Status;
  99. }
  100. /// <summary>
  101. /// 启动
  102. /// </summary>
  103. /// <param name="objs"></param>
  104. /// <returns></returns>
  105. public RState Start(params object[] objs)
  106. {
  107. _recipe = (DepRecipe)objs[0];
  108. if (objs.Length > 1)
  109. {
  110. _side = objs[1].ToString();
  111. }
  112. _device = DEVICE.GetDevice<StandardHotMetalDevice>(Module);
  113. if (!CheckPreCondition())
  114. {
  115. return RState.Failed;
  116. }
  117. return Runner.Start(Module, "Start run recipe");
  118. }
  119. /// <summary>
  120. /// 检验前置条件
  121. /// </summary>
  122. /// <returns></returns>
  123. private bool CheckPreCondition()
  124. {
  125. if (_recipe == null)
  126. {
  127. LOG.WriteLog(eEvent.ERR_METAL, Module, "Recipe is null");
  128. return false;
  129. }
  130. if (_recipe.CurrentRampProfileSteps.Count == 0)
  131. {
  132. LOG.WriteLog(eEvent.ERR_METAL, Module, "Recipe RampProfileSteps count is 0");
  133. return false;
  134. }
  135. return true;
  136. }
  137. /// <summary>
  138. /// RunRecipe停止状态
  139. /// </summary>
  140. /// <returns></returns>
  141. public bool CheckRunRecipeStopStatus()
  142. {
  143. bool result = CommonFunction.CheckRoutineStopState(_runRecipeRoutine);
  144. if (result)
  145. {
  146. AddLotTrackData();
  147. if (_device.SideAPowerSupplier != null)
  148. {
  149. _device.SideAPowerSupplier.DisableOperation("", null);
  150. }
  151. if (_device.SideBPowerSupplier != null)
  152. {
  153. _device.SideBPowerSupplier.DisableOperation("", null);
  154. }
  155. }
  156. return result;
  157. }
  158. /// <summary>
  159. /// 获取Lot Track数据
  160. /// </summary>
  161. /// <returns></returns>
  162. public void AddLotTrackData()
  163. {
  164. _runRecipeRoutine.AddLotTrackData();
  165. }
  166. }
  167. }