| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515 | 
							- using System;
 
- using System.Collections.Generic;
 
- using System.Diagnostics;
 
- using System.Linq;
 
- using Aitex.Core.Common;
 
- using Aitex.Core.RT.DataCenter;
 
- using Aitex.Core.RT.Device;
 
- using Aitex.Core.RT.Device.Unit;
 
- using Aitex.Core.RT.Event;
 
- using Aitex.Core.RT.Fsm;
 
- using Aitex.Core.RT.OperationCenter;
 
- using Aitex.Core.RT.Routine;
 
- using Aitex.Core.RT.SCCore;
 
- using Aitex.Core.Util;
 
- using Aitex.Core.Utilities;
 
- using Aitex.Sorter.Common;
 
- using MECF.Framework.Common.Alarms;
 
- using MECF.Framework.Common.DataCenter;
 
- using MECF.Framework.Common.Equipment;
 
- using MECF.Framework.Common.Schedulers;
 
- using MECF.Framework.Common.SubstrateTrackings;
 
- using FurnaceRT.Equipments.PMs.RecipeExecutions;
 
- using FurnaceRT.Equipments.PMs.Routines;
 
- using FurnaceRT.Equipments.Systems;
 
- using Process = FurnaceRT.Equipments.PMs.RecipeExecutions.Process;
 
- using Aitex.Core.Common.DeviceData;
 
- using FurnaceRT.Devices;
 
- using FurnaceRT.Modules.PMs;
 
- using MECF.Framework.Common.Device.Bases;
 
- using Aitex.Core.RT.Log;
 
- using FurnaceRT.Equipments.Boats;
 
- using MECF.Framework.Common.Event;
 
- namespace FurnaceRT.Equipments.PMs
 
- {
 
-     public partial class PMModule : PMModuleBase, IRecipeExecutor
 
-     {
 
-         public enum STATE
 
-         {
 
-             NotInstall,
 
-             NotConnected,
 
-             Init,
 
-             Idle,
 
-             Homing,
 
-             OpenSlitValve,
 
-             CloseSlitValve,
 
-             Error,
 
-             PrepareTransfer,
 
-             PostTransfer,
 
-             PreProcess,
 
-             PostProcess,
 
-             Process,
 
-             LeakCheck,
 
-             MFCCali,
 
-             Paused,
 
-             InTransfer,
 
-         }
 
-         public enum MSG
 
-         {
 
-             Home,
 
-             Connected,
 
-             Disconnected,
 
-             Transfer,
 
-             PrepareTransfer,
 
-             PostTransfer,
 
-             Reset,
 
-             Abort,
 
-             Error,
 
-             EndIdleRecipe,
 
-             OpenSlitValve,
 
-             CloseSlitValve,
 
-             SelectRecipe,
 
-             RunRecipe,
 
-             RunIdleRecipe,
 
-             RunOtherRecipe,
 
-             RecipeSkipStep,
 
-             RecipeJumpStep,
 
-             RecipePause,
 
-             RecipeContinue,
 
-             RecipeAbort,
 
-             Continue,
 
-             SetOnline,
 
-             SetOffline,
 
-             PostProcess,
 
-             Process,
 
-             AlarmConditionJumpStep,
 
-             LeakCheck,
 
-             ToInit,
 
-             StartMFCCalibration,
 
-         }
 
-         public enum ProcessFlowState
 
-         {
 
-             None,
 
-             Idle,
 
-             Standby,
 
-             Ready,
 
-             Run,
 
-             End,
 
-             Abort,
 
-         }
 
-         public override bool IsInit
 
-         {
 
-             get { return FsmState == (int)STATE.Init; }
 
-         }
 
-         public bool IsBusy
 
-         {
 
-             get { return !IsInit && !IsError && !IsReady; }
 
-         }
 
-         public bool IsProcessing
 
-         {
 
-             get { return FsmState == (int)STATE.Process; }
 
-         }
 
-         public override bool IsReady
 
-         {
 
-             get { return FsmState == (int)STATE.Idle && CheckAllMessageProcessed(); }
 
-         }
 
-         public override bool IsError
 
-         {
 
-             get
 
-             {
 
-                 return _alarmNumber != 0;
 
-             }
 
-         }
 
-         public event Action<string> OnEnterError;
 
-         private PMHomeRoutine _homeRoutine;
 
-         private PMLeakCheckRoutine _leakCheckRoutine;
 
-         private PreProcess _preprocessRoutine;
 
-         private Process _processRoutine;
 
-         private PostProcess _postprocessRoutine;
 
-         private PMPrepareTransferRoutine _prepareTransferRoutine;
 
-         private PMPostTransferRoutine _postTransferRoutine;
 
-         private ModuleName _module;
 
-         private RecipeRunningInfo _recipeRunningInfo = new RecipeRunningInfo();
 
-         private bool _isInit = true;
 
-         private bool _isPrepareProcess = true;
 
-         private bool _isStandbyStep;
 
-         private StatsData _statTubeCleanNumber;
 
-         private StatsData _statTubeCleanTime;
 
-         private StatsData _statTubeCleanThick;
 
-         private StatsData _statBoatCleanNumber;
 
-         private StatsData _statBoatCleanTime;
 
-         private StatsData _statBoatCleanThick;
 
-         private StatsData _statForkCleanNumber;
 
-         private StatsData _statForkCleanTime;
 
-         private StatsData _statForkCleanThick;
 
-         private Stopwatch _processTimer = new Stopwatch();
 
-         public List<IoValve> ValveLists = new List<IoValve>();
 
-         public List<IoFlowMeter> FlowmeterLists = new List<IoFlowMeter>();
 
-         private bool _isExternalSensorConditionBypass;
 
-         private bool _isTempStabilizeConditionBypass;
 
-         private bool _isPressureStabilizeConditionBypass;
 
-         private bool _isReachTempConditionBypass;
 
-         private bool _isReachPressureConditionBypass;
 
-         private bool _isFinishAutoProfileConditionBypass;
 
-         private SerializableDictionary<string, bool> _conditionCheckDic = new SerializableDictionary<string, bool>();
 
-         private Dictionary<string, string> _conditionCheckItemDic = new Dictionary<string, string>();
 
-         private Stopwatch _waitTimer = new Stopwatch();
 
-         public string StringProcessFlowState { get; set; }
 
-         public bool IsExcuteRoutineFailed { get; set; }
 
-         public bool IsJobProcess { get; private set; }
 
-         public string EditRecipeName { get; set; } = string.Empty;
 
-         public string EditRecipeStepName { get; set; } = string.Empty;
 
-         public bool IsExcuteIdleRecipe { get; set; }
 
-         public string ToolType { get; set; }
 
-         public PMModule(ModuleName module) : base(SC.GetValue<int>($"Boat.SlotCount"))
 
-         {
 
-             _module = module;
 
-             Module = module.ToString();
 
-             Name = module.ToString();
 
-             EnumLoop<STATE>.ForEach((item) =>
 
-             {
 
-                 MapState((int)item, item.ToString());
 
-             });
 
-             EnumLoop<MSG>.ForEach((item) =>
 
-             {
 
-                 MapMessage((int)item, item.ToString());
 
-             });
 
-             EnableFsm(1, STATE.Idle);
 
-         }
 
-         public override bool Initialize()
 
-         {
 
-             IsOnline = true;
 
-             InitRoutine();
 
-             InitDevice();
 
-             InitAUX();
 
-             InitInterlock();
 
-             InitFsm();
 
-             InitOp();
 
-             InitData();
 
-             InitLeakCheckData();
 
-             InitStats();
 
-             InitAlarmEvent();
 
-             InitAlarmConditionChecker();
 
-             InitScheduleMaintenance();
 
-             Singleton<EventManager>.Instance.OnAlarmEvent += Instance_OnAlarmEvent;
 
-             ToolType = SC.GetStringValue("System.SetUp.ToolType");
 
-             return base.Initialize();
 
-         }
 
-         private void Instance_OnAlarmEvent(EventItem item)
 
-         {
 
-             if (item != null && item.Level == EventLevel.Alarm && (item.Source == Name || item.Source == Module))
 
-             {
 
-                 var alarm = item as AlarmEventItem;
 
-                 DEVICE.GetDevice<SignalTowerBase>("System.SignalTower")?.Reset();
 
-                 LOG.Write($"{item.Source} {item.EventEnum} {item.Description}\n");
 
-                 //PostMsg(MSG.Error);
 
-             }
 
-         }
 
-         private void InitRoutine()
 
-         {
 
-             _homeRoutine = new PMHomeRoutine(ModuleHelper.Converter(Module), this);
 
-             _leakCheckRoutine = new PMLeakCheckRoutine(ModuleHelper.Converter(Module), this);
 
-             _preprocessRoutine = new PreProcess(ModuleHelper.Converter(Module), this);
 
-             _processRoutine = new Process(ModuleHelper.Converter(Module), this);
 
-             _postprocessRoutine = new PostProcess(ModuleHelper.Converter(Module), this);
 
-             _prepareTransferRoutine = new PMPrepareTransferRoutine(Module, this);
 
-             _postTransferRoutine = new PMPostTransferRoutine(Module, this);
 
-         }
 
-         private void InitData()
 
-         {
 
-             DATA.Subscribe($"{Module}.IsError", () => IsError);
 
-             DATA.Subscribe($"{Module}.Status", () => StringFsmStatus);
 
-             DATA.Subscribe($"{Module}.IsOnline", () => IsOnline);
 
-             DATA.Subscribe($"{Module}.IsProcessing", () => IsProcessing);
 
-             //DATA.Subscribe($"{Module}.WaferSize", () => WaferManager.Instance.GetWaferSize(_module, 0).ToString());
 
-             DATA.Subscribe($"{Module}.IsInMaintainMode", () => !IsOnline);
 
-             //DATA.Subscribe($"{Name}.LeakCheckElapseTime", () =>
 
-             //{
 
-             //    if (FsmState == (int)STATE.LeakCheck)
 
-             //        return _leakCheckRoutine.ElapsedTime;
 
-             //    return 0;
 
-             //});
 
-             DATA.Subscribe($"{Name}.ChamberPressure", () => ChamberPressure);
 
-             //DATA.Subscribe($"{Name}.VAC1", () => _vac1);
 
-             //DATA.Subscribe($"{Name}.VAC2", () => _vac2);
 
-             //DATA.Subscribe($"{Name}.VAC3", () => _vac3);
 
-             DATA.Subscribe($"{Name}.MainRecipeName", () => _recipeRunningInfo.MainRecipeName);
 
-             DATA.Subscribe($"{Name}.SelectedRecipeName", () => _recipeRunningInfo.RecipeName);
 
-             DATA.Subscribe($"{Name}.ProcessSubRecipe", () => _recipeRunningInfo.SubRecipeName);
 
-             DATA.Subscribe($"{Name}.ProcessAbortRecipe", () => _recipeRunningInfo.AbortRecipeName);
 
-             DATA.Subscribe($"{Name}.AbortRecipeName", () => _recipeRunningInfo.RecipeName);
 
-             DATA.Subscribe($"{Name}.SubRecipeCurrentLoopCount", () => _recipeRunningInfo.SubRecipeCurrentLoopCount);
 
-             DATA.Subscribe($"{Name}.SubRecipeLoopCount", () => _recipeRunningInfo.SubRecipeLoopCount);
 
-             DATA.Subscribe($"{Name}.IsExecuteSubRecipe", () => _processRoutine.IsSubReciep);
 
-             DATA.Subscribe($"{Name}.RecipeBeginTime", () => _recipeRunningInfo.BeginTime);
 
-             DATA.Subscribe($"{Name}.RecipeStepNumber", () => _recipeRunningInfo.StepNumber);
 
-             DATA.Subscribe($"{Name}.RecipeNextStepName", () => _recipeRunningInfo.NextStepName);
 
-             DATA.Subscribe($"{Name}.RecipeStepName", () => _recipeRunningInfo.StepName);
 
-             DATA.Subscribe($"{Name}.RecipeStepElapseTime", () => _recipeRunningInfo.StepElapseTime);
 
-             DATA.Subscribe($"{Name}.RecipeStepTime", () => _recipeRunningInfo.StepTime);
 
-             DATA.Subscribe($"{Name}.RecipeTotalElapseTime", () => _recipeRunningInfo.TotalElapseTime);
 
-             DATA.Subscribe($"{Name}.RecipeTotalTime", () => _recipeRunningInfo.TotalTime);
 
-             DATA.Subscribe($"{Name}.RecipeHoldTime", () => _recipeRunningInfo.HoldTime);
 
-             DATA.Subscribe($"{Name}.RecipeHold", () => IsPaused);//按了hold按键
 
-             DATA.Subscribe($"{Name}.RecipeHolded", () => IsHolded);//按了hold按键之后,当前step执行完了
 
-             DATA.Subscribe($"{Name}.RecipeWait", () => IsWait);//等待wait条件的结束
 
-             DATA.Subscribe($"{Name}.NewShowTime", () => GetNewShowTime());
 
-             DATA.Subscribe($"{Name}.ExecRecipeType", () => _recipeRunningInfo.ExecRecipeType);
 
-             DATA.Subscribe($"{Name}.LoopCountSet", () => _recipeRunningInfo.LoopCountSet);
 
-             DATA.Subscribe($"{Name}.LoopCountCurrent", () => _recipeRunningInfo.LoopCountCurrent);
 
-             DATA.Subscribe($"{Name}.IsLooping", () => _recipeRunningInfo.IsLooping);
 
-             DATA.Subscribe("ProcessFlow.Status", () => StringProcessFlowState);
 
-             DATA.Subscribe($"{Name}.ConditionCheck", () => _conditionCheckDic);
 
-             //DATA.Subscribe($"{Name}.LZoneHeaterData", () => Heater2.DeviceData.IsLspModeFeedBack ? Heater2.DeviceData : Heater1.DeviceData);
 
-             //DATA.Subscribe($"{Name}.CLZoneHeaterData", () => Heater4.DeviceData.IsLspModeFeedBack ? Heater4.DeviceData : Heater3.DeviceData);
 
-             //DATA.Subscribe($"{Name}.CZoneHeaterData", () => Heater6.DeviceData.IsLspModeFeedBack ? Heater6.DeviceData : Heater5.DeviceData);
 
-             //DATA.Subscribe($"{Name}.CUZoneHeaterData", () => Heater8.DeviceData.IsLspModeFeedBack ? Heater8.DeviceData : Heater7.DeviceData);
 
-             //DATA.Subscribe($"{Name}.UZoneHeaterData", () => Heater10.DeviceData.IsLspModeFeedBack ? Heater10.DeviceData : Heater9.DeviceData);
 
-             SensorRecipeOK = new AITSensorData()
 
-             {
 
-                 DeviceName = "SensorRecipeOK",
 
-                 DeviceSchematicId = "SensorRecipe",
 
-                 DisplayName = "SensorRecipe",
 
-                 Value = false,
 
-             };
 
-             DATA.Subscribe($"{Module}.{SensorRecipeOK.DeviceName}", () => SensorRecipeOK);
 
-             SensorPROCManualOK = new AITSensorData()
 
-             {
 
-                 DeviceName = "SensorPROCManualOK",
 
-                 DeviceSchematicId = "PROCManual",
 
-                 DisplayName = "PROCManual",
 
-                 Value = false,
 
-             };
 
-             DATA.Subscribe($"{Module}.{SensorPROCManualOK.DeviceName}", () => SensorPROCManualOK);
 
-             DATA.Subscribe($"{Module}.EditRecipeName", () => EditRecipeName);
 
-             DATA.Subscribe($"{Module}.EditRecipeStepName", () => EditRecipeStepName);
 
-             DATA.Subscribe($"{Module}.N2PurgeMode", () => _N2PurgeMode.ToString());
 
-             DATA.Subscribe($"{Module}.HTR1Enable", () => IsHTR1Enable);
 
-             DATA.Subscribe($"{Module}.HTR2Enable", () => IsHTR2Enable);
 
-             DATA.Subscribe($"{Module}.HTR3Enable", () => IsHTR3Enable);
 
-             DATA.Subscribe($"{Module}.IsCEXHOn", () => _isCEXHOn);
 
-             DATA.Subscribe($"{Module}.IsF2ClnOn", () =>
 
-             {
 
-                 return IsF2ClnOn;
 
-             });
 
-             DATA.Subscribe($"{Module}.IsHFClnOn", () =>
 
-             {
 
-                 return IsHFClnOn;
 
-             });
 
-             DATA.Subscribe($"{Module}.IsDEPOOn", () => TrigDEPOSW != null ? TrigDEPOSW.Value : false);
 
-             DATA.Subscribe($"{Module}.IsCREFOn", () => TrigCREFON != null ? TrigCREFON.Value : false);
 
-             DATA.Subscribe($"{Module}.IsSIREFOn", () => TrigSIREFON != null ? TrigSIREFON.Value : false);
 
-         }
 
-         private void InitStats()
 
-         {
 
-             _statTubeCleanNumber = new StatsData($"{Module}.Tube Clean Number", "Tube clean number", 0);
 
-             _statTubeCleanTime = new StatsData($"{Module}.Tube Clean Time", "Tube clean time(Min)", 0);
 
-             _statTubeCleanThick = new StatsData($"{Module}.Tube Clean thick", "Tube clean thick(nm)", 0);
 
-             _statBoatCleanNumber = new StatsData($"{Module}.Boat Clean Number", "Boat clean number", 0);
 
-             _statBoatCleanTime = new StatsData($"{Module}.Boat Clean Time", "Boat clean time(Min)", 0);
 
-             _statBoatCleanThick = new StatsData($"{Module}.Boat Clean thick", "Boat clean thick(nm)", 0);
 
-             _statForkCleanNumber = new StatsData($"{Module}.Fork Clean Number", "Fork clean number", 0);
 
-             _statForkCleanTime = new StatsData($"{Module}.Fork Clean Time", "Fork clean time(Min)", 0);
 
-             _statBoatCleanThick = new StatsData($"{Module}.Boat Clean thick", "Boat clean thick(nm)", 0);
 
-             _statForkCleanThick = new StatsData($"{Module}.Fork Clean thick", "Fork clean thick", 0);
 
-         }
 
-         private void InitOp()
 
-         {
 
-             OP.Subscribe($"{Module}.Home", (string cmd, object[] args) =>
 
-             {
 
-                 if (!(Singleton<EquipmentManager>.Instance.Modules[ModuleName.WaferRobot] as IModuleDevice).IsReady)
 
-                 {
 
-                     TubeHomeFailedWarning.Set($"Wafer Robot is not in ilde state, init failed.");
 
-                     return false;
 
-                 }
 
-                 return CheckToPostMessage((int)MSG.Home);
 
-             });
 
-             OP.Subscribe($"{Module}.Reset", (string cmd, object[] args) => CheckToPostMessage((int)MSG.Reset));
 
-             OP.Subscribe($"{Module}.Abort", (string cmd, object[] args) => CheckToPostMessage((int)MSG.Abort));
 
-             OP.Subscribe($"{Module}.PutOnline", (string cmd, object[] args) => CheckToPostMessage((int)MSG.SetOnline));
 
-             OP.Subscribe($"{Module}.PutOffline", (string cmd, object[] args) => CheckToPostMessage((int)MSG.SetOffline));
 
-             OP.Subscribe($"{Name}.SelectRecipe", (string cmd, object[] args) => CheckToPostMessage((int)MSG.SelectRecipe, args[0]));
 
-             OP.Subscribe($"{Name}.RunRecipe", (string cmd, object[] args) => CheckToPostMessage((int)MSG.RunRecipe, (string)args[0]));
 
-             OP.Subscribe($"{Name}.RecipeSkipStep", (string cmd, object[] args) => CheckToPostMessage((int)MSG.RecipeSkipStep));
 
-             OP.Subscribe($"{Name}.RecipeJumpStep", (string cmd, object[] args) => CheckToPostMessage((int)MSG.RecipeJumpStep, args[0], args[1]));
 
-             OP.Subscribe($"{Name}.RecipePause", (string cmd, object[] args) => CheckToPostMessage((int)MSG.RecipePause));
 
-             OP.Subscribe($"{Name}.RecipeContinue", (string cmd, object[] args) => CheckToPostMessage((int)MSG.RecipeContinue));
 
-             OP.Subscribe($"{Name}.RecipeAbort", (string cmd, object[] args) => CheckToPostMessage((int)MSG.RecipeAbort));
 
-             OP.Subscribe($"{Name}.LeakCheck", (string cmd, object[] args) => CheckToPostMessage((int)MSG.LeakCheck, args[0], args[1], args[2], args[3]));
 
-             OP.Subscribe($"{Name}.Wait", (string cmd, object[] args) =>
 
-             {
 
-                 IsWait = !IsWait;
 
-                 return true;
 
-             });
 
-             OP.Subscribe($"{Module}.AlarmAction", (string cmd, object[] args) =>
 
-             {
 
-                 Enum.TryParse(args[0].ToString(), out AlarmAction alarmAction);
 
-                 string eventName = null;
 
-                 if (args.Length > 1)
 
-                     eventName = args[1].ToString();
 
-                 if (eventName != null)
 
-                 {
 
-                     EV.ClearAlarmEvent(eventName);
 
-                     var item = _triggeredAlarmList.FirstOrDefault(x => x.EventEnum == eventName);
 
-                     if (item != null)
 
-                     {
 
-                         item.Reset();
 
-                         _triggeredAlarmList.Remove(item);
 
-                     }
 
-                     if (item != null)
 
-                     {
 
-                         switch (alarmAction)
 
-                         {
 
-                             case AlarmAction.Retry:
 
-                                 {
 
-                                     CheckToPostMessage((int)item.RetryMessage, item.RetryMessageParas);
 
-                                 }
 
-                                 break;
 
-                             case AlarmAction.Abort:
 
-                                 {
 
-                                     CheckToPostMessage((int)MSG.Abort);
 
-                                 }
 
-                                 break;
 
-                             case AlarmAction.Clear:
 
-                                 {
 
-                                     int alarmCount = 0;
 
-                                     var alarms = EV.GetAlarmEvent();
 
-                                     foreach (var alarm in alarms)
 
-                                     {
 
-                                         if (alarm.Level == EventLevel.Alarm && alarm.Source == Name)
 
-                                             alarmCount++;
 
-                                     }
 
-                                     if (alarmCount == 0 && !IsProcessing)
 
-                                     {
 
-                                         CheckToPostMessage((int)MSG.Reset);
 
-                                         _alarmNumber = 0;
 
-                                     }
 
-                                 }
 
-                                 break;
 
-                             case AlarmAction.Continue:
 
-                                 {
 
-                                     int alarmCount = 0;
 
-                                     var alarms = EV.GetAlarmEvent();
 
-                                     foreach (var alarm in alarms)
 
-                                     {
 
-                                         if (alarm.Level == EventLevel.Alarm && alarm.Source == Name)
 
-                                             alarmCount++;
 
-                                     }
 
-                                     if (alarmCount == 0)
 
-                                         CheckToPostMessage((int)MSG.Reset);
 
-                                 }
 
-                                 break;
 
-                             case AlarmAction.ClearAll:
 
-                                 ResetAUXTrig();
 
-                                 break;
 
-                         }
 
-                     }
 
-                 }
 
-                 return true;
 
-             });
 
-             OP.Subscribe($"{Name}.SetConditionCheck", SetConditionCheck);
 
-             OP.Subscribe($"{Name}.SetBoatZAxisMotion", SetBoatZAxisMotion);
 
-             OP.Subscribe($"{Name}.SetBoatRAxisMotion", SetBoatRAxisMotion);
 
-             OP.Subscribe($"{Name}.SetAutoShutterUp", SetAutoShutterUp);
 
-             OP.Subscribe($"{Name}.SetAutoShutterOpen", SetAutoShutterOpen);
 
-             OP.Subscribe($"{Name}.SetAutoShutterRotateOpen", SetAutoShutterRotateOpen);
 
-             OP.Subscribe($"{Name}.BypassStandbyFactor", SeBypassStandbyFactor);
 
-             OP.Subscribe($"{Name}.SetCommand", SetCommand);
 
-             OP.Subscribe($"{Name}.SetN2PurgeMode", SetN2PurgeMode);
 
-             //OP.Subscribe($"{Name}.SetTemperatureDetail",)
 
-             OP.Subscribe($"{Name}.SetSensorRecipeOK", SetSensorRecipeOK);
 
-             OP.Subscribe($"{Name}.SetSensorPROCManualOK", SetSensorPROCManualOK);
 
-             OP.Subscribe($"{Name}.SetEditRecipeName", SetEditRecipeName);
 
-             OP.Subscribe($"{Name}.SetEditRecipeStepName", SetEditRecipeStepName);
 
-             OP.Subscribe($"{Name}.Heater.SetParameters", (out string reason, int time, object[] param) =>
 
-             {
 
-                 reason = string.Empty;
 
-                 //Mode参数;Correct Table;PID Table
 
-                 //"Heater;Parameter\\TempCorrection\\tempCorrect,2,Name2;Parameter\\TempPID\\tempPID,3,Name3"
 
-                 SetHeaterControlParameters(param);
 
-                 return true;
 
-             });
 
-             OP.Subscribe($"{Name}.Heater.SetPID", (out string reason, int time, object[] param) =>
 
-             {
 
-                 reason = string.Empty;
 
-                 SetHeaterPIDParameters(param[0].ToString());
 
-                 return true;
 
-             });
 
-             OP.Subscribe($"{Name}.Heater.SetCorrect", (out string reason, int time, object[] param) =>
 
-             {
 
-                 reason = string.Empty;
 
-                 SetHeaterCorrectParameters(param[0].ToString());
 
-                 return true;
 
-             });
 
-             //Recipe
 
-             OP.Subscribe($"{Name}.SetBoatMotion", (out string reason, int time, object[] param) =>
 
-             {
 
-                 reason = string.Empty;
 
-                 SetBoatMotion(param);
 
-                 return true;
 
-             });
 
-             //Recipe
 
-             OP.Subscribe($"{Name}.SetValves", (out string reason, int time, object[] param) =>
 
-             {
 
-                 reason = string.Empty;
 
-                 SetValves(param);
 
-                 return true;
 
-             });
 
-             //Recipe
 
-             OP.Subscribe($"{Name}.SetAlarmConditionTable", (out string reason, int time, object[] param) =>
 
-             {
 
-                 reason = string.Empty;
 
-                 SetAlarmConditionTable(param);
 
-                 return true;
 
-             });
 
-             //manual
 
-             OP.Subscribe($"{Name}.SetAlarmConditionParameter", (out string reason, int time, object[] param) =>
 
-             {
 
-                 reason = string.Empty;
 
-                 InitAlarmCondition(param[0].ToString());
 
-                 SetAlarmConditionTable(new object[1] { param[1] });
 
-                 return true;
 
-             });
 
-             OP.Subscribe($"{Name}.SetBoatManualMotion", (out string reason, int time, object[] param) =>
 
-             {
 
-                 reason = string.Empty;
 
-                 SetBoatManualMotion(param);
 
-                 return true;
 
-             });
 
-             OP.Subscribe($"{Name}.SetCEXHEnable", (out string reason, int time, object[] param) =>
 
-             {
 
-                 reason = string.Empty;
 
-                 SetCEXHEnable(param);
 
-                 return true;
 
-             });
 
-             OP.Subscribe($"{Name}.SetF2ClnEnable", (out string reason, int time, object[] param) =>
 
-             {
 
-                 reason = string.Empty;
 
-                 SetF2ClnEnable(param);
 
-                 return true;
 
-             });
 
-             OP.Subscribe($"{Name}.SetHFClnEnable", (out string reason, int time, object[] param) =>
 
-             {
 
-                 reason = string.Empty;
 
-                 SetHFClnEnable(param);
 
-                 return true;
 
-             });
 
-             OP.Subscribe($"{Name}.SetDEPOEnable", (out string reason, int time, object[] param) =>
 
-             {
 
-                 reason = string.Empty;
 
-                 SetDEPOEnable(param);
 
-                 return true;
 
-             });
 
-             OP.Subscribe($"{Name}.SetHTR1Enable", (out string reason, int time, object[] param) =>
 
-             {
 
-                 reason = string.Empty;
 
-                 SetHTR1Enable(param);
 
-                 return true;
 
-             });
 
-             OP.Subscribe($"{Name}.SetHTR2Enable", (out string reason, int time, object[] param) =>
 
-             {
 
-                 reason = string.Empty;
 
-                 SetHTR2Enable(param);
 
-                 return true;
 
-             });
 
-             OP.Subscribe($"{Name}.SetHTR3Enable", (out string reason, int time, object[] param) =>
 
-             {
 
-                 reason = string.Empty;
 
-                 SetHTR3Enable(param);
 
-                 return true;
 
-             });
 
-             OP.Subscribe($"{Name}.AUX.SetParameters", (out string reason, int time, object[] param) =>
 
-             {
 
-                 reason = string.Empty;
 
-                 //Mode参数;Correct Table;PID Table
 
-                 //"Heater;Parameter\\TempCorrection\\tempCorrect,2,Name2;Parameter\\TempPID\\tempPID,3,Name3"
 
-                 SetAUXParameters(param);
 
-                 return true;
 
-             });
 
-             OP.Subscribe($"{Module}.SetAllMfcVirtualValue", (out string reason, int time, object[] param) =>
 
-             {
 
-                 reason = string.Empty;
 
-                 var dict = param[0] as Dictionary<string, string>;
 
-                 foreach (var item in dict)
 
-                 {
 
-                     var mfc = _processMFCs.FirstOrDefault(x => x.Name == item.Key);
 
-                     if (mfc != null)
 
-                     {
 
-                         mfc.SetMfcVirtualValue(out reason, 0, new object[] { item.Value });
 
-                     }
 
-                 }
 
-                 return true;
 
-             });
 
-             OP.Subscribe($"{Module}.SetAllMfcValue", (out string reason, int time, object[] param) =>
 
-             {
 
-                 reason = string.Empty;
 
-                 var dict = param[0] as Dictionary<string, string>;
 
-                 foreach (var item in dict)
 
-                 {
 
-                     var mfc = _processMFCs.FirstOrDefault(x => x.Name == item.Key);
 
-                     if (mfc != null)
 
-                     { mfc.SetMfcValue(out reason, 0, new object[] { item.Value }); }
 
-                 }
 
-                 return true;
 
-             });
 
-             OP.Subscribe($"{Module}.SetAllMfcSetPoint", (out string reason, int time, object[] param) =>
 
-             {
 
-                 reason = string.Empty;
 
-                 var dict = param[0] as Dictionary<string, string>;
 
-                 foreach (var item in dict)
 
-                 {
 
-                     var mfc = _processMFCs.FirstOrDefault(x => x.Name == item.Key);
 
-                     if (mfc != null)
 
-                     { mfc.SetMfcSetPoint(out reason, 0, new object[] { item.Value }); }
 
-                 }
 
-                 return true;
 
-             });
 
-             OP.Subscribe($"{Module}.SetAll{AITValveOperation.GVVirtualTurnValve}", (out string reason, int time, object[] param) =>
 
-             {
 
-                 reason = string.Empty;
 
-                 var dict = param[0] as Dictionary<string, bool>;
 
-                 foreach (var item in dict)
 
-                 {
 
-                     var valve = _valves.FirstOrDefault(x => x.Name == item.Key);
 
-                     if (valve != null)
 
-                     {
 
-                         valve.InvokeOpenCloseVirtualValve("", new object[] { item.Value });
 
-                     }
 
-                 }
 
-                 return true;
 
-             });
 
-             OP.Subscribe($"{Module}.SetAll{AITValveOperation.GVTurnValve}", (out string reason, int time, object[] param) =>
 
-             {
 
-                 reason = string.Empty;
 
-                 var dict = param[0] as Dictionary<string, bool>;
 
-                 foreach (var item in dict)
 
-                 {
 
-                     _valves.FirstOrDefault(x => x.Name == item.Key).InvokeOpenCloseValve("", new object[] { item.Value });
 
-                 }
 
-                 return true;
 
-             });
 
-             OP.Subscribe($"{Name}.SetCREFEnable", (out string reason, int time, object[] param) =>
 
-             {
 
-                 reason = string.Empty;
 
-                 SetCREFEnable(param);
 
-                 return true;
 
-             });
 
-             OP.Subscribe($"{Name}.SetSIREFEnable", (out string reason, int time, object[] param) =>
 
-             {
 
-                 reason = string.Empty;
 
-                 SetSIREFEnable(param);
 
-                 return true;
 
-             });
 
-         }
 
-         public void SetTemperatureDetail()
 
-         {
 
-         }
 
-         private void InitFsm()
 
-         {
 
-             //Error
 
-             Transition(STATE.Error, MSG.Reset, FsmReset, STATE.Idle);
 
-             AnyStateTransition(MSG.Error, FsmOnError, STATE.Error);
 
-             AnyStateTransition(MSG.Disconnected, FsmOnDisconnect, STATE.NotConnected);
 
-             EnterExitTransition<STATE, FSM_MSG>(STATE.Error, FsmEnterError, FSM_MSG.NONE, FsmExitError);
 
-             Transition(STATE.Idle, MSG.Abort, null, STATE.Idle);
 
-             Transition(STATE.Idle, MSG.Reset, null, STATE.Idle);
 
-             Transition(STATE.Init, MSG.Reset, null, STATE.Idle);
 
-             Transition(STATE.Error, MSG.Abort, null, STATE.Error);
 
-             //init
 
-             Transition(STATE.Init, MSG.Home, FsmStartHome, STATE.Homing);
 
-             AnyStateTransition(MSG.ToInit, FsmToInit, STATE.Init);
 
-             //not connected
 
-             Transition(STATE.NotConnected, MSG.Connected, null, STATE.Init);
 
-             //Home 
 
-             EnterExitTransition((int)STATE.Homing, FsmEnterHome, (int)FSM_MSG.NONE, FsmExitHome);
 
-             Transition(STATE.Error, MSG.Home, FsmStartHome, STATE.Homing);
 
-             Transition(STATE.Idle, MSG.Home, FsmStartHome, STATE.Homing);
 
-             Transition(STATE.Homing, FSM_MSG.TIMER, FsmMonitorHomeTask, STATE.Idle);
 
-             Transition(STATE.Homing, MSG.Error, null, STATE.Init);
 
-             Transition(STATE.Homing, MSG.Abort, FsmAbortTask, STATE.Init);
 
-             //PrepareTransfer
 
-             Transition(STATE.Idle, MSG.PrepareTransfer, FsmStartPrepareTransfer, STATE.PrepareTransfer);
 
-             Transition(STATE.PrepareTransfer, FSM_MSG.TIMER, FsmMonitorTask, STATE.Idle);
 
-             Transition(STATE.PrepareTransfer, MSG.Abort, FsmAbortTask, STATE.Idle);
 
-             //PostTransfer
 
-             Transition(STATE.InTransfer, MSG.PostTransfer, FsmStartPostTransfer, STATE.PostTransfer);
 
-             Transition(STATE.Idle, MSG.PostTransfer, FsmStartPostTransfer, STATE.PostTransfer);
 
-             Transition(STATE.PostTransfer, FSM_MSG.TIMER, FsmMonitorTask, STATE.Idle);
 
-             Transition(STATE.PostTransfer, MSG.Abort, FsmAbortTask, STATE.Idle);
 
-             //online
 
-             Transition(STATE.Idle, MSG.SetOnline, FsmStartSetOnline, STATE.Idle);
 
-             Transition(STATE.Idle, MSG.SetOffline, FsmStartSetOffline, STATE.Idle);
 
-             //Leak check
 
-             Transition(STATE.Idle, MSG.LeakCheck, FsmStartLeakCheck, STATE.LeakCheck);
 
-             Transition(STATE.LeakCheck, FSM_MSG.TIMER, FsmMonitorTask, STATE.Idle);
 
-             Transition(STATE.LeakCheck, MSG.Abort, FsmAbortTask, STATE.Idle);
 
-             EnterExitTransition<STATE, FSM_MSG>(STATE.LeakCheck, FsmEnterLeakCheck, FSM_MSG.NONE, FsmExitLeakCheck);
 
-             //open SlitValve
 
-             Transition(STATE.Idle, MSG.OpenSlitValve, FsmStartOpenSlitValve, STATE.OpenSlitValve);
 
-             Transition(STATE.OpenSlitValve, FSM_MSG.TIMER, FsmMonitorTask, STATE.Idle);
 
-             Transition(STATE.OpenSlitValve, MSG.Abort, FsmAbortTask, STATE.Idle);
 
-             //close SlitValve
 
-             Transition(STATE.Idle, MSG.CloseSlitValve, FsmStartCloseSlitValve, STATE.CloseSlitValve);
 
-             Transition(STATE.CloseSlitValve, FSM_MSG.TIMER, FsmMonitorTask, STATE.Idle);
 
-             Transition(STATE.CloseSlitValve, MSG.Abort, FsmAbortTask, STATE.Idle);
 
-             //PreProcess
 
-             Transition(STATE.Process, MSG.RunIdleRecipe, FsmStartIdleRecipePreProcess, STATE.PreProcess);
 
-             Transition(STATE.Process, MSG.RunOtherRecipe, FsmStartOtherRecipePreProcess, STATE.PreProcess);
 
-             Transition(STATE.Idle, MSG.RunOtherRecipe, FsmStartOtherRecipePreProcess, STATE.PreProcess);
 
-             Transition(STATE.Idle, MSG.SelectRecipe, FsmSelectRecipe, STATE.Idle);
 
-             Transition(STATE.Idle, MSG.RunRecipe, FsmStartPreProcess, STATE.PreProcess);
 
-             Transition(STATE.PreProcess, FSM_MSG.TIMER, FsmMonitorTask, STATE.PreProcess);
 
-             Transition(STATE.PreProcess, MSG.Abort, FsmAbortTask, STATE.Idle);
 
-             Transition(STATE.PreProcess, MSG.RecipeAbort, FsmAbortTask, STATE.Idle);
 
-             //Process
 
-             Transition(STATE.PreProcess, MSG.Process, FsmStartProcess, STATE.Process);
 
-             Transition(STATE.Idle, MSG.AlarmConditionJumpStep, FsmStartAlarmConditionJumpStep, STATE.Process);
 
-             Transition(STATE.Process, FSM_MSG.TIMER, FsmMonitorTask, STATE.Process);
 
-             Transition(STATE.Process, MSG.Abort, FsmAbortTask, STATE.Idle);
 
-             Transition(STATE.Process, MSG.EndIdleRecipe, null, STATE.Idle);
 
-             EnterExitTransition<STATE, FSM_MSG>(STATE.Process, FsmEnterProcess, FSM_MSG.NONE, FsmExitProcess);
 
-             Transition(STATE.Paused, FSM_MSG.TIMER, FsmMonitorTask, STATE.Paused);
 
-             Transition(STATE.Paused, MSG.Continue, FsmStartContinue, STATE.Process);
 
-             Transition(STATE.Paused, MSG.Error, null, STATE.Paused);
 
-             Transition(STATE.Paused, MSG.Abort, FsmAbortTask, STATE.Idle);
 
-             //Transition(STATE.Paused, MSG.Error, null, STATE.Paused);
 
-             Transition(STATE.Process, MSG.RecipeSkipStep, FsmSkipStep, STATE.Process);
 
-             Transition(STATE.Process, MSG.RecipeJumpStep, FsmJumpStep, STATE.Process);
 
-             Transition(STATE.Process, MSG.RecipePause, FsmRecipePause, STATE.Process);
 
-             Transition(STATE.Process, MSG.RecipeContinue, FsmRecipeContinue, STATE.Process);
 
-             Transition(STATE.Process, MSG.RecipeAbort, FsmRecipeAbort, STATE.Process);
 
-             //PostProcess
 
-             Transition(STATE.Process, MSG.PostProcess, FsmStartPostProcess, STATE.PostProcess);
 
-             Transition(STATE.PostProcess, FSM_MSG.TIMER, FsmMonitorTask, STATE.Idle);
 
-             Transition(STATE.PostProcess, MSG.Abort, FsmAbortTask, STATE.Idle);
 
-             EnterExitTransition<STATE, FSM_MSG>(STATE.PostProcess, null, FSM_MSG.NONE, ExitPostProcess);
 
-             //MFC Calibration
 
-             Transition(STATE.Idle, MSG.StartMFCCalibration, FsmStartMFCCalibration, STATE.MFCCali);
 
-             Transition(STATE.MFCCali, FSM_MSG.TIMER, FsmMonitorTask, STATE.Idle);
 
-             Transition(STATE.MFCCali, MSG.Abort, FsmAbortTask, STATE.Idle);
 
-         }
 
-         private bool FsmToInit(object[] param)
 
-         {
 
-             return true;
 
-         }
 
-         private bool FsmExitError(object[] param)
 
-         {
 
-             return true;
 
-         }
 
-         private bool FsmEnterError(object[] param)
 
-         {
 
-             if (OnEnterError != null)
 
-                 OnEnterError(Module);
 
-             if (IsOnline)
 
-             {
 
-                 //EV.PostWarningLog(Module, $"{Module}");
 
-             }
 
-             return true;
 
-         }
 
-         private bool FsmStartPostTransfer(object[] param)
 
-         {
 
-             _postTransferRoutine.Init((EnumTransferType)Enum.Parse(typeof(EnumTransferType), (string)param[0]));
 
-             Result ret = StartRoutine(_postTransferRoutine);
 
-             if (ret == Result.FAIL || ret == Result.DONE)
 
-                 return false;
 
-             return ret == Result.RUN;
 
-         }
 
-         private bool FsmStartPrepareTransfer(object[] param)
 
-         {
 
-             _prepareTransferRoutine.Init((EnumTransferType)Enum.Parse(typeof(EnumTransferType), (string)param[0]));
 
-             Result ret = StartRoutine(_prepareTransferRoutine);
 
-             if (ret == Result.FAIL || ret == Result.DONE)
 
-                 return false;
 
-             return ret == Result.RUN;
 
-         }
 
-         private bool FsmStartSetOffline(object[] param)
 
-         {
 
-             IsOnline = false;
 
-             return true;
 
-         }
 
-         private bool FsmStartSetOnline(object[] param)
 
-         {
 
-             IsOnline = true;
 
-             return true;
 
-         }
 
-         private bool FsmStartLeakCheck(object[] param)
 
-         {
 
-             _leakCheckRoutine.Init((int)param[0], (int)param[1], (string)param[2], (bool[])param[3]);
 
-             Result ret = StartRoutine(_leakCheckRoutine);
 
-             if (ret == Result.FAIL || ret == Result.DONE)
 
-                 return false;
 
-             return ret == Result.RUN;
 
-         }
 
-         private bool FsmEnterLeakCheck(object[] param)
 
-         {
 
-             return true;
 
-         }
 
-         private bool FsmExitLeakCheck(object[] param)
 
-         {
 
-             //ChamberProcessPressureGauge.UnsetTuning();
 
-             return true;
 
-         }
 
-         private bool FsmStartOpenSlitValve(object[] param)
 
-         {
 
-             return true;
 
-         }
 
-         private bool FsmStartCloseSlitValve(object[] param)
 
-         {
 
-             return true;
 
-         }
 
-         private bool FsmSelectRecipe(object[] param)
 
-         {
 
-             return true;
 
-         }
 
-         private bool FsmStartPreProcess(object[] param)
 
-         {
 
-             _recipeRunningInfo.RecipeName = (string)param[0];
 
-             if (!RecipeParser.Parse(_recipeRunningInfo.RecipeName, ModuleName.PM1.ToString(), out var recipeHead, out var recipeSteps, out string reason, "Process"))
 
-             {
 
-                 PreprocessStartFailedWarning.Set($"Load process recipe {_recipeRunningInfo.RecipeName} failed, {reason}");
 
-                 return false;
 
-             }
 
-             if (recipeSteps == null || recipeSteps.Count == 0)
 
-             {
 
-                 PreprocessStartFailedWarning.Set($"Process recipe {_recipeRunningInfo.RecipeName} is empty");
 
-                 return false;
 
-             }
 
-             string abortRecipeName = SC.ContainsItem("System.Recipe.Abort Recipe") ? SC.GetStringValue("System.Recipe.Abort Recipe") : string.Empty;
 
-             if (string.IsNullOrEmpty(abortRecipeName))
 
-             {
 
-                 PreprocessStartFailedWarning.Set($"Load abort recipe failed, recipe file is null");
 
-                 return false;
 
-             }
 
-             SC.SetItemValueFromString("PM1.ProcessRecipe", _recipeRunningInfo.RecipeName);
 
-             if (!IsJobProcess)
 
-                 Singleton<EquipmentManager>.Instance.CreatePj((string)param[0]);
 
-             _preprocessRoutine.Init((string)param[0]);
 
-             Result ret = StartRoutine(_preprocessRoutine);
 
-             if (ret == Result.FAIL || ret == Result.DONE)
 
-                 return false;
 
-             if (!IsJobProcess)
 
-                 SensorPROCManualOK.Value = true;
 
-             return ret == Result.RUN;
 
-         }
 
-         private bool FsmStartOtherRecipePreProcess(object[] param)
 
-         {
 
-             _recipeRunningInfo.RecipeName = param[0].ToString();
 
-             var recipeType = param[1].ToString();
 
-             var tableID = 1;
 
-             if (param.Length > 2)
 
-                 int.TryParse(param[2].ToString(), out tableID);
 
-             if (!RecipeParser.Parse(_recipeRunningInfo.RecipeName, ModuleName.PM1.ToString(), out var recipeHead, out var recipeSteps, out string reason, recipeType, tableID))
 
-             {
 
-                 PreprocessStartFailedWarning.Set($"Load {recipeType} recipe {_recipeRunningInfo.RecipeName} failed {reason}");
 
-                 return false;
 
-             }
 
-             if (recipeSteps == null || recipeSteps.Count == 0)
 
-             {
 
-                 PreprocessStartFailedWarning.Set($"{recipeType} recipe {_recipeRunningInfo.RecipeName} is empty");
 
-                 return false;
 
-             }
 
-             if (!IsJobProcess)
 
-                 Singleton<EquipmentManager>.Instance.CreatePj(_recipeRunningInfo.RecipeName);
 
-             _preprocessRoutine.Init(_recipeRunningInfo.RecipeName, false);
 
-             RecipeRunningInfo.MainRecipeName = _recipeRunningInfo.RecipeName;
 
-             RecipeRunningInfo.Head = recipeHead;
 
-             RecipeRunningInfo.RecipeStepList = recipeSteps;
 
-             Result ret = StartRoutine(_preprocessRoutine);
 
-             if (ret == Result.FAIL || ret == Result.DONE)
 
-                 return false;
 
-             if (!IsJobProcess)
 
-                 SensorPROCManualOK.Value = true;
 
-             return ret == Result.RUN;
 
-         }
 
-         private bool FsmStartIdleRecipePreProcess(object[] param)
 
-         {
 
-             if (!CheckBoatState())
 
-             {
 
-                 PreprocessStartFailedWarning.Set($"boat is not ready");
 
-                 return false;
 
-             }
 
-             _recipeRunningInfo.RecipeName = SC.ContainsItem("System.Recipe.Idle Recipe") ? SC.GetStringValue("System.Recipe.Idle Recipe") : string.Empty;
 
-             if (!RecipeParser.Parse(_recipeRunningInfo.RecipeName, ModuleName.PM1.ToString(), out var recipeHead, out var recipeSteps, out string reason, "Idle"))
 
-             {
 
-                 PreprocessStartFailedWarning.Set($"Load idle recipe {_recipeRunningInfo.RecipeName} failed {reason}");
 
-                 return false;
 
-             }
 
-             if (recipeSteps == null || recipeSteps.Count == 0)
 
-             {
 
-                 PreprocessStartFailedWarning.Set($"Process recipe {_recipeRunningInfo.RecipeName} is empty");
 
-                 return false;
 
-             }
 
-             if (!IsJobProcess)
 
-                 Singleton<EquipmentManager>.Instance.CreatePj(_recipeRunningInfo.RecipeName);
 
-             _preprocessRoutine.Init(_recipeRunningInfo.RecipeName, false);
 
-             RecipeRunningInfo.MainRecipeName = _recipeRunningInfo.RecipeName;
 
-             RecipeRunningInfo.Head = recipeHead;
 
-             RecipeRunningInfo.RecipeStepList = recipeSteps;
 
-             Result ret = StartRoutine(_preprocessRoutine);
 
-             if (ret == Result.FAIL || ret == Result.DONE)
 
-                 return false;
 
-             if (!IsJobProcess)
 
-                 SensorPROCManualOK.Value = true;
 
-             return ret == Result.RUN;
 
-         }
 
-         private bool FsmStartProcess(object[] param)
 
-         {
 
-             Result ret = StartRoutine(_processRoutine);
 
-             if (ret == Result.FAIL || ret == Result.DONE)
 
-                 return false;
 
-             if (ret == Result.RUN && !IsJobProcess)
 
-                 Singleton<EquipmentManager>.Instance.StartPj();
 
-             return ret == Result.RUN;
 
-         }
 
-         private bool FsmStartAlarmConditionJumpStep(object[] param)
 
-         {
 
-             if (param != null && param.Length > 0)
 
-             {
 
-                 int.TryParse(param[0].ToString(), out int jumpStep);
 
-                 _processRoutine.AlarmConditionJumpStep = jumpStep;
 
-                 Result ret = StartRoutine(_processRoutine);
 
-                 if (ret == Result.FAIL || ret == Result.DONE)
 
-                     return false;
 
-                 return ret == Result.RUN;
 
-             }
 
-             return false;
 
-         }
 
-         private bool FsmEnterProcess(object[] param)
 
-         {
 
-             for (int i = 0; i < SC.GetValue<int>($"Boat.SlotCount"); i++)
 
-             {
 
-                 if (!WaferManager.Instance.CheckHasWafer(ModuleHelper.Converter(Module), i))
 
-                     continue;
 
-                 WaferManager.Instance.UpdateWaferProcessStatus(ModuleHelper.Converter(Module), i, EnumWaferProcessStatus.InProcess);
 
-             }
 
-             _processTimer.Restart();
 
-             return true;
 
-         }
 
-         private bool FsmExitProcess(object[] param)
 
-         {
 
-             _processRoutine.ExitProcess();
 
-             //_statWaferCount.Increase();
 
-             //_statProcessTime.Increase((int)(_processTimer.ElapsedMilliseconds/1000));
 
-             _isPrepareProcess = true;
 
-             IsJobProcess = false;
 
-             SensorPROCManualOK.Value = false;
 
-             //if (SC.GetStringValue($"System.Recipe.ExcuteAfterRecipeComplete") == "StandbyStep")
 
-             //{
 
-             //    StringProcessFlowState = ProcessFlowState.Standby.ToString();
 
-             //    _recipeRunningInfo.StepName = "Standby";
 
-             //    var standbyStep = _recipeRunningInfo.RecipeStepList.Where(x => x.StepName == "Standby").FirstOrDefault();
 
-             //    if (standbyStep != null)
 
-             //    {
 
-             //        EV.PostInfoLog(Module, $"Recipe {_recipeRunningInfo.RecipeName} complete excute standby step");
 
-             //        foreach (var recipeCmd in standbyStep.RecipeCommands.Keys)
 
-             //        {
 
-             //            if (!OP.CanDoOperation($"{Module}.{recipeCmd}", out string reason, standbyStep.RecipeCommands[recipeCmd]))
 
-             //            {
 
-             //                if (!OP.CanDoOperation($"{ModuleName.PM1}.{recipeCmd}", out reason, standbyStep.RecipeCommands[recipeCmd]))
 
-             //                {
 
-             //                    if (!OP.CanDoOperation($"{ModuleName.System}.{recipeCmd}", out reason, standbyStep.RecipeCommands[recipeCmd]))
 
-             //                    {
 
-             //                        reason = $"Can not execute {recipeCmd}, {reason}";
 
-             //                        return false;
 
-             //                    }
 
-             //                    else
 
-             //                    {
 
-             //                        OP.DoOperation($"{ModuleName.System}.{recipeCmd}", out string reason1, 0, standbyStep.RecipeCommands[recipeCmd]);
 
-             //                    }
 
-             //                }
 
-             //                else
 
-             //                {
 
-             //                    OP.DoOperation($"{ModuleName.PM1}.{recipeCmd}", out string reason1, 0, standbyStep.RecipeCommands[recipeCmd]);
 
-             //                }
 
-             //            }
 
-             //            else
 
-             //            {
 
-             //                OP.DoOperation($"{Module}.{recipeCmd}", out string reason1, 0, standbyStep.RecipeCommands[recipeCmd]);
 
-             //            }
 
-             //        }
 
-             //    }
 
-             //    _isStandbyStep = true;
 
-             //    IsExcuteIdleRecipe = false;
 
-             //}
 
-             //else if (SC.GetStringValue($"System.Recipe.ExcuteAfterRecipeComplete") == "IdleRecipe")
 
-             //{
 
-             //    if (!IsExcuteIdleRecipe)
 
-             //    {
 
-             //        PostMsg((int)MSG.RunIdleRecipe);
 
-             //        IsExcuteIdleRecipe = true;
 
-             //    }
 
-             //    else
 
-             //    {
 
-             //        IsExcuteIdleRecipe = false;
 
-             //        _isStandbyStep = false;
 
-             //    }
 
-             //}
 
-             //else
 
-             //{
 
-             //    IsExcuteIdleRecipe = false;
 
-             //    _isStandbyStep = false;
 
-             //}
 
-             return true;
 
-         }
 
-         private bool FsmStartContinue(object[] param)
 
-         {
 
-             return true;
 
-         }
 
-         private bool FsmSkipStep(object[] param)
 
-         {
 
-             _processRoutine.SkipCurrentRecipeStep();
 
-             return true;
 
-         }
 
-         private bool FsmJumpStep(object[] param)
 
-         {
 
-             int.TryParse(param[0].ToString(), out int stepNumber);
 
-             _processRoutine.JumpCurrentRecipeStep(stepNumber, param[1].ToString());
 
-             return true;
 
-         }
 
-         private bool FsmRecipePause(object[] param)
 
-         {
 
-             _processRoutine.PauseRecipe();
 
-             return true;
 
-         }
 
-         private bool FsmRecipeContinue(object[] param)
 
-         {
 
-             _processRoutine.ContinueRecipe();
 
-             return true;
 
-         }
 
-         private bool FsmRecipeAbort(object[] param)
 
-         {
 
-             Singleton<EquipmentManager>.Instance.EndPj("Recipe Abort");
 
-             _processRoutine.Abort();
 
-             IsWait = false;
 
-             return true;
 
-         }
 
-         private bool FsmStartPostProcess(object[] param)
 
-         {
 
-             Result ret = StartRoutine(_postprocessRoutine);
 
-             if (ret == Result.FAIL || ret == Result.DONE)
 
-                 return false;
 
-             return ret == Result.RUN;
 
-         }
 
-         private bool ExitPostProcess(object[] param)
 
-         {
 
-             return true;
 
-         }
 
-         private bool FsmStartMFCCalibration(object[] param)
 
-         {
 
-             return true;
 
-         }
 
-         private bool FsmOnDisconnect(object[] param)
 
-         {
 
-             if (FsmState == (int)STATE.Error)
 
-             {
 
-                 return false;
 
-             }
 
-             return true;
 
-         }
 
-         private bool FsmOnError(object[] param)
 
-         {
 
-             if (FsmState == (int)STATE.Error)
 
-             {
 
-                 return false;
 
-             }
 
-             if ((FsmState == (int)STATE.Process) || (FsmState == (int)STATE.PreProcess) || (FsmState == (int)STATE.PostProcess))
 
-             {
 
-                 for (int i = 0; i < SC.GetValue<int>($"Boat.SlotCount"); i++)
 
-                 {
 
-                     if (!WaferManager.Instance.CheckHasWafer(ModuleHelper.Converter(Module), i))
 
-                         continue;
 
-                     WaferManager.Instance.UpdateWaferProcessStatus(ModuleHelper.Converter(Module), i, EnumWaferProcessStatus.Failed);
 
-                 }
 
-                 _processRoutine.Abort();
 
-                 _postprocessRoutine.Abort();
 
-                 _preprocessRoutine.Abort();
 
-                 IsWait = false;
 
-             }
 
-             return true;
 
-         }
 
-         private bool FsmReset(object[] param)
 
-         {
 
-             if (!_isInit)
 
-             {
 
-                 PostMsg(MSG.ToInit);
 
-                 return false;
 
-             }
 
-             foreach (var device in _allModuleDevice)
 
-             {
 
-                 if (device.HasAlarm)
 
-                 {
 
-                     CheckHasAlarmWarning.Set($"{device.Name} has error");
 
-                 }
 
-             }
 
-             if (CheckHasAlarm())
 
-                 return false;
 
-             return true;
 
-         }
 
-         private bool FsmStartHome(object[] param)
 
-         {
 
-             //if (!CheckIsConnected())
 
-             //{
 
-             //    PostMsg(MSG.Disconnected);
 
-             //    return false;
 
-             //}
 
-             if (CheckHasAlarm())
 
-             {
 
-                 CheckHasAlarmWarning.Set($"There exist active alarm, reset error before continue the initialization");
 
-                 PostMsg(MSG.Error);
 
-                 return false;
 
-             }
 
-             Result ret = StartRoutine(_homeRoutine);
 
-             if (ret == Result.FAIL || ret == Result.DONE)
 
-                 return false;
 
-             _isInit = false;
 
-             return ret == Result.RUN;
 
-         }
 
-         private bool FsmExitHome(object[] param)
 
-         {
 
-             return true;
 
-         }
 
-         private bool FsmEnterHome(object[] param)
 
-         {
 
-             return true;
 
-         }
 
-         private bool FsmAbortTask(object[] param)
 
-         {
 
-             AbortRoutine();
 
-             _isPrepareProcess = true;
 
-             return true;
 
-         }
 
-         private bool FsmMonitorHomeTask(object[] param)
 
-         {
 
-             Result ret = MonitorRoutine();
 
-             if (ret == Result.FAIL)
 
-             {
 
-                 PostMsg(MSG.Error);
 
-                 return false;
 
-             }
 
-             if (ret == Result.DONE)
 
-             {
 
-                 _isInit = true;
 
-                 return true;
 
-             }
 
-             return false;
 
-         }
 
-         private bool FsmMonitorTask(object[] param)
 
-         {
 
-             Result ret = MonitorRoutine();
 
-             if (ret == Result.FAIL)
 
-             {
 
-                 PostMsg(MSG.Error);
 
-                 return false;
 
-             }
 
-             if (ret == Result.DONE && FsmState == (int)STATE.PreProcess)
 
-             {
 
-                 PostMsg(MSG.Process);
 
-                 return true;
 
-             }
 
-             if (ret == Result.DONE && FsmState == (int)STATE.Process)
 
-             {
 
-                 PostMsg(MSG.PostProcess);
 
-                 return true;
 
-             }
 
-             if (ret == Result.DONE && IsExcuteIdleRecipe && FsmState == (int)STATE.PostProcess)
 
-             {
 
-                 PostMsg(MSG.RunIdleRecipe);
 
-                 return true;
 
-             }
 
-             return ret == Result.DONE;
 
-         }
 
-         #region Service functions
 
-         public override bool Home(out string reason)
 
-         {
 
-             CheckToPostMessage((int)MSG.Home);
 
-             reason = string.Empty;
 
-             return true;
 
-         }
 
-         public override void Reset()
 
-         {
 
-             ResetAUXTrig();
 
-             if (!IsProcessing)
 
-                 CheckToPostMessage((int)MSG.Reset);
 
-         }
 
-         public override bool PrepareTransfer(ModuleName robot, Hand blade, int targetSlot, EnumTransferType transferType, out string reason)
 
-         {
 
-             CheckToPostMessage((int)MSG.PrepareTransfer, transferType.ToString());
 
-             reason = string.Empty;
 
-             return true;
 
-         }
 
-         public override bool TransferHandoff(ModuleName robot, Hand blade, int targetSlot, EnumTransferType transferType, out string reason)
 
-         {
 
-             reason = string.Empty;
 
-             return true;
 
-         }
 
-         public override bool PostTransfer(ModuleName robot, Hand blade, int targetSlot, EnumTransferType transferType, out string reason)
 
-         {
 
-             CheckToPostMessage((int)MSG.PostTransfer, transferType.ToString());
 
-             reason = string.Empty;
 
-             return true;
 
-         }
 
-         public override bool CheckReadyForTransfer(ModuleName robot, Hand blade, int targetSlot, EnumTransferType transferType, out string reason)
 
-         {
 
-             reason = string.Empty;
 
-             var boat = Singleton<EquipmentManager>.Instance.Modules[ModuleName.Boat] as BoatModule;
 
-             if (!boat.IsBoatElevatorAtHomePosition)
 
-             {
 
-                 reason = "Boat z axis is not at home position";
 
-                 return false;
 
-             }
 
-             if (!boat.IsBoatRotationAtHomePosition)
 
-             {
 
-                 reason = "Boat r axis is not at home position";
 
-                 return false;
 
-             }
 
-             return true;
 
-         }
 
-         public override void NoteTransferStart(ModuleName robot, Hand blade, int targetSlot, EnumTransferType transferType)
 
-         {
 
-             //if (FsmState == (int)STATE.InTransfer)
 
-             //    CheckToPostMessage(MSG.Transfer)
 
-         }
 
-         public override void NoteTransferStop(ModuleName robot, Hand blade, int targetSlot, EnumTransferType transferType)
 
-         {
 
-             //if (FsmState == (int)STATE.InTransfer)
 
-             //    CheckToPostMessage(MSG.Transfer)
 
-         }
 
-         public override bool Process(string recipeName, bool isCleanRecipe, bool withWafer, out string reason)
 
-         {
 
-             _recipeRunningInfo.RecipeName = recipeName;
 
-             _isPrepareProcess = false;
 
-             _isStandbyStep = false;
 
-             IsJobProcess = true;
 
-             IsExcuteIdleRecipe = false;
 
-             CheckToPostMessage((int)MSG.RunRecipe, recipeName);
 
-             reason = string.Empty;
 
-             return true;
 
-         }
 
-         public override bool Standby(string recipeName, out string reason)
 
-         {
 
-             reason = string.Empty;
 
-             _recipeRunningInfo.RecipeName = recipeName;
 
-             _recipeRunningInfo.MainRecipeName = recipeName;
 
-             if (!RecipeParser.Parse(_recipeRunningInfo.RecipeName, ModuleName.PM1.ToString(), out var recipeHead, out var recipeSteps, out reason, "Process"))
 
-             {
 
-                 reason = $"Load process recipe {_recipeRunningInfo.RecipeName} failed, {reason}";
 
-                 return false;
 
-             }
 
-             if (recipeSteps == null || recipeSteps.Count == 0)
 
-             {
 
-                 reason = $"Process recipe {_recipeRunningInfo.RecipeName} is empty";
 
-                 return false;
 
-             }
 
-             _isStandbyStep = true;
 
-             var standbyStep = recipeSteps.Where(x => x.StepName == "Standby").FirstOrDefault();
 
-             if (standbyStep != null)
 
-             {
 
-                 StringProcessFlowState = ProcessFlowState.Standby.ToString();
 
-                 _recipeRunningInfo.StepName = "Standby";
 
-                 EV.PostInfoLog(Module, $"pj job excute recipe {recipeName} standby step");
 
-                 foreach (var recipeCmd in standbyStep.RecipeCommands.Keys)
 
-                 {
 
-                     if (!OP.CanDoOperation($"{Module}.{recipeCmd}", out reason, standbyStep.RecipeCommands[recipeCmd]))
 
-                     {
 
-                         if (!OP.CanDoOperation($"{ModuleName.PM1}.{recipeCmd}", out reason, standbyStep.RecipeCommands[recipeCmd]))
 
-                         {
 
-                             if (!OP.CanDoOperation($"{ModuleName.System}.{recipeCmd}", out reason, standbyStep.RecipeCommands[recipeCmd]))
 
-                             {
 
-                                 reason = $"Can not execute {recipeCmd}, {reason}";
 
-                                 return false;
 
-                             }
 
-                             else
 
-                             {
 
-                                 OP.DoOperation($"{ModuleName.System}.{recipeCmd}", out string reason1, 0, standbyStep.RecipeCommands[recipeCmd]);
 
-                             }
 
-                         }
 
-                         else
 
-                         {
 
-                             OP.DoOperation($"{ModuleName.PM1}.{recipeCmd}", out string reason1, 0, standbyStep.RecipeCommands[recipeCmd]);
 
-                         }
 
-                     }
 
-                     else
 
-                     {
 
-                         OP.DoOperation($"{Module}.{recipeCmd}", out string reason1, 0, standbyStep.RecipeCommands[recipeCmd]);
 
-                     }
 
-                 }
 
-             }
 
-             return true;
 
-         }
 
-         public void EndIdleRecipe()
 
-         {
 
-             CheckToPostMessage((int)MSG.EndIdleRecipe);
 
-         }
 
-         private double GetNewShowTime()
 
-         {
 
-             return GetWaitTime() + _recipeRunningInfo.HoldTime;
 
-         }
 
-         private double GetWaitTime()
 
-         {
 
-             if (StringFsmStatus=="Idle")
 
-             {
 
-                 _waitTimer.Reset();
 
-             }
 
-             if (IsWait)
 
-             {
 
-                 _waitTimer.Start();
 
-             }
 
-             else
 
-             {
 
-                 _waitTimer.Stop();
 
-             }
 
-             return _waitTimer.ElapsedMilliseconds / 1000;
 
-         }
 
-     }
 
-     #endregion
 
- }
 
 
  |