VenusDETMViewModel.cs 41 KB

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