EfemViewModel.cs 53 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371
  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 CyberX8_Core;
  19. using CyberX8_MainPages.Unity;
  20. using CyberX8_Themes.CustomControls;
  21. using CyberX8_Themes.Unity;
  22. using MECF.Framework.Common.Utilities;
  23. using CyberX8_Themes.UserControls;
  24. using Caliburn.Micro;
  25. using System.Windows.Documents;
  26. using System.Windows.Input;
  27. using System.Windows;
  28. using MECF.Framework.Common.Jobs;
  29. namespace CyberX8_MainPages.ViewModels
  30. {
  31. public enum EFEMModule
  32. {
  33. LP1,LP2,LP3,Aligner1,PUF1,PUF2,SRD1,SRD2,Dummy1,Dummy2
  34. }
  35. public enum EFEMBlade
  36. {
  37. Blade1
  38. }
  39. internal class EfemViewModel:BindableBase
  40. {
  41. #region 私有字段
  42. private bool m_puf1IsInstalled;
  43. private bool m_puf2IsInstalled;
  44. private bool m_srd1IsInstalled;
  45. private bool m_srd2IsInstalled;
  46. private bool m_puf1IsInRobotStation;
  47. private bool m_puf2IsInRobotStation;
  48. private bool _isAlignerVacuumOn;
  49. private bool _isRobotVacuumOn;
  50. private ModuleInfo m_LP1ModuleInfo;
  51. private ModuleInfo m_LP2ModuleInfo;
  52. private ModuleInfo m_LP3ModuleInfo;
  53. private ModuleInfo m_EFEMModuleInfo;
  54. private ModuleInfo m_srd1ModuleInfo;//upper
  55. private ModuleInfo m_srd2ModuleInfo;
  56. private ModuleInfo m_puf1ModuleInfo;
  57. private ModuleInfo m_puf2ModuleInfo;
  58. private List<EFEMModule> m_EFEMModules = new List<EFEMModule>();
  59. private List<EFEMModule> m_PUFModules = new List<EFEMModule>();
  60. private EFEMBlade m_PickSelectedBlade;
  61. private EFEMBlade m_PlaceSelectedBlade;
  62. private EFEMBlade m_ExtendSelectedBlade;
  63. private EFEMBlade m_RetractSelectedBlade;
  64. private ObservableCollection<int> m_PlaceSoltItemsSource = new ObservableCollection<int>();
  65. private ObservableCollection<int> m_PickSoltItemsSource = new ObservableCollection<int>();
  66. private ObservableCollection<int> m_PUFPlaceSoltItemsSource = new ObservableCollection<int>();
  67. private ObservableCollection<int> m_PUFPickSoltItemsSource = new ObservableCollection<int>();
  68. private ObservableCollection<int> m_ExtendSoltItemsSource = new ObservableCollection<int>();
  69. private ObservableCollection<int> m_RetractSoltItemsSource = new ObservableCollection<int>();
  70. private int m_PickSoltSelectedIndex;
  71. private int m_PlaceSoltSelectedIndex;
  72. private int m_PUFPickSoltSelectedIndex;
  73. private int m_PUFPlaceSoltSelectedIndex;
  74. private int m_ExtendSoltSelectedIndex;
  75. private int m_RetractSoltSelectedIndex;
  76. private EFEMModule m_PickSelectedModule;
  77. private EFEMModule m_PlaceSelectedModule;
  78. private EFEMModule m_ExtendSelectedModule;
  79. private EFEMModule m_RetractSelectedModule;
  80. private EFEMModule m_PUFPickSelectedModule;
  81. private EFEMModule m_PUFPlaceSelectedModule;
  82. private WaferInfo m_BladeAWafer;
  83. private WaferInfo m_BladeBWafer;
  84. private WaferInfo m_puf1Wafer;
  85. private WaferInfo m_puf2Wafer;
  86. private WaferInfo m_srd1Wafer;
  87. private WaferInfo m_srd2Wafer;
  88. private WaferInfo m_Aligner1Wafer;
  89. private string m_LP1Status;
  90. private string m_LP2Status;
  91. private string m_LP3Status;
  92. private string _setLP1IDValue;
  93. private string _setLP2IDValue;
  94. private string _setLP3IDValue;
  95. private int _setLP1CycleValue;
  96. private int _setLP2CycleValue;
  97. private int _setLP3CycleValue;
  98. private bool _isLp1Unable;
  99. private bool _isLp2Unable;
  100. private bool _isLp3Unable;
  101. private List<string> m_RtDataKeys=new List<string>();
  102. private Dictionary<string, object> m_RtDataValues;
  103. private int m_AlignValue;
  104. private int m_RobotSpeedValue;
  105. private WaferRobotTAction m_Robot1TAction;
  106. private WaferRobotXAction m_Robot1XAction;
  107. private WaferRobotTAction m_Robot2TAction;
  108. private WaferRobotXAction m_Robot2XAction;
  109. //int arm1oldWaferStatus = 100;
  110. //int arm2oldWaferStatus = 100;
  111. private EFEM.RobotPosition m_CurrentRobotPosition;
  112. private ModuleInfo _dummy1ModuleInfo;
  113. private ModuleInfo _dummy2ModuleInfo;
  114. private int m_dummy1WaferCount;
  115. private int m_dummy2WaferCount;
  116. private bool _isLp1HasNoJob;
  117. private bool _isLp2HasNoJob;
  118. private bool _isLp3HasNoJob;
  119. private bool _isHomeAllEnable;
  120. #endregion
  121. #region 属性
  122. public bool IsHomeAllEnable
  123. {
  124. get { return _isHomeAllEnable; }
  125. set { SetProperty(ref _isHomeAllEnable, value); }
  126. }
  127. public ModuleInfo LP1ModuleInfo
  128. {
  129. get { return m_LP1ModuleInfo; }
  130. set { SetProperty(ref m_LP1ModuleInfo, value); }
  131. }
  132. public ModuleInfo LP2ModuleInfo
  133. {
  134. get { return m_LP2ModuleInfo; }
  135. set { SetProperty(ref m_LP2ModuleInfo, value); }
  136. }
  137. public ModuleInfo LP3ModuleInfo
  138. {
  139. get { return m_LP3ModuleInfo; }
  140. set { SetProperty(ref m_LP3ModuleInfo, value); }
  141. }
  142. public bool IsLP1Unable
  143. {
  144. get { return _isLp1Unable; }
  145. set { SetProperty(ref _isLp1Unable, value); }
  146. }
  147. public bool IsLP2Unable
  148. {
  149. get { return _isLp2Unable; }
  150. set { SetProperty(ref _isLp2Unable, value); }
  151. }
  152. public bool IsLP3Unable
  153. {
  154. get { return _isLp3Unable; }
  155. set { SetProperty(ref _isLp3Unable, value); }
  156. }
  157. public bool IsLP1HasNoJob
  158. {
  159. get { return _isLp1HasNoJob; }
  160. set { SetProperty(ref _isLp1HasNoJob, value); }
  161. }
  162. public bool IsLP2HasNoJob
  163. {
  164. get { return _isLp2HasNoJob; }
  165. set { SetProperty(ref _isLp2HasNoJob, value); }
  166. }
  167. public bool IsLP3HasNoJob
  168. {
  169. get { return _isLp3HasNoJob; }
  170. set { SetProperty(ref _isLp3HasNoJob, value); }
  171. }
  172. public ModuleInfo EFEMModuleInfo
  173. {
  174. get { return m_EFEMModuleInfo; }
  175. set { SetProperty(ref m_EFEMModuleInfo, value); }
  176. }
  177. public List<EFEMModule> EFEMModules
  178. {
  179. get { return m_EFEMModules; }
  180. set { SetProperty(ref m_EFEMModules, value); }
  181. }
  182. public List<EFEMModule> PUFModules
  183. {
  184. get { return m_PUFModules; }
  185. set { SetProperty(ref m_PUFModules, value); }
  186. }
  187. public EFEMBlade PickSelectedBlade
  188. {
  189. get { return m_PickSelectedBlade; }
  190. set { SetProperty(ref m_PickSelectedBlade, value); }
  191. }
  192. public EFEMBlade PlaceSelectedBlade
  193. {
  194. get { return m_PlaceSelectedBlade; }
  195. set { SetProperty(ref m_PlaceSelectedBlade, value); }
  196. }
  197. public EFEMBlade ExtendSelectedBlade
  198. {
  199. get { return m_ExtendSelectedBlade; }
  200. set { SetProperty(ref m_ExtendSelectedBlade, value); }
  201. }
  202. public EFEMBlade RetractSelectedBlade
  203. {
  204. get { return m_RetractSelectedBlade; }
  205. set { SetProperty(ref m_RetractSelectedBlade, value); }
  206. }
  207. public ObservableCollection<int> PickSoltItemsSource
  208. {
  209. get { return m_PickSoltItemsSource; }
  210. set { SetProperty(ref m_PickSoltItemsSource, value); }
  211. }
  212. public ObservableCollection<int> PlaceSoltItemsSource
  213. {
  214. get { return m_PlaceSoltItemsSource; }
  215. set { SetProperty(ref m_PlaceSoltItemsSource, value); }
  216. }
  217. public ObservableCollection<int> PUFPickSoltItemsSource
  218. {
  219. get { return m_PUFPickSoltItemsSource; }
  220. set { SetProperty(ref m_PUFPickSoltItemsSource, value); }
  221. }
  222. public ObservableCollection<int> PUFPlaceSoltItemsSource
  223. {
  224. get { return m_PUFPlaceSoltItemsSource; }
  225. set { SetProperty(ref m_PUFPlaceSoltItemsSource, value); }
  226. }
  227. public ObservableCollection<int> ExtendSoltItemsSource
  228. {
  229. get { return m_ExtendSoltItemsSource; }
  230. set { SetProperty(ref m_ExtendSoltItemsSource, value); }
  231. }
  232. public ObservableCollection<int> RetractSoltItemsSource
  233. {
  234. get { return m_RetractSoltItemsSource; }
  235. set { SetProperty(ref m_RetractSoltItemsSource, value); }
  236. }
  237. public int PickSoltSelectedIndex
  238. {
  239. get { return m_PickSoltSelectedIndex; }
  240. set { SetProperty(ref m_PickSoltSelectedIndex, value); }
  241. }
  242. public int PlaceSoltSelectedIndex
  243. {
  244. get { return m_PlaceSoltSelectedIndex; }
  245. set { SetProperty(ref m_PlaceSoltSelectedIndex, value); }
  246. }
  247. public int PUFPickSoltSelectedIndex
  248. {
  249. get { return m_PUFPickSoltSelectedIndex; }
  250. set { SetProperty(ref m_PUFPickSoltSelectedIndex, value); }
  251. }
  252. public int PUFPlaceSoltSelectedIndex
  253. {
  254. get { return m_PUFPlaceSoltSelectedIndex; }
  255. set { SetProperty(ref m_PUFPlaceSoltSelectedIndex, value); }
  256. }
  257. public int ExtendSoltSelectedIndex
  258. {
  259. get { return m_ExtendSoltSelectedIndex; }
  260. set { SetProperty(ref m_ExtendSoltSelectedIndex, value); }
  261. }
  262. public int RetractSoltSelectedIndex
  263. {
  264. get { return m_RetractSoltSelectedIndex; }
  265. set { SetProperty(ref m_RetractSoltSelectedIndex, value); }
  266. }
  267. public EFEMModule PickSelectedModule
  268. {
  269. get { return m_PickSelectedModule; }
  270. set { SetProperty(ref m_PickSelectedModule, value); }
  271. }
  272. public EFEMModule PlaceSelectedModule
  273. {
  274. get { return m_PlaceSelectedModule; }
  275. set { SetProperty(ref m_PlaceSelectedModule, value); }
  276. }
  277. public EFEMModule PUFPickSelectedModule
  278. {
  279. get { return m_PUFPickSelectedModule; }
  280. set { SetProperty(ref m_PUFPickSelectedModule, value); }
  281. }
  282. public EFEMModule PUFPlaceSelectedModule
  283. {
  284. get { return m_PUFPlaceSelectedModule; }
  285. set { SetProperty(ref m_PUFPlaceSelectedModule, value); }
  286. }
  287. public EFEMModule ExtendSelectedModule
  288. {
  289. get { return m_ExtendSelectedModule; }
  290. set { SetProperty(ref m_ExtendSelectedModule, value); }
  291. }
  292. public EFEMModule RetractSelectedModule
  293. {
  294. get { return m_RetractSelectedModule; }
  295. set { SetProperty(ref m_RetractSelectedModule, value); }
  296. }
  297. public WaferInfo BladeAWafer
  298. {
  299. get { return m_BladeAWafer; }
  300. set { SetProperty(ref m_BladeAWafer, value); }
  301. }
  302. public WaferInfo Aligner1Wafer
  303. {
  304. get { return m_Aligner1Wafer; }
  305. set { SetProperty(ref m_Aligner1Wafer, value); }
  306. }
  307. public WaferInfo Puf1Wafer
  308. {
  309. get { return m_puf1Wafer; }
  310. set { SetProperty(ref m_puf1Wafer, value); }
  311. }
  312. public WaferInfo Puf2Wafer
  313. {
  314. get { return m_puf2Wafer; }
  315. set { SetProperty(ref m_puf2Wafer, value); }
  316. }
  317. public bool Puf1IsInstalled
  318. {
  319. get { return m_puf1IsInstalled; }
  320. set { SetProperty(ref m_puf1IsInstalled, value); }
  321. }
  322. public bool Puf2IsInstalled
  323. {
  324. get { return m_puf2IsInstalled; }
  325. set { SetProperty(ref m_puf2IsInstalled, value); }
  326. }
  327. public bool Srd1IsInstalled
  328. {
  329. get { return m_srd1IsInstalled; }
  330. set { SetProperty(ref m_srd1IsInstalled, value); }
  331. }
  332. public bool Srd2IsInstalled
  333. {
  334. get { return m_srd2IsInstalled; }
  335. set { SetProperty(ref m_srd2IsInstalled, value); }
  336. }
  337. public ModuleInfo Puf1ModuleInfo
  338. {
  339. get { return m_puf1ModuleInfo; }
  340. set { SetProperty(ref m_puf1ModuleInfo, value); }
  341. }
  342. public ModuleInfo Puf2ModuleInfo
  343. {
  344. get { return m_puf2ModuleInfo; }
  345. set { SetProperty(ref m_puf2ModuleInfo, value); }
  346. }
  347. public bool Puf1IsInRobotStation
  348. {
  349. get { return m_puf1IsInRobotStation; }
  350. set { SetProperty(ref m_puf1IsInRobotStation, value); }
  351. }
  352. public bool Puf2IsInRobotStation
  353. {
  354. get { return m_puf2IsInRobotStation; }
  355. set { SetProperty(ref m_puf2IsInRobotStation, value); }
  356. }
  357. public bool IsAlignerVacuumOn
  358. {
  359. get { return _isAlignerVacuumOn; }
  360. set { SetProperty(ref _isAlignerVacuumOn, value); }
  361. }
  362. public bool IsRobotVacuumOn
  363. {
  364. get { return _isRobotVacuumOn; }
  365. set { SetProperty(ref _isRobotVacuumOn, value); }
  366. }
  367. public string LP1Status
  368. {
  369. get { return m_LP1Status; }
  370. set { SetProperty(ref m_LP1Status, value); }
  371. }
  372. public string LP2Status
  373. {
  374. get { return m_LP2Status; }
  375. set { SetProperty(ref m_LP2Status, value); }
  376. }
  377. public string LP3Status
  378. {
  379. get { return m_LP3Status; }
  380. set { SetProperty(ref m_LP3Status, value); }
  381. }
  382. public string SetLP1IDValue
  383. {
  384. get { return _setLP1IDValue; }
  385. set { SetProperty(ref _setLP1IDValue, value); }
  386. }
  387. public string SetLP2IDValue
  388. {
  389. get { return _setLP1IDValue; }
  390. set { SetProperty(ref _setLP1IDValue, value); }
  391. }
  392. public string SetLP3IDValue
  393. {
  394. get { return _setLP1IDValue; }
  395. set { SetProperty(ref _setLP1IDValue, value); }
  396. }
  397. public int SetLP1CycleValue
  398. {
  399. get { return _setLP1CycleValue; }
  400. set { SetProperty(ref _setLP1CycleValue, value); }
  401. }
  402. public int SetLP2CycleValue
  403. {
  404. get { return _setLP2CycleValue; }
  405. set { SetProperty(ref _setLP2CycleValue, value); }
  406. }
  407. public int SetLP3CycleValue
  408. {
  409. get { return _setLP3CycleValue; }
  410. set { SetProperty(ref _setLP3CycleValue, value); }
  411. }
  412. public Dictionary<string, object> RtDataValues
  413. {
  414. get { return m_RtDataValues; }
  415. set { SetProperty(ref m_RtDataValues, value); }
  416. }
  417. public int AlignValue
  418. {
  419. get { return m_AlignValue; }
  420. set { SetProperty(ref m_AlignValue, value); }
  421. }
  422. public int RobotSpeedValue
  423. {
  424. get { return m_RobotSpeedValue; }
  425. set { SetProperty(ref m_RobotSpeedValue, value); }
  426. }
  427. public WaferRobotTAction Robot1TAction
  428. {
  429. get { return m_Robot1TAction; }
  430. set { SetProperty(ref m_Robot1TAction, value); }
  431. }
  432. public WaferRobotXAction Robot1XAction
  433. {
  434. get { return m_Robot1XAction; }
  435. set { SetProperty(ref m_Robot1XAction, value); }
  436. }
  437. public WaferRobotTAction Robot2TAction
  438. {
  439. get { return m_Robot2TAction; }
  440. set { SetProperty(ref m_Robot2TAction, value); }
  441. }
  442. public WaferRobotXAction Robot2XAction
  443. {
  444. get { return m_Robot2XAction; }
  445. set { SetProperty(ref m_Robot2XAction, value); }
  446. }
  447. private string m_RobotTarget;
  448. public string RobotTarget
  449. {
  450. get { return m_RobotTarget; }
  451. set
  452. {
  453. SetProperty(ref m_RobotTarget, value);
  454. }
  455. }
  456. public RobotMoveInfo m_robotMoveInfo;
  457. public RobotMoveInfo RobotMoveInfo
  458. {
  459. get { return m_robotMoveInfo; }
  460. set
  461. {
  462. RobotMoveInfoChanged(m_robotMoveInfo, value);
  463. m_robotMoveInfo = value;
  464. }
  465. }
  466. public EFEM.RobotPosition CurrentRobotPosition
  467. {
  468. get { return m_CurrentRobotPosition; }
  469. set { SetProperty(ref m_CurrentRobotPosition, value); }
  470. }
  471. public ModuleInfo Dummy1ModuleInfo
  472. {
  473. get { return _dummy1ModuleInfo; }
  474. set { SetProperty(ref _dummy1ModuleInfo, value); }
  475. }
  476. public ModuleInfo Dummy2ModuleInfo
  477. {
  478. get { return _dummy2ModuleInfo; }
  479. set { SetProperty(ref _dummy2ModuleInfo, value); }
  480. }
  481. public int Dummy1WaferCount
  482. {
  483. get { return m_dummy1WaferCount; }
  484. set { SetProperty(ref m_dummy1WaferCount, value); }
  485. }
  486. public int Dummy2WaferCount
  487. {
  488. get { return m_dummy2WaferCount; }
  489. set { SetProperty(ref m_dummy2WaferCount, value); }
  490. }
  491. public ModuleInfo Srd1ModuleInfo
  492. {
  493. get { return m_srd1ModuleInfo; }
  494. set { SetProperty(ref m_srd1ModuleInfo, value); }
  495. }
  496. public ModuleInfo Srd2ModuleInfo
  497. {
  498. get { return m_srd2ModuleInfo; }
  499. set { SetProperty(ref m_srd2ModuleInfo, value); }
  500. }
  501. public WaferInfo Srd1Wafer
  502. {
  503. get { return m_srd1Wafer; }
  504. set { SetProperty(ref m_srd1Wafer, value); }
  505. }
  506. public WaferInfo Srd2Wafer
  507. {
  508. get { return m_srd2Wafer; }
  509. set { SetProperty(ref m_srd2Wafer, value); }
  510. }
  511. #endregion
  512. #region 命令
  513. private DelegateCommand _ExtendCommand;
  514. public DelegateCommand ExtendCommand =>
  515. _ExtendCommand ?? (_ExtendCommand = new DelegateCommand(OnExtend));
  516. private DelegateCommand _RetractCommand;
  517. public DelegateCommand RetractCommand =>
  518. _RetractCommand ?? (_RetractCommand = new DelegateCommand(OnRetract));
  519. private DelegateCommand<object> _PUFModuleChangeCommand;
  520. public DelegateCommand<object> PUFModuleChangeCommand =>
  521. _PUFModuleChangeCommand ?? (_PUFModuleChangeCommand = new DelegateCommand<object>(OnPUFModuleChange));
  522. private DelegateCommand<object> _ModuleChangeCommand;
  523. public DelegateCommand<object> ModuleChangeCommand =>
  524. _ModuleChangeCommand ?? (_ModuleChangeCommand = new DelegateCommand<object>(OnModuleChange));
  525. private DelegateCommand _PickCommand;
  526. public DelegateCommand PickCommand =>
  527. _PickCommand ?? (_PickCommand = new DelegateCommand(OnPick));
  528. private DelegateCommand _PlaceCommand;
  529. public DelegateCommand PlaceCommand =>
  530. _PlaceCommand ?? (_PlaceCommand = new DelegateCommand(OnPlace));
  531. private DelegateCommand _BFMapCommand;
  532. public DelegateCommand BFMapCommand =>
  533. _BFMapCommand ?? (_BFMapCommand = new DelegateCommand(OnBFMap));
  534. private DelegateCommand _SetRobotSpeedCommand;
  535. public DelegateCommand SetRobotSpeedCommand =>
  536. _SetRobotSpeedCommand ?? (_SetRobotSpeedCommand = new DelegateCommand(OnSetRobotSpeed));
  537. private DelegateCommand<object> _PUFPickCommand;
  538. public DelegateCommand<object> PUFPickCommand =>
  539. _PUFPickCommand ?? (_PUFPickCommand = new DelegateCommand<object>(OnPUFPick));
  540. private DelegateCommand<object> _PUFPlaceCommand;
  541. public DelegateCommand<object> PUFPlaceCommand =>
  542. _PUFPlaceCommand ?? (_PUFPlaceCommand = new DelegateCommand<object>(OnPUFPlace));
  543. private DelegateCommand _HomeAllCommand;
  544. public DelegateCommand HomeAllCommand =>
  545. _HomeAllCommand ?? (_HomeAllCommand = new DelegateCommand(OnHomeAll));
  546. private DelegateCommand _ClearErrorCommand;
  547. public DelegateCommand ClearErrorCommand =>
  548. _ClearErrorCommand ?? (_ClearErrorCommand = new DelegateCommand(OnClearError));
  549. private DelegateCommand _AbortCommand;
  550. public DelegateCommand AbortCommand =>
  551. _AbortCommand ?? (_AbortCommand = new DelegateCommand(OnAbort));
  552. private DelegateCommand _CloseBuzzerCommand;
  553. public DelegateCommand CloseBuzzerCommand =>
  554. _CloseBuzzerCommand ?? (_CloseBuzzerCommand = new DelegateCommand(OnCloseBuzzer));
  555. private DelegateCommand _Align1HomeCommand;
  556. public DelegateCommand Align1HomeCommand =>
  557. _Align1HomeCommand ?? (_Align1HomeCommand = new DelegateCommand(OnAlign1Home));
  558. private DelegateCommand _Align1AlignCommand;
  559. public DelegateCommand Align1AlignCommand =>
  560. _Align1AlignCommand ?? (_Align1AlignCommand = new DelegateCommand(OnAlign1Align));
  561. private DelegateCommand _RobotHomeCommand;
  562. public DelegateCommand RobotHomeCommand =>
  563. _RobotHomeCommand ?? (_RobotHomeCommand = new DelegateCommand(OnRobotHome));
  564. private DelegateCommand _RobotPowerOnCommand;
  565. public DelegateCommand RobotPowerOnCommand =>
  566. _RobotPowerOnCommand ?? (_RobotPowerOnCommand = new DelegateCommand(RobotPowerOn));
  567. private DelegateCommand _RobotPowerOffCommand;
  568. public DelegateCommand RobotPowerOffCommand =>
  569. _RobotPowerOffCommand ?? (_RobotPowerOffCommand = new DelegateCommand(RobotPowerOff));
  570. private DelegateCommand<object> _LPHomeCommand;
  571. public DelegateCommand<object> LPHomeCommand =>
  572. _LPHomeCommand ?? (_LPHomeCommand = new DelegateCommand<object>(OnLPHome));
  573. private DelegateCommand<object> _LPAbortCommand;
  574. public DelegateCommand<object> LPAbortCommand =>
  575. _LPAbortCommand ?? (_LPAbortCommand = new DelegateCommand<object>(OnLPAbort));
  576. private DelegateCommand<object> _LPResetCommand;
  577. public DelegateCommand<object> LPResetCommand =>
  578. _LPResetCommand ?? (_LPResetCommand = new DelegateCommand<object>(OnLPReset));
  579. private DelegateCommand<object> _LPLoadCommand;
  580. public DelegateCommand<object> LPLoadCommand =>
  581. _LPLoadCommand ?? (_LPLoadCommand = new DelegateCommand<object>(OnLPLoad));
  582. private DelegateCommand<object> _LPUnLoadCommand;
  583. public DelegateCommand<object> LPUnLoadCommand =>
  584. _LPUnLoadCommand ?? (_LPUnLoadCommand = new DelegateCommand<object>(OnLPUnLoad));
  585. private DelegateCommand<object> _LPMapCommand;
  586. public DelegateCommand<object> LPMapCommand =>
  587. _LPMapCommand ?? (_LPMapCommand = new DelegateCommand<object>(OnLPMap));
  588. private DelegateCommand<object> _LPReadIDCommand;
  589. public DelegateCommand<object> LPReadIDCommand =>
  590. _LPReadIDCommand ?? (_LPReadIDCommand = new DelegateCommand<object>(OnLPReadID));
  591. private DelegateCommand<object> _LP1WriteIDCommand;
  592. public DelegateCommand<object> LP1WriteIDCommand =>
  593. _LP1WriteIDCommand ?? (_LP1WriteIDCommand = new DelegateCommand<object>(OnLP1WriteID));
  594. private DelegateCommand<object> _LP2WriteIDCommand;
  595. public DelegateCommand<object> LP2WriteIDCommand =>
  596. _LP2WriteIDCommand ?? (_LP2WriteIDCommand = new DelegateCommand<object>(OnLP2WriteID));
  597. private DelegateCommand<object> _LP3WriteIDCommand;
  598. public DelegateCommand<object> LP3WriteIDCommand =>
  599. _LP3WriteIDCommand ?? (_LP3WriteIDCommand = new DelegateCommand<object>(OnLP3WriteID));
  600. private DelegateCommand<object> _LPClampCommand;
  601. public DelegateCommand<object> LPClampCommand =>
  602. _LPClampCommand ?? (_LPClampCommand = new DelegateCommand<object>(OnLPClamp));
  603. private DelegateCommand<object> _LPUnClampCommand;
  604. public DelegateCommand<object> LPUnClampCommand =>
  605. _LPUnClampCommand ?? (_LPUnClampCommand = new DelegateCommand<object>(OnLPUnClamp));
  606. private DelegateCommand<object> _LPDockCommand;
  607. public DelegateCommand<object> LPDockCommand =>
  608. _LPDockCommand ?? (_LPDockCommand = new DelegateCommand<object>(OnLPDock));
  609. private DelegateCommand<object> _LPUnDockCommand;
  610. public DelegateCommand<object> LPUnDockCommand =>
  611. _LPUnDockCommand ?? (_LPUnDockCommand = new DelegateCommand<object>(OnLPUnDock));
  612. private DelegateCommand<object> _LPOpenDoorCommand;
  613. public DelegateCommand<object> LPOpenDoorCommand =>
  614. _LPOpenDoorCommand ?? (_LPOpenDoorCommand = new DelegateCommand<object>(OnLPOpenDoor));
  615. private DelegateCommand<object> _LPCloseDoorCommand;
  616. public DelegateCommand<object> LPCloseDoorCommand =>
  617. _LPCloseDoorCommand ?? (_LPCloseDoorCommand = new DelegateCommand<object>(OnLPCloseDoor));
  618. private DelegateCommand _OnlineCommand;
  619. public DelegateCommand OnlineCommand =>
  620. _OnlineCommand ?? (_OnlineCommand = new DelegateCommand(OnOnline));
  621. private DelegateCommand _OfflineCommand;
  622. public DelegateCommand OfflineCommand =>
  623. _OfflineCommand ?? (_OfflineCommand = new DelegateCommand(OnOffline));
  624. private DelegateCommand _AlignerVacuumCommand;
  625. public DelegateCommand AlignerVacuumCommand =>
  626. _AlignerVacuumCommand ?? (_AlignerVacuumCommand = new DelegateCommand(AlignerVacuum));
  627. private DelegateCommand _RobotVacuumCommand;
  628. public DelegateCommand RobotVacuumCommand =>
  629. _RobotVacuumCommand ?? (_RobotVacuumCommand = new DelegateCommand(RobotVacuum));
  630. private ICommand _lP1CycleCommand;
  631. public ICommand LP1CycleCommand => _lP1CycleCommand ?? (_lP1CycleCommand = new DelegateCommand<object>(OnLP1CycleAction));
  632. private ICommand _lP2CycleCommand;
  633. public ICommand LP2CycleCommand => _lP2CycleCommand ?? (_lP2CycleCommand = new DelegateCommand<object>(OnLP2CycleAction));
  634. private ICommand _lP3CycleCommand;
  635. public ICommand LP3CycleCommand => _lP3CycleCommand ?? (_lP3CycleCommand = new DelegateCommand<object>(OnLP3CycleAction));
  636. #endregion
  637. #region 构造函数
  638. public EfemViewModel()
  639. {
  640. Dictionary<string, object> allModulesDictionary = QueryDataClient.Instance.Service.PollData(new List<string>() { "System.InstalledModules" });
  641. if (allModulesDictionary != null)
  642. {
  643. List<string> allModules = CommonFunction.GetValue<List<string>>(allModulesDictionary, "System.InstalledModules");
  644. Puf1IsInstalled = allModules.Contains("PUF1");
  645. Puf2IsInstalled = allModules.Contains("PUF2");
  646. Srd1IsInstalled = allModules.Contains("SRD1");
  647. Srd2IsInstalled = allModules.Contains("SRD2");
  648. }
  649. DispatcherTimer timer = new DispatcherTimer();
  650. timer.Interval = TimeSpan.FromSeconds(0.1);
  651. timer.Tick += Timer_Tick;
  652. timer.Start();
  653. EFEMModules.Add(EFEMModule.LP1);
  654. EFEMModules.Add(EFEMModule.LP2);
  655. EFEMModules.Add(EFEMModule.LP3);
  656. EFEMModules.Add(EFEMModule.Aligner1);
  657. EFEMModules.Add(EFEMModule.PUF1);
  658. EFEMModules.Add(EFEMModule.PUF2);
  659. EFEMModules.Add(EFEMModule.SRD1);
  660. EFEMModules.Add(EFEMModule.SRD2);
  661. EFEMModules.Add(EFEMModule.Dummy1);
  662. EFEMModules.Add(EFEMModule.Dummy2);
  663. PUFModules.Add(EFEMModule.PUF1);
  664. PUFModules.Add(EFEMModule.PUF2);
  665. OnModuleChange("Pick");
  666. OnModuleChange("Place");
  667. OnPUFModuleChange("Pick");
  668. OnPUFModuleChange("Place");
  669. Init();
  670. }
  671. #endregion
  672. #region 命令方法
  673. private void OnPUFModuleChange(object obj)
  674. {
  675. var value = obj.ToString();
  676. switch (value)
  677. {
  678. case "Pick":
  679. PUFPickSoltItemsSource.Clear();
  680. switch (PUFPickSelectedModule)
  681. {
  682. case EFEMModule.PUF1:
  683. case EFEMModule.PUF2:
  684. PUFPickSoltItemsSource.Add(1);
  685. PUFPickSoltItemsSource.Add(2);
  686. break;
  687. }
  688. PUFPickSoltSelectedIndex = 0;
  689. break;
  690. case "Place":
  691. PUFPlaceSoltItemsSource.Clear();
  692. switch (PUFPlaceSelectedModule)
  693. {
  694. case EFEMModule.PUF1:
  695. case EFEMModule.PUF2:
  696. PUFPlaceSoltItemsSource.Add(1);
  697. PUFPlaceSoltItemsSource.Add(2);
  698. break;
  699. }
  700. PUFPlaceSoltSelectedIndex = 0;
  701. break;
  702. }
  703. }
  704. private void OnModuleChange(object obj)
  705. {
  706. var value = obj.ToString();
  707. switch (value)
  708. {
  709. case "Pick":
  710. PickSoltItemsSource.Clear();
  711. switch (PickSelectedModule)
  712. {
  713. case EFEMModule.PUF1:
  714. case EFEMModule.PUF2:
  715. PickSoltItemsSource.Add(1);
  716. PickSoltItemsSource.Add(2);
  717. break;
  718. case EFEMModule.Dummy1:
  719. case EFEMModule.Dummy2:
  720. for (int i = 1; i < 17; i++)
  721. {
  722. PickSoltItemsSource.Add(i);
  723. }
  724. break;
  725. case EFEMModule.LP1:
  726. case EFEMModule.LP2:
  727. case EFEMModule.LP3:
  728. for (int i = 1; i < 26; i++)
  729. {
  730. PickSoltItemsSource.Add(i);
  731. }
  732. break;
  733. default:
  734. PickSoltItemsSource.Add(1);
  735. break;
  736. }
  737. PickSoltSelectedIndex = 0;
  738. break;
  739. case "Place":
  740. PlaceSoltItemsSource.Clear();
  741. switch (PlaceSelectedModule)
  742. {
  743. case EFEMModule.PUF1:
  744. case EFEMModule.PUF2:
  745. PlaceSoltItemsSource.Add(1);
  746. PlaceSoltItemsSource.Add(2);
  747. break;
  748. case EFEMModule.Dummy1:
  749. case EFEMModule.Dummy2:
  750. for (int i = 1; i < 17; i++)
  751. {
  752. PlaceSoltItemsSource.Add(i);
  753. }
  754. break;
  755. case EFEMModule.LP1:
  756. case EFEMModule.LP2:
  757. case EFEMModule.LP3:
  758. for (int i = 1; i < 26; i++)
  759. {
  760. PlaceSoltItemsSource.Add(i);
  761. }
  762. break;
  763. default:
  764. PlaceSoltItemsSource.Add(1);
  765. break;
  766. }
  767. PlaceSoltSelectedIndex = 0;
  768. break;
  769. }
  770. }
  771. private void OnExtend()
  772. {
  773. var moduleName = (ModuleName)Enum.Parse(typeof(ModuleName), PlaceSelectedModule.ToString(), true);
  774. var selectedHand = (Hand)Enum.Parse(typeof(Hand), PlaceSelectedBlade.ToString(), true);
  775. InvokeClient.Instance.Service.DoOperation($"EFEM.{RtOperation.Extend}", moduleName, 0, selectedHand);
  776. }
  777. private void OnRetract()
  778. {
  779. var moduleName = (ModuleName)Enum.Parse(typeof(ModuleName), PlaceSelectedModule.ToString(), true);
  780. var selectedHand = (Hand)Enum.Parse(typeof(Hand), PlaceSelectedBlade.ToString(), true);
  781. InvokeClient.Instance.Service.DoOperation($"EFEM.{RtOperation.Retract}", moduleName, 0, selectedHand);
  782. }
  783. private void OnPick()
  784. {
  785. Queue<MoveItem> moveItems = new Queue<MoveItem>();
  786. var moduleName = (ModuleName)Enum.Parse(typeof(ModuleName), PickSelectedModule.ToString(), true);
  787. var selectedHand = (Hand)Enum.Parse(typeof(Hand), PickSelectedBlade.ToString(), true);
  788. MoveItem moveItem = new MoveItem(moduleName, PickSoltItemsSource[PickSoltSelectedIndex]-1, ModuleName.EfemRobot, 0, selectedHand);
  789. moveItems.Enqueue(moveItem);
  790. InvokeClient.Instance.Service.DoOperation($"{ModuleName.EfemRobot}.{EfemOperation.Pick}", moveItems);
  791. }
  792. private void OnPlace()
  793. {
  794. Queue<MoveItem> moveItems = new Queue<MoveItem>();
  795. var moduleName = (ModuleName)Enum.Parse(typeof(ModuleName), PlaceSelectedModule.ToString(), true);
  796. var selectedHand = (Hand)Enum.Parse(typeof(Hand), PlaceSelectedBlade.ToString(), true);
  797. MoveItem moveItem = new MoveItem(ModuleName.EfemRobot, 0, moduleName, PlaceSoltItemsSource[PlaceSoltSelectedIndex]-1, selectedHand);
  798. moveItems.Enqueue(moveItem);
  799. InvokeClient.Instance.Service.DoOperation($"{ModuleName.EfemRobot}.{EfemOperation.Place}", moveItems);
  800. }
  801. private void OnPUFPick(object obj)
  802. {
  803. var moduleName = (ModuleName)Enum.Parse(typeof(ModuleName), PUFPickSelectedModule.ToString(), true);
  804. var PufSlot = PUFPickSoltSelectedIndex == 0 ? "SideA" : "SideB";
  805. InvokeClient.Instance.Service.DoOperation($"{moduleName}.GotoRobotPositionForPick", PufSlot);
  806. }
  807. private void OnPUFPlace(object obj)
  808. {
  809. var moduleName = (ModuleName)Enum.Parse(typeof(ModuleName), PUFPlaceSelectedModule.ToString(), true);
  810. var PufSlot = PUFPlaceSoltSelectedIndex == 0 ? "SideA" : "SideB";
  811. InvokeClient.Instance.Service.DoOperation($"{moduleName}.GotoRobotPositionForPlace", PufSlot);
  812. }
  813. private void OnHomeAll()
  814. {
  815. InvokeClient.Instance.Service.DoOperation($"EFEM.{EfemOperation.Home}");
  816. }
  817. private void OnClearError()
  818. {
  819. InvokeClient.Instance.Service.DoOperation($"EFEM.{EfemOperation.ClearError}");
  820. }
  821. private void OnCloseBuzzer()
  822. {
  823. InvokeClient.Instance.Service.DoOperation($"EFEM.{EfemOperation.TurnOffBuzzer}");
  824. }
  825. private void OnAbort()
  826. {
  827. InvokeClient.Instance.Service.DoOperation($"{ModuleName.EfemRobot}.{EfemOperation.Abort}");
  828. }
  829. private void OnAlign1Home()
  830. {
  831. InvokeClient.Instance.Service.DoOperation($"{ModuleName.Aligner1}.{EfemOperation.Home}");
  832. }
  833. private void OnAlign1Align()
  834. {
  835. InvokeClient.Instance.Service.DoOperation($"{ModuleName.Aligner1}.{EfemOperation.Align}",0, AlignValue);
  836. }
  837. private void AlignerVacuum()
  838. {
  839. InvokeClient.Instance.Service.DoOperation($"{ModuleName.Aligner1}.{EfemOperation.Vacuum}", ModuleName.Aligner1,IsAlignerVacuumOn);
  840. }
  841. private void RobotVacuum()
  842. {
  843. InvokeClient.Instance.Service.DoOperation($"{ModuleName.EfemRobot}.{EfemOperation.Vacuum}", ModuleName.EfemRobot, IsRobotVacuumOn);
  844. }
  845. private void OnRobotHome()
  846. {
  847. InvokeClient.Instance.Service.DoOperation($"{ModuleName.EfemRobot}.{EfemOperation.Home}");
  848. }
  849. private void RobotPowerOn()
  850. {
  851. InvokeClient.Instance.Service.DoOperation($"{ModuleName.EfemRobot}.{EfemOperation.PowerOn}", true);
  852. }
  853. private void RobotPowerOff()
  854. {
  855. InvokeClient.Instance.Service.DoOperation($"{ModuleName.EfemRobot}.{EfemOperation.PowerOn}", false);
  856. }
  857. private void OnBFMap()
  858. {
  859. InvokeClient.Instance.Service.DoOperation($"{ModuleName.EfemRobot}.{EfemOperation.DummyMap}");
  860. }
  861. private void OnSetRobotSpeed()
  862. {
  863. InvokeClient.Instance.Service.DoOperation($"{ModuleName.EfemRobot}.{EfemOperation.Speed}", RobotSpeedValue);
  864. }
  865. private void OnLPHome(object obj)
  866. {
  867. InvokeClient.Instance.Service.DoOperation($"{obj.ToString()}.Home");
  868. }
  869. private void OnLPAbort(object obj)
  870. {
  871. InvokeClient.Instance.Service.DoOperation($"{obj.ToString()}.Abort");
  872. }
  873. private void OnLPReset(object obj)
  874. {
  875. //InvokeClient.Instance.Service.DoOperation($"{obj.ToString()}.ReSet");
  876. }
  877. private void OnLPLoad(object obj)
  878. {
  879. InvokeClient.Instance.Service.DoOperation($"{obj.ToString()}.Load");
  880. }
  881. private void OnLPUnLoad(object obj)
  882. {
  883. InvokeClient.Instance.Service.DoOperation($"{obj.ToString()}.Unload");
  884. }
  885. private void OnLPMap(object obj)
  886. {
  887. InvokeClient.Instance.Service.DoOperation($"{obj.ToString()}.Map");
  888. }
  889. private void OnLPReadID(object obj)
  890. {
  891. InvokeClient.Instance.Service.DoOperation($"{obj.ToString()}.ReadCarrierId");
  892. }
  893. private void OnLP1WriteID(object obj)
  894. {
  895. InvokeClient.Instance.Service.DoOperation($"{obj.ToString()}.WriteCarrierID", SetLP1IDValue);
  896. }
  897. private void OnLP2WriteID(object obj)
  898. {
  899. InvokeClient.Instance.Service.DoOperation($"{obj.ToString()}.WriteCarrierID", SetLP2IDValue);
  900. }
  901. private void OnLP3WriteID(object obj)
  902. {
  903. InvokeClient.Instance.Service.DoOperation($"{obj.ToString()}.WriteCarrierID", SetLP3IDValue);
  904. }
  905. private void OnLPClamp(object obj)
  906. {
  907. InvokeClient.Instance.Service.DoOperation($"{obj.ToString()}.Clamp");
  908. }
  909. private void OnLPUnClamp(object obj)
  910. {
  911. InvokeClient.Instance.Service.DoOperation($"{obj.ToString()}.Unclamp");
  912. }
  913. private void OnLPDock(object obj)
  914. {
  915. InvokeClient.Instance.Service.DoOperation($"{obj.ToString()}.Dock");
  916. }
  917. private void OnLPUnDock(object obj)
  918. {
  919. InvokeClient.Instance.Service.DoOperation($"{obj.ToString()}.Undock");
  920. }
  921. private void OnLPOpenDoor(object obj)
  922. {
  923. InvokeClient.Instance.Service.DoOperation($"{obj.ToString()}.OpenDoor");
  924. }
  925. private void OnLPCloseDoor(object obj)
  926. {
  927. InvokeClient.Instance.Service.DoOperation($"{obj.ToString()}.CloseDoor");
  928. }
  929. private void OnOnline()
  930. {
  931. InvokeClient.Instance.Service.DoOperation($"{ModuleName.EFEM}.Online",true);
  932. }
  933. private void OnOffline()
  934. {
  935. InvokeClient.Instance.Service.DoOperation($"{ModuleName.EFEM}.Online", false);
  936. }
  937. private void OnLP1CycleAction(object obj)
  938. {
  939. InvokeClient.Instance.Service.DoOperation($"{obj.ToString()}.CycleLoadUnload", SetLP1CycleValue);
  940. }
  941. private void OnLP2CycleAction(object obj)
  942. {
  943. InvokeClient.Instance.Service.DoOperation($"{obj.ToString()}.CycleLoadUnload", SetLP2CycleValue);
  944. }
  945. private void OnLP3CycleAction(object obj)
  946. {
  947. InvokeClient.Instance.Service.DoOperation($"{obj.ToString()}.CycleLoadUnload", SetLP3CycleValue);
  948. }
  949. #endregion
  950. #region 私有方法
  951. private void Timer_Tick(object sender, EventArgs e)
  952. {
  953. if (Puf1IsInstalled)
  954. {
  955. if (ModuleManager.ModuleInfos["PUF1"].WaferManager.Wafers.Count != 0)
  956. {
  957. Puf1Wafer = ModuleManager.ModuleInfos["PUF1"].WaferManager.Wafers[0];
  958. }
  959. Puf1ModuleInfo = ModuleManager.ModuleInfos["PUF1"];
  960. }
  961. if (Puf2IsInstalled)
  962. {
  963. if (ModuleManager.ModuleInfos["PUF2"].WaferManager.Wafers.Count != 0)
  964. {
  965. Puf2Wafer = ModuleManager.ModuleInfos["PUF2"].WaferManager.Wafers[0];
  966. }
  967. Puf2ModuleInfo = ModuleManager.ModuleInfos["PUF2"];
  968. }
  969. if (Srd1IsInstalled)
  970. {
  971. if (ModuleManager.ModuleInfos["SRD1"].WaferManager.Wafers.Count != 0)
  972. {
  973. Srd1Wafer = ModuleManager.ModuleInfos["SRD1"].WaferManager.Wafers[0];
  974. }
  975. Srd1ModuleInfo = ModuleManager.ModuleInfos["SRD1"];
  976. }
  977. if (Srd2IsInstalled)
  978. {
  979. if (ModuleManager.ModuleInfos["SRD2"].WaferManager.Wafers.Count != 0)
  980. {
  981. Srd2Wafer = ModuleManager.ModuleInfos["SRD2"].WaferManager.Wafers[0];
  982. }
  983. Srd2ModuleInfo = ModuleManager.ModuleInfos["SRD2"];
  984. }
  985. LP1ModuleInfo = ModuleManager.ModuleInfos["LP1"];
  986. LP2ModuleInfo = ModuleManager.ModuleInfos["LP2"];
  987. LP3ModuleInfo = ModuleManager.ModuleInfos["LP3"];
  988. EFEMModuleInfo = ModuleManager.ModuleInfos["EfemRobot"];
  989. if (ModuleManager.ModuleInfos["EfemRobot"].WaferManager.Wafers.Count != 0)
  990. {
  991. BladeAWafer = ModuleManager.ModuleInfos["EfemRobot"].WaferManager.Wafers[0];
  992. }
  993. if (ModuleManager.ModuleInfos["Aligner1"].WaferManager.Wafers.Count != 0)
  994. {
  995. Aligner1Wafer = ModuleManager.ModuleInfos["Aligner1"].WaferManager.Wafers[0];
  996. }
  997. RtDataValues = QueryDataClient.Instance.Service.PollData(m_RtDataKeys);
  998. if(RtDataValues!=null)
  999. {
  1000. IsHomeAllEnable = !CommonFunction.GetValue<bool>(RtDataValues, "System.IsAutoMode");
  1001. Puf1IsInRobotStation = CommonFunction.GetValue<bool>(RtDataValues, "PUF1.IsInRobotStation");
  1002. Puf2IsInRobotStation = CommonFunction.GetValue<bool>(RtDataValues, "PUF2.IsInRobotStation");
  1003. ControlJobInfo lp1Cj = CommonFunction.GetValue<ControlJobInfo>(RtDataValues, "LP1.CurrentControlJob");
  1004. IsLP1HasNoJob = lp1Cj == null ? true : false;
  1005. ControlJobInfo lp2Cj = CommonFunction.GetValue<ControlJobInfo>(RtDataValues, "LP2.CurrentControlJob");
  1006. IsLP2HasNoJob = lp2Cj == null ? true : false;
  1007. ControlJobInfo lp3Cj = CommonFunction.GetValue<ControlJobInfo>(RtDataValues, "LP3.CurrentControlJob");
  1008. IsLP3HasNoJob = lp3Cj == null ? true : false;
  1009. }
  1010. RobotMoveInfo = (RobotMoveInfo)QueryDataClient.Instance.Service.GetData("EFEM.RobotMoveAction");
  1011. Dummy1ModuleInfo = ModuleManager.ModuleInfos["Dummy1"];
  1012. Dummy1WaferCount = Dummy1ModuleInfo.WaferManager.Wafers.Where(x => x.WaferStatus != 0).Count();
  1013. Dummy2ModuleInfo = ModuleManager.ModuleInfos["Dummy2"];
  1014. Dummy2WaferCount = Dummy2ModuleInfo.WaferManager.Wafers.Where(x => x.WaferStatus != 0).Count();
  1015. IsLP1Unable = (bool)QueryDataClient.Instance.Service.GetConfig("EFEM.IsLoadPort1Unable");
  1016. IsLP2Unable = (bool)QueryDataClient.Instance.Service.GetConfig("EFEM.IsLoadPort2Unable");
  1017. IsLP3Unable = (bool)QueryDataClient.Instance.Service.GetConfig("EFEM.IsLoadPort3Unable");
  1018. }
  1019. private void Init()
  1020. {
  1021. m_RtDataKeys.Add("System.IsAutoMode");
  1022. m_RtDataKeys.Add("LP1.Status");
  1023. m_RtDataKeys.Add("LP2.Status");
  1024. m_RtDataKeys.Add("LP3.Status");
  1025. m_RtDataKeys.Add("LP1.IsLoaded");
  1026. m_RtDataKeys.Add("LP2.IsLoaded");
  1027. m_RtDataKeys.Add("LP3.IsLoaded");
  1028. m_RtDataKeys.Add("LP1.CarrierId");
  1029. m_RtDataKeys.Add("LP2.CarrierId");
  1030. m_RtDataKeys.Add("LP3.CarrierId");
  1031. m_RtDataKeys.Add("LP1.IsClamped");
  1032. m_RtDataKeys.Add("LP2.IsClamped");
  1033. m_RtDataKeys.Add("LP3.IsClamped");
  1034. m_RtDataKeys.Add("LP1.IsDocked");
  1035. m_RtDataKeys.Add("LP2.IsDocked");
  1036. m_RtDataKeys.Add("LP3.IsDocked");
  1037. m_RtDataKeys.Add("LP1.IsDoorOpened");
  1038. m_RtDataKeys.Add("LP2.IsDoorOpened");
  1039. m_RtDataKeys.Add("LP3.IsDoorOpened");
  1040. m_RtDataKeys.Add("TM.LLATSlitDoor.IsClosed");
  1041. m_RtDataKeys.Add("TM.LLBTSlitDoor.IsClosed");
  1042. m_RtDataKeys.Add("TM.LLAESlitDoor.IsClosed");
  1043. m_RtDataKeys.Add("TM.LLBESlitDoor.IsClosed");
  1044. m_RtDataKeys.Add("LP1.CassettePlaced");
  1045. m_RtDataKeys.Add("LP2.CassettePlaced");
  1046. m_RtDataKeys.Add("LP3.CassettePlaced");
  1047. m_RtDataKeys.Add("PUF1.IsInRobotStation");
  1048. m_RtDataKeys.Add("PUF2.IsInRobotStation");
  1049. m_RtDataKeys.Add("LP1.CurrentControlJob");
  1050. m_RtDataKeys.Add("LP2.CurrentControlJob");
  1051. m_RtDataKeys.Add("LP3.CurrentControlJob");
  1052. m_RtDataKeys.Add("LP1.WaferSize");
  1053. m_RtDataKeys.Add("LP2.WaferSize");
  1054. m_RtDataKeys.Add("LP3.WaferSize");
  1055. }
  1056. /// <summary>
  1057. /// Robot位置信息变更(动画)
  1058. /// </summary>
  1059. /// <param name="oldValue"></param>
  1060. /// <param name="newValue"></param>
  1061. private async void RobotMoveInfoChanged(RobotMoveInfo oldValue, RobotMoveInfo newValue)
  1062. {
  1063. if (oldValue == null || newValue == null)
  1064. {
  1065. return;
  1066. }
  1067. if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && (newValue.Action == RobotAction.Placing || newValue.Action == RobotAction.Picking))
  1068. {
  1069. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  1070. if (TMRobotMoveActionBladeTarget != null)
  1071. {
  1072. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  1073. }
  1074. else
  1075. {
  1076. return;
  1077. }
  1078. var values = RobotTarget.Split('.');
  1079. var arm = values[0];
  1080. var module = values[1];
  1081. if (arm == "ArmA")
  1082. {
  1083. var robot1Robot1TAction= (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  1084. //Robot整体平移动画
  1085. await ChangePosition(robot1Robot1TAction, newValue.Action);
  1086. if (Robot1TAction != robot1Robot1TAction)
  1087. {
  1088. Robot1TAction = robot1Robot1TAction;
  1089. await Task.Delay(600);
  1090. }
  1091. //await Task.Delay(1500);
  1092. Robot1XAction = WaferRobotXAction.Extend;
  1093. 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))
  1094. {
  1095. await Task.Delay(100);
  1096. }
  1097. Robot1XAction = WaferRobotXAction.Retract;
  1098. if(newValue.Action == RobotAction.Placing)
  1099. {
  1100. await ChangePosition(WaferRobotTAction.T_Origin, newValue.Action);
  1101. }
  1102. }
  1103. }
  1104. #region Home
  1105. else if (oldValue.Action == RobotAction.None && newValue.Action == RobotAction.Homing)
  1106. {
  1107. if (Robot1XAction == WaferRobotXAction.Extend||Robot2XAction == WaferRobotXAction.Extend2)
  1108. {
  1109. Robot1XAction = WaferRobotXAction.Retract2;
  1110. }
  1111. if (Robot2XAction == WaferRobotXAction.Extend|| Robot2XAction == WaferRobotXAction.Extend2)
  1112. {
  1113. Robot2XAction = WaferRobotXAction.Retract2;
  1114. }
  1115. await Task.Delay(2000);
  1116. if (Robot1TAction != WaferRobotTAction.T_Origin)
  1117. {
  1118. Robot1TAction = WaferRobotTAction.T_Origin;
  1119. }
  1120. if (Robot2TAction != WaferRobotTAction.T_Origin)
  1121. {
  1122. Robot2TAction = WaferRobotTAction.T_Origin;
  1123. }
  1124. if (CurrentRobotPosition != EFEM.RobotPosition.Origin)
  1125. {
  1126. CurrentRobotPosition = EFEM.RobotPosition.Origin;
  1127. }
  1128. await ChangePosition(WaferRobotTAction.T_Origin, newValue.Action);
  1129. }
  1130. #endregion
  1131. }
  1132. private async Task ChangePosition(WaferRobotTAction waferRobotTAction, RobotAction robotAction)
  1133. {
  1134. //CurrentRobotPosition = RobotPosition.Origin;
  1135. //await Task.Delay(1000);
  1136. if(robotAction == RobotAction.Placing)
  1137. {
  1138. if (waferRobotTAction == WaferRobotTAction.LP1 || waferRobotTAction == WaferRobotTAction.PUF1)
  1139. {
  1140. CurrentRobotPosition = EFEM.RobotPosition.Left_Place;
  1141. }
  1142. else if (waferRobotTAction == WaferRobotTAction.LP3)
  1143. {
  1144. CurrentRobotPosition = EFEM.RobotPosition.Right_Place;
  1145. }
  1146. else if (waferRobotTAction == WaferRobotTAction.LP2 || waferRobotTAction == WaferRobotTAction.PUF2)
  1147. {
  1148. CurrentRobotPosition = EFEM.RobotPosition.Middle_Place;
  1149. }
  1150. else if (waferRobotTAction == WaferRobotTAction.Aligner1)
  1151. {
  1152. CurrentRobotPosition = EFEM.RobotPosition.Aligner_Place;
  1153. }
  1154. else if (waferRobotTAction == WaferRobotTAction.SRD1 || waferRobotTAction == WaferRobotTAction.SRD2)
  1155. {
  1156. CurrentRobotPosition = EFEM.RobotPosition.SRD_Place;
  1157. }
  1158. else if (waferRobotTAction == WaferRobotTAction.Dummy1 || waferRobotTAction == WaferRobotTAction.Dummy2)
  1159. {
  1160. CurrentRobotPosition = EFEM.RobotPosition.Dummy_Place;
  1161. }
  1162. else
  1163. {
  1164. CurrentRobotPosition = EFEM.RobotPosition.Origin;
  1165. }
  1166. }
  1167. else
  1168. {
  1169. if (waferRobotTAction == WaferRobotTAction.LP1 || waferRobotTAction == WaferRobotTAction.PUF1)
  1170. {
  1171. CurrentRobotPosition = EFEM.RobotPosition.Left;
  1172. }
  1173. else if (waferRobotTAction == WaferRobotTAction.LP3)
  1174. {
  1175. CurrentRobotPosition = EFEM.RobotPosition.Right;
  1176. }
  1177. else if (waferRobotTAction == WaferRobotTAction.LP2 || waferRobotTAction == WaferRobotTAction.PUF2)
  1178. {
  1179. CurrentRobotPosition = EFEM.RobotPosition.Middle;
  1180. }
  1181. else if (waferRobotTAction == WaferRobotTAction.Aligner1)
  1182. {
  1183. CurrentRobotPosition = EFEM.RobotPosition.Aligner;
  1184. }
  1185. else if (waferRobotTAction == WaferRobotTAction.SRD1 || waferRobotTAction == WaferRobotTAction.SRD2)
  1186. {
  1187. CurrentRobotPosition = EFEM.RobotPosition.SRD;
  1188. }
  1189. else if (waferRobotTAction == WaferRobotTAction.Dummy1 || waferRobotTAction == WaferRobotTAction.Dummy2)
  1190. {
  1191. CurrentRobotPosition = EFEM.RobotPosition.Dummy;
  1192. }
  1193. else
  1194. {
  1195. CurrentRobotPosition = EFEM.RobotPosition.Origin;
  1196. }
  1197. }
  1198. await Task.Delay(600);
  1199. }
  1200. #endregion
  1201. }
  1202. }