Process.cs 96 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975
  1. using Aitex.Core.Common;
  2. using Aitex.Core.RT.Event;
  3. using Aitex.Core.RT.Log;
  4. using Aitex.Core.RT.OperationCenter;
  5. using Aitex.Core.RT.Routine;
  6. using Aitex.Core.RT.SCCore;
  7. using Aitex.Core.Util;
  8. using MECF.Framework.Common.DBCore;
  9. using MECF.Framework.Common.Equipment;
  10. using MECF.Framework.Common.Alarms;
  11. using MECF.Framework.Common.Event;
  12. using MECF.Framework.Common.SubstrateTrackings;
  13. using System;
  14. using System.Collections.Generic;
  15. using FurnaceRT.Equipments.PMs.Routines;
  16. using System.Diagnostics;
  17. using MECF.Framework.Common.DataCenter;
  18. using System.Runtime.Remoting.Metadata.W3cXsd2001;
  19. using FurnaceRT.Equipments.Systems;
  20. using MECF.Framework.Common.CommonData.EnumData;
  21. using MECF.Framework.Common.FAServices;
  22. using System.Threading.Tasks;
  23. using DocumentFormat.OpenXml.Drawing.Charts;
  24. using MECF.Framework.Common.Device;
  25. using Aitex.Core.Common.DeviceData;
  26. using Aitex.Sorter.Common;
  27. using MECF.Framework.FA.Core.FAControl;
  28. namespace FurnaceRT.Equipments.PMs.RecipeExecutions
  29. {
  30. public enum RecipeContinueMode
  31. {
  32. None,
  33. WaferReturnAndJobStop,
  34. RecipeCompleted,
  35. StepContinue,
  36. StepRestart,
  37. RecipeRestart,
  38. NextStep,
  39. }
  40. public class Process : PMBaseRoutine
  41. {
  42. enum RecipeRunningState
  43. {
  44. Error,
  45. RecipeCompleted,
  46. ExecStep,
  47. TimeWait,
  48. ConditionWait,
  49. StepCompleted,
  50. Paused,
  51. }
  52. enum RecipeAlaramAction
  53. {
  54. None,
  55. JumpAbortRecipe,
  56. JumpStep,
  57. JumpStepCancelCallLoop,
  58. Abort,
  59. Hold,
  60. IgnoreAlaram,
  61. }
  62. private object _recipeLocker = new object();
  63. private RecipeRunningState _state = RecipeRunningState.ExecStep;
  64. private RecipeRunningState _pausedState = RecipeRunningState.ExecStep;
  65. private double _curStepElpasedTimeBeforePaused;
  66. private double _holdTimeElpasedTime;
  67. private double _waferTimeElpasedTimeBeforPaused;
  68. //Add by SSH,20250930,判断recipe是否执行结束,给job使用
  69. public bool IsRecipeCompleted { get { return _state == RecipeRunningState.RecipeCompleted || _state == RecipeRunningState.Error; } }
  70. private double _totalElpasedTime;
  71. public RecipeContinueMode ContinueAction { get; set; }
  72. public DateTime _recipeStartTime
  73. {
  74. get;
  75. private set;
  76. }
  77. public string CurrentRecipeContent { get; private set; }
  78. public int _currentStepNumber;
  79. private int _currentSubRecipeStepNumber;
  80. private bool _loopEnd;
  81. public int CurStepTotalLoopCount
  82. {
  83. get;
  84. private set;
  85. }
  86. public int CurSubRecipeStepTotalLoopCount
  87. {
  88. get;
  89. private set;
  90. }
  91. public double CurStepTotalTime
  92. {
  93. get
  94. {
  95. if (PMModule.RecipeRunningInfo.RecipeStepList == null || PMModule.RecipeRunningInfo.RecipeStepList.Count == 0 || _state == RecipeRunningState.RecipeCompleted || _state == RecipeRunningState.Error)
  96. return 0;
  97. return PMModule.RecipeRunningInfo.RecipeStepList[_currentStepNumber].StepTime * 1000;
  98. }
  99. }
  100. public string FDCRecipeStep { get; set; }
  101. public int CurrentLoopCount
  102. {
  103. get;
  104. private set;
  105. }
  106. public int CurrentAbortRecipeLoopCount
  107. {
  108. get;
  109. private set;
  110. }
  111. public int CurrentSubRecipeLoopCount
  112. {
  113. get;
  114. private set;
  115. }
  116. public bool IsExecuteAbort
  117. {
  118. get;
  119. private set;
  120. }
  121. public bool IsSubReciep
  122. {
  123. get;
  124. private set;
  125. }
  126. public int AlarmConditionJumpStep { get; set; } = -1;
  127. private DeviceTimer _stepTimer = new DeviceTimer();
  128. private DeviceTimer _holdTimer = new DeviceTimer();
  129. private RecipeFACallback _faCallback;
  130. private RecipeDBCallback _dbCallback;
  131. private Fdc _fdc;
  132. private ModuleName _doModule = ModuleName.PM1;
  133. private bool IsJumpStepCancelCallLoop;
  134. private int _jumpStepNumber;
  135. private int _showStepNo;
  136. private int _subRecipeStartStepNumber;
  137. private RecipeAlaramAction _alarmAction = RecipeAlaramAction.None;
  138. public List<string> _alarmNames
  139. {
  140. private set;
  141. get;
  142. }
  143. private R_TRIG _trigHeaterBottomToleranceAlarm = new R_TRIG();
  144. private R_TRIG _trigHeaterBottomToleranceWarning = new R_TRIG();
  145. private R_TRIG _trigHeaterCenterBottomToleranceAlarm = new R_TRIG();
  146. private R_TRIG _trigHeaterCenterBottomToleranceWarning = new R_TRIG();
  147. private R_TRIG _trigHeaterCenterToleranceAlarm = new R_TRIG();
  148. private R_TRIG _trigHeaterCenterToleranceWarning = new R_TRIG();
  149. private R_TRIG _trigHeaterCenterTopToleranceAlarm = new R_TRIG();
  150. private R_TRIG _trigHeaterCenterTopToleranceWarning = new R_TRIG();
  151. private R_TRIG _trigHeaterTopToleranceAlarm = new R_TRIG();
  152. private R_TRIG _trigHeaterTopToleranceWarning = new R_TRIG();
  153. private R_TRIG _trigPressureToleranceAlarm = new R_TRIG();
  154. private R_TRIG _trigPressureToleranceWarning = new R_TRIG();
  155. private R_TRIG _trigInputSignalTimeOutAlarm = new R_TRIG();
  156. private R_TRIG _trigTemperatureConvergenceTimeOutAlarm = new R_TRIG();
  157. private R_TRIG _trigReachTempTimeOutAlarm = new R_TRIG();
  158. private R_TRIG _trigPressureConvergenceTimeOutAlarm = new R_TRIG();
  159. private R_TRIG _trigReachPressureTimeOutAlarm = new R_TRIG();
  160. private R_TRIG _trigAutoProfileTimeOutAlarm = new R_TRIG();
  161. private Dictionary<string, R_TRIG> _trigMfcToleranceAlarms;
  162. private Dictionary<string, R_TRIG> _trigMfcToleranceWarnings;
  163. private R_TRIG _trigBoatMoveToLoadPositionTimeout = new R_TRIG();
  164. private R_TRIG _trigHeaterProfileFinish = new R_TRIG();
  165. private R_TRIG _trigLeakCheckFinish = new R_TRIG();
  166. private R_TRIG _trigBoatWaitCondition = new R_TRIG();
  167. private R_TRIG _trigAPCWaitCondition = new R_TRIG();
  168. private R_TRIG _trigAUXWaitCondition = new R_TRIG();
  169. private R_TRIG _trigHeaterWaitCondition = new R_TRIG();
  170. private R_TRIG _trigMFCWaitCondition = new R_TRIG();
  171. private string _infoHeaterProfileFinish = "";
  172. private string _infoAUXWaitCondition = "";
  173. private string _infoHeaterWaitCondition = "";
  174. private string _infoMFCWaitCondition = "";
  175. private Dictionary<int, Tuple<bool, int>> _callSubSteps = new Dictionary<int, Tuple<bool, int>>();
  176. private bool _isJumpStep = false;
  177. private double _remainTimeExcludeEnd = 0;
  178. public Process(ModuleName module, PMModule pm) : base(module, pm)
  179. {
  180. Module = module.ToString();
  181. Name = "Process";
  182. _trigMfcToleranceAlarms = new Dictionary<string, R_TRIG>()
  183. {
  184. {"MFC61", new R_TRIG() },
  185. {"MFC13", new R_TRIG() },
  186. {"MFC14", new R_TRIG() },
  187. {"MFC15", new R_TRIG() },
  188. {"MFC16", new R_TRIG() },
  189. {"MFC24", new R_TRIG() },
  190. {"MFC25", new R_TRIG() },
  191. {"MFC26", new R_TRIG() },
  192. {"MFC34", new R_TRIG() },
  193. {"MFC35", new R_TRIG() },
  194. {"MFC36", new R_TRIG() },
  195. {"MFC90", new R_TRIG() },
  196. {"MFC91", new R_TRIG() },
  197. {"MFC84", new R_TRIG() },
  198. };
  199. _trigMfcToleranceWarnings = new Dictionary<string, R_TRIG>()
  200. {
  201. {"MFC61", new R_TRIG() },
  202. {"MFC13", new R_TRIG() },
  203. {"MFC14", new R_TRIG() },
  204. {"MFC15", new R_TRIG() },
  205. {"MFC16", new R_TRIG() },
  206. {"MFC24", new R_TRIG() },
  207. {"MFC25", new R_TRIG() },
  208. {"MFC26", new R_TRIG() },
  209. {"MFC34", new R_TRIG() },
  210. {"MFC35", new R_TRIG() },
  211. {"MFC36", new R_TRIG() },
  212. {"MFC90", new R_TRIG() },
  213. {"MFC91", new R_TRIG() },
  214. {"MFC84", new R_TRIG() },
  215. };
  216. _faCallback = new RecipeFACallback();
  217. _dbCallback = new RecipeDBCallback();
  218. _fdc = new Fdc(Module);
  219. }
  220. public override Result Start(params object[] param)
  221. {
  222. CurStepTotalLoopCount = 0;
  223. _currentSubRecipeStepNumber = CurSubRecipeStepTotalLoopCount = 0;
  224. if (AlarmConditionJumpStep > 0)
  225. _currentStepNumber = AlarmConditionJumpStep;
  226. else
  227. _currentStepNumber = PMModule.IsJobProcess ? 1 : 0; // 如果是从Job Process开始,从1开始,跳过standby step
  228. AlarmConditionJumpStep = -1;
  229. PMModule.RecipeRunningInfo.InnerId = Guid.NewGuid();
  230. PMModule.RecipeRunningInfo.BeginTime = DateTime.Now;
  231. PMModule.RecipeRunningInfo.TotalTime = CalcRecipeTime();
  232. if (PMModule.RecipeRunningInfo.TotalTime < 0)
  233. return Result.FAIL;
  234. PMModule.RecipeRunningInfo.RemainTimeExcludeEndStep = _remainTimeExcludeEnd;
  235. IsSubReciep = false;
  236. IsExecuteAbort = false;
  237. IsJumpStepCancelCallLoop = false;
  238. PMModule.IsPaused = false;
  239. PMModule.IsHeaterProfile = false;
  240. PMModule.IsHeaterProfileSuccess = false;
  241. PMModule.IsMainRecipeComplete = false;
  242. _loopEnd = false;
  243. _isJumpStep = false;
  244. _curStepElpasedTimeBeforePaused = 0;
  245. _waferTimeElpasedTimeBeforPaused = 0;
  246. _totalElpasedTime = 0;
  247. _holdTimeElpasedTime = 0;
  248. _jumpStepNumber = 0;
  249. _showStepNo = 0;
  250. _state = RecipeRunningState.ExecStep;
  251. _alarmAction = RecipeAlaramAction.None;
  252. _alarmNames = new List<string>();
  253. _subRecipeStartStepNumber = 1;
  254. _callSubSteps.Clear();
  255. PMModule.InitAlarmCondition(PMModule.RecipeRunningInfo.Head.AlarmCondition);
  256. PMModule.InitLeakCheck(PMModule.RecipeRunningInfo.Head.LeakCheck);
  257. PMModule.InitN2PurgeMode(PMModule.RecipeRunningInfo.Head.N2PurgeModeStr);
  258. ResetTrig();
  259. Notify($"Start");
  260. _faCallback.RecipeStart(PMModule.Module, PMModule.RecipeRunningInfo.RecipeName);
  261. _dbCallback.RecipeStart(PMModule.Module, 0, PMModule.RecipeRunningInfo.InnerId.ToString(), PMModule.RecipeRunningInfo.RecipeName, GetDBRecipeType(PMModule.RecipeRunningInfo.ExecRecipeType), (int)PMModule.RecipeExecEntryEnumValue);
  262. _dbCallback.RecipeUpdateStatus(PMModule.RecipeRunningInfo.InnerId.ToString(), "InProcess");
  263. _fdc.Reset();
  264. WaferManager.Instance.UpdateWaferProcessStatus(ModuleHelper.Converter(Module), 0, EnumWaferProcessStatus.InProcess);
  265. PMModule.ResetFDCRecipeStepName();
  266. PMModule.HeaterEnable(true);
  267. #region 把pj_id更新到process表
  268. //从原来退出process挪到此处写入,是为了避免多个job手动abort掉当前job,而recipe继续执行导致的pj_id更新错误
  269. var firstPjId = Singleton<EquipmentManager>.Instance.GetFirstPJId();
  270. UpdateProcessDataPJid(firstPjId);
  271. #endregion
  272. PMModule.RecipeExecEntryEnumValue = RecipeExecEntryEnum.None;
  273. return Result.RUN;
  274. }
  275. public override Result Monitor()
  276. {
  277. if (!PMModule.CheckEnableRunProcess(out string reason))
  278. {
  279. PMModule.CheckEnableRunProcessAlarm.Set(reason);
  280. return Result.FAIL;
  281. }
  282. //MonitorRecipeAlaramAction();
  283. //if (IsExecuteAbort)
  284. // return Result.DONE;
  285. MonitorRecipePause();
  286. CheckTolerance();
  287. List<RecipeStep> curSteps;
  288. if ((IsSubReciep || PMModule.RecipeRunningInfo.RecipeStepList[_currentStepNumber].IsCallSubStep) && !_isJumpStep)
  289. {
  290. curSteps = PMModule.RecipeRunningInfo.RecipeStepList[_currentStepNumber].SubRecipeSteps;
  291. if (!_callSubSteps.ContainsKey(_currentStepNumber))
  292. _callSubSteps.Add(_currentStepNumber, Tuple.Create(false, 0));
  293. if (PMModule.RecipeRunningInfo.RecipeStepList[_currentStepNumber].IsCallSubStep)
  294. _callSubSteps[_currentStepNumber] = Tuple.Create(true, PMModule.RecipeRunningInfo.RecipeStepList[_currentStepNumber].SubRecipeLoopCount);
  295. if (!IsSubReciep)
  296. {
  297. PMModule.RecipeRunningInfo.SubRecipeCurrentLoopCount = 1;
  298. PMModule.RecipeRunningInfo.SubRecipeLoopCount = PMModule.RecipeRunningInfo.RecipeStepList[_currentStepNumber].SubRecipeLoopCount;
  299. PMModule.RecipeRunningInfo.SubRecipeTable = PMModule.RecipeRunningInfo.RecipeStepList[_currentStepNumber].SubRecipeTableInfo;
  300. _faCallback.RecipeTriggerCallSubRecipe(Module, PMModule.RecipeRunningInfo.RecipeName, PMModule.RecipeRunningInfo.StepNumber.ToString(), PMModule.RecipeRunningInfo.RecipeStepList[_currentStepNumber].SubRecipeTableInfo);
  301. }
  302. PMModule.RecipeRunningInfo.RecipeStepList[_currentStepNumber].IsCallSubStep = false;
  303. IsSubReciep = true;
  304. }
  305. else
  306. {
  307. PMModule.RecipeRunningInfo.SubRecipeTable = string.Empty;
  308. curSteps = PMModule.RecipeRunningInfo.RecipeStepList;
  309. PMModule.RecipeRunningInfo.SubRecipeLoopCount = 0;
  310. }
  311. lock (_recipeLocker)
  312. {
  313. try
  314. {
  315. switch (_state)
  316. {
  317. case RecipeRunningState.ExecStep:
  318. {
  319. PMModule.IsWait = false;
  320. _loopEnd = false;
  321. if (!_holdTimer.IsIdle())
  322. {
  323. _holdTimeElpasedTime += _holdTimer.GetElapseTime();
  324. _holdTimer.Stop();
  325. }
  326. PMModule.ResetToleranceChecker();
  327. _curStepElpasedTimeBeforePaused = 0;
  328. ContinueAction = RecipeContinueMode.None;
  329. if (IsSubReciep)
  330. {
  331. if (SC.ContainsItem("System.FDC.SplitProcessLog") && SC.GetValue<bool>("System.FDC.SplitProcessLog"))
  332. {
  333. if (PMModule.RecipeRunningInfo.RecipeStepList[_currentStepNumber].StepName == "End" && PMModule.RecipeRunningInfo.RecipeStepList.Count - 1 == _currentStepNumber)
  334. {
  335. _faCallback.RecipeComplete(PMModule.Module, PMModule.RecipeRunningInfo.RecipeName);
  336. }
  337. }
  338. if (curSteps[_currentSubRecipeStepNumber].IsLoopStartStep)
  339. {
  340. CurrentSubRecipeLoopCount++;
  341. PMModule.RecipeRunningInfo.IsLooping = true;
  342. PMModule.RecipeRunningInfo.LoopCountCurrent = CurrentSubRecipeLoopCount - 1;//即使不循环,本身也有一次。本身的一次不算,所以减1
  343. PMModule.RecipeRunningInfo.LoopCountSet = curSteps[_currentSubRecipeStepNumber].LoopCount - 1;//即使不循环,本身也有一次。本身的一次不算,所以减1
  344. }
  345. if (curSteps[_currentSubRecipeStepNumber].IsJumpStep)
  346. {
  347. _faCallback.RecipeTriggerJumpStep(Module, PMModule.RecipeRunningInfo.RecipeName, _currentStepNumber.ToString(), curSteps[_currentStepNumber].JumpStepNo.ToString());
  348. _currentSubRecipeStepNumber = curSteps[_currentSubRecipeStepNumber].JumpStepNo;
  349. }
  350. PMModule.SetFDCRecipeStepName(IsSubReciep, curSteps[_currentSubRecipeStepNumber].StepName, (_currentSubRecipeStepNumber + 1).ToString());
  351. RecipeExec("Sub recipe", curSteps, _currentSubRecipeStepNumber, _curStepElpasedTimeBeforePaused, _currentSubRecipeStepNumber + 1);
  352. }
  353. else
  354. {
  355. if (curSteps[_currentStepNumber].IsLoopStartStep)
  356. {
  357. CurrentLoopCount++;
  358. PMModule.RecipeRunningInfo.IsLooping = true;
  359. PMModule.RecipeRunningInfo.LoopCountCurrent = CurrentLoopCount - 1;//即使不循环,本身也有一次。本身的一次不算,所以减1
  360. PMModule.RecipeRunningInfo.LoopCountSet = curSteps[_currentStepNumber].LoopCount - 1;//即使不循环,本身也有一次。本身的一次不算,所以减1
  361. }
  362. if (curSteps[_currentStepNumber].IsJumpStep)
  363. {
  364. _faCallback.RecipeTriggerJumpStep(Module, PMModule.RecipeRunningInfo.RecipeName, _currentStepNumber.ToString(), curSteps[_currentStepNumber].JumpStepNo.ToString());
  365. curSteps[_currentStepNumber].IsJumpStep = false;//只执行一次
  366. _currentStepNumber = curSteps[_currentStepNumber].JumpStepNo;
  367. }
  368. PMModule.SetFDCRecipeStepName(IsSubReciep, curSteps[_currentStepNumber].StepName, _currentStepNumber.ToString());
  369. RecipeExec("Main recipe", curSteps, _currentStepNumber, _curStepElpasedTimeBeforePaused);
  370. }
  371. }
  372. break;
  373. case RecipeRunningState.TimeWait:
  374. //if (PMModule.IsPaused)
  375. //{
  376. // _state = RecipeRunningState.Paused;
  377. // break;
  378. //}
  379. var leakCheck = PMModule.CheckLeakCheckFinish();
  380. _trigLeakCheckFinish.CLK = !leakCheck;
  381. if (_trigLeakCheckFinish.Q)
  382. LOG.Write($"Wait condition:leak check");
  383. if (_stepTimer.IsTimeout())
  384. {
  385. var heaterProfile = PMModule.CheckHeaterProfileFinish(out reason);
  386. _trigHeaterProfileFinish.CLK = !heaterProfile || _infoHeaterProfileFinish != reason;
  387. if (_trigHeaterProfileFinish.Q)
  388. LOG.Write($"Wait condition:heater profile--{reason}");
  389. _infoHeaterProfileFinish = reason;
  390. var boatWaitCondition = PMModule.CheckBoatWaitCondition(out reason);
  391. _trigBoatWaitCondition.CLK = !boatWaitCondition;
  392. if (_trigBoatWaitCondition.Q)
  393. LOG.Write($"Wait condition:boat--{reason}");
  394. var apcWaitCondition = PMModule.CheckAPCWaitCondition(out reason);
  395. _trigAPCWaitCondition.CLK = !apcWaitCondition;
  396. if (_trigAPCWaitCondition.Q)
  397. LOG.Write($"Wait condition:APC--{reason}");
  398. var auxWaitCondition = PMModule.CheckAUXWaitCondition(out reason);
  399. _trigAUXWaitCondition.CLK = !auxWaitCondition || _infoAUXWaitCondition != reason;
  400. if (_trigAUXWaitCondition.Q)
  401. LOG.Write($"Wait condition:heater profile--{reason}");
  402. _infoAUXWaitCondition = reason;
  403. var heaterWaitCondition = PMModule.CheckHeaterWaitCondition(out reason);
  404. _trigHeaterWaitCondition.CLK = !heaterWaitCondition || _infoHeaterWaitCondition != reason;
  405. if (_trigHeaterWaitCondition.Q)
  406. LOG.Write($"Wait condition:heater--{reason}");
  407. _infoHeaterWaitCondition = reason;
  408. var mfcWaitCondition = PMModule.CheckMFCWaitCondition(out reason);
  409. _trigMFCWaitCondition.CLK = !mfcWaitCondition || _infoMFCWaitCondition != reason;
  410. if (_trigMFCWaitCondition.Q)
  411. LOG.Write($"Wait condition:MFC--{reason}");
  412. _infoMFCWaitCondition = reason;
  413. if (heaterProfile &&
  414. leakCheck &&
  415. boatWaitCondition &&
  416. apcWaitCondition &&
  417. auxWaitCondition &&
  418. heaterWaitCondition &&
  419. mfcWaitCondition)
  420. {
  421. _state = RecipeRunningState.StepCompleted;
  422. }
  423. else
  424. {
  425. PMModule.IsWait = true;
  426. }
  427. }
  428. else
  429. {
  430. PMModule.CheckHeaterProfileFinish(out reason);
  431. PMModule.CheckBoatWaitCondition(out reason);
  432. PMModule.CheckAPCWaitCondition(out reason);
  433. PMModule.CheckAUXWaitCondition(out reason);
  434. PMModule.CheckHeaterWaitCondition(out reason);
  435. PMModule.CheckMFCWaitCondition(out reason);
  436. }
  437. break;
  438. case RecipeRunningState.ConditionWait:
  439. {
  440. if (!PMModule.CheckBoatState() && !PMModule.IsBoatMoveToLoadPosition)
  441. break;
  442. var heaterProfile = PMModule.CheckHeaterProfileFinish(out reason);
  443. _trigHeaterProfileFinish.CLK = !heaterProfile || _infoHeaterProfileFinish != reason;
  444. if (_trigHeaterProfileFinish.Q)
  445. LOG.Write($"Wait condition:heater profile--{reason}");
  446. _infoHeaterProfileFinish = reason;
  447. leakCheck = PMModule.CheckLeakCheckFinish();
  448. _trigLeakCheckFinish.CLK = !leakCheck;
  449. if (_trigLeakCheckFinish.Q)
  450. LOG.Write($"Wait condition:leak check");
  451. var boatWaitCondition = PMModule.CheckBoatWaitCondition(out reason);
  452. _trigBoatWaitCondition.CLK = !boatWaitCondition;
  453. if (_trigBoatWaitCondition.Q)
  454. LOG.Write($"Wait condition:boat--{reason}");
  455. var apcWaitCondition = PMModule.CheckAPCWaitCondition(out reason);
  456. _trigAPCWaitCondition.CLK = !apcWaitCondition;
  457. if (_trigAPCWaitCondition.Q)
  458. LOG.Write($"Wait condition:APC--{reason}");
  459. var auxWaitCondition = PMModule.CheckAUXWaitCondition(out reason);
  460. _trigAUXWaitCondition.CLK = !auxWaitCondition || _infoAUXWaitCondition != reason;
  461. if (_trigAUXWaitCondition.Q)
  462. LOG.Write($"Wait condition:heater profile--{reason}");
  463. _infoAUXWaitCondition = reason;
  464. var heaterWaitCondition = PMModule.CheckHeaterWaitCondition(out reason);
  465. _trigHeaterWaitCondition.CLK = !heaterWaitCondition || _infoHeaterWaitCondition != reason;
  466. if (_trigHeaterWaitCondition.Q)
  467. LOG.Write($"Wait condition:heater--{reason}");
  468. _infoHeaterWaitCondition = reason;
  469. var mfcWaitCondition = PMModule.CheckMFCWaitCondition(out reason);
  470. _trigMFCWaitCondition.CLK = !mfcWaitCondition || _infoMFCWaitCondition != reason;
  471. if (_trigMFCWaitCondition.Q)
  472. LOG.Write($"Wait condition:MFC--{reason}");
  473. _infoMFCWaitCondition = reason;
  474. if (heaterProfile &&
  475. leakCheck &&
  476. boatWaitCondition &&
  477. apcWaitCondition &&
  478. auxWaitCondition &&
  479. heaterWaitCondition &&
  480. mfcWaitCondition)
  481. {
  482. _state = RecipeRunningState.StepCompleted;
  483. }
  484. if (_stepTimer.IsTimeout())
  485. {
  486. if (PMModule.IsBoatMoveToLoadPosition)
  487. {
  488. _trigBoatMoveToLoadPositionTimeout.CLK = !boatWaitCondition;
  489. if (_trigBoatMoveToLoadPositionTimeout.Q)
  490. {
  491. LOG.Info($"stepName:{PMModule.RecipeRunningInfo.StepName},step timeout ,boatWaitCondition={boatWaitCondition}");
  492. }
  493. }
  494. //_trigInputSignalTimeOutAlarm.CLK = !PMModule.CheckExternalSensorCondition();
  495. //if (_trigInputSignalTimeOutAlarm.Q)
  496. // PMModule.InputSignalTimeOutAlarm.Set();
  497. //_trigTemperatureConvergenceTimeOutAlarm.CLK = !PMModule.CheckTempStabilizeCondition();
  498. //if (_trigTemperatureConvergenceTimeOutAlarm.Q)
  499. // PMModule.TemperatureConvergenceTimeOutAlarm.Set();
  500. //_trigReachTempTimeOutAlarm.CLK = !PMModule.CheckReachTempCondition();
  501. //if (_trigReachTempTimeOutAlarm.Q)
  502. // PMModule.TemperatureConvergenceTimeOutAlarm.Set("Reach temp condition timeout");
  503. //_trigPressureConvergenceTimeOutAlarm.CLK = !PMModule.CheckPressureStablilizeCondition();
  504. //if (_trigPressureConvergenceTimeOutAlarm.Q)
  505. // PMModule.PressureConvergenceTimeOutAlarm.Set();
  506. //_trigReachPressureTimeOutAlarm.CLK = !PMModule.CheckReachPressureCondition();
  507. //if (_trigReachPressureTimeOutAlarm.Q)
  508. // PMModule.PressureConvergenceTimeOutAlarm.Set("Reach pressure condition timeout");
  509. //_trigAutoProfileTimeOutAlarm.CLK = !PMModule.CheckFinishAutoProfileCondition();
  510. //if (_trigAutoProfileTimeOutAlarm.Q)
  511. // PMModule.AutoProfileTimeOutAlarm.Set();
  512. //_state = RecipeRunningState.StepCompleted;
  513. }
  514. else
  515. {
  516. _trigBoatMoveToLoadPositionTimeout.RST = true;
  517. }
  518. }
  519. break;
  520. case RecipeRunningState.Paused:
  521. if (!_stepTimer.IsIdle())
  522. {
  523. _curStepElpasedTimeBeforePaused += _stepTimer.GetElapseTime();
  524. _stepTimer.Stop();
  525. }
  526. if (_holdTimer.IsIdle())
  527. _holdTimer.Start(0);
  528. switch (ContinueAction)
  529. {
  530. case RecipeContinueMode.None:
  531. break;
  532. case RecipeContinueMode.StepContinue:
  533. if (!_holdTimer.IsIdle())
  534. {
  535. _holdTimeElpasedTime += _holdTimer.GetElapseTime();
  536. _holdTimer.Stop();
  537. }
  538. _state = RecipeRunningState.ExecStep;
  539. _stepTimer.Stop();
  540. break;
  541. }
  542. break;
  543. case RecipeRunningState.StepCompleted:
  544. {
  545. ResetTrig();
  546. //CloseAllValve();
  547. _curStepElpasedTimeBeforePaused = 0;
  548. var stepName = "";
  549. var stepTime = (float)_stepTimer.GetElapseTime() / 1000;//sec
  550. var thickness = 0.0f;
  551. if (IsSubReciep)
  552. {
  553. stepName = PMModule.RecipeRunningInfo.RecipeStepList[_currentStepNumber].SubRecipeSteps[_currentSubRecipeStepNumber].StepName;
  554. float.TryParse(PMModule.RecipeRunningInfo.RecipeStepList[_currentStepNumber].SubRecipeSteps[_currentSubRecipeStepNumber].FilmThickFormula, out thickness);
  555. //放在前面,stepnumber后面会被更新
  556. if (!_isJumpStep)
  557. {
  558. _faCallback.RecipeStepEnd(PMModule.Module, PMModule.RecipeRunningInfo.RecipeName, _currentSubRecipeStepNumber + 1);
  559. _dbCallback.RecipeStepEnd(PMModule.RecipeRunningInfo.InnerId.ToString(), _currentSubRecipeStepNumber + 1, _fdc.DataList, SC.GetStringValue("PM1.TempCorrection"), SC.GetStringValue("PM1.Heater.PID"));
  560. }
  561. _fdc.Stop();
  562. _totalElpasedTime += curSteps[_currentSubRecipeStepNumber].StepTime;
  563. _subRecipeStartStepNumber++;
  564. if (_loopEnd)
  565. {
  566. _currentSubRecipeStepNumber++;
  567. CurrentSubRecipeLoopCount = 0;
  568. PMModule.RecipeRunningInfo.IsLooping = false;
  569. PMModule.RecipeRunningInfo.LoopCountCurrent = 0;
  570. PMModule.RecipeRunningInfo.LoopCountSet = 0;
  571. }
  572. else
  573. {
  574. SubRecipeLoopEndCheck(curSteps);
  575. }
  576. if (_currentSubRecipeStepNumber >= curSteps.Count)
  577. {
  578. PMModule.RecipeRunningInfo.RecipeStepList[_currentStepNumber].SubRecipeLoopCount--;
  579. if (PMModule.RecipeRunningInfo.RecipeStepList[_currentStepNumber].SubRecipeLoopCount > 0)
  580. {
  581. IsSubReciep = true;
  582. }
  583. else
  584. {
  585. IsSubReciep = false;
  586. }
  587. _currentSubRecipeStepNumber = 0;
  588. CurrentSubRecipeLoopCount = 0;
  589. //// sub recipe执行完后,检查下是否在main recipe的loop内
  590. //RecipeLoopEndCheck();
  591. //if (_currentStepNumber >= PMModule.RecipeRunningInfo.RecipeStepList.Count)
  592. //{
  593. // _currentStepNumber = PMModule.RecipeRunningInfo.RecipeStepList.Count - 1;
  594. // _state = RecipeRunningState.RecipeCompleted;
  595. //}
  596. }
  597. _state = RecipeRunningState.ExecStep;
  598. _stepTimer.Stop();
  599. }
  600. else
  601. {
  602. stepName = PMModule.RecipeRunningInfo.RecipeStepList[_currentStepNumber].StepName;
  603. float.TryParse(PMModule.RecipeRunningInfo.RecipeStepList[_currentStepNumber].FilmThickFormula, out thickness);
  604. //放在前面,stepnumber后面会被更新
  605. if (!_isJumpStep)
  606. {
  607. _faCallback.RecipeStepEnd(PMModule.Module, PMModule.RecipeRunningInfo.RecipeName, _currentStepNumber);
  608. _dbCallback.RecipeStepEnd(PMModule.RecipeRunningInfo.InnerId.ToString(), _currentStepNumber, _fdc.DataList, SC.GetStringValue("PM1.TempCorrection"), SC.GetStringValue("PM1.Heater.PID"));
  609. }
  610. _fdc.Stop();
  611. if (_currentStepNumber >= 0 && !IsSubReciep)
  612. {
  613. _totalElpasedTime += PMModule.RecipeRunningInfo.RecipeStepList[_currentStepNumber].StepTime;
  614. }
  615. if (IsSubReciep)
  616. IsSubReciep = false;
  617. if (_loopEnd)
  618. {
  619. _currentStepNumber++;
  620. CurrentLoopCount = 0;
  621. CurrentAbortRecipeLoopCount = 0;
  622. CurrentSubRecipeLoopCount = 0;
  623. PMModule.RecipeRunningInfo.IsLooping = false;
  624. PMModule.RecipeRunningInfo.LoopCountCurrent = 0;
  625. PMModule.RecipeRunningInfo.LoopCountSet = 0;
  626. }
  627. else
  628. {
  629. RecipeLoopEndCheck(PMModule.RecipeRunningInfo.RecipeStepList);
  630. }
  631. if (_currentStepNumber >= PMModule.RecipeRunningInfo.RecipeStepList.Count - 1)
  632. {
  633. for (int i = 0; i < SC.GetValue<int>($"Boat.SlotCount"); i++)
  634. {
  635. if (!WaferManager.Instance.CheckHasWafer(ModuleHelper.Converter(Module), i))
  636. continue;
  637. var wafer = WaferManager.Instance.GetWafer(ModuleHelper.Converter(Module), i);
  638. if (wafer.ProcessState == EnumWaferProcessStatus.Completed ||
  639. wafer.ProcessState == EnumWaferProcessStatus.Idle)
  640. continue;
  641. WaferManager.Instance.UpdateWaferProcessStatus(ModuleHelper.Converter(Module), i, EnumWaferProcessStatus.Completed);
  642. }
  643. PMModule.IsMainRecipeComplete = true;
  644. }
  645. if (_currentStepNumber >= PMModule.RecipeRunningInfo.RecipeStepList.Count)
  646. {
  647. _currentStepNumber = PMModule.RecipeRunningInfo.RecipeStepList.Count - 1;
  648. _state = RecipeRunningState.RecipeCompleted;
  649. }
  650. else
  651. {
  652. _state = RecipeRunningState.ExecStep;
  653. _stepTimer.Stop();
  654. }
  655. }
  656. if (!_isJumpStep)
  657. {
  658. var wafers = WaferManager.Instance.GetWafers(ModuleHelper.Converter(Module));
  659. for (int i = 0; i < wafers.Length; i++)
  660. {
  661. if (WaferManager.Instance.CheckNoWafer(ModuleHelper.Converter(Module), i))
  662. continue;
  663. var useCount = wafers[i].UseCount;
  664. var useTime = wafers[i].UseTime + (float)stepTime;
  665. var useThick = wafers[i].UseThick + thickness;
  666. WaferManager.Instance.UpdateWaferStatistics(ModuleHelper.Converter(Module), i, useCount, (float)Math.Round(useTime, 1), useThick);
  667. }
  668. PMModule.UpdateRecipeThickness(PMModule.RecipeRunningInfo.RecipeName, thickness);
  669. PMModule.UpdateRecipeStepFre(stepName);
  670. PMModule.UpdateRecipeStepRunTime(stepName, Math.Round(stepTime, 1));
  671. PMModule.UpdateRecipeStepGroupThickness(stepName, thickness);
  672. PMModule.UpdateBoatTotalThickness(thickness);
  673. }
  674. }
  675. _isJumpStep = false;
  676. if (PMModule.IsPaused)
  677. {
  678. _state = RecipeRunningState.Paused;
  679. var step = IsSubReciep ? _currentSubRecipeStepNumber + 1 : _currentStepNumber;
  680. break;
  681. }
  682. break;
  683. case RecipeRunningState.RecipeCompleted:
  684. {
  685. var wafers = WaferManager.Instance.GetWafers(ModuleHelper.Converter(Module));
  686. for (int i = 0; i < wafers.Length; i++)
  687. {
  688. if (WaferManager.Instance.CheckNoWafer(ModuleHelper.Converter(Module), i))
  689. continue;
  690. var useCount = wafers[i].UseCount + 1;
  691. var useTime = wafers[i].UseTime;
  692. var useThick = wafers[i].UseThick;
  693. WaferManager.Instance.UpdateWaferStatistics(ModuleHelper.Converter(Module), i, useCount, (float)Math.Round(useTime, 1), useThick);
  694. }
  695. PMModule.UpdateSEDWafer(WaferManager.Instance.GetAllWafers());
  696. if (PMModule.IsHeaterProfile && !PMModule.IsHeaterProfileSuccess)
  697. EV.PostWarningLog(PMModule.Module, "Auto profile failed");
  698. PMModule.UpdateRecipeFre(PMModule.RecipeRunningInfo.RecipeName);
  699. PMModule.ResetFDCRecipeStepName();
  700. Notify("End");
  701. return Result.DONE;
  702. }
  703. case RecipeRunningState.Error:
  704. {
  705. return Result.DONE;
  706. }
  707. default:
  708. break;
  709. }
  710. }
  711. catch (Exception ex)
  712. {
  713. LOG.Write(ex);
  714. return Result.FAIL;
  715. }
  716. }
  717. MonitorRecipeRunInfo();
  718. return Result.RUN;
  719. }
  720. private void MonitorRecipeRunInfo()
  721. {
  722. PMModule.IsHolded = _state == RecipeRunningState.Paused;
  723. double elapseTime;
  724. double totalElapseTime;
  725. double holdTotalElapseTime;
  726. var step = 0;
  727. if (IsSubReciep)
  728. {
  729. if (PMModule.RecipeRunningInfo.RecipeStepList[_currentStepNumber].SubRecipeSteps != null)
  730. {
  731. if (_stepTimer.IsIdle())
  732. {
  733. elapseTime = (_curStepElpasedTimeBeforePaused / 1000) < 1 ? 0 : _curStepElpasedTimeBeforePaused / 1000;
  734. }
  735. else
  736. {
  737. elapseTime = ((_curStepElpasedTimeBeforePaused + _stepTimer.GetElapseTime()) / 1000) < 1 ? 0 : (_curStepElpasedTimeBeforePaused + _stepTimer.GetElapseTime()) / 1000;
  738. }
  739. if (elapseTime > PMModule.RecipeRunningInfo.RecipeStepList[_currentStepNumber].SubRecipeSteps[_currentSubRecipeStepNumber].StepTime)
  740. elapseTime = PMModule.RecipeRunningInfo.RecipeStepList[_currentStepNumber].SubRecipeSteps[_currentSubRecipeStepNumber].StepTime;
  741. totalElapseTime = _totalElpasedTime + elapseTime > PMModule.RecipeRunningInfo.TotalTime ? PMModule.RecipeRunningInfo.TotalTime : _totalElpasedTime + elapseTime;
  742. if (_holdTimer.IsIdle())
  743. {
  744. holdTotalElapseTime = _holdTimeElpasedTime / 1000;
  745. }
  746. else
  747. {
  748. holdTotalElapseTime = (_holdTimeElpasedTime + _holdTimer.GetElapseTime()) / 1000;
  749. }
  750. PMModule.RecipeRunningInfo.StepElapseTime = elapseTime;
  751. PMModule.RecipeRunningInfo.TotalElapseTime = totalElapseTime;
  752. PMModule.RecipeRunningInfo.HoldTime = holdTotalElapseTime;
  753. PMModule.RecipeRunningInfo.StepTime = PMModule.RecipeRunningInfo.RecipeStepList[_currentStepNumber].SubRecipeSteps[_currentSubRecipeStepNumber].StepTime;
  754. PMModule.RecipeRunningInfo.RecipeName = $"Sub/{PMModule.RecipeRunningInfo.Head.SubRecipe}-{PMModule.RecipeRunningInfo.RecipeStepList[_currentStepNumber].SubRecipeTableInfo}-{PMModule.RecipeRunningInfo.RecipeStepList[_currentStepNumber].SubRecipeSteps[_currentSubRecipeStepNumber].StepName}";
  755. PMModule.RecipeRunningInfo.ExecRecipeType = PMModule.RecipeRunningInfo.RecipeStepList[_currentStepNumber].SubRecipeSteps[_currentSubRecipeStepNumber].RecipeType;
  756. PMModule.RecipeRunningInfo.SubRecipeCurrentLoopCount = PMModule.RecipeRunningInfo.SubRecipeLoopCount - PMModule.RecipeRunningInfo.RecipeStepList[_currentStepNumber].SubRecipeLoopCount + 1;
  757. PMModule.RecipeRunningInfo.SubRecipeName = PMModule.RecipeRunningInfo.Head.SubRecipe;
  758. PMModule.RecipeRunningInfo.SubRecipeTable = PMModule.RecipeRunningInfo.RecipeStepList[_currentStepNumber].SubRecipeTableInfo;
  759. step = _currentSubRecipeStepNumber;
  760. if (_state == RecipeRunningState.Paused)
  761. {
  762. //pause之后,当前step执行完,显示的step要保持hold住的这一步的
  763. step--;
  764. if (step < 0)
  765. step = 0;
  766. }
  767. PMModule.RecipeRunningInfo.StepNumber = step + 1; //CurStepNum start from 0
  768. PMModule.RecipeRunningInfo.StepName = PMModule.RecipeRunningInfo.RecipeStepList[_currentStepNumber].SubRecipeSteps[step].StepName;
  769. if (PMModule.RecipeRunningInfo.RecipeStepList[_currentStepNumber].SubRecipeSteps[step].IsLoopEndStep)
  770. PMModule.RecipeRunningInfo.NextStepName = PMModule.RecipeRunningInfo.RecipeStepList[_currentStepNumber].SubRecipeSteps.Count > PMModule.RecipeRunningInfo.RecipeStepList[_currentStepNumber].SubRecipeSteps[_currentSubRecipeStepNumber].LoopStartStep ?
  771. PMModule.RecipeRunningInfo.RecipeStepList[_currentStepNumber].SubRecipeSteps[PMModule.RecipeRunningInfo.RecipeStepList[_currentStepNumber].SubRecipeSteps[step].LoopStartStep].StepName : "";
  772. else
  773. {
  774. if (PMModule.RecipeRunningInfo.RecipeStepList[_currentStepNumber].SubRecipeSteps.Count > step + 1)
  775. {
  776. PMModule.RecipeRunningInfo.NextStepName = PMModule.RecipeRunningInfo.RecipeStepList[_currentStepNumber].SubRecipeSteps[step + 1].StepName;
  777. }
  778. else
  779. {
  780. if (PMModule.RecipeRunningInfo.SubRecipeCurrentLoopCount < PMModule.RecipeRunningInfo.SubRecipeLoopCount)
  781. {
  782. //sub 下一个循环
  783. PMModule.RecipeRunningInfo.NextStepName = PMModule.RecipeRunningInfo.RecipeStepList[_currentStepNumber].SubRecipeSteps[0].StepName;
  784. }
  785. else
  786. {
  787. //sub执行结束
  788. if (PMModule.RecipeRunningInfo.RecipeStepList.Count > _currentStepNumber)
  789. {
  790. PMModule.RecipeRunningInfo.NextStepName = PMModule.RecipeRunningInfo.RecipeStepList[_currentStepNumber].StepName;
  791. }
  792. }
  793. }
  794. }
  795. if (PMModule.RecipeRunningInfo.RecipeStepList[_currentStepNumber].SubRecipeSteps[_currentSubRecipeStepNumber].StepName.ToLower() == "standby")
  796. {
  797. PMModule.StringProcessFlowState = PMModule.ProcessFlowState.Standby.ToString();
  798. }
  799. else
  800. {
  801. PMModule.StringProcessFlowState = PMModule.ProcessFlowState.Run.ToString();
  802. }
  803. }
  804. return;
  805. }
  806. if (_stepTimer.IsIdle())
  807. {
  808. elapseTime = (_curStepElpasedTimeBeforePaused / 1000) < 1 ? 0 : _curStepElpasedTimeBeforePaused / 1000;
  809. }
  810. else
  811. {
  812. elapseTime = ((_curStepElpasedTimeBeforePaused + _stepTimer.GetElapseTime()) / 1000) < 1 ? 0 : (_curStepElpasedTimeBeforePaused + _stepTimer.GetElapseTime()) / 1000;
  813. }
  814. if (elapseTime > PMModule.RecipeRunningInfo.RecipeStepList[_currentStepNumber].StepTime)
  815. elapseTime = PMModule.RecipeRunningInfo.RecipeStepList[_currentStepNumber].StepTime;
  816. totalElapseTime = _totalElpasedTime + elapseTime > PMModule.RecipeRunningInfo.TotalTime ? PMModule.RecipeRunningInfo.TotalTime : _totalElpasedTime + elapseTime;
  817. if (_holdTimer.IsIdle())
  818. {
  819. holdTotalElapseTime = _holdTimeElpasedTime / 1000;
  820. }
  821. else
  822. {
  823. holdTotalElapseTime = (_holdTimeElpasedTime + _holdTimer.GetElapseTime()) / 1000;
  824. }
  825. PMModule.RecipeRunningInfo.StepElapseTime = elapseTime;
  826. PMModule.RecipeRunningInfo.TotalElapseTime = totalElapseTime;
  827. PMModule.RecipeRunningInfo.HoldTime = holdTotalElapseTime;
  828. PMModule.RecipeRunningInfo.StepTime = PMModule.RecipeRunningInfo.RecipeStepList[_currentStepNumber].StepTime;
  829. PMModule.RecipeRunningInfo.RecipeName = PMModule.RecipeRunningInfo.MainRecipeName;
  830. PMModule.RecipeRunningInfo.ExecRecipeType = PMModule.RecipeRunningInfo.RecipeStepList[_currentStepNumber].RecipeType;
  831. if (_state == RecipeRunningState.RecipeCompleted)
  832. {
  833. PMModule.RecipeRunningInfo.HoldTime = 0;
  834. }
  835. step = _currentStepNumber;
  836. if (_state == RecipeRunningState.Paused)
  837. {
  838. //pause之后,当前step执行完,显示的step要保持hold住的这一步的
  839. step--;
  840. if (step < 0)
  841. step = 0;
  842. }
  843. if (PMModule.RecipeRunningInfo.RecipeStepList[0].StepName.ToLower() == "standby")
  844. {
  845. PMModule.RecipeRunningInfo.StepNumber = step; //CurStepNum start from 0
  846. }
  847. else
  848. {
  849. PMModule.RecipeRunningInfo.StepNumber = step + 1; //CurStepNum start from 0
  850. }
  851. PMModule.RecipeRunningInfo.StepName = PMModule.RecipeRunningInfo.RecipeStepList[_showStepNo].StepName;
  852. if (PMModule.RecipeRunningInfo.RecipeStepList[step].IsLoopEndStep)
  853. PMModule.RecipeRunningInfo.NextStepName = PMModule.RecipeRunningInfo.RecipeStepList.Count > PMModule.RecipeRunningInfo.RecipeStepList[step].LoopStartStep ? PMModule.RecipeRunningInfo.RecipeStepList[PMModule.RecipeRunningInfo.RecipeStepList[_currentStepNumber].LoopStartStep].StepName : "";
  854. else
  855. PMModule.RecipeRunningInfo.NextStepName = PMModule.RecipeRunningInfo.RecipeStepList.Count > step + 1 ? PMModule.RecipeRunningInfo.RecipeStepList[step + 1].StepName : "";
  856. if (PMModule.RecipeRunningInfo.RecipeStepList[_currentStepNumber].StepName.ToLower() == "standby")
  857. {
  858. PMModule.StringProcessFlowState = PMModule.ProcessFlowState.Standby.ToString();
  859. }
  860. else if (PMModule.RecipeRunningInfo.RecipeStepList.Count - 1 == _currentStepNumber)
  861. {
  862. PMModule.StringProcessFlowState = PMModule.ProcessFlowState.End.ToString();
  863. }
  864. else
  865. {
  866. PMModule.StringProcessFlowState = PMModule.ProcessFlowState.Run.ToString();
  867. }
  868. }
  869. private void MonitorRecipeAlaramAction()
  870. {
  871. if (_state != RecipeRunningState.TimeWait && _state != RecipeRunningState.ConditionWait)
  872. return;
  873. if (_alarmNames.Count == 0)
  874. return;
  875. int group = -1, temp = 0;
  876. string iAlarmConditionTable = "1:";
  877. if (IsSubReciep)
  878. {
  879. for (int i = 0; i < _alarmNames.Count; i++)
  880. {
  881. iAlarmConditionTable = PMModule.RecipeRunningInfo.RecipeStepList[_currentStepNumber].SubRecipeSteps[_currentSubRecipeStepNumber].AlarmConditionTable;
  882. temp = (int)Singleton<EventManager>.Instance.AlarmDic[iAlarmConditionTable.ToString()][_alarmNames[i]].Group;
  883. if (!PMModule.RecipeRunningInfo.RecipeStepList[_currentStepNumber].SubRecipeSteps[_currentSubRecipeStepNumber].AlarmActionSets.ContainsKey(temp))
  884. continue;
  885. var type = PMModule.RecipeRunningInfo.RecipeStepList[_currentStepNumber].SubRecipeSteps[_currentSubRecipeStepNumber].AlarmActionSets[temp].ProcessingType;
  886. if (temp >= group && (group == -1 || type != "Ignore Alarm"))
  887. group = temp;
  888. }
  889. }
  890. else
  891. {
  892. for (int i = 0; i < _alarmNames.Count; i++)
  893. {
  894. iAlarmConditionTable = PMModule.RecipeRunningInfo.RecipeStepList[_currentStepNumber].AlarmConditionTable;
  895. temp = (int)Singleton<EventManager>.Instance.AlarmDic[iAlarmConditionTable.ToString()][_alarmNames[i]].Group;
  896. if (!PMModule.RecipeRunningInfo.RecipeStepList[_currentStepNumber].AlarmActionSets.ContainsKey(temp))
  897. continue;
  898. var type = PMModule.RecipeRunningInfo.RecipeStepList[_currentStepNumber].AlarmActionSets[temp].ProcessingType;
  899. if (temp >= group && (group == -1 || type != "Ignore Alarm"))
  900. group = temp;
  901. }
  902. }
  903. _alarmNames.Clear();
  904. if (group == -1)
  905. return;
  906. string alarmAction = "", alarmDetails = "";
  907. List<RecipeStep> abortRecipes = new List<RecipeStep>();
  908. if (IsSubReciep)
  909. {
  910. alarmAction = PMModule.RecipeRunningInfo.RecipeStepList[_currentStepNumber].SubRecipeSteps[_currentSubRecipeStepNumber].AlarmActionSets[group].ProcessingType;
  911. alarmDetails = PMModule.RecipeRunningInfo.RecipeStepList[_currentStepNumber].SubRecipeSteps[_currentSubRecipeStepNumber].AlarmActionSets[group].ProcessingDetails;
  912. abortRecipes = PMModule.RecipeRunningInfo.RecipeStepList[_currentStepNumber].SubRecipeSteps[_currentSubRecipeStepNumber].AlarmActionSets[group].AbortRecipeStepList;
  913. }
  914. else
  915. {
  916. alarmAction = PMModule.RecipeRunningInfo.RecipeStepList[_currentStepNumber].AlarmActionSets[group].ProcessingType;
  917. alarmDetails = PMModule.RecipeRunningInfo.RecipeStepList[_currentStepNumber].AlarmActionSets[group].ProcessingDetails;
  918. abortRecipes = PMModule.RecipeRunningInfo.RecipeStepList[_currentStepNumber].AlarmActionSets[group].AbortRecipeStepList;
  919. }
  920. switch (alarmAction)
  921. {
  922. case "Jump Abort Recipe":
  923. alarmDetails = alarmDetails.Replace("Abort Recipe/", string.Empty);
  924. Abort();
  925. _alarmAction = RecipeAlaramAction.JumpAbortRecipe;
  926. break;
  927. case "Jump Step":
  928. alarmDetails = alarmDetails.Replace("Jump Step/", string.Empty);
  929. _jumpStepNumber = PMModule.RecipeRunningInfo.RecipeStepList.FindIndex(x => x.StepName == alarmDetails);
  930. _alarmAction = RecipeAlaramAction.JumpStep;
  931. _state = RecipeRunningState.StepCompleted;
  932. break;
  933. case "Jump Step(Cancel Call Loop)":
  934. alarmDetails = alarmDetails.Replace("Jump Step(Cancel Call Loop)/", string.Empty);
  935. _jumpStepNumber = PMModule.RecipeRunningInfo.RecipeStepList.FindIndex(x => x.StepName == alarmDetails);
  936. _alarmAction = RecipeAlaramAction.JumpStepCancelCallLoop;
  937. IsJumpStepCancelCallLoop = true;
  938. _state = RecipeRunningState.StepCompleted;
  939. break;
  940. case "Abort":
  941. IsExecuteAbort = true;
  942. break;
  943. case "Hold":
  944. PMModule.IsPaused = true;
  945. ContinueAction = RecipeContinueMode.None;
  946. _alarmAction = RecipeAlaramAction.Hold;
  947. break;
  948. case "Ignore Alarm":
  949. _alarmAction = RecipeAlaramAction.IgnoreAlaram;
  950. break;
  951. default:
  952. _alarmAction = RecipeAlaramAction.IgnoreAlaram;
  953. break;
  954. }
  955. }
  956. private void MonitorRecipePause()
  957. {
  958. if (_state != RecipeRunningState.TimeWait && _state != RecipeRunningState.ConditionWait)
  959. return;
  960. //if (PMModule.IsPaused)
  961. //{
  962. // _state = RecipeRunningState.Paused;
  963. //}
  964. }
  965. public override void Abort()
  966. {
  967. //PMModule.AbortRecipe();//暂时这么做
  968. PMModule.RecipeRunningInfo.IsLooping = false;
  969. PMModule.RecipeRunningInfo.LoopCountCurrent = 0;
  970. PMModule.RecipeRunningInfo.LoopCountSet = 0;
  971. IsExecuteAbort = true;
  972. IsSubReciep = false;
  973. PMModule.IsPaused = false;
  974. PMModule.IsHeaterProfile = false;
  975. PMModule.IsHeaterProfileSuccess = false;
  976. if (!_holdTimer.IsIdle())
  977. {
  978. _holdTimeElpasedTime += _holdTimer.GetElapseTime();
  979. _holdTimer.Stop();
  980. }
  981. CurrentLoopCount = 0;
  982. CurrentAbortRecipeLoopCount = 0;
  983. CurrentSubRecipeLoopCount = 0;
  984. _state = RecipeRunningState.RecipeCompleted;//暂时这么做
  985. //更新步次结束时间
  986. var step = IsSubReciep ? _currentSubRecipeStepNumber + 1 : _currentStepNumber;
  987. _dbCallback.RecipeStepEnd(PMModule.RecipeRunningInfo.InnerId.ToString(), step, _fdc.DataList, SC.GetStringValue("PM1.TempCorrection"), SC.GetStringValue("PM1.Heater.PID"));
  988. return;//暂时这么做
  989. //_totalElpasedTime = 0;
  990. PMModule.RecipeRunningInfo.BeginTime = DateTime.Now;
  991. double total = 0;
  992. for (int i = 0; i < PMModule.RecipeRunningInfo.RecipeStepList[_currentStepNumber].AbortRecipeSteps.Count; i++)
  993. {
  994. total += PMModule.RecipeRunningInfo.RecipeStepList[_currentStepNumber].AbortRecipeSteps[i].StepTime;
  995. }
  996. PMModule.RecipeRunningInfo.TotalTime = _totalElpasedTime + total;
  997. ResetTrig();
  998. //PMModule.ResetToleranceAlarm();
  999. //PMModule.ResetToleranceAlarmChecker();
  1000. PMModule.ExecuteAbortRecipeWarning.Set($"from recipe name:{PMModule.RecipeRunningInfo.RecipeName} step:{_currentStepNumber} start execute abort recipe.");
  1001. _state = RecipeRunningState.ExecStep;
  1002. }
  1003. public void UpdateProcessDataPJid(string pjId)
  1004. {
  1005. _dbCallback.RecipeUpdatePjId(PMModule.RecipeRunningInfo.InnerId.ToString(), pjId);
  1006. }
  1007. public void ExitProcess()
  1008. {
  1009. if (_state == RecipeRunningState.RecipeCompleted)
  1010. {
  1011. PMModule.StringProcessFlowState = PMModule.ProcessFlowState.Standby.ToString();
  1012. // _faCallback.RecipeComplete(PMModule.Module, PMModule.RecipeRunningInfo.RecipeName);
  1013. _dbCallback.RecipeComplete(PMModule.RecipeRunningInfo.InnerId.ToString());
  1014. _fdc.Stop();
  1015. }
  1016. else
  1017. {
  1018. if (PMModule.IsExcuteIdleRecipe)
  1019. {
  1020. // _faCallback.RecipeComplete(PMModule.Module, PMModule.RecipeRunningInfo.RecipeName);
  1021. _dbCallback.RecipeComplete(PMModule.RecipeRunningInfo.InnerId.ToString());
  1022. _fdc.Stop();
  1023. }
  1024. else
  1025. {
  1026. _faCallback.RecipeFailed(PMModule.Module, PMModule.RecipeRunningInfo.RecipeName);
  1027. _dbCallback.RecipeFailed(PMModule.RecipeRunningInfo.InnerId.ToString());
  1028. _fdc.Stop();
  1029. };
  1030. }
  1031. }
  1032. public void PauseRecipe()
  1033. {
  1034. PMModule.IsPaused = true;
  1035. ContinueAction = RecipeContinueMode.None;
  1036. }
  1037. public void ContinueRecipe()
  1038. {
  1039. PMModule.IsPaused = false;
  1040. ContinueAction = RecipeContinueMode.StepContinue;
  1041. var step = IsSubReciep ? _currentSubRecipeStepNumber + 1 : _currentStepNumber;
  1042. }
  1043. public void SkipCurrentRecipeStep()
  1044. {
  1045. if (_state == RecipeRunningState.ConditionWait || _state == RecipeRunningState.TimeWait || _state == RecipeRunningState.Paused)
  1046. {
  1047. _state = RecipeRunningState.StepCompleted;
  1048. _loopEnd = true;
  1049. PMModule.RecipeRunningInfo.IsLooping = false;
  1050. PMModule.RecipeRunningInfo.LoopCountCurrent = 0;
  1051. PMModule.RecipeRunningInfo.LoopCountSet = 0;
  1052. PMModule.IsPaused = false;
  1053. if (!_holdTimer.IsIdle())
  1054. {
  1055. _holdTimeElpasedTime += _holdTimer.GetElapseTime();
  1056. _holdTimer.Stop();
  1057. }
  1058. }
  1059. if (IsSubReciep)
  1060. {
  1061. ResetLoop(PMModule.RecipeRunningInfo.RecipeStepList[_currentStepNumber].SubRecipeSteps, _currentSubRecipeStepNumber);
  1062. }
  1063. else
  1064. {
  1065. ResetLoop(PMModule.RecipeRunningInfo.RecipeStepList, _currentStepNumber);
  1066. }
  1067. }
  1068. private void ResetLoop(List<RecipeStep> checkRecipeSeps, int currentStepNumber)
  1069. {
  1070. if (checkRecipeSeps == null)
  1071. return;
  1072. var hasLoopStart = false;
  1073. for (int i = currentStepNumber; i >= 0; i--)
  1074. {
  1075. if (checkRecipeSeps[i].IsLoopStartStep)
  1076. {
  1077. hasLoopStart = true;
  1078. break;
  1079. }
  1080. if (checkRecipeSeps[i].IsLoopEndStep)
  1081. {
  1082. hasLoopStart = false;//前面有end,说明没有循环
  1083. break;
  1084. }
  1085. }
  1086. if (hasLoopStart)
  1087. {
  1088. for (int i = currentStepNumber; i < checkRecipeSeps.Count; i++)
  1089. {
  1090. if (checkRecipeSeps[i].IsLoopStartStep)
  1091. {
  1092. break;//没有循环
  1093. }
  1094. if (checkRecipeSeps[i].IsLoopEndStep)
  1095. {
  1096. checkRecipeSeps[i].IsLoopEndStep = false;//跳出skip step之间的循环
  1097. break;
  1098. }
  1099. }
  1100. }
  1101. }
  1102. public void LeakCheckRetry()
  1103. {
  1104. JumpCurrentRecipeStep(_currentStepNumber - 1, PMModule.RecipeRunningInfo.RecipeStepList[_currentStepNumber - 1].StepName);
  1105. }
  1106. public void JumpCurrentRecipeStep(int stepNumber, string stepName, bool isAlarmConditionCall = false)
  1107. {
  1108. PMModule.StopLeakCheckTimer();
  1109. LOG.Write($"Jump to step stepNumber={stepNumber} stepName={stepName}, currentStepNumber={_currentStepNumber}");
  1110. if (_state == RecipeRunningState.ConditionWait || _state == RecipeRunningState.TimeWait ||
  1111. _state == RecipeRunningState.Paused || _state == RecipeRunningState.ExecStep)
  1112. {
  1113. _loopEnd = true;
  1114. PMModule.RecipeRunningInfo.IsLooping = false;
  1115. PMModule.RecipeRunningInfo.LoopCountCurrent = 0;
  1116. PMModule.RecipeRunningInfo.LoopCountSet = 0;
  1117. CurrentLoopCount = 0;
  1118. CurrentAbortRecipeLoopCount = 0;
  1119. CurrentSubRecipeLoopCount = 0;
  1120. IsSubReciep = false;
  1121. if (IsSubReciep)
  1122. {
  1123. _faCallback.RecipeStepEnd(PMModule.Module, PMModule.RecipeRunningInfo.RecipeName, _currentSubRecipeStepNumber + 1);
  1124. _dbCallback.RecipeStepEnd(PMModule.RecipeRunningInfo.InnerId.ToString(), _currentSubRecipeStepNumber + 1, _fdc.DataList, SC.GetStringValue("PM1.TempCorrection"), SC.GetStringValue("PM1.Heater.PID"));
  1125. ResetLoop(PMModule.RecipeRunningInfo.RecipeStepList[_currentStepNumber].SubRecipeSteps, _currentSubRecipeStepNumber);
  1126. }
  1127. else
  1128. {
  1129. _faCallback.RecipeStepEnd(PMModule.Module, PMModule.RecipeRunningInfo.RecipeName, _currentStepNumber);
  1130. _dbCallback.RecipeStepEnd(PMModule.RecipeRunningInfo.InnerId.ToString(), _currentStepNumber, _fdc.DataList, SC.GetStringValue("PM1.TempCorrection"), SC.GetStringValue("PM1.Heater.PID"));
  1131. ResetLoop(PMModule.RecipeRunningInfo.RecipeStepList, _currentStepNumber);
  1132. }
  1133. if (_callSubSteps != null)
  1134. {
  1135. foreach (var key in _callSubSteps.Keys)
  1136. {
  1137. if (PMModule.RecipeRunningInfo.RecipeStepList.Count > key)
  1138. {
  1139. PMModule.RecipeRunningInfo.RecipeStepList[key].IsCallSubStep = _callSubSteps[key].Item1;
  1140. PMModule.RecipeRunningInfo.RecipeStepList[key].SubRecipeLoopCount = _callSubSteps[key].Item2;
  1141. }
  1142. }
  1143. _currentSubRecipeStepNumber = CurSubRecipeStepTotalLoopCount = 0;
  1144. }
  1145. _isJumpStep = true;
  1146. _currentStepNumber = stepNumber - 1;
  1147. if (_currentStepNumber < 0)
  1148. _currentStepNumber = 0;
  1149. _totalElpasedTime = RefreshElpasedTime();
  1150. _state = RecipeRunningState.StepCompleted;
  1151. PMModule.IsPaused = false;
  1152. if (!_holdTimer.IsIdle())
  1153. {
  1154. _holdTimeElpasedTime += _holdTimer.GetElapseTime();
  1155. _holdTimer.Stop();
  1156. }
  1157. }
  1158. }
  1159. private double RefreshElpasedTime()
  1160. {
  1161. double total = 0;
  1162. try
  1163. {
  1164. for (int i = 0; i < _currentStepNumber; i++)
  1165. {
  1166. if (!PMModule.RecipeRunningInfo.RecipeStepList[i].IsJumpStep)
  1167. {
  1168. if (PMModule.RecipeRunningInfo.RecipeStepList[i].IsLoopEndStep)
  1169. {
  1170. int iLoopStartStep = PMModule.RecipeRunningInfo.RecipeStepList[i].LoopStartStep;
  1171. for (int j = 0; j < PMModule.RecipeRunningInfo.RecipeStepList[i].LoopCount; j++)
  1172. {
  1173. for (int m = iLoopStartStep; m <= i; m++)
  1174. {
  1175. if (PMModule.RecipeRunningInfo.RecipeStepList[i].SubRecipeSteps != null && PMModule.RecipeRunningInfo.RecipeStepList[i].SubRecipeSteps.Count > _currentSubRecipeStepNumber)
  1176. {
  1177. total += SubRecipeCalTotalTime(i) * PMModule.RecipeRunningInfo.RecipeStepList[i].SubRecipeLoopCount;
  1178. }
  1179. total += PMModule.RecipeRunningInfo.RecipeStepList[m].StepTime;
  1180. }
  1181. }
  1182. }
  1183. else
  1184. {
  1185. if (PMModule.RecipeRunningInfo.RecipeStepList[i].SubRecipeSteps != null &&
  1186. PMModule.RecipeRunningInfo.RecipeStepList[i].SubRecipeSteps.Count > _currentSubRecipeStepNumber)
  1187. {
  1188. total += SubRecipeCalTotalTime(i) * PMModule.RecipeRunningInfo.RecipeStepList[i].SubRecipeLoopCount;
  1189. }
  1190. total += PMModule.RecipeRunningInfo.RecipeStepList[i].StepTime;
  1191. }
  1192. }
  1193. }
  1194. }
  1195. catch (Exception ex)
  1196. {
  1197. LOG.Write(ex);
  1198. return -1;
  1199. }
  1200. return (int)total;
  1201. }
  1202. public void RespondAlarm(string name)
  1203. {
  1204. if (!_alarmNames.Contains(name))
  1205. _alarmNames.Add(name);
  1206. }
  1207. protected int CalcRecipeTime()
  1208. {
  1209. double total = 0;
  1210. int iStart = PMModule.IsJobProcess ? 1 : 0;
  1211. try
  1212. {
  1213. for (int i = iStart; i < PMModule.RecipeRunningInfo.RecipeStepList.Count; i++)
  1214. //for (int i = PMModule.RecipeRunningInfo.RecipeStepList.Count - 1; i <= iStart; i--)
  1215. {
  1216. if (!PMModule.RecipeRunningInfo.RecipeStepList[i].IsJumpStep)
  1217. {
  1218. if (PMModule.RecipeRunningInfo.RecipeStepList[i].IsLoopEndStep)
  1219. {
  1220. int iLoopStartStep = PMModule.RecipeRunningInfo.RecipeStepList[i].LoopStartStep;
  1221. total += PMModule.RecipeRunningInfo.RecipeStepList[i].StepTime;
  1222. for (int j = 0; j < PMModule.RecipeRunningInfo.RecipeStepList[i].LoopCount - 1; j++)
  1223. {
  1224. for (int m = iLoopStartStep; m <= i; m++)
  1225. {
  1226. if (PMModule.RecipeRunningInfo.RecipeStepList[i].SubRecipeSteps != null && PMModule.RecipeRunningInfo.RecipeStepList[i].SubRecipeSteps.Count > _currentSubRecipeStepNumber)
  1227. {
  1228. total += SubRecipeCalTotalTime(i) * PMModule.RecipeRunningInfo.RecipeStepList[i].SubRecipeLoopCount;
  1229. }
  1230. total += PMModule.RecipeRunningInfo.RecipeStepList[m].StepTime;
  1231. }
  1232. }
  1233. }
  1234. else
  1235. {
  1236. if (PMModule.RecipeRunningInfo.RecipeStepList[i].SubRecipeSteps != null && PMModule.RecipeRunningInfo.RecipeStepList[i].SubRecipeSteps.Count > _currentSubRecipeStepNumber)
  1237. {
  1238. total += SubRecipeCalTotalTime(i) * PMModule.RecipeRunningInfo.RecipeStepList[i].SubRecipeLoopCount;
  1239. }
  1240. total += PMModule.RecipeRunningInfo.RecipeStepList[i].StepTime;
  1241. }
  1242. }
  1243. else
  1244. {
  1245. i = PMModule.RecipeRunningInfo.RecipeStepList[i].JumpStepNo - 1;// -1是因为i++
  1246. }
  1247. if (i < PMModule.RecipeRunningInfo.RecipeStepList.Count - 1)
  1248. {
  1249. _remainTimeExcludeEnd = total;//获取除最后一步外的process时间,End步会cooling
  1250. }
  1251. }
  1252. }
  1253. catch (Exception ex)
  1254. {
  1255. LOG.Write(ex);
  1256. return -1;
  1257. }
  1258. return (int)total;
  1259. }
  1260. private int AbortRecipeCalTotalTime()
  1261. {
  1262. double total = 0;
  1263. List<RecipeStep> abortRecipeSteps;
  1264. abortRecipeSteps = PMModule.RecipeRunningInfo.RecipeStepList[_currentStepNumber].AbortRecipeSteps;
  1265. try
  1266. {
  1267. for (int i = 0; i < abortRecipeSteps.Count; i++)
  1268. {
  1269. if (!abortRecipeSteps[i].IsJumpStep)
  1270. {
  1271. if (abortRecipeSteps[i].IsLoopStartStep)
  1272. {
  1273. int iLoopEndStep = 0;
  1274. for (int j = 0; j < abortRecipeSteps[i].LoopCount; j++)
  1275. {
  1276. for (int m = i; m < abortRecipeSteps.Count; m++)
  1277. {
  1278. total += abortRecipeSteps[m].StepTime;
  1279. if (abortRecipeSteps[m].IsLoopEndStep)
  1280. {
  1281. iLoopEndStep = m;
  1282. break;
  1283. }
  1284. }
  1285. }
  1286. i = iLoopEndStep;
  1287. }
  1288. else
  1289. {
  1290. total += abortRecipeSteps[i].StepTime;
  1291. }
  1292. }
  1293. else
  1294. {
  1295. i = abortRecipeSteps[i].JumpStepNo - 1;// -1是因为i++
  1296. }
  1297. }
  1298. }
  1299. catch (Exception ex)
  1300. {
  1301. LOG.Write(ex);
  1302. return -1;
  1303. }
  1304. return (int)total;
  1305. }
  1306. public void SetContinue(string continueMode)
  1307. {
  1308. switch (continueMode)
  1309. {
  1310. case "Step continue":
  1311. ContinueAction = RecipeContinueMode.StepContinue;
  1312. break;
  1313. case "Step restart":
  1314. ContinueAction = RecipeContinueMode.StepRestart;
  1315. break;
  1316. case "Next step":
  1317. ContinueAction = RecipeContinueMode.NextStep;
  1318. break;
  1319. case "Recipe restart":
  1320. ContinueAction = RecipeContinueMode.RecipeRestart;
  1321. break;
  1322. case "Recipe complete":
  1323. ContinueAction = RecipeContinueMode.RecipeCompleted;
  1324. break;
  1325. case "Wafer return and job stop":
  1326. ContinueAction = RecipeContinueMode.WaferReturnAndJobStop;
  1327. break;
  1328. }
  1329. PMModule.ResetToleranceChecker();
  1330. }
  1331. private double SubRecipeCalTotalTime(int currentStepNumber)
  1332. {
  1333. double total = 0;
  1334. for (int k = _currentSubRecipeStepNumber; k < PMModule.RecipeRunningInfo.RecipeStepList[currentStepNumber].SubRecipeSteps.Count; k++)
  1335. {
  1336. if (!PMModule.RecipeRunningInfo.RecipeStepList[currentStepNumber].SubRecipeSteps[k].IsJumpStep)
  1337. {
  1338. if (PMModule.RecipeRunningInfo.RecipeStepList[currentStepNumber].SubRecipeSteps[k].IsLoopEndStep)
  1339. {
  1340. int iSystemLoopStartStep = PMModule.RecipeRunningInfo.RecipeStepList[currentStepNumber].SubRecipeSteps[k].LoopStartStep;
  1341. total += PMModule.RecipeRunningInfo.RecipeStepList[currentStepNumber].SubRecipeSteps[k].StepTime;
  1342. for (int n = 0; n < PMModule.RecipeRunningInfo.RecipeStepList[currentStepNumber].SubRecipeSteps[k].LoopCount - 1; n++)
  1343. {
  1344. for (int l = iSystemLoopStartStep; l <= k; l++)
  1345. {
  1346. total += PMModule.RecipeRunningInfo.RecipeStepList[currentStepNumber].SubRecipeSteps[l].StepTime;
  1347. }
  1348. }
  1349. }
  1350. else
  1351. {
  1352. total += PMModule.RecipeRunningInfo.RecipeStepList[currentStepNumber].SubRecipeSteps[k].StepTime;
  1353. }
  1354. }
  1355. else
  1356. {
  1357. k = PMModule.RecipeRunningInfo.RecipeStepList[currentStepNumber].SubRecipeSteps[k].JumpStepNo - 1;// -1是因为k++
  1358. }
  1359. }
  1360. return total;
  1361. }
  1362. private void SubRecipeLoopEndCheck(List<RecipeStep> recipeSteps)
  1363. {
  1364. if (_alarmAction == RecipeAlaramAction.JumpStep || _alarmAction == RecipeAlaramAction.JumpStepCancelCallLoop)
  1365. {
  1366. _currentSubRecipeStepNumber = _jumpStepNumber;
  1367. _alarmAction = RecipeAlaramAction.None;
  1368. _alarmNames.Clear();
  1369. return;
  1370. }
  1371. if (recipeSteps[_currentSubRecipeStepNumber].IsLoopEndStep)
  1372. {
  1373. if (IsJumpStepCancelCallLoop)
  1374. {
  1375. _currentSubRecipeStepNumber++;
  1376. IsJumpStepCancelCallLoop = false;
  1377. return;
  1378. }
  1379. //重新读取循环的设定次数
  1380. CurSubRecipeStepTotalLoopCount = recipeSteps[_currentSubRecipeStepNumber].LoopCount;
  1381. if (CurrentSubRecipeLoopCount >= CurSubRecipeStepTotalLoopCount)
  1382. {
  1383. CurrentSubRecipeLoopCount = CurSubRecipeStepTotalLoopCount = 0;
  1384. _currentSubRecipeStepNumber++;
  1385. PMModule.RecipeRunningInfo.IsLooping = false;
  1386. PMModule.RecipeRunningInfo.LoopCountCurrent = 0;
  1387. PMModule.RecipeRunningInfo.LoopCountSet = 0;
  1388. }
  1389. else
  1390. {
  1391. _currentSubRecipeStepNumber = recipeSteps[_currentSubRecipeStepNumber].LoopStartStep;
  1392. }
  1393. }
  1394. else
  1395. {
  1396. _currentSubRecipeStepNumber++;
  1397. }
  1398. }
  1399. private void RecipeLoopEndCheck(List<RecipeStep> recipeSteps)
  1400. {
  1401. if (_alarmAction == RecipeAlaramAction.JumpStep || _alarmAction == RecipeAlaramAction.JumpStepCancelCallLoop)
  1402. {
  1403. _currentStepNumber = _jumpStepNumber;
  1404. _alarmAction = RecipeAlaramAction.None;
  1405. _alarmNames.Clear();
  1406. return;
  1407. }
  1408. if (recipeSteps[_currentStepNumber].IsLoopEndStep)
  1409. {
  1410. if (IsJumpStepCancelCallLoop)
  1411. {
  1412. _currentStepNumber++;
  1413. IsJumpStepCancelCallLoop = false;
  1414. return;
  1415. }
  1416. //重新读取循环的设定次数
  1417. CurStepTotalLoopCount = recipeSteps[_currentStepNumber].LoopCount;
  1418. if (CurrentLoopCount >= CurStepTotalLoopCount)
  1419. {
  1420. CurrentLoopCount = CurStepTotalLoopCount = 0;
  1421. _currentStepNumber++;
  1422. PMModule.RecipeRunningInfo.IsLooping = false;
  1423. PMModule.RecipeRunningInfo.LoopCountCurrent = 0;
  1424. PMModule.RecipeRunningInfo.LoopCountSet = 0;
  1425. }
  1426. else
  1427. {
  1428. _currentStepNumber = recipeSteps[_currentStepNumber].LoopStartStep;
  1429. }
  1430. }
  1431. else
  1432. {
  1433. _currentStepNumber++;
  1434. }
  1435. }
  1436. private void CheckTolerance()
  1437. {
  1438. //foreach (var key in _trigMfcToleranceAlarms.Keys)
  1439. //{
  1440. // if (PMModule.GasMFCs.ContainsKey(key) && _trigMfcToleranceWarnings.ContainsKey(key))
  1441. // {
  1442. // _trigMfcToleranceAlarms[key].CLK = PMModule.GasMFCs[key].CheckToleranceAlarm();
  1443. // if (_trigMfcToleranceAlarms[key].Q)
  1444. // PMModule.GasMFCs[key].SetToleranceAlarm();
  1445. // _trigMfcToleranceWarnings[key].CLK = PMModule.GasMFCs[key].CheckToleranceWarning();
  1446. // if (_trigMfcToleranceWarnings[key].Q && !_trigMfcToleranceAlarms[key].Q)
  1447. // PMModule.GasMFCs[key].SetToleranceWarning();
  1448. // }
  1449. //}
  1450. //_trigHeaterBottomToleranceAlarm.CLK = PMModule.CheckHeaterBottomToleranceAlaram();
  1451. //if (_trigHeaterBottomToleranceAlarm.Q)
  1452. // PMModule.SetHeaterBottomToleranceAlaram();
  1453. //_trigHeaterBottomToleranceWarning.CLK = PMModule.CheckHeaterBottomToleranceWarning();
  1454. //if (_trigHeaterBottomToleranceWarning.Q && !_trigHeaterBottomToleranceAlarm.Q)
  1455. // PMModule.SetHeaterBottomToleranceWarning();
  1456. //_trigHeaterCenterBottomToleranceAlarm.CLK = PMModule.CheckHeaterCenterBottomToleranceAlaram();
  1457. //if (_trigHeaterCenterBottomToleranceAlarm.Q)
  1458. // PMModule.SetHeaterCenterBottomToleranceAlaram();
  1459. //_trigHeaterCenterBottomToleranceWarning.CLK = PMModule.CheckHeaterCenterBottomToleranceWarning();
  1460. //if (_trigHeaterCenterBottomToleranceWarning.Q && !_trigHeaterCenterBottomToleranceAlarm.Q)
  1461. // PMModule.SetHeaterCenterBottomToleranceWarning();
  1462. //_trigHeaterCenterToleranceAlarm.CLK = PMModule.CheckHeaterCenterToleranceAlaram();
  1463. //if (_trigHeaterCenterToleranceAlarm.Q)
  1464. // PMModule.SetHeaterCenterToleranceAlaram();
  1465. //_trigHeaterCenterToleranceWarning.CLK = PMModule.CheckHeaterCenterToleranceWarning();
  1466. //if (_trigHeaterCenterToleranceWarning.Q && !_trigHeaterCenterToleranceAlarm.Q)
  1467. // PMModule.SetHeaterCenterToleranceWarning();
  1468. //_trigHeaterCenterTopToleranceAlarm.CLK = PMModule.CheckHeaterCenterTopToleranceAlaram();
  1469. //if (_trigHeaterCenterTopToleranceAlarm.Q)
  1470. // PMModule.SetHeaterCenterTopToleranceAlaram();
  1471. //_trigHeaterCenterTopToleranceWarning.CLK = PMModule.CheckHeaterCenterTopToleranceWarning();
  1472. //if (_trigHeaterCenterTopToleranceWarning.Q && !_trigHeaterCenterTopToleranceAlarm.Q)
  1473. // PMModule.SetHeaterCenterTopToleranceWarning();
  1474. //_trigHeaterTopToleranceAlarm.CLK = PMModule.CheckHeaterTopToleranceAlaram();
  1475. //if (_trigHeaterTopToleranceAlarm.Q)
  1476. // PMModule.SetHeaterTopToleranceAlaram();
  1477. //_trigHeaterTopToleranceWarning.CLK = PMModule.CheckHeaterTopToleranceWarning();
  1478. //if (_trigHeaterTopToleranceWarning.Q && !_trigHeaterTopToleranceAlarm.Q)
  1479. // PMModule.SetHeaterTopToleranceWarning();
  1480. //_trigPressureToleranceAlarm.CLK = PMModule.CheckPressureToleranceAlaram();
  1481. //if (_trigPressureToleranceAlarm.Q)
  1482. // PMModule.SetPressureToleranceAlaram();
  1483. //_trigPressureToleranceWarning.CLK = PMModule.CheckPressureToleranceWarning();
  1484. //if (_trigPressureToleranceWarning.Q && !_trigPressureToleranceAlarm.Q)
  1485. // PMModule.SetPressureToleranceWarning();
  1486. }
  1487. private void ResetTrig()
  1488. {
  1489. PMModule.ResetAlarmCondition();
  1490. foreach (var key in _trigMfcToleranceAlarms.Keys)
  1491. {
  1492. if (_trigMfcToleranceWarnings.ContainsKey(key))
  1493. {
  1494. _trigMfcToleranceAlarms[key].RST = true;
  1495. _trigMfcToleranceWarnings[key].RST = true;
  1496. }
  1497. }
  1498. _trigHeaterBottomToleranceAlarm.RST = true;
  1499. _trigHeaterBottomToleranceWarning.RST = true;
  1500. _trigHeaterCenterBottomToleranceAlarm.RST = true;
  1501. _trigHeaterCenterBottomToleranceWarning.RST = true;
  1502. _trigHeaterCenterToleranceAlarm.RST = true;
  1503. _trigHeaterCenterToleranceWarning.RST = true;
  1504. _trigHeaterCenterTopToleranceAlarm.RST = true;
  1505. _trigHeaterCenterTopToleranceWarning.RST = true;
  1506. _trigHeaterTopToleranceAlarm.RST = true;
  1507. _trigHeaterTopToleranceWarning.RST = true;
  1508. _trigPressureToleranceAlarm.RST = true;
  1509. _trigPressureToleranceWarning.RST = true;
  1510. _trigInputSignalTimeOutAlarm.RST = true;
  1511. _trigTemperatureConvergenceTimeOutAlarm.RST = true;
  1512. _trigReachTempTimeOutAlarm.RST = true;
  1513. _trigPressureConvergenceTimeOutAlarm.RST = true;
  1514. _trigReachPressureTimeOutAlarm.RST = true;
  1515. _trigAutoProfileTimeOutAlarm.RST = true;
  1516. _trigHeaterProfileFinish.RST = true;
  1517. _trigLeakCheckFinish.RST = true;
  1518. _trigBoatWaitCondition.RST = true;
  1519. _trigAPCWaitCondition.RST = true;
  1520. _trigAUXWaitCondition.RST = true;
  1521. _trigHeaterWaitCondition.RST = true;
  1522. _trigMFCWaitCondition.RST = true;
  1523. _infoHeaterProfileFinish = "";
  1524. _infoAUXWaitCondition = "";
  1525. _infoHeaterWaitCondition = "";
  1526. _infoMFCWaitCondition = "";
  1527. }
  1528. private int GetDBRecipeType(string recipeTypeName)
  1529. {
  1530. if (string.IsNullOrEmpty(recipeTypeName))
  1531. return (int)RecipeTypeEnum.none;
  1532. if (Enum.TryParse<RecipeTypeEnum>(recipeTypeName, true, out var result))
  1533. return (int)result;
  1534. return (int)RecipeTypeEnum.none;
  1535. }
  1536. private void RecipeExec(string type, List<RecipeStep> curSteps, int currentStepNumber, double curStepElpasedTimeBeforePaused, int otherRecipeStartStepNumber = 0)
  1537. {
  1538. var reason = "";
  1539. _stepTimer.Start(curSteps[currentStepNumber].StepTime * 1000 - curStepElpasedTimeBeforePaused);
  1540. _showStepNo = currentStepNumber;
  1541. Notify($"{type} running step {currentStepNumber + 1}:{curSteps[currentStepNumber].StepName}");
  1542. var stopwatch = new Stopwatch();
  1543. stopwatch.Start();
  1544. //执行工艺程序命令
  1545. foreach (var recipeCmd in curSteps[currentStepNumber].RecipeCommands.Keys)
  1546. {
  1547. if (!OP.CanDoOperation($"{_doModule}.{recipeCmd}", out reason, curSteps[currentStepNumber].RecipeCommands[recipeCmd]))
  1548. {
  1549. if (!OP.CanDoOperation($"{Module}.{recipeCmd}", out reason, curSteps[currentStepNumber].RecipeCommands[recipeCmd]))
  1550. {
  1551. if (!OP.CanDoOperation($"{ModuleName.System}.{recipeCmd}", out reason, curSteps[currentStepNumber].RecipeCommands[recipeCmd]))
  1552. {
  1553. PMModule.CheckCanDoOperationAlarm.Set($"Can not execute {recipeCmd}, {reason}");
  1554. return;
  1555. }
  1556. else
  1557. {
  1558. OP.DoOperation($"{ModuleName.System}.{recipeCmd}", out string reason1, 0, curSteps[currentStepNumber].RecipeCommands[recipeCmd]);
  1559. }
  1560. }
  1561. else
  1562. {
  1563. OP.DoOperation($"{Module}.{recipeCmd}", out string reason1, 0, curSteps[currentStepNumber].RecipeCommands[recipeCmd]);
  1564. }
  1565. }
  1566. else
  1567. {
  1568. OP.DoOperation($"{_doModule}.{recipeCmd}", out string reason1, 0, curSteps[currentStepNumber].RecipeCommands[recipeCmd]);
  1569. }
  1570. }
  1571. LOG.Write($"step exec time {stopwatch.ElapsedMilliseconds}");
  1572. if (curSteps[currentStepNumber].EndBy == EnumEndByCondition.ByTime && !PMModule.IsBoatMoveToLoadPosition)
  1573. _state = RecipeRunningState.TimeWait;
  1574. else
  1575. _state = RecipeRunningState.ConditionWait;
  1576. _faCallback.RecipeStepStart(PMModule.Module, PMModule.RecipeRunningInfo.RecipeName, otherRecipeStartStepNumber != 0 ? otherRecipeStartStepNumber : currentStepNumber);
  1577. if (type == "Sub recipe")
  1578. _dbCallback.RecipeStepStart(PMModule.RecipeRunningInfo.InnerId.ToString(), _currentStepNumber, PMModule.RecipeRunningInfo.RecipeStepList.Count > _currentStepNumber ? PMModule.RecipeRunningInfo.RecipeStepList[_currentStepNumber].StepName : "",
  1579. PMModule.RecipeRunningInfo.RecipeStepList.Count > _currentStepNumber ? (float)PMModule.RecipeRunningInfo.RecipeStepList[_currentStepNumber].StepTime : 0,
  1580. $"{(otherRecipeStartStepNumber != 0 ? otherRecipeStartStepNumber : currentStepNumber)}", curSteps[currentStepNumber].StepName, (float)curSteps[currentStepNumber].StepTime,
  1581. $"{PMModule.RecipeRunningInfo.SubRecipeCurrentLoopCount}/{PMModule.RecipeRunningInfo.SubRecipeLoopCount}");
  1582. else
  1583. _dbCallback.RecipeStepStart(PMModule.RecipeRunningInfo.InnerId.ToString(), otherRecipeStartStepNumber != 0 ? otherRecipeStartStepNumber : currentStepNumber,
  1584. curSteps[currentStepNumber].StepName, (float)curSteps[currentStepNumber].StepTime, "", "", 0, "");
  1585. _fdc.Start(curSteps[currentStepNumber].RecipeCommands);
  1586. }
  1587. public void FACallBack(string triggerModule, string recipeAction, string module, string recipeName, string recipeStep, string jumpStpeId = "", string otherRecipeName = "")
  1588. {
  1589. if (triggerModule == ConstantsCommon.AlarmConditionTrigger)
  1590. {
  1591. switch (recipeAction)
  1592. {
  1593. case UniversalEvents.AlarmConditionTriggerReset:
  1594. _faCallback.AlarmConditionTriggerReset(module, recipeName, recipeStep, otherRecipeName);
  1595. break;
  1596. case UniversalEvents.AlarmConditionTriggerEnd:
  1597. _faCallback.AlarmConditionTriggerEnd(module, recipeName, recipeStep);
  1598. break;
  1599. case UniversalEvents.AlarmConditionTriggerHold:
  1600. _faCallback.AlarmConditionTriggerHold(module, recipeName, recipeStep);
  1601. break;
  1602. case UniversalEvents.AlarmConditionTriggerJumpStep:
  1603. _faCallback.AlarmConditionTriggerJumpStep(module, recipeName, recipeStep, jumpStpeId);
  1604. break;
  1605. case UniversalEvents.AlarmConditionTriggerCallAlarmRecipe:
  1606. _faCallback.AlarmConditionTriggerCallAlarmRecipe(module, recipeName, recipeStep, otherRecipeName);
  1607. break;
  1608. case UniversalEvents.AlarmConditionTriggerCallAbortRecipe:
  1609. _faCallback.AlarmConditionTriggerCallAbortRecipe(module, recipeName, recipeStep, otherRecipeName);
  1610. break;
  1611. }
  1612. Task.Delay(1000).ContinueWith(x =>
  1613. {
  1614. PMModule.RecipeAbnormalEnd(module, recipeName, recipeStep, recipeAction);
  1615. });
  1616. }
  1617. else if (triggerModule == ConstantsCommon.LeakCheckTrigger)
  1618. {
  1619. switch (recipeAction)
  1620. {
  1621. case UniversalEvents.LeakCheckTriggerReset:
  1622. _faCallback.LeakCheckTriggerReset(module, recipeName, recipeStep, otherRecipeName);
  1623. break;
  1624. case UniversalEvents.LeakCheckTriggerEnd:
  1625. _faCallback.LeakCheckTriggerEnd(module, recipeName, recipeStep);
  1626. break;
  1627. case UniversalEvents.LeakCheckTriggerHold:
  1628. _faCallback.LeakCheckTriggerHold(module, recipeName, recipeStep);
  1629. break;
  1630. case UniversalEvents.LeakCheckTriggerJumpStep:
  1631. _faCallback.LeakCheckTriggerJumpStep(module, recipeName, recipeStep, jumpStpeId);
  1632. break;
  1633. case UniversalEvents.LeakCheckTriggerCallAlarmRecipe:
  1634. _faCallback.LeakCheckTriggerCallAlarmRecipe(module, recipeName, recipeStep, otherRecipeName);
  1635. break;
  1636. case UniversalEvents.LeakCheckTriggerCallAbortRecipe:
  1637. _faCallback.LeakCheckTriggerCallAbortRecipe(module, recipeName, recipeStep, otherRecipeName);
  1638. break;
  1639. }
  1640. Task.Delay(1000).ContinueWith(x =>
  1641. {
  1642. PMModule.RecipeAbnormalEnd(module, recipeName, recipeStep, recipeAction);
  1643. });
  1644. }
  1645. else if (triggerModule == ConstantsCommon.ManualTrigger)
  1646. {
  1647. switch (recipeAction)
  1648. {
  1649. case UniversalEvents.ManualTriggerRecipeHold:
  1650. _faCallback.ManualTriggerRecipeHold(module, recipeName, recipeStep);
  1651. break;
  1652. case UniversalEvents.ManualTriggerRecipeRelease:
  1653. _faCallback.ManualTriggerRecipeRelease(module, recipeName, recipeStep);
  1654. break;
  1655. case UniversalEvents.ManualTriggerRecipeSkip:
  1656. _faCallback.ManualTriggerRecipeSkip(module, recipeName, recipeStep);
  1657. break;
  1658. case UniversalEvents.ManualTriggerRecipeJump:
  1659. _faCallback.ManualTriggerRecipeJump(module, recipeName, recipeStep, jumpStpeId);
  1660. break;
  1661. case UniversalEvents.ManualTriggerRecipeAbort:
  1662. _faCallback.ManualTriggerRecipeAbort(module, recipeName, recipeStep, otherRecipeName);
  1663. break;
  1664. }
  1665. Task.Delay(1000).ContinueWith(x =>
  1666. {
  1667. PMModule.RecipeAbnormalEnd(module, recipeName, recipeStep, recipeAction);
  1668. });
  1669. }
  1670. else if (triggerModule == ConstantsCommon.RecipeTrigger)
  1671. {
  1672. switch (recipeAction)
  1673. {
  1674. case UniversalEvents.RecipeTriggerReset:
  1675. _faCallback.RecipeTriggerReset(module, recipeName, recipeStep, otherRecipeName);
  1676. break;
  1677. case UniversalEvents.RecipeTriggerEnd:
  1678. _faCallback.RecipeTriggerEnd(module, recipeName, recipeStep);
  1679. break;
  1680. case UniversalEvents.RecipeTriggerHold:
  1681. _faCallback.RecipeTriggerHold(module, recipeName, recipeStep);
  1682. break;
  1683. case UniversalEvents.RecipeTriggerLeakCheck:
  1684. _faCallback.RecipeTriggerLeakCheck(module, recipeName, recipeStep);
  1685. break;
  1686. case UniversalEvents.RecipeTriggerJumpStep:
  1687. _faCallback.RecipeTriggerJumpStep(module, recipeName, recipeStep, otherRecipeName);
  1688. break;
  1689. case UniversalEvents.RecipeTriggerCallSubRecipe:
  1690. _faCallback.RecipeTriggerCallSubRecipe(module, recipeName, recipeStep, otherRecipeName);
  1691. break;
  1692. }
  1693. }
  1694. }
  1695. }
  1696. }