OperationOverViewModel.cs 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745
  1. using MECF.Framework.Common.CommonData;
  2. using MECF.Framework.Common.DataCenter;
  3. using MECF.Framework.Common.Equipment;
  4. using MECF.Framework.Common.OperationCenter;
  5. using OpenSEMI.ClientBase;
  6. using Prism.Commands;
  7. using Prism.Mvvm;
  8. using System;
  9. using System.Collections.Generic;
  10. using System.Linq;
  11. using System.Text;
  12. using System.Threading.Tasks;
  13. using System.Windows;
  14. using System.Windows.Threading;
  15. using Venus_MainPages.Unity;
  16. using Venus_MainPages.Views;
  17. using Venus_Themes.CustomControls;
  18. using Venus_Themes.Unity;
  19. namespace Venus_MainPages.ViewModels
  20. {
  21. public class OperationOverViewModel : BindableBase
  22. {
  23. #region 私有字段
  24. private bool m_TabIsChecked=true;
  25. private ModuleInfo m_LP1ModuleInfo;
  26. private ModuleInfo m_LP2ModuleInfo;
  27. private ModuleInfo m_LLAModuleInfo;
  28. private ModuleInfo m_LLBModuleInfo;
  29. private ModuleInfo m_LP3ModuleInfo;
  30. private ModuleInfo m_EFEMModuleInfo;
  31. private ModuleInfo m_TMModuleInfo;
  32. private WaferRobotTAction m_Robot1TAction;
  33. private WaferRobotXAction m_Robot1XAction;
  34. private WaferRobotTAction m_Robot2TAction;
  35. private WaferRobotXAction m_Robot2XAction;
  36. private RobotMoveInfo m_robotMoveInfo;
  37. int arm1oldWaferStatus = 100;
  38. int arm2oldWaferStatus = 100;
  39. private WaferInfo m_PMAWafer;
  40. private WaferInfo m_PMBWafer;
  41. private WaferInfo m_PMCWafer;
  42. private WaferInfo m_PMDWafer;
  43. private WaferInfo m_LLAWafer;
  44. private WaferInfo m_LLBWafer;
  45. private WaferInfo m_TMBladeAWafer;
  46. private WaferInfo m_TMBladeBWafer;
  47. private List<string> m_RtDataKeys = new List<string>();
  48. private Dictionary<string, object> m_RtDataValues;
  49. private bool m_PMAIsInstalled;
  50. private bool m_PMBIsInstalled;
  51. private bool m_PMCIsInstalled;
  52. private bool m_PMDIsInstalled;
  53. private bool m_LLAIsInstalled;
  54. private bool m_LLBIsInstalled;
  55. private bool m_TMIsInstalled;
  56. private bool m_EFEMIsInstalled;
  57. private WaferInfo m_EFEMBladeAWafer;
  58. private WaferInfo m_EFEMBladeBWafer;
  59. private WaferInfo m_Aligner1Wafer;
  60. private int m_LP1WaferCount;
  61. private int m_LP2WaferCount;
  62. private int m_LP3WaferCount;
  63. private WaferAssociationInfo _lp1WaferAssociation;
  64. private WaferAssociationInfo _lp2WaferAssociation;
  65. private WaferAssociationInfo _lp3WaferAssociation;
  66. #endregion
  67. #region 属性
  68. public bool TabIsChecked
  69. {
  70. get { return m_TabIsChecked; }
  71. set { SetProperty(ref m_TabIsChecked, value); }
  72. }
  73. public ModuleInfo LP1ModuleInfo
  74. {
  75. get { return m_LP1ModuleInfo; }
  76. set { SetProperty(ref m_LP1ModuleInfo, value); }
  77. }
  78. public ModuleInfo LLAModuleInfo
  79. {
  80. get { return m_LLAModuleInfo; }
  81. set { SetProperty(ref m_LLAModuleInfo, value); }
  82. }
  83. public ModuleInfo LLBModuleInfo
  84. {
  85. get { return m_LLBModuleInfo; }
  86. set { SetProperty(ref m_LLBModuleInfo, value); }
  87. }
  88. public ModuleInfo EFEMModuleInfo
  89. {
  90. get { return m_EFEMModuleInfo; }
  91. set { SetProperty(ref m_EFEMModuleInfo, value); }
  92. }
  93. public ModuleInfo TMModuleInfo
  94. {
  95. get { return m_TMModuleInfo; }
  96. set { SetProperty(ref m_TMModuleInfo, value); }
  97. }
  98. public ModuleInfo LP2ModuleInfo
  99. {
  100. get { return m_LP2ModuleInfo; }
  101. set { SetProperty(ref m_LP2ModuleInfo, value); }
  102. }
  103. public ModuleInfo LP3ModuleInfo
  104. {
  105. get { return m_LP3ModuleInfo; }
  106. set { SetProperty(ref m_LP3ModuleInfo, value); }
  107. }
  108. public WaferRobotTAction Robot1TAction
  109. {
  110. get { return m_Robot1TAction; }
  111. set { SetProperty(ref m_Robot1TAction, value); }
  112. }
  113. public WaferRobotXAction Robot1XAction
  114. {
  115. get { return m_Robot1XAction; }
  116. set { SetProperty(ref m_Robot1XAction, value); }
  117. }
  118. public WaferRobotTAction Robot2TAction
  119. {
  120. get { return m_Robot2TAction; }
  121. set { SetProperty(ref m_Robot2TAction, value); }
  122. }
  123. public WaferRobotXAction Robot2XAction
  124. {
  125. get { return m_Robot2XAction; }
  126. set { SetProperty(ref m_Robot2XAction, value); }
  127. }
  128. public RobotMoveInfo RobotMoveInfo
  129. {
  130. get { return m_robotMoveInfo; }
  131. set
  132. {
  133. RobotMoveInfoChanged(m_robotMoveInfo, value);
  134. m_robotMoveInfo = value;
  135. }
  136. }
  137. public WaferInfo LLAWafer
  138. {
  139. get { return m_LLAWafer; }
  140. set { SetProperty(ref m_LLAWafer, value); }
  141. }
  142. public WaferInfo LLBWafer
  143. {
  144. get { return m_LLBWafer; }
  145. set { SetProperty(ref m_LLBWafer, value); }
  146. }
  147. public WaferInfo PMAWafer
  148. {
  149. get { return m_PMAWafer; }
  150. set { SetProperty(ref m_PMAWafer, value); }
  151. }
  152. public WaferInfo PMBWafer
  153. {
  154. get { return m_PMBWafer; }
  155. set { SetProperty(ref m_PMBWafer, value); }
  156. }
  157. public WaferInfo PMCWafer
  158. {
  159. get { return m_PMCWafer; }
  160. set { SetProperty(ref m_PMCWafer, value); }
  161. }
  162. public WaferInfo PMDWafer
  163. {
  164. get { return m_PMDWafer; }
  165. set { SetProperty(ref m_PMDWafer, value); }
  166. }
  167. public WaferInfo TMBladeAWafer
  168. {
  169. get { return m_TMBladeAWafer; }
  170. set { SetProperty(ref m_TMBladeAWafer, value); }
  171. }
  172. public WaferInfo TMBladeBWafer
  173. {
  174. get { return m_TMBladeBWafer; }
  175. set { SetProperty(ref m_TMBladeBWafer, value); }
  176. }
  177. public Dictionary<string, object> RtDataValues
  178. {
  179. get { return m_RtDataValues; }
  180. set { SetProperty(ref m_RtDataValues, value); }
  181. }
  182. public bool PMAIsInstalled
  183. {
  184. get { return m_PMAIsInstalled; }
  185. set { SetProperty(ref m_PMAIsInstalled, value); }
  186. }
  187. public bool PMBIsInstalled
  188. {
  189. get { return m_PMBIsInstalled; }
  190. set { SetProperty(ref m_PMBIsInstalled, value); }
  191. }
  192. public bool PMCIsInstalled
  193. {
  194. get { return m_PMCIsInstalled; }
  195. set { SetProperty(ref m_PMCIsInstalled, value); }
  196. }
  197. public bool PMDIsInstalled
  198. {
  199. get { return m_PMDIsInstalled; }
  200. set { SetProperty(ref m_PMDIsInstalled, value); }
  201. }
  202. public bool LLAIsInstalled
  203. {
  204. get { return m_LLAIsInstalled; }
  205. set { SetProperty(ref m_LLAIsInstalled, value); }
  206. }
  207. public bool LLBIsInstalled
  208. {
  209. get { return m_LLBIsInstalled; }
  210. set { SetProperty(ref m_LLBIsInstalled, value); }
  211. }
  212. public bool TMIsInstalled
  213. {
  214. get { return m_TMIsInstalled; }
  215. set { SetProperty(ref m_TMIsInstalled, value); }
  216. }
  217. public bool EFEMIsInstalled
  218. {
  219. get { return m_EFEMIsInstalled; }
  220. set { SetProperty(ref m_EFEMIsInstalled, value); }
  221. }
  222. public WaferInfo EFEMBladeAWafer
  223. {
  224. get { return m_EFEMBladeAWafer; }
  225. set { SetProperty(ref m_EFEMBladeAWafer, value); }
  226. }
  227. public WaferInfo EFEMBladeBWafer
  228. {
  229. get { return m_EFEMBladeBWafer; }
  230. set { SetProperty(ref m_EFEMBladeBWafer, value); }
  231. }
  232. public WaferInfo Aligner1Wafer
  233. {
  234. get { return m_Aligner1Wafer; }
  235. set { SetProperty(ref m_Aligner1Wafer, value); }
  236. }
  237. public int LP1WaferCount
  238. {
  239. get { return m_LP1WaferCount; }
  240. set { SetProperty(ref m_LP1WaferCount, value); }
  241. }
  242. public int LP2WaferCount
  243. {
  244. get { return m_LP2WaferCount; }
  245. set { SetProperty(ref m_LP2WaferCount, value); }
  246. }
  247. public int LP3WaferCount
  248. {
  249. get { return m_LP3WaferCount; }
  250. set { SetProperty(ref m_LP3WaferCount, value); }
  251. }
  252. public WaferAssociationInfo LP1WaferAssociation
  253. {
  254. get { return _lp1WaferAssociation; }
  255. set { SetProperty(ref _lp1WaferAssociation, value); }
  256. }
  257. public WaferAssociationInfo LP2WaferAssociation
  258. {
  259. get { return _lp2WaferAssociation; }
  260. set { SetProperty(ref _lp2WaferAssociation, value); }
  261. }
  262. public WaferAssociationInfo LP3WaferAssociation
  263. {
  264. get { return _lp3WaferAssociation; }
  265. set { SetProperty(ref _lp3WaferAssociation, value); }
  266. }
  267. #endregion
  268. #region 命令
  269. private DelegateCommand _LoadCommand;
  270. public DelegateCommand LoadCommand =>
  271. _LoadCommand ?? (_LoadCommand = new DelegateCommand(OnLoad));
  272. private DelegateCommand<object> _LoadWaferCommand;
  273. public DelegateCommand<object> LoadWaferCommand =>
  274. _LoadWaferCommand ?? (_LoadWaferCommand = new DelegateCommand<object>(OnLoadWafer));
  275. private DelegateCommand<object> _UnLoadWaferCommand;
  276. public DelegateCommand<object> UnLoadWaferCommand =>
  277. _UnLoadWaferCommand ?? (_UnLoadWaferCommand = new DelegateCommand<object>(OnUnLoadWafer));
  278. private DelegateCommand<object> _SelectAllCommand;
  279. public DelegateCommand<object> SelectAllCommand =>
  280. _SelectAllCommand ?? (_SelectAllCommand = new DelegateCommand<object>(OnSelectAll));
  281. private DelegateCommand<object> _UnSelectAllCommand;
  282. public DelegateCommand<object> UnSelectAllCommand =>
  283. _UnSelectAllCommand ?? (_UnSelectAllCommand = new DelegateCommand<object>(OnUnSelectAll));
  284. private DelegateCommand<object> _StartCommand;
  285. public DelegateCommand<object> StartCommand =>
  286. _StartCommand ?? (_StartCommand = new DelegateCommand<object>(OnStart));
  287. private DelegateCommand<object> _StopCommand;
  288. public DelegateCommand<object> StopCommand =>
  289. _StopCommand ?? (_StopCommand = new DelegateCommand<object>(OnStop));
  290. private DelegateCommand<object> _AbortCommand;
  291. public DelegateCommand<object> AbortCommand =>
  292. _AbortCommand ?? (_AbortCommand = new DelegateCommand<object>(OnAbort));
  293. private DelegateCommand _HomeAllCommand;
  294. public DelegateCommand HomeAllCommand =>
  295. _HomeAllCommand ?? (_HomeAllCommand = new DelegateCommand(OnHomeAll));
  296. private DelegateCommand _PauseAllJobCommand;
  297. public DelegateCommand PauseAllJobCommand =>
  298. _PauseAllJobCommand ?? (_PauseAllJobCommand = new DelegateCommand(OnPauseAllJob));
  299. private DelegateCommand _AbortAllCommand;
  300. public DelegateCommand AbortAllCommand =>
  301. _AbortAllCommand ?? (_AbortAllCommand = new DelegateCommand(OnAbortAll));
  302. private DelegateCommand _ReturnAllWaferCommand;
  303. public DelegateCommand ReturnAllWaferCommand =>
  304. _ReturnAllWaferCommand ?? (_ReturnAllWaferCommand = new DelegateCommand(OnReturnAllWafer));
  305. private DelegateCommand _SetSequenceCommand;
  306. public DelegateCommand SetSequenceCommand =>
  307. _SetSequenceCommand ?? (_SetSequenceCommand = new DelegateCommand(OnSetSequence));
  308. private DelegateCommand<object> _CreateJobCommand;
  309. public DelegateCommand<object> CreateJobCommand =>
  310. _CreateJobCommand ?? (_CreateJobCommand = new DelegateCommand<object>(OnCreateJob));
  311. private DelegateCommand _EnableAutoCommand;
  312. public DelegateCommand EnableAutoCommand =>
  313. _EnableAutoCommand ?? (_EnableAutoCommand = new DelegateCommand(OnEnableAuto));
  314. private DelegateCommand _EnableManualCommand;
  315. public DelegateCommand EnableManualCommand =>
  316. _EnableManualCommand ?? (_EnableManualCommand = new DelegateCommand(OnEnableManual));
  317. #endregion
  318. #region 构造函数
  319. public OperationOverViewModel()
  320. {
  321. DispatcherTimer timer = new DispatcherTimer();
  322. timer.Interval = TimeSpan.FromSeconds(0.5);
  323. timer.Tick += Timer_Tick;
  324. timer.Start();
  325. addDataKeys();
  326. string allModules = QueryDataClient.Instance.Service.GetConfig($"System.InstalledModules").ToString();
  327. PMAIsInstalled = allModules.Contains("PMA");
  328. PMBIsInstalled = allModules.Contains("PMB");
  329. PMCIsInstalled = allModules.Contains("PMC");
  330. PMDIsInstalled = allModules.Contains("PMD");
  331. LLAIsInstalled = allModules.Contains("LLA");
  332. LLBIsInstalled = allModules.Contains("LLB");
  333. EFEMIsInstalled = allModules.Contains("EFEM");
  334. TMIsInstalled = allModules.Contains("TM");
  335. UIEvents.PMDoorRaiseChangedEvent += UIEvents_PMDoorRaiseChangedEvent;
  336. UIEvents.LLTDoorRaiseChangedEvent += UIEvents_LLTDoorRaiseChangedEvent;
  337. UIEvents.LLEDoorRaiseChangedEvent += UIEvents_LLEDoorRaiseChangedEvent;
  338. }
  339. #endregion
  340. #region 命令方法
  341. private void OnLoad()
  342. {
  343. LP1WaferAssociation = new WaferAssociationInfo();
  344. LP1WaferAssociation.ModuleData = ModuleManager.ModuleInfos["LP1"];
  345. LP2WaferAssociation = new WaferAssociationInfo();
  346. LP2WaferAssociation.ModuleData = ModuleManager.ModuleInfos["LP2"];
  347. LP3WaferAssociation = new WaferAssociationInfo();
  348. LP3WaferAssociation.ModuleData = ModuleManager.ModuleInfos["LP3"];
  349. }
  350. private void OnLoadWafer(object obj)
  351. {
  352. InvokeClient.Instance.Service.DoOperation($"{obj.ToString()}.Load", ModuleManager.ModuleInfos[obj.ToString()].ModuleID);
  353. }
  354. private void OnUnLoadWafer(object obj)
  355. {
  356. InvokeClient.Instance.Service.DoOperation($"{obj.ToString()}.UnLoad", ModuleManager.ModuleInfos[obj.ToString()].ModuleID);
  357. }
  358. private void OnSelectAll(object obj)
  359. {
  360. var info=obj as WaferAssociationInfo;
  361. info.SlotFrom = 1;
  362. info.SlotTo = 25;
  363. AssociateSequence(info, true);
  364. }
  365. private void OnUnSelectAll(object obj)
  366. {
  367. var info = obj as WaferAssociationInfo;
  368. info.SlotFrom = 1;
  369. info.SlotTo = 25;
  370. AssociateSequence(info, false);
  371. }
  372. private void OnStart(object obj)
  373. {
  374. var info = obj as WaferAssociationInfo;
  375. InvokeClient.Instance.Service.DoOperation("System.StartJob", info.LotId);
  376. }
  377. private void OnStop(object obj)
  378. {
  379. InvokeClient.Instance.Service.DoOperation("System.PauseJob", obj.ToString());
  380. }
  381. private void OnAbort(object obj)
  382. {
  383. InvokeClient.Instance.Service.DoOperation("System.ResumeJob", obj.ToString());
  384. }
  385. private void OnHomeAll()
  386. {
  387. InvokeClient.Instance.Service.DoOperation("System.HomeAll");
  388. }
  389. private void OnPauseAllJob()
  390. {
  391. InvokeClient.Instance.Service.DoOperation("System.PauseJob", LP1WaferAssociation.JobID);
  392. InvokeClient.Instance.Service.DoOperation("System.PauseJob", LP2WaferAssociation.JobID);
  393. InvokeClient.Instance.Service.DoOperation("System.PauseJob", LP3WaferAssociation.JobID);
  394. }
  395. private void OnAbortAll()
  396. {
  397. InvokeClient.Instance.Service.DoOperation("System.Abort");
  398. }
  399. private void OnReturnAllWafer()
  400. {
  401. //Dialog
  402. WaferDialogView dialog = new WaferDialogView()
  403. {
  404. Owner = Application.Current.MainWindow,
  405. };
  406. dialog.Left = Application.Current.MainWindow.Width / 2 - 150;
  407. dialog.Top = Application.Current.MainWindow.Height / 2 - 200;
  408. dialog.Height = 300;
  409. dialog.Width = 400;
  410. double angel = 0;
  411. double coolingtime = 0;
  412. if (dialog.ShowDialog() == true)
  413. {
  414. if ((bool)dialog.AlignFlag == true && !string.IsNullOrEmpty(dialog.Angle))
  415. {
  416. angel = Convert.ToDouble(dialog.Angle);
  417. }
  418. if ((bool)dialog.CoolingFlag == true && !string.IsNullOrEmpty(dialog.CoolingTime))
  419. {
  420. coolingtime = Convert.ToDouble(dialog.CoolingTime);
  421. }
  422. InvokeClient.Instance.Service.DoOperation("System.ReturnAllWafer", dialog.CoolingFlag,coolingtime, dialog.AlignFlag, angel);
  423. }
  424. }
  425. private void OnSetSequence()
  426. {
  427. //var info = obj as WaferAssociationInfo;
  428. }
  429. private void OnCreateJob(object obj)
  430. {
  431. var info = obj as WaferAssociationInfo;
  432. List<string> slotSequence = new List<string>();
  433. info.ModuleData.WaferManager.Wafers.ForEach(key => { slotSequence.Insert(0, key.SequenceName); });
  434. string jobId = info.LotId.Trim();
  435. if (string.IsNullOrEmpty(jobId))
  436. jobId = "CJ_Local_" + info.ModuleData.ModuleID;
  437. info.LotId = jobId;
  438. info.JobID = jobId;
  439. info.JobStatus = "WaitingForStart";
  440. info.LotIdSaved = true;
  441. Dictionary<string, object> param = new Dictionary<string, object>()
  442. {
  443. {"JobId", jobId},
  444. {"Module", info.ModuleData.ModuleID},
  445. {"SlotSequence", slotSequence.ToArray()},
  446. {"AutoStart", true},
  447. };
  448. InvokeClient.Instance.Service.DoOperation("System.CreateJob", param);
  449. }
  450. private void OnEnableAuto()
  451. {
  452. InvokeClient.Instance.Service.DoOperation("System.SetAutoMode");
  453. }
  454. private void OnEnableManual()
  455. {
  456. InvokeClient.Instance.Service.DoOperation("System.SetManualMode");
  457. }
  458. #endregion
  459. #region 私有方法
  460. private void Timer_Tick(object sender, EventArgs e)
  461. {
  462. LP1ModuleInfo = ModuleManager.ModuleInfos["LP1"];
  463. LP2ModuleInfo = ModuleManager.ModuleInfos["LP2"];
  464. LP3ModuleInfo = ModuleManager.ModuleInfos["LP3"];
  465. EFEMModuleInfo = ModuleManager.ModuleInfos["EfemRobot"];
  466. TMModuleInfo = ModuleManager.ModuleInfos["TMRobot"];
  467. if (LLAIsInstalled == true)
  468. {
  469. LLAModuleInfo = ModuleManager.ModuleInfos["LLA"];
  470. LLAWafer = ModuleManager.ModuleInfos["LLA"].WaferManager.Wafers.FirstOrDefault(x => x.WaferStatus != 0);
  471. }
  472. if (LLBIsInstalled == true)
  473. {
  474. LLBModuleInfo = ModuleManager.ModuleInfos["LLB"];
  475. LLBWafer = ModuleManager.ModuleInfos["LLB"].WaferManager.Wafers.FirstOrDefault(x => x.WaferStatus != 0);
  476. }
  477. if (PMAIsInstalled == true)
  478. {
  479. PMAWafer = ModuleManager.ModuleInfos["PMA"].WaferManager.Wafers[0];
  480. }
  481. if (PMBIsInstalled == true)
  482. {
  483. PMBWafer = ModuleManager.ModuleInfos["PMB"].WaferManager.Wafers[0];
  484. }
  485. if (PMCIsInstalled == true)
  486. {
  487. PMCWafer = ModuleManager.ModuleInfos["PMC"].WaferManager.Wafers[0];
  488. }
  489. if (PMDIsInstalled == true)
  490. {
  491. PMDWafer = ModuleManager.ModuleInfos["PMD"].WaferManager.Wafers[0];
  492. }
  493. if (TMIsInstalled == true)
  494. {
  495. TMBladeAWafer = ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[0];
  496. TMBladeBWafer = ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[1];
  497. }
  498. if (EFEMIsInstalled == true)
  499. {
  500. EFEMBladeAWafer = ModuleManager.ModuleInfos["EfemRobot"].WaferManager.Wafers[0];
  501. EFEMBladeBWafer = ModuleManager.ModuleInfos["EfemRobot"].WaferManager.Wafers[1];
  502. Aligner1Wafer = ModuleManager.ModuleInfos["Aligner1"].WaferManager.Wafers[0];
  503. }
  504. RobotMoveInfo = (RobotMoveInfo)QueryDataClient.Instance.Service.GetData("TM.RobotMoveAction");
  505. RtDataValues = QueryDataClient.Instance.Service.PollData(m_RtDataKeys);
  506. LP1WaferCount = LP1ModuleInfo.WaferManager.Wafers.Where(x=>x.WaferStatus!=0).Count();
  507. LP2WaferCount = LP2ModuleInfo.WaferManager.Wafers.Where(x => x.WaferStatus != 0).Count();
  508. LP3WaferCount = LP3ModuleInfo.WaferManager.Wafers.Where(x => x.WaferStatus != 0).Count();
  509. }
  510. private async void RobotMoveInfoChanged(RobotMoveInfo oldValue, RobotMoveInfo newValue)
  511. {
  512. string RobotTarget;
  513. if (oldValue == null || newValue == null)
  514. {
  515. return;
  516. }
  517. #region pick 和 place LL
  518. if (oldValue.Action == RobotAction.None && (newValue.Action == RobotAction.Placing || newValue.Action == RobotAction.Picking))
  519. {
  520. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  521. if (TMRobotMoveActionBladeTarget != null)
  522. {
  523. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  524. }
  525. else
  526. {
  527. return;
  528. }
  529. var values = RobotTarget.Split('.');
  530. var arm = values[0];
  531. var module = values[1];
  532. if (arm == "ArmA")
  533. {
  534. Robot1TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  535. await Task.Delay(1500);
  536. Robot1XAction = WaferRobotXAction.Extend;
  537. await Task.Delay(3000);
  538. Robot1XAction = WaferRobotXAction.Retract;
  539. }
  540. else if (arm == "ArmB")
  541. {
  542. Robot2TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  543. await Task.Delay(1500);
  544. Robot2XAction = WaferRobotXAction.Extend;
  545. await Task.Delay(3000);
  546. Robot2XAction = WaferRobotXAction.Retract;
  547. }
  548. }
  549. #endregion
  550. #region pick 和 place pm
  551. if (oldValue.Action == RobotAction.None && newValue.Action == RobotAction.Extending)
  552. {
  553. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  554. if (TMRobotMoveActionBladeTarget != null)
  555. {
  556. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  557. }
  558. else
  559. {
  560. return;
  561. }
  562. var values = RobotTarget.Split('.');
  563. var arm = values[0];
  564. var module = values[1];
  565. if (arm == "ArmA")
  566. {
  567. Robot1TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  568. await Task.Delay(1500);
  569. Robot1XAction = WaferRobotXAction.Extend;
  570. }
  571. else if (arm == "ArmB")
  572. {
  573. Robot2TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  574. await Task.Delay(1500);
  575. Robot2XAction = WaferRobotXAction.Extend;
  576. }
  577. }
  578. if (oldValue.Action == RobotAction.None && newValue.Action == RobotAction.Retracting)
  579. {
  580. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  581. if (TMRobotMoveActionBladeTarget != null)
  582. {
  583. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  584. }
  585. else
  586. {
  587. return;
  588. }
  589. var values = RobotTarget.Split('.');
  590. var arm = values[0];
  591. if (arm == "ArmA")
  592. {
  593. Robot1XAction = WaferRobotXAction.Retract;
  594. }
  595. else if (arm == "ArmB")
  596. {
  597. Robot2XAction = WaferRobotXAction.Retract;
  598. }
  599. }
  600. #endregion
  601. arm1oldWaferStatus = ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[0].WaferStatus;
  602. arm2oldWaferStatus = ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[1].WaferStatus;
  603. }
  604. private void addDataKeys()
  605. {
  606. m_RtDataKeys.Add("PMA.IsSlitDoorClosed");
  607. m_RtDataKeys.Add("PMB.IsSlitDoorClosed");
  608. m_RtDataKeys.Add("PMC.IsSlitDoorClosed");
  609. m_RtDataKeys.Add("PMD.IsSlitDoorClosed");
  610. m_RtDataKeys.Add("TM.LLATSlitDoor.IsClosed");
  611. m_RtDataKeys.Add("TM.LLBTSlitDoor.IsClosed");
  612. m_RtDataKeys.Add("TM.LLAESlitDoor.IsClosed");
  613. m_RtDataKeys.Add("TM.LLBESlitDoor.IsClosed");
  614. m_RtDataKeys.Add("System.IsAutoMode");
  615. }
  616. private void AssociateSequence(WaferAssociationInfo info, bool flag, int slot = -1)
  617. {
  618. List<WaferInfo> wafers = info.ModuleData.WaferManager.Wafers;
  619. if (slot >= 0) //by wafer
  620. {
  621. int index = wafers.Count - slot - 1;
  622. if (index < wafers.Count)
  623. {
  624. if (flag && HasWaferOnSlot(wafers, index))
  625. wafers[index].SequenceName = info.SequenceName;
  626. else
  627. wafers[index].SequenceName = string.Empty;
  628. }
  629. }
  630. else //by from-to
  631. {
  632. for (int i = info.SlotFrom - 1; i < info.SlotTo; i++)
  633. {
  634. int index = wafers.Count - i - 1;
  635. if (index < wafers.Count)
  636. {
  637. if (flag && HasWaferOnSlot(wafers, index))
  638. wafers[index].SequenceName = info.SequenceName;
  639. else
  640. wafers[index].SequenceName = string.Empty;
  641. }
  642. }
  643. }
  644. switch (info.ModuleData.ModuleID)
  645. {
  646. case "LP1":
  647. LP1WaferAssociation = info;
  648. break;
  649. case "LP2":
  650. LP2WaferAssociation = info;
  651. break;
  652. case "LP3":
  653. LP3WaferAssociation = info;
  654. break;
  655. }
  656. }
  657. private bool HasWaferOnSlot(List<WaferInfo> wafers, int index)
  658. {
  659. if (wafers[index].WaferStatus == 0)
  660. return false;
  661. return true;
  662. }
  663. private void UIEvents_PMDoorRaiseChangedEvent(DoorPara obj)
  664. {
  665. InvokeClient.Instance.Service.DoOperation($"{obj?.ModuleName}.SlitDoor.{obj?.IsOpen}");
  666. }
  667. private void UIEvents_LLTDoorRaiseChangedEvent(DoorPara obj)
  668. {
  669. InvokeClient.Instance.Service.DoOperation($"TM.{obj.ModuleName}TSlitDoor.{obj?.IsOpen}");
  670. }
  671. private void UIEvents_LLEDoorRaiseChangedEvent(DoorPara obj)
  672. {
  673. InvokeClient.Instance.Service.DoOperation($"TM.{obj.ModuleName}ESlitDoor.{obj?.IsOpen}");
  674. }
  675. #endregion
  676. }
  677. }