EFEMViewModel.cs 36 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Security.AccessControl;
  5. using System.Windows;
  6. using Aitex.Core.Common;
  7. using Aitex.Core.Common.DeviceData;
  8. using Aitex.Core.Util;
  9. using Aitex.Sorter.Common;
  10. using Bolt.Toolkit.Wpf.Data;
  11. using Bolt.Toolkit.Wpf.Data.Enum;
  12. using Caliburn.Micro.Core;
  13. using MECF.Framework.Common.DataCenter;
  14. using MECF.Framework.Common.Equipment;
  15. using MECF.Framework.Common.OperationCenter;
  16. using VirgoCommon;
  17. using VirgoUI.Client.Models.Sys;
  18. namespace VirgoUI.Client.Models.Platform.EFEM
  19. {
  20. public class EFEMViewModel : UiViewModelBase
  21. {
  22. private int MenuPermission;
  23. #region Properties
  24. [Subscription("LP1.CassettePlaced")]
  25. public bool PlacedLP1 { get; set; }
  26. [Subscription("LP1.IsLoaded")]
  27. public bool IsLoadedLP1 { get; set; }
  28. [Subscription("LP1.IsClamped")]
  29. public bool IsClampedLP1 { get; set; }
  30. [Subscription("LP1.IsDocked")]
  31. public bool IsDockedLP1 { get; set; }
  32. [Subscription("LP2.CassettePlaced")]
  33. public bool PlacedLP2 { get; set; }
  34. [Subscription("LP1.Status")]
  35. public string LP1Status { get; set; }
  36. public string LP1StatusBackground
  37. {
  38. get { return GetUnitStatusBackground(LP1Status); }
  39. }
  40. [Subscription("LP1.CarrierId")]
  41. public string LP1CarrierId { get; set; }
  42. [Subscription("LP2.CarrierId")]
  43. public string LP2CarrierId { get; set; }
  44. [Subscription("LP1.IsMapped")]
  45. public bool IsLP1Mapped { get; set; }
  46. [Subscription("LP2.Status")]
  47. public string LP2Status { get; set; }
  48. public string LP2StatusBackground
  49. {
  50. get { return GetUnitStatusBackground(LP2Status); }
  51. }
  52. [Subscription("LP2.IsMapped")]
  53. public bool IsLP2Mapped { get; set; }
  54. public Visibility Foup1Visibility
  55. {
  56. get
  57. {
  58. if (IsLP1Installed)
  59. {
  60. return Visibility.Visible;
  61. }
  62. else
  63. return Visibility.Hidden;
  64. }
  65. }
  66. public Visibility Foup2Visibility
  67. {
  68. get
  69. {
  70. if (IsLP2Installed)
  71. {
  72. return Visibility.Visible;
  73. }
  74. else
  75. return Visibility.Hidden;
  76. }
  77. }
  78. [Subscription("LP2.IsLoaded")]
  79. public bool IsLoadedLP2 { get; set; }
  80. [Subscription("LP2.IsClamped")]
  81. public bool IsClampedLP2 { get; set; }
  82. [Subscription("LP2.IsDocked")]
  83. public bool IsDockedLP2 { get; set; }
  84. [Subscription("EfemRobot.RobotMoveAction")]
  85. public MECF.Framework.Common.CommonData.RobotMoveInfo EfemRobotMoveAction
  86. {
  87. get;
  88. set;
  89. }
  90. [Subscription("EFEM.FsmState")]
  91. public string EfemStatus { get; set; }
  92. public string EfemStatusBackground
  93. {
  94. get { return GetUnitStatusBackground(EfemStatus); }
  95. }
  96. [Subscription("PMA.IsAutoMode")]
  97. public bool PMAIsAutoMode { get; set; }
  98. [Subscription("PMB.IsAutoMode")]
  99. public bool PMBIsAutoMode { get; set; }
  100. [Subscription("PMA.IsOnline")]
  101. public bool PMAIsOnline { get; set; }
  102. [Subscription("PMB.IsOnline")]
  103. public bool PMBIsOnline { get; set; }
  104. public string PMAState
  105. {
  106. get
  107. {
  108. return "PMA/" + (PMAIsAutoMode ? "Auto/" : "Manual/") + (PMAIsOnline ? "Online" : "Offline");
  109. }
  110. }
  111. public string PMBState
  112. {
  113. get
  114. {
  115. return "PMB/" + (PMBIsAutoMode ? "Auto/" : "Manual/") + (PMBIsOnline ? "Online" : "Offline");
  116. }
  117. }
  118. private string _SelectedModule;
  119. public string SelectedModule
  120. {
  121. get
  122. {
  123. return _SelectedModule;
  124. }
  125. set
  126. {
  127. _SelectedModule = value;
  128. Slots = GetSlotsByModule(_SelectedModule);
  129. SelectedSlot = 1;
  130. NotifyOfPropertyChange("SelectedModule");
  131. }
  132. }
  133. private string _PickSelectedModule;
  134. public string PickSelectedModule
  135. {
  136. get
  137. {
  138. return _PickSelectedModule;
  139. }
  140. set
  141. {
  142. _PickSelectedModule = value;
  143. PickSlots = GetSlotsByModule(_PickSelectedModule);
  144. PickSelectedSlot = 1;
  145. NotifyOfPropertyChange("PickSelectedModule");
  146. }
  147. }
  148. private string _PlaceSelectedModule;
  149. public string PlaceSelectedModule
  150. {
  151. get
  152. {
  153. return _PlaceSelectedModule;
  154. }
  155. set
  156. {
  157. _PlaceSelectedModule = value;
  158. PlaceSlots = GetSlotsByModule(_PlaceSelectedModule);
  159. PlaceSelectedSlot = 1;
  160. NotifyOfPropertyChange("PlaceSelectedModule");
  161. }
  162. }
  163. private string _ExtendSelectedModule;
  164. public string ExtendSelectedModule
  165. {
  166. get
  167. {
  168. return _ExtendSelectedModule;
  169. }
  170. set
  171. {
  172. _ExtendSelectedModule = value;
  173. ExtendSlots = GetExtendPos();
  174. NotifyOfPropertyChange("ExtendSelectedModule");
  175. }
  176. }
  177. private List<string> GetExtendPos()
  178. {
  179. //return new List<string> { "G1", "GB", "G4", "P1", "PB", "P4" };
  180. return new List<string> { "GoIntoGet", "GoBackGet", "GoIntoPut", "GoBackPut" };
  181. }
  182. private static Dictionary<string, string> ExtendParam = new Dictionary<string, string>()
  183. {
  184. {"GoIntoGet","GB" },
  185. {"GoBackGet","G4" },
  186. {"GoIntoPut","PB" },
  187. {"GoBackPut","P4" }
  188. };
  189. private string _RetractSelectedModule;
  190. public string RetractSelectedModule
  191. {
  192. get
  193. {
  194. return _RetractSelectedModule;
  195. }
  196. set
  197. {
  198. _RetractSelectedModule = value;
  199. RetractSlots = GetExtendPos();
  200. NotifyOfPropertyChange("RetractSelectedModule");
  201. }
  202. }
  203. private string _MapSelectedModule;
  204. public string MapSelectedModule
  205. {
  206. get
  207. {
  208. return _MapSelectedModule;
  209. }
  210. set
  211. {
  212. _MapSelectedModule = value;
  213. //MapSlots = GetSlotsByModule(_MapSelectedModule);
  214. MapSelectedSlot = 1;
  215. NotifyOfPropertyChange("MapSelectedModule");
  216. }
  217. }
  218. private string _SelectedHomeModule;
  219. public string SelectedHomeModule
  220. {
  221. get
  222. {
  223. return _SelectedHomeModule;
  224. }
  225. set
  226. {
  227. _SelectedHomeModule = value;
  228. NotifyOfPropertyChange("SelectedHomeModule");
  229. }
  230. }
  231. private List<string> _HomeModules;
  232. public List<string> HomeModules
  233. {
  234. get { return _HomeModules; }
  235. set { _HomeModules = value; NotifyOfPropertyChange("HomeModules"); }
  236. }
  237. private string _SelectedSpeed;
  238. public string SelectedSpeed
  239. {
  240. get
  241. {
  242. return _SelectedSpeed;
  243. }
  244. set
  245. {
  246. _SelectedSpeed = value;
  247. NotifyOfPropertyChange("SelectedSpeed");
  248. }
  249. }
  250. private List<string> _RobotSpeeds;
  251. public List<string> RobotSpeeds
  252. {
  253. get { return _RobotSpeeds; }
  254. set { _RobotSpeeds = value; NotifyOfPropertyChange("RobotSpeeds"); }
  255. }
  256. [Subscription("EFEM.CassetteDoor")]
  257. public LidState CassetteDoorStatus
  258. {
  259. get;
  260. set;
  261. }
  262. public bool IsLP1PresentFeedback
  263. {
  264. get { return LP1CassetteState == LoadportCassetteState.Normal; }
  265. }
  266. public bool IsLP2PresentFeedback
  267. {
  268. get { return LP2CassetteState == LoadportCassetteState.Normal; }
  269. }
  270. [Subscription("LP1.CassetteState")]
  271. public LoadportCassetteState LP1CassetteState { get; set; }
  272. [Subscription("LP2.CassetteState")]
  273. public LoadportCassetteState LP2CassetteState { get; set; }
  274. public bool Foup1Present
  275. {
  276. get { return LP1CassetteState == LoadportCassetteState.Normal; }
  277. }
  278. public bool Foup2Present
  279. {
  280. get { return LP2CassetteState == LoadportCassetteState.Normal; }
  281. }
  282. //public RobotMoveInfo EfemRobotMoveInfo
  283. //{
  284. // get
  285. // {
  286. // RobotMoveInfo _moveInfo = new RobotMoveInfo() { BladeTarget = "System" };
  287. // if (!string.IsNullOrEmpty(EfemRobotMoveAction))
  288. // {
  289. // var action = EfemRobotMoveAction.Split('.');
  290. // _moveInfo.BladeTarget = action[0];
  291. // _moveInfo.Action = (RobotAction)Enum.Parse(typeof(RobotAction), action[1]);
  292. // }
  293. // return _moveInfo;
  294. // }
  295. //}
  296. private List<string> _blades = new List<string>() { "Blade1", "Blade2" };
  297. public List<string> Blades
  298. {
  299. get { return _blades; }
  300. set { _blades = value; NotifyOfPropertyChange("Blades"); }
  301. }
  302. private int _SelectedSlot;
  303. public int SelectedSlot
  304. {
  305. get { return _SelectedSlot; }
  306. set { _SelectedSlot = value; NotifyOfPropertyChange("SelectedSlot"); }
  307. }
  308. private int _PickSelectedSlot;
  309. public int PickSelectedSlot
  310. {
  311. get { return _PickSelectedSlot; }
  312. set { _PickSelectedSlot = value; NotifyOfPropertyChange("PickSelectedSlot"); }
  313. }
  314. private string _pickSelectedBlade;
  315. public string PickSelectedBlade
  316. {
  317. get { return _pickSelectedBlade; }
  318. set { _pickSelectedBlade = value; NotifyOfPropertyChange("PickSelectedBlade"); }
  319. }
  320. private int _PlaceSelectedSlot;
  321. public int PlaceSelectedSlot
  322. {
  323. get { return _PlaceSelectedSlot; }
  324. set { _PlaceSelectedSlot = value; NotifyOfPropertyChange("PlaceSelectedSlot"); }
  325. }
  326. private string _placeSelectedBlade;
  327. public string PlaceSelectedBlade
  328. {
  329. get { return _placeSelectedBlade; }
  330. set { _placeSelectedBlade = value; NotifyOfPropertyChange("PlaceSelectedBlade"); }
  331. }
  332. private string _ExtendSelectedSlot;
  333. public string ExtendSelectedSlot
  334. {
  335. get { return _ExtendSelectedSlot; }
  336. set { _ExtendSelectedSlot = value; NotifyOfPropertyChange("ExtendSelectedSlot"); }
  337. }
  338. private string _extendSelectedBlade;
  339. public string ExtendSelectedBlade
  340. {
  341. get { return _extendSelectedBlade; }
  342. set { _extendSelectedBlade = value; NotifyOfPropertyChange("ExtendSelectedBlade"); }
  343. }
  344. private string _gripSelectedBlade;
  345. public string GripSelectedBlade
  346. {
  347. get { return _gripSelectedBlade; }
  348. set { _gripSelectedBlade = value; NotifyOfPropertyChange("GripSelectedBlade"); }
  349. }
  350. private string _ungripSelectedBlade;
  351. public string UngripSelectedBlade
  352. {
  353. get { return _ungripSelectedBlade; }
  354. set { _ungripSelectedBlade = value; NotifyOfPropertyChange("UngripSelectedBlade"); }
  355. }
  356. private string _flipSelectedBlade;
  357. public string FlipSelectedBlade
  358. {
  359. get { return _flipSelectedBlade; }
  360. set { _flipSelectedBlade = value; NotifyOfPropertyChange("FlipSelectedBlade"); }
  361. }
  362. private int _RetractSelectedSlot;
  363. public int RetractSelectedSlot
  364. {
  365. get { return _RetractSelectedSlot; }
  366. set { _RetractSelectedSlot = value; NotifyOfPropertyChange("RetractSelectedSlot"); }
  367. }
  368. private int _MapSelectedSlot;
  369. public int MapSelectedSlot
  370. {
  371. get { return _MapSelectedSlot; }
  372. set { _MapSelectedSlot = value; NotifyOfPropertyChange("MapSelectedSlot"); }
  373. }
  374. private List<string> _pickModules;
  375. public List<string> PickPlaceModules
  376. {
  377. get { return _pickModules; }
  378. set { _pickModules = value; NotifyOfPropertyChange("PickPlaceModules"); }
  379. }
  380. private List<string> _mapModules;
  381. public List<string> MapModules
  382. {
  383. get { return _mapModules; }
  384. set { _mapModules = value; NotifyOfPropertyChange("MapModules"); }
  385. }
  386. private List<string> _extendModules;
  387. public List<string> ExtendRetractModules
  388. {
  389. get { return _extendModules; }
  390. set { _extendModules = value; NotifyOfPropertyChange("ExtendRetractModules"); }
  391. }
  392. private List<int> _slots;
  393. public List<int> Slots
  394. {
  395. get { return _slots; }
  396. set { _slots = value; NotifyOfPropertyChange("Slots"); }
  397. }
  398. private List<int> _Pickslots;
  399. public List<int> PickSlots
  400. {
  401. get { return _Pickslots; }
  402. set { _Pickslots = value; NotifyOfPropertyChange("PickSlots"); }
  403. }
  404. private List<int> _Placeslots;
  405. public List<int> PlaceSlots
  406. {
  407. get { return _Placeslots; }
  408. set { _Placeslots = value; NotifyOfPropertyChange("PlaceSlots"); }
  409. }
  410. private List<string> _Extendslots;
  411. public List<string> ExtendSlots
  412. {
  413. get { return _Extendslots; }
  414. set { _Extendslots = value; NotifyOfPropertyChange("ExtendSlots"); }
  415. }
  416. private List<string> _Retractslots;
  417. public List<string> RetractSlots
  418. {
  419. get { return _Retractslots; }
  420. set { _Retractslots = value; NotifyOfPropertyChange("RetractSlots"); }
  421. }
  422. [Subscription("LP1.WaferSize")]
  423. public string LP1WaferSize { get; set; }
  424. public string WaferSizeLP1
  425. {
  426. get { return LP1CassetteState == LoadportCassetteState.Normal ? GetWaferSize(LP1WaferSize) : "--"; }
  427. }
  428. [Subscription("LP2.WaferSize")]
  429. public string LP2WaferSize { get; set; }
  430. public string WaferSizeLP2
  431. {
  432. get { return LP2CassetteState == LoadportCassetteState.Normal ? GetWaferSize(LP2WaferSize) : "--"; }
  433. }
  434. [Subscription("Aligner1.WaferSize")]
  435. public string Aligner1WaferSize { get; set; }
  436. public string WaferSizeAligner1
  437. {
  438. get { return GetWaferSize(Aligner1WaferSize); }
  439. }
  440. [Subscription("Aligner2.WaferSize")]
  441. public string Aligner2WaferSize { get; set; }
  442. public string WaferSizeAligner2
  443. {
  444. get { return GetWaferSize(Aligner2WaferSize); }
  445. }
  446. [Subscription("Cooling1.WaferSize")]
  447. public string Cooling1WaferSize { get; set; }
  448. public string WaferSizeCooling1
  449. {
  450. get { return GetWaferSize(Cooling1WaferSize); }
  451. }
  452. [Subscription("Cooling2.WaferSize")]
  453. public string Cooling2WaferSize { get; set; }
  454. public string WaferSizeCooling2
  455. {
  456. get { return GetWaferSize(Cooling2WaferSize); }
  457. }
  458. [Subscription("EfemRobot.WaferSize")]
  459. public string EfemRobotWaferSize { get; set; }
  460. public string WaferSizeEfemRobot
  461. {
  462. get { return GetWaferSize(EfemRobotWaferSize); }
  463. }
  464. [Subscription("PMA.WaferSize")]
  465. public string PMAWaferSize { get; set; }
  466. public string WaferSizePMA
  467. {
  468. get { return GetWaferSize(PMAWaferSize); }
  469. }
  470. [Subscription("PMB.WaferSize")]
  471. public string PMBWaferSize { get; set; }
  472. public string WaferSizePMB
  473. {
  474. get { return GetWaferSize(PMBWaferSize); }
  475. }
  476. [Subscription("EFEM.SmallWafer")]
  477. public int SmallWafer { get; set; }
  478. [Subscription("EFEM.MidWafer")]
  479. public int MidWafer { get; set; }
  480. [Subscription("EFEM.BigWafer")]
  481. public int BigWafer { get; set; }
  482. private List<string> _flipFace = new List<string>() { "FaceUp", "FaceDown" };
  483. public List<string> FlipFace
  484. {
  485. get { return _flipFace; }
  486. set { _flipFace = value; NotifyOfPropertyChange("FlipFace"); }
  487. }
  488. #region
  489. public bool WaferSizePMA_3
  490. {
  491. set { }
  492. get { return PMAWaferSize == "WS3"; }
  493. }
  494. public bool WaferSizePMA_4
  495. {
  496. set { }
  497. get { return PMAWaferSize == "WS4"; }
  498. }
  499. public bool WaferSizePMA_6
  500. {
  501. set { }
  502. get { return PMAWaferSize == "WS6"; }
  503. }
  504. public bool WaferSizePMB_3
  505. {
  506. set { }
  507. get { return PMBWaferSize == "WS3"; }
  508. }
  509. public bool WaferSizePMB_4
  510. {
  511. set { }
  512. get { return PMBWaferSize == "WS4"; }
  513. }
  514. public bool WaferSizePMB_6
  515. {
  516. set { }
  517. get { return PMBWaferSize == "WS6"; }
  518. }
  519. public bool WaferSizeCooling2_3
  520. {
  521. set { }
  522. get { return Cooling2WaferSize == "WS3"; }
  523. }
  524. public bool WaferSizeCooling2_4
  525. {
  526. set { }
  527. get { return Cooling2WaferSize == "WS4"; }
  528. }
  529. public bool WaferSizeCooling2_6
  530. {
  531. set { }
  532. get { return Cooling2WaferSize == "WS6"; }
  533. }
  534. public bool WaferSizeCooling1_3
  535. {
  536. set { }
  537. get { return Cooling1WaferSize == "WS3"; }
  538. }
  539. public bool WaferSizeCooling1_4
  540. {
  541. set { }
  542. get { return Cooling1WaferSize == "WS4"; }
  543. }
  544. public bool WaferSizeCooling1_6
  545. {
  546. set { }
  547. get { return Cooling1WaferSize == "WS6"; }
  548. }
  549. public bool WaferSizeAligner2_3
  550. {
  551. set { }
  552. get { return Aligner2WaferSize == "WS3"; }
  553. }
  554. public bool WaferSizeAligner2_4
  555. {
  556. set { }
  557. get { return Aligner2WaferSize == "WS4"; }
  558. }
  559. public bool WaferSizeAligner2_6
  560. {
  561. set { }
  562. get { return Aligner2WaferSize == "WS6"; }
  563. }
  564. public bool WaferSizeAligner1_3
  565. {
  566. set { }
  567. get { return Aligner1WaferSize == "WS3"; }
  568. }
  569. public bool WaferSizeAligner1_4
  570. {
  571. set { }
  572. get { return Aligner1WaferSize == "WS4"; }
  573. }
  574. public bool WaferSizeAligner1_6
  575. {
  576. set { }
  577. get { return Aligner1WaferSize == "WS6"; }
  578. }
  579. public bool WaferSizeEfemRobot_3
  580. {
  581. set { }
  582. get { return EfemRobotWaferSize == "WS3"; }
  583. }
  584. public bool WaferSizeEfemRobot_4
  585. {
  586. set { }
  587. get { return EfemRobotWaferSize == "WS4"; }
  588. }
  589. public bool WaferSizeEfemRobot_6
  590. {
  591. set { }
  592. get { return EfemRobotWaferSize == "WS6"; }
  593. }
  594. #endregion
  595. public bool PMASlitValveIsOpen
  596. {
  597. get { return SlitDoorDataA != null && SlitDoorDataA.OpenFeedback && !SlitDoorDataA.CloseFeedback; }
  598. }
  599. [Subscription("PMA.SlitDoor.DeviceData")]
  600. public AITCylinderData SlitDoorDataA
  601. {
  602. get;
  603. set;
  604. }
  605. public bool PMBSlitValveIsOpen
  606. {
  607. get { return SlitDoorDataB != null && SlitDoorDataB.OpenFeedback && !SlitDoorDataB.CloseFeedback; }
  608. }
  609. [Subscription("PMB.SlitDoor.DeviceData")]
  610. public AITCylinderData SlitDoorDataB
  611. {
  612. get;
  613. set;
  614. }
  615. public Dictionary<string, string> _waferSizeMap = new Dictionary<string, string>()
  616. {
  617. {"WS3", "3'"},{"WS4", "4'"},{"WS6", "6'"}
  618. };
  619. private string GetWaferSize(string size)
  620. {
  621. if (size != null && _waferSizeMap.ContainsKey(size))
  622. switch (size)
  623. {
  624. case "WS3": return SmallWafer.ToString();
  625. case "WS4": return MidWafer.ToString();
  626. case "WS6": return BigWafer.ToString();
  627. default: return "";
  628. }
  629. //return _waferSizeMap[size];
  630. return BigWafer.ToString();
  631. }
  632. [Subscription("EfemRobot.GripStateBlade1")]
  633. public string GripStateBlade1 { get; set; }
  634. public string Blade1GripStateColor
  635. {
  636. get
  637. {
  638. switch (GripStateBlade1)
  639. {
  640. case "ON": return "Lime";
  641. case "OFF": return "Gray";
  642. default: return "Yellow";
  643. }
  644. }
  645. }
  646. [Subscription("EfemRobot.GripStateBlade2")]
  647. public string GripStateBlade2 { get; set; }
  648. public string Blade2GripStateColor
  649. {
  650. get
  651. {
  652. switch (GripStateBlade2)
  653. {
  654. case "ON": return "Lime";
  655. case "OFF": return "Gray";
  656. default: return "Yellow";
  657. }
  658. }
  659. }
  660. public Aitex.Core.Common.WaferSize SmallPinWaferSize { get; set; }
  661. public Aitex.Core.Common.WaferSize MediumPinWaferSize { get; set; }
  662. public Aitex.Core.Common.WaferSize BigPinWaferSize { get; set; }
  663. #endregion Properties
  664. public Visibility LowerArmVisibility
  665. {
  666. get
  667. {
  668. try
  669. {
  670. var armTypeConfig = QueryDataClient.Instance.Service.GetConfig("EFEM.EfemRobotArmType");
  671. if (armTypeConfig == null || !int.TryParse(armTypeConfig.ToString(), out int armType) || armType != 2)
  672. return Visibility.Visible;
  673. var lowerBladeConfig = QueryDataClient.Instance.Service.GetConfig("EFEM.EfemRobot.LowerBladeEnable");
  674. if (lowerBladeConfig != null && bool.TryParse(lowerBladeConfig.ToString(), out bool lowerEnabled))
  675. {
  676. return lowerEnabled ? Visibility.Visible : Visibility.Collapsed;
  677. }
  678. return Visibility.Collapsed;
  679. }
  680. catch
  681. {
  682. return Visibility.Visible;
  683. }
  684. }
  685. }
  686. public Visibility UpperArmVisibility
  687. {
  688. get
  689. {
  690. try
  691. {
  692. var armTypeConfig = QueryDataClient.Instance.Service.GetConfig("EFEM.EfemRobotArmType");
  693. if (armTypeConfig == null || !int.TryParse(armTypeConfig.ToString(), out int armType) || armType != 2)
  694. return Visibility.Visible;
  695. var upperBladeConfig = QueryDataClient.Instance.Service.GetConfig("EFEM.EfemRobot.UpperBladeEnable");
  696. if (upperBladeConfig != null && bool.TryParse(upperBladeConfig.ToString(), out bool upperEnabled))
  697. {
  698. return upperEnabled ? Visibility.Visible : Visibility.Collapsed;
  699. }
  700. return Visibility.Collapsed;
  701. }
  702. catch
  703. {
  704. return Visibility.Visible;
  705. }
  706. }
  707. }
  708. public EFEMViewModel()
  709. {
  710. this.DisplayName = "EFEM";
  711. _pickModules = new List<string>() { "LP1", "LP2", "Aligner1", "Aligner2", "Cooling1", "Cooling2", "Buffer" };
  712. _mapModules = new List<string>() { "LP1", "LP2", "Buffer" };
  713. _extendModules = new List<string>() { "PMA", "PMB" };
  714. var installModules = (string)QueryDataClient.Instance.Service.GetConfig($"System.InstalledModules");
  715. if(!string.IsNullOrWhiteSpace(installModules))
  716. {
  717. var delMods = _pickModules.Where(p=> !installModules.Contains(p)).ToList();
  718. if(delMods != null && delMods.Count() > 0)
  719. {
  720. delMods.ForEach(p => {
  721. if (_pickModules.Contains(p)) _pickModules.Remove(p);
  722. if (_mapModules.Contains(p)) _mapModules.Remove(p);
  723. if (_extendModules.Contains(p)) _extendModules.Remove(p);
  724. });
  725. }
  726. }
  727. var lowerBladeEnable = (bool)QueryDataClient.Instance.Service.GetConfig($"EFEM.EfemRobot.LowerBladeEnable");
  728. var upperBladeEnable = (bool)QueryDataClient.Instance.Service.GetConfig($"EFEM.EfemRobot.UpperBladeEnable");
  729. if (!lowerBladeEnable) _blades.Remove("Blade1");
  730. if (!upperBladeEnable) _blades.Remove("Blade2");
  731. _RobotSpeeds = new List<string>() { "Full", "High", "Medium", "Low", "Home", "Jog" };
  732. _HomeModules = new List<string>() { "EFEM", "AllAxes", "EE1", "EE2", "Theta", "X", "Z" };
  733. PickSelectedModule = _pickModules[0];
  734. PlaceSelectedModule = _pickModules[0];
  735. ExtendSelectedModule = _extendModules[0];
  736. RetractSelectedModule = _extendModules[0];
  737. MapSelectedModule = _mapModules[0];
  738. SelectedSpeed = "Medium";
  739. SelectedHomeModule = "EFEM";
  740. PickSelectedBlade = PlaceSelectedBlade = ExtendSelectedBlade = GripSelectedBlade = UngripSelectedBlade = _blades[0];
  741. }
  742. protected override void OnActivate()
  743. {
  744. SmallPinWaferSize = MapWaferSize((int)QueryDataClient.Instance.Service.GetConfig($"System.SmallWafer"));
  745. MediumPinWaferSize = MapWaferSize((int)QueryDataClient.Instance.Service.GetConfig($"System.MidWafer"));
  746. BigPinWaferSize = MapWaferSize((int)QueryDataClient.Instance.Service.GetConfig($"System.BigWafer"));
  747. NotifyOfPropertyChange(nameof(SmallPinWaferSize));
  748. NotifyOfPropertyChange(nameof(MediumPinWaferSize));
  749. NotifyOfPropertyChange(nameof(BigPinWaferSize));
  750. base.OnActivate();
  751. }
  752. private Aitex.Core.Common.WaferSize MapWaferSize(int value)
  753. {
  754. switch (value)
  755. {
  756. case 3: return Aitex.Core.Common.WaferSize.WS3;
  757. case 4: return Aitex.Core.Common.WaferSize.WS4;
  758. case 6: return Aitex.Core.Common.WaferSize.WS6;
  759. case 8: return Aitex.Core.Common.WaferSize.WS8;
  760. }
  761. return Aitex.Core.Common.WaferSize.WS0;
  762. }
  763. private List<int> GetSlotsByModule(string module)
  764. {
  765. List<int> slots = new List<int>();
  766. int num = 0;
  767. switch (module)
  768. {
  769. case "LP1":
  770. case "LP2":
  771. num = (int)QueryDataClient.Instance.Service.GetConfig($"EFEM.LoadPort.SlotNumber");
  772. break;
  773. case "Buffer":
  774. num = (int)QueryDataClient.Instance.Service.GetConfig($"EFEM.Buffer.SlotNumber");
  775. break;
  776. case "Aligner1":
  777. case "Aligner2":
  778. case "Cooling1":
  779. case "Cooling2":
  780. case "PMA":
  781. case "PMB":
  782. num = 1;
  783. break;
  784. }
  785. int j = 0;
  786. while (j < num)
  787. {
  788. slots.Add(j + 1);
  789. j++;
  790. }
  791. return slots;
  792. }
  793. protected override void OnInitialize()
  794. {
  795. MenuPermission = ClientApp.Instance.GetPermission("EFEM");
  796. base.OnInitialize();
  797. base.InitModules();
  798. }
  799. #region Operation
  800. public void SetWaferSize(string module, string size)
  801. {
  802. if (MenuPermission != 3) return;
  803. InvokeClient.Instance.Service.DoOperation("System.SetWaferSize", module, size);
  804. }
  805. public void HomeAligner(string module)
  806. {
  807. if (MenuPermission != 3) return;
  808. InvokeClient.Instance.Service.DoOperation($"{module}.{EfemOperation.Home}");
  809. }
  810. public void AlignAligner(string module)
  811. {
  812. if (MenuPermission != 3) return;
  813. string size = Aligner1WaferSize;
  814. if (module == ModuleName.Aligner2.ToString())
  815. size = Aligner2WaferSize;
  816. if (module == ModuleName.Cooling1.ToString())
  817. size = Cooling1WaferSize;
  818. if (module == ModuleName.Cooling2.ToString())
  819. size = Cooling2WaferSize;
  820. InvokeClient.Instance.Service.DoOperation($"{module}.{EfemOperation.Align}", module, size);
  821. }
  822. public void LiftAligner(string module)
  823. {
  824. if (MenuPermission != 3) return;
  825. InvokeClient.Instance.Service.DoOperation($"{module}.{EfemOperation.Lift}");
  826. }
  827. public void HomeEfem(string mod)
  828. {
  829. if (MenuPermission != 3) return;
  830. InvokeClient.Instance.Service.DoOperation($"{mod}.{EfemOperation.Home}");
  831. }
  832. public void ResetEfem()
  833. {
  834. if (MenuPermission != 3) return;
  835. InvokeClient.Instance.Service.DoOperation($"{ModuleName.EFEM}.Reset");
  836. }
  837. public void ClearError()
  838. {
  839. if (MenuPermission != 3) return;
  840. InvokeClient.Instance.Service.DoOperation($"{ModuleName.EFEM}.{EfemOperation.ClearError}");
  841. }
  842. public void HomeRobot()
  843. {
  844. if (MenuPermission != 3) return;
  845. InvokeClient.Instance.Service.DoOperation($"{ModuleName.EfemRobot}.{EfemOperation.Home}");
  846. }
  847. public void AbortRobot()
  848. {
  849. if (MenuPermission != 3) return;
  850. InvokeClient.Instance.Service.DoOperation($"{ModuleName.EfemRobot}.{EfemOperation.Abort}");
  851. }
  852. public void RobotPick()
  853. {
  854. if (MenuPermission != 3) return;
  855. string ws = PickSelectedModule == ModuleName.LP1.ToString() ? LP1WaferSize :
  856. PickSelectedModule == ModuleName.LP2.ToString() ? LP2WaferSize :
  857. PickSelectedModule == ModuleName.Aligner1.ToString() ? Aligner1WaferSize :
  858. PickSelectedModule == ModuleName.Aligner2.ToString() ? Aligner2WaferSize :
  859. PickSelectedModule == ModuleName.Cooling2.ToString() ? Cooling2WaferSize :
  860. PickSelectedModule == ModuleName.Cooling1.ToString() ? Cooling1WaferSize : throw new ArgumentOutOfRangeException();
  861. InvokeClient.Instance.Service.DoOperation($"{ModuleName.EfemRobot}.{EfemOperation.Pick}",
  862. PickSelectedModule, PickSelectedSlot - 1, ws, PickSelectedBlade);
  863. }
  864. public void RobotPlace()
  865. {
  866. if (MenuPermission != 3) return;
  867. string ws = PlaceSelectedModule == ModuleName.LP1.ToString() ? LP1WaferSize :
  868. PlaceSelectedModule == ModuleName.LP2.ToString() ? LP2WaferSize :
  869. PlaceSelectedModule == ModuleName.Aligner1.ToString() ? Aligner1WaferSize :
  870. PlaceSelectedModule == ModuleName.Aligner2.ToString() ? Aligner2WaferSize :
  871. PlaceSelectedModule == ModuleName.Cooling1.ToString() ? Cooling1WaferSize :
  872. PlaceSelectedModule == ModuleName.Cooling2.ToString() ? Cooling2WaferSize : throw new ArgumentOutOfRangeException();
  873. InvokeClient.Instance.Service.DoOperation($"{ModuleName.EfemRobot}.{EfemOperation.Place}",
  874. PlaceSelectedModule, PlaceSelectedSlot - 1, ws, PlaceSelectedBlade);
  875. }
  876. public void RobotExtend()
  877. {
  878. if (MenuPermission != 3) return;
  879. InvokeClient.Instance.Service.DoOperation($"{ModuleName.EfemRobot}.{EfemOperation.Extend}", ExtendSelectedModule, ExtendParam[ExtendSelectedSlot], ExtendSelectedBlade);
  880. }
  881. public void RobotRetract()
  882. {
  883. if (MenuPermission != 3) return;
  884. InvokeClient.Instance.Service.DoOperation($"{ModuleName.EfemRobot}.{EfemOperation.Retract}", RetractSelectedModule, RetractSlots[RetractSelectedSlot]);
  885. }
  886. public void RobotMap()
  887. {
  888. if (MenuPermission != 3) return;
  889. InvokeClient.Instance.Service.DoOperation($"{MapSelectedModule}.{EfemOperation.Map}");
  890. }
  891. public void RobotGrip()
  892. {
  893. if (MenuPermission != 3) return;
  894. InvokeClient.Instance.Service.DoOperation($"{ModuleName.EfemRobot}.{EfemOperation.Grip}", "ON", GripSelectedBlade);
  895. }
  896. public void RobotUngrip()
  897. {
  898. if (MenuPermission != 3) return;
  899. InvokeClient.Instance.Service.DoOperation($"{ModuleName.EfemRobot}.{EfemOperation.Grip}", "OFF", UngripSelectedBlade);
  900. }
  901. public void RobotFlip()
  902. {
  903. if (MenuPermission != 3) return;
  904. InvokeClient.Instance.Service.DoOperation($"{ModuleName.EfemRobot}.{EfemOperation.Flip}", FlipSelectedBlade);
  905. }
  906. public void RobotEmsStop()
  907. {
  908. if (MenuPermission != 3) return;
  909. InvokeClient.Instance.Service.DoOperation($"{ModuleName.EfemRobot}.{EfemOperation.EmsStop}");
  910. }
  911. public void SetRobotSpeed()
  912. {
  913. if (MenuPermission != 3) return;
  914. InvokeClient.Instance.Service.DoOperation($"{ModuleName.EfemRobot}.{EfemOperation.SetRobotSpeed}", SelectedSpeed);
  915. }
  916. #endregion Operation
  917. #region LP
  918. public void Home(string module)
  919. {
  920. InvokeClient.Instance.Service.DoOperation($"{module}.Home");
  921. }
  922. public void Abort(string module)
  923. {
  924. InvokeClient.Instance.Service.DoOperation($"{module}.Abort");
  925. }
  926. public void Reset(string module)
  927. {
  928. InvokeClient.Instance.Service.DoOperation($"{module}.Reset");
  929. }
  930. public void ReadCarrierID(string moduleID)
  931. {
  932. //LoadPortProvider.Instance.ReadCarrierID(moduleID);
  933. InvokeClient.Instance.Service.DoOperation($"{moduleID}.ReadCarrierId");
  934. }
  935. public void Load(string moduleID)
  936. {
  937. //LoadPortProvider.Instance.LoadLP(moduleID);
  938. InvokeClient.Instance.Service.DoOperation($"{moduleID}.Load");
  939. }
  940. public void Unload(string moduleID)
  941. {
  942. //LoadPortProvider.Instance.UnloadLP(moduleID);
  943. InvokeClient.Instance.Service.DoOperation($"{moduleID}.Unload");
  944. }
  945. public void Clamp(string moduleID)
  946. {
  947. InvokeClient.Instance.Service.DoOperation($"{moduleID}.Clamp");
  948. ///LoadPortProvider.Instance.Clamp(moduleID);
  949. }
  950. public void Unclamp(string moduleID)
  951. {
  952. //LoadPortProvider.Instance.Unclamp(moduleID);
  953. InvokeClient.Instance.Service.DoOperation($"{moduleID}.Unclamp");
  954. }
  955. public void Dock(string moduleID)
  956. {
  957. //LoadPortProvider.Instance.Dock(moduleID);
  958. InvokeClient.Instance.Service.DoOperation($"{moduleID}.Dock");
  959. }
  960. public void Undock(string moduleID)
  961. {
  962. //LoadPortProvider.Instance.Undock(moduleID);
  963. InvokeClient.Instance.Service.DoOperation($"{moduleID}.Undock");
  964. }
  965. public void OpenDoor(string moduleID)
  966. {
  967. //LoadPortProvider.Instance.OpenDoor(moduleID);
  968. InvokeClient.Instance.Service.DoOperation($"{moduleID}.OpenDoor");
  969. }
  970. public void CloseDoor(string moduleID)
  971. {
  972. //LoadPortProvider.Instance.CloseDoor(moduleID);
  973. InvokeClient.Instance.Service.DoOperation($"{moduleID}.CloseDoor");
  974. }
  975. public void Map(string moduleID)
  976. {
  977. //LoadPortProvider.Instance.Map(moduleID);
  978. InvokeClient.Instance.Service.DoOperation($"{ModuleName.EFEM}.Map", moduleID);
  979. }
  980. #endregion
  981. }
  982. }