VenusDETMViewModel.cs 36 KB

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