RouteManager.cs 47 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using Aitex.Core.RT.Fsm;
  8. using Aitex.Core.Common;
  9. using Aitex.Core.RT.DataCenter;
  10. using Aitex.Core.RT.Event;
  11. using Aitex.Core.RT.OperationCenter;
  12. using Aitex.Core.RT.Routine;
  13. using Aitex.Core.RT.SCCore;
  14. using Aitex.Core.Util;
  15. using MECF.Framework.Common.Jobs;
  16. using MECF.Framework.Common.Equipment;
  17. using MECF.Framework.Common.SubstrateTrackings;
  18. using Venus_Core;
  19. using Venus_RT.Modules.PMs;
  20. using Aitex.Core.RT.Log;
  21. using Venus_RT.Modules.VCE;
  22. using Venus_RT.Devices.PreAligner;
  23. using Venus_RT.Modules.TM.VenusEntity;
  24. using SecsGem.Core.Application;
  25. using Aitex.Core.RT.RecipeCenter;
  26. namespace Venus_RT.Modules
  27. {
  28. class RouteManager : Entity, IEntity, IEquipmentCommand
  29. {
  30. public enum MSG
  31. {
  32. MoveWafer,
  33. ReturnWafer,
  34. HomeUnit,
  35. PauseAuto,
  36. ResumeAuto,
  37. Stop,
  38. StartCycle,
  39. StopCycle,
  40. HOME,
  41. RESET,
  42. ABORT,
  43. ERROR,
  44. SetAutoMode,
  45. SetManualMode,
  46. ResetIdleCleanTime,
  47. ResetIdlePurgeTime,
  48. CreateJob,
  49. PauseJob,
  50. ResumeJob,
  51. StartJob,
  52. StopJob,
  53. AbortJob,
  54. JobDone,
  55. CassetteLeave, //For unload light control off afer job done
  56. Map,
  57. ReturnAllWafer,
  58. TMCycle,
  59. SETMCycle,
  60. StopSECycle,
  61. CreateSEJob,
  62. StartSEJob,
  63. AbortSEJob,
  64. SEMoveWafer,
  65. SEReturnWafer,
  66. SEAbort,
  67. }
  68. public PMEntity PMA { get; private set; }
  69. public PMEntity PMB { get; private set; }
  70. public PMEntity PMC { get; private set; }
  71. public PMEntity PMD { get; private set; }
  72. public TMEntity TM { get; private set; }
  73. public LLEntity LLA { get; private set; }
  74. public LLEntity LLB { get; private set; }
  75. public EfemEntity EFEM { get; private set; }
  76. public VceEntity VCE { get; private set; }
  77. public SETMEntity seTM { get; private set; }
  78. public string Name { get; set; }
  79. public bool IsAutoMode
  80. {
  81. get
  82. {
  83. return fsm.State == (int)RtState.AutoRunning || fsm.State == (int)RtState.AutoIdle;
  84. }
  85. }
  86. public bool IsInit
  87. {
  88. get { return fsm.State == (int)RtState.Init; }
  89. }
  90. public bool IsIdle
  91. {
  92. get { return fsm.State == (int)RtState.Idle || fsm.State == (int)RtState.AutoIdle; }
  93. }
  94. public bool IsAlarm
  95. {
  96. get { return fsm.State == (int)RtState.Error; }
  97. }
  98. public bool IsPaused
  99. {
  100. get { return _AutoCycle.CycleState == RState.Paused; }
  101. }
  102. public bool IsEntityError
  103. {
  104. get
  105. {
  106. return (EFEM?.IsError ?? false)
  107. || (PMA?.IsError ?? false)
  108. || (PMB?.IsError ?? false)
  109. || (PMC?.IsError ?? false)
  110. || (PMD?.IsError ?? false);
  111. }
  112. }
  113. public bool IsRunning
  114. {
  115. get
  116. {
  117. return !IsInit && !IsAlarm && !IsIdle;
  118. }
  119. }
  120. public static bool IsATMMode
  121. {
  122. get
  123. {
  124. if(_isATMMode == -1)
  125. {
  126. _isATMMode = SC.GetValue<bool>("System.IsATMMode") ? 1 : 0;
  127. }
  128. return _isATMMode == 1;
  129. }
  130. }
  131. public SequenceLLInOutPath LLInOutPath => _AutoCycle.LLInOutPath;
  132. private TMCycle _TMCycle;
  133. private ICycle _AutoCycle;
  134. private ManualTransfer _manualTransfer;
  135. private ReturnAllWafer _returnWafer;
  136. private SETMCycle _seTMCycle;
  137. private SEManualTransfer _setransfer;
  138. private SEReturnWafer _sereturnWafer;
  139. private bool _isWaitUnload;
  140. private static int _isATMMode = -1;
  141. public RouteManager()
  142. {
  143. Name = "System";
  144. if (ModuleHelper.IsInstalled(ModuleName.PMA))
  145. PMA = new PMEntity(ModuleName.PMA);
  146. if (ModuleHelper.IsInstalled(ModuleName.PMB))
  147. PMB = new PMEntity(ModuleName.PMB);
  148. if (ModuleHelper.IsInstalled(ModuleName.PMC))
  149. PMC = new PMEntity(ModuleName.PMC);
  150. if (ModuleHelper.IsInstalled(ModuleName.PMD))
  151. PMD = new PMEntity(ModuleName.PMD);
  152. if (ModuleHelper.IsInstalled(ModuleName.TM))
  153. TM = new TMEntity();
  154. if (ModuleHelper.IsInstalled(ModuleName.LLA))
  155. LLA = new LLEntity(ModuleName.LLA);
  156. if (ModuleHelper.IsInstalled(ModuleName.LLB))
  157. LLB = new LLEntity(ModuleName.LLB);
  158. if (ModuleHelper.IsInstalled(ModuleName.EFEM))
  159. EFEM = new EfemEntity();
  160. if (ModuleHelper.IsInstalled(ModuleName.VCE1))
  161. {
  162. //临时加 后改为配置项
  163. VCE = new VceEntity(ModuleName.VCE1);
  164. }
  165. if (ModuleHelper.IsInstalled(ModuleName.SETM))
  166. {
  167. seTM = new SETMEntity();
  168. }
  169. fsm = new StateMachine<RouteManager>(Name, (int)RtState.Init, 200);
  170. SubscribeOperation();
  171. SubscribeDataVariable();
  172. }
  173. public bool Check(int msg, out string reason, params object[] args)
  174. {
  175. if (!fsm.FindTransition(fsm.State, msg))
  176. {
  177. reason = String.Format("{0} is in {1} state,can not do {2}", Name, 0, (MSG)msg);
  178. return false;
  179. }
  180. if (msg == (int)MSG.StartCycle)
  181. {
  182. if (!IsAutoMode)
  183. {
  184. reason = String.Format("can not do {0}, isn't auto mode.", msg.ToString());
  185. return false;
  186. }
  187. }
  188. reason = "";
  189. return true;
  190. }
  191. void SubscribeDataVariable()
  192. {
  193. DATA.Subscribe("Rt.Status", () => ((RtState)fsm.State).ToString(), SubscriptionAttribute.FLAG.IgnoreSaveDB);
  194. DATA.Subscribe(ModuleName.System.ToString(), "AlarmEvent", EV.GetAlarmEvent, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  195. DATA.Subscribe("System.IsAutoMode", () => IsAutoMode, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  196. DATA.Subscribe("System.IsIdle", () => IsIdle || IsInit, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  197. DATA.Subscribe("System.IsAlarm", () => IsAlarm || IsEntityError, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  198. DATA.Subscribe("System.IsBusy", () => IsRunning, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  199. DATA.Subscribe("System.IsWaitUnload", () => _isWaitUnload && IsAutoMode, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  200. //DATA.Subscribe("System.IsConnectedWithHost", () => Singleton<SecGemApplication>.Instance., SubscriptionAttribute.FLAG.IgnoreSaveDB);
  201. DATA.Subscribe("EquipmentMode", () => IsAutoMode ? 0 : 1, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  202. DATA.Subscribe("EquipmentStatus", () =>
  203. {
  204. //"0 = Uninit
  205. //1 = Idle
  206. //2 = Running
  207. //3 = Error
  208. //4 = Pause
  209. //"
  210. if (IsInit) return 0;
  211. if (IsIdle) return 1;
  212. if (IsAlarm) return 3;
  213. if (IsPaused) return 4;
  214. return 2;
  215. }, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  216. }
  217. void SubscribeOperation()
  218. {
  219. OP.Subscribe("CreateWafer", InvokeCreateWafer);
  220. OP.Subscribe("DeleteWafer", InvokeDeleteWafer);
  221. OP.Subscribe("System.Home", (cmd, args) => CheckToPostMessage((int)MSG.HOME, args));
  222. OP.Subscribe("TMCycle.Start", (cmd, args) => CheckToPostMessage((int)MSG.TMCycle, args));
  223. OP.Subscribe("TMCycle.Abort", (cmd, args) => CheckToPostMessage((int)MSG.StopCycle, args));
  224. OP.Subscribe("System.StopSECycle", (cmd, args) => CheckToPostMessage((int)MSG.StopSECycle, args));
  225. DATA.Subscribe("SYSTEM.FsmState", () => (((RtState)fsm.State).ToString()));
  226. DATA.Subscribe("TMCycle.CycleIndex", () => (_TMCycle?.CycleIndex));
  227. OP.Subscribe("ReturnWafer", InvokeReturnWafer);
  228. OP.Subscribe("System.ReturnAllWafer", (string cmd, object[] args) =>
  229. {
  230. if (seTM != null && VCE != null)
  231. return CheckToPostMessage((int)MSG.SEReturnWafer, args);
  232. else
  233. return CheckToPostMessage((int)MSG.ReturnAllWafer, args[0], args[1], args[2], args[3]);
  234. });
  235. OP.Subscribe("System.MoveWafer", (string cmd, object[] args) =>
  236. {
  237. if (!Enum.TryParse((string)args[0], out ModuleName source))
  238. {
  239. EV.PostWarningLog(Name, $"Parameter source {(string)args[0]} not valid");
  240. return false;
  241. }
  242. if (!Enum.TryParse((string)args[2], out ModuleName destination))
  243. {
  244. EV.PostWarningLog(Name, $"Parameter destination {(string)args[1]} not valid");
  245. return false;
  246. }
  247. if (seTM!=null && VCE!=null)
  248. return CheckToPostMessage((int)MSG.SEMoveWafer,
  249. source, (int)args[1],
  250. destination, (int)args[3],
  251. args[4], args[5],
  252. args[6], args[7], (string)args[8]);
  253. else
  254. return CheckToPostMessage((int)MSG.MoveWafer,
  255. source, (int)args[1],
  256. destination, (int)args[3],
  257. args[4], args[5],
  258. args[6], args[7], (string)args[8]);
  259. });
  260. OP.Subscribe("System.HomeAll", (string cmd, object[] args) =>
  261. {
  262. return CheckToPostMessage((int)MSG.HOME);
  263. });
  264. OP.Subscribe("System.Abort", (string cmd, object[] args) =>
  265. {
  266. return CheckToPostMessage((int)MSG.ABORT);
  267. });
  268. OP.Subscribe("System.Reset", (string cmd, object[] args) =>
  269. {
  270. return CheckToPostMessage((int)MSG.RESET);
  271. });
  272. OP.Subscribe("System.SetAutoMode", (string cmd, object[] args) =>
  273. {
  274. return CheckToPostMessage((int)MSG.SetAutoMode);
  275. });
  276. OP.Subscribe("System.SetManualMode", (string cmd, object[] args) =>
  277. {
  278. return CheckToPostMessage((int)MSG.SetManualMode);
  279. });
  280. OP.Subscribe("System.CreateJob", (string cmd, object[] args) =>
  281. {
  282. return CheckToPostMessage((int)MSG.CreateJob, args[0]);
  283. });
  284. OP.Subscribe("System.StartJob", (string cmd, object[] args) =>
  285. {
  286. return CheckToPostMessage((int)MSG.StartJob, args[0]);
  287. });
  288. OP.Subscribe("System.PauseJob", (string cmd, object[] args) =>
  289. {
  290. return CheckToPostMessage((int)MSG.PauseJob, args[0]);
  291. });
  292. OP.Subscribe("System.ResumeJob", (string cmd, object[] args) =>
  293. {
  294. return CheckToPostMessage((int)MSG.ResumeJob, args[0]);
  295. });
  296. OP.Subscribe("System.StopJob", (string cmd, object[] args) =>
  297. {
  298. return CheckToPostMessage((int)MSG.StopJob, args[0]);
  299. });
  300. OP.Subscribe("System.AbortJob", (string cmd, object[] args) =>
  301. {
  302. return CheckToPostMessage((int)MSG.AbortJob, args[0]);
  303. });
  304. OP.Subscribe("LP1.Map", (string cmd, object[] args) =>
  305. {
  306. if (IsAutoMode)
  307. {
  308. return CheckToPostMessage((int)MSG.Map, ModuleName.LP1.ToString());
  309. }
  310. return EFEM.InvokeMap(ModuleName.LP1.ToString()) != (int)FSM_MSG.NONE;
  311. });
  312. OP.Subscribe("LP2.Map", (string cmd, object[] args) =>
  313. {
  314. if (IsAutoMode)
  315. {
  316. return CheckToPostMessage((int)MSG.Map, ModuleName.LP2.ToString());
  317. }
  318. return EFEM.InvokeMap(ModuleName.LP2.ToString()) != (int)FSM_MSG.NONE;
  319. });
  320. OP.Subscribe(RtOperation.SetConfig.ToString(), (name, args) =>
  321. {
  322. string sc_key = args[0] as string;
  323. if (!string.IsNullOrWhiteSpace(sc_key) && args.Length > 1)
  324. {
  325. SC.SetItemValue(sc_key, args[1]);
  326. }
  327. return true;
  328. });
  329. OP.Subscribe("System.ResetIdleCleanTime", (string cmd, object[] args) =>
  330. {
  331. return CheckToPostMessage((int)MSG.ResetIdleCleanTime, args[0]);
  332. });
  333. OP.Subscribe("System.ResetIdlePurgeTime", (string cmd, object[] args) =>
  334. {
  335. return CheckToPostMessage((int)MSG.ResetIdlePurgeTime, args[0]);
  336. });
  337. OP.Subscribe("System.SetWaferSize", (string cmd, object[] args) =>
  338. {
  339. string module = (string)args[0];
  340. string size = (string)args[1];
  341. switch (size)
  342. {
  343. case "3":
  344. WaferManager.Instance.UpdateWaferSize(ModuleHelper.Converter(module), 0, WaferSize.WS3);
  345. break;
  346. case "4":
  347. WaferManager.Instance.UpdateWaferSize(ModuleHelper.Converter(module), 0, WaferSize.WS4);
  348. break;
  349. case "6":
  350. WaferManager.Instance.UpdateWaferSize(ModuleHelper.Converter(module), 0, WaferSize.WS6);
  351. break;
  352. default:
  353. EV.PostWarningLog("System", $"wafer size {size} not valid");
  354. break;
  355. }
  356. return true;
  357. });
  358. OP.Subscribe("System.CassetteLeave", (string cmd, object[] args) =>
  359. {
  360. return CheckToPostMessage((int)MSG.CassetteLeave);
  361. });
  362. OP.Subscribe("System.IsModuleInstalled", (string cmd, object[] args) => {
  363. return ModuleHelper.IsInstalled((ModuleName)args[0]);
  364. });
  365. OP.Subscribe("System.SETMCycle", (cmd, args) => CheckToPostMessage((int)MSG.SETMCycle, args));
  366. OP.Subscribe("System.CreateSEJob", (cmd, args) => CheckToPostMessage((int)MSG.CreateSEJob, args));
  367. OP.Subscribe("System.StartSEJob",(cmd,args)=>CheckToPostMessage((int)MSG.StartSEJob,args));
  368. OP.Subscribe("System.ReturnAllSEWafer", (cmd, args) => CheckToPostMessage((int)MSG.SEReturnWafer, args));
  369. OP.Subscribe("System.SEAbort", (cmd, args) => CheckToPostMessage((int)MSG.SEAbort, args));
  370. }
  371. public bool CheckToPostMessage(int msg, params object[] args)
  372. {
  373. if (!fsm.FindTransition(fsm.State, msg))
  374. {
  375. LOG.Write(eEvent.WARN_ROUTER, ModuleName.System, $"System is in {(RtState)fsm.State} state,can not do {(MSG)msg}");
  376. return false;
  377. }
  378. Running = true;
  379. fsm.PostMsg(msg, args);
  380. return true;
  381. }
  382. public bool InvokeAbort(object[] args)
  383. {
  384. return CheckToPostMessage((int)MSG.ABORT, args);
  385. }
  386. private bool InvokeCreateWafer(string arg1, object[] args)
  387. {
  388. ModuleName chamber = ModuleHelper.Converter(args[0].ToString());
  389. int slot = (int)args[1];
  390. WaferStatus state = WaferStatus.Normal;
  391. if (WaferManager.Instance.IsWaferSlotLocationValid(chamber, slot))
  392. {
  393. if (WaferManager.Instance.CheckHasWafer(chamber, slot))
  394. {
  395. LOG.Write(eEvent.EV_ROUTER, "System", string.Format("{0} slot {1} already has wafer.create wafer is not valid", chamber, slot));
  396. }
  397. else if (WaferManager.Instance.CreateWafer(chamber, slot, state) != null)
  398. {
  399. LOG.Write(eEvent.EV_WAFER_CREATE, ModuleName.System, chamber.ToString(), (slot + 1).ToString(), state.ToString());
  400. }
  401. }
  402. else
  403. {
  404. LOG.Write(eEvent.WARN_ROUTER, "System", string.Format("Invalid position,{0},{1}", chamber.ToString(), slot.ToString()));
  405. return false;
  406. }
  407. return true;
  408. }
  409. private bool InvokeDeleteWafer(string arg1, object[] args)
  410. {
  411. ModuleName chamber = ModuleHelper.Converter(args[0].ToString());
  412. int slot = (int)args[1];
  413. if (WaferManager.Instance.IsWaferSlotLocationValid(chamber, slot))
  414. {
  415. if (WaferManager.Instance.CheckHasWafer(chamber, slot))
  416. {
  417. WaferManager.Instance.DeleteWafer(chamber, slot);
  418. EV.PostMessage(ModuleName.System.ToString(), EventEnum.WaferDelete, chamber.ToString(), slot + 1);
  419. }
  420. else
  421. {
  422. LOG.Write(eEvent.EV_ROUTER, "System", string.Format("No wafer at {0} {1}, delete not valid", chamber.ToString(), slot + 1));
  423. }
  424. }
  425. else
  426. {
  427. LOG.Write(eEvent.WARN_ROUTER, "System", string.Format("Invalid position,{0},{1}", chamber.ToString(), slot.ToString()));
  428. return false;
  429. }
  430. return true;
  431. }
  432. private bool InvokeReturnWafer(string arg1, object[] args)
  433. {
  434. ModuleName target = ModuleHelper.Converter(args[0].ToString());
  435. int slot = (int)args[1];
  436. if (seTM != null && VCE != null)
  437. {
  438. if (ModuleHelper.IsVCE(target))
  439. {
  440. LOG.Write(eEvent.WARN_ROUTER, "System", string.Format("Wafer already at vce {0} {1}, return operation is not valid", target.ToString(), slot + 1));
  441. return false;
  442. }
  443. WaferInfo wafer = WaferManager.Instance.GetWafer(target,slot);
  444. if (wafer.IsEmpty)
  445. {
  446. LOG.Write(eEvent.WARN_ROUTER, "System", string.Format("No wafer at {0} {1}, return operation is not valid", target.ToString(), slot + 1));
  447. return false;
  448. }
  449. return CheckToPostMessage((int)MSG.SEMoveWafer,
  450. target, slot,
  451. (ModuleName)wafer.OriginStation, wafer.OriginSlot,
  452. false, 0, false, 0, "Blade1");
  453. }
  454. else
  455. {
  456. if (ModuleHelper.IsLoadPort(target))
  457. {
  458. LOG.Write(eEvent.WARN_ROUTER, "System", string.Format("Wafer already at LoadPort {0} {1}, return operation is not valid", target.ToString(), slot + 1));
  459. return false;
  460. }
  461. if (!WaferManager.Instance.IsWaferSlotLocationValid(target, slot))
  462. {
  463. LOG.Write(eEvent.WARN_ROUTER, "System", string.Format("Invalid position,{0},{1}", target.ToString(), slot.ToString()));
  464. return false;
  465. }
  466. WaferInfo wafer = WaferManager.Instance.GetWafer(target, slot);
  467. if (wafer.IsEmpty)
  468. {
  469. LOG.Write(eEvent.WARN_ROUTER, "System", string.Format("No wafer at {0} {1}, return operation is not valid", target.ToString(), slot + 1));
  470. return false;
  471. }
  472. return CheckToPostMessage((int)MSG.MoveWafer,
  473. target, slot,
  474. (ModuleName)wafer.OriginStation, wafer.OriginSlot,
  475. false, 0, false, 0, "Blade1");
  476. }
  477. }
  478. public PMEntity GetPM(ModuleName mod)
  479. {
  480. if (ModuleHelper.IsInstalled(mod))
  481. {
  482. switch (mod)
  483. {
  484. case ModuleName.PMA:
  485. return PMA;
  486. case ModuleName.PMB:
  487. return PMB;
  488. case ModuleName.PMC:
  489. return PMC;
  490. case ModuleName.PMD:
  491. return PMD;
  492. }
  493. }
  494. return null;
  495. }
  496. public LLEntity GetLL(ModuleName mod)
  497. {
  498. if (ModuleHelper.IsInstalled(mod))
  499. {
  500. switch (mod)
  501. {
  502. case ModuleName.LLA:
  503. return LLA;
  504. case ModuleName.LLB:
  505. return LLB;
  506. }
  507. }
  508. return null;
  509. }
  510. public VceEntity GetVCE(ModuleName mod)
  511. {
  512. if (ModuleHelper.IsInstalled(mod))
  513. {
  514. return VCE;
  515. }
  516. return null;
  517. }
  518. public TMEntity GetTM()
  519. {
  520. return TM;
  521. }
  522. protected override bool Init()
  523. {
  524. PMA?.Initialize();
  525. PMB?.Initialize();
  526. PMC?.Initialize();
  527. PMD?.Initialize();
  528. TM?.Initialize();
  529. LLA?.Initialize();
  530. LLB?.Initialize();
  531. EFEM?.Initialize();
  532. VCE?.Initialize();
  533. seTM?.Initialize();
  534. _TMCycle = new TMCycle();
  535. _AutoCycle = new AutoCycle();
  536. //_AutoCycle = new SystemDispatcher();
  537. _manualTransfer = new ManualTransfer();
  538. _returnWafer = new ReturnAllWafer(_manualTransfer);
  539. _seTMCycle = new SETMCycle(ModuleName.SETM);
  540. _setransfer = new SEManualTransfer();
  541. _sereturnWafer = new SEReturnWafer(_setransfer);
  542. BuildTransitionTable();
  543. return true;
  544. }
  545. private void BuildTransitionTable()
  546. {
  547. //Init sequence
  548. Transition(RtState.Init, MSG.HOME, FsmStartHome, RtState.Initializing);
  549. Transition(RtState.Idle, MSG.HOME, FsmStartHome, RtState.Initializing);
  550. Transition(RtState.Error, MSG.HOME, FsmStartHome, RtState.Initializing);
  551. EnterExitTransition<RtState, FSM_MSG>(RtState.AutoRunning, FsmEnterAutoRunning, FSM_MSG.NONE, FsmExitAutoTransfer);
  552. EnterExitTransition<RtState, FSM_MSG>(RtState.Transfer, null, FSM_MSG.NONE, FsmExitTransfer);
  553. EnterExitTransition<RtState, FSM_MSG>(RtState.ReturnWafer, null, FSM_MSG.NONE, FsmExitReturnWafer);
  554. AnyStateTransition(MSG.ERROR, FsmError, RtState.Error);
  555. Transition(RtState.Idle, FSM_MSG.TIMER, FsmMonitor, RtState.Idle);
  556. Transition(RtState.Init, FSM_MSG.TIMER, FsmMonitor, RtState.Init);
  557. Transition(RtState.Initializing, FSM_MSG.TIMER, FsmMonitorHome, RtState.Idle);
  558. Transition(RtState.Initializing, MSG.ERROR, FsmError, RtState.Error);
  559. Transition(RtState.Initializing, MSG.ABORT, FsmAbort, RtState.Init);
  560. // TM Cycle
  561. Transition(RtState.Idle, MSG.TMCycle, FsmStartTMCycle, RtState.TMCycle);
  562. Transition(RtState.TMCycle, FSM_MSG.TIMER, FsmMonitorTMCycle, RtState.Idle);
  563. Transition(RtState.TMCycle, MSG.StopCycle, FsmStopTMCycle, RtState.Idle);
  564. //Auto/manual
  565. Transition(RtState.Idle, MSG.SetAutoMode, FsmStartAutoTransfer, RtState.AutoIdle);
  566. Transition(RtState.AutoRunning, FSM_MSG.TIMER, FsmAutoTransfer, RtState.AutoIdle);
  567. Transition(RtState.AutoRunning, MSG.ABORT, FsmAbortAutoTransfer, RtState.Idle);
  568. //Transition(RtState.AutoRunning, MSG.SetManualMode, FsmStartSetManualMode, RtState.Idle);
  569. Transition(RtState.AutoRunning, MSG.JobDone, FsmJobDone, RtState.AutoIdle);
  570. //Transition(RtState.AutoRunning, MSG.CassetteLeave, fCassetteLeave, RtState.AutoRunning); //For unload light control off afer job done
  571. Transition(RtState.AutoRunning, MSG.CreateJob, FsmCreateJob, RtState.AutoRunning);
  572. Transition(RtState.AutoRunning, MSG.StartJob, FsmStartJob, RtState.AutoRunning);
  573. Transition(RtState.AutoRunning, MSG.PauseJob, FsmPauseJob, RtState.AutoRunning);
  574. Transition(RtState.AutoRunning, MSG.ResumeJob, FsmResumeJob, RtState.AutoRunning);
  575. Transition(RtState.AutoRunning, MSG.StopJob, FsmStopJob, RtState.AutoRunning);
  576. Transition(RtState.AutoRunning, MSG.AbortJob, FsmAbortJob, RtState.AutoRunning);
  577. Transition(RtState.AutoRunning, MSG.MoveWafer, FsmAutoReturnWafer, RtState.AutoRunning);
  578. Transition(RtState.AutoRunning, MSG.Map, FsmMap, RtState.AutoRunning);
  579. Transition(RtState.AutoRunning, MSG.ResetIdleCleanTime, FsmResetIdleCleanTime, RtState.AutoRunning);
  580. Transition(RtState.AutoRunning, MSG.ResetIdlePurgeTime, FsmResetIdlePurgeTime, RtState.AutoRunning);
  581. Transition(RtState.AutoIdle, FSM_MSG.TIMER, FsmMonitorAutoIdle, RtState.AutoIdle);
  582. Transition(RtState.AutoIdle, MSG.SetManualMode, FsmStartSetManualMode, RtState.Idle);
  583. Transition(RtState.AutoIdle, MSG.CreateJob, FsmCreateJob, RtState.AutoIdle);
  584. Transition(RtState.AutoIdle, MSG.StartJob, FsmStartJob, RtState.AutoRunning);
  585. Transition(RtState.AutoIdle, MSG.PauseJob, FsmPauseJob, RtState.AutoIdle);
  586. Transition(RtState.AutoIdle, MSG.ResumeJob, FsmResumeJob, RtState.AutoIdle);
  587. Transition(RtState.AutoIdle, MSG.StopJob, FsmStopJob, RtState.AutoIdle);
  588. Transition(RtState.AutoIdle, MSG.AbortJob, FsmAbortJob, RtState.AutoIdle);
  589. Transition(RtState.AutoIdle, MSG.Map, FsmMap, RtState.AutoIdle);
  590. //Transfer
  591. Transition(RtState.Idle, MSG.MoveWafer, FsmStartTransfer, RtState.Transfer);
  592. Transition(RtState.Transfer, FSM_MSG.TIMER, FsmMonitorTransfer, RtState.Idle);
  593. Transition(RtState.Transfer, MSG.ABORT, FsmAbort, RtState.Idle);
  594. //Return Wafer
  595. Transition(RtState.Idle, MSG.ReturnAllWafer, FsmStartReturnWafer, RtState.ReturnWafer);
  596. Transition(RtState.ReturnWafer, FSM_MSG.TIMER, FsmMonitorReturnWafer, RtState.Idle);
  597. Transition(RtState.ReturnWafer, MSG.ABORT, FsmAbort, RtState.Idle);
  598. // SETM Cycle
  599. Transition(RtState.Idle, MSG.SETMCycle, FsmStartSETMCycle, RtState.SETMCycle);
  600. Transition(RtState.SETMCycle, FSM_MSG.TIMER, FsmMonitorSETMCycle, RtState.Idle);
  601. Transition(RtState.SETMCycle, MSG.SEAbort, SEAbort, RtState.Idle);
  602. // SETM CreateCycle
  603. Transition(RtState.Idle, MSG.CreateSEJob, FsmStartCreateSEJob, RtState.Idle);
  604. // SETM StartCycle
  605. Transition(RtState.Idle, MSG.StartSEJob, FsmStartSEJob, RtState.SERunning);
  606. Transition(RtState.SERunning, FSM_MSG.TIMER, FsmSEJobMonitor, RtState.Idle);
  607. Transition(RtState.SERunning, MSG.SEAbort, SEAbort, RtState.Idle);
  608. // SE Transfer
  609. Transition(RtState.Idle, MSG.SEMoveWafer, FsmStartSEMoveWafer, RtState.SETransfer);
  610. Transition(RtState.SETransfer, FSM_MSG.TIMER, FsmMonitorSEMoveWafer, RtState.Idle);
  611. Transition(RtState.SETransfer, MSG.SEAbort, SEAbort, RtState.Idle);
  612. // SE ReturnWafer
  613. Transition(RtState.Idle, MSG.SEReturnWafer, FsmStartSEReturnWafer, RtState.SEReturnWafer);
  614. Transition(RtState.SEReturnWafer, FSM_MSG.TIMER, FsmMonitorSEReturnWafer, RtState.Idle);
  615. Transition(RtState.SEReturnWafer, MSG.SEAbort, SEAbort, RtState.Idle);
  616. }
  617. private bool FsmMonitor(object[] objs)
  618. {
  619. _debugRoutine();
  620. return true;
  621. }
  622. private bool FsmStartHome(object[] objs)
  623. {
  624. TM?.Invoke("Home");
  625. EFEM?.Invoke("Home");
  626. seTM?.Invoke("Home");
  627. VCE?.Invoke("Home");
  628. foreach(var mod in ModuleHelper.InstalledModules)
  629. {
  630. if(ModuleHelper.IsPm(mod))
  631. {
  632. if(GetPM(mod).IsInclude)
  633. {
  634. GetPM(mod).Invoke("Home");
  635. }
  636. }
  637. else if (ModuleHelper.IsLoadLock(mod))
  638. {
  639. if(GetLL(mod).IsInclude)
  640. {
  641. GetLL(mod).Invoke("Home");
  642. }
  643. }
  644. }
  645. return true;
  646. }
  647. private bool FsmMonitorHome(object[] objs)
  648. {
  649. ModuleName notReadyModule = ModuleName.System;
  650. foreach(var mod in ModuleHelper.InstalledModules)
  651. {
  652. if ((ModuleHelper.IsPm(mod)&& GetPM(mod).IsInclude && !GetPM(mod).IsIdle) ||
  653. (ModuleHelper.IsLoadLock(mod) && GetLL(mod).IsInclude && !GetLL(mod).IsIdle) ||
  654. (ModuleHelper.IsTM(mod) && !GetTM().IsIdle) ||
  655. (ModuleHelper.IsVCE(mod) && !GetVCE(mod).IsIdle) ||
  656. (ModuleHelper.IsEFEM(mod) && !EFEM.IsIdle) ||
  657. (ModuleHelper.isSETM(mod) && !seTM.IsIdle))
  658. {
  659. notReadyModule = mod;
  660. break;
  661. }
  662. }
  663. if(notReadyModule != ModuleName.System)
  664. {
  665. if (fsm.ElapsedTime > 100 * 1000)
  666. {
  667. LOG.Write(eEvent.ERR_ROUTER, ModuleName.System, $"{notReadyModule} home timeout");
  668. PostMsg(MSG.ERROR);
  669. return true;
  670. }
  671. else
  672. return false;
  673. }
  674. return true;
  675. }
  676. private bool FsmEnterAutoRunning(object[] objs)
  677. {
  678. return true;
  679. }
  680. private bool FsmExitAutoTransfer(object[] objs)
  681. {
  682. _AutoCycle.Clear();
  683. return true;
  684. }
  685. private bool FsmExitTransfer(object[] objs)
  686. {
  687. _manualTransfer.Clear();
  688. return true;
  689. }
  690. private bool FsmExitReturnWafer(object[] objs)
  691. {
  692. _returnWafer.Clear();
  693. return true;
  694. }
  695. private bool FsmError(object[] objs)
  696. {
  697. return true;
  698. }
  699. private bool FsmAbort(object[] objs)
  700. {
  701. _manualTransfer.Clear();
  702. _returnWafer.Clear();
  703. _AutoCycle.Clear();
  704. return true;
  705. }
  706. private bool FsmStartTMCycle(object[] objs)
  707. {
  708. return _TMCycle.Start(objs) == RState.Running;
  709. }
  710. private bool FsmMonitorTMCycle(object[] objs)
  711. {
  712. RState ret = _TMCycle.Monitor();
  713. if (ret == RState.Failed || ret == RState.Timeout)
  714. {
  715. PostMsg(MSG.ERROR);
  716. return false;
  717. }
  718. return ret == RState.End;
  719. }
  720. private bool FsmStopTMCycle(object[] objs)
  721. {
  722. _TMCycle.Abort();
  723. return true;
  724. }
  725. private bool FsmStartAutoTransfer(object[] objs)
  726. {
  727. return _AutoCycle.Start(objs) == RState.Running;
  728. }
  729. private bool FsmAutoTransfer(object[] objs)
  730. {
  731. RState ret = _AutoCycle.Monitor();
  732. if(ret == RState.Failed)
  733. {
  734. if (!CheckToPostMessage((int)MSG.ERROR))
  735. return false;
  736. }
  737. if (_AutoCycle.CheckJobJustDone(out string jobInfo))
  738. {
  739. EV.PostPopDialogMessage(EventLevel.InformationNoDelay, "Job complete", jobInfo);
  740. }
  741. if (_AutoCycle.CheckAllJobDone())
  742. {
  743. if (!CheckToPostMessage((int)MSG.JobDone))
  744. return false;
  745. }
  746. //_isWaitUnload = (bool)DATA.Poll("LP1.NotifyJobDone") || (bool)DATA.Poll("LP2.NotifyJobDone");
  747. return ret == RState.End;
  748. }
  749. private bool FsmAbortAutoTransfer(object[] objs)
  750. {
  751. _AutoCycle.Clear();
  752. return true;
  753. }
  754. private bool FsmJobDone(object[] objs)
  755. {
  756. _isWaitUnload = true;
  757. return true;
  758. }
  759. private bool FsmCreateJob(object[] objs)
  760. {
  761. return _AutoCycle.CreateJob((Dictionary<string, object>)objs[0],out var reason);
  762. }
  763. private bool FsmStartJob(object[] objs)
  764. {
  765. _AutoCycle.StartJob((string)objs[0],out var reason);
  766. return true;
  767. }
  768. private bool FsmPauseJob(object[] objs)
  769. {
  770. _AutoCycle.PauseJob((string)objs[0],out var reason);
  771. return true;
  772. }
  773. private bool FsmResumeJob(object[] objs)
  774. {
  775. _AutoCycle.ResumeJob((string)objs[0],out var reason);
  776. return true;
  777. }
  778. private bool FsmStopJob(object[] objs)
  779. {
  780. _AutoCycle.StopJob((string)objs[0], out var reason);
  781. return true;
  782. }
  783. private bool FsmAbortJob(object[] objs)
  784. {
  785. _AutoCycle.AbortJob((string)objs[0],out var reason);
  786. return true;
  787. }
  788. private bool FsmStartTransfer(object[] objs)
  789. {
  790. return _manualTransfer.Start(objs) == RState.Running;
  791. }
  792. private bool FsmMonitorTransfer(object[] objs)
  793. {
  794. RState ret = _manualTransfer.Monitor();
  795. if (ret == RState.Failed || ret == RState.Timeout)
  796. {
  797. PostMsg(MSG.ERROR);
  798. return false;
  799. }
  800. return ret == RState.End;
  801. }
  802. private bool FsmStartReturnWafer(object[] objs)
  803. {
  804. //return _returnWafer.Start(objs) == RState.Running;
  805. return _AutoCycle.CheckManualReturnWafer() == RState.Running;
  806. }
  807. private bool FsmMonitorReturnWafer(object[] objs)
  808. {
  809. //RState ret = _returnWafer.Monitor();
  810. RState ret = _AutoCycle.ReturnAllWafers();
  811. if (ret == RState.Failed || ret == RState.Timeout)
  812. {
  813. PostMsg(MSG.ERROR);
  814. return false;
  815. }
  816. return ret == RState.End;
  817. }
  818. private bool FsmMap(object[] objs)
  819. {
  820. return true;
  821. }
  822. private bool FsmResetIdleCleanTime(object[] objs)
  823. {
  824. return true;
  825. }
  826. private bool FsmResetIdlePurgeTime(object[] objs)
  827. {
  828. return true;
  829. }
  830. private bool FsmAutoReturnWafer(object[] objs)
  831. {
  832. return _AutoCycle.ManualReturnWafer(objs);
  833. }
  834. private bool FsmMonitorAutoIdle(object[] objs)
  835. {
  836. RState ret = _AutoCycle.Monitor();
  837. //if (_AutoCycle.CheckAllJobDone())
  838. //{
  839. // if (!CheckToPostMessage((int)MSG.JobDone))
  840. // return false;
  841. //}
  842. //_isWaitUnload = (bool)DATA.Poll("LP1.NotifyJobDone") || (bool)DATA.Poll("LP2.NotifyJobDone");
  843. _debugRoutine();
  844. return ret == RState.End;
  845. }
  846. private bool FsmStartSetManualMode(object[] objs)
  847. {
  848. if (_AutoCycle.HasJobRunning)
  849. {
  850. LOG.Write(eEvent.WARN_ROUTER, "System", "Can not change to manual mode, abort running job first");
  851. return false;
  852. }
  853. return true;
  854. }
  855. private void _debugRoutine()
  856. {
  857. int flag = 0;
  858. // Test Home routine
  859. if (flag == 1)
  860. {
  861. PostMsg(MSG.HOME);
  862. }
  863. else if (flag == 2)
  864. {
  865. PostMsg(MSG.TMCycle);
  866. }
  867. else if (flag == 3)
  868. {
  869. PostMsg(MSG.SetAutoMode);
  870. }
  871. else if (flag == 4)
  872. {
  873. PostMsg(MSG.ReturnAllWafer);
  874. }
  875. else if(flag == 5)
  876. {
  877. PostMsg(MSG.StartJob, "CJ_Local_LP1");
  878. }
  879. }
  880. private bool FsmStartSETMCycle(object[] objs)
  881. {
  882. return _seTMCycle.Start(objs) == RState.Running;
  883. }
  884. private bool FsmMonitorSETMCycle(object[] objs)
  885. {
  886. RState ret = _seTMCycle.Monitor();
  887. if (ret == RState.Failed || ret == RState.Timeout)
  888. {
  889. PostMsg(MSG.ERROR);
  890. return false;
  891. }
  892. return ret == RState.End;
  893. }
  894. private bool FsmStopSETMCycle(object[] objs)
  895. {
  896. _seTMCycle.Abort();
  897. return true;
  898. }
  899. private bool FsmStartCreateSEJob(object[] objs)
  900. {
  901. _seTMCycle.CreateJob((Dictionary<string, object>)objs[0]);
  902. return true;
  903. }
  904. private bool FsmStartSEJob(object[] objs)
  905. {
  906. return _seTMCycle.StartJob(objs[0].ToString()) == RState.Running;
  907. }
  908. private bool FsmSEJobMonitor(object[] objs)
  909. {
  910. RState ret = _seTMCycle.Monitor();
  911. return ret == RState.End;
  912. }
  913. private bool FsmStartSEMoveWafer(object[] objs)
  914. {
  915. return _setransfer.Start(objs) == RState.Running;
  916. }
  917. private bool FsmMonitorSEMoveWafer(object[] objs)
  918. {
  919. RState ret = _setransfer.Monitor();
  920. if (ret == RState.Failed || ret == RState.Timeout)
  921. {
  922. PostMsg(MSG.ERROR);
  923. return false;
  924. }
  925. return ret == RState.End;
  926. }
  927. private bool FsmStartSEReturnWafer(object[] objs)
  928. {
  929. return _sereturnWafer.Start(objs) == RState.Running;
  930. }
  931. private bool FsmMonitorSEReturnWafer(object[] objs)
  932. {
  933. RState ret = _sereturnWafer.Monitor();
  934. if (ret == RState.Failed || ret == RState.Timeout)
  935. {
  936. PostMsg(MSG.ERROR);
  937. return false;
  938. }
  939. return ret == RState.End;
  940. }
  941. private bool SEAbort(object[] objs)
  942. {
  943. _seTMCycle.Abort();
  944. _setransfer.Abort();
  945. _sereturnWafer.Abort();
  946. seTM.CheckToPostMessage((int)SETMEntity.MSG.Abort);
  947. return true;
  948. }
  949. #region Fa接口
  950. /// <summary>
  951. /// 接口指令
  952. /// </summary>
  953. /// <param name="command"></param>
  954. /// <param name="paras"></param>
  955. /// <param name="reason"></param>
  956. /// <returns></returns>
  957. public bool ExcuteCommand(string command, object[] paras, out string reason)
  958. {
  959. reason = "";
  960. switch(command)
  961. {
  962. case "PP-SELECT":
  963. return FaCreateJob(paras, out reason);
  964. case "StartJob":
  965. return FaStartJob(paras[0].ToString(), out reason);
  966. case "StopJob":
  967. return FaStopJob(paras[0].ToString(), out reason);
  968. case "AbortJob":
  969. return FaAbortob(paras[0].ToString(), out reason);
  970. case "PauseJob":
  971. return FaPauseJob(paras[0].ToString(), out reason);
  972. case "ResumeJob":
  973. return FaResumeJob(paras[0].ToString(), out reason);
  974. case "Load":
  975. return FaLoad(paras[0].ToString());
  976. case "Unload":
  977. return FaUnLoad(paras[0].ToString());
  978. case "ReadID":
  979. return FaReadId(paras[0].ToString());
  980. }
  981. return true;
  982. }
  983. /// <summary>
  984. /// Fa创建任务
  985. /// </summary>
  986. /// <param name="paras"></param>
  987. /// <param name="reason"></param>
  988. /// <returns></returns>
  989. private bool FaCreateJob(object[] paras,out string reason)
  990. {
  991. if(!CheckAuto())
  992. {
  993. reason = "System is not in Auto,cannot create job";
  994. return false;
  995. }
  996. else
  997. {
  998. Dictionary<string, object> createParams = new Dictionary<string, object>();
  999. createParams["Module"] = $"LP{paras[0]}";
  1000. createParams["JobId"] = paras[1].ToString();
  1001. createParams["SlotSequence"] = (string[])paras[3];
  1002. createParams["AutoStart"] = true;
  1003. if (paras.Length >= 5)
  1004. {
  1005. createParams["PreCleanRecipeName"] = paras[4].ToString();
  1006. }
  1007. if (paras.Length >= 6)
  1008. {
  1009. createParams["PostCleabRecipeName"] = paras[5].ToString();
  1010. }
  1011. return _AutoCycle.CreateJob(createParams,out reason);
  1012. }
  1013. }
  1014. /// <summary>
  1015. /// Fa启动任务
  1016. /// </summary>
  1017. /// <param name="jobName"></param>
  1018. /// <param name="reason"></param>
  1019. /// <returns></returns>
  1020. private bool FaStartJob(string jobName,out string reason)
  1021. {
  1022. return _AutoCycle.StartJob(jobName,out reason);
  1023. }
  1024. /// <summary>
  1025. /// Fa停止任务
  1026. /// </summary>
  1027. /// <param name="jobName"></param>
  1028. /// <param name="reason"></param>
  1029. /// <returns></returns>
  1030. private bool FaStopJob(string jobName, out string reason)
  1031. {
  1032. return _AutoCycle.StopJob(jobName, out reason);
  1033. }
  1034. /// <summary>
  1035. /// Fa中止任务
  1036. /// </summary>
  1037. /// <param name="jobName"></param>
  1038. /// <param name="reason"></param>
  1039. /// <returns></returns>
  1040. private bool FaAbortob(string jobName, out string reason)
  1041. {
  1042. return _AutoCycle.AbortJob(jobName, out reason);
  1043. }
  1044. /// <summary>
  1045. /// Fa暂停任务
  1046. /// </summary>
  1047. /// <param name="jobName"></param>
  1048. /// <param name="reason"></param>
  1049. /// <returns></returns>
  1050. private bool FaPauseJob(string jobName, out string reason)
  1051. {
  1052. return _AutoCycle.PauseJob(jobName, out reason);
  1053. }
  1054. /// <summary>
  1055. /// Fa恢复任务
  1056. /// </summary>
  1057. /// <param name="jobName"></param>
  1058. /// <param name="reason"></param>
  1059. /// <returns></returns>
  1060. private bool FaResumeJob(string jobName, out string reason)
  1061. {
  1062. return _AutoCycle.ResumeJob(jobName, out reason);
  1063. }
  1064. /// <summary>
  1065. /// Fa Load
  1066. /// </summary>
  1067. /// <param name="lp"></param>
  1068. /// <returns></returns>
  1069. private bool FaLoad(string lp)
  1070. {
  1071. return EFEM.EfemDevice.Load(ModuleHelper.Converter($"LP{lp}"));
  1072. }
  1073. /// <summary>
  1074. /// 读取Id
  1075. /// </summary>
  1076. /// <param name="lp"></param>
  1077. /// <returns></returns>
  1078. private bool FaReadId(string lp)
  1079. {
  1080. return EFEM.EfemDevice.ReadCarrierId(ModuleHelper.Converter($"LP{lp}"));
  1081. }
  1082. /// <summary>
  1083. /// Fa Unload
  1084. /// </summary>
  1085. /// <param name="lp"></param>
  1086. /// <returns></returns>
  1087. private bool FaUnLoad(string lp)
  1088. {
  1089. return EFEM.EfemDevice.Unload(ModuleHelper.Converter($"LP{lp}"));
  1090. }
  1091. /// <summary>
  1092. /// 获取所有Sequence
  1093. /// </summary>
  1094. /// <returns></returns>
  1095. public string[] GetSequenceList()
  1096. {
  1097. return RecipeFileManager.Instance.GetSequenceNameList().ToArray();
  1098. }
  1099. public string GetSequenceBody(string ppid)
  1100. {
  1101. return RecipeFileManager.Instance.GetSequence(ppid, false);
  1102. }
  1103. public List<string> GetFormatedSequence(string ppid)
  1104. {
  1105. return null;
  1106. }
  1107. public bool deleteSequence(string ppid)
  1108. {
  1109. return true;
  1110. }
  1111. public bool UpdateSequence(string ppid, string body)
  1112. {
  1113. return true;
  1114. }
  1115. public void ShowTerminalMessage(string message)
  1116. {
  1117. }
  1118. public bool CreateProcessJob(string processJobId, string sequenceName, string carrierId, out string reason)
  1119. {
  1120. reason = "";
  1121. return true;
  1122. }
  1123. public void UpdateProcessJobCarrierSlot(string processJobId, string moduleName, List<int> slots)
  1124. {
  1125. }
  1126. public void CreateControlJob(string controlJobId, string carrierId, List<string> processJobs)
  1127. {
  1128. }
  1129. public bool CheckCreateControlJobCondition(List<string> modules, out string reason)
  1130. {
  1131. reason = "";
  1132. return true;
  1133. }
  1134. public bool StartControlJob(string controlJob)
  1135. {
  1136. return true;
  1137. }
  1138. public bool StopControlJob(string controlJob)
  1139. {
  1140. return true;
  1141. }
  1142. public bool AbortControlJob(string controlJob)
  1143. {
  1144. return true;
  1145. }
  1146. public bool PauseControlJob(string controlJob)
  1147. {
  1148. return true;
  1149. }
  1150. public bool ResumeControlJob(string controlJob)
  1151. {
  1152. return true;
  1153. }
  1154. public bool CheckAuto()
  1155. {
  1156. return fsm.State == (int)RtState.AutoIdle;
  1157. }
  1158. public void UpdateControlJobModule(string controlJobId, string moduleName)
  1159. {
  1160. }
  1161. #endregion
  1162. }
  1163. }