Process.cs 95 KB

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