| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221 | 
							- using Aitex.Core.RT.Device;
 
- using Aitex.Core.RT.Log;
 
- using Aitex.Core.RT.Routine;
 
- using Aitex.Core.Util;
 
- using CyberX8_Core;
 
- using CyberX8_RT.Devices.Metal;
 
- using CyberX8_RT.Modules.Metal;
 
- using MECF.Framework.Common.CommonData;
 
- using MECF.Framework.Common.CommonData.Metal;
 
- using MECF.Framework.Common.CommonData.PowerSupplier;
 
- using MECF.Framework.Common.CommonData.SRD;
 
- using MECF.Framework.Common.Device.PowerSupplier;
 
- using MECF.Framework.Common.RecipeCenter;
 
- using MECF.Framework.Common.Routine;
 
- using MECF.Framework.Common.Utilities;
 
- using System;
 
- using System.Collections.Generic;
 
- using System.Linq;
 
- using System.Text;
 
- using System.Threading.Tasks;
 
- namespace CyberX8_RT.Modules.Metal
 
- {
 
-     public class StandardHotRunRecipeRoutine : RoutineBase, IRoutine
 
-     {
 
-         private enum RecipeStep
 
-         {
 
-             LoopStart,
 
-             WaferHolderClampOn,
 
-             RunRecipe,
 
-             RunRecipeWait,
 
-             WaferHolderUnclampOn,
 
-             LoopDelay,
 
-             LoopEnd,
 
-             End
 
-         }
 
-         #region 常量 
 
-         private const int ALL_DAY_MILLOSECONDS = 24 * 60 * 60 * 1000;
 
-         #endregion
 
-         #region 内部变量
 
-         /// <summary>
 
-         /// recipe
 
-         /// </summary>
 
-         private DepRecipe _recipe;
 
-         /// <summary>
 
-         /// cycle次数
 
-         /// </summary>
 
-         private int _cycle;
 
-         /// <summary>
 
-         /// 当前完成的Cycle次数
 
-         /// </summary>
 
-         private int _currentCycle;
 
-         /// <summary>
 
-         /// 单面
 
-         /// </summary>
 
-         private string _side;
 
-         /// <summary>
 
-         /// Metal设备
 
-         /// </summary>
 
-         private StandardHotMetalDevice _device;
 
-         /// <summary>
 
-         /// RunRecipe routine
 
-         /// </summary>
 
-         private ReservoirRunRecipeRoutine _runRecipeRoutine;
 
-         #endregion
 
-         #region 属性
 
-         /// <summary>
 
-         /// A面电量
 
-         /// </summary>
 
-         public double AnodeAUsage { get { return _runRecipeRoutine.AnodeAUsage; } }
 
-         /// <summary>
 
-         /// B面电量
 
-         /// </summary>
 
-         public double AnodeBUsage { get { return _runRecipeRoutine.AnodeBUsage; } }
 
-         /// <summary>
 
-         /// LotTrack数据
 
-         /// </summary>
 
-         public List<MetalLotTrackData> MetalLotTrackDatas { get { return _runRecipeRoutine.MetalLotTrackDatas; } }
 
-         /// <summary>
 
-         /// LotTrack文件头数据
 
-         /// </summary>
 
-         public LotTrackFileHeaderCommonData MetalLotTrackHeaderDatas { get { return _runRecipeRoutine.MetalLotTrackHeaderDatas; } }
 
-         #endregion
 
-         /// <summary>
 
-         /// 构造函数
 
-         /// </summary>
 
-         /// <param name="module"></param>
 
-         public StandardHotRunRecipeRoutine(string module) : base(module)
 
-         {
 
-             _runRecipeRoutine = new ReservoirRunRecipeRoutine(module);
 
-         }
 
-         /// <summary>
 
-         /// 中止
 
-         /// </summary>
 
-         public void Abort()
 
-         {
 
-             _runRecipeRoutine.Abort();
 
-             Runner.Stop("Manual Abort");
 
-         }
 
-         /// <summary>
 
-         /// 监控
 
-         /// </summary>
 
-         /// <returns></returns>
 
-         public RState Monitor()
 
-         {
 
-             Runner.LoopStart(RecipeStep.LoopStart, "Loop Start Cycle StandardHotRunRecipeRoutine", _cycle, NullFun, _delay_1ms)
 
-                 .LoopRun(RecipeStep.WaferHolderClampOn, () => _device.WaferHolderClampOn("", null), () => _device.MetalDeviceData.WaferHolderClamp, _delay_1s)
 
-                 .LoopRun(RecipeStep.RunRecipe, () => _runRecipeRoutine.Start(new object[] { _recipe, _side }) == RState.Running, _delay_1ms)
 
-                 .LoopRunWithStopStatus(RecipeStep.RunRecipeWait, () => CommonFunction.CheckRoutineEndState(_runRecipeRoutine), CheckRunRecipeStopStatus, ALL_DAY_MILLOSECONDS)
 
-                 .LoopRun(RecipeStep.WaferHolderUnclampOn, () => _device.WaferHolderClampOff("", null), () => !_device.MetalDeviceData.WaferHolderClamp, _delay_1s)
 
-                 .LoopRunIf(RecipeStep.LoopDelay, _cycle > 1, NullFun, _delay_5s)
 
-                 .LoopEnd(RecipeStep.LoopEnd, UpdateCycleCount, _delay_1ms)
 
-                 .End(RecipeStep.End, NullFun, _delay_1ms);
 
-             return Runner.Status;
 
-         }
 
-         /// <summary>
 
-         /// 统计完成的Cycle次数
 
-         /// </summary>
 
-         /// <returns></returns>
 
-         private bool UpdateCycleCount()
 
-         {
 
-             _currentCycle += 1;
 
-             return true;
 
-         }
 
-         /// <summary>
 
-         /// 获取当前Cycle次数
 
-         /// </summary>
 
-         /// <returns></returns>
 
-         public int GetCurrentCycle()
 
-         {
 
-             return _currentCycle;
 
-         }
 
-         /// <summary>
 
-         /// 启动
 
-         /// </summary>
 
-         /// <param name="objs"></param>
 
-         /// <returns></returns>
 
-         public RState Start(params object[] objs)
 
-         {
 
-             _recipe = (DepRecipe)objs[0];
 
-             if (objs.Length > 1)
 
-             {
 
-                 _side = objs[1].ToString();
 
-             }
 
-             if (objs.Length > 2)
 
-             {
 
-                 _cycle = (int)objs[2];
 
-             }
 
-             _device = DEVICE.GetDevice<StandardHotMetalDevice>(Module);
 
-             if (!CheckPreCondition())
 
-             {
 
-                 return RState.Failed;
 
-             }
 
-             _currentCycle = 0;
 
-             _runRecipeRoutine.clearLotTrack();//清除loaTrack里面的历史数据
 
-             _runRecipeRoutine.resetMetalUsage();//清除usage历史数据
 
-             return Runner.Start(Module, "Start run recipe");
 
-         }
 
-         /// <summary>
 
-         /// 检验前置条件
 
-         /// </summary>
 
-         /// <returns></returns>
 
-         private bool CheckPreCondition()
 
-         {
 
-             if (_recipe == null)
 
-             {
 
-                 LOG.WriteLog(eEvent.ERR_METAL, Module, "Recipe is null");
 
-                 return false;
 
-             }
 
-             if (_recipe.CurrentRampProfileSteps.Count == 0)
 
-             {
 
-                 LOG.WriteLog(eEvent.ERR_METAL, Module, "Recipe RampProfileSteps count is 0");
 
-                 return false;
 
-             }
 
-             //MetalEntity metalEntity = Singleton<RouteManager>.Instance.GetModule<MetalEntity>(Module);
 
-             //if (metalEntity != null && metalEntity.WaferHolderInfo == null)
 
-             //{
 
-             //    LOG.WriteLog(eEvent.ERR_METAL, Module, $"there is no waferShuttle in {Module}");
 
-             //    return false;
 
-             //}
 
-             return true;
 
-         }
 
-         /// <summary>
 
-         /// RunRecipe停止状态
 
-         /// </summary>
 
-         /// <returns></returns>
 
-         public bool CheckRunRecipeStopStatus()
 
-         {
 
-             bool result = CommonFunction.CheckRoutineStopState(_runRecipeRoutine);
 
-             if (result)
 
-             {
 
-                 AddLotTrackData();
 
-                 if (_device.SideAPowerSupplier != null)
 
-                 {
 
-                     _device.SideAPowerSupplier.DisableOperation("", null);
 
-                 }
 
-                 if (_device.SideBPowerSupplier != null)
 
-                 {
 
-                     _device.SideBPowerSupplier.DisableOperation("", null);
 
-                 }
 
-             }
 
-             return result;
 
-         }
 
-         /// <summary>
 
-         /// 获取Lot Track数据
 
-         /// </summary>
 
-         /// <returns></returns>
 
-         public void AddLotTrackData()
 
-         {
 
-             _runRecipeRoutine.AddLotTrackData();
 
-         }
 
-     }
 
- }
 
 
  |