SeTMViewModel.cs 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972
  1. using Aitex.Sorter.Common;
  2. using MECF.Framework.Common.CommonData;
  3. using MECF.Framework.Common.DataCenter;
  4. using MECF.Framework.Common.Equipment;
  5. using MECF.Framework.Common.OperationCenter;
  6. using MECF.Framework.Common.Schedulers;
  7. using OpenSEMI.ClientBase;
  8. using OpenSEMI.Ctrlib.Controls;
  9. using Prism.Commands;
  10. using Prism.Mvvm;
  11. using System;
  12. using System.Collections.Generic;
  13. using System.Collections.ObjectModel;
  14. using System.Linq;
  15. using System.Text;
  16. using System.Threading.Tasks;
  17. using System.Windows.Threading;
  18. using Venus_Core;
  19. using Venus_MainPages.Unity;
  20. using Venus_Themes.CustomControls;
  21. using static Venus_Themes.CustomControls.DERobot;
  22. using static Venus_Themes.CustomControls.SERobot;
  23. namespace Venus_MainPages.ViewModels
  24. {
  25. public enum SeTMModule
  26. {
  27. PMA, PMB, PMC, LP1, Aligner1
  28. }
  29. public enum SeTMBlade
  30. {
  31. Blade1, Blade2
  32. }
  33. public class SeTMViewModel : BindableBase
  34. {
  35. #region 私有字段
  36. public double m_Alignerangle;
  37. private ModuleInfo m_VCEModuleInfo;
  38. private ModuleInfo m_AlignerModuleInfo;
  39. private ModuleInfo m_TMModuleInfo;
  40. //Wafer
  41. private WaferInfo m_PMAWafer;
  42. private WaferInfo m_PMBWafer;
  43. private WaferInfo m_PMCWafer;
  44. public WaferInfo m_RobotUpperWafer;
  45. public WaferInfo m_RobotLowerWafer;
  46. public WaferInfo m_PAWafer;
  47. //Door
  48. private bool m_PMADoorIsOpen;
  49. private bool m_PMBDoorIsOpen;
  50. private bool m_PMCDoorIsOpen;
  51. private bool m_VCEDoorIsOpen;
  52. private bool m_VCEOutDoorIsOpen;
  53. //Pick、Place、Extend、Retract行下拉框内容
  54. private SeTMModule m_PickSelectedModule;
  55. private SeTMModule m_PlaceSelectedModule;
  56. private SeTMModule m_ExtendSelectedModule;
  57. private SeTMModule m_RetractSelectedModule;
  58. private SeTMModule m_GotoSelectedModule;
  59. private SeTMBlade m_PickSelectedBlade;
  60. private SeTMBlade m_PlaceSelectedBlade;
  61. private SeTMBlade m_ExtendSelectedBlade;
  62. private SeTMBlade m_RetractSelectedBlade;
  63. private SeTMBlade m_GoToSelectedBlade;
  64. //Pick、Place、Extend、Retract行下拉框关联
  65. private ObservableCollection<int> m_PickSoltItemsSource = new ObservableCollection<int>();
  66. private ObservableCollection<int> m_PlaceSoltItemsSource = new ObservableCollection<int>();
  67. private ObservableCollection<int> m_ExtendSoltItemsSource = new ObservableCollection<int>();
  68. private ObservableCollection<int> m_RetractSoltItemsSource = new ObservableCollection<int>();
  69. private int m_PickSoltSelectedIndex;
  70. private int m_PlaceSoltSelectedIndex;
  71. private int m_ExtendSoltSelectedIndex;
  72. private int m_RetractSoltSelectedIndex;
  73. //下拉框内容
  74. private List<SeTMModule> m_TMModules = new List<SeTMModule>();
  75. private bool m_PMAIsInstalled;
  76. private bool m_PMBIsInstalled;
  77. private bool m_PMCIsInstalled;
  78. private bool m_VCEIsInstalled;
  79. private bool m_AlignerIsInstalled;
  80. private Dictionary<string, object> m_RtDataValues = new Dictionary<string, object>();
  81. private List<string> m_RtDataKeys = new List<string>();
  82. //Robot动画
  83. private SERobotTAction m_SERobotTAction;
  84. private SERobotTAction m_Robot1TAction;
  85. private SERobotXAction m_Robot1XAction;
  86. private SERobotTAction m_Robot2TAction;
  87. private SERobotXAction m_Robot2XAction;
  88. public RobotMoveInfo m_robotMoveInfo;
  89. //Cycle
  90. private List<string> m_OriginalCycle = new List<string>();
  91. private List<string> m_ToCycle = new List<string>();
  92. private bool m_CycleEnable;
  93. private bool m_PMAIsCycle;
  94. private bool m_PMBIsCycle;
  95. private bool m_PMCIsCycle;
  96. private int m_CycleCount;
  97. private string m_PMAChamberLabel;
  98. private string m_PMBChamberLabel;
  99. private string m_PMCChamberLabel;
  100. private string m_PMDChamberLabel;
  101. #endregion
  102. #region 属性
  103. public string PMAChamberLabel
  104. {
  105. get { return m_PMAChamberLabel; }
  106. set { SetProperty(ref m_PMAChamberLabel, value); }
  107. }
  108. public string PMBChamberLabel
  109. {
  110. get { return m_PMBChamberLabel; }
  111. set { SetProperty(ref m_PMBChamberLabel, value); }
  112. }
  113. public string PMCChamberLabel
  114. {
  115. get { return m_PMCChamberLabel; }
  116. set { SetProperty(ref m_PMCChamberLabel, value); }
  117. }
  118. public string PMDChamberLabel
  119. {
  120. get { return m_PMDChamberLabel; }
  121. set { SetProperty(ref m_PMDChamberLabel, value); }
  122. }
  123. public double Alignerangle
  124. {
  125. get { return m_Alignerangle; }
  126. set { SetProperty(ref m_Alignerangle, value); }
  127. }
  128. public WaferInfo PMAWafer
  129. {
  130. get { return m_PMAWafer; }
  131. set { SetProperty(ref m_PMAWafer, value); }
  132. }
  133. public WaferInfo PMBWafer
  134. {
  135. get { return m_PMBWafer; }
  136. set { SetProperty(ref m_PMBWafer, value); }
  137. }
  138. public WaferInfo PMCWafer
  139. {
  140. get { return m_PMCWafer; }
  141. set { SetProperty(ref m_PMCWafer, value); }
  142. }
  143. public WaferInfo RobotUpperWafer
  144. {
  145. get { return m_RobotUpperWafer; }
  146. set { SetProperty(ref m_RobotUpperWafer, value); }
  147. }
  148. public WaferInfo RobotLowerWafer
  149. {
  150. get { return m_RobotLowerWafer; }
  151. set { SetProperty(ref m_RobotLowerWafer, value); }
  152. }
  153. public WaferInfo PAWafer
  154. {
  155. get { return m_PAWafer; }
  156. set { SetProperty(ref m_PAWafer, value); }
  157. }
  158. public bool VCEDoorIsOpen { get => m_VCEDoorIsOpen; set => SetProperty(ref m_VCEDoorIsOpen, value); }
  159. public bool VCEOutDoorIsOpen { get => m_VCEOutDoorIsOpen; set => SetProperty(ref m_VCEOutDoorIsOpen, value); }
  160. public bool PMCDoorIsOpen
  161. {
  162. get => m_PMCDoorIsOpen;
  163. set
  164. {
  165. SetProperty(ref m_PMCDoorIsOpen, value);
  166. }
  167. }
  168. public bool PMADoorIsOpen
  169. {
  170. get { return m_PMADoorIsOpen; }
  171. set { SetProperty(ref m_PMADoorIsOpen, value); }
  172. }
  173. public bool PMBDoorIsOpen
  174. {
  175. get { return m_PMBDoorIsOpen; }
  176. set { SetProperty(ref m_PMBDoorIsOpen, value); }
  177. }
  178. public ModuleInfo VCEModuleInfo
  179. {
  180. get { return m_VCEModuleInfo; }
  181. set
  182. {
  183. SetProperty(ref m_VCEModuleInfo, value);
  184. }
  185. }
  186. public ModuleInfo AlignerModuleInfo
  187. {
  188. get { return m_AlignerModuleInfo; }
  189. set
  190. {
  191. SetProperty(ref m_AlignerModuleInfo, value);
  192. }
  193. }
  194. public Dictionary<string, object> RtDataValues
  195. {
  196. get { return m_RtDataValues; }
  197. set { SetProperty(ref m_RtDataValues, value); }
  198. }
  199. public bool PMAIsInstalled
  200. {
  201. get { return m_PMAIsInstalled; }
  202. set { SetProperty(ref m_PMAIsInstalled, value); }
  203. }
  204. public bool PMBIsInstalled
  205. {
  206. get { return m_PMBIsInstalled; }
  207. set { SetProperty(ref m_PMBIsInstalled, value); }
  208. }
  209. public bool PMCIsInstalled
  210. {
  211. get { return m_PMCIsInstalled; }
  212. set { SetProperty(ref m_PMCIsInstalled, value); }
  213. }
  214. public bool VCEIsInstalled
  215. {
  216. get { return m_VCEIsInstalled; }
  217. set { SetProperty(ref m_VCEIsInstalled, value); }
  218. }
  219. public bool AlignerIsInstalled
  220. {
  221. get { return m_AlignerIsInstalled; }
  222. set { SetProperty(ref m_AlignerIsInstalled, value); }
  223. }
  224. public List<SeTMModule> TMModules
  225. {
  226. get { return m_TMModules; }
  227. set { SetProperty(ref m_TMModules, value); }
  228. }
  229. //Module属性
  230. public SeTMModule PickSelectedModule
  231. {
  232. get { return m_PickSelectedModule; }
  233. set { SetProperty(ref m_PickSelectedModule, value); }
  234. }
  235. public SeTMModule PlaceSelectedModule
  236. {
  237. get { return m_PlaceSelectedModule; }
  238. set { SetProperty(ref m_PlaceSelectedModule, value); }
  239. }
  240. public SeTMModule ExtendSelectedModule
  241. {
  242. get { return m_ExtendSelectedModule; }
  243. set { SetProperty(ref m_ExtendSelectedModule, value); }
  244. }
  245. public SeTMModule RetractSelectedModule
  246. {
  247. get { return m_RetractSelectedModule; }
  248. set { SetProperty(ref m_RetractSelectedModule, value); }
  249. }
  250. public SeTMModule GotoSelectedModule
  251. {
  252. get { return m_GotoSelectedModule; }
  253. set { SetProperty(ref m_GotoSelectedModule, value); }
  254. }
  255. public ModuleInfo TMModuleInfo
  256. {
  257. get { return m_TMModuleInfo; }
  258. set
  259. {
  260. SetProperty(ref m_TMModuleInfo, value);
  261. }
  262. }
  263. //Blade属性
  264. public SeTMBlade PickSelectedBlade
  265. {
  266. get { return m_PickSelectedBlade; }
  267. set { SetProperty(ref m_PickSelectedBlade, value); }
  268. }
  269. public SeTMBlade PlaceSelectedBlade
  270. {
  271. get { return m_PlaceSelectedBlade; }
  272. set { SetProperty(ref m_PlaceSelectedBlade, value); }
  273. }
  274. public SeTMBlade ExtendSelectedBlade
  275. {
  276. get { return m_ExtendSelectedBlade; }
  277. set { SetProperty(ref m_ExtendSelectedBlade, value); }
  278. }
  279. public SeTMBlade RetractSelectedBlade
  280. {
  281. get { return m_RetractSelectedBlade; }
  282. set { SetProperty(ref m_RetractSelectedBlade, value); }
  283. }
  284. public SeTMBlade GoToSelectedBlade
  285. {
  286. get { return m_GoToSelectedBlade; }
  287. set { SetProperty(ref m_GoToSelectedBlade, value); }
  288. }
  289. public ObservableCollection<int> PickSoltItemsSource
  290. {
  291. get { return m_PickSoltItemsSource; }
  292. set { SetProperty(ref m_PickSoltItemsSource, value); }
  293. }
  294. public ObservableCollection<int> PlaceSoltItemsSource
  295. {
  296. get { return m_PlaceSoltItemsSource; }
  297. set { SetProperty(ref m_PlaceSoltItemsSource, value); }
  298. }
  299. public ObservableCollection<int> ExtendSoltItemsSource
  300. {
  301. get { return m_ExtendSoltItemsSource; }
  302. set { SetProperty(ref m_ExtendSoltItemsSource, value); }
  303. }
  304. public ObservableCollection<int> RetractSoltItemsSource
  305. {
  306. get { return m_RetractSoltItemsSource; }
  307. set { SetProperty(ref m_RetractSoltItemsSource, value); }
  308. }
  309. public int PickSoltSelectedIndex
  310. {
  311. get { return m_PickSoltSelectedIndex; }
  312. set { SetProperty(ref m_PickSoltSelectedIndex, value); }
  313. }
  314. public int PlaceSoltSelectedIndex
  315. {
  316. get { return m_PlaceSoltSelectedIndex; }
  317. set { SetProperty(ref m_PlaceSoltSelectedIndex, value); }
  318. }
  319. public int ExtendSoltSelectedIndex
  320. {
  321. get { return m_ExtendSoltSelectedIndex; }
  322. set { SetProperty(ref m_ExtendSoltSelectedIndex, value); }
  323. }
  324. public int RetractSoltSelectedIndex
  325. {
  326. get { return m_RetractSoltSelectedIndex; }
  327. set { SetProperty(ref m_RetractSoltSelectedIndex, value); }
  328. }
  329. //Robot动作
  330. public SERobotTAction SERobotTAction
  331. {
  332. get { return m_SERobotTAction; }
  333. set { SetProperty(ref m_SERobotTAction, value); }
  334. }
  335. public SERobotTAction Robot1TAction
  336. {
  337. get { return m_Robot1TAction; }
  338. set { SetProperty(ref m_Robot1TAction, value); }
  339. }
  340. public SERobotXAction Robot1XAction
  341. {
  342. get { return m_Robot1XAction; }
  343. set { SetProperty(ref m_Robot1XAction, value); }
  344. }
  345. public SERobotTAction Robot2TAction
  346. {
  347. get { return m_Robot2TAction; }
  348. set { SetProperty(ref m_Robot2TAction, value); }
  349. }
  350. public SERobotXAction Robot2XAction
  351. {
  352. get { return m_Robot2XAction; }
  353. set { SetProperty(ref m_Robot2XAction, value); }
  354. }
  355. public RobotMoveInfo RobotMoveInfo
  356. {
  357. get { return m_robotMoveInfo; }
  358. set
  359. {
  360. RobotMoveInfoChanged(m_robotMoveInfo, value);
  361. m_robotMoveInfo = value;
  362. }
  363. }
  364. //Cycle
  365. public List<string> OriginalCycle
  366. {
  367. get { return m_OriginalCycle; }
  368. set { SetProperty(ref m_OriginalCycle, value); }
  369. }
  370. public List<string> ToCycle
  371. {
  372. get { return m_ToCycle; }
  373. set { SetProperty(ref m_ToCycle, value); }
  374. }
  375. public bool CycleEnable
  376. {
  377. get { return m_CycleEnable; }
  378. set { SetProperty(ref m_CycleEnable, value); }
  379. }
  380. public bool PMAIsCycle
  381. {
  382. get { return m_PMAIsCycle; }
  383. set { SetProperty(ref m_PMAIsCycle, value); }
  384. }
  385. public bool PMBIsCycle
  386. {
  387. get { return m_PMBIsCycle; }
  388. set { SetProperty(ref m_PMBIsCycle, value); }
  389. }
  390. public bool PMCIsCycle
  391. {
  392. get { return m_PMCIsCycle; }
  393. set { SetProperty(ref m_PMCIsCycle, value); }
  394. }
  395. public int CycleCount
  396. {
  397. get { return m_CycleCount; }
  398. set { SetProperty(ref m_CycleCount, value); }
  399. }
  400. #endregion
  401. #region 命令
  402. //模块下拉框选择命令
  403. private DelegateCommand<object> _ModuleChangeCommand;
  404. public DelegateCommand<object> ModuleChangeCommand =>
  405. _ModuleChangeCommand ?? (_ModuleChangeCommand = new DelegateCommand<object>(OnModuleChange));
  406. //Pick按钮命令
  407. private DelegateCommand _PickCommand;
  408. public DelegateCommand PickCommand =>
  409. _PickCommand ?? (_PickCommand = new DelegateCommand(OnPick));
  410. //Place按钮命令
  411. private DelegateCommand _PlaceCommand;
  412. public DelegateCommand PlaceCommand =>
  413. _PlaceCommand ?? (_PlaceCommand = new DelegateCommand(OnPlace));
  414. //Extend按钮命令
  415. private DelegateCommand _ExtendCommand;
  416. public DelegateCommand ExtendCommand =>
  417. _ExtendCommand ?? (_ExtendCommand = new DelegateCommand(OnExtend));
  418. //Retract按钮命令
  419. private DelegateCommand _RetractCommand;
  420. public DelegateCommand RetractCommand =>
  421. _RetractCommand ?? (_RetractCommand = new DelegateCommand(OnRetract));
  422. //RobotHome按钮命令
  423. public DelegateCommand _RobotHomeCommand;
  424. public DelegateCommand RobotHomeCommand =>
  425. _RobotHomeCommand ?? (_RobotHomeCommand = new DelegateCommand(OnRobotHome));
  426. private DelegateCommand _HomeCommand;
  427. public DelegateCommand HomeCommand =>
  428. _HomeCommand ?? (_HomeCommand = new DelegateCommand(OnHome));
  429. private DelegateCommand _GotoCommand;
  430. public DelegateCommand GotoCommand =>
  431. _GotoCommand ?? (_GotoCommand = new DelegateCommand(OnGoto));
  432. #endregion
  433. //Cycle
  434. private DelegateCommand _StartCycleCommand;
  435. public DelegateCommand StartCycleCommand =>
  436. _StartCycleCommand ?? (_StartCycleCommand = new DelegateCommand(OnStartCycle));
  437. private DelegateCommand _StopCycleCommand;
  438. public DelegateCommand StopCycleCommand =>
  439. _StopCycleCommand ?? (_StopCycleCommand = new DelegateCommand(OnStopCycle));
  440. #region 构造函数
  441. public SeTMViewModel()
  442. {
  443. string allModules = QueryDataClient.Instance.Service.GetConfig($"System.InstalledModules").ToString();
  444. PMAIsInstalled = allModules.Contains("PMA");
  445. PMBIsInstalled = allModules.Contains("PMB");
  446. PMCIsInstalled = allModules.Contains("PMC");
  447. VCEIsInstalled = allModules.Contains("VCE1");
  448. AlignerIsInstalled = allModules.Contains("Aligner1");
  449. if (PMAIsInstalled == true)
  450. {
  451. TMModules.Add(SeTMModule.PMA);
  452. }
  453. if (PMBIsInstalled == true)
  454. {
  455. TMModules.Add(SeTMModule.PMB);
  456. }
  457. if (PMCIsInstalled == true)
  458. {
  459. TMModules.Add(SeTMModule.PMC);
  460. m_Alignerangle = 270;
  461. }
  462. else
  463. {
  464. m_Alignerangle = 180;
  465. }
  466. if (VCEIsInstalled == true)
  467. {
  468. TMModules.Add(SeTMModule.LP1);
  469. }
  470. if (AlignerIsInstalled == true)
  471. {
  472. TMModules.Add(SeTMModule.Aligner1);
  473. }
  474. PickSoltItemsSource.Add(1);
  475. PlaceSoltItemsSource.Add(1);
  476. ExtendSoltItemsSource.Add(1);
  477. RetractSoltItemsSource.Add(1);
  478. addDataKeys();
  479. RtDataValues = QueryDataClient.Instance.Service.PollData(m_RtDataKeys);
  480. VCEDoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "TM.VCESlitDoorClosed");
  481. PMADoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "TM.PMASlitDoorClosed");
  482. PMBDoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "TM.PMBSlitDoorClosed");
  483. PMCDoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "TM.PMCSlitDoorClosed");
  484. VCEOutDoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "VCE1.VCEOutDoorClosed");
  485. DispatcherTimer timer = new DispatcherTimer();
  486. timer.Interval = TimeSpan.FromSeconds(0.5);
  487. timer.Tick += Timer_Tick;
  488. timer.Start();
  489. }
  490. #endregion
  491. #region 命令方法
  492. private void addDataKeys()
  493. {
  494. m_RtDataKeys.Add($"TM.VCESlitDoorClosed");
  495. m_RtDataKeys.Add($"TM.PMASlitDoorClosed");
  496. m_RtDataKeys.Add($"TM.PMBSlitDoorClosed");
  497. m_RtDataKeys.Add($"TM.PMCSlitDoorClosed");
  498. m_RtDataKeys.Add($"VCE1.VCEOutDoorClosed");
  499. m_RtDataKeys.Add($"PMA.ChamberPressure");
  500. m_RtDataKeys.Add($"PMB.ChamberPressure");
  501. m_RtDataKeys.Add($"PMC.ChamberPressure");
  502. m_RtDataKeys.Add($"TM.VCEPressure.Value");
  503. m_RtDataKeys.Add($"VCE1.CassetteArrive");
  504. m_RtDataKeys.Add($"TMCycle.CycleIndex");
  505. }
  506. //模块选择根据obj选择下拉框内容
  507. private void OnModuleChange(object obj)
  508. {
  509. var value = obj.ToString();
  510. switch (value)
  511. {
  512. case "Pick":
  513. PickSoltItemsSource.Clear();
  514. if ((int)PickSelectedModule == 3)
  515. {
  516. for (int i = 1; i <= 25; i++)
  517. {
  518. PickSoltItemsSource.Add(i);
  519. }
  520. }
  521. else
  522. {
  523. PickSoltItemsSource.Add(1);
  524. }
  525. PickSoltSelectedIndex = 0;
  526. break;
  527. case "Place":
  528. PlaceSoltItemsSource.Clear();
  529. if ((int)PlaceSelectedModule == 3)
  530. {
  531. for (int i = 1; i <= 25; i++)
  532. {
  533. PlaceSoltItemsSource.Add(i);
  534. }
  535. }
  536. else
  537. {
  538. PlaceSoltItemsSource.Add(1);
  539. }
  540. PlaceSoltSelectedIndex = 0;
  541. break;
  542. case "Extend":
  543. ExtendSoltItemsSource.Clear();
  544. if ((int)ExtendSelectedModule == 3)
  545. {
  546. for (int i = 1; i <= 25; i++)
  547. {
  548. ExtendSoltItemsSource.Add(i);
  549. }
  550. }
  551. else
  552. {
  553. ExtendSoltItemsSource.Add(1);
  554. }
  555. ExtendSoltSelectedIndex = 0;
  556. break;
  557. case "Retract":
  558. RetractSoltItemsSource.Clear();
  559. if ((int)RetractSelectedModule == 3)
  560. {
  561. for (int i = 1; i <= 25; i++)
  562. {
  563. RetractSoltItemsSource.Add(i);
  564. }
  565. }
  566. else
  567. {
  568. RetractSoltItemsSource.Add(1);
  569. }
  570. RetractSoltSelectedIndex = 0;
  571. break;
  572. }
  573. }
  574. private void OnPick()
  575. {
  576. Queue<MoveItem> moveItems = new Queue<MoveItem>();
  577. var moduleName = (ModuleName)Enum.Parse(typeof(ModuleName), PickSelectedModule.ToString(), true);
  578. var selectedHand = (Hand)Enum.Parse(typeof(Hand), PickSelectedBlade.ToString(), true);
  579. MoveItem moveItem = new MoveItem(moduleName, PickSoltItemsSource[PickSoltSelectedIndex] - 1, ModuleName.TMRobot, 0, selectedHand);
  580. moveItems.Enqueue(moveItem);
  581. if ((int)PickSelectedModule < TMModules.Count - 2)
  582. {
  583. InvokeClient.Instance.Service.DoOperation($"TM.PMPick", moveItems);
  584. }
  585. else
  586. {
  587. InvokeClient.Instance.Service.DoOperation($"TM.Pick", moveItems);
  588. }
  589. }
  590. private void OnPlace()
  591. {
  592. Queue<MoveItem> moveItems = new Queue<MoveItem>();
  593. var moduleName = (ModuleName)Enum.Parse(typeof(ModuleName), PlaceSelectedModule.ToString(), true);
  594. var selectedHand = (Hand)Enum.Parse(typeof(Hand), PlaceSelectedBlade.ToString(), true);
  595. MoveItem moveItem = new MoveItem(ModuleName.TMRobot, 0, moduleName, PlaceSoltItemsSource[PlaceSoltSelectedIndex] - 1, selectedHand);
  596. moveItems.Enqueue(moveItem);
  597. if ((int)PlaceSelectedModule < TMModules.Count - 2)
  598. {
  599. InvokeClient.Instance.Service.DoOperation($"TM.PMPlace", moveItems);
  600. }
  601. //VCE、Aligner1
  602. else
  603. {
  604. InvokeClient.Instance.Service.DoOperation($"TM.Place", moveItems);
  605. }
  606. }
  607. private void OnExtend()
  608. {
  609. var moduleName = (ModuleName)Enum.Parse(typeof(ModuleName), ExtendSelectedModule.ToString(), true);
  610. var selectedHand = (Hand)Enum.Parse(typeof(Hand), ExtendSelectedBlade.ToString(), true);
  611. InvokeClient.Instance.Service.DoOperation($"TM.Extend", moduleName, ExtendSoltItemsSource[ExtendSoltSelectedIndex] - 1, selectedHand);
  612. }
  613. private void OnRetract()
  614. {
  615. //Queue<MoveItem> moveItems = new Queue<MoveItem>();
  616. var moduleName = (ModuleName)Enum.Parse(typeof(ModuleName), RetractSelectedModule.ToString(), true);
  617. var selectedHand = (Hand)Enum.Parse(typeof(Hand), RetractSelectedBlade.ToString(), true);
  618. //MoveItem moveItem = new MoveItem(moduleName, RetractSoltItemsSource[PickSoltSelectedIndex] - 1, 0, 0, selectedHand);
  619. //moveItems.Enqueue(moveItem);
  620. InvokeClient.Instance.Service.DoOperation($"TM.Retract", moduleName, RetractSoltItemsSource[PlaceSoltSelectedIndex] - 1, selectedHand);
  621. }
  622. //令选择的模块下发Home指令
  623. private void OnRobotHome()
  624. {
  625. InvokeClient.Instance.Service.DoOperation($"TM.Home", "TMRobot");
  626. }
  627. private void OnHome()
  628. {
  629. InvokeClient.Instance.Service.DoOperation($"TM.Home");
  630. }
  631. private void OnGoto()
  632. {
  633. var moduleName = (ModuleName)Enum.Parse(typeof(ModuleName), GotoSelectedModule.ToString(), true);
  634. var selectedHand = (Hand)Enum.Parse(typeof(Hand), GoToSelectedBlade.ToString(), true);
  635. InvokeClient.Instance.Service.DoOperation($"TM.Goto", moduleName, 0, selectedHand);
  636. }
  637. //Cycle
  638. private void OnStartCycle()
  639. {
  640. if (CycleEnable == false)
  641. {
  642. return;
  643. }
  644. List<string> stations = new List<string>();
  645. stations.Add("VCE1");
  646. stations.Add("Aligner1");
  647. if (PMAIsCycle == true)
  648. {
  649. stations.Add("PMA");
  650. }
  651. if (PMBIsCycle == true)
  652. {
  653. stations.Add("PMB");
  654. }
  655. if (PMCIsCycle == true)
  656. {
  657. stations.Add("PMC");
  658. }
  659. stations.Add("VCE1");
  660. InvokeClient.Instance.Service.DoOperation("System.SETMCycle", stations.ToArray(), CycleCount);
  661. }
  662. private void OnStopCycle()
  663. {
  664. InvokeClient.Instance.Service.DoOperation("System.SEAbort");
  665. }
  666. #endregion
  667. #region 私有方法
  668. private void Timer_Tick(object sender, EventArgs e)
  669. {
  670. TMModuleInfo = ModuleManager.ModuleInfos["TMRobot"];
  671. if (VCEIsInstalled)
  672. {
  673. }
  674. if (PMAIsInstalled == true)
  675. {
  676. ModuleInfo PMAModuleInfo = ModuleManager.ModuleInfos["PMA"];
  677. PMAWafer = PMAModuleInfo.WaferManager.Wafers[0];
  678. }
  679. if (PMBIsInstalled == true)
  680. {
  681. ModuleInfo PMBModuleInfo = ModuleManager.ModuleInfos["PMB"];
  682. PMBWafer = PMBModuleInfo.WaferManager.Wafers[0];
  683. }
  684. if (PMCIsInstalled == true)
  685. {
  686. ModuleInfo PMCModuleInfo = ModuleManager.ModuleInfos["PMC"];
  687. PMCWafer = PMCModuleInfo.WaferManager.Wafers[0];
  688. }
  689. RtDataValues = QueryDataClient.Instance.Service.PollData(m_RtDataKeys);
  690. VCEDoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "TM.VCESlitDoorClosed");
  691. PMADoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "TM.PMASlitDoorClosed");
  692. PMBDoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "TM.PMBSlitDoorClosed");
  693. PMCDoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "TM.PMCSlitDoorClosed");
  694. VCEOutDoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "VCE1.VCEOutDoorClosed");
  695. RobotMoveInfo = (RobotMoveInfo)QueryDataClient.Instance.Service.GetData("TM.RobotMoveAction");
  696. PAWafer = ModuleManager.ModuleInfos["Aligner1"].WaferManager.Wafers[0];
  697. RobotUpperWafer = TMModuleInfo.WaferManager.Wafers[0];
  698. RobotLowerWafer = TMModuleInfo.WaferManager.Wafers[1];
  699. PMAChamberLabel = QueryDataClient.Instance.Service.GetConfig($"PMA.ChamberLabel").ToString();
  700. PMBChamberLabel = QueryDataClient.Instance.Service.GetConfig($"PMB.ChamberLabel").ToString();
  701. PMCChamberLabel = QueryDataClient.Instance.Service.GetConfig($"PMC.ChamberLabel").ToString();
  702. PMDChamberLabel = QueryDataClient.Instance.Service.GetConfig($"PMD.ChamberLabel").ToString();
  703. }
  704. private async void RobotMoveInfoChanged(RobotMoveInfo oldValue, RobotMoveInfo newValue)
  705. {
  706. string RobotTarget;
  707. if (oldValue == null || newValue == null)
  708. {
  709. return;
  710. }
  711. #region Rotating
  712. if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && (newValue.Action == RobotAction.Rotating))
  713. {
  714. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  715. if (TMRobotMoveActionBladeTarget != null)
  716. {
  717. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  718. }
  719. else
  720. {
  721. return;
  722. }
  723. var values = RobotTarget.Split('.');
  724. var arm = values[0];
  725. var module = values[1];
  726. var SERobotTAction = (SERobotTAction)Enum.Parse(typeof(SERobotTAction), module, true);
  727. if (SERobotTAction != Robot1TAction || SERobotTAction != Robot2TAction)
  728. {
  729. Robot1TAction = SERobotTAction;
  730. Robot2TAction = SERobotTAction;
  731. }
  732. }
  733. #endregion
  734. #region Aligner1、VCE1 Pick、Place
  735. else if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && (newValue.Action == RobotAction.Placing || newValue.Action == RobotAction.Picking))
  736. {
  737. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  738. if (TMRobotMoveActionBladeTarget != null)
  739. {
  740. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  741. }
  742. else
  743. {
  744. return;
  745. }
  746. var values = RobotTarget.Split('.');
  747. var arm = values[0];
  748. var module = values[1];
  749. if (module == "Aligner1")
  750. {
  751. module = PMCIsInstalled ? "Aligner1" : "VPARight";
  752. }
  753. var SERobotTAction = (SERobotTAction)Enum.Parse(typeof(SERobotTAction), module, true);
  754. if (SERobotTAction != Robot1TAction || SERobotTAction != Robot2TAction)
  755. {
  756. Robot1TAction = SERobotTAction;
  757. Robot2TAction = SERobotTAction;
  758. }
  759. if (arm == "ArmA")
  760. {
  761. await Task.Delay(600);
  762. if (module == "VCE1")
  763. {
  764. Robot1XAction = SERobotXAction.ToVCE;
  765. while ((newValue.Action == RobotAction.Placing && ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[0].WaferStatus != 0) || (newValue.Action == RobotAction.Picking && ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[0].WaferStatus == 0))
  766. {
  767. await Task.Delay(100);
  768. }
  769. Robot1XAction = SERobotXAction.FromVCE;
  770. }
  771. else if (module == "Aligner1" || module == "VPARight")
  772. {
  773. Robot1XAction = SERobotXAction.ToAligner;
  774. while ((newValue.Action == RobotAction.Placing && ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[0].WaferStatus != 0) || (newValue.Action == RobotAction.Picking && ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[0].WaferStatus == 0))
  775. {
  776. await Task.Delay(100);
  777. }
  778. Robot1XAction = SERobotXAction.FromAligner;
  779. }
  780. else
  781. {
  782. Robot1XAction = SERobotXAction.Extend;
  783. while ((newValue.Action == RobotAction.Placing && ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[0].WaferStatus != 0) || (newValue.Action == RobotAction.Picking && ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[0].WaferStatus == 0))
  784. {
  785. await Task.Delay(100);
  786. }
  787. Robot1XAction = SERobotXAction.Retract;
  788. }
  789. }
  790. else if (arm == "ArmB")
  791. {
  792. await Task.Delay(600);
  793. if (module == "VCE1")
  794. {
  795. Robot2XAction = SERobotXAction.ToVCE2;
  796. while ((newValue.Action == RobotAction.Placing && ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[1].WaferStatus != 0) || (newValue.Action == RobotAction.Picking && ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[1].WaferStatus == 0))
  797. {
  798. await Task.Delay(100);
  799. }
  800. Robot2XAction = SERobotXAction.FromVCE2;
  801. }
  802. else if (module == "Aligner1" || module == "VPARight")
  803. {
  804. Robot2XAction = SERobotXAction.ToAligner2;
  805. while ((newValue.Action == RobotAction.Placing && ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[1].WaferStatus != 0) || (newValue.Action == RobotAction.Picking && ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[1].WaferStatus == 0))
  806. {
  807. await Task.Delay(100);
  808. }
  809. Robot2XAction = SERobotXAction.FromAligner2;
  810. }
  811. else
  812. {
  813. Robot2XAction = SERobotXAction.Extend2;
  814. while ((newValue.Action == RobotAction.Placing && ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[1].WaferStatus != 0) || (newValue.Action == RobotAction.Picking && ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[1].WaferStatus == 0))
  815. {
  816. await Task.Delay(100);
  817. }
  818. Robot2XAction = SERobotXAction.Retract2;
  819. }
  820. }
  821. }
  822. #endregion
  823. #region PM pick、PM place
  824. else if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && newValue.Action == RobotAction.Extending)
  825. {
  826. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  827. if (TMRobotMoveActionBladeTarget != null)
  828. {
  829. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  830. }
  831. else
  832. {
  833. return;
  834. }
  835. var values = RobotTarget.Split('.');
  836. var arm = values[0];
  837. var module = values[1];
  838. var SERobotTAction = (SERobotTAction)Enum.Parse(typeof(SERobotTAction), module, true);
  839. if (SERobotTAction != Robot1TAction || SERobotTAction != Robot2TAction)
  840. {
  841. Robot1TAction = SERobotTAction;
  842. Robot2TAction = SERobotTAction;
  843. }
  844. if (arm == "ArmA")
  845. {
  846. await Task.Delay(600);
  847. Robot1XAction = SERobotXAction.Extend;
  848. }
  849. else if (arm == "ArmB")
  850. {
  851. await Task.Delay(600);
  852. Robot2XAction = SERobotXAction.Extend2;
  853. }
  854. }
  855. else if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && newValue.Action == RobotAction.Retracting)
  856. {
  857. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  858. if (TMRobotMoveActionBladeTarget != null)
  859. {
  860. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  861. }
  862. else
  863. {
  864. return;
  865. }
  866. var values = RobotTarget.Split('.');
  867. var arm = values[0];
  868. if (arm == "ArmA")
  869. {
  870. await Task.Delay(100);
  871. Robot1XAction = SERobotXAction.Retract;
  872. }
  873. else if (arm == "ArmB")
  874. {
  875. await Task.Delay(100);
  876. Robot2XAction = SERobotXAction.Retract2;
  877. }
  878. }
  879. #endregion
  880. #region Home
  881. else if (oldValue.Action == RobotAction.None && newValue.Action == RobotAction.Homing)
  882. {
  883. if (Robot1XAction == SERobotXAction.Extend)
  884. {
  885. Robot1XAction = SERobotXAction.Retract;
  886. }
  887. if (Robot2XAction == SERobotXAction.Extend2)
  888. {
  889. Robot2XAction = SERobotXAction.Retract2;
  890. }
  891. await Task.Delay(2000);
  892. if (Robot1TAction != SERobotTAction.T_Origin)
  893. {
  894. Robot1TAction = SERobotTAction.T_Origin;
  895. }
  896. if (Robot2TAction != SERobotTAction.T_Origin)
  897. {
  898. Robot2TAction = SERobotTAction.T_Origin;
  899. }
  900. }
  901. #endregion
  902. }
  903. #endregion
  904. }
  905. }