EFEMViewModel.cs 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630
  1. using System;
  2. using System.Collections.Generic;
  3. using Aitex.Core.Common.DeviceData;
  4. using Aitex.Core.Util;
  5. using Aitex.Sorter.Common;
  6. using Bolt.Toolkit.Wpf.Data;
  7. using Bolt.Toolkit.Wpf.Data.Enum;
  8. using MECF.Framework.Common.Equipment;
  9. using MECF.Framework.Common.OperationCenter;
  10. using Virgo_DCommon;
  11. using Virgo_DUI.Client.Models.Sys;
  12. namespace Virgo_DUI.Client.Models.Platform.EFEM
  13. {
  14. public class EFEMViewModel : UiViewModelBase
  15. {
  16. #region Properties
  17. [Subscription("LP1.Status")]
  18. public string LP1Status { get; set; }
  19. public string LP1StatusBackground
  20. {
  21. get { return GetUnitStatusBackground(LP1Status); }
  22. }
  23. [Subscription("LP1.IsMapped")]
  24. public bool IsLP1Mapped { get; set; }
  25. [Subscription("LP2.Status")]
  26. public string LP2Status { get; set; }
  27. public string LP2StatusBackground
  28. {
  29. get { return GetUnitStatusBackground(LP2Status); }
  30. }
  31. [Subscription("LP2.IsMapped")]
  32. public bool IsLP2Mapped { get; set; }
  33. [Subscription("EFEM.FsmState")]
  34. public string EfemStatus { get; set; }
  35. public string EfemStatusBackground
  36. {
  37. get { return GetUnitStatusBackground(EfemStatus); }
  38. }
  39. private string _SelectedModule;
  40. public string SelectedModule
  41. {
  42. get
  43. {
  44. return _SelectedModule;
  45. }
  46. set
  47. {
  48. _SelectedModule = value;
  49. Slots = GetSlotsByModule(_SelectedModule);
  50. SelectedSlot = 1;
  51. NotifyOfPropertyChange("SelectedModule");
  52. }
  53. }
  54. private string _PickSelectedModule;
  55. public string PickSelectedModule
  56. {
  57. get
  58. {
  59. return _PickSelectedModule;
  60. }
  61. set
  62. {
  63. _PickSelectedModule = value;
  64. PickSlots = GetSlotsByModule(_PickSelectedModule);
  65. PickSelectedSlot = 1;
  66. NotifyOfPropertyChange("PickSelectedModule");
  67. }
  68. }
  69. private string _PlaceSelectedModule;
  70. public string PlaceSelectedModule
  71. {
  72. get
  73. {
  74. return _PlaceSelectedModule;
  75. }
  76. set
  77. {
  78. _PlaceSelectedModule = value;
  79. PlaceSlots = GetSlotsByModule(_PlaceSelectedModule);
  80. PlaceSelectedSlot = 1;
  81. NotifyOfPropertyChange("PlaceSelectedModule");
  82. }
  83. }
  84. private string _ExtendSelectedModule;
  85. public string ExtendSelectedModule
  86. {
  87. get
  88. {
  89. return _ExtendSelectedModule;
  90. }
  91. set
  92. {
  93. _ExtendSelectedModule = value;
  94. ExtendSlots = GetExtendPos();
  95. NotifyOfPropertyChange("ExtendSelectedModule");
  96. }
  97. }
  98. private List<string> GetExtendPos()
  99. {
  100. //return new List<string> { "G1", "GB", "G4", "P1", "PB", "P4" };
  101. return new List<string> { "GoIntoGet", "GoBackGet", "GoIntoPut", "GoBackPut" };
  102. }
  103. private static Dictionary<string, string> ExtendParam = new Dictionary<string, string>()
  104. {
  105. {"GoIntoGet","GB" },
  106. {"GoBackGet","G4" },
  107. {"GoIntoPut","PB" },
  108. {"GoBackPut","P4" }
  109. };
  110. private string _RetractSelectedModule;
  111. public string RetractSelectedModule
  112. {
  113. get
  114. {
  115. return _RetractSelectedModule;
  116. }
  117. set
  118. {
  119. _RetractSelectedModule = value;
  120. RetractSlots = GetExtendPos();
  121. NotifyOfPropertyChange("RetractSelectedModule");
  122. }
  123. }
  124. private string _MapSelectedModule;
  125. public string MapSelectedModule
  126. {
  127. get
  128. {
  129. return _MapSelectedModule;
  130. }
  131. set
  132. {
  133. _MapSelectedModule = value;
  134. //MapSlots = GetSlotsByModule(_MapSelectedModule);
  135. MapSelectedSlot = 1;
  136. NotifyOfPropertyChange("MapSelectedModule");
  137. }
  138. }
  139. [Subscription("EfemRobot.RobotMoveAction")]
  140. public string EfemRobotMoveAction
  141. {
  142. get;
  143. set;
  144. }
  145. //[Subscription("EFEM.CassetteDoor")]
  146. //public AITSensorData CassetteDoorStatus
  147. //{
  148. // get;
  149. // set;
  150. //}
  151. [Subscription("EFEM.CassetteDoor")]
  152. public LidState CassetteDoorStatus
  153. {
  154. get;
  155. set;
  156. }
  157. public bool IsLP1PresentFeedback
  158. {
  159. get { return LP1CassetteState == LoadportCassetteState.Normal; }
  160. }
  161. public bool IsLP2PresentFeedback
  162. {
  163. get { return LP2CassetteState == LoadportCassetteState.Normal; }
  164. }
  165. [Subscription("LP1.CassetteState")]
  166. public LoadportCassetteState LP1CassetteState { get; set; }
  167. [Subscription("LP2.CassetteState")]
  168. public LoadportCassetteState LP2CassetteState { get; set; }
  169. public bool Foup1Present
  170. {
  171. get { return LP1CassetteState == LoadportCassetteState.Normal; }
  172. }
  173. public bool Foup2Present
  174. {
  175. get { return LP2CassetteState == LoadportCassetteState.Normal; }
  176. }
  177. public RobotMoveInfo EfemRobotMoveInfo
  178. {
  179. get
  180. {
  181. RobotMoveInfo _moveInfo = new RobotMoveInfo() { BladeTarget = "System" };
  182. if (!string.IsNullOrEmpty(EfemRobotMoveAction))
  183. {
  184. var action = EfemRobotMoveAction.Split('.');
  185. _moveInfo.BladeTarget = action[0];
  186. _moveInfo.Action = (RobotAction)Enum.Parse(typeof(RobotAction), action[1]);
  187. }
  188. return _moveInfo;
  189. }
  190. }
  191. private int _SelectedSlot;
  192. public int SelectedSlot
  193. {
  194. get { return _SelectedSlot; }
  195. set { _SelectedSlot = value; NotifyOfPropertyChange("SelectedSlot"); }
  196. }
  197. private int _PickSelectedSlot;
  198. public int PickSelectedSlot
  199. {
  200. get { return _PickSelectedSlot; }
  201. set { _PickSelectedSlot = value; NotifyOfPropertyChange("PickSelectedSlot"); }
  202. }
  203. private int _PlaceSelectedSlot;
  204. public int PlaceSelectedSlot
  205. {
  206. get { return _PlaceSelectedSlot; }
  207. set { _PlaceSelectedSlot = value; NotifyOfPropertyChange("PlaceSelectedSlot"); }
  208. }
  209. private string _ExtendSelectedSlot;
  210. public string ExtendSelectedSlot
  211. {
  212. get { return _ExtendSelectedSlot; }
  213. set { _ExtendSelectedSlot = value; NotifyOfPropertyChange("ExtendSelectedSlot"); }
  214. }
  215. private int _RetractSelectedSlot;
  216. public int RetractSelectedSlot
  217. {
  218. get { return _RetractSelectedSlot; }
  219. set { _RetractSelectedSlot = value; NotifyOfPropertyChange("RetractSelectedSlot"); }
  220. }
  221. private int _MapSelectedSlot;
  222. public int MapSelectedSlot
  223. {
  224. get { return _MapSelectedSlot; }
  225. set { _MapSelectedSlot = value; NotifyOfPropertyChange("MapSelectedSlot"); }
  226. }
  227. private List<string> _pickModules;
  228. public List<string> PickPlaceModules
  229. {
  230. get { return _pickModules; }
  231. set { _pickModules = value; NotifyOfPropertyChange("PickPlaceModules"); }
  232. }
  233. private List<string> _mapModules;
  234. public List<string> MapModules
  235. {
  236. get { return _mapModules; }
  237. set { _mapModules = value; NotifyOfPropertyChange("MapModules"); }
  238. }
  239. private List<string> _extendModules;
  240. public List<string> ExtendRetractModules
  241. {
  242. get { return _extendModules; }
  243. set { _extendModules = value; NotifyOfPropertyChange("ExtendRetractModules"); }
  244. }
  245. private List<int> _slots;
  246. public List<int> Slots
  247. {
  248. get { return _slots; }
  249. set { _slots = value; NotifyOfPropertyChange("Slots"); }
  250. }
  251. private List<int> _Pickslots;
  252. public List<int> PickSlots
  253. {
  254. get { return _Pickslots; }
  255. set { _Pickslots = value; NotifyOfPropertyChange("PickSlots"); }
  256. }
  257. private List<int> _Placeslots;
  258. public List<int> PlaceSlots
  259. {
  260. get { return _Placeslots; }
  261. set { _Placeslots = value; NotifyOfPropertyChange("PlaceSlots"); }
  262. }
  263. private List<string> _Extendslots;
  264. public List<string> ExtendSlots
  265. {
  266. get { return _Extendslots; }
  267. set { _Extendslots = value; NotifyOfPropertyChange("ExtendSlots"); }
  268. }
  269. private List<string> _Retractslots;
  270. public List<string> RetractSlots
  271. {
  272. get { return _Retractslots; }
  273. set { _Retractslots = value; NotifyOfPropertyChange("RetractSlots"); }
  274. }
  275. [Subscription("LP1.WaferSize")]
  276. public string LP1WaferSize { get; set; }
  277. public string WaferSizeLP1
  278. {
  279. get { return LP1CassetteState == LoadportCassetteState.Normal ? GetWaferSize(LP1WaferSize) : "--"; }
  280. }
  281. [Subscription("LP2.WaferSize")]
  282. public string LP2WaferSize { get; set; }
  283. public string WaferSizeLP2
  284. {
  285. get { return LP2CassetteState == LoadportCassetteState.Normal ? GetWaferSize(LP2WaferSize) : "--"; }
  286. }
  287. [Subscription("Aligner1.WaferSize")]
  288. public string Aligner1WaferSize { get; set; }
  289. public string WaferSizeAligner1
  290. {
  291. get { return GetWaferSize(Aligner1WaferSize); }
  292. }
  293. [Subscription("Aligner2.WaferSize")]
  294. public string Aligner2WaferSize { get; set; }
  295. public string WaferSizeAligner2
  296. {
  297. get { return GetWaferSize(Aligner2WaferSize); }
  298. }
  299. [Subscription("EfemRobot.WaferSize")]
  300. public string EfemRobotWaferSize { get; set; }
  301. public string WaferSizeEfemRobot
  302. {
  303. get { return GetWaferSize(EfemRobotWaferSize); }
  304. }
  305. [Subscription("PMA.WaferSize")]
  306. public string PMAWaferSize { get; set; }
  307. public string WaferSizePMA
  308. {
  309. get { return GetWaferSize(PMAWaferSize); }
  310. }
  311. [Subscription("PMB.WaferSize")]
  312. public string PMBWaferSize { get; set; }
  313. public string WaferSizePMB
  314. {
  315. get { return GetWaferSize(PMBWaferSize); }
  316. }
  317. #region
  318. public bool WaferSizePMA_3
  319. {
  320. set { }
  321. get { return PMAWaferSize == "WS3"; }
  322. }
  323. public bool WaferSizePMA_4
  324. {
  325. set { }
  326. get { return PMAWaferSize == "WS4"; }
  327. }
  328. public bool WaferSizePMA_6
  329. {
  330. set { }
  331. get { return PMAWaferSize == "WS6"; }
  332. }
  333. public bool WaferSizePMB_3
  334. {
  335. set { }
  336. get { return PMBWaferSize == "WS3"; }
  337. }
  338. public bool WaferSizePMB_4
  339. {
  340. set { }
  341. get { return PMBWaferSize == "WS4"; }
  342. }
  343. public bool WaferSizePMB_6
  344. {
  345. set { }
  346. get { return PMBWaferSize == "WS6"; }
  347. }
  348. public bool WaferSizeAligner2_3
  349. {
  350. set { }
  351. get { return Aligner2WaferSize == "WS3"; }
  352. }
  353. public bool WaferSizeAligner2_4
  354. {
  355. set { }
  356. get { return Aligner2WaferSize == "WS4"; }
  357. }
  358. public bool WaferSizeAligner2_6
  359. {
  360. set { }
  361. get { return Aligner2WaferSize == "WS6"; }
  362. }
  363. public bool WaferSizeAligner1_3
  364. {
  365. set { }
  366. get { return Aligner1WaferSize == "WS3"; }
  367. }
  368. public bool WaferSizeAligner1_4
  369. {
  370. set { }
  371. get { return Aligner1WaferSize == "WS4"; }
  372. }
  373. public bool WaferSizeAligner1_6
  374. {
  375. set { }
  376. get { return Aligner1WaferSize == "WS6"; }
  377. }
  378. public bool WaferSizeEfemRobot_3
  379. {
  380. set { }
  381. get { return EfemRobotWaferSize == "WS3"; }
  382. }
  383. public bool WaferSizeEfemRobot_4
  384. {
  385. set { }
  386. get { return EfemRobotWaferSize == "WS4"; }
  387. }
  388. public bool WaferSizeEfemRobot_6
  389. {
  390. set { }
  391. get { return EfemRobotWaferSize == "WS6"; }
  392. }
  393. #endregion
  394. public bool PMASlitValveIsOpen
  395. {
  396. get { return SlitDoorDataA != null && SlitDoorDataA.OpenFeedback && !SlitDoorDataA.CloseFeedback; }
  397. }
  398. [Subscription("PMA.SlitDoor.DeviceData")]
  399. public AITCylinderData SlitDoorDataA
  400. {
  401. get;
  402. set;
  403. }
  404. public bool PMBSlitValveIsOpen
  405. {
  406. get { return SlitDoorDataB != null && SlitDoorDataB.OpenFeedback && !SlitDoorDataB.CloseFeedback; }
  407. }
  408. [Subscription("PMB.SlitDoor.DeviceData")]
  409. public AITCylinderData SlitDoorDataB
  410. {
  411. get;
  412. set;
  413. }
  414. public Dictionary<string, string> _waferSizeMap = new Dictionary<string, string>()
  415. {
  416. {"WS3", "3'"},{"WS4", "4'"},{"WS6", "6'"}
  417. };
  418. private string GetWaferSize(string size)
  419. {
  420. if (size != null && _waferSizeMap.ContainsKey(size))
  421. return _waferSizeMap[size];
  422. return "";
  423. }
  424. #endregion Properties
  425. public EFEMViewModel()
  426. {
  427. this.DisplayName = "EFEM";
  428. _pickModules = new List<string>() { "LP1", "LP2", "Aligner1", "Aligner2" };
  429. _mapModules = new List<string>() { "LP1", "LP2" };
  430. _extendModules = new List<string>() { "PMA", "PMB" };
  431. PickSelectedModule = "LP1";
  432. PlaceSelectedModule = "LP1";
  433. ExtendSelectedModule = "PMA";
  434. RetractSelectedModule = "PMA";
  435. MapSelectedModule = "LP1";
  436. }
  437. private List<int> GetSlotsByModule(string module)
  438. {
  439. List<int> slots = new List<int>();
  440. int num = 0;
  441. switch (module)
  442. {
  443. case "LP1":
  444. case "LP2":
  445. num = 25;
  446. break;
  447. case "Aligner1":
  448. case "Aligner2":
  449. case "PMA":
  450. case "PMB":
  451. num = 1;
  452. break;
  453. }
  454. int j = 0;
  455. while (j < num)
  456. {
  457. slots.Add(j + 1);
  458. j++;
  459. }
  460. return slots;
  461. }
  462. protected override void OnInitialize()
  463. {
  464. base.OnInitialize();
  465. base.InitModules();
  466. }
  467. #region Operation
  468. public void SetWaferSize(string module, string size)
  469. {
  470. InvokeClient.Instance.Service.DoOperation("System.SetWaferSize", module, size);
  471. }
  472. public void HomeAligner(string module)
  473. {
  474. InvokeClient.Instance.Service.DoOperation($"{module}.{EfemOperation.Home}");
  475. }
  476. public void AlignAligner(string module)
  477. {
  478. InvokeClient.Instance.Service.DoOperation($"{module}.{EfemOperation.Align}",
  479. module == ModuleName.Aligner1.ToString() ? Aligner1WaferSize : Aligner2WaferSize);
  480. }
  481. public void LiftAligner(string module)
  482. {
  483. InvokeClient.Instance.Service.DoOperation($"{module}.{EfemOperation.Lift}");
  484. }
  485. public void HomeEfem()
  486. {
  487. InvokeClient.Instance.Service.DoOperation($"{ModuleName.EFEM}.{EfemOperation.Home}");
  488. }
  489. public void ResetEfem()
  490. {
  491. InvokeClient.Instance.Service.DoOperation($"{ModuleName.EFEM}.Reset");
  492. }
  493. public void ClearError()
  494. {
  495. InvokeClient.Instance.Service.DoOperation($"{ModuleName.EFEM}.{EfemOperation.ClearError}");
  496. }
  497. public void HomeRobot()
  498. {
  499. InvokeClient.Instance.Service.DoOperation($"{ModuleName.EfemRobot}.{EfemOperation.Home}");
  500. }
  501. public void AbortRobot()
  502. {
  503. InvokeClient.Instance.Service.DoOperation($"{ModuleName.EfemRobot}.{EfemOperation.Abort}");
  504. }
  505. public void RobotPick()
  506. {
  507. string ws = PickSelectedModule == ModuleName.LP1.ToString() ? LP1WaferSize :
  508. PickSelectedModule == ModuleName.LP2.ToString() ? LP2WaferSize :
  509. PickSelectedModule == ModuleName.Aligner1.ToString() ? Aligner1WaferSize :
  510. PickSelectedModule == ModuleName.Aligner2.ToString() ? Aligner2WaferSize : throw new ArgumentOutOfRangeException();
  511. InvokeClient.Instance.Service.DoOperation($"{ModuleName.EfemRobot}.{EfemOperation.Pick}",
  512. PickSelectedModule, PickSelectedSlot - 1, ws);
  513. }
  514. public void RobotPlace()
  515. {
  516. string ws = PlaceSelectedModule == ModuleName.LP1.ToString() ? LP1WaferSize :
  517. PlaceSelectedModule == ModuleName.LP2.ToString() ? LP2WaferSize :
  518. PlaceSelectedModule == ModuleName.Aligner1.ToString() ? Aligner1WaferSize :
  519. PlaceSelectedModule == ModuleName.Aligner2.ToString() ? Aligner2WaferSize : throw new ArgumentOutOfRangeException();
  520. InvokeClient.Instance.Service.DoOperation($"{ModuleName.EfemRobot}.{EfemOperation.Place}",
  521. PlaceSelectedModule, PlaceSelectedSlot - 1, ws);
  522. }
  523. public void RobotExtend()
  524. {
  525. InvokeClient.Instance.Service.DoOperation($"{ModuleName.EfemRobot}.{EfemOperation.Extend}", ExtendSelectedModule, ExtendParam[ExtendSelectedSlot]);
  526. }
  527. public void RobotRetract()
  528. {
  529. InvokeClient.Instance.Service.DoOperation($"{ModuleName.EfemRobot}.{EfemOperation.Retract}", RetractSelectedModule, RetractSlots[RetractSelectedSlot]);
  530. }
  531. public void RobotMap()
  532. {
  533. InvokeClient.Instance.Service.DoOperation($"{MapSelectedModule}.{EfemOperation.Map}");
  534. }
  535. #endregion Operation
  536. }
  537. }