Process.cs 96 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977
  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. Task.Delay(1000).ContinueWith(a =>
  337. {
  338. _faCallback.RecipeStart(PMModule.Module, PMModule.RecipeRunningInfo.RecipeName);
  339. });
  340. }
  341. }
  342. if (curSteps[_currentSubRecipeStepNumber].IsLoopStartStep)
  343. {
  344. CurrentSubRecipeLoopCount++;
  345. PMModule.RecipeRunningInfo.IsLooping = true;
  346. PMModule.RecipeRunningInfo.LoopCountCurrent = CurrentSubRecipeLoopCount - 1;//即使不循环,本身也有一次。本身的一次不算,所以减1
  347. PMModule.RecipeRunningInfo.LoopCountSet = curSteps[_currentSubRecipeStepNumber].LoopCount - 1;//即使不循环,本身也有一次。本身的一次不算,所以减1
  348. }
  349. if (curSteps[_currentSubRecipeStepNumber].IsJumpStep)
  350. {
  351. _faCallback.RecipeTriggerJumpStep(Module, PMModule.RecipeRunningInfo.RecipeName, _currentStepNumber.ToString(), curSteps[_currentStepNumber].JumpStepNo.ToString());
  352. _currentSubRecipeStepNumber = curSteps[_currentSubRecipeStepNumber].JumpStepNo;
  353. }
  354. PMModule.SetFDCRecipeStepName(IsSubReciep, curSteps[_currentSubRecipeStepNumber].StepName, (_currentSubRecipeStepNumber + 1).ToString());
  355. RecipeExec("Sub recipe", curSteps, _currentSubRecipeStepNumber, _curStepElpasedTimeBeforePaused, _currentSubRecipeStepNumber + 1);
  356. }
  357. else
  358. {
  359. if (curSteps[_currentStepNumber].IsLoopStartStep)
  360. {
  361. CurrentLoopCount++;
  362. PMModule.RecipeRunningInfo.IsLooping = true;
  363. PMModule.RecipeRunningInfo.LoopCountCurrent = CurrentLoopCount - 1;//即使不循环,本身也有一次。本身的一次不算,所以减1
  364. PMModule.RecipeRunningInfo.LoopCountSet = curSteps[_currentStepNumber].LoopCount - 1;//即使不循环,本身也有一次。本身的一次不算,所以减1
  365. }
  366. if (curSteps[_currentStepNumber].IsJumpStep)
  367. {
  368. _faCallback.RecipeTriggerJumpStep(Module, PMModule.RecipeRunningInfo.RecipeName, _currentStepNumber.ToString(), curSteps[_currentStepNumber].JumpStepNo.ToString());
  369. curSteps[_currentStepNumber].IsJumpStep = false;//只执行一次
  370. _currentStepNumber = curSteps[_currentStepNumber].JumpStepNo;
  371. }
  372. PMModule.SetFDCRecipeStepName(IsSubReciep, curSteps[_currentStepNumber].StepName, _currentStepNumber.ToString());
  373. RecipeExec("Main recipe", curSteps, _currentStepNumber, _curStepElpasedTimeBeforePaused);
  374. }
  375. }
  376. break;
  377. case RecipeRunningState.TimeWait:
  378. //if (PMModule.IsPaused)
  379. //{
  380. // _state = RecipeRunningState.Paused;
  381. // break;
  382. //}
  383. var leakCheck = PMModule.CheckLeakCheckFinish();
  384. _trigLeakCheckFinish.CLK = !leakCheck;
  385. if (_trigLeakCheckFinish.Q)
  386. LOG.Write($"Wait condition:leak check");
  387. if (_stepTimer.IsTimeout())
  388. {
  389. var heaterProfile = PMModule.CheckHeaterProfileFinish(out reason);
  390. _trigHeaterProfileFinish.CLK = !heaterProfile || _infoHeaterProfileFinish != reason;
  391. if (_trigHeaterProfileFinish.Q)
  392. LOG.Write($"Wait condition:heater profile--{reason}");
  393. _infoHeaterProfileFinish = reason;
  394. var boatWaitCondition = PMModule.CheckBoatWaitCondition(out reason);
  395. _trigBoatWaitCondition.CLK = !boatWaitCondition;
  396. if (_trigBoatWaitCondition.Q)
  397. LOG.Write($"Wait condition:boat--{reason}");
  398. var apcWaitCondition = PMModule.CheckAPCWaitCondition(out reason);
  399. _trigAPCWaitCondition.CLK = !apcWaitCondition;
  400. if (_trigAPCWaitCondition.Q)
  401. LOG.Write($"Wait condition:APC--{reason}");
  402. var auxWaitCondition = PMModule.CheckAUXWaitCondition(out reason);
  403. _trigAUXWaitCondition.CLK = !auxWaitCondition || _infoAUXWaitCondition != reason;
  404. if (_trigAUXWaitCondition.Q)
  405. LOG.Write($"Wait condition:heater profile--{reason}");
  406. _infoAUXWaitCondition = reason;
  407. var heaterWaitCondition = PMModule.CheckHeaterWaitCondition(out reason);
  408. _trigHeaterWaitCondition.CLK = !heaterWaitCondition || _infoHeaterWaitCondition != reason;
  409. if (_trigHeaterWaitCondition.Q)
  410. LOG.Write($"Wait condition:heater--{reason}");
  411. _infoHeaterWaitCondition = reason;
  412. var mfcWaitCondition = PMModule.CheckMFCWaitCondition(out reason);
  413. _trigMFCWaitCondition.CLK = !mfcWaitCondition || _infoMFCWaitCondition != reason;
  414. if (_trigMFCWaitCondition.Q)
  415. LOG.Write($"Wait condition:MFC--{reason}");
  416. _infoMFCWaitCondition = reason;
  417. if (heaterProfile &&
  418. leakCheck &&
  419. boatWaitCondition &&
  420. apcWaitCondition &&
  421. auxWaitCondition &&
  422. heaterWaitCondition &&
  423. mfcWaitCondition)
  424. {
  425. _state = RecipeRunningState.StepCompleted;
  426. }
  427. else
  428. {
  429. PMModule.IsWait = true;
  430. }
  431. }
  432. else
  433. {
  434. PMModule.CheckHeaterProfileFinish(out reason);
  435. PMModule.CheckBoatWaitCondition(out reason);
  436. PMModule.CheckAPCWaitCondition(out reason);
  437. PMModule.CheckAUXWaitCondition(out reason);
  438. PMModule.CheckHeaterWaitCondition(out reason);
  439. PMModule.CheckMFCWaitCondition(out reason);
  440. }
  441. break;
  442. case RecipeRunningState.ConditionWait:
  443. {
  444. if (!PMModule.CheckBoatState() && !PMModule.IsBoatMoveToLoadPosition)
  445. break;
  446. var heaterProfile = PMModule.CheckHeaterProfileFinish(out reason);
  447. _trigHeaterProfileFinish.CLK = !heaterProfile || _infoHeaterProfileFinish != reason;
  448. if (_trigHeaterProfileFinish.Q)
  449. LOG.Write($"Wait condition:heater profile--{reason}");
  450. _infoHeaterProfileFinish = reason;
  451. leakCheck = PMModule.CheckLeakCheckFinish();
  452. _trigLeakCheckFinish.CLK = !leakCheck;
  453. if (_trigLeakCheckFinish.Q)
  454. LOG.Write($"Wait condition:leak check");
  455. var boatWaitCondition = PMModule.CheckBoatWaitCondition(out reason);
  456. _trigBoatWaitCondition.CLK = !boatWaitCondition;
  457. if (_trigBoatWaitCondition.Q)
  458. LOG.Write($"Wait condition:boat--{reason}");
  459. var apcWaitCondition = PMModule.CheckAPCWaitCondition(out reason);
  460. _trigAPCWaitCondition.CLK = !apcWaitCondition;
  461. if (_trigAPCWaitCondition.Q)
  462. LOG.Write($"Wait condition:APC--{reason}");
  463. var auxWaitCondition = PMModule.CheckAUXWaitCondition(out reason);
  464. _trigAUXWaitCondition.CLK = !auxWaitCondition || _infoAUXWaitCondition != reason;
  465. if (_trigAUXWaitCondition.Q)
  466. LOG.Write($"Wait condition:heater profile--{reason}");
  467. _infoAUXWaitCondition = reason;
  468. var heaterWaitCondition = PMModule.CheckHeaterWaitCondition(out reason);
  469. _trigHeaterWaitCondition.CLK = !heaterWaitCondition || _infoHeaterWaitCondition != reason;
  470. if (_trigHeaterWaitCondition.Q)
  471. LOG.Write($"Wait condition:heater--{reason}");
  472. _infoHeaterWaitCondition = reason;
  473. var mfcWaitCondition = PMModule.CheckMFCWaitCondition(out reason);
  474. _trigMFCWaitCondition.CLK = !mfcWaitCondition || _infoMFCWaitCondition != reason;
  475. if (_trigMFCWaitCondition.Q)
  476. LOG.Write($"Wait condition:MFC--{reason}");
  477. _infoMFCWaitCondition = reason;
  478. if (heaterProfile &&
  479. leakCheck &&
  480. boatWaitCondition &&
  481. apcWaitCondition &&
  482. auxWaitCondition &&
  483. heaterWaitCondition &&
  484. mfcWaitCondition)
  485. {
  486. _state = RecipeRunningState.StepCompleted;
  487. }
  488. if (_stepTimer.IsTimeout())
  489. {
  490. if (PMModule.IsBoatMoveToLoadPosition)
  491. {
  492. _trigBoatMoveToLoadPositionTimeout.CLK = !boatWaitCondition;
  493. if (_trigBoatMoveToLoadPositionTimeout.Q)
  494. PMModule.BoatMoveToLoadPositionTimeoutWarning.Set();
  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. PMModule.StringProcessFlowState = PMModule.ProcessFlowState.Standby.ToString();
  1014. _faCallback.RecipeComplete(PMModule.Module, PMModule.RecipeRunningInfo.RecipeName);
  1015. _dbCallback.RecipeComplete(PMModule.RecipeRunningInfo.InnerId.ToString());
  1016. _fdc.Stop();
  1017. }
  1018. else
  1019. {
  1020. if (PMModule.IsExcuteIdleRecipe)
  1021. {
  1022. _faCallback.RecipeComplete(PMModule.Module, PMModule.RecipeRunningInfo.RecipeName);
  1023. _dbCallback.RecipeComplete(PMModule.RecipeRunningInfo.InnerId.ToString());
  1024. _fdc.Stop();
  1025. }
  1026. else
  1027. {
  1028. _faCallback.RecipeFailed(PMModule.Module, PMModule.RecipeRunningInfo.RecipeName);
  1029. _dbCallback.RecipeFailed(PMModule.RecipeRunningInfo.InnerId.ToString());
  1030. _fdc.Stop();
  1031. };
  1032. }
  1033. }
  1034. public void PauseRecipe()
  1035. {
  1036. PMModule.IsPaused = true;
  1037. ContinueAction = RecipeContinueMode.None;
  1038. }
  1039. public void ContinueRecipe()
  1040. {
  1041. PMModule.IsPaused = false;
  1042. ContinueAction = RecipeContinueMode.StepContinue;
  1043. var step = IsSubReciep ? _currentSubRecipeStepNumber + 1 : _currentStepNumber;
  1044. }
  1045. public void SkipCurrentRecipeStep()
  1046. {
  1047. if (_state == RecipeRunningState.ConditionWait || _state == RecipeRunningState.TimeWait || _state == RecipeRunningState.Paused)
  1048. {
  1049. _state = RecipeRunningState.StepCompleted;
  1050. _loopEnd = true;
  1051. PMModule.RecipeRunningInfo.IsLooping = false;
  1052. PMModule.RecipeRunningInfo.LoopCountCurrent = 0;
  1053. PMModule.RecipeRunningInfo.LoopCountSet = 0;
  1054. PMModule.IsPaused = false;
  1055. if (!_holdTimer.IsIdle())
  1056. {
  1057. _holdTimeElpasedTime += _holdTimer.GetElapseTime();
  1058. _holdTimer.Stop();
  1059. }
  1060. }
  1061. if (IsSubReciep)
  1062. {
  1063. ResetLoop(PMModule.RecipeRunningInfo.RecipeStepList[_currentStepNumber].SubRecipeSteps, _currentSubRecipeStepNumber);
  1064. }
  1065. else
  1066. {
  1067. ResetLoop(PMModule.RecipeRunningInfo.RecipeStepList, _currentStepNumber);
  1068. }
  1069. }
  1070. private void ResetLoop(List<RecipeStep> checkRecipeSeps, int currentStepNumber)
  1071. {
  1072. if (checkRecipeSeps == null)
  1073. return;
  1074. var hasLoopStart = false;
  1075. for (int i = currentStepNumber; i >= 0; i--)
  1076. {
  1077. if (checkRecipeSeps[i].IsLoopStartStep)
  1078. {
  1079. hasLoopStart = true;
  1080. break;
  1081. }
  1082. if (checkRecipeSeps[i].IsLoopEndStep)
  1083. {
  1084. hasLoopStart = false;//前面有end,说明没有循环
  1085. break;
  1086. }
  1087. }
  1088. if (hasLoopStart)
  1089. {
  1090. for (int i = currentStepNumber; i < checkRecipeSeps.Count; i++)
  1091. {
  1092. if (checkRecipeSeps[i].IsLoopStartStep)
  1093. {
  1094. break;//没有循环
  1095. }
  1096. if (checkRecipeSeps[i].IsLoopEndStep)
  1097. {
  1098. checkRecipeSeps[i].IsLoopEndStep = false;//跳出skip step之间的循环
  1099. break;
  1100. }
  1101. }
  1102. }
  1103. }
  1104. public void LeakCheckRetry()
  1105. {
  1106. JumpCurrentRecipeStep(_currentStepNumber - 1, PMModule.RecipeRunningInfo.RecipeStepList[_currentStepNumber - 1].StepName);
  1107. }
  1108. public void JumpCurrentRecipeStep(int stepNumber, string stepName, bool isAlarmConditionCall = false)
  1109. {
  1110. PMModule.StopLeakCheckTimer();
  1111. LOG.Write($"Jump to step stepNumber={stepNumber} stepName={stepName}, currentStepNumber={_currentStepNumber}");
  1112. if (_state == RecipeRunningState.ConditionWait || _state == RecipeRunningState.TimeWait ||
  1113. _state == RecipeRunningState.Paused || _state == RecipeRunningState.ExecStep)
  1114. {
  1115. _loopEnd = true;
  1116. PMModule.RecipeRunningInfo.IsLooping = false;
  1117. PMModule.RecipeRunningInfo.LoopCountCurrent = 0;
  1118. PMModule.RecipeRunningInfo.LoopCountSet = 0;
  1119. CurrentLoopCount = 0;
  1120. CurrentAbortRecipeLoopCount = 0;
  1121. CurrentSubRecipeLoopCount = 0;
  1122. IsSubReciep = false;
  1123. if (IsSubReciep)
  1124. {
  1125. _faCallback.RecipeStepEnd(PMModule.Module, PMModule.RecipeRunningInfo.RecipeName, _currentSubRecipeStepNumber + 1);
  1126. _dbCallback.RecipeStepEnd(PMModule.RecipeRunningInfo.InnerId.ToString(), _currentSubRecipeStepNumber + 1, _fdc.DataList, SC.GetStringValue("PM1.TempCorrection"), SC.GetStringValue("PM1.Heater.PID"));
  1127. ResetLoop(PMModule.RecipeRunningInfo.RecipeStepList[_currentStepNumber].SubRecipeSteps, _currentSubRecipeStepNumber);
  1128. }
  1129. else
  1130. {
  1131. _faCallback.RecipeStepEnd(PMModule.Module, PMModule.RecipeRunningInfo.RecipeName, _currentStepNumber);
  1132. _dbCallback.RecipeStepEnd(PMModule.RecipeRunningInfo.InnerId.ToString(), _currentStepNumber, _fdc.DataList, SC.GetStringValue("PM1.TempCorrection"), SC.GetStringValue("PM1.Heater.PID"));
  1133. ResetLoop(PMModule.RecipeRunningInfo.RecipeStepList, _currentStepNumber);
  1134. }
  1135. if (_callSubSteps != null)
  1136. {
  1137. foreach (var key in _callSubSteps.Keys)
  1138. {
  1139. if (PMModule.RecipeRunningInfo.RecipeStepList.Count > key)
  1140. {
  1141. PMModule.RecipeRunningInfo.RecipeStepList[key].IsCallSubStep = _callSubSteps[key].Item1;
  1142. PMModule.RecipeRunningInfo.RecipeStepList[key].SubRecipeLoopCount = _callSubSteps[key].Item2;
  1143. }
  1144. }
  1145. _currentSubRecipeStepNumber = CurSubRecipeStepTotalLoopCount = 0;
  1146. }
  1147. _isJumpStep = true;
  1148. _currentStepNumber = stepNumber - 1;
  1149. if (_currentStepNumber < 0)
  1150. _currentStepNumber = 0;
  1151. _totalElpasedTime = RefreshElpasedTime();
  1152. _state = RecipeRunningState.StepCompleted;
  1153. PMModule.IsPaused = false;
  1154. if (!_holdTimer.IsIdle())
  1155. {
  1156. _holdTimeElpasedTime += _holdTimer.GetElapseTime();
  1157. _holdTimer.Stop();
  1158. }
  1159. }
  1160. }
  1161. private double RefreshElpasedTime()
  1162. {
  1163. double total = 0;
  1164. try
  1165. {
  1166. for (int i = 0; i < _currentStepNumber; i++)
  1167. {
  1168. if (!PMModule.RecipeRunningInfo.RecipeStepList[i].IsJumpStep)
  1169. {
  1170. if (PMModule.RecipeRunningInfo.RecipeStepList[i].IsLoopEndStep)
  1171. {
  1172. int iLoopStartStep = PMModule.RecipeRunningInfo.RecipeStepList[i].LoopStartStep;
  1173. for (int j = 0; j < PMModule.RecipeRunningInfo.RecipeStepList[i].LoopCount; j++)
  1174. {
  1175. for (int m = iLoopStartStep; m <= i; m++)
  1176. {
  1177. if (PMModule.RecipeRunningInfo.RecipeStepList[i].SubRecipeSteps != null && PMModule.RecipeRunningInfo.RecipeStepList[i].SubRecipeSteps.Count > _currentSubRecipeStepNumber)
  1178. {
  1179. total += SubRecipeCalTotalTime(i) * PMModule.RecipeRunningInfo.RecipeStepList[i].SubRecipeLoopCount;
  1180. }
  1181. total += PMModule.RecipeRunningInfo.RecipeStepList[m].StepTime;
  1182. }
  1183. }
  1184. }
  1185. else
  1186. {
  1187. if (PMModule.RecipeRunningInfo.RecipeStepList[i].SubRecipeSteps != null &&
  1188. PMModule.RecipeRunningInfo.RecipeStepList[i].SubRecipeSteps.Count > _currentSubRecipeStepNumber)
  1189. {
  1190. total += SubRecipeCalTotalTime(i) * PMModule.RecipeRunningInfo.RecipeStepList[i].SubRecipeLoopCount;
  1191. }
  1192. total += PMModule.RecipeRunningInfo.RecipeStepList[i].StepTime;
  1193. }
  1194. }
  1195. }
  1196. }
  1197. catch (Exception ex)
  1198. {
  1199. LOG.Write(ex);
  1200. return -1;
  1201. }
  1202. return (int)total;
  1203. }
  1204. public void RespondAlarm(string name)
  1205. {
  1206. if (!_alarmNames.Contains(name))
  1207. _alarmNames.Add(name);
  1208. }
  1209. protected int CalcRecipeTime()
  1210. {
  1211. double total = 0;
  1212. int iStart = PMModule.IsJobProcess ? 1 : 0;
  1213. try
  1214. {
  1215. for (int i = iStart; i < PMModule.RecipeRunningInfo.RecipeStepList.Count; i++)
  1216. //for (int i = PMModule.RecipeRunningInfo.RecipeStepList.Count - 1; i <= iStart; i--)
  1217. {
  1218. if (!PMModule.RecipeRunningInfo.RecipeStepList[i].IsJumpStep)
  1219. {
  1220. if (PMModule.RecipeRunningInfo.RecipeStepList[i].IsLoopEndStep)
  1221. {
  1222. int iLoopStartStep = PMModule.RecipeRunningInfo.RecipeStepList[i].LoopStartStep;
  1223. total += PMModule.RecipeRunningInfo.RecipeStepList[i].StepTime;
  1224. for (int j = 0; j < PMModule.RecipeRunningInfo.RecipeStepList[i].LoopCount - 1; j++)
  1225. {
  1226. for (int m = iLoopStartStep; m <= i; m++)
  1227. {
  1228. if (PMModule.RecipeRunningInfo.RecipeStepList[i].SubRecipeSteps != null && PMModule.RecipeRunningInfo.RecipeStepList[i].SubRecipeSteps.Count > _currentSubRecipeStepNumber)
  1229. {
  1230. total += SubRecipeCalTotalTime(i) * PMModule.RecipeRunningInfo.RecipeStepList[i].SubRecipeLoopCount;
  1231. }
  1232. total += PMModule.RecipeRunningInfo.RecipeStepList[m].StepTime;
  1233. }
  1234. }
  1235. }
  1236. else
  1237. {
  1238. if (PMModule.RecipeRunningInfo.RecipeStepList[i].SubRecipeSteps != null && PMModule.RecipeRunningInfo.RecipeStepList[i].SubRecipeSteps.Count > _currentSubRecipeStepNumber)
  1239. {
  1240. total += SubRecipeCalTotalTime(i) * PMModule.RecipeRunningInfo.RecipeStepList[i].SubRecipeLoopCount;
  1241. }
  1242. total += PMModule.RecipeRunningInfo.RecipeStepList[i].StepTime;
  1243. }
  1244. }
  1245. else
  1246. {
  1247. i = PMModule.RecipeRunningInfo.RecipeStepList[i].JumpStepNo - 1;// -1是因为i++
  1248. }
  1249. if (i < PMModule.RecipeRunningInfo.RecipeStepList.Count - 1)
  1250. {
  1251. _remainTimeExcludeEnd = total;//获取除最后一步外的process时间,End步会cooling
  1252. }
  1253. }
  1254. }
  1255. catch (Exception ex)
  1256. {
  1257. LOG.Write(ex);
  1258. return -1;
  1259. }
  1260. return (int)total;
  1261. }
  1262. private int AbortRecipeCalTotalTime()
  1263. {
  1264. double total = 0;
  1265. List<RecipeStep> abortRecipeSteps;
  1266. abortRecipeSteps = PMModule.RecipeRunningInfo.RecipeStepList[_currentStepNumber].AbortRecipeSteps;
  1267. try
  1268. {
  1269. for (int i = 0; i < abortRecipeSteps.Count; i++)
  1270. {
  1271. if (!abortRecipeSteps[i].IsJumpStep)
  1272. {
  1273. if (abortRecipeSteps[i].IsLoopStartStep)
  1274. {
  1275. int iLoopEndStep = 0;
  1276. for (int j = 0; j < abortRecipeSteps[i].LoopCount; j++)
  1277. {
  1278. for (int m = i; m < abortRecipeSteps.Count; m++)
  1279. {
  1280. total += abortRecipeSteps[m].StepTime;
  1281. if (abortRecipeSteps[m].IsLoopEndStep)
  1282. {
  1283. iLoopEndStep = m;
  1284. break;
  1285. }
  1286. }
  1287. }
  1288. i = iLoopEndStep;
  1289. }
  1290. else
  1291. {
  1292. total += abortRecipeSteps[i].StepTime;
  1293. }
  1294. }
  1295. else
  1296. {
  1297. i = abortRecipeSteps[i].JumpStepNo - 1;// -1是因为i++
  1298. }
  1299. }
  1300. }
  1301. catch (Exception ex)
  1302. {
  1303. LOG.Write(ex);
  1304. return -1;
  1305. }
  1306. return (int)total;
  1307. }
  1308. public void SetContinue(string continueMode)
  1309. {
  1310. switch (continueMode)
  1311. {
  1312. case "Step continue":
  1313. ContinueAction = RecipeContinueMode.StepContinue;
  1314. break;
  1315. case "Step restart":
  1316. ContinueAction = RecipeContinueMode.StepRestart;
  1317. break;
  1318. case "Next step":
  1319. ContinueAction = RecipeContinueMode.NextStep;
  1320. break;
  1321. case "Recipe restart":
  1322. ContinueAction = RecipeContinueMode.RecipeRestart;
  1323. break;
  1324. case "Recipe complete":
  1325. ContinueAction = RecipeContinueMode.RecipeCompleted;
  1326. break;
  1327. case "Wafer return and job stop":
  1328. ContinueAction = RecipeContinueMode.WaferReturnAndJobStop;
  1329. break;
  1330. }
  1331. PMModule.ResetToleranceChecker();
  1332. }
  1333. private double SubRecipeCalTotalTime(int currentStepNumber)
  1334. {
  1335. double total = 0;
  1336. for (int k = _currentSubRecipeStepNumber; k < PMModule.RecipeRunningInfo.RecipeStepList[currentStepNumber].SubRecipeSteps.Count; k++)
  1337. {
  1338. if (!PMModule.RecipeRunningInfo.RecipeStepList[currentStepNumber].SubRecipeSteps[k].IsJumpStep)
  1339. {
  1340. if (PMModule.RecipeRunningInfo.RecipeStepList[currentStepNumber].SubRecipeSteps[k].IsLoopEndStep)
  1341. {
  1342. int iSystemLoopStartStep = PMModule.RecipeRunningInfo.RecipeStepList[currentStepNumber].SubRecipeSteps[k].LoopStartStep;
  1343. total += PMModule.RecipeRunningInfo.RecipeStepList[currentStepNumber].SubRecipeSteps[k].StepTime;
  1344. for (int n = 0; n < PMModule.RecipeRunningInfo.RecipeStepList[currentStepNumber].SubRecipeSteps[k].LoopCount - 1; n++)
  1345. {
  1346. for (int l = iSystemLoopStartStep; l <= k; l++)
  1347. {
  1348. total += PMModule.RecipeRunningInfo.RecipeStepList[currentStepNumber].SubRecipeSteps[l].StepTime;
  1349. }
  1350. }
  1351. }
  1352. else
  1353. {
  1354. total += PMModule.RecipeRunningInfo.RecipeStepList[currentStepNumber].SubRecipeSteps[k].StepTime;
  1355. }
  1356. }
  1357. else
  1358. {
  1359. k = PMModule.RecipeRunningInfo.RecipeStepList[currentStepNumber].SubRecipeSteps[k].JumpStepNo - 1;// -1是因为k++
  1360. }
  1361. }
  1362. return total;
  1363. }
  1364. private void SubRecipeLoopEndCheck(List<RecipeStep> recipeSteps)
  1365. {
  1366. if (_alarmAction == RecipeAlaramAction.JumpStep || _alarmAction == RecipeAlaramAction.JumpStepCancelCallLoop)
  1367. {
  1368. _currentSubRecipeStepNumber = _jumpStepNumber;
  1369. _alarmAction = RecipeAlaramAction.None;
  1370. _alarmNames.Clear();
  1371. return;
  1372. }
  1373. if (recipeSteps[_currentSubRecipeStepNumber].IsLoopEndStep)
  1374. {
  1375. if (IsJumpStepCancelCallLoop)
  1376. {
  1377. _currentSubRecipeStepNumber++;
  1378. IsJumpStepCancelCallLoop = false;
  1379. return;
  1380. }
  1381. //重新读取循环的设定次数
  1382. CurSubRecipeStepTotalLoopCount = recipeSteps[_currentSubRecipeStepNumber].LoopCount;
  1383. if (CurrentSubRecipeLoopCount >= CurSubRecipeStepTotalLoopCount)
  1384. {
  1385. CurrentSubRecipeLoopCount = CurSubRecipeStepTotalLoopCount = 0;
  1386. _currentSubRecipeStepNumber++;
  1387. PMModule.RecipeRunningInfo.IsLooping = false;
  1388. PMModule.RecipeRunningInfo.LoopCountCurrent = 0;
  1389. PMModule.RecipeRunningInfo.LoopCountSet = 0;
  1390. }
  1391. else
  1392. {
  1393. _currentSubRecipeStepNumber = recipeSteps[_currentSubRecipeStepNumber].LoopStartStep;
  1394. }
  1395. }
  1396. else
  1397. {
  1398. _currentSubRecipeStepNumber++;
  1399. }
  1400. }
  1401. private void RecipeLoopEndCheck(List<RecipeStep> recipeSteps)
  1402. {
  1403. if (_alarmAction == RecipeAlaramAction.JumpStep || _alarmAction == RecipeAlaramAction.JumpStepCancelCallLoop)
  1404. {
  1405. _currentStepNumber = _jumpStepNumber;
  1406. _alarmAction = RecipeAlaramAction.None;
  1407. _alarmNames.Clear();
  1408. return;
  1409. }
  1410. if (recipeSteps[_currentStepNumber].IsLoopEndStep)
  1411. {
  1412. if (IsJumpStepCancelCallLoop)
  1413. {
  1414. _currentStepNumber++;
  1415. IsJumpStepCancelCallLoop = false;
  1416. return;
  1417. }
  1418. //重新读取循环的设定次数
  1419. CurStepTotalLoopCount = recipeSteps[_currentStepNumber].LoopCount;
  1420. if (CurrentLoopCount >= CurStepTotalLoopCount)
  1421. {
  1422. CurrentLoopCount = CurStepTotalLoopCount = 0;
  1423. _currentStepNumber++;
  1424. PMModule.RecipeRunningInfo.IsLooping = false;
  1425. PMModule.RecipeRunningInfo.LoopCountCurrent = 0;
  1426. PMModule.RecipeRunningInfo.LoopCountSet = 0;
  1427. }
  1428. else
  1429. {
  1430. _currentStepNumber = recipeSteps[_currentStepNumber].LoopStartStep;
  1431. }
  1432. }
  1433. else
  1434. {
  1435. _currentStepNumber++;
  1436. }
  1437. }
  1438. private void CheckTolerance()
  1439. {
  1440. //foreach (var key in _trigMfcToleranceAlarms.Keys)
  1441. //{
  1442. // if (PMModule.GasMFCs.ContainsKey(key) && _trigMfcToleranceWarnings.ContainsKey(key))
  1443. // {
  1444. // _trigMfcToleranceAlarms[key].CLK = PMModule.GasMFCs[key].CheckToleranceAlarm();
  1445. // if (_trigMfcToleranceAlarms[key].Q)
  1446. // PMModule.GasMFCs[key].SetToleranceAlarm();
  1447. // _trigMfcToleranceWarnings[key].CLK = PMModule.GasMFCs[key].CheckToleranceWarning();
  1448. // if (_trigMfcToleranceWarnings[key].Q && !_trigMfcToleranceAlarms[key].Q)
  1449. // PMModule.GasMFCs[key].SetToleranceWarning();
  1450. // }
  1451. //}
  1452. //_trigHeaterBottomToleranceAlarm.CLK = PMModule.CheckHeaterBottomToleranceAlaram();
  1453. //if (_trigHeaterBottomToleranceAlarm.Q)
  1454. // PMModule.SetHeaterBottomToleranceAlaram();
  1455. //_trigHeaterBottomToleranceWarning.CLK = PMModule.CheckHeaterBottomToleranceWarning();
  1456. //if (_trigHeaterBottomToleranceWarning.Q && !_trigHeaterBottomToleranceAlarm.Q)
  1457. // PMModule.SetHeaterBottomToleranceWarning();
  1458. //_trigHeaterCenterBottomToleranceAlarm.CLK = PMModule.CheckHeaterCenterBottomToleranceAlaram();
  1459. //if (_trigHeaterCenterBottomToleranceAlarm.Q)
  1460. // PMModule.SetHeaterCenterBottomToleranceAlaram();
  1461. //_trigHeaterCenterBottomToleranceWarning.CLK = PMModule.CheckHeaterCenterBottomToleranceWarning();
  1462. //if (_trigHeaterCenterBottomToleranceWarning.Q && !_trigHeaterCenterBottomToleranceAlarm.Q)
  1463. // PMModule.SetHeaterCenterBottomToleranceWarning();
  1464. //_trigHeaterCenterToleranceAlarm.CLK = PMModule.CheckHeaterCenterToleranceAlaram();
  1465. //if (_trigHeaterCenterToleranceAlarm.Q)
  1466. // PMModule.SetHeaterCenterToleranceAlaram();
  1467. //_trigHeaterCenterToleranceWarning.CLK = PMModule.CheckHeaterCenterToleranceWarning();
  1468. //if (_trigHeaterCenterToleranceWarning.Q && !_trigHeaterCenterToleranceAlarm.Q)
  1469. // PMModule.SetHeaterCenterToleranceWarning();
  1470. //_trigHeaterCenterTopToleranceAlarm.CLK = PMModule.CheckHeaterCenterTopToleranceAlaram();
  1471. //if (_trigHeaterCenterTopToleranceAlarm.Q)
  1472. // PMModule.SetHeaterCenterTopToleranceAlaram();
  1473. //_trigHeaterCenterTopToleranceWarning.CLK = PMModule.CheckHeaterCenterTopToleranceWarning();
  1474. //if (_trigHeaterCenterTopToleranceWarning.Q && !_trigHeaterCenterTopToleranceAlarm.Q)
  1475. // PMModule.SetHeaterCenterTopToleranceWarning();
  1476. //_trigHeaterTopToleranceAlarm.CLK = PMModule.CheckHeaterTopToleranceAlaram();
  1477. //if (_trigHeaterTopToleranceAlarm.Q)
  1478. // PMModule.SetHeaterTopToleranceAlaram();
  1479. //_trigHeaterTopToleranceWarning.CLK = PMModule.CheckHeaterTopToleranceWarning();
  1480. //if (_trigHeaterTopToleranceWarning.Q && !_trigHeaterTopToleranceAlarm.Q)
  1481. // PMModule.SetHeaterTopToleranceWarning();
  1482. //_trigPressureToleranceAlarm.CLK = PMModule.CheckPressureToleranceAlaram();
  1483. //if (_trigPressureToleranceAlarm.Q)
  1484. // PMModule.SetPressureToleranceAlaram();
  1485. //_trigPressureToleranceWarning.CLK = PMModule.CheckPressureToleranceWarning();
  1486. //if (_trigPressureToleranceWarning.Q && !_trigPressureToleranceAlarm.Q)
  1487. // PMModule.SetPressureToleranceWarning();
  1488. }
  1489. private void ResetTrig()
  1490. {
  1491. PMModule.ResetAlarmCondition();
  1492. foreach (var key in _trigMfcToleranceAlarms.Keys)
  1493. {
  1494. if (_trigMfcToleranceWarnings.ContainsKey(key))
  1495. {
  1496. _trigMfcToleranceAlarms[key].RST = true;
  1497. _trigMfcToleranceWarnings[key].RST = true;
  1498. }
  1499. }
  1500. _trigHeaterBottomToleranceAlarm.RST = true;
  1501. _trigHeaterBottomToleranceWarning.RST = true;
  1502. _trigHeaterCenterBottomToleranceAlarm.RST = true;
  1503. _trigHeaterCenterBottomToleranceWarning.RST = true;
  1504. _trigHeaterCenterToleranceAlarm.RST = true;
  1505. _trigHeaterCenterToleranceWarning.RST = true;
  1506. _trigHeaterCenterTopToleranceAlarm.RST = true;
  1507. _trigHeaterCenterTopToleranceWarning.RST = true;
  1508. _trigHeaterTopToleranceAlarm.RST = true;
  1509. _trigHeaterTopToleranceWarning.RST = true;
  1510. _trigPressureToleranceAlarm.RST = true;
  1511. _trigPressureToleranceWarning.RST = true;
  1512. _trigInputSignalTimeOutAlarm.RST = true;
  1513. _trigTemperatureConvergenceTimeOutAlarm.RST = true;
  1514. _trigReachTempTimeOutAlarm.RST = true;
  1515. _trigPressureConvergenceTimeOutAlarm.RST = true;
  1516. _trigReachPressureTimeOutAlarm.RST = true;
  1517. _trigAutoProfileTimeOutAlarm.RST = true;
  1518. _trigHeaterProfileFinish.RST = true;
  1519. _trigLeakCheckFinish.RST = true;
  1520. _trigBoatWaitCondition.RST = true;
  1521. _trigAPCWaitCondition.RST = true;
  1522. _trigAUXWaitCondition.RST = true;
  1523. _trigHeaterWaitCondition.RST = true;
  1524. _trigMFCWaitCondition.RST = true;
  1525. _infoHeaterProfileFinish = "";
  1526. _infoAUXWaitCondition = "";
  1527. _infoHeaterWaitCondition = "";
  1528. _infoMFCWaitCondition = "";
  1529. }
  1530. private int GetDBRecipeType(string recipeTypeName)
  1531. {
  1532. if (string.IsNullOrEmpty(recipeTypeName))
  1533. return (int)RecipeTypeEnum.none;
  1534. if (Enum.TryParse<RecipeTypeEnum>(recipeTypeName, true, out var result))
  1535. return (int)result;
  1536. return (int)RecipeTypeEnum.none;
  1537. }
  1538. private void RecipeExec(string type, List<RecipeStep> curSteps, int currentStepNumber, double curStepElpasedTimeBeforePaused, int otherRecipeStartStepNumber = 0)
  1539. {
  1540. var reason = "";
  1541. _stepTimer.Start(curSteps[currentStepNumber].StepTime * 1000 - curStepElpasedTimeBeforePaused);
  1542. _showStepNo = currentStepNumber;
  1543. Notify($"{type} running step {currentStepNumber + 1}:{curSteps[currentStepNumber].StepName}");
  1544. var stopwatch = new Stopwatch();
  1545. stopwatch.Start();
  1546. //执行工艺程序命令
  1547. foreach (var recipeCmd in curSteps[currentStepNumber].RecipeCommands.Keys)
  1548. {
  1549. if (!OP.CanDoOperation($"{_doModule}.{recipeCmd}", out reason, curSteps[currentStepNumber].RecipeCommands[recipeCmd]))
  1550. {
  1551. if (!OP.CanDoOperation($"{Module}.{recipeCmd}", out reason, curSteps[currentStepNumber].RecipeCommands[recipeCmd]))
  1552. {
  1553. if (!OP.CanDoOperation($"{ModuleName.System}.{recipeCmd}", out reason, curSteps[currentStepNumber].RecipeCommands[recipeCmd]))
  1554. {
  1555. PMModule.CheckCanDoOperationAlarm.Set($"Can not execute {recipeCmd}, {reason}");
  1556. return;
  1557. }
  1558. else
  1559. {
  1560. OP.DoOperation($"{ModuleName.System}.{recipeCmd}", out string reason1, 0, curSteps[currentStepNumber].RecipeCommands[recipeCmd]);
  1561. }
  1562. }
  1563. else
  1564. {
  1565. OP.DoOperation($"{Module}.{recipeCmd}", out string reason1, 0, curSteps[currentStepNumber].RecipeCommands[recipeCmd]);
  1566. }
  1567. }
  1568. else
  1569. {
  1570. OP.DoOperation($"{_doModule}.{recipeCmd}", out string reason1, 0, curSteps[currentStepNumber].RecipeCommands[recipeCmd]);
  1571. }
  1572. }
  1573. LOG.Write($"step exec time {stopwatch.ElapsedMilliseconds}");
  1574. if (curSteps[currentStepNumber].EndBy == EnumEndByCondition.ByTime && !PMModule.IsBoatMoveToLoadPosition)
  1575. _state = RecipeRunningState.TimeWait;
  1576. else
  1577. _state = RecipeRunningState.ConditionWait;
  1578. _faCallback.RecipeStepStart(PMModule.Module, PMModule.RecipeRunningInfo.RecipeName, otherRecipeStartStepNumber != 0 ? otherRecipeStartStepNumber : currentStepNumber);
  1579. if (type == "Sub recipe")
  1580. _dbCallback.RecipeStepStart(PMModule.RecipeRunningInfo.InnerId.ToString(), _currentStepNumber, PMModule.RecipeRunningInfo.RecipeStepList.Count > _currentStepNumber ? PMModule.RecipeRunningInfo.RecipeStepList[_currentStepNumber].StepName : "",
  1581. PMModule.RecipeRunningInfo.RecipeStepList.Count > _currentStepNumber ? (float)PMModule.RecipeRunningInfo.RecipeStepList[_currentStepNumber].StepTime : 0,
  1582. $"{(otherRecipeStartStepNumber != 0 ? otherRecipeStartStepNumber : currentStepNumber)}", curSteps[currentStepNumber].StepName, (float)curSteps[currentStepNumber].StepTime,
  1583. $"{PMModule.RecipeRunningInfo.SubRecipeCurrentLoopCount}/{PMModule.RecipeRunningInfo.SubRecipeLoopCount}");
  1584. else
  1585. _dbCallback.RecipeStepStart(PMModule.RecipeRunningInfo.InnerId.ToString(), otherRecipeStartStepNumber != 0 ? otherRecipeStartStepNumber : currentStepNumber,
  1586. curSteps[currentStepNumber].StepName, (float)curSteps[currentStepNumber].StepTime, "", "", 0, "");
  1587. _fdc.Start(curSteps[currentStepNumber].RecipeCommands);
  1588. }
  1589. public void FACallBack(string triggerModule, string recipeAction, string module, string recipeName, string recipeStep, string jumpStpeId = "", string otherRecipeName = "")
  1590. {
  1591. if (triggerModule == ConstantsCommon.AlarmConditionTrigger)
  1592. {
  1593. switch (recipeAction)
  1594. {
  1595. case UniversalEvents.AlarmConditionTriggerReset:
  1596. _faCallback.AlarmConditionTriggerReset(module, recipeName, recipeStep, otherRecipeName);
  1597. break;
  1598. case UniversalEvents.AlarmConditionTriggerEnd:
  1599. _faCallback.AlarmConditionTriggerEnd(module, recipeName, recipeStep);
  1600. break;
  1601. case UniversalEvents.AlarmConditionTriggerHold:
  1602. _faCallback.AlarmConditionTriggerHold(module, recipeName, recipeStep);
  1603. break;
  1604. case UniversalEvents.AlarmConditionTriggerJumpStep:
  1605. _faCallback.AlarmConditionTriggerJumpStep(module, recipeName, recipeStep, jumpStpeId);
  1606. break;
  1607. case UniversalEvents.AlarmConditionTriggerCallAlarmRecipe:
  1608. _faCallback.AlarmConditionTriggerCallAlarmRecipe(module, recipeName, recipeStep, otherRecipeName);
  1609. break;
  1610. case UniversalEvents.AlarmConditionTriggerCallAbortRecipe:
  1611. _faCallback.AlarmConditionTriggerCallAbortRecipe(module, recipeName, recipeStep, otherRecipeName);
  1612. break;
  1613. }
  1614. Task.Delay(1000).ContinueWith(x =>
  1615. {
  1616. PMModule.RecipeAbnormalEnd(module, recipeName, recipeStep, recipeAction);
  1617. });
  1618. }
  1619. else if (triggerModule == ConstantsCommon.LeakCheckTrigger)
  1620. {
  1621. switch (recipeAction)
  1622. {
  1623. case UniversalEvents.LeakCheckTriggerReset:
  1624. _faCallback.LeakCheckTriggerReset(module, recipeName, recipeStep, otherRecipeName);
  1625. break;
  1626. case UniversalEvents.LeakCheckTriggerEnd:
  1627. _faCallback.LeakCheckTriggerEnd(module, recipeName, recipeStep);
  1628. break;
  1629. case UniversalEvents.LeakCheckTriggerHold:
  1630. _faCallback.LeakCheckTriggerHold(module, recipeName, recipeStep);
  1631. break;
  1632. case UniversalEvents.LeakCheckTriggerJumpStep:
  1633. _faCallback.LeakCheckTriggerJumpStep(module, recipeName, recipeStep, jumpStpeId);
  1634. break;
  1635. case UniversalEvents.LeakCheckTriggerCallAlarmRecipe:
  1636. _faCallback.LeakCheckTriggerCallAlarmRecipe(module, recipeName, recipeStep, otherRecipeName);
  1637. break;
  1638. case UniversalEvents.LeakCheckTriggerCallAbortRecipe:
  1639. _faCallback.LeakCheckTriggerCallAbortRecipe(module, recipeName, recipeStep, otherRecipeName);
  1640. break;
  1641. }
  1642. Task.Delay(1000).ContinueWith(x =>
  1643. {
  1644. PMModule.RecipeAbnormalEnd(module, recipeName, recipeStep, recipeAction);
  1645. });
  1646. }
  1647. else if (triggerModule == ConstantsCommon.ManualTrigger)
  1648. {
  1649. switch (recipeAction)
  1650. {
  1651. case UniversalEvents.ManualTriggerRecipeHold:
  1652. _faCallback.ManualTriggerRecipeHold(module, recipeName, recipeStep);
  1653. break;
  1654. case UniversalEvents.ManualTriggerRecipeRelease:
  1655. _faCallback.ManualTriggerRecipeRelease(module, recipeName, recipeStep);
  1656. break;
  1657. case UniversalEvents.ManualTriggerRecipeSkip:
  1658. _faCallback.ManualTriggerRecipeSkip(module, recipeName, recipeStep);
  1659. break;
  1660. case UniversalEvents.ManualTriggerRecipeJump:
  1661. _faCallback.ManualTriggerRecipeJump(module, recipeName, recipeStep, jumpStpeId);
  1662. break;
  1663. case UniversalEvents.ManualTriggerRecipeAbort:
  1664. _faCallback.ManualTriggerRecipeAbort(module, recipeName, recipeStep, otherRecipeName);
  1665. break;
  1666. }
  1667. Task.Delay(1000).ContinueWith(x =>
  1668. {
  1669. PMModule.RecipeAbnormalEnd(module, recipeName, recipeStep, recipeAction);
  1670. });
  1671. }
  1672. else if (triggerModule == ConstantsCommon.RecipeTrigger)
  1673. {
  1674. switch (recipeAction)
  1675. {
  1676. case UniversalEvents.RecipeTriggerReset:
  1677. _faCallback.RecipeTriggerReset(module, recipeName, recipeStep, otherRecipeName);
  1678. break;
  1679. case UniversalEvents.RecipeTriggerEnd:
  1680. _faCallback.RecipeTriggerEnd(module, recipeName, recipeStep);
  1681. break;
  1682. case UniversalEvents.RecipeTriggerHold:
  1683. _faCallback.RecipeTriggerHold(module, recipeName, recipeStep);
  1684. break;
  1685. case UniversalEvents.RecipeTriggerLeakCheck:
  1686. _faCallback.RecipeTriggerLeakCheck(module, recipeName, recipeStep);
  1687. break;
  1688. case UniversalEvents.RecipeTriggerJumpStep:
  1689. _faCallback.RecipeTriggerJumpStep(module, recipeName, recipeStep, otherRecipeName);
  1690. break;
  1691. case UniversalEvents.RecipeTriggerCallSubRecipe:
  1692. _faCallback.RecipeTriggerCallSubRecipe(module, recipeName, recipeStep, otherRecipeName);
  1693. break;
  1694. }
  1695. }
  1696. }
  1697. }
  1698. }