EfemViewModel.cs 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908
  1. using Aitex.Sorter.Common;
  2. using ExcelLibrary.BinaryFileFormat;
  3. using MECF.Framework.Common.CommonData;
  4. using MECF.Framework.Common.DataCenter;
  5. using MECF.Framework.Common.Equipment;
  6. using MECF.Framework.Common.OperationCenter;
  7. using MECF.Framework.Common.Schedulers;
  8. using OpenSEMI.ClientBase;
  9. using OpenSEMI.Ctrlib.Controls;
  10. using Prism.Commands;
  11. using Prism.Mvvm;
  12. using System;
  13. using System.Collections.Generic;
  14. using System.Collections.ObjectModel;
  15. using System.Linq;
  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 Venus_Themes.Unity;
  22. using static Venus_Themes.UserControls.EFEM;
  23. namespace Venus_MainPages.ViewModels
  24. {
  25. public enum EFEMModule
  26. {
  27. LLA, LLB,LP1,LP2,LP3,Aligner1
  28. }
  29. public enum EFEMBlade
  30. {
  31. Blade1, Blade2
  32. }
  33. internal class EfemViewModel:BindableBase
  34. {
  35. #region 私有字段
  36. private bool m_LLAIsInstalled;
  37. private bool m_LLBIsInstalled;
  38. private ModuleInfo m_LLAModuleInfo;
  39. private ModuleInfo m_LLBModuleInfo;
  40. private ModuleInfo m_LP1ModuleInfo;
  41. private ModuleInfo m_LP2ModuleInfo;
  42. private ModuleInfo m_LP3ModuleInfo;
  43. private ModuleInfo m_EFEMModuleInfo;
  44. private List<EFEMModule> m_EFEMModules = new List<EFEMModule>();
  45. private EFEMBlade m_PickSelectedBlade;
  46. private EFEMBlade m_PlaceSelectedBlade;
  47. private EFEMBlade m_ExtendSelectedBlade;
  48. private EFEMBlade m_RetractSelectedBlade;
  49. private ObservableCollection<int> m_PlaceSoltItemsSource = new ObservableCollection<int>();
  50. private ObservableCollection<int> m_PickSoltItemsSource = new ObservableCollection<int>();
  51. private ObservableCollection<int> m_ExtendSoltItemsSource = new ObservableCollection<int>();
  52. private ObservableCollection<int> m_RetractSoltItemsSource = new ObservableCollection<int>();
  53. private int m_PickSoltSelectedIndex;
  54. private int m_PlaceSoltSelectedIndex;
  55. private int m_ExtendSoltSelectedIndex;
  56. private int m_RetractSoltSelectedIndex;
  57. private EFEMModule m_PickSelectedModule;
  58. private EFEMModule m_PlaceSelectedModule;
  59. private EFEMModule m_ExtendSelectedModule;
  60. private EFEMModule m_RetractSelectedModule;
  61. private WaferInfo m_BladeAWafer;
  62. private WaferInfo m_BladeBWafer;
  63. private WaferInfo m_LLAWafer;
  64. private WaferInfo m_LLBWafer;
  65. private WaferInfo m_Aligner1Wafer;
  66. private string m_LP1Status;
  67. private string m_LP2Status;
  68. private string m_LP3Status;
  69. private List<string> m_RtDataKeys=new List<string>();
  70. private Dictionary<string, object> m_RtDataValues;
  71. private int m_AlignValue;
  72. private WaferRobotTAction m_Robot1TAction;
  73. private WaferRobotXAction m_Robot1XAction;
  74. private WaferRobotTAction m_Robot2TAction;
  75. private WaferRobotXAction m_Robot2XAction;
  76. //int arm1oldWaferStatus = 100;
  77. //int arm2oldWaferStatus = 100;
  78. private RobotPosition m_CurrentRobotPosition;
  79. #endregion
  80. #region 属性
  81. public bool LLAIsInstalled
  82. {
  83. get { return m_LLAIsInstalled; }
  84. set { SetProperty(ref m_LLAIsInstalled, value); }
  85. }
  86. public bool LLBIsInstalled
  87. {
  88. get { return m_LLBIsInstalled; }
  89. set { SetProperty(ref m_LLBIsInstalled, value); }
  90. }
  91. public ModuleInfo LLAModuleInfo
  92. {
  93. get { return m_LLAModuleInfo; }
  94. set { SetProperty(ref m_LLAModuleInfo, value); }
  95. }
  96. public ModuleInfo LLBModuleInfo
  97. {
  98. get { return m_LLBModuleInfo; }
  99. set { SetProperty(ref m_LLBModuleInfo, value); }
  100. }
  101. public ModuleInfo LP1ModuleInfo
  102. {
  103. get { return m_LP1ModuleInfo; }
  104. set { SetProperty(ref m_LP1ModuleInfo, value); }
  105. }
  106. public ModuleInfo LP2ModuleInfo
  107. {
  108. get { return m_LP2ModuleInfo; }
  109. set { SetProperty(ref m_LP2ModuleInfo, value); }
  110. }
  111. public ModuleInfo LP3ModuleInfo
  112. {
  113. get { return m_LP3ModuleInfo; }
  114. set { SetProperty(ref m_LP3ModuleInfo, value); }
  115. }
  116. public ModuleInfo EFEMModuleInfo
  117. {
  118. get { return m_EFEMModuleInfo; }
  119. set { SetProperty(ref m_EFEMModuleInfo, value); }
  120. }
  121. public List<EFEMModule> EFEMModules
  122. {
  123. get { return m_EFEMModules; }
  124. set { SetProperty(ref m_EFEMModules, value); }
  125. }
  126. public EFEMBlade PickSelectedBlade
  127. {
  128. get { return m_PickSelectedBlade; }
  129. set { SetProperty(ref m_PickSelectedBlade, value); }
  130. }
  131. public EFEMBlade PlaceSelectedBlade
  132. {
  133. get { return m_PlaceSelectedBlade; }
  134. set { SetProperty(ref m_PlaceSelectedBlade, value); }
  135. }
  136. public EFEMBlade ExtendSelectedBlade
  137. {
  138. get { return m_ExtendSelectedBlade; }
  139. set { SetProperty(ref m_ExtendSelectedBlade, value); }
  140. }
  141. public EFEMBlade RetractSelectedBlade
  142. {
  143. get { return m_RetractSelectedBlade; }
  144. set { SetProperty(ref m_RetractSelectedBlade, value); }
  145. }
  146. public ObservableCollection<int> PickSoltItemsSource
  147. {
  148. get { return m_PickSoltItemsSource; }
  149. set { SetProperty(ref m_PickSoltItemsSource, value); }
  150. }
  151. public ObservableCollection<int> PlaceSoltItemsSource
  152. {
  153. get { return m_PlaceSoltItemsSource; }
  154. set { SetProperty(ref m_PlaceSoltItemsSource, value); }
  155. }
  156. public ObservableCollection<int> ExtendSoltItemsSource
  157. {
  158. get { return m_ExtendSoltItemsSource; }
  159. set { SetProperty(ref m_ExtendSoltItemsSource, value); }
  160. }
  161. public ObservableCollection<int> RetractSoltItemsSource
  162. {
  163. get { return m_RetractSoltItemsSource; }
  164. set { SetProperty(ref m_RetractSoltItemsSource, value); }
  165. }
  166. public int PickSoltSelectedIndex
  167. {
  168. get { return m_PickSoltSelectedIndex; }
  169. set { SetProperty(ref m_PickSoltSelectedIndex, value); }
  170. }
  171. public int PlaceSoltSelectedIndex
  172. {
  173. get { return m_PlaceSoltSelectedIndex; }
  174. set { SetProperty(ref m_PlaceSoltSelectedIndex, value); }
  175. }
  176. public int ExtendSoltSelectedIndex
  177. {
  178. get { return m_ExtendSoltSelectedIndex; }
  179. set { SetProperty(ref m_ExtendSoltSelectedIndex, value); }
  180. }
  181. public int RetractSoltSelectedIndex
  182. {
  183. get { return m_RetractSoltSelectedIndex; }
  184. set { SetProperty(ref m_RetractSoltSelectedIndex, value); }
  185. }
  186. public EFEMModule PickSelectedModule
  187. {
  188. get { return m_PickSelectedModule; }
  189. set { SetProperty(ref m_PickSelectedModule, value); }
  190. }
  191. public EFEMModule PlaceSelectedModule
  192. {
  193. get { return m_PlaceSelectedModule; }
  194. set { SetProperty(ref m_PlaceSelectedModule, value); }
  195. }
  196. public EFEMModule ExtendSelectedModule
  197. {
  198. get { return m_ExtendSelectedModule; }
  199. set { SetProperty(ref m_ExtendSelectedModule, value); }
  200. }
  201. public EFEMModule RetractSelectedModule
  202. {
  203. get { return m_RetractSelectedModule; }
  204. set { SetProperty(ref m_RetractSelectedModule, value); }
  205. }
  206. public WaferInfo BladeAWafer
  207. {
  208. get { return m_BladeAWafer; }
  209. set { SetProperty(ref m_BladeAWafer, value); }
  210. }
  211. public WaferInfo BladeBWafer
  212. {
  213. get { return m_BladeBWafer; }
  214. set { SetProperty(ref m_BladeBWafer, value); }
  215. }
  216. public WaferInfo Aligner1Wafer
  217. {
  218. get { return m_Aligner1Wafer; }
  219. set { SetProperty(ref m_Aligner1Wafer, value); }
  220. }
  221. public WaferInfo LLAWafer
  222. {
  223. get { return m_LLAWafer; }
  224. set { SetProperty(ref m_LLAWafer, value); }
  225. }
  226. public WaferInfo LLBWafer
  227. {
  228. get { return m_LLBWafer; }
  229. set { SetProperty(ref m_LLBWafer, value); }
  230. }
  231. public string LP1Status
  232. {
  233. get { return m_LP1Status; }
  234. set { SetProperty(ref m_LP1Status, value); }
  235. }
  236. public string LP2Status
  237. {
  238. get { return m_LP2Status; }
  239. set { SetProperty(ref m_LP2Status, value); }
  240. }
  241. public string LP3Status
  242. {
  243. get { return m_LP3Status; }
  244. set { SetProperty(ref m_LP3Status, value); }
  245. }
  246. public Dictionary<string, object> RtDataValues
  247. {
  248. get { return m_RtDataValues; }
  249. set { SetProperty(ref m_RtDataValues, value); }
  250. }
  251. public int AlignValue
  252. {
  253. get { return m_AlignValue; }
  254. set { SetProperty(ref m_AlignValue, value); }
  255. }
  256. public WaferRobotTAction Robot1TAction
  257. {
  258. get { return m_Robot1TAction; }
  259. set { SetProperty(ref m_Robot1TAction, value); }
  260. }
  261. public WaferRobotXAction Robot1XAction
  262. {
  263. get { return m_Robot1XAction; }
  264. set { SetProperty(ref m_Robot1XAction, value); }
  265. }
  266. public WaferRobotTAction Robot2TAction
  267. {
  268. get { return m_Robot2TAction; }
  269. set { SetProperty(ref m_Robot2TAction, value); }
  270. }
  271. public WaferRobotXAction Robot2XAction
  272. {
  273. get { return m_Robot2XAction; }
  274. set { SetProperty(ref m_Robot2XAction, value); }
  275. }
  276. private string m_RobotTarget;
  277. public string RobotTarget
  278. {
  279. get { return m_RobotTarget; }
  280. set
  281. {
  282. SetProperty(ref m_RobotTarget, value);
  283. }
  284. }
  285. public RobotMoveInfo m_robotMoveInfo;
  286. public RobotMoveInfo RobotMoveInfo
  287. {
  288. get { return m_robotMoveInfo; }
  289. set
  290. {
  291. RobotMoveInfoChanged(m_robotMoveInfo, value);
  292. m_robotMoveInfo = value;
  293. }
  294. }
  295. public RobotPosition CurrentRobotPosition
  296. {
  297. get { return m_CurrentRobotPosition; }
  298. set { SetProperty(ref m_CurrentRobotPosition, value); }
  299. }
  300. #endregion
  301. #region 命令
  302. private DelegateCommand _ExtendCommand;
  303. public DelegateCommand ExtendCommand =>
  304. _ExtendCommand ?? (_ExtendCommand = new DelegateCommand(OnExtend));
  305. private DelegateCommand _RetractCommand;
  306. public DelegateCommand RetractCommand =>
  307. _RetractCommand ?? (_RetractCommand = new DelegateCommand(OnRetract));
  308. private DelegateCommand<object> _ModuleChangeCommand;
  309. public DelegateCommand<object> ModuleChangeCommand =>
  310. _ModuleChangeCommand ?? (_ModuleChangeCommand = new DelegateCommand<object>(OnModuleChange));
  311. private DelegateCommand _PickCommand;
  312. public DelegateCommand PickCommand =>
  313. _PickCommand ?? (_PickCommand = new DelegateCommand(OnPick));
  314. private DelegateCommand _PlaceCommand;
  315. public DelegateCommand PlaceCommand =>
  316. _PlaceCommand ?? (_PlaceCommand = new DelegateCommand(OnPlace));
  317. private DelegateCommand _HomeAllCommand;
  318. public DelegateCommand HomeAllCommand =>
  319. _HomeAllCommand ?? (_HomeAllCommand = new DelegateCommand(OnHomeAll));
  320. private DelegateCommand _ClearErrorCommand;
  321. public DelegateCommand ClearErrorCommand =>
  322. _ClearErrorCommand ?? (_ClearErrorCommand = new DelegateCommand(OnClearError));
  323. private DelegateCommand _AbortCommand;
  324. public DelegateCommand AbortCommand =>
  325. _AbortCommand ?? (_AbortCommand = new DelegateCommand(OnAbort));
  326. private DelegateCommand _Align1HomeCommand;
  327. public DelegateCommand Align1HomeCommand =>
  328. _Align1HomeCommand ?? (_Align1HomeCommand = new DelegateCommand(OnAlign1Home));
  329. private DelegateCommand _Align1UpCommand;
  330. public DelegateCommand Align1UpCommand =>
  331. _Align1UpCommand ?? (_Align1UpCommand = new DelegateCommand(OnAlign1Up));
  332. private DelegateCommand _Align1DownCommand;
  333. public DelegateCommand Align1DownCommand =>
  334. _Align1DownCommand ?? (_Align1DownCommand = new DelegateCommand(OnAlign1Down));
  335. private DelegateCommand _Align1AlignCommand;
  336. public DelegateCommand Align1AlignCommand =>
  337. _Align1AlignCommand ?? (_Align1AlignCommand = new DelegateCommand(OnAlign1Align));
  338. private DelegateCommand _RobotHomeCommand;
  339. public DelegateCommand RobotHomeCommand =>
  340. _RobotHomeCommand ?? (_RobotHomeCommand = new DelegateCommand(OnRobotHome));
  341. private DelegateCommand<object> _LPHomeCommand;
  342. public DelegateCommand<object> LPHomeCommand =>
  343. _LPHomeCommand ?? (_LPHomeCommand = new DelegateCommand<object>(OnLPHome));
  344. private DelegateCommand<object> _LPAbortCommand;
  345. public DelegateCommand<object> LPAbortCommand =>
  346. _LPAbortCommand ?? (_LPAbortCommand = new DelegateCommand<object>(OnLPAbort));
  347. private DelegateCommand<object> _LPResetCommand;
  348. public DelegateCommand<object> LPResetCommand =>
  349. _LPResetCommand ?? (_LPResetCommand = new DelegateCommand<object>(OnLPReset));
  350. private DelegateCommand<object> _LPLoadCommand;
  351. public DelegateCommand<object> LPLoadCommand =>
  352. _LPLoadCommand ?? (_LPLoadCommand = new DelegateCommand<object>(OnLPLoad));
  353. private DelegateCommand<object> _LPUnLoadCommand;
  354. public DelegateCommand<object> LPUnLoadCommand =>
  355. _LPUnLoadCommand ?? (_LPUnLoadCommand = new DelegateCommand<object>(OnLPUnLoad));
  356. private DelegateCommand<object> _LPReadIDCommand;
  357. public DelegateCommand<object> LPReadIDCommand =>
  358. _LPReadIDCommand ?? (_LPReadIDCommand = new DelegateCommand<object>(OnLPReadID));
  359. private DelegateCommand<object> _LPClampCommand;
  360. public DelegateCommand<object> LPClampCommand =>
  361. _LPClampCommand ?? (_LPClampCommand = new DelegateCommand<object>(OnLPClamp));
  362. private DelegateCommand<object> _LPUnClampCommand;
  363. public DelegateCommand<object> LPUnClampCommand =>
  364. _LPUnClampCommand ?? (_LPUnClampCommand = new DelegateCommand<object>(OnLPUnClamp));
  365. private DelegateCommand<object> _LPDockCommand;
  366. public DelegateCommand<object> LPDockCommand =>
  367. _LPDockCommand ?? (_LPDockCommand = new DelegateCommand<object>(OnLPDock));
  368. private DelegateCommand<object> _LPUnDockCommand;
  369. public DelegateCommand<object> LPUnDockCommand =>
  370. _LPUnDockCommand ?? (_LPUnDockCommand = new DelegateCommand<object>(OnLPUnDock));
  371. private DelegateCommand<object> _LPOpenDoorCommand;
  372. public DelegateCommand<object> LPOpenDoorCommand =>
  373. _LPOpenDoorCommand ?? (_LPOpenDoorCommand = new DelegateCommand<object>(OnLPOpenDoor));
  374. private DelegateCommand<object> _LPCloseDoorCommand;
  375. public DelegateCommand<object> LPCloseDoorCommand =>
  376. _LPCloseDoorCommand ?? (_LPCloseDoorCommand = new DelegateCommand<object>(OnLPCloseDoor));
  377. private DelegateCommand _OnlineCommand;
  378. public DelegateCommand OnlineCommand =>
  379. _OnlineCommand ?? (_OnlineCommand = new DelegateCommand(OnOnline));
  380. private DelegateCommand _OfflineCommand;
  381. public DelegateCommand OfflineCommand =>
  382. _OfflineCommand ?? (_OfflineCommand = new DelegateCommand(OnOffline));
  383. #endregion
  384. #region 构造函数
  385. public EfemViewModel()
  386. {
  387. string[] allModules = QueryDataClient.Instance.Service.GetConfig($"System.InstalledModules").ToString().Split(',');
  388. LLAIsInstalled = allModules.Contains("LLA");
  389. LLBIsInstalled = allModules.Contains("LLB");
  390. DispatcherTimer timer = new DispatcherTimer();
  391. timer.Interval = TimeSpan.FromSeconds(0.1);
  392. timer.Tick += Timer_Tick;
  393. timer.Start();
  394. EFEMModules.Add(EFEMModule.LLA);
  395. EFEMModules.Add(EFEMModule.LLB);
  396. EFEMModules.Add(EFEMModule.LP1);
  397. EFEMModules.Add(EFEMModule.LP2);
  398. EFEMModules.Add(EFEMModule.LP3);
  399. EFEMModules.Add(EFEMModule.Aligner1);
  400. OnModuleChange("Pick");
  401. OnModuleChange("Place");
  402. Init();
  403. }
  404. #endregion
  405. #region 命令方法
  406. private void OnModuleChange(object obj)
  407. {
  408. var value = obj.ToString();
  409. switch (value)
  410. {
  411. case "Pick":
  412. PickSoltItemsSource.Clear();
  413. switch (PickSelectedModule)
  414. {
  415. case EFEMModule.LLA:
  416. case EFEMModule.LLB:
  417. PickSoltItemsSource.Add(1);
  418. PickSoltItemsSource.Add(2);
  419. break;
  420. case EFEMModule.LP1:
  421. case EFEMModule.LP2:
  422. case EFEMModule.LP3:
  423. for (int i = 1; i < 26; i++)
  424. {
  425. PickSoltItemsSource.Add(i);
  426. }
  427. break;
  428. default:
  429. PickSoltItemsSource.Add(1);
  430. break;
  431. }
  432. PickSoltSelectedIndex = 0;
  433. break;
  434. case "Place":
  435. PlaceSoltItemsSource.Clear();
  436. switch (PlaceSelectedModule)
  437. {
  438. case EFEMModule.LLA:
  439. case EFEMModule.LLB:
  440. PlaceSoltItemsSource.Add(1);
  441. PlaceSoltItemsSource.Add(2);
  442. break;
  443. case EFEMModule.LP1:
  444. case EFEMModule.LP2:
  445. case EFEMModule.LP3:
  446. for (int i = 1; i < 26; i++)
  447. {
  448. PlaceSoltItemsSource.Add(i);
  449. }
  450. break;
  451. default:
  452. PlaceSoltItemsSource.Add(1);
  453. break;
  454. }
  455. PlaceSoltSelectedIndex = 0;
  456. break;
  457. //case "Extend":
  458. // ExtendSoltItemsSource.Clear();
  459. // switch (ExtendSelectedModule)
  460. // {
  461. // case EFEMModule.LLA:
  462. // case EFEMModule.LLB:
  463. // ExtendSoltItemsSource.Add(1);
  464. // ExtendSoltItemsSource.Add(2);
  465. // break;
  466. // case EFEMModule.LP1:
  467. // case EFEMModule.LP2:
  468. // case EFEMModule.LP3:
  469. // for (int i = 1; i < 26; i++)
  470. // {
  471. // ExtendSoltItemsSource.Add(i);
  472. // }
  473. // break;
  474. // default:
  475. // ExtendSoltItemsSource.Add(1);
  476. // break;
  477. // }
  478. // ExtendSoltSelectedIndex = 0;
  479. // break;
  480. //case "Retract":
  481. // RetractSoltItemsSource.Clear();
  482. // switch (RetractSelectedModule)
  483. // {
  484. // case EFEMModule.LLA:
  485. // case EFEMModule.LLB:
  486. // RetractSoltItemsSource.Add(1);
  487. // RetractSoltItemsSource.Add(2);
  488. // break;
  489. // case EFEMModule.LP1:
  490. // case EFEMModule.LP2:
  491. // case EFEMModule.LP3:
  492. // for (int i = 1; i < 26; i++)
  493. // {
  494. // RetractSoltItemsSource.Add(i);
  495. // }
  496. // break;
  497. // default:
  498. // RetractSoltItemsSource.Add(1);
  499. // break;
  500. // }
  501. // RetractSoltSelectedIndex = 0;
  502. // break;
  503. }
  504. }
  505. private void OnExtend()
  506. {
  507. var moduleName = (ModuleName)Enum.Parse(typeof(ModuleName), PlaceSelectedModule.ToString(), true);
  508. var selectedHand = (Hand)Enum.Parse(typeof(Hand), PlaceSelectedBlade.ToString(), true);
  509. InvokeClient.Instance.Service.DoOperation($"EFEM.{RtOperation.Extend}", moduleName, 0, selectedHand);
  510. }
  511. private void OnRetract()
  512. {
  513. var moduleName = (ModuleName)Enum.Parse(typeof(ModuleName), PlaceSelectedModule.ToString(), true);
  514. var selectedHand = (Hand)Enum.Parse(typeof(Hand), PlaceSelectedBlade.ToString(), true);
  515. InvokeClient.Instance.Service.DoOperation($"EFEM.{RtOperation.Retract}", moduleName, 0, selectedHand);
  516. }
  517. private void OnPick()
  518. {
  519. Queue<MoveItem> moveItems = new Queue<MoveItem>();
  520. var moduleName = (ModuleName)Enum.Parse(typeof(ModuleName), PickSelectedModule.ToString(), true);
  521. var selectedHand = (Hand)Enum.Parse(typeof(Hand), PickSelectedBlade.ToString(), true);
  522. MoveItem moveItem = new MoveItem(moduleName, PickSoltItemsSource[PickSoltSelectedIndex]-1, ModuleName.EfemRobot, 0, selectedHand);
  523. moveItems.Enqueue(moveItem);
  524. if (PickSelectedModule == EFEMModule.LLA || PickSelectedModule == EFEMModule.LLB)
  525. {
  526. InvokeClient.Instance.Service.DoOperation($"{ModuleName.EfemRobot}.{EfemOperation.Swap}", moveItems);
  527. }
  528. else
  529. {
  530. InvokeClient.Instance.Service.DoOperation($"{ModuleName.EfemRobot}.{EfemOperation.Pick}", moveItems);
  531. }
  532. //if ((int)PickSelectedModule > 3)
  533. //{
  534. // InvokeClient.Instance.Service.DoOperation($"EFEM.{RtOperation.LLPick}", moveItems);
  535. //}
  536. //else
  537. //{
  538. // InvokeClient.Instance.Service.DoOperation($"EFEM.{RtOperation.PMPick}", moveItems);
  539. //}
  540. }
  541. private void OnPlace()
  542. {
  543. Queue<MoveItem> moveItems = new Queue<MoveItem>();
  544. var moduleName = (ModuleName)Enum.Parse(typeof(ModuleName), PlaceSelectedModule.ToString(), true);
  545. var selectedHand = (Hand)Enum.Parse(typeof(Hand), PlaceSelectedBlade.ToString(), true);
  546. MoveItem moveItem = new MoveItem(ModuleName.EfemRobot, 0, moduleName, PlaceSoltItemsSource[PlaceSoltSelectedIndex]-1, selectedHand);
  547. moveItems.Enqueue(moveItem);
  548. //if ((int)PlaceSelectedModule > 3)
  549. //{
  550. // InvokeClient.Instance.Service.DoOperation($"TM.{RtOperation.LLPlace}", moveItems);
  551. //}
  552. //else
  553. //{
  554. // InvokeClient.Instance.Service.DoOperation($"TM.{RtOperation.PMPlace}", moveItems);
  555. //}
  556. if (PlaceSelectedModule == EFEMModule.LLA || PlaceSelectedModule == EFEMModule.LLB)
  557. {
  558. InvokeClient.Instance.Service.DoOperation($"{ModuleName.EfemRobot}.{EfemOperation.Swap}", moveItems);
  559. }
  560. else
  561. {
  562. InvokeClient.Instance.Service.DoOperation($"{ModuleName.EfemRobot}.{EfemOperation.Place}", moveItems);
  563. }
  564. }
  565. private void OnHomeAll()
  566. {
  567. InvokeClient.Instance.Service.DoOperation($"EFEM.{EfemOperation.Home}");
  568. }
  569. private void OnClearError()
  570. {
  571. InvokeClient.Instance.Service.DoOperation($"EFEM.{EfemOperation.ClearError}");
  572. }
  573. private void OnAbort()
  574. {
  575. InvokeClient.Instance.Service.DoOperation($"{ModuleName.EfemRobot}.{EfemOperation.Abort}");
  576. }
  577. private void OnAlign1Home()
  578. {
  579. InvokeClient.Instance.Service.DoOperation($"{ModuleName.Aligner1}.{EfemOperation.Home}");
  580. }
  581. private void OnAlign1Up()
  582. {
  583. InvokeClient.Instance.Service.DoOperation($"{ModuleName.Aligner1}.{EfemOperation.Lift}", true);
  584. }
  585. private void OnAlign1Down()
  586. {
  587. InvokeClient.Instance.Service.DoOperation($"{ModuleName.Aligner1}.{EfemOperation.Lift}", false);
  588. }
  589. private void OnAlign1Align()
  590. {
  591. InvokeClient.Instance.Service.DoOperation($"{ModuleName.Aligner1}.{EfemOperation.Align}",0, AlignValue);
  592. }
  593. private void OnRobotHome()
  594. {
  595. InvokeClient.Instance.Service.DoOperation($"{ModuleName.EfemRobot}.{EfemOperation.Home}");
  596. }
  597. private void OnLPHome(object obj)
  598. {
  599. InvokeClient.Instance.Service.DoOperation($"{obj.ToString()}.Home");
  600. }
  601. private void OnLPAbort(object obj)
  602. {
  603. InvokeClient.Instance.Service.DoOperation($"{obj.ToString()}.Abort");
  604. }
  605. private void OnLPReset(object obj)
  606. {
  607. //InvokeClient.Instance.Service.DoOperation($"{obj.ToString()}.ReSet");
  608. }
  609. private void OnLPLoad(object obj)
  610. {
  611. InvokeClient.Instance.Service.DoOperation($"{obj.ToString()}.Load");
  612. }
  613. private void OnLPUnLoad(object obj)
  614. {
  615. InvokeClient.Instance.Service.DoOperation($"{obj.ToString()}.Unload");
  616. }
  617. private void OnLPReadID(object obj)
  618. {
  619. InvokeClient.Instance.Service.DoOperation($"{obj.ToString()}.ReadCarrierId");
  620. }
  621. private void OnLPClamp(object obj)
  622. {
  623. InvokeClient.Instance.Service.DoOperation($"{obj.ToString()}.Clamp");
  624. }
  625. private void OnLPUnClamp(object obj)
  626. {
  627. InvokeClient.Instance.Service.DoOperation($"{obj.ToString()}.Unclamp");
  628. }
  629. private void OnLPDock(object obj)
  630. {
  631. InvokeClient.Instance.Service.DoOperation($"{obj.ToString()}.Dock");
  632. }
  633. private void OnLPUnDock(object obj)
  634. {
  635. InvokeClient.Instance.Service.DoOperation($"{obj.ToString()}.Undock");
  636. }
  637. private void OnLPOpenDoor(object obj)
  638. {
  639. InvokeClient.Instance.Service.DoOperation($"{obj.ToString()}.OpenDoor");
  640. }
  641. private void OnLPCloseDoor(object obj)
  642. {
  643. InvokeClient.Instance.Service.DoOperation($"{obj.ToString()}.CloseDoor");
  644. }
  645. private void OnOnline()
  646. {
  647. InvokeClient.Instance.Service.DoOperation($"{ModuleName.EFEM}.Online",true);
  648. }
  649. private void OnOffline()
  650. {
  651. InvokeClient.Instance.Service.DoOperation($"{ModuleName.EFEM}.Online", false);
  652. }
  653. #endregion
  654. #region 私有方法
  655. private void Timer_Tick(object sender, EventArgs e)
  656. {
  657. if (LLAIsInstalled == true)
  658. {
  659. LLAWafer = ModuleManager.ModuleInfos["LLA"].WaferManager.Wafers.FirstOrDefault(x => x.WaferStatus != 0);
  660. LLAModuleInfo = ModuleManager.ModuleInfos["LLA"];
  661. }
  662. if (LLBIsInstalled == true)
  663. {
  664. LLBWafer = ModuleManager.ModuleInfos["LLB"].WaferManager.Wafers.FirstOrDefault(x => x.WaferStatus != 0);
  665. LLBModuleInfo = ModuleManager.ModuleInfos["LLB"];
  666. }
  667. LP1ModuleInfo = ModuleManager.ModuleInfos["LP1"];
  668. LP2ModuleInfo = ModuleManager.ModuleInfos["LP2"];
  669. LP3ModuleInfo = ModuleManager.ModuleInfos["LP3"];
  670. EFEMModuleInfo = ModuleManager.ModuleInfos["EfemRobot"];
  671. BladeAWafer = ModuleManager.ModuleInfos["EfemRobot"].WaferManager.Wafers[0];
  672. BladeBWafer = ModuleManager.ModuleInfos["EfemRobot"].WaferManager.Wafers[1];
  673. Aligner1Wafer= ModuleManager.ModuleInfos["Aligner1"].WaferManager.Wafers[0];
  674. RtDataValues = QueryDataClient.Instance.Service.PollData(m_RtDataKeys);
  675. RobotMoveInfo = (RobotMoveInfo)QueryDataClient.Instance.Service.GetData("EFEM.RobotMoveAction");
  676. }
  677. private void Init()
  678. {
  679. m_RtDataKeys.Add("LP1.Status");
  680. m_RtDataKeys.Add("LP2.Status");
  681. m_RtDataKeys.Add("LP3.Status");
  682. m_RtDataKeys.Add("LP1.IsLoaded");
  683. m_RtDataKeys.Add("LP2.IsLoaded");
  684. m_RtDataKeys.Add("LP3.IsLoaded");
  685. m_RtDataKeys.Add("LP1.CarrierId");
  686. m_RtDataKeys.Add("LP2.CarrierId");
  687. m_RtDataKeys.Add("LP3.CarrierId");
  688. m_RtDataKeys.Add("LP1.IsClamped");
  689. m_RtDataKeys.Add("LP2.IsClamped");
  690. m_RtDataKeys.Add("LP3.IsClamped");
  691. m_RtDataKeys.Add("LP1.IsDocked");
  692. m_RtDataKeys.Add("LP2.IsDocked");
  693. m_RtDataKeys.Add("LP3.IsDocked");
  694. m_RtDataKeys.Add("TM.LLATSlitDoor.IsClosed");
  695. m_RtDataKeys.Add("TM.LLBTSlitDoor.IsClosed");
  696. m_RtDataKeys.Add("TM.LLAESlitDoor.IsClosed");
  697. m_RtDataKeys.Add("TM.LLBESlitDoor.IsClosed");
  698. m_RtDataKeys.Add("LP1.CassettePlaced");
  699. m_RtDataKeys.Add("LP2.CassettePlaced");
  700. m_RtDataKeys.Add("LP3.CassettePlaced");
  701. m_RtDataKeys.Add("EFEM.IsOnline");
  702. }
  703. //private void UIEvents_PMDoorRaiseChangedEvent(DoorPara obj)
  704. //{
  705. // InvokeClient.Instance.Service.DoOperation($"{obj?.ModuleName}.SlitDoor.{obj?.IsOpen}");
  706. //}
  707. //private void UIEvents_LLTDoorRaiseChangedEvent(DoorPara obj)
  708. //{
  709. // InvokeClient.Instance.Service.DoOperation($"TM.{obj.ModuleName}TSlitDoor.{obj?.IsOpen}");
  710. //}
  711. //private void UIEvents_LLEDoorRaiseChangedEvent(DoorPara obj)
  712. //{
  713. // InvokeClient.Instance.Service.DoOperation($"TM.{obj.ModuleName}ESlitDoor.{obj?.IsOpen}");
  714. //}
  715. private async void RobotMoveInfoChanged(RobotMoveInfo oldValue, RobotMoveInfo newValue)
  716. {
  717. if (oldValue == null || newValue == null)
  718. {
  719. return;
  720. }
  721. if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && (newValue.Action == RobotAction.Placing || newValue.Action == RobotAction.Picking))
  722. {
  723. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  724. if (TMRobotMoveActionBladeTarget != null)
  725. {
  726. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  727. }
  728. else
  729. {
  730. return;
  731. }
  732. var values = RobotTarget.Split('.');
  733. var arm = values[0];
  734. var module = values[1];
  735. if (arm == "ArmA")
  736. {
  737. var robot1Robot1TAction= (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  738. await ChangePosition(robot1Robot1TAction);
  739. if (Robot1TAction != robot1Robot1TAction)
  740. {
  741. Robot1TAction = robot1Robot1TAction;
  742. await Task.Delay(600);
  743. }
  744. //await Task.Delay(1500);
  745. Robot1XAction = WaferRobotXAction.Extend;
  746. while ((newValue.Action == RobotAction.Placing && ModuleManager.ModuleInfos["EfemRobot"].WaferManager.Wafers[0].WaferStatus != 0) || (newValue.Action == RobotAction.Picking && ModuleManager.ModuleInfos["EfemRobot"].WaferManager.Wafers[0].WaferStatus == 0))
  747. {
  748. await Task.Delay(100);
  749. }
  750. Robot1XAction = WaferRobotXAction.Retract;
  751. }
  752. else if (arm == "ArmB")
  753. {
  754. var robot2Robot1TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  755. await ChangePosition(robot2Robot1TAction);
  756. //Robot2TAction = robot2Robot1TAction;
  757. //await Task.Delay(1500);
  758. if (Robot2TAction != robot2Robot1TAction)
  759. {
  760. Robot2TAction = robot2Robot1TAction;
  761. await Task.Delay(600);
  762. }
  763. Robot2XAction = WaferRobotXAction.Extend;
  764. while ((newValue.Action == RobotAction.Placing && ModuleManager.ModuleInfos["EfemRobot"].WaferManager.Wafers[1].WaferStatus != 0) || (newValue.Action == RobotAction.Picking && ModuleManager.ModuleInfos["EfemRobot"].WaferManager.Wafers[1].WaferStatus == 0))
  765. {
  766. await Task.Delay(100);
  767. }
  768. Robot2XAction = WaferRobotXAction.Retract;
  769. }
  770. }
  771. #region Home
  772. else if (oldValue.Action == RobotAction.None && newValue.Action == RobotAction.Homing)
  773. {
  774. if (Robot1XAction == WaferRobotXAction.Extend)
  775. {
  776. Robot1XAction = WaferRobotXAction.Retract;
  777. }
  778. if (Robot2XAction == WaferRobotXAction.Extend)
  779. {
  780. Robot2XAction = WaferRobotXAction.Retract;
  781. }
  782. await Task.Delay(2000);
  783. if (Robot1TAction != WaferRobotTAction.T_Origin)
  784. {
  785. Robot1TAction = WaferRobotTAction.T_Origin;
  786. }
  787. if (Robot2TAction != WaferRobotTAction.T_Origin)
  788. {
  789. Robot2TAction = WaferRobotTAction.T_Origin;
  790. }
  791. }
  792. #endregion
  793. }
  794. private async Task ChangePosition(WaferRobotTAction waferRobotTAction)
  795. {
  796. //CurrentRobotPosition = RobotPosition.Origin;
  797. //await Task.Delay(1000);
  798. if (waferRobotTAction == WaferRobotTAction.LP1)
  799. {
  800. CurrentRobotPosition = RobotPosition.Left;
  801. }
  802. else if (waferRobotTAction == WaferRobotTAction.LP3)
  803. {
  804. CurrentRobotPosition = RobotPosition.Right;
  805. }
  806. else if (waferRobotTAction == WaferRobotTAction.LP2)
  807. {
  808. CurrentRobotPosition = RobotPosition.Middle;
  809. }
  810. else
  811. {
  812. CurrentRobotPosition = RobotPosition.Origin;
  813. }
  814. await Task.Delay(600);
  815. }
  816. #endregion
  817. }
  818. }