EfemViewModel.cs 35 KB

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