| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180 |
- using Aitex.Core.RT.Routine;
- using MECF.Framework.Common.Equipment;
- using System;
- using Aitex.Core.RT.SCCore;
- using FurnaceRT.Equipments.PMs.Routines;
- using System.Collections.Generic;
- using FurnaceRT.Equipments.Systems;
- using Aitex.Core.Util;
- using MECF.Framework.Common.SubstrateTrackings;
- using System.Linq;
- using Aitex.Core.Common;
- using MECF.Framework.Common.CommonData.EnumData;
- using MECF.Framework.Common.DataCenter;
- using MECF.Framework.Common.Utilities;
- using Aitex.Core.RT.Log;
- using Aitex.Sorter.Common;
- namespace FurnaceRT.Equipments.PMs.RecipeExecutions
- {
- public class PreProcess : PMBaseRoutine, IRoutine
- {
- public enum Routine
- {
- ToReadyProcessState,
- Pump,
- PinDown,
- CheckSchedule,
- }
- private string _recipeName;
- private int _checkTimeOut = 3600;
- private bool _isProcessRecipe;
- private bool _isJobAutoStart;
- public PreProcess(ModuleName module, PMModule pm) : base(module, pm)
- {
- Module = module.ToString();
- Name = "PreProcess";
- }
- public void Init(string recipeName, bool isProcessRecipe = true, bool IsJobAutoStart = false)
- {
- _recipeName = recipeName;
- _isProcessRecipe = isProcessRecipe;
- _isJobAutoStart = IsJobAutoStart;
- }
- private List<RecipeStep> _recipeSteps;
- public override Result Start(params object[] objs)
- {
- RecipeHead recipeHead;
- Dictionary<int, List<RecipeStep>> abortRecipe;
- Dictionary<int, string> abortRecipeName;
- Dictionary<int, List<RecipeStep>> subRecipe;
- Dictionary<int, string> subRecipeName;
- string reason = string.Empty;
- if (_isProcessRecipe)
- {
- if (!RecipeParser.Parse(_recipeName, Module, out recipeHead, out _recipeSteps, out reason, "Process"))
- {
- PMModule.PreprocessStartFailedWarning.Set($"Load process recipe {_recipeName} failed, {reason}");
- return Result.FAIL;
- }
- PMModule.RecipeRunningInfo.MainRecipeName = _recipeName;
- PMModule.RecipeRunningInfo.Head = recipeHead;
- PMModule.RecipeRunningInfo.IsProcessRecipe = _isProcessRecipe;
- PMModule.RecipeRunningInfo.IsJobAutoStart = _isJobAutoStart;
- PMModule.RecipeRunningInfo.RecipeStepList = _recipeSteps;
- PMModule.RecipeRunningInfo.ExecRecipeType = _recipeSteps.Count > 0 ? _recipeSteps[0].RecipeType : string.Empty;
- }
- Reset();
- Notify($"Start");
- return Result.RUN;
- }
- public override Result Monitor()
- {
- try
- {
- CheckSchedule((int)Routine.CheckSchedule, PMModule, _checkTimeOut);
- //ExecuteRoutine((int)Routine.Pump, _pumpRoutine);
- //MovePinDown((int)Routine.PinDown, PMModule, _liftTimeout);
- }
- catch (RoutineBreakException)
- {
- return Result.RUN;
- }
- catch (RoutineFaildException)
- {
- return Result.FAIL;
- }
- Singleton<EquipmentManager>.Instance.SetPJState();
- return Result.DONE;
- }
- public void CheckSchedule(int id, PMModule pm, int timeout)
- {
- Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
- {
- Notify($"prepare chamber {pm.Name} CheckSchedule");
- pm.GetAllDBRecord();
- string reason = "";
- return true;
- }, () =>
- {
- if (_isJobAutoStart|| !_isProcessRecipe)
- return true;
-
- pm.CheckBoatRecipeThicknessMoreThan(out var boatRecipeThicknessIsPause, out string boatRecipeThicknessJobName, false);
- if (boatRecipeThicknessIsPause)
- return false;
- pm.CheckRecipeThicknessMoreThan(_recipeName, out var isPause, out string jobName, false);
- if (isPause)
- return false;
- pm.CheckRecipeExecuteFreqMoreThan(_recipeName, out var isPause1, out string jobName1, false);
- if (isPause1)
- return false;
- foreach (var item in _recipeSteps)
- {
- pm.CheckRecipeStepFreqMoreThan(item.StepName, out var isPause2, out string jobName2, false);
- if (isPause2)
- return false;
- pm.CheckRecipeStepTimeMoreThan(item.StepName, out var isPause3, out string jobName3, false);
- if (isPause3)
- return false;
- pm.CheckRecipeStepGroupThicknessMoreThan(item.StepName, out var isPause4, out string jobName4, false);
- if (isPause4)
- return false;
- }
- return true;
- }, timeout * 1000);
- if (ret.Item1)
- {
- if (ret.Item2 == Result.FAIL)
- {
- throw (new RoutineFaildException());
- }
- else if (ret.Item2 == Result.TIMEOUT) //timeout
- {
- Stop($"{pm.Name} prepare process timeout, over {timeout} seconds");
- throw (new RoutineFaildException());
- }
- else
- {
- throw (new RoutineBreakException());
- }
- }
- }
- public override void Abort()
- {
- }
- }
- }
|