EFEMViewModel.cs 37 KB

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