EfemAction.cs 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984
  1. using System;
  2. using System.Collections.Generic;
  3. using Aitex.Core.Common;
  4. using Aitex.Core.RT.Event;
  5. using Aitex.Core.Util;
  6. using Aitex.Sorter.Common;
  7. using MECF.Framework.Common.Equipment;
  8. using MECF.Framework.Common.SubstrateTrackings;
  9. using VirgoCommon;
  10. using VirgoRT.Device;
  11. using VirgoRT.Device.YASKAWA;
  12. using System.Diagnostics;
  13. using System.Threading;
  14. using Aitex.Core.RT.Device;
  15. using Aitex.Core.RT.Log;
  16. using VirgoRT.Devices.EFEM;
  17. namespace VirgoRT.Devices
  18. {
  19. /// <summary>
  20. /// Base action
  21. /// </summary>
  22. abstract class EfemActionBase : ActionBase
  23. {
  24. protected readonly EfemBase _efem;
  25. public EfemOperation Type { get; protected set; }
  26. protected EfemActionBase() : this(null) { }
  27. protected EfemActionBase(EfemBase efem) : base(ModuleName.EFEM)
  28. {
  29. _efem = efem;
  30. }
  31. }
  32. class DelayAction : ActionBase
  33. {
  34. private readonly DeviceTimer _timer = new DeviceTimer();
  35. private readonly ushort _delayTime;
  36. public bool IsDone => _timer.IsTimeout();
  37. public DelayAction(ushort delaytime) : base(ModuleName.System)
  38. {
  39. this._delayTime = delaytime;
  40. }
  41. public override void Execute()
  42. {
  43. _timer.Start(this._delayTime * 1000);
  44. }
  45. public override void OnPostWork(string data)
  46. {
  47. EV.PostInfoLog(ModuleName.EFEM.ToString(), $"Delay time [{_delayTime}]");
  48. }
  49. }
  50. }
  51. namespace VirgoRT.Devices.YASKAWA
  52. {
  53. class EfemAction : EfemActionBase
  54. {
  55. public EfemAction(EfemBase device, ModuleName mod) : base(device)
  56. { }
  57. public override void Execute()
  58. {
  59. _efem.MsgHandler.Send(new EfemMessage
  60. {
  61. Operation = this.Type,
  62. Head = EfemMessage.MsgHead.MOV,
  63. Parameters = new List<string> { Constant.ModuleString[this.Module] }
  64. });
  65. base.Execute();
  66. _efem.Status = DeviceState.Busy;
  67. EV.PostInfoLog(this.Module.ToString(), $"Cmd {this.ID} {this.Type} Start");
  68. }
  69. public override void OnPostWork(string data = null)
  70. {
  71. _efem.Status = DeviceState.Idle;
  72. EV.PostInfoLog(this.Module.ToString(), $"Cmd {this.ID} {this.Type} End");
  73. }
  74. }
  75. /// <summary>
  76. ///
  77. /// </summary>
  78. class HomeAllAction : EfemAction
  79. {
  80. public HomeAllAction(EfemBase efem, ModuleName mod) : base(efem, mod)
  81. {
  82. Type = EfemOperation.Home;
  83. this.Module = mod;
  84. }
  85. public override void OnPostWork(string data = null)
  86. {
  87. _efem[ModuleName.LP1].OnHomed();
  88. _efem[ModuleName.LP2].OnHomed();
  89. base.OnPostWork(data);
  90. var tower = DEVICE.GetDevice<VirgoSignalTower>("System.SignalTower");
  91. if (tower != null)
  92. {
  93. tower.ResetData();
  94. }
  95. }
  96. }
  97. class HomeModuleAction : EfemAction
  98. {
  99. public HomeModuleAction(EfemBase efem, ModuleName mod) : base(efem, mod)
  100. {
  101. Type = EfemOperation.Home;
  102. this.Module = mod;
  103. IsBackground = ModuleHelper.IsLoadPort(mod);
  104. }
  105. public override void OnPostWork(string data = null)
  106. {
  107. if (ModuleHelper.IsLoadPort(Module))
  108. {
  109. _efem[Module].OnHomed();
  110. }
  111. EV.PostInfoLog(this.Module.ToString(), $"Cmd {this.ID} {this.Type} End");
  112. }
  113. }
  114. class LoadModuleAction : EfemAction
  115. {
  116. public LoadModuleAction(EfemBase efem, ModuleName mod) : base(efem, mod)
  117. {
  118. Type = EfemOperation.Load;
  119. this.Module = mod;
  120. IsBackground = true;
  121. }
  122. public override void OnPostWork(string data = null)
  123. {
  124. _efem[Module].OnLoaded();
  125. EV.PostInfoLog(this.Module.ToString(), $"Cmd {this.ID} {this.Type} End");
  126. }
  127. public override void OnError(string data = null)
  128. {
  129. _efem[Module].OnLoadFailed(data);
  130. base.OnError(data);
  131. }
  132. }
  133. class UnloadModuleAction : EfemAction
  134. {
  135. public UnloadModuleAction(EfemBase efem, ModuleName mod) : base(efem, mod)
  136. {
  137. Type = EfemOperation.Unload;
  138. this.Module = mod;
  139. IsBackground = true;
  140. }
  141. public override void OnPostWork(string data = null)
  142. {
  143. _efem.Status = DeviceState.Idle;
  144. _efem[Module].OnUnloaded();
  145. EV.PostInfoLog(this.Module.ToString(), $"Cmd {this.ID} {this.Type} End");
  146. }
  147. public override void OnError(string data = null)
  148. {
  149. _efem[Module].OnUnloadFailed(data);
  150. base.OnError(data);
  151. }
  152. }
  153. class ReadCarrierIdModuleAction : EfemAction
  154. {
  155. public ReadCarrierIdModuleAction(EfemBase efem, ModuleName mod) : base(efem, mod)
  156. {
  157. Type = EfemOperation.CarrierId;
  158. this.Module = mod;
  159. IsBackground = true;
  160. }
  161. public override void Execute()
  162. {
  163. _efem.MsgHandler.Send(new EfemMessage
  164. {
  165. Operation = this.Type,
  166. Head = EfemMessage.MsgHead.GET,
  167. Parameters = new List<string> { Constant.ModuleString[this.Module] }
  168. });
  169. //base.Execute();
  170. this.Status = ActionStatus.SendCmd;
  171. _efem.Status = DeviceState.Busy;
  172. EV.PostInfoLog(this.Module.ToString(), $"Cmd {this.ID} {this.Type} Start");
  173. }
  174. public override void OnPostWork(string data = null)
  175. {
  176. _efem.Status = DeviceState.Idle;
  177. _efem[Module].OnCarrierIDRead(data);
  178. EV.PostInfoLog(this.Module.ToString(), $"Cmd {this.ID} {this.Type} End");
  179. }
  180. public override void OnError(string data = null)
  181. {
  182. _efem[Module].OnCarrierIDReadFailed(data);
  183. base.OnError(data);
  184. }
  185. }
  186. class WriteCarrierIdModuleAction : EfemAction
  187. {
  188. private string _id;
  189. public WriteCarrierIdModuleAction(EfemBase efem, ModuleName mod, string id) : base(efem, mod)
  190. {
  191. Type = EfemOperation.CarrierId;
  192. this.Module = mod;
  193. IsBackground = true;
  194. _id = id;
  195. }
  196. public override void Execute()
  197. {
  198. _efem.MsgHandler.Send(new EfemMessage
  199. {
  200. Operation = this.Type,
  201. Head = EfemMessage.MsgHead.SET,
  202. Parameters = new List<string> { Constant.ModuleString[this.Module] , _id}
  203. });
  204. //base.Execute();
  205. this.Status = ActionStatus.SendCmd;
  206. _efem.Status = DeviceState.Busy;
  207. EV.PostInfoLog(this.Module.ToString(), $"Cmd {this.ID} {this.Type} Start");
  208. }
  209. public override void OnPostWork(string data = null)
  210. {
  211. _efem.Status = DeviceState.Idle;
  212. _efem[Module].OnCarrierIDWrite(_id);
  213. EV.PostInfoLog(this.Module.ToString(), $"Cmd {this.ID} {this.Type} End");
  214. }
  215. public override void OnError(string data = null)
  216. {
  217. _efem[Module].OnCarrierIDWriteFailed(_id);
  218. base.OnError(data);
  219. }
  220. }
  221. class ReadTagDataModuleAction : EfemAction
  222. {
  223. public ReadTagDataModuleAction(EfemBase efem, ModuleName mod) : base(efem, mod)
  224. {
  225. Type = EfemOperation.CarrierId;
  226. this.Module = mod;
  227. IsBackground = true;
  228. }
  229. public override void Execute()
  230. {
  231. _efem.MsgHandler.Send(new EfemMessage
  232. {
  233. Operation = this.Type,
  234. Head = EfemMessage.MsgHead.GET,
  235. Parameters = new List<string> { Constant.ModuleString[this.Module] }
  236. });
  237. //base.Execute();
  238. this.Status = ActionStatus.SendCmd;
  239. _efem.Status = DeviceState.Busy;
  240. EV.PostInfoLog(this.Module.ToString(), $"Cmd {this.ID} {this.Type} Start");
  241. }
  242. public override void OnPostWork(string data = null)
  243. {
  244. _efem.Status = DeviceState.Idle;
  245. _efem[Module].OnTagDataRead(data);
  246. EV.PostInfoLog(this.Module.ToString(), $"Cmd {this.ID} {this.Type} End");
  247. }
  248. public override void OnError(string data = null)
  249. {
  250. _efem[Module].OnTagDataReadFailed(data);
  251. base.OnError(data);
  252. }
  253. }
  254. class WriteTagDataModuleAction : EfemAction
  255. {
  256. private string _id;
  257. public WriteTagDataModuleAction(EfemBase efem, ModuleName mod, string id) : base(efem, mod)
  258. {
  259. Type = EfemOperation.CarrierId;
  260. this.Module = mod;
  261. IsBackground = true;
  262. _id = id;
  263. }
  264. public override void Execute()
  265. {
  266. _efem.MsgHandler.Send(new EfemMessage
  267. {
  268. Operation = this.Type,
  269. Head = EfemMessage.MsgHead.SET,
  270. Parameters = new List<string> { Constant.ModuleString[this.Module], _id }
  271. });
  272. //base.Execute();
  273. this.Status = ActionStatus.SendCmd;
  274. _efem.Status = DeviceState.Busy;
  275. EV.PostInfoLog(this.Module.ToString(), $"Cmd {this.ID} {this.Type} Start");
  276. }
  277. public override void OnPostWork(string data = null)
  278. {
  279. _efem.Status = DeviceState.Idle;
  280. _efem[Module].OnTagDataWrite(_id);
  281. EV.PostInfoLog(this.Module.ToString(), $"Cmd {this.ID} {this.Type} End");
  282. }
  283. public override void OnError(string data = null)
  284. {
  285. _efem[Module].OnTagDataWriteFailed(_id);
  286. base.OnError(data);
  287. }
  288. }
  289. class DockModuleAction : EfemAction
  290. {
  291. public DockModuleAction(EfemBase efem, ModuleName mod) : base(efem, mod)
  292. {
  293. Type = EfemOperation.Dock;
  294. this.Module = mod;
  295. IsBackground = true;
  296. }
  297. }
  298. class UndockModuleAction : EfemAction
  299. {
  300. public UndockModuleAction(EfemBase efem, ModuleName mod) : base(efem, mod)
  301. {
  302. Type = EfemOperation.Undock;
  303. this.Module = mod;
  304. IsBackground = true;
  305. }
  306. }
  307. class ClampModuleAction : EfemAction
  308. {
  309. private bool _isUnloadClamp;
  310. public ClampModuleAction(EfemBase efem, ModuleName mod, bool isUnloadClamp) : base(efem, mod)
  311. {
  312. Type = EfemOperation.Clamp;
  313. this.Module = mod;
  314. IsBackground = true;
  315. _isUnloadClamp = isUnloadClamp;
  316. }
  317. public override void OnPostWork(string data = null)
  318. {
  319. _efem.Status = DeviceState.Idle;
  320. _efem[Module].OnClamped(_isUnloadClamp);
  321. EV.PostInfoLog(this.Module.ToString(), $"Cmd {this.ID} {this.Type} End");
  322. }
  323. public override void OnError(string data = null)
  324. {
  325. _efem[Module].OnClampFailed(data);
  326. base.OnError(data);
  327. }
  328. }
  329. class UnclampModuleAction : EfemAction
  330. {
  331. public UnclampModuleAction(EfemBase efem, ModuleName mod) : base(efem, mod)
  332. {
  333. Type = EfemOperation.Unclamp;
  334. this.Module = mod;
  335. IsBackground = true;
  336. }
  337. public override void OnPostWork(string data = null)
  338. {
  339. _efem.Status = DeviceState.Idle;
  340. _efem[Module].OnUnclamped();
  341. EV.PostInfoLog(this.Module.ToString(), $"Cmd {this.ID} {this.Type} End");
  342. }
  343. public override void OnError(string data = null)
  344. {
  345. _efem[Module].OnUnclampFailed(data);
  346. base.OnError(data);
  347. }
  348. }
  349. class SetThicknessModuleAction : EfemAction
  350. {
  351. private string _thick;
  352. public SetThicknessModuleAction(EfemBase efem, ModuleName mod, string thickness) : base(efem, mod)
  353. {
  354. Type = EfemOperation.SetThickness;
  355. this.Module = mod;
  356. IsBackground = true;
  357. _thick = thickness;
  358. }
  359. public override void Execute()
  360. {
  361. _efem.MsgHandler.Send(new EfemMessage
  362. {
  363. Operation = this.Type,
  364. Head = EfemMessage.MsgHead.SET,
  365. Parameters = new List<string> { Constant.ModuleString[this.Module] , _thick.ToUpper()}
  366. });
  367. //base.Execute();
  368. this.Status = ActionStatus.SendCmd;
  369. EV.PostInfoLog(this.Module.ToString(), $"Cmd {this.ID} {this.Type} Start");
  370. }
  371. }
  372. class OrgshAction : EfemAction
  373. {
  374. public OrgshAction(EfemBase efem, ModuleName mod) : base(efem, mod)
  375. {
  376. Type = EfemOperation.Orgsh;
  377. this.Module = mod;
  378. }
  379. }
  380. class TrackAction : EfemAction
  381. {
  382. public TrackAction(EfemBase efem, ModuleName mod) : base(efem, mod)
  383. {
  384. Type = EfemOperation.StateTrack;
  385. this.Module = mod;
  386. }
  387. public override void Execute()
  388. {
  389. _efem.MsgHandler.Send(new EfemMessage
  390. {
  391. Operation = this.Type,
  392. Head = EfemMessage.MsgHead.GET,
  393. Parameters = new List<string> { "TRACK" }
  394. });
  395. this.Status = ActionStatus.SendCmd;
  396. EV.PostInfoLog(this.Module.ToString(), "Query wafer present information");
  397. }
  398. public override void OnPostWork(string data)
  399. {
  400. this.Status = ActionStatus.Completed;
  401. //000/111 upperArmWafer, lowerArmWafer, alignerWafer1, alignerWafer2, coolingwafer1,coolingwafer2
  402. if (data.Length != 6 )
  403. {
  404. LOG.Write($"EFEM Track wafer present return invalid value, {data}, should be 6 characters");
  405. return;
  406. }
  407. //upper arm
  408. if (data[0] == '1')
  409. {
  410. if (WaferManager.Instance.CheckNoWafer(ModuleName.EfemRobot, 1))
  411. {
  412. WaferManager.Instance.CreateWafer(ModuleName.EfemRobot, 1, WaferStatus.Normal);
  413. }
  414. }
  415. else
  416. {
  417. if (WaferManager.Instance.CheckHasWafer(ModuleName.EfemRobot, 1))
  418. {
  419. EV.PostWarningLog(Module.ToString(), $" {ModuleName.EfemRobot} upper arm has wafer information, while EFEM return empty, manually delete if really no wafer");
  420. }
  421. }
  422. //lower arm
  423. if (data[1] == '1')
  424. {
  425. if (WaferManager.Instance.CheckNoWafer(ModuleName.EfemRobot, 0))
  426. {
  427. WaferManager.Instance.CreateWafer(ModuleName.EfemRobot, 0, WaferStatus.Normal);
  428. }
  429. }
  430. else
  431. {
  432. if (WaferManager.Instance.CheckHasWafer(ModuleName.EfemRobot, 0))
  433. {
  434. EV.PostWarningLog(Module.ToString(), $" {ModuleName.EfemRobot} lower arm has wafer information, while EFEM return empty, manually delete if really no wafer");
  435. }
  436. }
  437. //aligner1
  438. if (data[2] == '1')
  439. {
  440. if (WaferManager.Instance.CheckNoWafer(ModuleName.Aligner1, 0))
  441. {
  442. WaferManager.Instance.CreateWafer(ModuleName.Aligner1, 0, WaferStatus.Normal);
  443. }
  444. }
  445. else
  446. {
  447. if (WaferManager.Instance.CheckHasWafer(ModuleName.Aligner1, 0))
  448. {
  449. EV.PostWarningLog(Module.ToString(), $" {ModuleName.Aligner1} has wafer information, while EFEM return empty, manually delete if really no wafer");
  450. }
  451. }
  452. //aligner2
  453. if (data[3] == '1')
  454. {
  455. if (WaferManager.Instance.CheckNoWafer(ModuleName.Aligner2, 0))
  456. {
  457. WaferManager.Instance.CreateWafer(ModuleName.Aligner2, 0, WaferStatus.Normal);
  458. }
  459. }
  460. else
  461. {
  462. if (WaferManager.Instance.CheckHasWafer(ModuleName.Aligner2, 0))
  463. {
  464. EV.PostWarningLog(Module.ToString(), $" {ModuleName.Aligner2} has wafer information, while EFEM return empty, manually delete if really no wafer");
  465. }
  466. }
  467. //cooling1
  468. if (data[4] == '1')
  469. {
  470. if (WaferManager.Instance.CheckNoWafer(ModuleName.Cooling1, 0))
  471. {
  472. WaferManager.Instance.CreateWafer(ModuleName.Cooling1, 0, WaferStatus.Normal);
  473. }
  474. }
  475. else
  476. {
  477. if (WaferManager.Instance.CheckHasWafer(ModuleName.Cooling1, 0))
  478. {
  479. EV.PostWarningLog(Module.ToString(), $" {ModuleName.Cooling1} has wafer information, while EFEM return empty, manually delete if really no wafer");
  480. }
  481. }
  482. //cooling2
  483. if (data[5] == '1')
  484. {
  485. if (WaferManager.Instance.CheckNoWafer(ModuleName.Cooling2, 0))
  486. {
  487. WaferManager.Instance.CreateWafer(ModuleName.Cooling2, 0, WaferStatus.Normal);
  488. }
  489. }
  490. else
  491. {
  492. if (WaferManager.Instance.CheckHasWafer(ModuleName.Cooling2, 0))
  493. {
  494. EV.PostWarningLog(Module.ToString(), $" {ModuleName.Cooling2} has wafer information, while EFEM return empty, manually delete if really no wafer");
  495. }
  496. }
  497. }
  498. }
  499. class ClearErrorAction : EfemAction
  500. {
  501. public ClearErrorAction(EfemBase efem) : base(efem, ModuleName.EFEM)
  502. {
  503. Type = EfemOperation.ClearError;
  504. IsBackground = true;
  505. }
  506. public override void Execute()
  507. {
  508. _efem.MsgHandler.Send(new EfemMessage
  509. {
  510. Operation = this.Type,
  511. Head = EfemMessage.MsgHead.SET,
  512. Parameters = new List<string> { "CLEAR" }
  513. });
  514. this.Status = ActionStatus.SendCmd;
  515. EV.PostInfoLog(this.Module.ToString(), "清除 EFEM 所有错误");
  516. }
  517. }
  518. class MapAction : EfemAction
  519. {
  520. public MapAction(EfemBase efem, ModuleName mod) : base(efem, mod)
  521. {
  522. Type = EfemOperation.Map;
  523. this.Module = mod;
  524. }
  525. public override void OnPostWork(string data)
  526. {
  527. _efem[Module].Status = DeviceState.Idle;
  528. }
  529. }
  530. class PickAction : EfemAction
  531. {
  532. private MoveParam MoveParam { get; }
  533. public PickAction(EfemBase efem, MoveParam mp) : base(efem, ModuleName.EFEM)
  534. {
  535. Type = EfemOperation.Pick;
  536. MoveParam = mp;
  537. }
  538. public override void Execute()
  539. {
  540. //MOV:LOAD/P113/ARM2;
  541. _efem.MsgHandler.Send(new EfemMessage
  542. {
  543. Operation = this.Type,
  544. Head = EfemMessage.MsgHead.MOV,
  545. Parameters = new List<string>
  546. {
  547. MoveParam.SrcPos.ToHWString(),
  548. Constant.ArmString[MoveParam.Arm],
  549. MoveParam.WaferSize.ToString()
  550. }
  551. });
  552. this.Status = ActionStatus.SendCmd;
  553. _efem.Status = DeviceState.Busy;
  554. }
  555. public override void OnPostWork(string data)
  556. {
  557. WaferManager.Instance.WaferMoved(MoveParam.SrcModule, MoveParam.SrcSlot, MoveParam.DestModule, MoveParam.DestSlot);
  558. _efem.Status = DeviceState.Idle;
  559. //_bladeTarget = ModuleName.EfemRobot;
  560. }
  561. }
  562. class PlaceAction : EfemAction
  563. {
  564. private MoveParam MoveParam { get; }
  565. public PlaceAction(EfemBase device, MoveParam mp) : base(device, ModuleName.EFEM)
  566. {
  567. Type = EfemOperation.Place;
  568. MoveParam = mp;
  569. }
  570. public override void Execute()
  571. {
  572. _efem.MsgHandler.Send(new EfemMessage
  573. {
  574. Operation = this.Type,
  575. Head = EfemMessage.MsgHead.MOV,
  576. Parameters = new List<string>
  577. {
  578. MoveParam.DestPos.ToHWString(),
  579. Constant.ArmString[MoveParam.Arm],
  580. MoveParam.WaferSize.ToString()
  581. }
  582. });
  583. this.Status = ActionStatus.SendCmd;
  584. _efem.Status = DeviceState.Busy;
  585. }
  586. public override void OnPostWork(string data)
  587. {
  588. WaferManager.Instance.WaferMoved(MoveParam.SrcModule, MoveParam.SrcSlot, MoveParam.DestModule, MoveParam.DestSlot);
  589. _efem.Status = DeviceState.Idle;
  590. }
  591. }
  592. class GotoAction : EfemAction
  593. {
  594. private MoveParam MoveParam { get; }
  595. public GotoAction(EfemBase device, MoveParam mp) : base(device, ModuleName.EFEM)
  596. {
  597. Type = EfemOperation.Goto;
  598. MoveParam = mp;
  599. }
  600. public override void Execute()
  601. {
  602. _efem.MsgHandler.Send(new EfemMessage
  603. {
  604. Operation = this.Type,
  605. Head = EfemMessage.MsgHead.MOV,
  606. Parameters = new List<string>
  607. {
  608. MoveParam.DestPos.ToHWString(),
  609. Constant.ArmString[MoveParam.Arm],
  610. MoveParam.WaferSize.ToString()
  611. }
  612. });
  613. this.Status = ActionStatus.SendCmd;
  614. _efem.Status = DeviceState.Busy;
  615. }
  616. public override void OnPostWork(string data)
  617. {
  618. _efem.Status = DeviceState.Idle;
  619. }
  620. }
  621. class ExtendAction : EfemAction
  622. {
  623. private ExtendParam ExtParam { get; }
  624. public ExtendPos TargetPosition => ExtParam.Pos;
  625. public ExtendAction(EfemBase efem, ExtendParam ep)
  626. : base(efem, ModuleName.EFEM)
  627. {
  628. Type = EfemOperation.Extend;
  629. ExtParam = ep;
  630. ExtParam.Arm = ep.Arm;
  631. }
  632. public override void Execute()
  633. {
  634. //MOV:EXTEND/LLA03/ARM2;
  635. _efem.MsgHandler.Send(new EfemMessage
  636. {
  637. Operation = this.Type,
  638. Head = EfemMessage.MsgHead.MOV,
  639. Parameters = new List<string>
  640. {
  641. ExtParam.Module.ToHWString(),
  642. //Constant.ExtendPosString[ExtParam.Pos],
  643. ExtParam.Pos.ToString(),
  644. Constant.ArmString[ExtParam.Arm]
  645. }
  646. });
  647. this.Status = ActionStatus.SendCmd;
  648. _efem.Status = DeviceState.Busy;
  649. }
  650. public override void OnPostWork(string data)
  651. {
  652. _efem.Status = DeviceState.Idle;
  653. switch (TargetPosition)
  654. {
  655. case ExtendPos.PB:
  656. LOG.Write($"robot extend PB put: arm {ExtParam.Arm}, module {ExtParam.Module}");
  657. //WaferManager.Instance.WaferMoved(ModuleName.EfemRobot, (int)ExtParam.Arm, ExtParam.Module, 0);
  658. break;
  659. case ExtendPos.G4:
  660. LOG.Write($"robot extend G4 get: arm {ExtParam.Arm}, module {ExtParam.Module}");
  661. // WaferManager.Instance.WaferMoved(ExtParam.Module, 0, ModuleName.EfemRobot, (int)ExtParam.Arm);
  662. break;
  663. default:
  664. LOG.Write($"MNPT:{TargetPosition} 不需要更新 WaferManager 信息");
  665. break;
  666. }
  667. }
  668. }
  669. class GripAction : EfemAction
  670. {
  671. private Hand _blade;
  672. private bool _isGrip;
  673. public GripAction(EfemBase efem, Hand blade, bool isGrip)
  674. : base(efem, ModuleName.EFEM)
  675. {
  676. Type = EfemOperation.Grip;
  677. _blade = blade;
  678. _isGrip = isGrip;
  679. }
  680. public override void Execute()
  681. {
  682. _efem.MsgHandler.Send(new EfemMessage
  683. {
  684. Operation = this.Type,
  685. Head = EfemMessage.MsgHead.SET,
  686. Parameters = new List<string>
  687. {
  688. Constant.ArmString[_blade],
  689. _isGrip ? "ON":"OFF"
  690. }
  691. });
  692. this.Status = ActionStatus.SendCmd;
  693. _efem.Status = DeviceState.Busy;
  694. }
  695. public override void OnPostWork(string data)
  696. {
  697. _efem.Status = DeviceState.Idle;
  698. if (_blade == Hand.Blade1)
  699. _efem.GripStateBlade1 = _isGrip ? "ON" : "OFF";
  700. if (_blade == Hand.Blade2)
  701. _efem.GripStateBlade2 = _isGrip ? "ON" : "OFF";
  702. }
  703. }
  704. class LiftAction : EfemAction
  705. {
  706. // MOV:LIFT/ALIGN1;
  707. private bool _isUp;
  708. public LiftAction(EfemBase device, ModuleName mod, bool isUp) : base(device, mod)
  709. {
  710. Type = EfemOperation.Lift;
  711. Module = mod;
  712. _isUp = isUp;
  713. IsBackground = true;
  714. (device as Efem).IsBufferPinUp[mod] = !isUp;
  715. }
  716. public override void Execute()
  717. {
  718. _efem.MsgHandler.Send(new EfemMessage
  719. {
  720. Operation = this.Type,
  721. Head = EfemMessage.MsgHead.MOV,
  722. Parameters = new List<string> { Constant.ModuleString[this.Module], _isUp ? "UP":"DOWN" }
  723. });
  724. this.Status = ActionStatus.SendCmd;
  725. _efem.Status = DeviceState.Busy;
  726. EV.PostInfoLog(this.Module.ToString(), $"Cmd {this.ID} {this.Type} Start");
  727. }
  728. public override void OnPostWork(string data)
  729. {
  730. _efem.Status = DeviceState.Idle;
  731. (_efem as Efem).IsBufferPinUp[Module] = _isUp;
  732. }
  733. }
  734. class AlignAction : EfemAction
  735. {
  736. private WaferSize _ws { get; }
  737. public AlignAction(EfemBase device, ModuleName mod, WaferSize size) : base(device, mod)
  738. {
  739. Type = EfemOperation.Align;
  740. this.Module = mod;
  741. this._ws = size;
  742. }
  743. public override void Execute()
  744. {
  745. _efem.MsgHandler.Send(new EfemMessage
  746. {
  747. Operation = this.Type,
  748. Head = EfemMessage.MsgHead.MOV,
  749. Parameters = new List<string> { Module.ToHWString(), this._ws.ToString() }
  750. });
  751. this.Status = ActionStatus.SendCmd;
  752. }
  753. public override void OnPostWork(string data) { }
  754. }
  755. class LedAction : EfemAction
  756. {
  757. private LightType Light { get; }
  758. private LightStatus LtStatus { get; }
  759. public LedAction(EfemBase device, LightType lt, LightStatus st) : base(device, ModuleName.EFEM)
  760. {
  761. Type = EfemOperation.Light;
  762. Light = lt;
  763. LtStatus = st;
  764. IsBackground = true;
  765. }
  766. public override void Execute()
  767. {
  768. _efem.MsgHandler.Send(new EfemMessage
  769. {
  770. Operation = this.Type,
  771. Head = EfemMessage.MsgHead.SET,
  772. Parameters = new List<string> { Constant.STOWER, Light.ToString(), LtStatus.ToString() }
  773. });
  774. _efem.Status = DeviceState.Busy;
  775. this.Status = ActionStatus.SendCmd;
  776. //EV.PostInfoLog(this.Module.ToString(), $"CMD[{this.ID}], Set {this.Light} = {LtStatus}");
  777. }
  778. public override void OnPostWork(string data)
  779. {
  780. }
  781. }
  782. class AbortAction: EfemAction
  783. {
  784. public AbortAction(EfemBase efem) : base(efem, ModuleName.EFEM)
  785. {
  786. Type = EfemOperation.Abort;
  787. }
  788. public override void Execute()
  789. {
  790. _efem.MsgHandler.Send(new EfemMessage
  791. {
  792. Operation = this.Type,
  793. Head = EfemMessage.MsgHead.MOV
  794. });
  795. }
  796. }
  797. }