| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870 | 
							- 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;
 
- using System.IO;
 
- using Aitex.Common.Util;
 
- using static Aitex.Core.Common.DeviceData.AITConfigData;
 
- using MECF.Framework.Common.CommonData.SorterDefines;
 
- using MECF.Framework.Common.Utilities;
 
- using System.Windows.Documents;
 
- using MECF.Framework.Common.CommonData.EnumData;
 
- using MECF.Framework.Common.CommonData;
 
- using System.ServiceModel;
 
- using FabConnect.SecsGemInterface.Application.Objects.ObjectService;
 
- using DocumentFormat.OpenXml.Packaging;
 
- using System.Runtime.Remoting.Metadata.W3cXsd2001;
 
- using FurnaceRT.Equipments.Schedulers;
 
- using FabConnect.SecsGemInterface.Common;
 
- using MECF.Framework.Common.FAServices;
 
- 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; } = ProcessFlowState.Standby.ToString();
 
-         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();
 
-             InitScheduleMaintenance();
 
-             InitAlarmConditionChecker();
 
-             Singleton<EventManager>.Instance.OnAlarmEvent += Instance_OnAlarmEvent;
 
-             ToolType = SC.GetStringValue("System.SetUp.ToolType");
 
-             #region bufferpurge重启下发
 
-             var isEnable = SC.GetValue<bool>("BufferPurge.IsEnable");
 
-             if (isEnable)
 
-             {
 
-                 var sequence = SC.GetStringValue("BufferPurge.OperationOrder")?.Split(';');
 
-                 string[] names = SC.GetStringValue("BufferPurge.NameList")?.Split(';');
 
-                 if (sequence?.Length > 0 && names?.Length > 0)
 
-                 {
 
-                     List<PurgeParameter> purge = new List<PurgeParameter>();
 
-                     foreach (string p in sequence)
 
-                     {
 
-                         if (string.IsNullOrWhiteSpace(p)) continue;//Purge1,0,Time(10),Open;
 
-                         var step = p.Trim().Split(',');
 
-                         if (step.Length == 4)
 
-                         {
 
-                             if (string.IsNullOrEmpty(step[0])) continue;//name
 
-                             if (names.Contains(step[0]))
 
-                             {
 
-                                 var index = step[2].IndexOf('(') + 1;
 
-                                 int.TryParse(step[2].Substring(index, step[2].Length - index - 1), out int time);//仅考虑时间
 
-                                 purge.Add(
 
-                                 new PurgeParameter() { Name = step[0], TimeString = $"{time / 3600:00}:{time % 3600 / 60:00}:{time % 60:00}", IsClose = step[3].ToLower() == "close", IsOpen = step[3].ToLower() == "open" });
 
-                             }
 
-                         }
 
-                     }
 
-                     SetBufferPurge(purge);
 
-                 }
 
-             }
 
-             #endregion
 
-             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);
 
-         }
 
-         public bool GetRunningModeIsDebug()
 
-         {
 
-             if (SC.ContainsItem("System.RunningMode"))
 
-             {
 
-                 return SC.GetStringValue("System.RunningMode") == ConfigEnum.Debug.ToString();
 
-             }
 
-             return true;
 
-         }
 
-         private void InitData()
 
-         {
 
-             DATA.Subscribe($"{Module}.IsError", () => IsError);
 
-             DATA.Subscribe($"{Module}.IsProcessing", () => IsProcessing);
 
-             DATA.Subscribe($"{Module}.Status", () => StringFsmStatus);
 
-             DATA.Subscribe($"{Module}.IsOnline", () => IsOnline);
 
-             DATA.Subscribe($"{Module}.RunningModeIsDebug", () => GetRunningModeIsDebug());
 
-             DATA.Subscribe($"{Module}.EnableMinics", () => SC.ContainsItem("Minics.EnableMinics") ? SC.GetValue<bool>("Minics.EnableMinics") : false);
 
-             //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}.ProcessSubRecipeTable", () => _recipeRunningInfo.SubRecipeTable);
 
-             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}.HTR1Enable", () => IsHTR1Enable);
 
-             DATA.Subscribe($"{Module}.HTR2Enable", () => IsHTR2Enable);
 
-             DATA.Subscribe($"{Module}.HTR3Enable", () => IsHTR3Enable);
 
-             DATA.Subscribe($"{Module}.IsDPROn", () => _isDPROn);
 
-             DATA.Subscribe($"{Module}.IsCEXHOn", () => TrigCEXHON?.Value);
 
-             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);
 
-             DATA.Subscribe($"{Module}.MFCList", () =>
 
-             {
 
-                 List<AITMfcData> aITMfcDataList = new List<AITMfcData>();
 
-                 var mfcs = DEVICE.GetDevice<PMs.Devices.IoMFC>();
 
-                 if (mfcs != null)
 
-                 {
 
-                     foreach (var item in mfcs)
 
-                     {
 
-                         if (item == null) continue;
 
-                         if (item.IsMFCInstalled)
 
-                         {
 
-                             aITMfcDataList.Add(item.DeviceData);
 
-                         }
 
-                     }
 
-                 }
 
-                 return aITMfcDataList;
 
-             });
 
-             InitScheduleData();
 
-             FDCSubscribe();
 
-             InitOtherData();
 
-             InitN2PurgeData();
 
-         }
 
-         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}.RecipeIdle", (string cmd, object[] args) => CheckToPostMessage((int)MSG.RunIdleRecipe));
 
-             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}.SetAllFFUPower", (out string reason, int time, object[] param) =>
 
-             {
 
-                 reason = string.Empty;
 
-                 SetAllFFUPower(param);
 
-                 return true;
 
-             });
 
-             //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}.SetBWREnable", (out string reason, int time, object[] param) =>
 
-             {
 
-                 reason = string.Empty;
 
-                 SetBWREnable(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}.SetCEXHEnable", (out string reason, int time, object[] param) =>
 
-             {
 
-                 reason = string.Empty;
 
-                 SetCEXHEnable(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;
 
-                 SetHREFEnable(param);
 
-                 return true;
 
-             });
 
-             OP.Subscribe($"{Name}.SetBufferPurge", (out string reason, int time, object[] param) =>
 
-             {
 
-                 reason = string.Empty;
 
-                 if (param.Length > 0 && param[0] is List<PurgeParameter> purge)
 
-                 {
 
-                     reason = SetBufferPurge(purge);
 
-                     if (!string.IsNullOrEmpty(reason)) return false;
 
-                     SC.SetItemValue("BufferPurge.OperationOrder", $"{purge[0].Name},{purge[0].Speed},Time({purge[0].Time}),{(purge[0].IsOpen ? "Open" : (purge[0].IsClose ? "Close" : ""))}");
 
-                 }
 
-                 return true;
 
-             });
 
-             InitOtherOP();
 
-         }
 
-         private string SetBufferPurge(List<PurgeParameter> purge)
 
-         {
 
-             string reason = string.Empty;
 
-             if (TrigBufferPurgeTime == null || TrigBufferN2PurageEN == null) { reason = "TrigBufferPurgeTime/TrigBufferN2PurageEN is null"; }
 
-             if (purge[0].IsOpen || purge[0].IsClose)
 
-             {
 
-                 if (TrigBufferPurgeTime.SetAOTrigger(purge[0].Time, out reason))
 
-                 {
 
-                     TrigBufferN2PurageEN.SetTrigger(purge[0].IsOpen, out reason);
 
-                 }
 
-             }
 
-             return reason;
 
-         }
 
-         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]);
 
-             RecipeExecEntryEnumValue = RecipeExecEntryEnum.MaintenanceJobTrigger;
 
-             _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)
 
-         {
 
-             Singleton<EquipmentManager>.Instance.EndPj("AbnormalEnd");
 
-             _processRoutine?.Abort();
 
-             IsWait = false;
 
-             IsJobProcess = false;
 
-             _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;
 
-             RecipeRunningInfo.RecipeName = _recipeRunningInfo.RecipeName;
 
-             RecipeRunningInfo.ExecRecipeType = recipeSteps.Count > 0 ? recipeSteps[0].RecipeType : string.Empty;
 
-             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;
 
-             }
 
-             Singleton<EquipmentManager>.Instance.EndPj("AbnormalEnd");
 
-             _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;
 
-             RecipeRunningInfo.RecipeName = _recipeRunningInfo.RecipeName;
 
-             RecipeRunningInfo.ExecRecipeType = recipeSteps.Count > 0 ? recipeSteps[0].RecipeType : string.Empty;
 
-             RecipeExecEntryEnumValue = RecipeExecEntryEnum.IdleRecipeTrigger;
 
-             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();
 
-             if (!IsJobProcess && !_processRoutine.IsExecuteAbort)//非jobprocess需要recipe结束也需要更新数据库
 
-             {
 
-                 var firstPjId = Singleton<EquipmentManager>.Instance.GetFirstPJId();
 
-                 Singleton<EquipmentManager>.Instance.EndPj();
 
-             }
 
-             //_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("AbnormalEnd");
 
-             var firstPjId = Singleton<EquipmentManager>.Instance.GetFirstPJId();
 
-             _processRoutine.UpdateProcessDataPJid(firstPjId);
 
-             _processRoutine.Abort();
 
-             IsWait = false;
 
-             IsJobProcess = false;
 
-             var recipeName = _recipeRunningInfo.Head.AbortRecipe;
 
-             var reason = "";
 
-             if (!File.Exists($"{PathManager.GetRecipeDir()}\\{SC.GetStringValue("System.Recipe.SupportedChamberType")}\\Abort\\{recipeName}.rcp") ||
 
-                 !RecipeParser.Parse(recipeName, ModuleName.PM1.ToString(), out var recipeHead, out var recipeSteps, out reason, "Abort"))
 
-             {
 
-                 recipeName = SC.GetStringValue("System.Recipe.Abort Recipe");
 
-                 if (!File.Exists($"{PathManager.GetRecipeDir()}\\{SC.GetStringValue("System.Recipe.SupportedChamberType")}\\Abort\\{recipeName}.rcp") ||
 
-                     !RecipeParser.Parse(SC.GetStringValue("System.Recipe.Abort Recipe"), ModuleName.PM1.ToString(), out recipeHead, out recipeSteps, out reason, "Abort"))
 
-                 {
 
-                     PostMsg(MSG.Error);
 
-                     ExecuteAbortRecipeFailAlarm.Set($"Load abort recipe {recipeName} failed, {reason}");
 
-                     return false;
 
-                 }
 
-             }
 
-             var recipeType = recipeSteps.Count > 0 ? recipeSteps[0].RecipeType : string.Empty;
 
-             var recipeTable = "";
 
-             if (!string.IsNullOrEmpty(_recipeRunningInfo.Head.AbortRecipe))
 
-             {
 
-                 var currectStep = _recipeRunningInfo.RecipeStepList[_processRoutine._currentStepNumber];
 
-                 if (string.IsNullOrEmpty(currectStep.AbortRecipeTableInfo))
 
-                 {
 
-                     if (!RecipeParser.ParseTables(_recipeRunningInfo.Head.AbortRecipe, Module, out var recipeData, out reason, "Abort"))
 
-                     {
 
-                         ExecuteAbortRecipeFailAlarm.Set($"Load abort recipe {recipeName} failed, {reason}");
 
-                         return false;
 
-                     }
 
-                     else
 
-                     {
 
-                         recipeTable = recipeData.FirstOrDefault().Key.ToString();
 
-                     }
 
-                 }
 
-                 else
 
-                 {
 
-                     recipeTable = currectStep.AbortRecipeTableInfo.Split(':').FirstOrDefault();
 
-                 }
 
-             }
 
-             else
 
-             {
 
-                 if (!RecipeParser.ParseTables(SC.GetStringValue("System.Recipe.Abort Recipe"), Module, out var recipeData, out reason, "Abort"))
 
-                 {
 
-                     ExecuteAbortRecipeFailAlarm.Set($"Load abort recipe {recipeName} failed, {reason}");
 
-                     return false;
 
-                 }
 
-                 else
 
-                 {
 
-                     recipeTable = recipeData.FirstOrDefault().Key.ToString();
 
-                 }
 
-             }
 
-             RecipeExecEntryEnumValue = RecipeExecEntryEnum.AbortRecipeTrigger;
 
-             CheckToPostMessage((int)MSG.RunOtherRecipe, recipeName, recipeType, recipeTable);
 
-             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;
 
-         }
 
-         #region 
 
-         #region 
 
-         private string _processRecipeStepName = "";
 
-         private string _subRecipeStepName = "";
 
-         private string _subRecipeStepNumber = "";
 
-         private string _currentFilmThickness = "";
 
-         private string _dryClearCount = "";
 
-         /// <summary>
 
-         /// 更新FDC采集的数据
 
-         /// </summary>
 
-         /// <param name="isSub"></param>
 
-         /// <param name="stepName"></param>
 
-         /// <param name="stepNo"></param>
 
-         public void SetFDCRecipeStepName(bool isSub, string stepName, string stepNo = "")
 
-         {
 
-             if (isSub)
 
-             {
 
-                 _subRecipeStepName = stepName;
 
-                 _subRecipeStepNumber = stepNo;
 
-             }
 
-             else
 
-             {
 
-                 _processRecipeStepName = stepName;
 
-                 _subRecipeStepName = string.Empty;
 
-                 _subRecipeStepNumber = string.Empty;
 
-             }
 
-         }
 
-         #endregion
 
-         public void ResetFDCRecipeStepName()
 
-         {
 
-             _subRecipeStepName = "";
 
-             _subRecipeStepNumber = "";
 
-             _processRecipeStepName = "";
 
-         }
 
-         public void SetCurrentFilmThickness(float value)
 
-         {
 
-             _currentFilmThickness = value.ToString();
 
-         }
 
-         public void SetDryClearCount(float value)
 
-         {
 
-             _dryClearCount = value.ToString();
 
-         }
 
-         public void FDCSubscribe()
 
-         {
 
-             DATA.Subscribe($"DryClearCount", () => _dryClearCount);
 
-             DATA.Subscribe($"BoatCurrentFilmThickness", () => _currentFilmThickness);
 
-             DATA.Subscribe($"ProcessRecipeStepName", () => _processRecipeStepName);
 
-             DATA.Subscribe($"SubRecipeStepName", () => _subRecipeStepName);
 
-             DATA.Subscribe($"SubRecipeStepNumber", () => _subRecipeStepNumber);
 
-         }
 
-         #endregion
 
-         #region 
 
-         public void CarrierOutStart(CarrierInfo carrier)
 
-         {
 
-             List<string> crids = CarrierManager.Instance.GetBufferMaterialInfo();
 
-             SECsDataItem BufferMaterialInfos = new SECsDataItem(SECsFormat.List);
 
-             SECsDataItem BufferMaterialInfo = new SECsDataItem(SECsFormat.List);
 
-             foreach (var _id in crids)
 
-             {
 
-                 BufferMaterialInfo = new SECsDataItem(SECsFormat.List);
 
-                 BufferMaterialInfo.Add("StockerName", _id.Split(';')[0], SECsFormat.Ascii);
 
-                 BufferMaterialInfo.Add("StockerCarrierID", _id.Split(';')[1].Replace("emptyid", ""), SECsFormat.Ascii);
 
-                 BufferMaterialInfos.Add(BufferMaterialInfo);
 
-             }
 
-             if (carrier != null)
 
-             {
 
-                 EV.Notify(UniversalEvents.CarrierOutStart, new SerializableDictionary<string, object>()
 
-                 {
 
-                     {DataVariables.Usage,  carrier.CarrierType.ToString()},
 
-                     {DataVariables.CarrierID,  carrier.CarrierId},
 
-                     {DataVariables.BufferCapacitiyList,  GetBufferCapacitiyList()},
 
-                     {DataVariables.BufferMaterialInfo,  BufferMaterialInfos},
 
-                 });
 
-             }
 
-         }
 
-         private SECsDataItem GetBufferCapacitiyList()
 
-         {
 
-             SECsDataItem bufinfo = new SECsDataItem(SECsFormat.List);
 
-             bufinfo.Add("BUFPara", "Partition1");
 
-             bufinfo.Add("BUFPara", "General");
 
-             int emptyStocker = 0;
 
-             int totalStocker = 0;
 
-             foreach (var key in Singleton<EquipmentManager>.Instance.Modules.Keys)
 
-             {
 
-                 if (ModuleHelper.IsStocker(key))
 
-                     totalStocker++;
 
-                 if (ModuleHelper.IsStocker(key) && CarrierManager.Instance.CheckNoCarrier(key, 0))
 
-                 {
 
-                     var has = false;
 
-                     foreach (var key1 in Singleton<EquipmentManager>.Instance.Modules.Keys)
 
-                     {
 
-                         if (CarrierManager.Instance.CheckHasCarrier(key1, 0) && CarrierManager.Instance.GetCarrier(key1, 0).InternalModuleName == key)
 
-                         {
 
-                             has = true;
 
-                             break;
 
-                         }
 
-                     }
 
-                     if (has)
 
-                         continue;
 
-                     emptyStocker++;
 
-                 }
 
-             }
 
-             bufinfo.Add("BUFPara", emptyStocker, SECsFormat.U1);
 
-             bufinfo.Add("BUFPara", totalStocker, SECsFormat.U1);
 
-             int unallocatedPartitionCapacity = 0;
 
-             List<ModuleName> checkList = new List<ModuleName>()
 
-                 {
 
-                     ModuleName.LP1,
 
-                     ModuleName.LP2,
 
-                     ModuleName.FIMS1,
 
-                     ModuleName.FIMS2,
 
-                 };
 
-             foreach (var module in checkList)
 
-             {
 
-                 if (CarrierManager.Instance.CheckHasCarrier(module, 0))
 
-                     unallocatedPartitionCapacity++;
 
-             }
 
-             bufinfo.Add("BUFPara", unallocatedPartitionCapacity, SECsFormat.U1);
 
-             return bufinfo;
 
-         }
 
-         public void CarrierOutEnd(CarrierInfo carrier)
 
-         {
 
-             List<string> crids = CarrierManager.Instance.GetBufferMaterialInfo();
 
-             SECsDataItem BufferMaterialInfos = new SECsDataItem(SECsFormat.List);
 
-             SECsDataItem BufferMaterialInfo = new SECsDataItem(SECsFormat.List);
 
-             foreach (var _id in crids)
 
-             {
 
-                 BufferMaterialInfo = new SECsDataItem(SECsFormat.List);
 
-                 BufferMaterialInfo.Add("StockerName", _id.Split(';')[0], SECsFormat.Ascii);
 
-                 BufferMaterialInfo.Add("StockerCarrierID", _id.Split(';')[1].Replace("emptyid", ""), SECsFormat.Ascii);
 
-                 BufferMaterialInfos.Add(BufferMaterialInfo);
 
-             }
 
-             if (carrier != null)
 
-             {
 
-                 EV.Notify(UniversalEvents.CarrierOutEnd, new SerializableDictionary<string, object>()
 
-                 {
 
-                     {DataVariables.Usage,  carrier.CarrierType.ToString()},
 
-                     {DataVariables.BufferCapacitiyList,  GetBufferCapacitiyList()},
 
-                     {DataVariables.BufferMaterialInfo,  BufferMaterialInfos},
 
-                     {DataVariables.CarrierID,  carrier.CarrierId},
 
-                 });
 
-             }
 
-         }
 
-         #endregion
 
-     }
 
-     #endregion
 
- }
 
 
  |