Process.cs 96 KB

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