EFEMViewModel.cs 34 KB

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