OverViewModel.cs 39 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354
  1. using Aitex.Core.Common.DeviceData;
  2. using Aitex.Core.Util;
  3. using Aitex.Sorter.Common;
  4. using Bolt.Toolkit.Wpf.Data;
  5. using Bolt.Toolkit.Wpf.Data.Enum;
  6. using Caliburn.Micro;
  7. using MECF.Framework.Common.DataCenter;
  8. using MECF.Framework.Common.OperationCenter;
  9. using MECF.Framework.Common.RecipeCenter;
  10. using OpenSEMI.ClientBase;
  11. using System;
  12. using System.Collections.Generic;
  13. using System.Collections.ObjectModel;
  14. using System.Windows;
  15. using VirgoCommon;
  16. using VirgoUI.Client.Dialog;
  17. using VirgoUI.Client.Models.Operate.WaferAssociation;
  18. using VirgoUI.Client.Models.Platform.LoadPort;
  19. using VirgoUI.Client.Models.Recipe;
  20. using VirgoUI.Client.Models.Sys;
  21. namespace VirgoUI.Client.Models.Operate
  22. {
  23. public enum EfemType
  24. {
  25. FutureEfem = 1,
  26. JetEfem = 2,
  27. }
  28. public class OverViewModel : UiViewModelBase
  29. {
  30. #region Property
  31. //private int MenuPermission;
  32. #region PM
  33. public string PMABackground
  34. {
  35. get
  36. {
  37. if (!PMAIsOnline)
  38. return "Red";
  39. if (PMAServiceStatus == PMState.Error.ToString())
  40. return "Red";
  41. if (PMAServiceStatus == PMState.Idle.ToString()
  42. || PMAServiceStatus == PMState.Init.ToString())
  43. {
  44. return "Transparent";
  45. }
  46. return "Green";
  47. }
  48. }
  49. public string PMBBackground
  50. {
  51. get
  52. {
  53. if (!PMBIsOnline)
  54. return "Red";
  55. if (PMBServiceStatus == PMState.Error.ToString())
  56. return "Red";
  57. if (PMBServiceStatus == PMState.Idle.ToString()
  58. || PMBServiceStatus == PMState.Init.ToString())
  59. {
  60. return "Transparent";
  61. }
  62. return "Green";
  63. }
  64. }
  65. #endregion
  66. #region EFEM
  67. private WaferAssociationInfo _lp1WaferAssociation;
  68. public WaferAssociationInfo LP1WaferAssociation
  69. {
  70. get { return _lp1WaferAssociation; }
  71. set { _lp1WaferAssociation = value; }
  72. }
  73. private WaferAssociationInfo _lp2WaferAssociation;
  74. public WaferAssociationInfo LP2WaferAssociation
  75. {
  76. get { return _lp2WaferAssociation; }
  77. set { _lp2WaferAssociation = value; }
  78. }
  79. public string LP1ProcStatus
  80. {
  81. get
  82. {
  83. if (LP1WaferAssociation.JobStatus == "")
  84. {
  85. return "Idle";
  86. }
  87. return LP1WaferAssociation.JobStatus;
  88. }
  89. }
  90. public string LP2ProcStatus
  91. {
  92. get
  93. {
  94. if (LP2WaferAssociation.JobStatus == "")
  95. {
  96. return "Idle";
  97. }
  98. return LP2WaferAssociation.JobStatus;
  99. }
  100. }
  101. private string[] _LP1StatusColor = new string[2];
  102. public string[] LP1StatusColor
  103. {
  104. get
  105. {
  106. switch (LP1ProcStatus)
  107. {
  108. case "Idle":
  109. _LP1StatusColor[0] = "Gold";
  110. _LP1StatusColor[1] = "Black";
  111. break;
  112. case "WaitingForStart":
  113. _LP1StatusColor[0] = "Blue";
  114. _LP1StatusColor[1] = "White";
  115. break;
  116. case "Executing":
  117. _LP1StatusColor[0] = "Cyan";
  118. _LP1StatusColor[1] = "Black";
  119. break;
  120. case "Paused":
  121. _LP1StatusColor[0] = "Blue";
  122. _LP1StatusColor[1] = "White";
  123. break;
  124. default:
  125. _LP1StatusColor[0] = "Gold";
  126. _LP1StatusColor[1] = "Black";
  127. break;
  128. }
  129. return _LP1StatusColor;
  130. }
  131. }
  132. private string[] _LP2StatusColor = new string[2];
  133. public string[] LP2StatusColor
  134. {
  135. get
  136. {
  137. switch (LP2ProcStatus)
  138. {
  139. case "Idle":
  140. _LP2StatusColor[0] = "Gold";
  141. _LP2StatusColor[1] = "Black";
  142. break;
  143. case "WaitingForStart":
  144. _LP2StatusColor[0] = "Blue";
  145. _LP2StatusColor[1] = "White";
  146. break;
  147. case "Executing":
  148. _LP2StatusColor[0] = "Cyan";
  149. _LP2StatusColor[1] = "Black";
  150. break;
  151. case "Paused":
  152. _LP2StatusColor[0] = "Blue";
  153. _LP2StatusColor[1] = "White";
  154. break;
  155. default:
  156. _LP2StatusColor[0] = "Gold";
  157. _LP2StatusColor[1] = "Black";
  158. break;
  159. }
  160. return _LP2StatusColor;
  161. }
  162. }
  163. [Subscription("LP1.CassetteState")]
  164. public LoadportCassetteState LP1CassetteState { get; set; }
  165. [Subscription("LP1.FoupDoorState")]
  166. public FoupDoorState LP1DoorState { get; set; }
  167. [Subscription("LP2.CassetteState")]
  168. public LoadportCassetteState LP2CassetteState { get; set; }
  169. [Subscription("LP2.FoupDoorState")]
  170. public FoupDoorState LP2DoorState { get; set; }
  171. [Subscription("LP1.IsLoaded")]
  172. public bool IsLoadedLP1 { get; set; }
  173. [Subscription("LP2.IsLoaded")]
  174. public bool IsLoadedLP2 { get; set; }
  175. private R_TRIG _lp1JobFinished = new R_TRIG();
  176. private R_TRIG _lp2JobFinished = new R_TRIG();
  177. [Subscription("EfemRobot.RobotMoveAction")]
  178. public string EfemRobotMoveAction
  179. {
  180. get;
  181. set;
  182. }
  183. public bool Foup1Present
  184. {
  185. get { return LP1CassetteState == LoadportCassetteState.Normal; }
  186. }
  187. public bool Foup1Idle
  188. {
  189. get { return LP1CassetteState == LoadportCassetteState.Normal && !Foup1Busy && !Foup1Complete; }
  190. }
  191. public bool Foup1Complete
  192. {
  193. get { return LP1JobDone && Foup1Present; }
  194. }
  195. public bool Foup1Busy
  196. {
  197. get { return LP1JobStatus == "WaitingForStart" || LP1JobStatus == "Executing" || LP1JobStatus == "Paused" ; }
  198. }
  199. public bool Foup1Error
  200. {
  201. get { return LP1WaferProtrude==1; }
  202. }
  203. public bool Foup2Present
  204. {
  205. get { return LP2CassetteState == LoadportCassetteState.Normal; }
  206. }
  207. public bool Foup2Idle
  208. {
  209. get { return LP2CassetteState == LoadportCassetteState.Normal && !Foup2Busy && !Foup2Complete; }
  210. }
  211. public bool Foup2Complete
  212. {
  213. get { return LP2JobDone && Foup2Present; }
  214. }
  215. public bool Foup2Busy
  216. {
  217. get { return LP2JobStatus == "WaitingForStart" || LP2JobStatus == "Executing" || LP2JobStatus == "Paused"; }
  218. }
  219. public bool Foup2Error
  220. {
  221. get { return LP2WaferProtrude == 1; }
  222. }
  223. public RobotMoveInfo EfemRobotMoveInfo
  224. {
  225. get
  226. {
  227. RobotMoveInfo _moveInfo = new RobotMoveInfo() { BladeTarget = "System" };
  228. if (!string.IsNullOrEmpty(EfemRobotMoveAction))
  229. {
  230. var action = EfemRobotMoveAction.Split('.');
  231. _moveInfo.BladeTarget = action[0];
  232. _moveInfo.Action = (RobotAction)Enum.Parse(typeof(RobotAction), action[1]);
  233. }
  234. return _moveInfo;
  235. }
  236. }
  237. [Subscription("LP1.JobDone")]
  238. public bool LP1JobDone { get; set; }
  239. [Subscription("LP1.IsWaferProtrude")]
  240. public int LP1WaferProtrude { get; set; }
  241. [Subscription("LP2.JobDone")]
  242. public bool LP2JobDone { get; set; }
  243. [Subscription("LP2.IsWaferProtrude")]
  244. public int LP2WaferProtrude { get; set; }
  245. [Subscription("LP1.WaferSize")]
  246. public string LP1WaferSize { get; set; }
  247. public string WaferSizeLP1
  248. {
  249. get { return LP1CassetteState == LoadportCassetteState.Normal ? GetWaferSize(LP1WaferSize) : "--"; }
  250. }
  251. [Subscription("LP2.WaferSize")]
  252. public string LP2WaferSize { get; set; }
  253. public string WaferSizeLP2
  254. {
  255. get { return LP2CassetteState == LoadportCassetteState.Normal ? GetWaferSize(LP2WaferSize) : "--"; }
  256. }
  257. [Subscription("Aligner1.WaferSize")]
  258. public string Aligner1WaferSize { get; set; }
  259. public string WaferSizeAligner1
  260. {
  261. get { return GetWaferSize(Aligner1WaferSize); }
  262. }
  263. [Subscription("Aligner2.WaferSize")]
  264. public string Aligner2WaferSize { get; set; }
  265. public string WaferSizeAligner2
  266. {
  267. get { return GetWaferSize(Aligner2WaferSize); }
  268. }
  269. [Subscription("Cooling1.WaferSize")]
  270. public string Cooling1WaferSize { get; set; }
  271. public string WaferSizeCooling1
  272. {
  273. get { return GetWaferSize(Cooling1WaferSize); }
  274. }
  275. [Subscription("Cooling2.WaferSize")]
  276. public string Cooling2WaferSize { get; set; }
  277. public string WaferSizeCooling2
  278. {
  279. get { return GetWaferSize(Cooling2WaferSize); }
  280. }
  281. [Subscription("EfemRobot.WaferSize")]
  282. public string EfemRobotWaferSize { get; set; }
  283. public string WaferSizeEfemRobot
  284. {
  285. get { return GetWaferSize(EfemRobotWaferSize); }
  286. }
  287. [Subscription("PMA.WaferSize")]
  288. public string PMAWaferSize { get; set; }
  289. public string WaferSizePMA
  290. {
  291. get { return GetWaferSize(PMAWaferSize); }
  292. }
  293. [Subscription("PMB.WaferSize")]
  294. public string PMBWaferSize { get; set; }
  295. public string WaferSizePMB
  296. {
  297. get { return GetWaferSize(PMBWaferSize); }
  298. }
  299. [Subscription("PMA.IsAutoMode")]
  300. public bool PMAIsAutoMode { get; set; }
  301. [Subscription("PMB.IsAutoMode")]
  302. public bool PMBIsAutoMode { get; set; }
  303. [Subscription("PMA.IsOnline")]
  304. public bool PMAIsOnline { get; set; }
  305. [Subscription("PMB.IsOnline")]
  306. public bool PMBIsOnline { get; set; }
  307. public string PMAState
  308. {
  309. get
  310. {
  311. return "PMA/" + (PMAIsAutoMode ? "Auto/" : "Manual/") + (PMAIsOnline ? "Online" : "Offline");
  312. }
  313. }
  314. public string PMBState
  315. {
  316. get
  317. {
  318. return "PMB/" + (PMBIsAutoMode ? "Auto/" : "Manual/") + (PMBIsOnline ? "Online" : "Offline");
  319. }
  320. }
  321. [Subscription("EFEM.SmallWafer")]
  322. public int SmallWafer { get; set; }
  323. [Subscription("EFEM.MidWafer")]
  324. public int MidWafer { get; set; }
  325. [Subscription("EFEM.BigWafer")]
  326. public int BigWafer { get; set; }
  327. //[Subscription("EFEM.CassetteDoor")]
  328. //public AITSensorData CassetteDoorStatus
  329. //{
  330. // get;
  331. // set;
  332. //}
  333. [Subscription("EFEM.CassetteDoor")]
  334. public LidState CassetteDoorStatus
  335. {
  336. get;
  337. set;
  338. }
  339. public Visibility CassetteDoorIsOpened
  340. {
  341. get
  342. {
  343. return CassetteDoorStatus == LidState.Open ? Visibility.Visible : Visibility.Hidden;
  344. }
  345. }
  346. public Visibility CassetteDoorVisibility
  347. {
  348. get
  349. {
  350. return _efemType == EfemType.FutureEfem ? Visibility.Visible : Visibility.Collapsed;
  351. }
  352. }
  353. public Visibility SmartTagVisibility
  354. {
  355. get
  356. {
  357. return _efemType == EfemType.FutureEfem ? Visibility.Collapsed : Visibility.Visible;
  358. }
  359. }
  360. public Dictionary<string, string> _waferSizeMap = new Dictionary<string, string>()
  361. {
  362. {"WS3", "3'"},{"WS4", "4'"},{"WS6", "6'"}
  363. };
  364. private string GetWaferSize(string size)
  365. {
  366. if (_efemType == EfemType.JetEfem)
  367. return "";
  368. if (size != null && _waferSizeMap.ContainsKey(size))
  369. switch (size)
  370. {
  371. case "WS3": return SmallWafer.ToString();
  372. case "WS4": return MidWafer.ToString();
  373. case "WS6": return BigWafer.ToString();
  374. default: return "";
  375. }
  376. //return _waferSizeMap[size];
  377. return "";
  378. }
  379. public DoorState Chamber1DoorState
  380. {
  381. get { return DoorState.Unknown; }
  382. }
  383. public DoorState Chamber2DoorState
  384. {
  385. get { return DoorState.Unknown; }
  386. }
  387. public bool EnableAuto
  388. {
  389. get { return !IsAutoMode; }
  390. }
  391. public bool EnableManual
  392. {
  393. get { return IsAutoMode; }
  394. }
  395. public bool IsRtInitialized
  396. {
  397. get { return false; }
  398. }
  399. public bool EnableMapLP1
  400. {
  401. get
  402. {
  403. return Foup1Present && CassetteDoorStatus == LidState.Close;
  404. }
  405. }
  406. public bool EnableMapLP2
  407. {
  408. get
  409. {
  410. return Foup2Present && CassetteDoorStatus == LidState.Close;
  411. }
  412. }
  413. public bool EnableJobLP1
  414. {
  415. get { return IsAutoMode; }
  416. }
  417. public bool EnableJobLP2
  418. {
  419. get { return IsAutoMode; }
  420. }
  421. private EfemType _efemType = EfemType.FutureEfem;
  422. private bool _enableThickness = true;
  423. public Visibility LoadUnloadVisibility
  424. {
  425. get { return _efemType == EfemType.JetEfem ? Visibility.Visible : Visibility.Collapsed; }
  426. }
  427. public Visibility MapVisibility
  428. {
  429. get { return _efemType == EfemType.FutureEfem ? Visibility.Visible : Visibility.Collapsed; }
  430. }
  431. public bool EnableLoadLP1
  432. {
  433. get
  434. {
  435. return Foup1Present && string.IsNullOrEmpty(LP1JobStatus) && !IsLoadedLP1;
  436. }
  437. }
  438. public bool EnableLoadLP2
  439. {
  440. get
  441. {
  442. return Foup2Present && string.IsNullOrEmpty(LP2JobStatus) && !IsLoadedLP2;
  443. }
  444. }
  445. public bool EnableUnloadLP1
  446. {
  447. get
  448. {
  449. return Foup1Present && (string.IsNullOrEmpty(LP1JobStatus) || LP1JobStatus == "Completed") && IsLoadedLP1;
  450. }
  451. }
  452. public bool EnableUnloadLP2
  453. {
  454. get
  455. {
  456. return Foup2Present && (string.IsNullOrEmpty(LP2JobStatus) || LP2JobStatus == "Completed") && IsLoadedLP2;
  457. }
  458. }
  459. public Visibility WaferSizeVisibility
  460. {
  461. get { return _efemType == EfemType.FutureEfem ? Visibility.Visible : Visibility.Collapsed; }
  462. }
  463. public Visibility ThicknessVisibility
  464. {
  465. get { return (_efemType == EfemType.JetEfem && _enableThickness) ? Visibility.Visible : Visibility.Collapsed; }
  466. }
  467. [Subscription("LP1.WaferThicknessType")]
  468. public string ThicknessLP1 { get; set; }
  469. public string WaferThicknessLP1
  470. {
  471. get
  472. {
  473. if (ThicknessLP1 == "Thin")
  474. return "薄片";
  475. if (ThicknessLP1 == "Thick")
  476. return "厚片";
  477. return "--";
  478. }
  479. }
  480. public bool EnableThinLP1
  481. {
  482. get
  483. {
  484. return ThicknessLP1 != "Thin" && Foup1Present;
  485. }
  486. }
  487. public bool EnableThickLP1
  488. {
  489. get
  490. {
  491. return ThicknessLP1 != "Thick" && Foup1Present;
  492. }
  493. }
  494. [Subscription("LP1.SmartTag")]
  495. public string _SmartTagLP1 { get; set; }
  496. public string SmartTagLP1
  497. {
  498. get
  499. {
  500. return FormattedSmartTag(_SmartTagLP1);
  501. }
  502. }
  503. private string FormattedSmartTag(string tag)
  504. {
  505. if (string.IsNullOrEmpty(tag))
  506. return "";
  507. //LOT :A135380.1QTY :25STG :PA_PHMODE:BCLN :2009-10-19QTY :
  508. var items = tag.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
  509. string result = "";
  510. foreach (var item in items)
  511. {
  512. result += item.Trim() + "\r\n";
  513. }
  514. return result;
  515. }
  516. [Subscription("LP2.SmartTag")]
  517. public string _SmartTagLP2 { get; set; }
  518. public string SmartTagLP2
  519. {
  520. get
  521. {
  522. return FormattedSmartTag(_SmartTagLP2);
  523. }
  524. }
  525. [Subscription("LP2.WaferThicknessType")]
  526. public string ThicknessLP2 { get; set; }
  527. public string WaferThicknessLP2
  528. {
  529. get
  530. {
  531. if (ThicknessLP2 == "Thin")
  532. return "薄片";
  533. if (ThicknessLP2 == "Thick")
  534. return "厚片";
  535. return "--";
  536. }
  537. }
  538. public bool EnableThinLP2
  539. {
  540. get
  541. {
  542. return ThicknessLP2 != "Thin" && Foup2Present;
  543. }
  544. }
  545. public bool EnableThickLP2
  546. {
  547. get
  548. {
  549. return ThicknessLP2 != "Thick" && Foup2Present;
  550. }
  551. }
  552. #region Mainframe
  553. public bool ButtonControl { get; set; }
  554. [Subscription("Aligner.Status")]
  555. public string AlignerStatus { get; set; }
  556. [Subscription("EFEM.Status")]
  557. public string EFEMStatus { get; set; }
  558. [Subscription("LP1.Status")]
  559. public string LP1Status { get; set; }
  560. [Subscription("LP2.Status")]
  561. public string LP2Status { get; set; }
  562. #endregion Mainframe
  563. #region PM
  564. public string PMALabel
  565. {
  566. get;
  567. set;
  568. }
  569. public string PMBLabel
  570. {
  571. get;
  572. set;
  573. }
  574. [Subscription("PMA.FsmState")]
  575. public string PMAServiceStatus { get; set; }
  576. [Subscription("PMA.RecipeName")]
  577. public string PMARecipeName { get; set; }
  578. [Subscription("PMA.RecipeProcessTime")]
  579. public string PMARemainTime { get; set; }
  580. [Subscription("PMA.StepNo")]
  581. public int PMAStepNo { get; set; }
  582. [Subscription("PMA.RecipeStepName")]
  583. public string PMAStepName { get; set; }
  584. [Subscription("PMA.ChamberPressure")]
  585. public double PMAChamberPressure { get; set; }
  586. [Subscription("PMA.HeaterChamber.Temperature")]
  587. public double PMATemperature { get; set; }
  588. [Subscription("PMA.Chiller.CoolantOutletTempFeedback")]
  589. public double PMAChillerTemperature { get; set; }
  590. public bool PMASlitValveIsOpen
  591. {
  592. get { return SlitDoorDataA != null && SlitDoorDataA.OpenFeedback && !SlitDoorDataA.CloseFeedback; }
  593. }
  594. [Subscription("PMA.SlitDoor.DeviceData")]
  595. public AITCylinderData SlitDoorDataA
  596. {
  597. get;
  598. set;
  599. }
  600. [Subscription("PMB.FsmState")]
  601. public string PMBServiceStatus { get; set; }
  602. [Subscription("PMB.RecipeName")]
  603. public string PMBRecipeName { get; set; }
  604. [Subscription("PMB.RecipeProcessTime")]
  605. public string PMBRemainTime { get; set; }
  606. [Subscription("PMB.StepNo")]
  607. public string PMBStepNo { get; set; }
  608. [Subscription("PMB.RecipeStepName")]
  609. public string PMBStepName { get; set; }
  610. [Subscription("PMB.ChamberPressure")]
  611. public double PMBChamberPressure { get; set; }
  612. [Subscription("PMB.HeaterChamber.Temperature")]
  613. public double PMBTemperature { get; set; }
  614. [Subscription("PMB.Chiller.CoolantOutletTempFeedback")]
  615. public double PMBChillerTemperature { get; set; }
  616. public bool PMBSlitValveIsOpen
  617. {
  618. get { return SlitDoorDataB != null && SlitDoorDataB.OpenFeedback && !SlitDoorDataB.CloseFeedback; }
  619. }
  620. [Subscription("PMB.SlitDoor.DeviceData")]
  621. public AITCylinderData SlitDoorDataB
  622. {
  623. get;
  624. set;
  625. }
  626. public bool IsPMAChillerVisibility
  627. {
  628. get
  629. {
  630. return (bool)QueryDataClient.Instance.Service.GetConfig($"PMA.Chiller.EnableChiller");
  631. }
  632. }
  633. public bool IsPMBChillerVisibility
  634. {
  635. get
  636. {
  637. return (bool)QueryDataClient.Instance.Service.GetConfig($"PMB.Chiller.EnableChiller");
  638. }
  639. }
  640. public bool IsPMAHeaterVisibility
  641. {
  642. get
  643. {
  644. return !IsPMAChillerVisibility;
  645. }
  646. }
  647. public bool IsPMBHeaterVisibility
  648. {
  649. get
  650. {
  651. return !IsPMBChillerVisibility;
  652. }
  653. }
  654. #endregion PM
  655. #region Scheduler
  656. [Subscription("System.IsAutoMode")]
  657. public bool IsAutoMode { get; set; }
  658. public bool _isCycleMode;
  659. public bool _isATMMode;
  660. public int _efemtype;
  661. public Visibility IsCycleInfoVisibility
  662. {
  663. get { return _isCycleMode ? Visibility.Visible : Visibility.Hidden; }
  664. }
  665. public Visibility JobControlVisibility
  666. {
  667. get { return (_efemtype==1) ? Visibility.Visible : Visibility.Hidden; }
  668. }
  669. public Visibility IsATMInfoVisibility
  670. {
  671. get { return _isATMMode ? Visibility.Visible : Visibility.Hidden; }
  672. }
  673. //[Subscription("Scheduler.CycledCount")]
  674. //public int CycledCount { get; set; }
  675. //[Subscription("Scheduler.CycledWafer")]
  676. //public int CycledWafer { get; set; }
  677. [Subscription("Scheduler.LP1CycledWafer")]
  678. public int LP1CycledWafer { get; set; }
  679. [Subscription("Scheduler.LP2CycledWafer")]
  680. public int LP2CycledWafer { get; set; }
  681. [Subscription("Scheduler.LP1CycledCount")]
  682. public int LP1CycledCount { get; set; }
  683. [Subscription("Scheduler.LP2CycledCount")]
  684. public int LP2CycledCount { get; set; }
  685. [Subscription("Scheduler.LP1CycleSetPoint")]
  686. public int LP1CycleSetPoint { get; set; }
  687. [Subscription("Scheduler.LP2CycleSetPoint")]
  688. public int LP2CycleSetPoint { get; set; }
  689. public string LP1CycleCountDisplay
  690. {
  691. get { return (LP1CycleSetPoint > 0 && (LP1CycledCount > LP1CycleSetPoint)) ? $"{LP1CycledCount + 1}/{LP1CycleSetPoint}" : $"{LP1CycledCount}/{LP1CycleSetPoint}"; }
  692. }
  693. public string LP2CycleCountDisplay
  694. {
  695. get { return (LP2CycleSetPoint > 0 && (LP2CycledCount > LP2CycleSetPoint)) ? $"{LP2CycledCount + 1}/{LP2CycleSetPoint}" : $"{LP2CycledCount}/{LP2CycleSetPoint}"; }
  696. }
  697. [Subscription("LP1.CurrentRecipeList")]
  698. public List<string> LP1CurrentRecipeList { get; set; }
  699. [Subscription("LP1.LocalJobName")]
  700. public string LP1JobName { get; set; }
  701. [Subscription("LP1.LocalJobStatus")]
  702. public string LP1JobStatus { get; set; }
  703. [Subscription("LP1.JobLotName")]
  704. public string LP1JobLotName { get; set; }
  705. [Subscription("LP2.CurrentRecipeList")]
  706. public List<string> LP2CurrentRecipeList { get; set; }
  707. [Subscription("LP2.LocalJobName")]
  708. public string LP2JobName { get; set; }
  709. [Subscription("LP2.LocalJobStatus")]
  710. public string LP2JobStatus { get; set; }
  711. [Subscription("LP2.JobLotName")]
  712. public string LP2JobLotName { get; set; }
  713. public bool IsPauseAllEnable => LP1JobStatus == "Executing" || LP2JobStatus == "Executing";
  714. #endregion Scheduler
  715. #endregion EFEM
  716. #endregion Property
  717. public OverViewModel()
  718. {
  719. this.DisplayName = "OverView";
  720. }
  721. protected override void OnInitialize()
  722. {
  723. base.OnInitialize();
  724. base.InitModules();
  725. LP1WaferAssociation = new WaferAssociationInfo();
  726. LP1WaferAssociation.ModuleData = ModuleManager.ModuleInfos["LP1"];
  727. LP2WaferAssociation = new WaferAssociationInfo();
  728. LP2WaferAssociation.ModuleData = ModuleManager.ModuleInfos["LP2"];
  729. }
  730. protected override void OnActivate()
  731. {
  732. base.OnActivate();
  733. _isCycleMode = (bool)QueryDataClient.Instance.Service.GetConfig("System.IsCycleMode");
  734. _isATMMode = (bool)QueryDataClient.Instance.Service.GetConfig("System.IsATMMode");
  735. _efemtype = (int)QueryDataClient.Instance.Service.GetConfig("EFEM.EfemType");
  736. PMALabel = (string)QueryDataClient.Instance.Service.GetConfig("PMA.ChamberLabel");
  737. PMBLabel = (string)QueryDataClient.Instance.Service.GetConfig("PMB.ChamberLabel");
  738. _efemType = (int)QueryDataClient.Instance.Service.GetConfig("EFEM.EfemType") == 1 ? EfemType.FutureEfem : EfemType.JetEfem;
  739. _enableThickness = (bool)QueryDataClient.Instance.Service.GetConfig("System.WaferThickness.EnableThickness");
  740. }
  741. public void Start()
  742. {
  743. //if (MenuPermission != 3) return;
  744. InvokeClient.Instance.Service.DoOperation("System.StartAutoRun");
  745. }
  746. public void Stop()
  747. {
  748. //InvokeClient.Instance.Service.DoOperation("System.StartAutoRun");
  749. }
  750. protected override void InvokeAfterUpdateProperty(Dictionary<string, object> data)
  751. {
  752. ContextMenuManager.Instance.IsAutoMode = this.IsAutoMode;
  753. ModuleTemperature["PMA"] = (float)PMATemperature;
  754. ModuleTemperature["PMB"] = (float)PMBTemperature;
  755. LP1WaferAssociation.JobID = LP1JobName;
  756. LP1WaferAssociation.JobStatus = LP1JobStatus;
  757. LP2WaferAssociation.JobID = LP2JobName;
  758. LP2WaferAssociation.JobStatus = LP2JobStatus;
  759. LP1WaferAssociation.JobID = LP1JobName;
  760. LP1WaferAssociation.JobStatus = LP1JobStatus;
  761. if (!string.IsNullOrEmpty(LP1JobName))
  762. LP1WaferAssociation.LotId = LP1JobLotName;
  763. LP2WaferAssociation.JobID = LP2JobName;
  764. LP2WaferAssociation.JobStatus = LP2JobStatus;
  765. if (!string.IsNullOrEmpty(LP2JobName))
  766. LP2WaferAssociation.LotId = LP2JobLotName;
  767. _lp1JobFinished.CLK = string.IsNullOrEmpty(LP1JobName);
  768. if (_lp1JobFinished.Q)
  769. {
  770. var wafers = LP1WaferAssociation.ModuleData.WaferManager.Wafers;
  771. for (int i = 0; i < wafers.Count; i++)
  772. {
  773. wafers[i].SequenceName = "";
  774. }
  775. LP1WaferAssociation.LotId = "";
  776. LP1WaferAssociation.SequenceName = "";
  777. }
  778. _lp2JobFinished.CLK = string.IsNullOrEmpty(LP2JobName);
  779. if (_lp2JobFinished.Q)
  780. {
  781. var wafers = LP2WaferAssociation.ModuleData.WaferManager.Wafers;
  782. for (int i = 0; i < wafers.Count; i++)
  783. {
  784. wafers[i].SequenceName = "";
  785. }
  786. LP2WaferAssociation.LotId = "";
  787. LP2WaferAssociation.SequenceName = "";
  788. }
  789. if (!string.IsNullOrEmpty(LP1JobStatus) && LP1JobStatus == "Executing")
  790. {
  791. var wafers = LP1WaferAssociation.ModuleData.WaferManager.Wafers;
  792. for (int i = 0; i < wafers.Count; i++)
  793. {
  794. wafers[i].SequenceName = LP1CurrentRecipeList[wafers[i].SlotID];
  795. }
  796. }
  797. if (!string.IsNullOrEmpty(LP2JobStatus) && LP2JobStatus == "Executing")
  798. {
  799. var wafers = LP2WaferAssociation.ModuleData.WaferManager.Wafers;
  800. for (int i = 0; i < wafers.Count; i++)
  801. {
  802. wafers[i].SequenceName = LP2CurrentRecipeList[wafers[i].SlotID];
  803. }
  804. }
  805. if (LP1CassetteState != LoadportCassetteState.Normal)
  806. {
  807. foreach (var wafer in LP1WaferAssociation.ModuleData.WaferManager.Wafers)
  808. {
  809. wafer.SequenceName = "";
  810. }
  811. }
  812. if (LP2CassetteState != LoadportCassetteState.Normal)
  813. {
  814. foreach (var wafer in LP2WaferAssociation.ModuleData.WaferManager.Wafers)
  815. {
  816. wafer.SequenceName = "";
  817. }
  818. }
  819. FOUPA.IsJobDone = LP1JobDone;
  820. FOUPB.IsJobDone = LP2JobDone;
  821. }
  822. #region LP Operation
  823. public void SetThick(string moduleID)
  824. {
  825. //if (MenuPermission != 3) return;
  826. LoadPortProvider.Instance.SetThick(moduleID);
  827. }
  828. public void SetThin(string moduleID)
  829. {
  830. //if (MenuPermission != 3) return;
  831. LoadPortProvider.Instance.SetThin(moduleID);
  832. }
  833. public void MapLP(string moduleID)
  834. {
  835. //if (MenuPermission != 3) return;
  836. LoadPortProvider.Instance.MapLP(moduleID);
  837. }
  838. public void LoadLP(string moduleID)
  839. {
  840. //if (MenuPermission != 3) return;
  841. if (_enableThickness)
  842. {
  843. WindowManager wm = new WindowManager();
  844. ThicknessDialogViewModel dialog = new ThicknessDialogViewModel();
  845. bool? bret = wm.ShowDialogWithNoStyle(dialog);
  846. if ((bool)bret)
  847. {
  848. string thickness = dialog.DialogResult;
  849. if (thickness == "Thick")
  850. SetThick(moduleID);
  851. if (thickness == "Thin")
  852. SetThin(moduleID);
  853. }
  854. else
  855. {
  856. return;
  857. }
  858. }
  859. LoadPortProvider.Instance.LoadLP(moduleID);
  860. }
  861. public void UnloadLP(string moduleID)
  862. {
  863. //if (MenuPermission != 3) return;
  864. LoadPortProvider.Instance.UnloadLP(moduleID);
  865. }
  866. public void HomeAll()
  867. {
  868. //if (MenuPermission != 3) return;
  869. InvokeClient.Instance.Service.DoOperation("System.HomeAll");
  870. }
  871. public void ReturnAllWafer()
  872. {
  873. //if (MenuPermission != 3) return;
  874. WindowManager wm = new WindowManager();
  875. bool needCooling = false;
  876. int coolingTime = 0;
  877. WaferTransferDialogViewModel _transferVM = new WaferTransferDialogViewModel("Would the wafer need cooling?", false, true, "");
  878. bool? bret = wm.ShowDialogWithNoStyle(_transferVM);
  879. if ((bool)bret)
  880. {
  881. //get and use transfer conditions
  882. WaferTransferCondition conditions = _transferVM.DialogResult;
  883. needCooling = conditions.IsPassCooling;
  884. coolingTime = conditions.CoolingTime;
  885. }
  886. InvokeClient.Instance.Service.DoOperation("System.ReturnAllWafer", needCooling, coolingTime);
  887. }
  888. public void PauseAllJob()
  889. {
  890. if (!string.IsNullOrEmpty(LP1WaferAssociation.JobID))
  891. WaferAssociationProvider.Instance.Pause(LP1WaferAssociation.JobID);
  892. if (!string.IsNullOrEmpty(LP2WaferAssociation.JobID))
  893. WaferAssociationProvider.Instance.Pause(LP2WaferAssociation.JobID);
  894. }
  895. public void Abort()
  896. {
  897. //if (MenuPermission != 3) return;
  898. InvokeClient.Instance.Service.DoOperation("System.Abort");
  899. }
  900. public void Auto()
  901. {
  902. //if (MenuPermission != 3) return;
  903. InvokeClient.Instance.Service.DoOperation("System.SetAutoMode");
  904. }
  905. public void Manual()
  906. {
  907. //if (MenuPermission != 3) return;
  908. InvokeClient.Instance.Service.DoOperation("System.SetManualMode");
  909. }
  910. #endregion LP Operation
  911. #region Sequence operation
  912. public void SelectSequence(WaferAssociationInfo info)
  913. {
  914. //if (MenuPermission != 3) return;
  915. SequenceDialogViewModel dialog = new SequenceDialogViewModel();
  916. dialog.DisplayName = "Select Sequence";
  917. dialog.Files = new ObservableCollection<FileNode>(RecipeSequenceTreeBuilder.GetFiles(
  918. RecipeClient.Instance.Service.GetSequenceNameList()
  919. ));
  920. WindowManager wm = new WindowManager();
  921. bool? bret = wm.ShowDialog(dialog);
  922. if ((bool)bret)
  923. {
  924. info.SequenceName = dialog.DialogResult;
  925. }
  926. }
  927. public void SetSlot(WaferAssociationInfo info)
  928. {
  929. if (InputSlotCheck(info.SlotFrom, info.SlotTo))
  930. AssociateSequence(info, true);
  931. }
  932. public void SkipSlot(WaferAssociationInfo info)
  933. {
  934. if (InputSlotCheck(info.SlotFrom, info.SlotTo))
  935. AssociateSequence(info, false);
  936. }
  937. public void SetAll(WaferAssociationInfo info)
  938. {
  939. //if (MenuPermission != 3) return;
  940. info.SlotFrom = 1;
  941. info.SlotTo = 25;
  942. AssociateSequence(info, true);
  943. }
  944. public void DeselectAll(WaferAssociationInfo info)
  945. {
  946. //if (MenuPermission != 3) return;
  947. info.SlotFrom = 1;
  948. info.SlotTo = 25;
  949. AssociateSequence(info, false);
  950. }
  951. public void SetSequence(WaferAssociationInfo info, int slotIndex, string seqName)
  952. {
  953. bool flag = string.IsNullOrEmpty(seqName);
  954. AssociateSequence(info, flag, slotIndex - 1);
  955. }
  956. private bool InputSlotCheck(int from, int to)
  957. {
  958. if (from > to)
  959. {
  960. DialogBox.ShowInfo("This index of from slot should be large than the index of to slot.");
  961. return false;
  962. }
  963. if (from < 1 || to > 25)
  964. {
  965. DialogBox.ShowInfo("This input value for from should be between 1 and 25.");
  966. return false;
  967. }
  968. return true;
  969. }
  970. private void AssociateSequence(WaferAssociationInfo info, bool flag, int slot = -1)
  971. {
  972. List<WaferInfo> wafers = info.ModuleData.WaferManager.Wafers;
  973. if (slot >= 0) //by wafer
  974. {
  975. int index = wafers.Count - slot - 1;
  976. if (index < wafers.Count)
  977. {
  978. if (flag && HasWaferOnSlot(wafers, index))
  979. wafers[index].SequenceName = info.SequenceName;
  980. else
  981. wafers[index].SequenceName = string.Empty;
  982. }
  983. }
  984. else //by from-to
  985. {
  986. for (int i = info.SlotFrom - 1; i < info.SlotTo; i++)
  987. {
  988. int index = wafers.Count - i - 1;
  989. if (index < wafers.Count)
  990. {
  991. if (flag && HasWaferOnSlot(wafers, index))
  992. wafers[index].SequenceName = info.SequenceName;
  993. else
  994. wafers[index].SequenceName = string.Empty;
  995. }
  996. }
  997. }
  998. }
  999. private bool HasWaferOnSlot(List<WaferInfo> wafers, int index)
  1000. {
  1001. if (wafers[index].WaferStatus == 0)
  1002. return false;
  1003. return true;
  1004. }
  1005. public int LP1WaferCount
  1006. {
  1007. get
  1008. {
  1009. int iWaferCount = 0;
  1010. foreach (var Wafers in ModuleManager.ModuleInfos["LP1"].WaferManager.Wafers)
  1011. {
  1012. if (Wafers.WaferStatus != 0)
  1013. {
  1014. iWaferCount++;
  1015. }
  1016. }
  1017. return iWaferCount;
  1018. }
  1019. }
  1020. public string LP1WaferCountInfo
  1021. {
  1022. get
  1023. {
  1024. return $"Wafer数量:{LP1WaferCount}";
  1025. }
  1026. }
  1027. public int LP2WaferCount
  1028. {
  1029. get
  1030. {
  1031. int iWaferCount = 0;
  1032. foreach (var Wafers in ModuleManager.ModuleInfos["LP2"].WaferManager.Wafers)
  1033. {
  1034. if (Wafers.WaferStatus != 0)
  1035. {
  1036. iWaferCount++;
  1037. }
  1038. }
  1039. return iWaferCount;
  1040. }
  1041. }
  1042. public string LP2WaferCountInfo
  1043. {
  1044. get
  1045. {
  1046. return $"Wafer数量:{LP2WaferCount}";
  1047. }
  1048. }
  1049. #endregion Sequence operation
  1050. #region Job operation
  1051. private bool JobCheck(string jobID)
  1052. {
  1053. if (jobID.Length == 0)
  1054. {
  1055. DialogBox.ShowWarning("Please create job first.");
  1056. return false;
  1057. }
  1058. else
  1059. return true;
  1060. }
  1061. public void CreateJob(WaferAssociationInfo info)
  1062. {
  1063. //if (MenuPermission != 3) return;
  1064. List<string> slotSequence = new List<string>();
  1065. info.ModuleData.WaferManager.Wafers.ForEach(key => { slotSequence.Insert(0, key.SequenceName); });
  1066. string jobId = info.LotId.Trim();
  1067. if (string.IsNullOrEmpty(jobId))
  1068. jobId = "CJ_Local_" + info.ModuleData.ModuleID;
  1069. info.LotId = jobId;
  1070. info.LotIdSaved = true;
  1071. WaferAssociationProvider.Instance.CreateJob(jobId, info.ModuleData.ModuleID, slotSequence, true);
  1072. }
  1073. public void AbortJob(string jobID)
  1074. {
  1075. //if (MenuPermission != 3) return;
  1076. if (JobCheck(jobID))
  1077. WaferAssociationProvider.Instance.AbortJob(jobID);
  1078. }
  1079. public void Start(string jobID)
  1080. {
  1081. //if (MenuPermission != 3) return;
  1082. if (JobCheck(jobID))
  1083. WaferAssociationProvider.Instance.Start(jobID);
  1084. }
  1085. public void Pause(string jobID)
  1086. {
  1087. //if (MenuPermission != 3) return;
  1088. if (JobCheck(jobID))
  1089. WaferAssociationProvider.Instance.Pause(jobID);
  1090. }
  1091. public void Resume(string jobID)
  1092. {
  1093. //if (MenuPermission != 3) return;
  1094. if (JobCheck(jobID))
  1095. WaferAssociationProvider.Instance.Resume(jobID);
  1096. }
  1097. public void Stop(string jobID)
  1098. {
  1099. //if (MenuPermission != 3) return;
  1100. if (JobCheck(jobID))
  1101. WaferAssociationProvider.Instance.Stop(jobID);
  1102. }
  1103. #endregion Job operation
  1104. }
  1105. }