PMModule.cs 68 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Diagnostics;
  4. using System.Linq;
  5. using Aitex.Core.Common;
  6. using Aitex.Core.RT.DataCenter;
  7. using Aitex.Core.RT.Device;
  8. using Aitex.Core.RT.Device.Unit;
  9. using Aitex.Core.RT.Event;
  10. using Aitex.Core.RT.Fsm;
  11. using Aitex.Core.RT.OperationCenter;
  12. using Aitex.Core.RT.Routine;
  13. using Aitex.Core.RT.SCCore;
  14. using Aitex.Core.Util;
  15. using Aitex.Core.Utilities;
  16. using Aitex.Sorter.Common;
  17. using MECF.Framework.Common.Alarms;
  18. using MECF.Framework.Common.DataCenter;
  19. using MECF.Framework.Common.Equipment;
  20. using MECF.Framework.Common.Schedulers;
  21. using MECF.Framework.Common.SubstrateTrackings;
  22. using FurnaceRT.Equipments.PMs.RecipeExecutions;
  23. using FurnaceRT.Equipments.PMs.Routines;
  24. using FurnaceRT.Equipments.Systems;
  25. using Process = FurnaceRT.Equipments.PMs.RecipeExecutions.Process;
  26. using Aitex.Core.Common.DeviceData;
  27. using FurnaceRT.Devices;
  28. using FurnaceRT.Modules.PMs;
  29. using MECF.Framework.Common.Device.Bases;
  30. using Aitex.Core.RT.Log;
  31. using FurnaceRT.Equipments.Boats;
  32. using MECF.Framework.Common.Event;
  33. using System.IO;
  34. using Aitex.Common.Util;
  35. using static Aitex.Core.Common.DeviceData.AITConfigData;
  36. using MECF.Framework.Common.CommonData.SorterDefines;
  37. using MECF.Framework.Common.Utilities;
  38. using System.Windows.Documents;
  39. using MECF.Framework.Common.CommonData.EnumData;
  40. using MECF.Framework.Common.CommonData;
  41. namespace FurnaceRT.Equipments.PMs
  42. {
  43. public partial class PMModule : PMModuleBase, IRecipeExecutor
  44. {
  45. public enum STATE
  46. {
  47. NotInstall,
  48. NotConnected,
  49. Init,
  50. Idle,
  51. Homing,
  52. OpenSlitValve,
  53. CloseSlitValve,
  54. Error,
  55. PrepareTransfer,
  56. PostTransfer,
  57. PreProcess,
  58. PostProcess,
  59. Process,
  60. LeakCheck,
  61. MFCCali,
  62. Paused,
  63. InTransfer,
  64. }
  65. public enum MSG
  66. {
  67. Home,
  68. Connected,
  69. Disconnected,
  70. Transfer,
  71. PrepareTransfer,
  72. PostTransfer,
  73. Reset,
  74. Abort,
  75. Error,
  76. EndIdleRecipe,
  77. OpenSlitValve,
  78. CloseSlitValve,
  79. SelectRecipe,
  80. RunRecipe,
  81. RunIdleRecipe,
  82. RunOtherRecipe,
  83. RecipeSkipStep,
  84. RecipeJumpStep,
  85. RecipePause,
  86. RecipeContinue,
  87. RecipeAbort,
  88. Continue,
  89. SetOnline,
  90. SetOffline,
  91. PostProcess,
  92. Process,
  93. AlarmConditionJumpStep,
  94. LeakCheck,
  95. ToInit,
  96. StartMFCCalibration,
  97. }
  98. public enum ProcessFlowState
  99. {
  100. None,
  101. Idle,
  102. Standby,
  103. Ready,
  104. Run,
  105. End,
  106. Abort,
  107. }
  108. public override bool IsInit
  109. {
  110. get { return FsmState == (int)STATE.Init; }
  111. }
  112. public bool IsBusy
  113. {
  114. get { return !IsInit && !IsError && !IsReady; }
  115. }
  116. public bool IsProcessing
  117. {
  118. get { return FsmState == (int)STATE.Process; }
  119. }
  120. public override bool IsReady
  121. {
  122. get { return FsmState == (int)STATE.Idle && CheckAllMessageProcessed(); }
  123. }
  124. public override bool IsError
  125. {
  126. get
  127. {
  128. return _alarmNumber != 0;
  129. }
  130. }
  131. public event Action<string> OnEnterError;
  132. private PMHomeRoutine _homeRoutine;
  133. private PMLeakCheckRoutine _leakCheckRoutine;
  134. private PreProcess _preprocessRoutine;
  135. private Process _processRoutine;
  136. private PostProcess _postprocessRoutine;
  137. private PMPrepareTransferRoutine _prepareTransferRoutine;
  138. private PMPostTransferRoutine _postTransferRoutine;
  139. private ModuleName _module;
  140. private RecipeRunningInfo _recipeRunningInfo = new RecipeRunningInfo();
  141. private bool _isInit = true;
  142. private bool _isPrepareProcess = true;
  143. private bool _isStandbyStep;
  144. private StatsData _statTubeCleanNumber;
  145. private StatsData _statTubeCleanTime;
  146. private StatsData _statTubeCleanThick;
  147. private StatsData _statBoatCleanNumber;
  148. private StatsData _statBoatCleanTime;
  149. private StatsData _statBoatCleanThick;
  150. private StatsData _statForkCleanNumber;
  151. private StatsData _statForkCleanTime;
  152. private StatsData _statForkCleanThick;
  153. private Stopwatch _processTimer = new Stopwatch();
  154. public List<IoValve> ValveLists = new List<IoValve>();
  155. public List<IoFlowMeter> FlowmeterLists = new List<IoFlowMeter>();
  156. private bool _isExternalSensorConditionBypass;
  157. private bool _isTempStabilizeConditionBypass;
  158. private bool _isPressureStabilizeConditionBypass;
  159. private bool _isReachTempConditionBypass;
  160. private bool _isReachPressureConditionBypass;
  161. private bool _isFinishAutoProfileConditionBypass;
  162. private SerializableDictionary<string, bool> _conditionCheckDic = new SerializableDictionary<string, bool>();
  163. private Dictionary<string, string> _conditionCheckItemDic = new Dictionary<string, string>();
  164. private Stopwatch _waitTimer = new Stopwatch();
  165. public string StringProcessFlowState { get; set; } = ProcessFlowState.Standby.ToString();
  166. public bool IsExcuteRoutineFailed { get; set; }
  167. public bool IsJobProcess { get; private set; }
  168. public string EditRecipeName { get; set; } = string.Empty;
  169. public string EditRecipeStepName { get; set; } = string.Empty;
  170. public bool IsExcuteIdleRecipe { get; set; }
  171. public string ToolType { get; set; }
  172. public PMModule(ModuleName module) : base(SC.GetValue<int>($"Boat.SlotCount"))
  173. {
  174. _module = module;
  175. Module = module.ToString();
  176. Name = module.ToString();
  177. EnumLoop<STATE>.ForEach((item) =>
  178. {
  179. MapState((int)item, item.ToString());
  180. });
  181. EnumLoop<MSG>.ForEach((item) =>
  182. {
  183. MapMessage((int)item, item.ToString());
  184. });
  185. EnableFsm(1, STATE.Idle);
  186. }
  187. public override bool Initialize()
  188. {
  189. IsOnline = true;
  190. InitRoutine();
  191. InitDevice();
  192. InitAUX();
  193. InitInterlock();
  194. InitFsm();
  195. InitOp();
  196. InitData();
  197. InitLeakCheckData();
  198. InitStats();
  199. InitAlarmEvent();
  200. InitScheduleMaintenance();
  201. InitAlarmConditionChecker();
  202. Singleton<EventManager>.Instance.OnAlarmEvent += Instance_OnAlarmEvent;
  203. ToolType = SC.GetStringValue("System.SetUp.ToolType");
  204. #region bufferpurge重启下发
  205. var isEnable = SC.GetValue<bool>("BufferPurge.IsEnable");
  206. if (isEnable)
  207. {
  208. var sequence= SC.GetStringValue("BufferPurge.OperationOrder")?.Split(';');
  209. string[] names = SC.GetStringValue("BufferPurge.NameList")?.Split(';');
  210. if (sequence?.Length > 0&&names?.Length>0)
  211. {
  212. List<PurgeParameter> purge = new List<PurgeParameter>();
  213. foreach (string p in sequence)
  214. {
  215. if (string.IsNullOrWhiteSpace(p)) continue;//Purge1,0,Time(10),Open;
  216. var step = p.Trim().Split(',');
  217. if (step.Length == 4)
  218. {
  219. if (string.IsNullOrEmpty(step[0])) continue;//name
  220. if (names.Contains(step[0]))
  221. {
  222. var index = step[2].IndexOf('(') + 1;
  223. int.TryParse(step[2].Substring(index, step[2].Length - index - 1), out int time);//仅考虑时间
  224. purge.Add(
  225. 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" });
  226. }
  227. }
  228. }
  229. SetBufferPurge(purge);
  230. }
  231. }
  232. #endregion
  233. return base.Initialize();
  234. }
  235. private void Instance_OnAlarmEvent(EventItem item)
  236. {
  237. if (item != null && item.Level == EventLevel.Alarm && (item.Source == Name || item.Source == Module))
  238. {
  239. var alarm = item as AlarmEventItem;
  240. DEVICE.GetDevice<SignalTowerBase>("System.SignalTower")?.Reset();
  241. LOG.Write($"{item.Source} {item.EventEnum} {item.Description}\n");
  242. //PostMsg(MSG.Error);
  243. }
  244. }
  245. private void InitRoutine()
  246. {
  247. _homeRoutine = new PMHomeRoutine(ModuleHelper.Converter(Module), this);
  248. _leakCheckRoutine = new PMLeakCheckRoutine(ModuleHelper.Converter(Module), this);
  249. _preprocessRoutine = new PreProcess(ModuleHelper.Converter(Module), this);
  250. _processRoutine = new Process(ModuleHelper.Converter(Module), this);
  251. _postprocessRoutine = new PostProcess(ModuleHelper.Converter(Module), this);
  252. _prepareTransferRoutine = new PMPrepareTransferRoutine(Module, this);
  253. _postTransferRoutine = new PMPostTransferRoutine(Module, this);
  254. }
  255. public bool GetRunningModeIsDebug()
  256. {
  257. if (SC.ContainsItem("System.RunningMode"))
  258. {
  259. return SC.GetStringValue("System.RunningMode") == ConfigEnum.Debug.ToString();
  260. }
  261. return true;
  262. }
  263. private void InitData()
  264. {
  265. DATA.Subscribe($"{Module}.IsError", () => IsError);
  266. DATA.Subscribe($"{Module}.Status", () => StringFsmStatus);
  267. DATA.Subscribe($"{Module}.IsOnline", () => IsOnline);
  268. DATA.Subscribe($"{Module}.IsProcessing", () => IsProcessing);
  269. DATA.Subscribe($"{Module}.RunningModeIsDebug", () => GetRunningModeIsDebug());
  270. DATA.Subscribe($"{Module}.EnableMinics", () => SC.ContainsItem("Minics.EnableMinics") ? SC.GetValue<bool>("Minics.EnableMinics") : false);
  271. //DATA.Subscribe($"{Module}.WaferSize", () => WaferManager.Instance.GetWaferSize(_module, 0).ToString());
  272. DATA.Subscribe($"{Module}.IsInMaintainMode", () => !IsOnline);
  273. //DATA.Subscribe($"{Name}.LeakCheckElapseTime", () =>
  274. //{
  275. // if (FsmState == (int)STATE.LeakCheck)
  276. // return _leakCheckRoutine.ElapsedTime;
  277. // return 0;
  278. //});
  279. DATA.Subscribe($"{Name}.ChamberPressure", () => ChamberPressure);
  280. //DATA.Subscribe($"{Name}.VAC1", () => _vac1);
  281. //DATA.Subscribe($"{Name}.VAC2", () => _vac2);
  282. //DATA.Subscribe($"{Name}.VAC3", () => _vac3);
  283. DATA.Subscribe($"{Name}.MainRecipeName", () => _recipeRunningInfo.MainRecipeName);
  284. DATA.Subscribe($"{Name}.SelectedRecipeName", () => _recipeRunningInfo.RecipeName);
  285. DATA.Subscribe($"{Name}.ProcessSubRecipe", () => _recipeRunningInfo.SubRecipeName);
  286. DATA.Subscribe($"{Name}.ProcessSubRecipeTable", () => _recipeRunningInfo.SubRecipeTable);
  287. DATA.Subscribe($"{Name}.ProcessAbortRecipe", () => _recipeRunningInfo.AbortRecipeName);
  288. DATA.Subscribe($"{Name}.AbortRecipeName", () => _recipeRunningInfo.RecipeName);
  289. DATA.Subscribe($"{Name}.SubRecipeCurrentLoopCount", () => _recipeRunningInfo.SubRecipeCurrentLoopCount);
  290. DATA.Subscribe($"{Name}.SubRecipeLoopCount", () => _recipeRunningInfo.SubRecipeLoopCount);
  291. DATA.Subscribe($"{Name}.IsExecuteSubRecipe", () => _processRoutine.IsSubReciep);
  292. DATA.Subscribe($"{Name}.RecipeBeginTime", () => _recipeRunningInfo.BeginTime);
  293. DATA.Subscribe($"{Name}.RecipeStepNumber", () => _recipeRunningInfo.StepNumber);
  294. DATA.Subscribe($"{Name}.RecipeNextStepName", () => _recipeRunningInfo.NextStepName);
  295. DATA.Subscribe($"{Name}.RecipeStepName", () => _recipeRunningInfo.StepName);
  296. DATA.Subscribe($"{Name}.RecipeStepElapseTime", () => _recipeRunningInfo.StepElapseTime);
  297. DATA.Subscribe($"{Name}.RecipeStepTime", () => _recipeRunningInfo.StepTime);
  298. DATA.Subscribe($"{Name}.RecipeTotalElapseTime", () => _recipeRunningInfo.TotalElapseTime);
  299. DATA.Subscribe($"{Name}.RecipeTotalTime", () => _recipeRunningInfo.TotalTime);
  300. DATA.Subscribe($"{Name}.RecipeHoldTime", () => _recipeRunningInfo.HoldTime);
  301. DATA.Subscribe($"{Name}.RecipeHold", () => IsPaused);//按了hold按键
  302. DATA.Subscribe($"{Name}.RecipeHolded", () => IsHolded);//按了hold按键之后,当前step执行完了
  303. DATA.Subscribe($"{Name}.RecipeWait", () => IsWait);//等待wait条件的结束
  304. DATA.Subscribe($"{Name}.NewShowTime", () => GetNewShowTime());
  305. DATA.Subscribe($"{Name}.ExecRecipeType", () => _recipeRunningInfo.ExecRecipeType);
  306. DATA.Subscribe($"{Name}.LoopCountSet", () => _recipeRunningInfo.LoopCountSet);
  307. DATA.Subscribe($"{Name}.LoopCountCurrent", () => _recipeRunningInfo.LoopCountCurrent);
  308. DATA.Subscribe($"{Name}.IsLooping", () => _recipeRunningInfo.IsLooping);
  309. DATA.Subscribe("ProcessFlow.Status", () => StringProcessFlowState);
  310. DATA.Subscribe($"{Name}.ConditionCheck", () => _conditionCheckDic);
  311. //DATA.Subscribe($"{Name}.LZoneHeaterData", () => Heater2.DeviceData.IsLspModeFeedBack ? Heater2.DeviceData : Heater1.DeviceData);
  312. //DATA.Subscribe($"{Name}.CLZoneHeaterData", () => Heater4.DeviceData.IsLspModeFeedBack ? Heater4.DeviceData : Heater3.DeviceData);
  313. //DATA.Subscribe($"{Name}.CZoneHeaterData", () => Heater6.DeviceData.IsLspModeFeedBack ? Heater6.DeviceData : Heater5.DeviceData);
  314. //DATA.Subscribe($"{Name}.CUZoneHeaterData", () => Heater8.DeviceData.IsLspModeFeedBack ? Heater8.DeviceData : Heater7.DeviceData);
  315. //DATA.Subscribe($"{Name}.UZoneHeaterData", () => Heater10.DeviceData.IsLspModeFeedBack ? Heater10.DeviceData : Heater9.DeviceData);
  316. SensorRecipeOK = new AITSensorData()
  317. {
  318. DeviceName = "SensorRecipeOK",
  319. DeviceSchematicId = "SensorRecipe",
  320. DisplayName = "SensorRecipe",
  321. Value = false,
  322. };
  323. DATA.Subscribe($"{Module}.{SensorRecipeOK.DeviceName}", () => SensorRecipeOK);
  324. SensorPROCManualOK = new AITSensorData()
  325. {
  326. DeviceName = "SensorPROCManualOK",
  327. DeviceSchematicId = "PROCManual",
  328. DisplayName = "PROCManual",
  329. Value = false,
  330. };
  331. DATA.Subscribe($"{Module}.{SensorPROCManualOK.DeviceName}", () => SensorPROCManualOK);
  332. DATA.Subscribe($"{Module}.EditRecipeName", () => EditRecipeName);
  333. DATA.Subscribe($"{Module}.EditRecipeStepName", () => EditRecipeStepName);
  334. DATA.Subscribe($"{Module}.HTR1Enable", () => IsHTR1Enable);
  335. DATA.Subscribe($"{Module}.HTR2Enable", () => IsHTR2Enable);
  336. DATA.Subscribe($"{Module}.HTR3Enable", () => IsHTR3Enable);
  337. DATA.Subscribe($"{Module}.IsDPROn", () => _isDPROn);
  338. DATA.Subscribe($"{Module}.IsCEXHOn", () => TrigCEXHON?.Value);
  339. DATA.Subscribe($"{Module}.IsF2ClnOn", () =>
  340. {
  341. return IsF2ClnOn;
  342. });
  343. DATA.Subscribe($"{Module}.IsHFClnOn", () =>
  344. {
  345. return IsHFClnOn;
  346. });
  347. DATA.Subscribe($"{Module}.IsDEPOOn", () => TrigDEPOSW != null ? TrigDEPOSW.Value : false);
  348. DATA.Subscribe($"{Module}.IsCREFOn", () => TrigCREFON != null ? TrigCREFON.Value : false);
  349. DATA.Subscribe($"{Module}.IsSIREFOn", () => TrigSIREFON != null ? TrigSIREFON.Value : false);
  350. DATA.Subscribe($"{Module}.MFCList", () =>
  351. {
  352. List<AITMfcData> aITMfcDataList = new List<AITMfcData>();
  353. var mfcs = DEVICE.GetDevice<PMs.Devices.IoMFC>();
  354. if (mfcs != null)
  355. {
  356. foreach (var item in mfcs)
  357. {
  358. if (item == null) continue;
  359. if (item.IsMFCInstalled)
  360. {
  361. aITMfcDataList.Add(item.DeviceData);
  362. }
  363. }
  364. }
  365. return aITMfcDataList;
  366. });
  367. InitOtherData();
  368. InitN2PurgeData();
  369. }
  370. private void InitStats()
  371. {
  372. _statTubeCleanNumber = new StatsData($"{Module}.Tube Clean Number", "Tube clean number", 0);
  373. _statTubeCleanTime = new StatsData($"{Module}.Tube Clean Time", "Tube clean time(Min)", 0);
  374. _statTubeCleanThick = new StatsData($"{Module}.Tube Clean thick", "Tube clean thick(nm)", 0);
  375. _statBoatCleanNumber = new StatsData($"{Module}.Boat Clean Number", "Boat clean number", 0);
  376. _statBoatCleanTime = new StatsData($"{Module}.Boat Clean Time", "Boat clean time(Min)", 0);
  377. _statBoatCleanThick = new StatsData($"{Module}.Boat Clean thick", "Boat clean thick(nm)", 0);
  378. _statForkCleanNumber = new StatsData($"{Module}.Fork Clean Number", "Fork clean number", 0);
  379. _statForkCleanTime = new StatsData($"{Module}.Fork Clean Time", "Fork clean time(Min)", 0);
  380. _statBoatCleanThick = new StatsData($"{Module}.Boat Clean thick", "Boat clean thick(nm)", 0);
  381. _statForkCleanThick = new StatsData($"{Module}.Fork Clean thick", "Fork clean thick", 0);
  382. }
  383. private void InitOp()
  384. {
  385. OP.Subscribe($"{Module}.Home", (string cmd, object[] args) =>
  386. {
  387. if (!(Singleton<EquipmentManager>.Instance.Modules[ModuleName.WaferRobot] as IModuleDevice).IsReady)
  388. {
  389. TubeHomeFailedWarning.Set($"Wafer Robot is not in ilde state, init failed.");
  390. return false;
  391. }
  392. return CheckToPostMessage((int)MSG.Home);
  393. });
  394. OP.Subscribe($"{Module}.Reset", (string cmd, object[] args) => CheckToPostMessage((int)MSG.Reset));
  395. OP.Subscribe($"{Module}.Abort", (string cmd, object[] args) => CheckToPostMessage((int)MSG.Abort));
  396. OP.Subscribe($"{Module}.PutOnline", (string cmd, object[] args) => CheckToPostMessage((int)MSG.SetOnline));
  397. OP.Subscribe($"{Module}.PutOffline", (string cmd, object[] args) => CheckToPostMessage((int)MSG.SetOffline));
  398. OP.Subscribe($"{Name}.SelectRecipe", (string cmd, object[] args) => CheckToPostMessage((int)MSG.SelectRecipe, args[0]));
  399. OP.Subscribe($"{Name}.RunRecipe", (string cmd, object[] args) => CheckToPostMessage((int)MSG.RunRecipe, (string)args[0]));
  400. OP.Subscribe($"{Name}.RecipeSkipStep", (string cmd, object[] args) => CheckToPostMessage((int)MSG.RecipeSkipStep));
  401. OP.Subscribe($"{Name}.RecipeJumpStep", (string cmd, object[] args) => CheckToPostMessage((int)MSG.RecipeJumpStep, args[0], args[1]));
  402. OP.Subscribe($"{Name}.RecipePause", (string cmd, object[] args) => CheckToPostMessage((int)MSG.RecipePause));
  403. OP.Subscribe($"{Name}.RecipeContinue", (string cmd, object[] args) => CheckToPostMessage((int)MSG.RecipeContinue));
  404. OP.Subscribe($"{Name}.RecipeAbort", (string cmd, object[] args) => CheckToPostMessage((int)MSG.RecipeAbort));
  405. OP.Subscribe($"{Name}.RecipeIdle", (string cmd, object[] args) => CheckToPostMessage((int)MSG.RunIdleRecipe));
  406. OP.Subscribe($"{Name}.LeakCheck", (string cmd, object[] args) => CheckToPostMessage((int)MSG.LeakCheck, args[0], args[1], args[2], args[3]));
  407. OP.Subscribe($"{Name}.Wait", (string cmd, object[] args) =>
  408. {
  409. IsWait = !IsWait;
  410. return true;
  411. });
  412. OP.Subscribe($"{Module}.AlarmAction", (string cmd, object[] args) =>
  413. {
  414. Enum.TryParse(args[0].ToString(), out AlarmAction alarmAction);
  415. string eventName = null;
  416. if (args.Length > 1)
  417. eventName = args[1].ToString();
  418. if (eventName != null)
  419. {
  420. EV.ClearAlarmEvent(eventName);
  421. var item = _triggeredAlarmList.FirstOrDefault(x => x.EventEnum == eventName);
  422. if (item != null)
  423. {
  424. item.Reset();
  425. _triggeredAlarmList.Remove(item);
  426. }
  427. if (item != null)
  428. {
  429. switch (alarmAction)
  430. {
  431. case AlarmAction.Retry:
  432. {
  433. CheckToPostMessage((int)item.RetryMessage, item.RetryMessageParas);
  434. }
  435. break;
  436. case AlarmAction.Abort:
  437. {
  438. CheckToPostMessage((int)MSG.Abort);
  439. }
  440. break;
  441. case AlarmAction.Clear:
  442. {
  443. int alarmCount = 0;
  444. var alarms = EV.GetAlarmEvent();
  445. foreach (var alarm in alarms)
  446. {
  447. if (alarm.Level == EventLevel.Alarm && alarm.Source == Name)
  448. alarmCount++;
  449. }
  450. if (alarmCount == 0 && !IsProcessing)
  451. {
  452. CheckToPostMessage((int)MSG.Reset);
  453. _alarmNumber = 0;
  454. }
  455. }
  456. break;
  457. case AlarmAction.Continue:
  458. {
  459. int alarmCount = 0;
  460. var alarms = EV.GetAlarmEvent();
  461. foreach (var alarm in alarms)
  462. {
  463. if (alarm.Level == EventLevel.Alarm && alarm.Source == Name)
  464. alarmCount++;
  465. }
  466. if (alarmCount == 0)
  467. CheckToPostMessage((int)MSG.Reset);
  468. }
  469. break;
  470. case AlarmAction.ClearAll:
  471. ResetAUXTrig();
  472. break;
  473. }
  474. }
  475. }
  476. return true;
  477. });
  478. OP.Subscribe($"{Name}.SetConditionCheck", SetConditionCheck);
  479. OP.Subscribe($"{Name}.SetBoatZAxisMotion", SetBoatZAxisMotion);
  480. OP.Subscribe($"{Name}.SetBoatRAxisMotion", SetBoatRAxisMotion);
  481. OP.Subscribe($"{Name}.SetAutoShutterUp", SetAutoShutterUp);
  482. OP.Subscribe($"{Name}.SetAutoShutterOpen", SetAutoShutterOpen);
  483. OP.Subscribe($"{Name}.SetAutoShutterRotateOpen", SetAutoShutterRotateOpen);
  484. OP.Subscribe($"{Name}.BypassStandbyFactor", SeBypassStandbyFactor);
  485. OP.Subscribe($"{Name}.SetCommand", SetCommand);
  486. OP.Subscribe($"{Name}.SetN2PurgeMode", SetN2PurgeMode);
  487. OP.Subscribe($"{Name}.SetAllFFUPower", (out string reason, int time, object[] param) =>
  488. {
  489. reason = string.Empty;
  490. SetAllFFUPower(param);
  491. return true;
  492. });
  493. //OP.Subscribe($"{Name}.SetTemperatureDetail",)
  494. OP.Subscribe($"{Name}.SetSensorRecipeOK", SetSensorRecipeOK);
  495. OP.Subscribe($"{Name}.SetSensorPROCManualOK", SetSensorPROCManualOK);
  496. OP.Subscribe($"{Name}.SetEditRecipeName", SetEditRecipeName);
  497. OP.Subscribe($"{Name}.SetEditRecipeStepName", SetEditRecipeStepName);
  498. OP.Subscribe($"{Name}.Heater.SetParameters", (out string reason, int time, object[] param) =>
  499. {
  500. reason = string.Empty;
  501. //Mode参数;Correct Table;PID Table
  502. //"Heater;Parameter\\TempCorrection\\tempCorrect,2,Name2;Parameter\\TempPID\\tempPID,3,Name3"
  503. SetHeaterControlParameters(param);
  504. return true;
  505. });
  506. OP.Subscribe($"{Name}.Heater.SetPID", (out string reason, int time, object[] param) =>
  507. {
  508. reason = string.Empty;
  509. SetHeaterPIDParameters(param[0].ToString());
  510. return true;
  511. });
  512. OP.Subscribe($"{Name}.Heater.SetCorrect", (out string reason, int time, object[] param) =>
  513. {
  514. reason = string.Empty;
  515. SetHeaterCorrectParameters(param[0].ToString());
  516. return true;
  517. });
  518. //Recipe
  519. OP.Subscribe($"{Name}.SetBoatMotion", (out string reason, int time, object[] param) =>
  520. {
  521. reason = string.Empty;
  522. SetBoatMotion(param);
  523. return true;
  524. });
  525. //Recipe
  526. OP.Subscribe($"{Name}.SetValves", (out string reason, int time, object[] param) =>
  527. {
  528. reason = string.Empty;
  529. SetValves(param);
  530. return true;
  531. });
  532. //Recipe
  533. OP.Subscribe($"{Name}.SetAlarmConditionTable", (out string reason, int time, object[] param) =>
  534. {
  535. reason = string.Empty;
  536. SetAlarmConditionTable(param);
  537. return true;
  538. });
  539. //manual
  540. OP.Subscribe($"{Name}.SetAlarmConditionParameter", (out string reason, int time, object[] param) =>
  541. {
  542. reason = string.Empty;
  543. InitAlarmCondition(param[0].ToString());
  544. SetAlarmConditionTable(new object[1] { param[1] });
  545. return true;
  546. });
  547. OP.Subscribe($"{Name}.SetBoatManualMotion", (out string reason, int time, object[] param) =>
  548. {
  549. reason = string.Empty;
  550. SetBoatManualMotion(param);
  551. return true;
  552. });
  553. OP.Subscribe($"{Name}.SetBWREnable", (out string reason, int time, object[] param) =>
  554. {
  555. reason = string.Empty;
  556. SetBWREnable(param);
  557. return true;
  558. });
  559. OP.Subscribe($"{Name}.SetF2ClnEnable", (out string reason, int time, object[] param) =>
  560. {
  561. reason = string.Empty;
  562. SetF2ClnEnable(param);
  563. return true;
  564. });
  565. OP.Subscribe($"{Name}.SetHFClnEnable", (out string reason, int time, object[] param) =>
  566. {
  567. reason = string.Empty;
  568. SetHFClnEnable(param);
  569. return true;
  570. });
  571. OP.Subscribe($"{Name}.SetDEPOEnable", (out string reason, int time, object[] param) =>
  572. {
  573. reason = string.Empty;
  574. SetDEPOEnable(param);
  575. return true;
  576. });
  577. OP.Subscribe($"{Name}.SetHTR1Enable", (out string reason, int time, object[] param) =>
  578. {
  579. reason = string.Empty;
  580. SetHTR1Enable(param);
  581. return true;
  582. });
  583. OP.Subscribe($"{Name}.SetHTR2Enable", (out string reason, int time, object[] param) =>
  584. {
  585. reason = string.Empty;
  586. SetHTR2Enable(param);
  587. return true;
  588. });
  589. OP.Subscribe($"{Name}.SetHTR3Enable", (out string reason, int time, object[] param) =>
  590. {
  591. reason = string.Empty;
  592. SetHTR3Enable(param);
  593. return true;
  594. });
  595. OP.Subscribe($"{Name}.SetCEXHEnable", (out string reason, int time, object[] param) =>
  596. {
  597. reason = string.Empty;
  598. SetCEXHEnable(param);
  599. return true;
  600. });
  601. OP.Subscribe($"{Name}.AUX.SetParameters", (out string reason, int time, object[] param) =>
  602. {
  603. reason = string.Empty;
  604. //Mode参数;Correct Table;PID Table
  605. //"Heater;Parameter\\TempCorrection\\tempCorrect,2,Name2;Parameter\\TempPID\\tempPID,3,Name3"
  606. SetAUXParameters(param);
  607. return true;
  608. });
  609. OP.Subscribe($"{Module}.SetAllMfcVirtualValue", (out string reason, int time, object[] param) =>
  610. {
  611. reason = string.Empty;
  612. var dict = param[0] as Dictionary<string, string>;
  613. foreach (var item in dict)
  614. {
  615. var mfc = _processMFCs.FirstOrDefault(x => x.Name == item.Key);
  616. if (mfc != null)
  617. {
  618. mfc.SetMfcVirtualValue(out reason, 0, new object[] { item.Value });
  619. }
  620. }
  621. return true;
  622. });
  623. OP.Subscribe($"{Module}.SetAllMfcValue", (out string reason, int time, object[] param) =>
  624. {
  625. reason = string.Empty;
  626. var dict = param[0] as Dictionary<string, string>;
  627. foreach (var item in dict)
  628. {
  629. var mfc = _processMFCs.FirstOrDefault(x => x.Name == item.Key);
  630. if (mfc != null)
  631. { mfc.SetMfcValue(out reason, 0, new object[] { item.Value }); }
  632. }
  633. return true;
  634. });
  635. OP.Subscribe($"{Module}.SetAllMfcSetPoint", (out string reason, int time, object[] param) =>
  636. {
  637. reason = string.Empty;
  638. var dict = param[0] as Dictionary<string, string>;
  639. foreach (var item in dict)
  640. {
  641. var mfc = _processMFCs.FirstOrDefault(x => x.Name == item.Key);
  642. if (mfc != null)
  643. { mfc.SetMfcSetPoint(out reason, 0, new object[] { item.Value }); }
  644. }
  645. return true;
  646. });
  647. OP.Subscribe($"{Module}.SetAll{AITValveOperation.GVVirtualTurnValve}", (out string reason, int time, object[] param) =>
  648. {
  649. reason = string.Empty;
  650. var dict = param[0] as Dictionary<string, bool>;
  651. foreach (var item in dict)
  652. {
  653. var valve = _valves.FirstOrDefault(x => x.Name == item.Key);
  654. if (valve != null)
  655. {
  656. valve.InvokeOpenCloseVirtualValve("", new object[] { item.Value });
  657. }
  658. }
  659. return true;
  660. });
  661. OP.Subscribe($"{Module}.SetAll{AITValveOperation.GVTurnValve}", (out string reason, int time, object[] param) =>
  662. {
  663. reason = string.Empty;
  664. var dict = param[0] as Dictionary<string, bool>;
  665. foreach (var item in dict)
  666. {
  667. _valves.FirstOrDefault(x => x.Name == item.Key).InvokeOpenCloseValve("", new object[] { item.Value });
  668. }
  669. return true;
  670. });
  671. OP.Subscribe($"{Name}.SetCREFEnable", (out string reason, int time, object[] param) =>
  672. {
  673. reason = string.Empty;
  674. SetCREFEnable(param);
  675. return true;
  676. });
  677. OP.Subscribe($"{Name}.SetSIREFEnable", (out string reason, int time, object[] param) =>
  678. {
  679. reason = string.Empty;
  680. SetSIREFEnable(param);
  681. return true;
  682. });
  683. OP.Subscribe($"{Name}.SetBufferPurge", (out string reason, int time, object[] param) =>
  684. {
  685. reason = string.Empty;
  686. if (param.Length > 0 && param[0] is List<PurgeParameter> purge)
  687. {
  688. reason= SetBufferPurge(purge);
  689. if (!string.IsNullOrEmpty(reason)) return false;
  690. SC.SetItemValue("BufferPurge.OperationOrder", $"{purge[0].Name},{purge[0].Speed},Time({purge[0].Time}),{(purge[0].IsOpen ? "Open" : (purge[0].IsClose?"Close":""))}");
  691. }
  692. return true;
  693. });
  694. InitOtherOP();
  695. }
  696. private string SetBufferPurge(List<PurgeParameter> purge)
  697. {
  698. string reason = string.Empty;
  699. if (TrigBufferPurgeTime == null || TrigBufferN2PurageEN == null) { reason = "TrigBufferPurgeTime/TrigBufferN2PurageEN is null"; }
  700. if (purge[0].IsOpen || purge[0].IsClose)
  701. {
  702. if (TrigBufferPurgeTime.SetAOTrigger(purge[0].Time, out reason))
  703. {
  704. TrigBufferN2PurageEN.SetTrigger(purge[0].IsOpen, out reason);
  705. }
  706. }
  707. return reason;
  708. }
  709. public void SetTemperatureDetail()
  710. {
  711. }
  712. private void InitFsm()
  713. {
  714. //Error
  715. Transition(STATE.Error, MSG.Reset, FsmReset, STATE.Idle);
  716. AnyStateTransition(MSG.Error, FsmOnError, STATE.Error);
  717. AnyStateTransition(MSG.Disconnected, FsmOnDisconnect, STATE.NotConnected);
  718. EnterExitTransition<STATE, FSM_MSG>(STATE.Error, FsmEnterError, FSM_MSG.NONE, FsmExitError);
  719. Transition(STATE.Idle, MSG.Abort, null, STATE.Idle);
  720. Transition(STATE.Idle, MSG.Reset, null, STATE.Idle);
  721. Transition(STATE.Init, MSG.Reset, null, STATE.Idle);
  722. Transition(STATE.Error, MSG.Abort, null, STATE.Error);
  723. //init
  724. Transition(STATE.Init, MSG.Home, FsmStartHome, STATE.Homing);
  725. AnyStateTransition(MSG.ToInit, FsmToInit, STATE.Init);
  726. //not connected
  727. Transition(STATE.NotConnected, MSG.Connected, null, STATE.Init);
  728. //Home
  729. EnterExitTransition((int)STATE.Homing, FsmEnterHome, (int)FSM_MSG.NONE, FsmExitHome);
  730. Transition(STATE.Error, MSG.Home, FsmStartHome, STATE.Homing);
  731. Transition(STATE.Idle, MSG.Home, FsmStartHome, STATE.Homing);
  732. Transition(STATE.Homing, FSM_MSG.TIMER, FsmMonitorHomeTask, STATE.Idle);
  733. Transition(STATE.Homing, MSG.Error, null, STATE.Init);
  734. Transition(STATE.Homing, MSG.Abort, FsmAbortTask, STATE.Init);
  735. //PrepareTransfer
  736. Transition(STATE.Idle, MSG.PrepareTransfer, FsmStartPrepareTransfer, STATE.PrepareTransfer);
  737. Transition(STATE.PrepareTransfer, FSM_MSG.TIMER, FsmMonitorTask, STATE.Idle);
  738. Transition(STATE.PrepareTransfer, MSG.Abort, FsmAbortTask, STATE.Idle);
  739. //PostTransfer
  740. Transition(STATE.InTransfer, MSG.PostTransfer, FsmStartPostTransfer, STATE.PostTransfer);
  741. Transition(STATE.Idle, MSG.PostTransfer, FsmStartPostTransfer, STATE.PostTransfer);
  742. Transition(STATE.PostTransfer, FSM_MSG.TIMER, FsmMonitorTask, STATE.Idle);
  743. Transition(STATE.PostTransfer, MSG.Abort, FsmAbortTask, STATE.Idle);
  744. //online
  745. Transition(STATE.Idle, MSG.SetOnline, FsmStartSetOnline, STATE.Idle);
  746. Transition(STATE.Idle, MSG.SetOffline, FsmStartSetOffline, STATE.Idle);
  747. //Leak check
  748. Transition(STATE.Idle, MSG.LeakCheck, FsmStartLeakCheck, STATE.LeakCheck);
  749. Transition(STATE.LeakCheck, FSM_MSG.TIMER, FsmMonitorTask, STATE.Idle);
  750. Transition(STATE.LeakCheck, MSG.Abort, FsmAbortTask, STATE.Idle);
  751. EnterExitTransition<STATE, FSM_MSG>(STATE.LeakCheck, FsmEnterLeakCheck, FSM_MSG.NONE, FsmExitLeakCheck);
  752. //open SlitValve
  753. Transition(STATE.Idle, MSG.OpenSlitValve, FsmStartOpenSlitValve, STATE.OpenSlitValve);
  754. Transition(STATE.OpenSlitValve, FSM_MSG.TIMER, FsmMonitorTask, STATE.Idle);
  755. Transition(STATE.OpenSlitValve, MSG.Abort, FsmAbortTask, STATE.Idle);
  756. //close SlitValve
  757. Transition(STATE.Idle, MSG.CloseSlitValve, FsmStartCloseSlitValve, STATE.CloseSlitValve);
  758. Transition(STATE.CloseSlitValve, FSM_MSG.TIMER, FsmMonitorTask, STATE.Idle);
  759. Transition(STATE.CloseSlitValve, MSG.Abort, FsmAbortTask, STATE.Idle);
  760. //PreProcess
  761. Transition(STATE.Process, MSG.RunIdleRecipe, FsmStartIdleRecipePreProcess, STATE.PreProcess);
  762. Transition(STATE.Process, MSG.RunOtherRecipe, FsmStartOtherRecipePreProcess, STATE.PreProcess);
  763. Transition(STATE.Idle, MSG.RunOtherRecipe, FsmStartOtherRecipePreProcess, STATE.PreProcess);
  764. Transition(STATE.Idle, MSG.SelectRecipe, FsmSelectRecipe, STATE.Idle);
  765. Transition(STATE.Idle, MSG.RunRecipe, FsmStartPreProcess, STATE.PreProcess);
  766. Transition(STATE.PreProcess, FSM_MSG.TIMER, FsmMonitorTask, STATE.PreProcess);
  767. Transition(STATE.PreProcess, MSG.Abort, FsmAbortTask, STATE.Idle);
  768. Transition(STATE.PreProcess, MSG.RecipeAbort, FsmAbortTask, STATE.Idle);
  769. //Process
  770. Transition(STATE.PreProcess, MSG.Process, FsmStartProcess, STATE.Process);
  771. Transition(STATE.Idle, MSG.AlarmConditionJumpStep, FsmStartAlarmConditionJumpStep, STATE.Process);
  772. Transition(STATE.Process, FSM_MSG.TIMER, FsmMonitorTask, STATE.Process);
  773. Transition(STATE.Process, MSG.Abort, FsmAbortTask, STATE.Idle);
  774. Transition(STATE.Process, MSG.EndIdleRecipe, null, STATE.Idle);
  775. EnterExitTransition<STATE, FSM_MSG>(STATE.Process, FsmEnterProcess, FSM_MSG.NONE, FsmExitProcess);
  776. Transition(STATE.Paused, FSM_MSG.TIMER, FsmMonitorTask, STATE.Paused);
  777. Transition(STATE.Paused, MSG.Continue, FsmStartContinue, STATE.Process);
  778. Transition(STATE.Paused, MSG.Error, null, STATE.Paused);
  779. Transition(STATE.Paused, MSG.Abort, FsmAbortTask, STATE.Idle);
  780. //Transition(STATE.Paused, MSG.Error, null, STATE.Paused);
  781. Transition(STATE.Process, MSG.RecipeSkipStep, FsmSkipStep, STATE.Process);
  782. Transition(STATE.Process, MSG.RecipeJumpStep, FsmJumpStep, STATE.Process);
  783. Transition(STATE.Process, MSG.RecipePause, FsmRecipePause, STATE.Process);
  784. Transition(STATE.Process, MSG.RecipeContinue, FsmRecipeContinue, STATE.Process);
  785. Transition(STATE.Process, MSG.RecipeAbort, FsmRecipeAbort, STATE.Process);
  786. //PostProcess
  787. Transition(STATE.Process, MSG.PostProcess, FsmStartPostProcess, STATE.PostProcess);
  788. Transition(STATE.PostProcess, FSM_MSG.TIMER, FsmMonitorTask, STATE.Idle);
  789. Transition(STATE.PostProcess, MSG.Abort, FsmAbortTask, STATE.Idle);
  790. EnterExitTransition<STATE, FSM_MSG>(STATE.PostProcess, null, FSM_MSG.NONE, ExitPostProcess);
  791. //MFC Calibration
  792. Transition(STATE.Idle, MSG.StartMFCCalibration, FsmStartMFCCalibration, STATE.MFCCali);
  793. Transition(STATE.MFCCali, FSM_MSG.TIMER, FsmMonitorTask, STATE.Idle);
  794. Transition(STATE.MFCCali, MSG.Abort, FsmAbortTask, STATE.Idle);
  795. }
  796. private bool FsmToInit(object[] param)
  797. {
  798. return true;
  799. }
  800. private bool FsmExitError(object[] param)
  801. {
  802. return true;
  803. }
  804. private bool FsmEnterError(object[] param)
  805. {
  806. if (OnEnterError != null)
  807. OnEnterError(Module);
  808. if (IsOnline)
  809. {
  810. //EV.PostWarningLog(Module, $"{Module}");
  811. }
  812. return true;
  813. }
  814. private bool FsmStartPostTransfer(object[] param)
  815. {
  816. _postTransferRoutine.Init((EnumTransferType)Enum.Parse(typeof(EnumTransferType), (string)param[0]));
  817. Result ret = StartRoutine(_postTransferRoutine);
  818. if (ret == Result.FAIL || ret == Result.DONE)
  819. return false;
  820. return ret == Result.RUN;
  821. }
  822. private bool FsmStartPrepareTransfer(object[] param)
  823. {
  824. _prepareTransferRoutine.Init((EnumTransferType)Enum.Parse(typeof(EnumTransferType), (string)param[0]));
  825. Result ret = StartRoutine(_prepareTransferRoutine);
  826. if (ret == Result.FAIL || ret == Result.DONE)
  827. return false;
  828. return ret == Result.RUN;
  829. }
  830. private bool FsmStartSetOffline(object[] param)
  831. {
  832. IsOnline = false;
  833. return true;
  834. }
  835. private bool FsmStartSetOnline(object[] param)
  836. {
  837. IsOnline = true;
  838. return true;
  839. }
  840. private bool FsmStartLeakCheck(object[] param)
  841. {
  842. _leakCheckRoutine.Init((int)param[0], (int)param[1], (string)param[2], (bool[])param[3]);
  843. Result ret = StartRoutine(_leakCheckRoutine);
  844. if (ret == Result.FAIL || ret == Result.DONE)
  845. return false;
  846. return ret == Result.RUN;
  847. }
  848. private bool FsmEnterLeakCheck(object[] param)
  849. {
  850. return true;
  851. }
  852. private bool FsmExitLeakCheck(object[] param)
  853. {
  854. //ChamberProcessPressureGauge.UnsetTuning();
  855. return true;
  856. }
  857. private bool FsmStartOpenSlitValve(object[] param)
  858. {
  859. return true;
  860. }
  861. private bool FsmStartCloseSlitValve(object[] param)
  862. {
  863. return true;
  864. }
  865. private bool FsmSelectRecipe(object[] param)
  866. {
  867. return true;
  868. }
  869. private bool FsmStartPreProcess(object[] param)
  870. {
  871. _recipeRunningInfo.RecipeName = (string)param[0];
  872. if (!RecipeParser.Parse(_recipeRunningInfo.RecipeName, ModuleName.PM1.ToString(), out var recipeHead, out var recipeSteps, out string reason, "Process"))
  873. {
  874. PreprocessStartFailedWarning.Set($"Load process recipe {_recipeRunningInfo.RecipeName} failed, {reason}");
  875. return false;
  876. }
  877. if (recipeSteps == null || recipeSteps.Count == 0)
  878. {
  879. PreprocessStartFailedWarning.Set($"Process recipe {_recipeRunningInfo.RecipeName} is empty");
  880. return false;
  881. }
  882. string abortRecipeName = SC.ContainsItem("System.Recipe.Abort Recipe") ? SC.GetStringValue("System.Recipe.Abort Recipe") : string.Empty;
  883. if (string.IsNullOrEmpty(abortRecipeName))
  884. {
  885. PreprocessStartFailedWarning.Set($"Load abort recipe failed, recipe file is null");
  886. return false;
  887. }
  888. SC.SetItemValueFromString("PM1.ProcessRecipe", _recipeRunningInfo.RecipeName);
  889. if (!IsJobProcess)
  890. Singleton<EquipmentManager>.Instance.CreatePj((string)param[0]);
  891. _preprocessRoutine.Init((string)param[0]);
  892. Result ret = StartRoutine(_preprocessRoutine);
  893. if (ret == Result.FAIL || ret == Result.DONE)
  894. return false;
  895. if (!IsJobProcess)
  896. SensorPROCManualOK.Value = true;
  897. return ret == Result.RUN;
  898. }
  899. private bool FsmStartOtherRecipePreProcess(object[] param)
  900. {
  901. Singleton<EquipmentManager>.Instance.EndPj("AbnormalEnd");
  902. _processRoutine?.Abort();
  903. IsWait = false;
  904. IsJobProcess = false;
  905. _recipeRunningInfo.RecipeName = param[0].ToString();
  906. var recipeType = param[1].ToString();
  907. var tableID = 1;
  908. if (param.Length > 2)
  909. int.TryParse(param[2].ToString(), out tableID);
  910. if (!RecipeParser.Parse(_recipeRunningInfo.RecipeName, ModuleName.PM1.ToString(), out var recipeHead, out var recipeSteps, out string reason, recipeType, tableID))
  911. {
  912. PreprocessStartFailedWarning.Set($"Load {recipeType} recipe {_recipeRunningInfo.RecipeName} failed {reason}");
  913. return false;
  914. }
  915. if (recipeSteps == null || recipeSteps.Count == 0)
  916. {
  917. PreprocessStartFailedWarning.Set($"{recipeType} recipe {_recipeRunningInfo.RecipeName} is empty");
  918. return false;
  919. }
  920. if (!IsJobProcess)
  921. Singleton<EquipmentManager>.Instance.CreatePj(_recipeRunningInfo.RecipeName);
  922. _preprocessRoutine.Init(_recipeRunningInfo.RecipeName, false);
  923. RecipeRunningInfo.MainRecipeName = _recipeRunningInfo.RecipeName;
  924. RecipeRunningInfo.Head = recipeHead;
  925. RecipeRunningInfo.RecipeStepList = recipeSteps;
  926. RecipeRunningInfo.RecipeName = _recipeRunningInfo.RecipeName;
  927. Result ret = StartRoutine(_preprocessRoutine);
  928. if (ret == Result.FAIL || ret == Result.DONE)
  929. return false;
  930. if (!IsJobProcess)
  931. SensorPROCManualOK.Value = true;
  932. return ret == Result.RUN;
  933. }
  934. private bool FsmStartIdleRecipePreProcess(object[] param)
  935. {
  936. if (!CheckBoatState())
  937. {
  938. PreprocessStartFailedWarning.Set($"boat is not ready");
  939. return false;
  940. }
  941. Singleton<EquipmentManager>.Instance.EndPj("AbnormalEnd");
  942. _recipeRunningInfo.RecipeName = SC.ContainsItem("System.Recipe.Idle Recipe") ? SC.GetStringValue("System.Recipe.Idle Recipe") : string.Empty;
  943. if (!RecipeParser.Parse(_recipeRunningInfo.RecipeName, ModuleName.PM1.ToString(), out var recipeHead, out var recipeSteps, out string reason, "Idle"))
  944. {
  945. PreprocessStartFailedWarning.Set($"Load idle recipe {_recipeRunningInfo.RecipeName} failed {reason}");
  946. return false;
  947. }
  948. if (recipeSteps == null || recipeSteps.Count == 0)
  949. {
  950. PreprocessStartFailedWarning.Set($"Process recipe {_recipeRunningInfo.RecipeName} is empty");
  951. return false;
  952. }
  953. if (!IsJobProcess)
  954. Singleton<EquipmentManager>.Instance.CreatePj(_recipeRunningInfo.RecipeName);
  955. _preprocessRoutine.Init(_recipeRunningInfo.RecipeName, false);
  956. RecipeRunningInfo.MainRecipeName = _recipeRunningInfo.RecipeName;
  957. RecipeRunningInfo.Head = recipeHead;
  958. RecipeRunningInfo.RecipeStepList = recipeSteps;
  959. RecipeRunningInfo.RecipeName = _recipeRunningInfo.RecipeName;
  960. RecipeRunningInfo.ExecRecipeType = recipeSteps.Count > 0 ? recipeSteps[0].RecipeType : string.Empty;
  961. Result ret = StartRoutine(_preprocessRoutine);
  962. if (ret == Result.FAIL || ret == Result.DONE)
  963. return false;
  964. if (!IsJobProcess)
  965. SensorPROCManualOK.Value = true;
  966. return ret == Result.RUN;
  967. }
  968. private bool FsmStartProcess(object[] param)
  969. {
  970. Result ret = StartRoutine(_processRoutine);
  971. if (ret == Result.FAIL || ret == Result.DONE)
  972. return false;
  973. if (ret == Result.RUN && !IsJobProcess)
  974. Singleton<EquipmentManager>.Instance.StartPj();
  975. return ret == Result.RUN;
  976. }
  977. private bool FsmStartAlarmConditionJumpStep(object[] param)
  978. {
  979. if (param != null && param.Length > 0)
  980. {
  981. int.TryParse(param[0].ToString(), out int jumpStep);
  982. _processRoutine.AlarmConditionJumpStep = jumpStep;
  983. Result ret = StartRoutine(_processRoutine);
  984. if (ret == Result.FAIL || ret == Result.DONE)
  985. return false;
  986. return ret == Result.RUN;
  987. }
  988. return false;
  989. }
  990. private bool FsmEnterProcess(object[] param)
  991. {
  992. for (int i = 0; i < SC.GetValue<int>($"Boat.SlotCount"); i++)
  993. {
  994. if (!WaferManager.Instance.CheckHasWafer(ModuleHelper.Converter(Module), i))
  995. continue;
  996. WaferManager.Instance.UpdateWaferProcessStatus(ModuleHelper.Converter(Module), i, EnumWaferProcessStatus.InProcess);
  997. }
  998. _processTimer.Restart();
  999. return true;
  1000. }
  1001. private bool FsmExitProcess(object[] param)
  1002. {
  1003. _processRoutine.ExitProcess();
  1004. if (!IsJobProcess && !_processRoutine.IsExecuteAbort)//非jobprocess需要recipe结束也需要更新数据库
  1005. {
  1006. var firstPjId = Singleton<EquipmentManager>.Instance.GetFirstPJId();
  1007. Singleton<EquipmentManager>.Instance.EndPj();
  1008. }
  1009. //_statWaferCount.Increase();
  1010. //_statProcessTime.Increase((int)(_processTimer.ElapsedMilliseconds/1000));
  1011. _isPrepareProcess = true;
  1012. IsJobProcess = false;
  1013. SensorPROCManualOK.Value = false;
  1014. //if (SC.GetStringValue($"System.Recipe.ExcuteAfterRecipeComplete") == "StandbyStep")
  1015. //{
  1016. // StringProcessFlowState = ProcessFlowState.Standby.ToString();
  1017. // _recipeRunningInfo.StepName = "Standby";
  1018. // var standbyStep = _recipeRunningInfo.RecipeStepList.Where(x => x.StepName == "Standby").FirstOrDefault();
  1019. // if (standbyStep != null)
  1020. // {
  1021. // EV.PostInfoLog(Module, $"Recipe {_recipeRunningInfo.RecipeName} complete excute standby step");
  1022. // foreach (var recipeCmd in standbyStep.RecipeCommands.Keys)
  1023. // {
  1024. // if (!OP.CanDoOperation($"{Module}.{recipeCmd}", out string reason, standbyStep.RecipeCommands[recipeCmd]))
  1025. // {
  1026. // if (!OP.CanDoOperation($"{ModuleName.PM1}.{recipeCmd}", out reason, standbyStep.RecipeCommands[recipeCmd]))
  1027. // {
  1028. // if (!OP.CanDoOperation($"{ModuleName.System}.{recipeCmd}", out reason, standbyStep.RecipeCommands[recipeCmd]))
  1029. // {
  1030. // reason = $"Can not execute {recipeCmd}, {reason}";
  1031. // return false;
  1032. // }
  1033. // else
  1034. // {
  1035. // OP.DoOperation($"{ModuleName.System}.{recipeCmd}", out string reason1, 0, standbyStep.RecipeCommands[recipeCmd]);
  1036. // }
  1037. // }
  1038. // else
  1039. // {
  1040. // OP.DoOperation($"{ModuleName.PM1}.{recipeCmd}", out string reason1, 0, standbyStep.RecipeCommands[recipeCmd]);
  1041. // }
  1042. // }
  1043. // else
  1044. // {
  1045. // OP.DoOperation($"{Module}.{recipeCmd}", out string reason1, 0, standbyStep.RecipeCommands[recipeCmd]);
  1046. // }
  1047. // }
  1048. // }
  1049. // _isStandbyStep = true;
  1050. // IsExcuteIdleRecipe = false;
  1051. //}
  1052. //else if (SC.GetStringValue($"System.Recipe.ExcuteAfterRecipeComplete") == "IdleRecipe")
  1053. //{
  1054. // if (!IsExcuteIdleRecipe)
  1055. // {
  1056. // PostMsg((int)MSG.RunIdleRecipe);
  1057. // IsExcuteIdleRecipe = true;
  1058. // }
  1059. // else
  1060. // {
  1061. // IsExcuteIdleRecipe = false;
  1062. // _isStandbyStep = false;
  1063. // }
  1064. //}
  1065. //else
  1066. //{
  1067. // IsExcuteIdleRecipe = false;
  1068. // _isStandbyStep = false;
  1069. //}
  1070. return true;
  1071. }
  1072. public string GetN2PurgeModeEnumByStr(string str)
  1073. {
  1074. if ((str == N2PurgeModeEnum.ATMMode.ToString()) || (str == N2PurgeModeEnum.ATMMode.ToDescription()) || (str.StartsWith("ATM")))
  1075. {
  1076. return N2PurgeModeEnum.ATMMode.ToString();
  1077. }
  1078. if ((str == N2PurgeModeEnum.N2PurgeMode.ToString()) || (str == N2PurgeModeEnum.N2PurgeMode.ToDescription()) || (str.StartsWith("N2")))
  1079. {
  1080. return N2PurgeModeEnum.N2PurgeMode.ToString();
  1081. }
  1082. return N2PurgeModeEnum.ManualMode.ToString();
  1083. }
  1084. private bool FsmStartContinue(object[] param)
  1085. {
  1086. return true;
  1087. }
  1088. private bool FsmSkipStep(object[] param)
  1089. {
  1090. _processRoutine.SkipCurrentRecipeStep();
  1091. return true;
  1092. }
  1093. private bool FsmJumpStep(object[] param)
  1094. {
  1095. int.TryParse(param[0].ToString(), out int stepNumber);
  1096. _processRoutine.JumpCurrentRecipeStep(stepNumber, param[1].ToString());
  1097. return true;
  1098. }
  1099. private bool FsmRecipePause(object[] param)
  1100. {
  1101. _processRoutine.PauseRecipe();
  1102. return true;
  1103. }
  1104. private bool FsmRecipeContinue(object[] param)
  1105. {
  1106. _processRoutine.ContinueRecipe();
  1107. return true;
  1108. }
  1109. private bool FsmRecipeAbort(object[] param)
  1110. {
  1111. Singleton<EquipmentManager>.Instance.EndPj("Recipe Abort");
  1112. var firstPjId = Singleton<EquipmentManager>.Instance.GetFirstPJId();
  1113. _processRoutine.UpdateProcessDataPJid(firstPjId);
  1114. _processRoutine.Abort();
  1115. IsWait = false;
  1116. IsJobProcess = false;
  1117. var recipeName = _recipeRunningInfo.Head.AbortRecipe;
  1118. var reason = "";
  1119. if (!File.Exists($"{PathManager.GetRecipeDir()}\\{SC.GetStringValue("System.Recipe.SupportedChamberType")}\\Abort\\{recipeName}.rcp") ||
  1120. !RecipeParser.Parse(recipeName, ModuleName.PM1.ToString(), out var recipeHead, out var recipeSteps, out reason, "Abort"))
  1121. {
  1122. recipeName = SC.GetStringValue("System.Recipe.Abort Recipe");
  1123. if (!File.Exists($"{PathManager.GetRecipeDir()}\\{SC.GetStringValue("System.Recipe.SupportedChamberType")}\\Abort\\{recipeName}.rcp") ||
  1124. !RecipeParser.Parse(SC.GetStringValue("System.Recipe.Abort Recipe"), ModuleName.PM1.ToString(), out recipeHead, out recipeSteps, out reason, "Abort"))
  1125. {
  1126. PostMsg(MSG.Error);
  1127. ExecuteAbortRecipeFailAlarm.Set($"Load abort recipe {recipeName} failed, {reason}");
  1128. return false;
  1129. }
  1130. }
  1131. var recipeType = recipeSteps.Count > 0 ? recipeSteps[0].RecipeType : string.Empty;
  1132. var recipeTable = "";
  1133. if (!string.IsNullOrEmpty(_recipeRunningInfo.Head.AbortRecipe))
  1134. {
  1135. var currectStep = _recipeRunningInfo.RecipeStepList[_processRoutine._currentStepNumber];
  1136. if (string.IsNullOrEmpty(currectStep.AbortRecipeTableInfo))
  1137. {
  1138. if (!RecipeParser.ParseTables(_recipeRunningInfo.Head.AbortRecipe, Module, out var recipeData, out reason, "Abort"))
  1139. {
  1140. ExecuteAbortRecipeFailAlarm.Set($"Load abort recipe {recipeName} failed, {reason}");
  1141. return false;
  1142. }
  1143. else
  1144. {
  1145. recipeTable = recipeData.FirstOrDefault().Key.ToString();
  1146. }
  1147. }
  1148. else
  1149. {
  1150. recipeTable = currectStep.AbortRecipeTableInfo.Split(':').FirstOrDefault();
  1151. }
  1152. }
  1153. else
  1154. {
  1155. if (!RecipeParser.ParseTables(SC.GetStringValue("System.Recipe.Abort Recipe"), Module, out var recipeData, out reason, "Abort"))
  1156. {
  1157. ExecuteAbortRecipeFailAlarm.Set($"Load abort recipe {recipeName} failed, {reason}");
  1158. return false;
  1159. }
  1160. else
  1161. {
  1162. recipeTable = recipeData.FirstOrDefault().Key.ToString();
  1163. }
  1164. }
  1165. CheckToPostMessage((int)MSG.RunOtherRecipe, recipeName, recipeType, recipeTable);
  1166. return true;
  1167. }
  1168. private bool FsmStartPostProcess(object[] param)
  1169. {
  1170. Result ret = StartRoutine(_postprocessRoutine);
  1171. if (ret == Result.FAIL || ret == Result.DONE)
  1172. return false;
  1173. return ret == Result.RUN;
  1174. }
  1175. private bool ExitPostProcess(object[] param)
  1176. {
  1177. return true;
  1178. }
  1179. private bool FsmStartMFCCalibration(object[] param)
  1180. {
  1181. return true;
  1182. }
  1183. private bool FsmOnDisconnect(object[] param)
  1184. {
  1185. if (FsmState == (int)STATE.Error)
  1186. {
  1187. return false;
  1188. }
  1189. return true;
  1190. }
  1191. private bool FsmOnError(object[] param)
  1192. {
  1193. if (FsmState == (int)STATE.Error)
  1194. {
  1195. return false;
  1196. }
  1197. if ((FsmState == (int)STATE.Process) || (FsmState == (int)STATE.PreProcess) || (FsmState == (int)STATE.PostProcess))
  1198. {
  1199. for (int i = 0; i < SC.GetValue<int>($"Boat.SlotCount"); i++)
  1200. {
  1201. if (!WaferManager.Instance.CheckHasWafer(ModuleHelper.Converter(Module), i))
  1202. continue;
  1203. WaferManager.Instance.UpdateWaferProcessStatus(ModuleHelper.Converter(Module), i, EnumWaferProcessStatus.Failed);
  1204. }
  1205. _processRoutine.Abort();
  1206. _postprocessRoutine.Abort();
  1207. _preprocessRoutine.Abort();
  1208. IsWait = false;
  1209. }
  1210. return true;
  1211. }
  1212. private bool FsmReset(object[] param)
  1213. {
  1214. if (!_isInit)
  1215. {
  1216. PostMsg(MSG.ToInit);
  1217. return false;
  1218. }
  1219. foreach (var device in _allModuleDevice)
  1220. {
  1221. if (device.HasAlarm)
  1222. {
  1223. CheckHasAlarmWarning.Set($"{device.Name} has error");
  1224. }
  1225. }
  1226. if (CheckHasAlarm())
  1227. return false;
  1228. return true;
  1229. }
  1230. private bool FsmStartHome(object[] param)
  1231. {
  1232. //if (!CheckIsConnected())
  1233. //{
  1234. // PostMsg(MSG.Disconnected);
  1235. // return false;
  1236. //}
  1237. if (CheckHasAlarm())
  1238. {
  1239. CheckHasAlarmWarning.Set($"There exist active alarm, reset error before continue the initialization");
  1240. PostMsg(MSG.Error);
  1241. return false;
  1242. }
  1243. Result ret = StartRoutine(_homeRoutine);
  1244. if (ret == Result.FAIL || ret == Result.DONE)
  1245. return false;
  1246. _isInit = false;
  1247. return ret == Result.RUN;
  1248. }
  1249. private bool FsmExitHome(object[] param)
  1250. {
  1251. return true;
  1252. }
  1253. private bool FsmEnterHome(object[] param)
  1254. {
  1255. return true;
  1256. }
  1257. private bool FsmAbortTask(object[] param)
  1258. {
  1259. AbortRoutine();
  1260. _isPrepareProcess = true;
  1261. return true;
  1262. }
  1263. private bool FsmMonitorHomeTask(object[] param)
  1264. {
  1265. Result ret = MonitorRoutine();
  1266. if (ret == Result.FAIL)
  1267. {
  1268. PostMsg(MSG.Error);
  1269. return false;
  1270. }
  1271. if (ret == Result.DONE)
  1272. {
  1273. _isInit = true;
  1274. return true;
  1275. }
  1276. return false;
  1277. }
  1278. private bool FsmMonitorTask(object[] param)
  1279. {
  1280. Result ret = MonitorRoutine();
  1281. if (ret == Result.FAIL)
  1282. {
  1283. PostMsg(MSG.Error);
  1284. return false;
  1285. }
  1286. if (ret == Result.DONE && FsmState == (int)STATE.PreProcess)
  1287. {
  1288. PostMsg(MSG.Process);
  1289. return true;
  1290. }
  1291. if (ret == Result.DONE && FsmState == (int)STATE.Process)
  1292. {
  1293. PostMsg(MSG.PostProcess);
  1294. return true;
  1295. }
  1296. if (ret == Result.DONE && IsExcuteIdleRecipe && FsmState == (int)STATE.PostProcess)
  1297. {
  1298. PostMsg(MSG.RunIdleRecipe);
  1299. return true;
  1300. }
  1301. return ret == Result.DONE;
  1302. }
  1303. #region Service functions
  1304. public override bool Home(out string reason)
  1305. {
  1306. CheckToPostMessage((int)MSG.Home);
  1307. reason = string.Empty;
  1308. return true;
  1309. }
  1310. public override void Reset()
  1311. {
  1312. ResetAUXTrig();
  1313. if (!IsProcessing)
  1314. CheckToPostMessage((int)MSG.Reset);
  1315. }
  1316. public override bool PrepareTransfer(ModuleName robot, Hand blade, int targetSlot, EnumTransferType transferType, out string reason)
  1317. {
  1318. CheckToPostMessage((int)MSG.PrepareTransfer, transferType.ToString());
  1319. reason = string.Empty;
  1320. return true;
  1321. }
  1322. public override bool TransferHandoff(ModuleName robot, Hand blade, int targetSlot, EnumTransferType transferType, out string reason)
  1323. {
  1324. reason = string.Empty;
  1325. return true;
  1326. }
  1327. public override bool PostTransfer(ModuleName robot, Hand blade, int targetSlot, EnumTransferType transferType, out string reason)
  1328. {
  1329. CheckToPostMessage((int)MSG.PostTransfer, transferType.ToString());
  1330. reason = string.Empty;
  1331. return true;
  1332. }
  1333. public override bool CheckReadyForTransfer(ModuleName robot, Hand blade, int targetSlot, EnumTransferType transferType, out string reason)
  1334. {
  1335. reason = string.Empty;
  1336. var boat = Singleton<EquipmentManager>.Instance.Modules[ModuleName.Boat] as BoatModule;
  1337. if (!boat.IsBoatElevatorAtHomePosition)
  1338. {
  1339. reason = "Boat z axis is not at home position";
  1340. return false;
  1341. }
  1342. if (!boat.IsBoatRotationAtHomePosition)
  1343. {
  1344. reason = "Boat r axis is not at home position";
  1345. return false;
  1346. }
  1347. return true;
  1348. }
  1349. public override void NoteTransferStart(ModuleName robot, Hand blade, int targetSlot, EnumTransferType transferType)
  1350. {
  1351. //if (FsmState == (int)STATE.InTransfer)
  1352. // CheckToPostMessage(MSG.Transfer)
  1353. }
  1354. public override void NoteTransferStop(ModuleName robot, Hand blade, int targetSlot, EnumTransferType transferType)
  1355. {
  1356. //if (FsmState == (int)STATE.InTransfer)
  1357. // CheckToPostMessage(MSG.Transfer)
  1358. }
  1359. public override bool Process(string recipeName, bool isCleanRecipe, bool withWafer, out string reason)
  1360. {
  1361. _recipeRunningInfo.RecipeName = recipeName;
  1362. _isPrepareProcess = false;
  1363. _isStandbyStep = false;
  1364. IsJobProcess = true;
  1365. IsExcuteIdleRecipe = false;
  1366. CheckToPostMessage((int)MSG.RunRecipe, recipeName);
  1367. reason = string.Empty;
  1368. return true;
  1369. }
  1370. public override bool Standby(string recipeName, out string reason)
  1371. {
  1372. reason = string.Empty;
  1373. _recipeRunningInfo.RecipeName = recipeName;
  1374. _recipeRunningInfo.MainRecipeName = recipeName;
  1375. if (!RecipeParser.Parse(_recipeRunningInfo.RecipeName, ModuleName.PM1.ToString(), out var recipeHead, out var recipeSteps, out reason, "Process"))
  1376. {
  1377. reason = $"Load process recipe {_recipeRunningInfo.RecipeName} failed, {reason}";
  1378. return false;
  1379. }
  1380. if (recipeSteps == null || recipeSteps.Count == 0)
  1381. {
  1382. reason = $"Process recipe {_recipeRunningInfo.RecipeName} is empty";
  1383. return false;
  1384. }
  1385. _isStandbyStep = true;
  1386. var standbyStep = recipeSteps.Where(x => x.StepName == "Standby").FirstOrDefault();
  1387. if (standbyStep != null)
  1388. {
  1389. StringProcessFlowState = ProcessFlowState.Standby.ToString();
  1390. _recipeRunningInfo.StepName = "Standby";
  1391. EV.PostInfoLog(Module, $"pj job excute recipe {recipeName} standby step");
  1392. foreach (var recipeCmd in standbyStep.RecipeCommands.Keys)
  1393. {
  1394. if (!OP.CanDoOperation($"{Module}.{recipeCmd}", out reason, standbyStep.RecipeCommands[recipeCmd]))
  1395. {
  1396. if (!OP.CanDoOperation($"{ModuleName.PM1}.{recipeCmd}", out reason, standbyStep.RecipeCommands[recipeCmd]))
  1397. {
  1398. if (!OP.CanDoOperation($"{ModuleName.System}.{recipeCmd}", out reason, standbyStep.RecipeCommands[recipeCmd]))
  1399. {
  1400. reason = $"Can not execute {recipeCmd}, {reason}";
  1401. return false;
  1402. }
  1403. else
  1404. {
  1405. OP.DoOperation($"{ModuleName.System}.{recipeCmd}", out string reason1, 0, standbyStep.RecipeCommands[recipeCmd]);
  1406. }
  1407. }
  1408. else
  1409. {
  1410. OP.DoOperation($"{ModuleName.PM1}.{recipeCmd}", out string reason1, 0, standbyStep.RecipeCommands[recipeCmd]);
  1411. }
  1412. }
  1413. else
  1414. {
  1415. OP.DoOperation($"{Module}.{recipeCmd}", out string reason1, 0, standbyStep.RecipeCommands[recipeCmd]);
  1416. }
  1417. }
  1418. }
  1419. return true;
  1420. }
  1421. public void EndIdleRecipe()
  1422. {
  1423. CheckToPostMessage((int)MSG.EndIdleRecipe);
  1424. }
  1425. private double GetNewShowTime()
  1426. {
  1427. return GetWaitTime() + _recipeRunningInfo.HoldTime;
  1428. }
  1429. private double GetWaitTime()
  1430. {
  1431. if (StringFsmStatus == "Idle")
  1432. {
  1433. _waitTimer.Reset();
  1434. }
  1435. if (IsWait)
  1436. {
  1437. _waitTimer.Start();
  1438. }
  1439. else
  1440. {
  1441. _waitTimer.Stop();
  1442. }
  1443. return _waitTimer.ElapsedMilliseconds / 1000;
  1444. }
  1445. }
  1446. #endregion
  1447. }