123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- using Aitex.Common.Util;
- using Aitex.Core.Common;
- using Aitex.Core.RT.Log;
- using Aitex.Core.Util;
- using CyberX8_Core;
- using CyberX8_RT.Modules;
- using CyberX8_RT.Modules.Rinse;
- using CyberX8_RT.Modules.SRD;
- using MECF.Framework.Common.Equipment;
- using MECF.Framework.Common.RecipeCenter;
- using MECF.Framework.Common.SubstrateTrackings;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace CyberX8_RT.Schedulers.Srd
- {
- public class SchedulerSrd : SchedulerModule
- {
- #region 内部变量
- private SRDEntity _srdEntity;
- private bool _isStartRunRecipe = false;
- #endregion
- #region 属性
- /// <summary>
- /// 是否空闲
- /// </summary>
- public override bool IsIdle
- {
- get { return _state == RState.End; }
- }
- /// <summary>
- /// 是否错误
- /// </summary>
- public override bool IsError
- {
- get { return _state == RState.Failed || _state == RState.Timeout; }
- }
- #endregion
- /// <summary>
- /// 构造函数
- /// </summary>
- /// <param name="moduleName"></param>
- public SchedulerSrd(ModuleName moduleName) : base(moduleName.ToString())
- {
- _srdEntity = Singleton<RouteManager>.Instance.GetModule<SRDEntity>(moduleName.ToString());
- }
- /// <summary>
- /// 执行
- /// </summary>
- /// <param name="parameter"></param>
- /// <returns></returns>
- public override bool RunProcess(object recipe, object parameter, List<SchedulerSyncModuleMessage> syncModuleMessages)
- {
- if (!(recipe is SrdRecipe))
- {
- _state = RState.Failed;
- LOG.WriteLog(eEvent.ERR_SRD, Module.ToString(), "recipe is invalid");
- return false;
- }
- _isStartRunRecipe = false;
- SrdRecipe srdRecipe = (SrdRecipe)recipe;
- bool result = _srdEntity.CheckToPostMessage<SRDState, SRDMSG>(eEvent.WARN_SRD, Module.ToString(), (int)SRDMSG.ProcessRecipe, srdRecipe, 1);
- if (result)
- {
- _state = RState.Running;
- }
- return result;
- }
- /// <summary>
- /// 监控执行
- /// </summary>
- /// <returns></returns>
- public override bool MonitorProcess(SchedulerSequence schedulerSequence,bool hasMatchWafer)
- {
- if (!_isStartRunRecipe)
- {
- _isStartRunRecipe = _srdEntity.State == (int)SRDState.ProcessReciping;
- }
- if (_isStartRunRecipe && _srdEntity.IsIdle)
- {
- _state = RState.End;
- _isStartRunRecipe = false;
- }
- return true;
- }
- /// <summary>
- /// 检验前置条件
- /// </summary>
- /// <param name="sequenceIndex"></param>
- /// <param name="parameter"></param>
- /// <returns></returns>
- public override bool CheckPrecondition(List<SchedulerSequence> schedulerSequences, int sequenceIndex, object parameter, string materialId,ref string reason)
- {
- if (_state == RState.Running)
- {
- reason = "scheduler module is already running";
- return false;
- }
- if (_srdEntity.IsBusy)
- {
- reason = $"{_srdEntity.Module} is busy";
- return false;
- }
- if(WaferManager.Instance.CheckNoWafer(Module,0))
- {
- reason = $"{_srdEntity.Module} has no wafer";
- return false;
- }
- return true;
- }
- }
- }
|