VenusDETMViewModel.cs 37 KB

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