RouteManager.cs 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738
  1. using System;
  2. using System.Collections.Generic;
  3. using Aitex.Core.Common;
  4. using Aitex.Core.RT.DataCenter;
  5. using Aitex.Core.RT.Event;
  6. using Aitex.Core.RT.Fsm;
  7. using Aitex.Core.RT.OperationCenter;
  8. using Aitex.Core.RT.Routine;
  9. using Aitex.Core.RT.SCCore;
  10. using Aitex.Core.Util;
  11. using MECF.Framework.Common.Equipment;
  12. using MECF.Framework.Common.SubstrateTrackings;
  13. using Virgo_DCommon;
  14. using Virgo_DRT.Instances;
  15. using Virgo_DRT.Module;
  16. namespace Virgo_DRT.Modules
  17. {
  18. class RouteManager : Entity, IEntity
  19. {
  20. public enum MSG
  21. {
  22. MoveWafer,
  23. ReturnWafer,
  24. HomeUnit,
  25. PauseAuto,
  26. ResumeAuto,
  27. Stop,
  28. StartCycle,
  29. HOME,
  30. RESET,
  31. ABORT,
  32. ERROR,
  33. SetAutoMode,
  34. SetManualMode,
  35. CreateJob,
  36. PauseJob,
  37. ResumeJob,
  38. StartJob,
  39. StopJob,
  40. AbortJob,
  41. Map,
  42. ReturnAllWafer,
  43. }
  44. //public LoadPortEntity LP1 { get; private set; }
  45. //public LoadPortEntity LP2 { get; private set; }
  46. //public CoolingStorageEntity Aligner { get; private set; }
  47. public EfemEntity EFEM { get; private set; }
  48. public PMEntity PMA { get; private set; }
  49. public PMEntity PMB { get; private set; }
  50. //routine
  51. public bool IsAutoMode
  52. {
  53. get
  54. {
  55. return fsm.State == (int)RtState.AutoRunning;
  56. }
  57. }
  58. public string Name { get; set; }
  59. public bool IsInit
  60. {
  61. get { return fsm.State == (int)RtState.Init; }
  62. }
  63. public bool IsIdle
  64. {
  65. get { return fsm.State == (int)RtState.Idle; }
  66. }
  67. public bool IsAlarm
  68. {
  69. get { return fsm.State == (int)RtState.Error; }
  70. }
  71. public bool IsRunning
  72. {
  73. get
  74. {
  75. return fsm.State == (int)RtState.Initializing
  76. || fsm.State == (int)RtState.Transfer
  77. || fsm.State == (int)RtState.Cycle
  78. || fsm.State == (int)RtState.PrepareCycle
  79. || fsm.State == (int)RtState.PostCycle
  80. || fsm.State == (int)RtState.AutoRunning
  81. || fsm.State == (int)RtState.Reset;
  82. }
  83. }
  84. private ManualTransfer _manualTransfer;
  85. private AutoTransfer _auto = null;
  86. private ReturnAllWafer _returnWafer;
  87. private HomeAll _homeAll = new HomeAll();
  88. public RouteManager()
  89. {
  90. Name = "System";
  91. //LP1 = new LoadPortEntity(ModuleName.LP1);
  92. //LP2 = new LoadPortEntity(ModuleName.LP2);
  93. //Aligner = new CoolingStorageEntity(ModuleName.Aligner);
  94. //EFEM = new EfemEntity();
  95. if (SC.GetValue<bool>("System.PMAIsInstalled"))
  96. PMA = new PMEntity(ModuleName.PMA);
  97. if (SC.GetValue<bool>("System.PMBIsInstalled"))
  98. PMB = new PMEntity(ModuleName.PMB);
  99. fsm = new StateMachine<RouteManager>(Name, (int)RtState.Init, 50);
  100. BuildTransitionTable();
  101. SubscribeDataVariable();
  102. SubscribeOperation();
  103. Running = true;
  104. }
  105. private void BuildTransitionTable()
  106. {
  107. EnterExitTransition<RtState, FSM_MSG>(RtState.AutoRunning, fEnterAutoRunning, FSM_MSG.NONE, fExitAutoTransfer);
  108. EnterExitTransition<RtState, FSM_MSG>(RtState.Transfer, null, FSM_MSG.NONE, fExitTransfer);
  109. EnterExitTransition<RtState, FSM_MSG>(RtState.Idle, fEnterIdle, FSM_MSG.NONE, fExitIdle);
  110. EnterExitTransition<RtState, FSM_MSG>(RtState.ReturnWafer, null, FSM_MSG.NONE, FsmExitReturnWafer);
  111. //Init sequence
  112. Transition(RtState.Init, MSG.HOME, FsmStartHome, RtState.Initializing);
  113. Transition(RtState.Idle, MSG.HOME, FsmStartHome, RtState.Initializing);
  114. Transition(RtState.Error, MSG.HOME, FsmStartHome, RtState.Initializing);
  115. // EnterExitTransition<RtState, FSM_MSG>(RtState.Initializing, fStartInit, FSM_MSG.NONE, null);
  116. Transition(RtState.Initializing, FSM_MSG.TIMER, FsmMonitorHome, RtState.Idle);
  117. Transition(RtState.Initializing, MSG.ERROR, fError, RtState.Error);
  118. Transition(RtState.Initializing, MSG.ABORT, FsmAbort, RtState.Init);
  119. //Reset
  120. AnyStateTransition(MSG.RESET, fStartReset, RtState.Idle);
  121. AnyStateTransition(MSG.ERROR, fError, RtState.Error);
  122. AnyStateTransition((int)FSM_MSG.ALARM, fError, (int)RtState.Error);
  123. //Auto/manual
  124. Transition(RtState.Idle, MSG.SetAutoMode, fStartAutoTransfer, RtState.AutoRunning);
  125. Transition(RtState.AutoRunning, FSM_MSG.TIMER, fAutoTransfer, RtState.Idle);
  126. Transition(RtState.AutoRunning, MSG.ABORT, fAbortAutoTransfer, RtState.Idle);
  127. Transition(RtState.AutoRunning, MSG.SetManualMode, FsmStartSetManualMode, RtState.Idle);
  128. Transition(RtState.AutoRunning, MSG.CreateJob, FsmCreateJob, RtState.AutoRunning);
  129. Transition(RtState.AutoRunning, MSG.StartJob, FsmStartJob, RtState.AutoRunning);
  130. Transition(RtState.AutoRunning, MSG.PauseJob, FsmPauseJob, RtState.AutoRunning);
  131. Transition(RtState.AutoRunning, MSG.ResumeJob, FsmResumeJob, RtState.AutoRunning);
  132. Transition(RtState.AutoRunning, MSG.StopJob, FsmStopJob, RtState.AutoRunning);
  133. Transition(RtState.AutoRunning, MSG.AbortJob, FsmAbortJob, RtState.AutoRunning);
  134. Transition(RtState.AutoRunning, MSG.Map, FsmMap, RtState.AutoRunning);
  135. //Transfer
  136. Transition(RtState.Idle, MSG.MoveWafer, fStartTransfer, RtState.Transfer);
  137. Transition(RtState.Transfer, FSM_MSG.TIMER, fTransfer, RtState.Idle);
  138. Transition(RtState.Transfer, MSG.ABORT, FsmAbort, RtState.Idle);
  139. //Return Wafer
  140. Transition(RtState.Idle, MSG.ReturnAllWafer, FsmStartReturnWafer, RtState.ReturnWafer);
  141. Transition(RtState.ReturnWafer, FSM_MSG.TIMER, FsmMonitorReturnWafer, RtState.Idle);
  142. Transition(RtState.ReturnWafer, MSG.ABORT, FsmAbort, RtState.Idle);
  143. }
  144. void SubscribeDataVariable()
  145. {
  146. DATA.Subscribe("Rt.Status", () => ((RtState)fsm.State).ToString());
  147. DATA.Subscribe("System.IsAutoMode", () => IsAutoMode);
  148. DATA.Subscribe(ModuleName.System.ToString(), "AlarmEvent", EV.GetAlarmEvent);
  149. }
  150. void SubscribeOperation()
  151. {
  152. OP.Subscribe("CreateWafer", InvokeCreateWafer);
  153. OP.Subscribe("DeleteWafer", InvokeDeleteWafer);
  154. OP.Subscribe("ReturnWafer", InvokeReturnWafer);
  155. OP.Subscribe("System.ReturnAllWafer", (string cmd, object[] args) =>
  156. {
  157. return CheckToPostMessage((int)MSG.ReturnAllWafer);
  158. });
  159. OP.Subscribe("System.MoveWafer", (string cmd, object[] args) =>
  160. {
  161. if (!Enum.TryParse((string)args[0], out ModuleName source))
  162. {
  163. EV.PostWarningLog(Name, $"Parameter source {(string)args[0]} not valid");
  164. return false;
  165. }
  166. if (!Enum.TryParse((string)args[2], out ModuleName destination))
  167. {
  168. EV.PostWarningLog(Name, $"Parameter destination {(string)args[1]} not valid");
  169. return false;
  170. }
  171. return CheckToPostMessage((int)MSG.MoveWafer,
  172. source, (int)args[1],
  173. destination, (int)args[3],
  174. (bool)args[4], (int)args[5],
  175. (bool)args[6], (int)args[7]);
  176. });
  177. OP.Subscribe("System.HomeAll", (string cmd, object[] args) =>
  178. {
  179. return CheckToPostMessage((int)MSG.HOME);
  180. });
  181. OP.Subscribe("System.Abort", (string cmd, object[] args) =>
  182. {
  183. return CheckToPostMessage((int)MSG.ABORT);
  184. });
  185. OP.Subscribe("System.Reset", (string cmd, object[] args) =>
  186. {
  187. return CheckToPostMessage((int)MSG.RESET);
  188. });
  189. OP.Subscribe("System.SetAutoMode", (string cmd, object[] args) =>
  190. {
  191. return CheckToPostMessage((int)MSG.SetAutoMode);
  192. });
  193. OP.Subscribe("System.SetManualMode", (string cmd, object[] args) =>
  194. {
  195. return CheckToPostMessage((int)MSG.SetManualMode);
  196. });
  197. OP.Subscribe("System.CreateJob", (string cmd, object[] args) =>
  198. {
  199. return CheckToPostMessage((int)MSG.CreateJob, args[0]);
  200. });
  201. OP.Subscribe("System.StartJob", (string cmd, object[] args) =>
  202. {
  203. return CheckToPostMessage((int)MSG.StartJob, args[0]);
  204. });
  205. OP.Subscribe("System.PauseJob", (string cmd, object[] args) =>
  206. {
  207. return CheckToPostMessage((int)MSG.PauseJob, args[0]);
  208. });
  209. OP.Subscribe("System.ResumeJob", (string cmd, object[] args) =>
  210. {
  211. return CheckToPostMessage((int)MSG.ResumeJob, args[0]);
  212. });
  213. OP.Subscribe("System.StopJob", (string cmd, object[] args) =>
  214. {
  215. return CheckToPostMessage((int)MSG.StopJob, args[0]);
  216. });
  217. OP.Subscribe("System.AbortJob", (string cmd, object[] args) =>
  218. {
  219. return CheckToPostMessage((int)MSG.AbortJob, args[0]);
  220. });
  221. OP.Subscribe("LP1.Map", (string cmd, object[] args) =>
  222. {
  223. if (IsAutoMode)
  224. {
  225. return CheckToPostMessage((int)MSG.Map, ModuleName.LP1.ToString());
  226. }
  227. return EFEM.InvokeMap(ModuleName.LP1.ToString())!= (int)FSM_MSG.NONE;
  228. });
  229. OP.Subscribe("LP2.Map", (string cmd, object[] args) =>
  230. {
  231. if (IsAutoMode)
  232. {
  233. return CheckToPostMessage((int)MSG.Map, ModuleName.LP2.ToString());
  234. }
  235. return EFEM.InvokeMap(ModuleName.LP2.ToString()) != (int)FSM_MSG.NONE;
  236. });
  237. OP.Subscribe(RtOperation.SetConfig.ToString(), (name, args) =>
  238. {
  239. string sc_key = args[0] as string;
  240. if (!string.IsNullOrWhiteSpace(sc_key) && args.Length > 1)
  241. {
  242. SC.SetItemValue(sc_key, args[1]);
  243. }
  244. return true;
  245. });
  246. OP.Subscribe("System.SetWaferSize", (string cmd, object[] args) =>
  247. {
  248. string module = (string)args[0];
  249. string size = (string)args[1];
  250. switch (size)
  251. {
  252. case "3":
  253. WaferManager.Instance.UpdateWaferSize(ModuleHelper.Converter(module), 0, WaferSize.WS3);
  254. break;
  255. case "4":
  256. WaferManager.Instance.UpdateWaferSize(ModuleHelper.Converter(module), 0, WaferSize.WS4);
  257. break;
  258. case "6":
  259. WaferManager.Instance.UpdateWaferSize(ModuleHelper.Converter(module), 0, WaferSize.WS6);
  260. break;
  261. default:
  262. EV.PostWarningLog("System", $"wafer size {size} not valid");
  263. break;
  264. }
  265. return true;
  266. });
  267. }
  268. public bool CheckToPostMessage(int msg, params object[] args)
  269. {
  270. if (!fsm.FindTransition(fsm.State, msg))
  271. {
  272. EV.PostWarningLog(Name, $"{Name} is in { (RtState)fsm.State} state,can not do {(MSG)msg}");
  273. return false;
  274. }
  275. fsm.PostMsg(msg, args);
  276. return true;
  277. }
  278. public bool Check(int msg, out string reason, params object[] args)
  279. {
  280. if (!fsm.FindTransition(fsm.State, msg))
  281. {
  282. reason = String.Format("{0} is in {1} state,can not do {2}", Name, (RtState)fsm.State, (MSG)msg);
  283. return false;
  284. }
  285. if (msg == (int)MSG.StartCycle)
  286. {
  287. if (!IsAutoMode)
  288. {
  289. reason = String.Format("can not do {0}, isn't auto mode.", msg.ToString());
  290. return false;
  291. }
  292. }
  293. reason = "";
  294. return true;
  295. }
  296. protected override bool Init()
  297. {
  298. _manualTransfer = new ManualTransfer();
  299. Singleton<EventManager>.Instance.OnAlarmEvent += Instance_OnAlarmEvent;
  300. //EFEM.Initialize();
  301. //Aligner.Initialize();
  302. //LP1.Initialize();
  303. //LP2.Initialize();
  304. PMA?.Initialize();
  305. PMB?.Initialize();
  306. _auto = new AutoTransfer();
  307. _returnWafer = new ReturnAllWafer();
  308. return true;
  309. }
  310. private void Instance_OnAlarmEvent(EventItem obj)
  311. {
  312. FSM_MSG msg = FSM_MSG.NONE;
  313. if (obj.Level == EventLevel.Warning)
  314. msg = FSM_MSG.WARNING;
  315. else if (obj.Level == EventLevel.Alarm)
  316. msg = FSM_MSG.ALARM;
  317. switch (obj.Source)
  318. {
  319. case "PMA":
  320. PMA?.PostMsg(msg, obj.Id, obj.Description);
  321. break;
  322. }
  323. }
  324. protected override void Term()
  325. {
  326. PMA?.Terminate();
  327. PMB?.Terminate();
  328. //LP2.Terminate();
  329. //LP1.Terminate();
  330. //EFEM.Terminate();
  331. }
  332. #region Init
  333. private bool FsmStartHome(object[] objs)
  334. {
  335. return _homeAll.Start() == Result.RUN;
  336. }
  337. private bool FsmMonitorHome(object[] objs)
  338. {
  339. Result ret = _homeAll.Monitor();
  340. if (ret == Result.DONE)
  341. {
  342. _homeAll.Clear();
  343. return true;
  344. }
  345. if (ret == Result.FAIL)
  346. {
  347. _homeAll.Clear();
  348. PostMsg(MSG.ERROR);
  349. }
  350. return false;
  351. }
  352. private bool fError(object[] objs)
  353. {
  354. if (fsm.State == (int)RtState.Transfer)
  355. {
  356. _manualTransfer.Clear();
  357. }
  358. EFEM.PostMsg(EfemEntity.MSG.LED, LightType.RED, LightStatus.ON);
  359. return true;
  360. }
  361. private bool fEnterIdle(object[] param)
  362. {
  363. EFEM.PostMsg(EfemEntity.MSG.LED, LightType.YELLOW, LightStatus.ON);
  364. EFEM.PostMsg(EfemEntity.MSG.LED, LightType.GREEN, LightStatus.OFF);
  365. return true;
  366. }
  367. private bool fExitIdle(object[] param)
  368. {
  369. return true;
  370. }
  371. #endregion Init
  372. #region AutoTransfer
  373. private bool FsmStartSetManualMode(object[] objs)
  374. {
  375. if (_auto.HasJobRunning)
  376. {
  377. EV.PostWarningLog("System", "Can not change to manual mode, abort running job first");
  378. return false;
  379. }
  380. return true;
  381. }
  382. private bool fStartAutoTransfer(object[] objs)
  383. {
  384. Result ret = _auto.Start(objs);
  385. return ret == Result.RUN;
  386. }
  387. private bool fAutoTransfer(object[] objs)
  388. {
  389. return _auto.Monitor() == Result.DONE;
  390. }
  391. private bool fEnterAutoRunning(object[] objs)
  392. {
  393. EFEM.PostMsg(EfemEntity.MSG.LED, LightType.GREEN, LightStatus.ON);
  394. EFEM.PostMsg(EfemEntity.MSG.LED, LightType.YELLOW, LightStatus.OFF);
  395. return true;
  396. }
  397. private bool fExitAutoTransfer(object[] objs)
  398. {
  399. _auto.Clear();
  400. return true;
  401. }
  402. private bool fAbortAutoTransfer(object[] objs)
  403. {
  404. _auto.Clear();
  405. return true;
  406. }
  407. #endregion AutoTransfer
  408. #region return wafer
  409. private bool FsmStartReturnWafer(object[] objs)
  410. {
  411. Result ret = _returnWafer.Start(objs);
  412. if (ret == Result.FAIL || ret == Result.DONE)
  413. return false;
  414. return ret == Result.RUN;
  415. }
  416. private bool FsmMonitorReturnWafer(object[] objs)
  417. {
  418. Result ret = _returnWafer.Monitor(objs);
  419. if (ret == Result.FAIL)
  420. {
  421. PostMsg(MSG.ERROR);
  422. return false;
  423. }
  424. return ret == Result.DONE;
  425. }
  426. private bool FsmExitReturnWafer(object[] objs)
  427. {
  428. _returnWafer.Clear();
  429. return true;
  430. }
  431. #endregion cycle
  432. #region Transfer
  433. private bool fStartTransfer(object[] objs)
  434. {
  435. Result ret = _manualTransfer.Start(objs);
  436. if (ret == Result.FAIL || ret == Result.DONE)
  437. return false;
  438. return ret == Result.RUN;
  439. }
  440. private bool fTransfer(object[] objs)
  441. {
  442. Result ret = _manualTransfer.Monitor(objs);
  443. if (ret == Result.FAIL)
  444. {
  445. PostMsg(MSG.ERROR);
  446. return false;
  447. }
  448. return ret == Result.DONE;
  449. }
  450. private bool fExitTransfer(object[] objs)
  451. {
  452. _manualTransfer.Clear();
  453. return true;
  454. }
  455. #endregion Transfer
  456. #region reset
  457. private bool fStartReset(object[] objs)
  458. {
  459. //LP1.InvokeReset();
  460. //LP2.InvokeReset();
  461. //Aligner.InvokeReset();
  462. //EFEM.InvokeReset();
  463. PMA?.InvokeReset();
  464. PMB?.InvokeReset();
  465. Singleton<DeviceEntity>.Instance.PostMsg(DeviceEntity.MSG.RESET);
  466. if (fsm.State == (int)RtState.Error)
  467. return true;
  468. return false;
  469. }
  470. #endregion reset
  471. private bool FsmMap(object[] param)
  472. {
  473. _auto.Map((string)param[0]);
  474. return true;
  475. }
  476. private bool FsmCreateJob(object[] param)
  477. {
  478. _auto.CreateJob((Dictionary<string, object>)param[0]);
  479. return true;
  480. }
  481. private bool FsmAbortJob(object[] param)
  482. {
  483. _auto.AbortJob((string)param[0]);
  484. return true;
  485. }
  486. private bool FsmStopJob(object[] param)
  487. {
  488. _auto.StopJob((string)param[0]);
  489. return true;
  490. }
  491. private bool FsmResumeJob(object[] param)
  492. {
  493. _auto.ResumeJob((string)param[0]);
  494. return true;
  495. }
  496. private bool FsmPauseJob(object[] param)
  497. {
  498. _auto.PauseJob((string)param[0]);
  499. return true;
  500. }
  501. private bool FsmStartJob(object[] param)
  502. {
  503. _auto.StartJob((string)param[0]);
  504. return true;
  505. }
  506. private bool FsmAbort(object[] param)
  507. {
  508. if (fsm.State == (int)RtState.Transfer)
  509. {
  510. _manualTransfer.Clear();
  511. }
  512. if (fsm.State == (int)RtState.AutoRunning)
  513. {
  514. _auto.Clear();
  515. }
  516. if (fsm.State == (int)RtState.ReturnWafer)
  517. {
  518. _returnWafer.Clear();
  519. }
  520. return true;
  521. }
  522. private bool InvokeReturnWafer(string arg1, object[] args)
  523. {
  524. ModuleName target = ModuleHelper.Converter(args[0].ToString());
  525. int slot = (int)args[1];
  526. if (ModuleHelper.IsLoadPort(target))
  527. {
  528. EV.PostInfoLog("System", string.Format("Wafer already at LoadPort {0} {1}, return operation is not valid", target.ToString(), slot + 1));
  529. return false;
  530. }
  531. if (!WaferManager.Instance.IsWaferSlotLocationValid(target, slot))
  532. {
  533. EV.PostWarningLog("System", string.Format("Invalid position,{0},{1}", target.ToString(), slot.ToString()));
  534. return false;
  535. }
  536. WaferInfo wafer = WaferManager.Instance.GetWafer(target, slot);
  537. if (wafer.IsEmpty)
  538. {
  539. EV.PostInfoLog("System", string.Format("No wafer at {0} {1}, return operation is not valid", target.ToString(), slot + 1));
  540. return false;
  541. }
  542. return CheckToPostMessage((int)MSG.MoveWafer,
  543. target, slot,
  544. (ModuleName)wafer.OriginStation, wafer.OriginSlot,
  545. false, 0, false, 0 );
  546. return true;
  547. }
  548. private bool InvokeDeleteWafer(string arg1, object[] args)
  549. {
  550. ModuleName chamber = ModuleHelper.Converter(args[0].ToString());
  551. int slot = (int)args[1];
  552. if (WaferManager.Instance.IsWaferSlotLocationValid(chamber, slot))
  553. {
  554. if (WaferManager.Instance.CheckHasWafer(chamber, slot))
  555. {
  556. WaferManager.Instance.DeleteWafer(chamber, slot);
  557. EV.PostMessage(ModuleName.System.ToString(), EventEnum.WaferDelete, chamber.ToString(), slot + 1);
  558. }
  559. else
  560. {
  561. EV.PostInfoLog("System", string.Format("No wafer at {0} {1}, delete not valid", chamber.ToString(), slot + 1));
  562. }
  563. }
  564. else
  565. {
  566. EV.PostWarningLog("System", string.Format("Invalid position,{0},{1}", chamber.ToString(), slot.ToString()));
  567. return false;
  568. }
  569. return true;
  570. }
  571. private bool InvokeCreateWafer(string arg1, object[] args)
  572. {
  573. ModuleName chamber = ModuleHelper.Converter(args[0].ToString());
  574. int slot = (int)args[1];
  575. WaferStatus state = WaferStatus.Normal;
  576. if (WaferManager.Instance.IsWaferSlotLocationValid(chamber, slot))
  577. {
  578. if (WaferManager.Instance.CheckHasWafer(chamber, slot))
  579. {
  580. EV.PostInfoLog("System", string.Format("{0} slot {1} already has wafer.create wafer is not valid", chamber, slot));
  581. }
  582. else if (WaferManager.Instance.CreateWafer(chamber, slot, state) != null)
  583. {
  584. EV.PostMessage(ModuleName.System.ToString(), EventEnum.WaferCreate, chamber.ToString(), slot + 1, state.ToString());
  585. }
  586. }
  587. else
  588. {
  589. EV.PostWarningLog("System", string.Format("Invalid position,{0},{1}", chamber.ToString(), slot.ToString()));
  590. return false;
  591. }
  592. return true;
  593. }
  594. }
  595. }