VenusDeOperationOverViewModel.cs 46 KB

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