Process.cs 97 KB

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