OverViewModel.cs 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149
  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 Dictionary<string, string> _waferSizeMap = new Dictionary<string, string>()
  354. {
  355. {"WS3", "3'"},{"WS4", "4'"},{"WS6", "6'"}
  356. };
  357. private string GetWaferSize(string size)
  358. {
  359. //if (_efemType == EfemType.JetEfem)
  360. // return "";
  361. if (size != null && _waferSizeMap.ContainsKey(size))
  362. switch (size)
  363. {
  364. case "WS3": return SmallWafer.ToString();
  365. case "WS4": return MidWafer.ToString();
  366. case "WS6": return BigWafer.ToString();
  367. default: return "";
  368. }
  369. //return _waferSizeMap[size];
  370. return "";
  371. }
  372. public DoorState Chamber1DoorState
  373. {
  374. get { return DoorState.Unknown; }
  375. }
  376. public DoorState Chamber2DoorState
  377. {
  378. get { return DoorState.Unknown; }
  379. }
  380. public bool EnableAuto
  381. {
  382. get { return !IsAutoMode; }
  383. }
  384. public bool EnableManual
  385. {
  386. get { return IsAutoMode; }
  387. }
  388. public bool IsRtInitialized
  389. {
  390. get { return false; }
  391. }
  392. public bool EnableMapLP1
  393. {
  394. get
  395. {
  396. return Foup1Present && CassetteDoorStatus == LidState.Close;
  397. }
  398. }
  399. public bool EnableMapLP2
  400. {
  401. get
  402. {
  403. return Foup2Present && CassetteDoorStatus == LidState.Close;
  404. }
  405. }
  406. public bool EnableJobLP1
  407. {
  408. get { return IsAutoMode; }
  409. }
  410. public bool EnableJobLP2
  411. {
  412. get { return IsAutoMode; }
  413. }
  414. #region Mainframe
  415. public bool ButtonControl { get; set; }
  416. [Subscription("Aligner.Status")]
  417. public string AlignerStatus { get; set; }
  418. [Subscription("EFEM.Status")]
  419. public string EFEMStatus { get; set; }
  420. [Subscription("LP1.Status")]
  421. public string LP1Status { get; set; }
  422. [Subscription("LP2.Status")]
  423. public string LP2Status { get; set; }
  424. #endregion Mainframe
  425. #region PM
  426. public string PMALabel
  427. {
  428. get;
  429. set;
  430. }
  431. public string PMBLabel
  432. {
  433. get;
  434. set;
  435. }
  436. [Subscription("PMA.FsmState")]
  437. public string PMAServiceStatus { get; set; }
  438. [Subscription("PMA.RecipeName")]
  439. public string PMARecipeName { get; set; }
  440. [Subscription("PMA.RecipeProcessTime")]
  441. public string PMARemainTime { get; set; }
  442. [Subscription("PMA.StepNo")]
  443. public int PMAStepNo { get; set; }
  444. [Subscription("PMA.RecipeStepName")]
  445. public string PMAStepName { get; set; }
  446. [Subscription("PMA.ChamberPressure")]
  447. public double PMAChamberPressure { get; set; }
  448. [Subscription("PMA.HeaterChamber.Temperature")]
  449. public double PMATemperature { get; set; }
  450. [Subscription("PMA.Chiller.CoolantOutletTempFeedback")]
  451. public double PMAChillerTemperature { get; set; }
  452. public bool PMASlitValveIsOpen
  453. {
  454. get { return SlitDoorDataA != null && SlitDoorDataA.OpenFeedback && !SlitDoorDataA.CloseFeedback; }
  455. }
  456. [Subscription("PMA.SlitDoor.DeviceData")]
  457. public AITCylinderData SlitDoorDataA
  458. {
  459. get;
  460. set;
  461. }
  462. [Subscription("PMB.FsmState")]
  463. public string PMBServiceStatus { get; set; }
  464. [Subscription("PMB.RecipeName")]
  465. public string PMBRecipeName { get; set; }
  466. [Subscription("PMB.RecipeProcessTime")]
  467. public string PMBRemainTime { get; set; }
  468. [Subscription("PMB.StepNo")]
  469. public string PMBStepNo { get; set; }
  470. [Subscription("PMB.RecipeStepName")]
  471. public string PMBStepName { get; set; }
  472. [Subscription("PMB.ChamberPressure")]
  473. public double PMBChamberPressure { get; set; }
  474. [Subscription("PMB.HeaterChamber.Temperature")]
  475. public double PMBTemperature { get; set; }
  476. [Subscription("PMB.Chiller.CoolantOutletTempFeedback")]
  477. public double PMBChillerTemperature { get; set; }
  478. public bool PMBSlitValveIsOpen
  479. {
  480. get { return SlitDoorDataB != null && SlitDoorDataB.OpenFeedback && !SlitDoorDataB.CloseFeedback; }
  481. }
  482. [Subscription("PMB.SlitDoor.DeviceData")]
  483. public AITCylinderData SlitDoorDataB
  484. {
  485. get;
  486. set;
  487. }
  488. public bool IsPMAChillerVisibility
  489. {
  490. get
  491. {
  492. return (bool)QueryDataClient.Instance.Service.GetConfig($"PMA.Chiller.EnableChiller");
  493. }
  494. }
  495. public bool IsPMBChillerVisibility
  496. {
  497. get
  498. {
  499. return (bool)QueryDataClient.Instance.Service.GetConfig($"PMB.Chiller.EnableChiller");
  500. }
  501. }
  502. public bool IsPMAHeaterVisibility
  503. {
  504. get
  505. {
  506. return !IsPMAChillerVisibility;
  507. }
  508. }
  509. public bool IsPMBHeaterVisibility
  510. {
  511. get
  512. {
  513. return !IsPMBChillerVisibility;
  514. }
  515. }
  516. #endregion PM
  517. #region Scheduler
  518. [Subscription("System.IsAutoMode")]
  519. public bool IsAutoMode { get; set; }
  520. public bool _isCycleMode;
  521. public bool _isATMMode;
  522. public Visibility IsCycleInfoVisibility
  523. {
  524. get { return _isCycleMode ? Visibility.Visible : Visibility.Hidden; }
  525. }
  526. public Visibility IsATMInfoVisibility
  527. {
  528. get { return _isATMMode ? Visibility.Visible : Visibility.Hidden; }
  529. }
  530. [Subscription("Scheduler.CycledCount")]
  531. public int CycledCount { get; set; }
  532. [Subscription("Scheduler.CycledWafer")]
  533. public int CycledWafer { get; set; }
  534. [Subscription("Scheduler.CycleSetPoint")]
  535. public int CycleSetPoint { get; set; }
  536. public string CycleCountDisplay
  537. {
  538. get { return (CycleSetPoint > 0 && (CycledCount > CycleSetPoint)) ? $"{CycledCount + 1}/{CycleSetPoint}" : $"{CycledCount}/{CycleSetPoint}"; }
  539. }
  540. [Subscription("LP1.CurrentRecipeList")]
  541. public List<string> LP1CurrentRecipeList { get; set; }
  542. [Subscription("LP1.LocalJobName")]
  543. public string LP1JobName { get; set; }
  544. [Subscription("LP1.LocalJobStatus")]
  545. public string LP1JobStatus { get; set; }
  546. [Subscription("LP1.JobLotName")]
  547. public string LP1JobLotName { get; set; }
  548. [Subscription("LP2.CurrentRecipeList")]
  549. public List<string> LP2CurrentRecipeList { get; set; }
  550. [Subscription("LP2.LocalJobName")]
  551. public string LP2JobName { get; set; }
  552. [Subscription("LP2.LocalJobStatus")]
  553. public string LP2JobStatus { get; set; }
  554. [Subscription("LP2.JobLotName")]
  555. public string LP2JobLotName { get; set; }
  556. public bool IsPauseAllEnable => LP1JobStatus == "Executing" || LP2JobStatus == "Executing";
  557. #endregion Scheduler
  558. #endregion EFEM
  559. #endregion Property
  560. public OverViewModel()
  561. {
  562. this.DisplayName = "OverView";
  563. }
  564. protected override void OnInitialize()
  565. {
  566. base.OnInitialize();
  567. base.InitModules();
  568. LP1WaferAssociation = new WaferAssociationInfo();
  569. LP1WaferAssociation.ModuleData = ModuleManager.ModuleInfos["LP1"];
  570. LP2WaferAssociation = new WaferAssociationInfo();
  571. LP2WaferAssociation.ModuleData = ModuleManager.ModuleInfos["LP2"];
  572. }
  573. protected override void OnActivate()
  574. {
  575. base.OnActivate();
  576. _isCycleMode = (bool)QueryDataClient.Instance.Service.GetConfig("System.IsCycleMode");
  577. _isATMMode = (bool)QueryDataClient.Instance.Service.GetConfig("System.IsATMMode");
  578. PMALabel = (string)QueryDataClient.Instance.Service.GetConfig("PMA.ChamberLabel");
  579. PMBLabel = (string)QueryDataClient.Instance.Service.GetConfig("PMB.ChamberLabel");
  580. }
  581. public void Start()
  582. {
  583. //if (MenuPermission != 3) return;
  584. InvokeClient.Instance.Service.DoOperation("System.StartAutoRun");
  585. }
  586. public void Stop()
  587. {
  588. //InvokeClient.Instance.Service.DoOperation("System.StartAutoRun");
  589. }
  590. protected override void InvokeAfterUpdateProperty(Dictionary<string, object> data)
  591. {
  592. ContextMenuManager.Instance.IsAutoMode = this.IsAutoMode;
  593. ModuleTemperature["PMA"] = (float)PMATemperature;
  594. ModuleTemperature["PMB"] = (float)PMBTemperature;
  595. LP1WaferAssociation.JobID = LP1JobName;
  596. LP1WaferAssociation.JobStatus = LP1JobStatus;
  597. if (!string.IsNullOrEmpty(LP1JobName))
  598. LP1WaferAssociation.LotId = LP1JobLotName;
  599. LP2WaferAssociation.JobID = LP2JobName;
  600. LP2WaferAssociation.JobStatus = LP2JobStatus;
  601. if (!string.IsNullOrEmpty(LP2JobName))
  602. LP2WaferAssociation.LotId = LP2JobLotName;
  603. _lp1JobFinished.CLK = string.IsNullOrEmpty(LP1JobName);
  604. if (_lp1JobFinished.Q)
  605. {
  606. var wafers = LP1WaferAssociation.ModuleData.WaferManager.Wafers;
  607. for (int i = 0; i < wafers.Count; i++)
  608. {
  609. wafers[i].SequenceName = "";
  610. }
  611. LP1WaferAssociation.LotId = "";
  612. LP1WaferAssociation.SequenceName = "";
  613. }
  614. _lp2JobFinished.CLK = string.IsNullOrEmpty(LP2JobName);
  615. if (_lp2JobFinished.Q)
  616. {
  617. var wafers = LP2WaferAssociation.ModuleData.WaferManager.Wafers;
  618. for (int i = 0; i < wafers.Count; i++)
  619. {
  620. wafers[i].SequenceName = "";
  621. }
  622. LP2WaferAssociation.LotId = "";
  623. LP2WaferAssociation.SequenceName = "";
  624. }
  625. if (!string.IsNullOrEmpty(LP1JobStatus) && LP1JobStatus == "Executing")
  626. {
  627. var wafers = LP1WaferAssociation.ModuleData.WaferManager.Wafers;
  628. for (int i = 0; i < wafers.Count; i++)
  629. {
  630. wafers[i].SequenceName = LP1CurrentRecipeList[wafers[i].SlotID];
  631. }
  632. }
  633. if (!string.IsNullOrEmpty(LP2JobStatus) && LP2JobStatus == "Executing")
  634. {
  635. var wafers = LP2WaferAssociation.ModuleData.WaferManager.Wafers;
  636. for (int i = 0; i < wafers.Count; i++)
  637. {
  638. wafers[i].SequenceName = LP2CurrentRecipeList[wafers[i].SlotID];
  639. }
  640. }
  641. if (LP1CassetteState != LoadportCassetteState.Normal)
  642. {
  643. foreach (var wafer in LP1WaferAssociation.ModuleData.WaferManager.Wafers)
  644. {
  645. wafer.SequenceName = "";
  646. }
  647. }
  648. if (LP2CassetteState != LoadportCassetteState.Normal)
  649. {
  650. foreach (var wafer in LP2WaferAssociation.ModuleData.WaferManager.Wafers)
  651. {
  652. wafer.SequenceName = "";
  653. }
  654. }
  655. FOUPA.IsJobDone = LP1JobDone;
  656. FOUPB.IsJobDone = LP2JobDone;
  657. }
  658. #region LP Operation
  659. public void SetThick(string moduleID)
  660. {
  661. //if (MenuPermission != 3) return;
  662. //LoadPortProvider.Instance.SetThick(moduleID);
  663. }
  664. public void SetThin(string moduleID)
  665. {
  666. //if (MenuPermission != 3) return;
  667. //LoadPortProvider.Instance.SetThin(moduleID);
  668. }
  669. public void MapLP(string moduleID)
  670. {
  671. //if (MenuPermission != 3) return;
  672. LoadPortProvider.Instance.MapLP(moduleID);
  673. }
  674. public void LoadLP(string moduleID)
  675. {
  676. //if (MenuPermission != 3) return;
  677. //if (_enableThickness)
  678. //{
  679. // WindowManager wm = new WindowManager();
  680. // ThicknessDialogViewModel dialog = new ThicknessDialogViewModel();
  681. // bool? bret = wm.ShowDialogWithNoStyle(dialog);
  682. // if ((bool)bret)
  683. // {
  684. // string thickness = dialog.DialogResult;
  685. // if (thickness == "Thick")
  686. // SetThick(moduleID);
  687. // if (thickness == "Thin")
  688. // SetThin(moduleID);
  689. // }
  690. // else
  691. // {
  692. // return;
  693. // }
  694. //}
  695. //LoadPortProvider.Instance.LoadLP(moduleID);
  696. }
  697. public void UnloadLP(string moduleID)
  698. {
  699. //if (MenuPermission != 3) return;
  700. //LoadPortProvider.Instance.UnloadLP(moduleID);
  701. }
  702. public void HomeAll()
  703. {
  704. //if (MenuPermission != 3) return;
  705. InvokeClient.Instance.Service.DoOperation("System.HomeAll");
  706. }
  707. public void ReturnAllWafer()
  708. {
  709. //if (MenuPermission != 3) return;
  710. WindowManager wm = new WindowManager();
  711. bool needCooling = false;
  712. int coolingTime = 0;
  713. WaferTransferDialogViewModel _transferVM = new WaferTransferDialogViewModel("Would the wafer need cooling?", false, true, "");
  714. bool? bret = wm.ShowDialogWithNoStyle(_transferVM);
  715. if ((bool)bret)
  716. {
  717. //get and use transfer conditions
  718. WaferTransferCondition conditions = _transferVM.DialogResult;
  719. needCooling = conditions.IsPassCooling;
  720. coolingTime = conditions.CoolingTime;
  721. }
  722. InvokeClient.Instance.Service.DoOperation("System.ReturnAllWafer", needCooling, coolingTime);
  723. }
  724. public void PauseAllJob()
  725. {
  726. if (!string.IsNullOrEmpty(LP1WaferAssociation.JobID))
  727. WaferAssociationProvider.Instance.Pause(LP1WaferAssociation.JobID);
  728. if (!string.IsNullOrEmpty(LP2WaferAssociation.JobID))
  729. WaferAssociationProvider.Instance.Pause(LP2WaferAssociation.JobID);
  730. }
  731. public void Abort()
  732. {
  733. //if (MenuPermission != 3) return;
  734. InvokeClient.Instance.Service.DoOperation("System.Abort");
  735. }
  736. public void Auto()
  737. {
  738. //if (MenuPermission != 3) return;
  739. InvokeClient.Instance.Service.DoOperation("System.SetAutoMode");
  740. }
  741. public void Manual()
  742. {
  743. //if (MenuPermission != 3) return;
  744. InvokeClient.Instance.Service.DoOperation("System.SetManualMode");
  745. }
  746. #endregion LP Operation
  747. #region Sequence operation
  748. public void SelectSequence(WaferAssociationInfo info)
  749. {
  750. //if (MenuPermission != 3) return;
  751. SequenceDialogViewModel dialog = new SequenceDialogViewModel();
  752. dialog.DisplayName = "Select Sequence";
  753. dialog.Files = new ObservableCollection<FileNode>(RecipeSequenceTreeBuilder.GetFiles(
  754. RecipeClient.Instance.Service.GetSequenceNameList()
  755. ));
  756. WindowManager wm = new WindowManager();
  757. bool? bret = wm.ShowDialog(dialog);
  758. if ((bool)bret)
  759. {
  760. info.SequenceName = dialog.DialogResult;
  761. }
  762. }
  763. public void SetSlot(WaferAssociationInfo info)
  764. {
  765. if (InputSlotCheck(info.SlotFrom, info.SlotTo))
  766. AssociateSequence(info, true);
  767. }
  768. public void SkipSlot(WaferAssociationInfo info)
  769. {
  770. if (InputSlotCheck(info.SlotFrom, info.SlotTo))
  771. AssociateSequence(info, false);
  772. }
  773. public void SetAll(WaferAssociationInfo info)
  774. {
  775. //if (MenuPermission != 3) return;
  776. info.SlotFrom = 1;
  777. info.SlotTo = 25;
  778. AssociateSequence(info, true);
  779. }
  780. public void DeselectAll(WaferAssociationInfo info)
  781. {
  782. //if (MenuPermission != 3) return;
  783. info.SlotFrom = 1;
  784. info.SlotTo = 25;
  785. AssociateSequence(info, false);
  786. }
  787. public void SetSequence(WaferAssociationInfo info, int slotIndex, string seqName)
  788. {
  789. bool flag = string.IsNullOrEmpty(seqName);
  790. AssociateSequence(info, flag, slotIndex - 1);
  791. }
  792. private bool InputSlotCheck(int from, int to)
  793. {
  794. if (from > to)
  795. {
  796. DialogBox.ShowInfo("This index of from slot should be large than the index of to slot.");
  797. return false;
  798. }
  799. if (from < 1 || to > 25)
  800. {
  801. DialogBox.ShowInfo("This input value for from should be between 1 and 25.");
  802. return false;
  803. }
  804. return true;
  805. }
  806. private void AssociateSequence(WaferAssociationInfo info, bool flag, int slot = -1)
  807. {
  808. List<WaferInfo> wafers = info.ModuleData.WaferManager.Wafers;
  809. if (slot >= 0) //by wafer
  810. {
  811. int index = wafers.Count - slot - 1;
  812. if (index < wafers.Count)
  813. {
  814. if (flag && HasWaferOnSlot(wafers, index))
  815. wafers[index].SequenceName = info.SequenceName;
  816. else
  817. wafers[index].SequenceName = string.Empty;
  818. }
  819. }
  820. else //by from-to
  821. {
  822. for (int i = info.SlotFrom - 1; i < info.SlotTo; i++)
  823. {
  824. int index = wafers.Count - i - 1;
  825. if (index < wafers.Count)
  826. {
  827. if (flag && HasWaferOnSlot(wafers, index))
  828. wafers[index].SequenceName = info.SequenceName;
  829. else
  830. wafers[index].SequenceName = string.Empty;
  831. }
  832. }
  833. }
  834. }
  835. private bool HasWaferOnSlot(List<WaferInfo> wafers, int index)
  836. {
  837. if (wafers[index].WaferStatus == 0)
  838. return false;
  839. return true;
  840. }
  841. public int LP1WaferCount
  842. {
  843. get
  844. {
  845. int iWaferCount = 0;
  846. foreach (var Wafers in ModuleManager.ModuleInfos["LP1"].WaferManager.Wafers)
  847. {
  848. if (Wafers.WaferStatus != 0)
  849. {
  850. iWaferCount++;
  851. }
  852. }
  853. return iWaferCount;
  854. }
  855. }
  856. public string LP1WaferCountInfo
  857. {
  858. get
  859. {
  860. return $"Wafer数量:{LP1WaferCount}";
  861. }
  862. }
  863. public int LP2WaferCount
  864. {
  865. get
  866. {
  867. int iWaferCount = 0;
  868. foreach (var Wafers in ModuleManager.ModuleInfos["LP2"].WaferManager.Wafers)
  869. {
  870. if (Wafers.WaferStatus != 0)
  871. {
  872. iWaferCount++;
  873. }
  874. }
  875. return iWaferCount;
  876. }
  877. }
  878. public string LP2WaferCountInfo
  879. {
  880. get
  881. {
  882. return $"Wafer数量:{LP2WaferCount}";
  883. }
  884. }
  885. #endregion Sequence operation
  886. #region Job operation
  887. private bool JobCheck(string jobID)
  888. {
  889. if (jobID.Length == 0)
  890. {
  891. DialogBox.ShowWarning("Please create job first.");
  892. return false;
  893. }
  894. else
  895. return true;
  896. }
  897. public void CreateJob(WaferAssociationInfo info)
  898. {
  899. //if (MenuPermission != 3) return;
  900. List<string> slotSequence = new List<string>();
  901. info.ModuleData.WaferManager.Wafers.ForEach(key => { slotSequence.Insert(0, key.SequenceName); });
  902. string jobId = info.LotId.Trim();
  903. if (string.IsNullOrEmpty(jobId))
  904. jobId = "CJ_Local_" + info.ModuleData.ModuleID;
  905. info.LotId = jobId;
  906. info.LotIdSaved = true;
  907. WaferAssociationProvider.Instance.CreateJob(jobId, info.ModuleData.ModuleID, slotSequence, true);
  908. }
  909. public void AbortJob(string jobID)
  910. {
  911. //if (MenuPermission != 3) return;
  912. if (JobCheck(jobID))
  913. WaferAssociationProvider.Instance.AbortJob(jobID);
  914. }
  915. public void Start(string jobID)
  916. {
  917. //if (MenuPermission != 3) return;
  918. if (JobCheck(jobID))
  919. WaferAssociationProvider.Instance.Start(jobID);
  920. }
  921. public void Pause(string jobID)
  922. {
  923. //if (MenuPermission != 3) return;
  924. if (JobCheck(jobID))
  925. WaferAssociationProvider.Instance.Pause(jobID);
  926. }
  927. public void Resume(string jobID)
  928. {
  929. //if (MenuPermission != 3) return;
  930. if (JobCheck(jobID))
  931. WaferAssociationProvider.Instance.Resume(jobID);
  932. }
  933. public void Stop(string jobID)
  934. {
  935. //if (MenuPermission != 3) return;
  936. if (JobCheck(jobID))
  937. WaferAssociationProvider.Instance.Stop(jobID);
  938. }
  939. #endregion Job operation
  940. }
  941. }