VenusDeOperationOverViewModel.cs 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086
  1. using MECF.Framework.Common.CommonData;
  2. using MECF.Framework.Common.DataCenter;
  3. using MECF.Framework.Common.Equipment;
  4. using MECF.Framework.Common.OperationCenter;
  5. using OpenSEMI.ClientBase;
  6. using Prism.Commands;
  7. using Prism.Mvvm;
  8. using System;
  9. using System.Collections.Generic;
  10. using System.Linq;
  11. using System.Text;
  12. using System.Threading.Tasks;
  13. using Venus_Core;
  14. using Venus_Themes.CustomControls;
  15. using System.Windows.Threading;
  16. using Venus_MainPages.Unity;
  17. using Microsoft.VisualBasic;
  18. using ExcelLibrary.BinaryFileFormat;
  19. using MECF.Framework.Common.Schedulers;
  20. using Venus_MainPages.Views;
  21. using System.Windows;
  22. using static Venus_Themes.CustomControls.SERobot;
  23. using System.Security.RightsManagement;
  24. namespace Venus_MainPages.ViewModels
  25. {
  26. public class VenusDeOperationOverViewModel : BindableBase
  27. {
  28. #region 私有字段
  29. private ModuleInfo m_VCEAModuleInfo;
  30. private ModuleInfo m_VCEBModuleInfo;
  31. private ModuleInfo m_PMAModuleInfo;
  32. private ModuleInfo m_PMBModuleInfo;
  33. private ModuleInfo m_PMCModuleInfo;
  34. private ModuleInfo m_PMDModuleInfo;
  35. private ModuleInfo m_VPAModuleInfo;
  36. private ModuleInfo m_TMModuleInfo;
  37. public WaferInfo m_PMAWafer;
  38. public WaferInfo m_PMBWafer;
  39. public WaferInfo m_PMCWafer;
  40. public WaferInfo m_PMDWafer;
  41. public WaferInfo m_RobotUpperWafer;
  42. public WaferInfo m_RobotLowerWafer;
  43. public WaferInfo m_PAWafer;
  44. private SERobotTAction m_Robot1TAction;
  45. private SERobotXAction m_Robot1XAction;
  46. private SERobotTAction m_Robot2TAction;
  47. private SERobotXAction m_Robot2XAction;
  48. public RobotMoveInfo m_robotMoveInfo;
  49. private int m_VCEAWaferCount;
  50. private int m_VCEBWaferCount;
  51. private bool m_PMAIsInstalled;
  52. private bool m_PMBIsInstalled;
  53. private bool m_PMCIsInstalled;
  54. private bool m_PMDIsInstalled;
  55. private bool m_VCEAIsInstalled;
  56. private bool m_VCEBIsInstalled;
  57. private bool m_VCEADoorIsOpen;
  58. private bool m_VCEBDoorIsOpen;
  59. private bool m_PMADoorIsOpen;
  60. private bool m_PMBDoorIsOpen;
  61. private bool m_PMCDoorIsOpen;
  62. private bool m_PMDDoorIsOpen;
  63. private bool m_VCEAOutDoorIsOpen;
  64. private bool m_VCEBOutDoorIsOpen;
  65. private Dictionary<string, object> m_RtDataValues = new Dictionary<string, object>();
  66. private List<string> m_RtDataKeys = new List<string>();
  67. private double m_PMAPercent;
  68. private double m_PMBPercent;
  69. private double m_PMCPercent;
  70. private double m_PMDPercent;
  71. private double m_VCEAPercent;
  72. private double m_VCEBPercent;
  73. private int m_PickNum;
  74. private RecipeResult m_PMARecipeResult;
  75. private RecipeResult m_PMBRecipeResult;
  76. private RecipeResult m_PMCRecipeResult;
  77. private RecipeResult m_PMDRecipeResult;
  78. private WaferAssociationInfo m_VCEAwaferAssociation;
  79. private WaferAssociationInfo m_VCEBwaferAssociation;
  80. private bool loadflag;
  81. #endregion
  82. #region 属性
  83. public SERobotTAction Robot1TAction
  84. {
  85. get { return m_Robot1TAction; }
  86. set { SetProperty(ref m_Robot1TAction, value); }
  87. }
  88. private DelegateCommand<object> _AbortJobCommand;
  89. public DelegateCommand<object> AbortJobCommand =>
  90. _AbortJobCommand ?? (_AbortJobCommand = new DelegateCommand<object>(OnAbortJob));
  91. public SERobotXAction Robot1XAction
  92. {
  93. get { return m_Robot1XAction; }
  94. set { SetProperty(ref m_Robot1XAction, value); }
  95. }
  96. public SERobotTAction Robot2TAction
  97. {
  98. get { return m_Robot2TAction; }
  99. set { SetProperty(ref m_Robot2TAction, value); }
  100. }
  101. public SERobotXAction Robot2XAction
  102. {
  103. get { return m_Robot2XAction; }
  104. set { SetProperty(ref m_Robot2XAction, value); }
  105. }
  106. public RobotMoveInfo RobotMoveInfo
  107. {
  108. get { return m_robotMoveInfo; }
  109. set
  110. {
  111. //RobotMoveInfoChanged(m_robotMoveInfo, value);
  112. m_robotMoveInfo = value;
  113. }
  114. }
  115. public RecipeResult PMARecipeResult
  116. {
  117. get { return m_PMARecipeResult; }
  118. set { SetProperty(ref m_PMARecipeResult, value); }
  119. }
  120. public RecipeResult PMBRecipeResult
  121. {
  122. get { return m_PMBRecipeResult; }
  123. set { SetProperty(ref m_PMBRecipeResult, value); }
  124. }
  125. public RecipeResult PMCRecipeResult
  126. {
  127. get { return m_PMCRecipeResult; }
  128. set { SetProperty(ref m_PMCRecipeResult, value); }
  129. }
  130. public RecipeResult PMDRecipeResult
  131. {
  132. get { return m_PMDRecipeResult; }
  133. set { SetProperty(ref m_PMDRecipeResult, value); }
  134. }
  135. public double PMAPercent
  136. {
  137. get { return m_PMAPercent; }
  138. set { SetProperty(ref m_PMAPercent, value); }
  139. }
  140. public double PMBPercent
  141. {
  142. get { return m_PMBPercent; }
  143. set { SetProperty(ref m_PMBPercent, value); }
  144. }
  145. public double PMCPercent
  146. {
  147. get { return m_PMCPercent; }
  148. set { SetProperty(ref m_PMCPercent, value); }
  149. }
  150. public double PMDPercent
  151. {
  152. get { return m_PMDPercent; }
  153. set { SetProperty(ref m_PMDPercent, value); }
  154. }
  155. public double VCEAPercent
  156. {
  157. get { return m_VCEAPercent; }
  158. set { SetProperty(ref m_VCEAPercent, value); }
  159. }
  160. public double VCEBPercent
  161. {
  162. get { return m_VCEBPercent; }
  163. set { SetProperty(ref m_VCEBPercent, value); }
  164. }
  165. public int PickNum
  166. {
  167. get { return m_PickNum; }
  168. set { SetProperty(ref m_PickNum, value); }
  169. }
  170. public WaferInfo PMAWafer
  171. {
  172. get { return m_PMAWafer; }
  173. set { SetProperty(ref m_PMAWafer, value); }
  174. }
  175. public WaferInfo PMBWafer
  176. {
  177. get { return m_PMBWafer; }
  178. set { SetProperty(ref m_PMBWafer, value); }
  179. }
  180. public WaferInfo PMCWafer
  181. {
  182. get { return m_PMCWafer; }
  183. set { SetProperty(ref m_PMCWafer, value); }
  184. }
  185. public WaferInfo PMDWafer
  186. {
  187. get { return m_PMDWafer; }
  188. set { SetProperty(ref m_PMDWafer, value); }
  189. }
  190. public WaferInfo RobotUpperWafer
  191. {
  192. get { return m_RobotUpperWafer; }
  193. set { SetProperty(ref m_RobotUpperWafer, value); }
  194. }
  195. public WaferInfo RobotLowerWafer
  196. {
  197. get { return m_RobotLowerWafer; }
  198. set { SetProperty(ref m_RobotLowerWafer, value); }
  199. }
  200. public WaferInfo PAWafer
  201. {
  202. get { return m_PAWafer; }
  203. set { SetProperty(ref m_PAWafer, value); }
  204. }
  205. public ModuleInfo VCEAModuleInfo
  206. {
  207. get { return m_VCEAModuleInfo; }
  208. set
  209. {
  210. SetProperty(ref m_VCEAModuleInfo, value);
  211. }
  212. }
  213. public ModuleInfo VCEBModuleInfo
  214. {
  215. get { return m_VCEBModuleInfo; }
  216. set
  217. {
  218. SetProperty(ref m_VCEBModuleInfo, value);
  219. }
  220. }
  221. public ModuleInfo PMAModuleInfo
  222. {
  223. get { return m_PMAModuleInfo; }
  224. set
  225. {
  226. SetProperty(ref m_PMAModuleInfo, value);
  227. }
  228. }
  229. public ModuleInfo PMBModuleInfo
  230. {
  231. get { return m_PMBModuleInfo; }
  232. set
  233. {
  234. SetProperty(ref m_PMBModuleInfo, value);
  235. }
  236. }
  237. public ModuleInfo PMCModuleInfo
  238. {
  239. get { return m_PMCModuleInfo; }
  240. set
  241. {
  242. SetProperty(ref m_PMCModuleInfo, value);
  243. }
  244. }
  245. public ModuleInfo PMDModuleInfo
  246. {
  247. get { return m_PMDModuleInfo; }
  248. set
  249. {
  250. SetProperty(ref m_PMDModuleInfo, value);
  251. }
  252. }
  253. public ModuleInfo VPAModuleInfo
  254. {
  255. get { return m_VPAModuleInfo; }
  256. set
  257. {
  258. SetProperty(ref m_VPAModuleInfo, value);
  259. }
  260. }
  261. public ModuleInfo TMModuleInfo
  262. {
  263. get { return m_TMModuleInfo; }
  264. set
  265. {
  266. SetProperty(ref m_TMModuleInfo, value);
  267. }
  268. }
  269. public bool PMAIsInstalled
  270. {
  271. get { return m_PMAIsInstalled; }
  272. set
  273. {
  274. SetProperty(ref m_PMAIsInstalled, value);
  275. }
  276. }
  277. public bool PMBIsInstalled
  278. {
  279. get { return m_PMBIsInstalled; }
  280. set
  281. {
  282. SetProperty(ref m_PMBIsInstalled, value);
  283. }
  284. }
  285. public bool PMCIsInstalled
  286. {
  287. get { return m_PMCIsInstalled; }
  288. set
  289. {
  290. SetProperty(ref m_PMCIsInstalled, value);
  291. }
  292. }
  293. public bool PMDIsInstalled
  294. {
  295. get { return m_PMDIsInstalled; }
  296. set
  297. {
  298. SetProperty(ref m_PMDIsInstalled, value);
  299. }
  300. }
  301. public bool VCEAIsInstalled
  302. {
  303. get { return m_VCEAIsInstalled; }
  304. set
  305. {
  306. SetProperty(ref m_VCEAIsInstalled, value);
  307. }
  308. }
  309. public bool VCEBIsInstalled
  310. {
  311. get { return m_VCEBIsInstalled; }
  312. set
  313. {
  314. SetProperty(ref m_VCEBIsInstalled, value);
  315. }
  316. }
  317. public bool VCEADoorIsOpen { get => m_VCEADoorIsOpen; set => SetProperty(ref m_VCEADoorIsOpen, value); }
  318. public bool VCEBDoorIsOpen { get => m_VCEBDoorIsOpen; set => SetProperty(ref m_VCEBDoorIsOpen, value); }
  319. public bool PMADoorIsOpen { get => m_PMADoorIsOpen; set => SetProperty(ref m_PMADoorIsOpen, value); }
  320. public bool PMBDoorIsOpen { get => m_PMBDoorIsOpen; set => SetProperty(ref m_PMBDoorIsOpen, value); }
  321. public bool PMCDoorIsOpen { get => m_PMCDoorIsOpen; set => SetProperty(ref m_PMCDoorIsOpen, value); }
  322. public bool PMDDoorIsOpen { get => m_PMDDoorIsOpen; set => SetProperty(ref m_PMDDoorIsOpen, value); }
  323. public bool VCEAOutDoorIsOpen { get => m_VCEAOutDoorIsOpen; set => SetProperty(ref m_VCEAOutDoorIsOpen, value); }
  324. public bool VCEBOutDoorIsOpen { get => m_VCEBOutDoorIsOpen; set => SetProperty(ref m_VCEBOutDoorIsOpen, value); }
  325. public int VCEAWaferCount
  326. {
  327. get { return m_VCEAWaferCount; }
  328. set
  329. {
  330. SetProperty(ref m_VCEAWaferCount, value);
  331. }
  332. }
  333. public int VCEBWaferCount
  334. {
  335. get { return m_VCEBWaferCount; }
  336. set
  337. {
  338. SetProperty(ref m_VCEBWaferCount, value);
  339. }
  340. }
  341. public Dictionary<string, object> RtDataValues
  342. {
  343. get { return m_RtDataValues; }
  344. set { SetProperty(ref m_RtDataValues, value); }
  345. }
  346. public WaferAssociationInfo VCEAwaferAssociation
  347. {
  348. get { return m_VCEAwaferAssociation; }
  349. set { SetProperty(ref m_VCEAwaferAssociation, value); }
  350. }
  351. public WaferAssociationInfo VCEBwaferAssociation
  352. {
  353. get { return m_VCEBwaferAssociation; }
  354. set { SetProperty(ref m_VCEBwaferAssociation, value); }
  355. }
  356. #endregion
  357. #region 命令
  358. private DelegateCommand _HomeAll;
  359. public DelegateCommand HomeAll => _HomeAll ?? (_HomeAll = new DelegateCommand(onHomeAll));
  360. private DelegateCommand _SetAutoMode;
  361. public DelegateCommand SetAutoMode => _SetAutoMode ?? (_SetAutoMode = new DelegateCommand(onSetAutoMode));
  362. private DelegateCommand _SetManualMode;
  363. public DelegateCommand SetManualMode => _SetManualMode ?? (_SetManualMode = new DelegateCommand(onSetManualMode));
  364. private DelegateCommand _StartSETMCycle;
  365. public DelegateCommand StartSETMCycle => _StartSETMCycle ?? (_StartSETMCycle = new DelegateCommand(onStartSETMCycle));
  366. private DelegateCommand<object> _StartCommand;
  367. public DelegateCommand<object> StartCommand =>
  368. _StartCommand ?? (_StartCommand = new DelegateCommand<object>(OnStart));
  369. private DelegateCommand _StopCycle;
  370. public DelegateCommand StopCycle => _StopCycle ?? (_StopCycle = new DelegateCommand(onStopCycle));
  371. private DelegateCommand<object> _VCEHome;
  372. public DelegateCommand<object> VCEHome => _VCEHome ?? (_VCEHome = new DelegateCommand<object>(vceHome));
  373. private DelegateCommand<object> _VCEReadMap;
  374. public DelegateCommand<object> VCEReadMap => _VCEReadMap ?? (_VCEReadMap = new DelegateCommand<object>(vceReadMap));
  375. private DelegateCommand<object> _VCELoadPrepare;
  376. public DelegateCommand<object> VCELoadPrepare =>
  377. _VCELoadPrepare ?? (_VCELoadPrepare = new DelegateCommand<object>(vceLoadPrepare));
  378. private DelegateCommand<object> __VCELoad;
  379. public DelegateCommand<object> VCELoad =>
  380. __VCELoad ?? (__VCELoad = new DelegateCommand<object>(vceLoad));
  381. private DelegateCommand<object> __VCELoadWithSMIF;
  382. public DelegateCommand<object> VCELoadWithSMIF =>
  383. __VCELoadWithSMIF ?? (__VCELoadWithSMIF = new DelegateCommand<object>(vceLoadWithSMIF));
  384. private DelegateCommand<object> __VCEUnLoadWithSMIF;
  385. public DelegateCommand<object> VCEUnLoadWithSMIF =>
  386. __VCEUnLoadWithSMIF ?? (__VCEUnLoadWithSMIF = new DelegateCommand<object>(vceUnLoadWithSMIF));
  387. private DelegateCommand<object> _VCEUnLoad;
  388. public DelegateCommand<object> VCEUnLoad =>
  389. _VCEUnLoad ?? (_VCEUnLoad = new DelegateCommand<object>(vceUnLoad));
  390. private DelegateCommand _SMIFLoad;
  391. public DelegateCommand SMIFLoad =>
  392. _SMIFLoad ?? (_SMIFLoad = new DelegateCommand(smifLoad));
  393. private DelegateCommand _SMIFULoad;
  394. public DelegateCommand SMIFULoad =>
  395. _SMIFULoad ?? (_SMIFULoad = new DelegateCommand(smifUnLoad));
  396. private DelegateCommand _tmhome;
  397. public DelegateCommand TmHome =>
  398. _tmhome ?? (_tmhome = new DelegateCommand(tmhome));
  399. private DelegateCommand _tmPick;
  400. public DelegateCommand TmPick =>
  401. _tmPick ?? (_tmPick = new DelegateCommand(tmpick));
  402. private DelegateCommand _tmPlace;
  403. public DelegateCommand TMPlace =>
  404. _tmPlace ?? (_tmPlace = new DelegateCommand(tmplace));
  405. //private DelegateCommand _tmSave;
  406. private DelegateCommand _LoadCommand;
  407. public DelegateCommand LoadCommand =>
  408. _LoadCommand ?? (_LoadCommand = new DelegateCommand(OnLoad));
  409. private DelegateCommand _PauseAllJobCommand;
  410. public DelegateCommand PauseAllJobCommand =>
  411. _PauseAllJobCommand ?? (_PauseAllJobCommand = new DelegateCommand(OnPauseAllJob));
  412. private DelegateCommand _AbortAllCommand;
  413. public DelegateCommand AbortAllCommand =>
  414. _AbortAllCommand ?? (_AbortAllCommand = new DelegateCommand(OnAbortAll));
  415. private DelegateCommand<object> _SetSequenceCommand;
  416. public DelegateCommand<object> SetSequenceCommand =>
  417. _SetSequenceCommand ?? (_SetSequenceCommand = new DelegateCommand<object>(OnSetSequence));
  418. private DelegateCommand<object> _CreateJobCommand;
  419. public DelegateCommand<object> CreateJobCommand =>
  420. _CreateJobCommand ?? (_CreateJobCommand = new DelegateCommand<object>(OnCreateJob));
  421. private DelegateCommand<object> _SelectAllCommand;
  422. public DelegateCommand<object> SelectAllCommand =>
  423. _SelectAllCommand ?? (_SelectAllCommand = new DelegateCommand<object>(OnSelectAll));
  424. private DelegateCommand<object> _UnSelectAllCommand;
  425. public DelegateCommand<object> UnSelectAllCommand =>
  426. _UnSelectAllCommand ?? (_UnSelectAllCommand = new DelegateCommand<object>(OnDeSelectAll));
  427. private DelegateCommand<object> _ReturnAllWafer;
  428. public DelegateCommand<object> ReturnAllWafer =>
  429. _ReturnAllWafer ?? (_ReturnAllWafer = new DelegateCommand<object>(OnReturnAllWafer));
  430. #endregion
  431. #region 构造函数
  432. public VenusDeOperationOverViewModel()
  433. {
  434. //页面不刷错的方法 页面中的PM做成List的形式 通过itemsource显示 同时提供各个位置的pm点位 旋转角度
  435. VCEAWaferCount = 25;
  436. VCEBWaferCount = 25;
  437. string[] allModules = QueryDataClient.Instance.Service.GetConfig($"System.InstalledModules").ToString().Split(',');
  438. PMAIsInstalled = allModules.Contains("PMA");
  439. PMBIsInstalled = allModules.Contains("PMB");
  440. PMCIsInstalled = allModules.Contains("PMC");
  441. PMDIsInstalled = allModules.Contains("PMD");
  442. VCEAIsInstalled = allModules.Contains("VCEA");
  443. VCEBIsInstalled = allModules.Contains("VCEB");
  444. addDataKeys();
  445. RtDataValues = QueryDataClient.Instance.Service.PollData(m_RtDataKeys);
  446. VCEADoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "DETM.VCESlitDoorClosed");
  447. VCEBDoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "DETM.VCESlitDoorClosed");
  448. PMADoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "DETM.PMASlitDoorClosed");
  449. PMBDoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "DETM.PMBSlitDoorClosed");
  450. PMCDoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "DETM.PMCSlitDoorClosed");
  451. PMDDoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "DETM.PMDSlitDoorClosed");
  452. VCEAOutDoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "VCEA.VCEOutDoorClosed");
  453. VCEBOutDoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "VCEB.VCEOutDoorClosed");
  454. loadflag = false;
  455. DispatcherTimer timer = new DispatcherTimer();
  456. timer.Interval = TimeSpan.FromSeconds(0.1);
  457. timer.Tick += Timer_Tick;
  458. timer.Start();
  459. }
  460. #endregion
  461. #region 命令实现
  462. private void OnLoad()
  463. {
  464. if (!loadflag)
  465. {
  466. if (VCEAIsInstalled && VCEAwaferAssociation == null)
  467. {
  468. VCEAwaferAssociation = new WaferAssociationInfo
  469. {
  470. ModuleData = ModuleManager.ModuleInfos["LP1"]
  471. };
  472. }
  473. if (VCEBIsInstalled && VCEBwaferAssociation == null)
  474. {
  475. VCEBwaferAssociation = new WaferAssociationInfo
  476. {
  477. ModuleData = ModuleManager.ModuleInfos["LP2"]
  478. };
  479. }
  480. loadflag = true;
  481. }
  482. }
  483. private void OnAbortJob(object obj)
  484. {
  485. InvokeClient.Instance.Service.DoOperation("SE.AbortJob", obj.ToString());
  486. }
  487. private void OnSelectAll(object obj)
  488. {
  489. var info = obj as WaferAssociationInfo;
  490. info.SlotFrom = 1;
  491. info.SlotTo = 25;
  492. AssociateSequence(info, true);
  493. }
  494. private void OnDeSelectAll(object obj)
  495. {
  496. var info = obj as WaferAssociationInfo;
  497. info.SlotFrom = 1;
  498. info.SlotTo = 25;
  499. AssociateSequence(info, false);
  500. }
  501. private void OnReturnAllWafer(object obj)
  502. {
  503. WaferDialogView dialog = new WaferDialogView()
  504. {
  505. Owner = Application.Current.MainWindow,
  506. };
  507. dialog.Height = 300;
  508. dialog.Width = 400;
  509. double angel = 0;
  510. double coolingtime = 0;
  511. string message = "Please Confirm Return Wafer";
  512. WaferDialogViewModel vm = new WaferDialogViewModel();
  513. vm.ConfirmText = message;
  514. dialog.DataContext = vm;
  515. if (dialog.ShowDialog() == true)
  516. {
  517. if ((bool)dialog.AlignFlag == true && !string.IsNullOrEmpty(dialog.Angle))
  518. {
  519. angel = Convert.ToDouble(dialog.Angle);
  520. }
  521. if ((bool)dialog.CoolingFlag == true && !string.IsNullOrEmpty(dialog.CoolingTime))
  522. {
  523. coolingtime = Convert.ToDouble(dialog.CoolingTime);
  524. }
  525. InvokeClient.Instance.Service.DoOperation("System.ReturnAllSEWafer", dialog.CoolingFlag, coolingtime, dialog.AlignFlag, angel);
  526. }
  527. }
  528. private void OnCreateJob(object obj)
  529. {
  530. var info = obj as WaferAssociationInfo;
  531. List<string> slotSequence = new List<string>();
  532. info.ModuleData.WaferManager.Wafers.ForEach(key => { slotSequence.Insert(0, key.SequenceName); });
  533. string jobId = info.LotId.Trim();
  534. if (string.IsNullOrEmpty(jobId))
  535. jobId = "CJ_Local_" + info.ModuleData.ModuleID;
  536. info.LotId = jobId;
  537. info.JobID = jobId;
  538. info.JobStatus = "WaitingForStart";
  539. info.LotIdSaved = true;
  540. Dictionary<string, object> param = new Dictionary<string, object>()
  541. {
  542. {"JobId", jobId},
  543. {"Module", info.ModuleData.ModuleID},
  544. {"SlotSequence", slotSequence.ToArray()},
  545. {"AutoStart", true},
  546. };
  547. InvokeClient.Instance.Service.DoOperation("System.CreateSEJob", param);
  548. }
  549. private void OnSetSequence(object obj)
  550. {
  551. var info = obj as WaferInfo;
  552. bool flag = info.SequenceName != "" ? false : true;
  553. if (info.ModuleID == "VCEA")
  554. {
  555. AssociateSequence(VCEAwaferAssociation, flag, info.SlotID);
  556. }
  557. if (info.ModuleID == "VCEB")
  558. {
  559. AssociateSequence(VCEBwaferAssociation, flag, info.SlotID);
  560. }
  561. }
  562. private void OnPauseAllJob()
  563. {
  564. //InvokeClient.Instance.Service.DoOperation("System.PauseJob", VCEwaferAssociation.JobID);
  565. }
  566. private void OnAbortAll()
  567. {
  568. InvokeClient.Instance.Service.DoOperation("System.SEAbort");
  569. }
  570. private void AssociateSequence(WaferAssociationInfo info, bool flag, int slot = -1)
  571. {
  572. List<WaferInfo> wafers = info.ModuleData.WaferManager.Wafers;
  573. if (slot >= 0) //by wafer
  574. {
  575. int index = wafers.Count - slot - 1;
  576. if (index < wafers.Count)
  577. {
  578. //has wafer
  579. if (flag && !(wafers[index].WaferStatus == 0))
  580. wafers[index].SequenceName = info.SequenceName;
  581. else
  582. wafers[index].SequenceName = string.Empty;
  583. }
  584. }
  585. else //by from-to
  586. {
  587. for (int i = info.SlotFrom - 1; i < info.SlotTo; i++)
  588. {
  589. int index = wafers.Count - i - 1;
  590. if (index < wafers.Count)
  591. {
  592. if (flag && !(wafers[index].WaferStatus == 0))
  593. wafers[index].SequenceName = info.SequenceName;
  594. else
  595. wafers[index].SequenceName = string.Empty;
  596. }
  597. }
  598. }
  599. }
  600. private void addDataKeys()
  601. {
  602. m_RtDataKeys.Add($"DETM.VCEASlitDoorClosed");
  603. m_RtDataKeys.Add($"DETM.VCEBSlitDoorClosed");
  604. m_RtDataKeys.Add($"DETM.PMASlitDoorClosed");
  605. m_RtDataKeys.Add($"DETM.PMBSlitDoorClosed");
  606. m_RtDataKeys.Add($"DETM.PMCSlitDoorClosed");
  607. m_RtDataKeys.Add($"DETM.PMDSlitDoorClosed");
  608. m_RtDataKeys.Add($"DETM.TMPressure.Value");
  609. m_RtDataKeys.Add($"DETM.VCEAPressure.Value");
  610. m_RtDataKeys.Add($"DETM.VCEBPressure.Value");
  611. m_RtDataKeys.Add($"VCEA.VCEOutDoorClosed");
  612. m_RtDataKeys.Add($"VCEA.CassetteArrive");
  613. m_RtDataKeys.Add($"VCEB.VCEOutDoorClosed");
  614. m_RtDataKeys.Add($"VCEB.CassetteArrive");
  615. m_RtDataKeys.Add($"SEScheduler.CycledWafer");
  616. m_RtDataKeys.Add($"SEScheduler.CycleSetPoint");
  617. m_RtDataKeys.Add($"SEScheduler.CycleCount");
  618. m_RtDataKeys.Add($"SEScheduler.ThroughPut");
  619. m_RtDataKeys.Add($"PMA.ChamberPressure");
  620. m_RtDataKeys.Add($"PMA.VentingFlag");
  621. m_RtDataKeys.Add($"PMA.CurrentRecipeResult");
  622. m_RtDataKeys.Add($"PMB.ChamberPressure");
  623. m_RtDataKeys.Add($"PMB.VentingFlag");
  624. m_RtDataKeys.Add($"PMB.CurrentRecipeResult");
  625. m_RtDataKeys.Add($"PMC.ChamberPressure");
  626. m_RtDataKeys.Add($"PMC.VentingFlag");
  627. m_RtDataKeys.Add($"PMC.CurrentRecipeResult");
  628. m_RtDataKeys.Add($"PMD.ChamberPressure");
  629. m_RtDataKeys.Add($"PMD.VentingFlag");
  630. m_RtDataKeys.Add($"PMD.CurrentRecipeResult");
  631. //if (PMAIsInstalled)
  632. //{
  633. // m_RtDataKeys.Add($"PMA.ChamberPressure");
  634. // m_RtDataKeys.Add($"PMA.VentingFlag");
  635. // m_RtDataKeys.Add($"PMA.CurrentRecipeResult");
  636. //}
  637. //if (PMBIsInstalled)
  638. //{
  639. // m_RtDataKeys.Add($"PMB.ChamberPressure");
  640. // m_RtDataKeys.Add($"PMB.VentingFlag");
  641. // m_RtDataKeys.Add($"PMB.CurrentRecipeResult");
  642. //}
  643. //if (PMCIsInstalled)
  644. //{
  645. // m_RtDataKeys.Add($"PMC.ChamberPressure");
  646. // m_RtDataKeys.Add($"PMC.VentingFlag");
  647. // m_RtDataKeys.Add($"PMC.CurrentRecipeResult");
  648. //}
  649. }
  650. private void onHomeAll()
  651. {
  652. InvokeClient.Instance.Service.DoOperation("System.HomeAll");
  653. }
  654. private void onSetAutoMode()
  655. {
  656. InvokeClient.Instance.Service.DoOperation("System.SetAutoMode");
  657. }
  658. private void onSetManualMode()
  659. {
  660. InvokeClient.Instance.Service.DoOperation("System.SetManualMode");
  661. }
  662. private void onStopCycle()
  663. {
  664. InvokeClient.Instance.Service.DoOperation("System.StopSECycle");
  665. }
  666. private void onStartSETMCycle()
  667. {
  668. List<string> stations = new List<string>();
  669. stations.Add("VCEA");
  670. stations.Add("VPA");
  671. if (PMAIsInstalled)
  672. {
  673. stations.Add("PMA");
  674. }
  675. if (PMBIsInstalled)
  676. {
  677. stations.Add("PMB");
  678. }
  679. if (PMCIsInstalled)
  680. {
  681. stations.Add("PMC");
  682. }
  683. if (PMCIsInstalled)
  684. {
  685. stations.Add("PMD");
  686. }
  687. stations.Add("VCEA");
  688. InvokeClient.Instance.Service.DoOperation("System.SETMCycle", stations.ToArray(), 1);
  689. }
  690. private void OnStart(object obj)
  691. {
  692. var info = obj as WaferAssociationInfo;
  693. InvokeClient.Instance.Service.DoOperation("System.StartSEJob", info.LotId);
  694. }
  695. private void vceHome(object obj)
  696. {
  697. InvokeClient.Instance.Service.DoOperation($"{obj}.HOME");
  698. }
  699. private void vceReadMap(object obj)
  700. {
  701. InvokeClient.Instance.Service.DoOperation($"{obj}.ReadMap");
  702. }
  703. private void vceLoadPrepare(object obj)
  704. {
  705. InvokeClient.Instance.Service.DoOperation($"{obj}.LoadPrepare");
  706. }
  707. private void vceLoad(object obj)
  708. {
  709. InvokeClient.Instance.Service.DoOperation($"{obj}.SafeLoad");
  710. }
  711. private void vceLoadWithSMIF(object obj)
  712. {
  713. InvokeClient.Instance.Service.DoOperation($"{obj}.LoadWithSMIF");
  714. }
  715. private void vceUnLoadWithSMIF(object obj)
  716. {
  717. InvokeClient.Instance.Service.DoOperation($"{obj}.UnLoadWithSMIF");
  718. }
  719. private void vceUnLoad(object obj)
  720. {
  721. InvokeClient.Instance.Service.DoOperation($"{obj}.SafeUnload");
  722. }
  723. private void smifLoad() { }
  724. private void smifUnLoad() { }
  725. private void tmhome()
  726. {
  727. InvokeClient.Instance.Service.DoOperation("DETM.Home");
  728. }
  729. private void tmpick()
  730. {
  731. ModuleName target = ModuleName.VCE1;
  732. int slot = PickNum;
  733. MoveItem moveItem = new MoveItem(target, slot - 1, ModuleName.TMRobot, 0, 0);
  734. Queue<MoveItem> que = new Queue<MoveItem>();
  735. que.Enqueue(moveItem);
  736. InvokeClient.Instance.Service.DoOperation("DETM.Pick", que);
  737. }
  738. private void tmplace()
  739. {
  740. ModuleName target = ModuleName.VCE1;
  741. int slot = PickNum;
  742. MoveItem moveItem = new MoveItem(ModuleName.TMRobot, 0, target, slot - 1, 0);
  743. Queue<MoveItem> que = new Queue<MoveItem>();
  744. que.Enqueue(moveItem);
  745. InvokeClient.Instance.Service.DoOperation("DETM.Place", que);
  746. }
  747. #endregion
  748. #region 私有方法
  749. private void Timer_Tick(object sender, EventArgs e)
  750. {
  751. try
  752. {
  753. RtDataValues = QueryDataClient.Instance.Service.PollData(m_RtDataKeys);
  754. VCEADoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "DETM.VCEASlitDoorClosed");
  755. VCEBDoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "DETM.VCEBSlitDoorClosed");
  756. PMADoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "DETM.PMASlitDoorClosed");
  757. PMBDoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "DETM.PMBSlitDoorClosed");
  758. PMCDoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "DETM.PMCSlitDoorClosed");
  759. PMDDoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "DETM.PMDSlitDoorClosed");
  760. VCEAOutDoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "VCEA.VCEOutDoorClosed");
  761. VCEBOutDoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "VCEB.VCEOutDoorClosed");
  762. VCEAPercent = CommonFunction.GetValue<double>(RtDataValues, "DETM.VCEAPressure.Value") * 260 / 750000;
  763. VCEBPercent = CommonFunction.GetValue<double>(RtDataValues, "DETM.VCEBPressure.Value") * 260 / 750000;
  764. if (PMAIsInstalled == true)
  765. {
  766. PMAModuleInfo = ModuleManager.ModuleInfos["PMA"];
  767. PMAWafer = PMAModuleInfo.WaferManager.Wafers[0];
  768. PMAPercent = CommonFunction.GetValue<double>(RtDataValues, "PMA.ChamberPressure") * 260 / 750000;
  769. PMARecipeResult = CommonFunction.GetValue<RecipeResult>(RtDataValues, "PMA.CurrentRecipeResult");
  770. }
  771. if (PMBIsInstalled == true)
  772. {
  773. PMBModuleInfo = ModuleManager.ModuleInfos["PMB"];
  774. PMBWafer = PMBModuleInfo.WaferManager.Wafers[0];
  775. PMBPercent = CommonFunction.GetValue<double>(RtDataValues, "PMB.ChamberPressure") * 260 / 750000;
  776. PMBRecipeResult = CommonFunction.GetValue<RecipeResult>(RtDataValues, "PMB.CurrentRecipeResult");
  777. }
  778. if (PMCIsInstalled == true)
  779. {
  780. PMCModuleInfo = ModuleManager.ModuleInfos["PMC"];
  781. PMCWafer = PMCModuleInfo.WaferManager.Wafers[0];
  782. PMCPercent = CommonFunction.GetValue<double>(RtDataValues, "PMC.ChamberPressure") * 260 / 750000;
  783. PMCRecipeResult = CommonFunction.GetValue<RecipeResult>(RtDataValues, "PMC.CurrentRecipeResult");
  784. }
  785. if (PMDIsInstalled == true)
  786. {
  787. PMDModuleInfo = ModuleManager.ModuleInfos["PMD"];
  788. PMDWafer = PMCModuleInfo.WaferManager.Wafers[0];
  789. PMDPercent = CommonFunction.GetValue<double>(RtDataValues, "PMD.ChamberPressure") * 260 / 750000;
  790. PMDRecipeResult = CommonFunction.GetValue<RecipeResult>(RtDataValues, "PMD.CurrentRecipeResult");
  791. }
  792. if (VCEAIsInstalled == true)
  793. {
  794. VCEAModuleInfo = ModuleManager.ModuleInfos["LP1"];
  795. }
  796. if (VCEBIsInstalled == true)
  797. {
  798. VCEBModuleInfo = ModuleManager.ModuleInfos["LP2"];
  799. }
  800. RobotMoveInfo = (RobotMoveInfo)QueryDataClient.Instance.Service.GetData("DETM.RobotMoveAction");
  801. TMModuleInfo = ModuleManager.ModuleInfos["TMRobot"];
  802. RobotUpperWafer = TMModuleInfo.WaferManager.Wafers[0];
  803. RobotLowerWafer = TMModuleInfo.WaferManager.Wafers[1];
  804. PAWafer = ModuleManager.ModuleInfos["Aligner1"].WaferManager.Wafers[0];
  805. }
  806. catch
  807. {
  808. }
  809. }
  810. #endregion
  811. private async void RobotMoveInfoChanged(RobotMoveInfo oldValue, RobotMoveInfo newValue)
  812. {
  813. string RobotTarget;
  814. if (oldValue == null || newValue == null)
  815. {
  816. return;
  817. }
  818. #region Rotating
  819. if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && (newValue.Action == RobotAction.Rotating))
  820. {
  821. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  822. if (TMRobotMoveActionBladeTarget != null)
  823. {
  824. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  825. }
  826. else
  827. {
  828. return;
  829. }
  830. var values = RobotTarget.Split('.');
  831. var arm = values[0];
  832. var module = values[1];
  833. if (arm == "ArmA")
  834. {
  835. Robot1TAction = (SERobotTAction)Enum.Parse(typeof(SERobotTAction), module, true);
  836. }
  837. else if (arm == "ArmB")
  838. {
  839. Robot2TAction = (SERobotTAction)Enum.Parse(typeof(SERobotTAction), module, true);
  840. }
  841. }
  842. #endregion
  843. #region VPA、VCE1 Pick、Place
  844. else if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && (newValue.Action == RobotAction.Placing || newValue.Action == RobotAction.Picking))
  845. {
  846. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  847. if (TMRobotMoveActionBladeTarget != null)
  848. {
  849. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  850. }
  851. else
  852. {
  853. return;
  854. }
  855. var values = RobotTarget.Split('.');
  856. var arm = values[0];
  857. var module = values[1];
  858. if (arm == "ArmA")
  859. {
  860. var SERobotTAction = (SERobotTAction)Enum.Parse(typeof(SERobotTAction), module, true);
  861. if (SERobotTAction != Robot1TAction)
  862. {
  863. Robot1TAction = SERobotTAction;
  864. }
  865. else
  866. {
  867. //await Task.Delay(100);
  868. }
  869. await Task.Delay(600);
  870. if (module == "VCE1")
  871. {
  872. Robot1XAction = SERobotXAction.ToVCE;
  873. }
  874. else
  875. {
  876. Robot1XAction = SERobotXAction.Extend;
  877. }
  878. while ((newValue.Action == RobotAction.Placing && ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[0].WaferStatus != 0) || (newValue.Action == RobotAction.Picking && ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[0].WaferStatus == 0))
  879. {
  880. await Task.Delay(100);
  881. }
  882. Robot1XAction = SERobotXAction.Retract;
  883. }
  884. else if (arm == "ArmB")
  885. {
  886. var waferRobotTAction = (SERobotTAction)Enum.Parse(typeof(SERobotTAction), module, true);
  887. if (waferRobotTAction != Robot2TAction)
  888. {
  889. Robot2TAction = waferRobotTAction;
  890. }
  891. else
  892. {
  893. //await Task.Delay(100);
  894. }
  895. await Task.Delay(600);
  896. if (module == "VCE1")
  897. {
  898. Robot2XAction = SERobotXAction.ToVCE2;
  899. }
  900. else
  901. {
  902. Robot2XAction = SERobotXAction.Extend2;
  903. }
  904. while ((newValue.Action == RobotAction.Placing && ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[1].WaferStatus != 0) || (newValue.Action == RobotAction.Picking && ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[1].WaferStatus == 0))
  905. {
  906. await Task.Delay(100);
  907. }
  908. Robot2XAction = SERobotXAction.Retract2;
  909. }
  910. }
  911. #endregion
  912. #region PM pick、PM place
  913. else if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && newValue.Action == RobotAction.Extending)
  914. {
  915. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  916. if (TMRobotMoveActionBladeTarget != null)
  917. {
  918. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  919. }
  920. else
  921. {
  922. return;
  923. }
  924. var values = RobotTarget.Split('.');
  925. var arm = values[0];
  926. var module = values[1];
  927. if (arm == "ArmA")
  928. {
  929. var SERobotTAction = (SERobotTAction)Enum.Parse(typeof(SERobotTAction), module, true);
  930. if (SERobotTAction != Robot1TAction)
  931. {
  932. Robot1TAction = SERobotTAction;
  933. }
  934. else
  935. {
  936. // await Task.Delay(100);
  937. }
  938. await Task.Delay(600);
  939. Robot1XAction = SERobotXAction.Extend;
  940. }
  941. else if (arm == "ArmB")
  942. {
  943. var SERobotTAction = (SERobotTAction)Enum.Parse(typeof(SERobotTAction), module, true);
  944. if (SERobotTAction != Robot2TAction)
  945. {
  946. Robot2TAction = SERobotTAction;
  947. }
  948. else
  949. {
  950. // await Task.Delay(100);
  951. }
  952. await Task.Delay(600);
  953. Robot2XAction = SERobotXAction.Extend2;
  954. }
  955. }
  956. else if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && newValue.Action == RobotAction.Retracting)
  957. {
  958. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  959. if (TMRobotMoveActionBladeTarget != null)
  960. {
  961. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  962. }
  963. else
  964. {
  965. return;
  966. }
  967. var values = RobotTarget.Split('.');
  968. var arm = values[0];
  969. if (arm == "ArmA")
  970. {
  971. Robot1XAction = SERobotXAction.Retract;
  972. }
  973. else if (arm == "ArmB")
  974. {
  975. Robot2XAction = SERobotXAction.Retract2;
  976. }
  977. }
  978. #endregion
  979. #region Home
  980. else if (oldValue.Action == RobotAction.None && newValue.Action == RobotAction.Homing)
  981. {
  982. if (Robot1XAction == SERobotXAction.Extend)
  983. {
  984. Robot1XAction = SERobotXAction.Retract;
  985. }
  986. if (Robot2XAction == SERobotXAction.Extend2)
  987. {
  988. Robot2XAction = SERobotXAction.Retract2;
  989. }
  990. await Task.Delay(2000);
  991. if (Robot1TAction != SERobotTAction.T_Origin)
  992. {
  993. Robot1TAction = SERobotTAction.T_Origin;
  994. }
  995. if (Robot2TAction != SERobotTAction.T_Origin)
  996. {
  997. Robot2TAction = SERobotTAction.T_Origin;
  998. }
  999. }
  1000. #endregion
  1001. }
  1002. }
  1003. }