VenusDeOperationOverViewModel.cs 45 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216
  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_VPAModuleInfo;
  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 VPAModuleInfo
  298. {
  299. get { return m_VPAModuleInfo; }
  300. set
  301. {
  302. SetProperty(ref m_VPAModuleInfo, 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. };
  632. InvokeClient.Instance.Service.DoOperation("System.CreateSEJob", param);
  633. }
  634. private void OnSetSequence(object obj)
  635. {
  636. var info = obj as WaferInfo;
  637. bool flag = info.SequenceName != "" ? false : true;
  638. if (info.ModuleID == "LP1")
  639. {
  640. AssociateSequence(VCEAwaferAssociation, flag, info.SlotID);
  641. }
  642. if (info.ModuleID == "LP2")
  643. {
  644. AssociateSequence(VCEBwaferAssociation, flag, info.SlotID);
  645. }
  646. }
  647. private void OnPauseAllJob()
  648. {
  649. }
  650. private void OnAbortAll()
  651. {
  652. InvokeClient.Instance.Service.DoOperation("System.Abort");
  653. }
  654. private void AssociateSequence(WaferAssociationInfo info, bool flag, int slot = -1)
  655. {
  656. List<WaferInfo> wafers = info.ModuleData.WaferManager.Wafers;
  657. if (slot >= 0) //by wafer
  658. {
  659. int index = wafers.Count - slot - 1;
  660. if (index < wafers.Count)
  661. {
  662. //has wafer
  663. if (flag && !(wafers[index].WaferStatus == 0))
  664. wafers[index].SequenceName = info.SequenceName;
  665. else
  666. wafers[index].SequenceName = string.Empty;
  667. }
  668. }
  669. else //by from-to
  670. {
  671. for (int i = info.SlotFrom - 1; i < info.SlotTo; i++)
  672. {
  673. int index = wafers.Count - i - 1;
  674. if (index < wafers.Count)
  675. {
  676. if (flag && !(wafers[index].WaferStatus == 0))
  677. wafers[index].SequenceName = info.SequenceName;
  678. else
  679. wafers[index].SequenceName = string.Empty;
  680. }
  681. }
  682. }
  683. }
  684. private void addDataKeys()
  685. {
  686. m_RtDataKeys.Add($"TM.VCEASlitDoorClosed");
  687. m_RtDataKeys.Add($"TM.VCEBSlitDoorClosed");
  688. m_RtDataKeys.Add($"TM.PMASlitDoorClosed");
  689. m_RtDataKeys.Add($"TM.PMBSlitDoorClosed");
  690. m_RtDataKeys.Add($"TM.PMCSlitDoorClosed");
  691. m_RtDataKeys.Add($"TM.PMDSlitDoorClosed");
  692. m_RtDataKeys.Add($"TM.TMPressure.Value");
  693. m_RtDataKeys.Add($"TM.VCEAPressure.Value");
  694. m_RtDataKeys.Add($"TM.VCEBPressure.Value");
  695. m_RtDataKeys.Add($"VCEA.VCEOutDoorClosed");
  696. m_RtDataKeys.Add($"LP1.CassettePlaced");
  697. m_RtDataKeys.Add($"VCEB.VCEOutDoorClosed");
  698. m_RtDataKeys.Add($"LP2.CassettePlaced");
  699. m_RtDataKeys.Add($"SEScheduler.CycledWafer");
  700. m_RtDataKeys.Add($"SEScheduler.CycleSetPoint");
  701. m_RtDataKeys.Add($"SEScheduler.CycleCount");
  702. m_RtDataKeys.Add($"SEScheduler.ThroughPut");
  703. m_RtDataKeys.Add($"PMA.ChamberPressure");
  704. m_RtDataKeys.Add($"PMA.VentingFlag");
  705. m_RtDataKeys.Add($"PMA.CurrentRecipeResult");
  706. m_RtDataKeys.Add($"PMB.ChamberPressure");
  707. m_RtDataKeys.Add($"PMB.VentingFlag");
  708. m_RtDataKeys.Add($"PMB.CurrentRecipeResult");
  709. m_RtDataKeys.Add($"PMC.ChamberPressure");
  710. m_RtDataKeys.Add($"PMC.VentingFlag");
  711. m_RtDataKeys.Add($"PMC.CurrentRecipeResult");
  712. m_RtDataKeys.Add($"PMD.ChamberPressure");
  713. m_RtDataKeys.Add($"PMD.VentingFlag");
  714. m_RtDataKeys.Add($"PMD.CurrentRecipeResult");
  715. m_RtDataKeys.Add($"VCEA.CurrentSlot");
  716. m_RtDataKeys.Add($"VCEB.CurrentSlot");
  717. m_RtDataKeys.Add($"TM.TMIsATM");
  718. m_RtDataKeys.Add($"TM.VCEAIsATM");
  719. m_RtDataKeys.Add($"TM.VCEBIsATM");
  720. m_RtDataKeys.Add("System.IsAutoMode");
  721. m_RtDataKeys.Add("System.IsBusy");
  722. m_RtDataKeys.Add("Scheduler.CycledCount");
  723. m_RtDataKeys.Add("Scheduler.CycledWafer");
  724. m_RtDataKeys.Add("Scheduler.CycleSetPoint");
  725. m_RtDataKeys.Add("Scheduler.Throughput");
  726. //m_RtDataKeys.Add("EquipmentStatus");
  727. m_RtDataKeys.Add("Scheduler.PjNameList");
  728. //if (PMAIsInstalled)
  729. //{
  730. // m_RtDataKeys.Add($"PMA.ChamberPressure");
  731. // m_RtDataKeys.Add($"PMA.VentingFlag");
  732. // m_RtDataKeys.Add($"PMA.CurrentRecipeResult");
  733. //}
  734. //if (PMBIsInstalled)
  735. //{
  736. // m_RtDataKeys.Add($"PMB.ChamberPressure");
  737. // m_RtDataKeys.Add($"PMB.VentingFlag");
  738. // m_RtDataKeys.Add($"PMB.CurrentRecipeResult");
  739. //}
  740. //if (PMCIsInstalled)
  741. //{
  742. // m_RtDataKeys.Add($"PMC.ChamberPressure");
  743. // m_RtDataKeys.Add($"PMC.VentingFlag");
  744. // m_RtDataKeys.Add($"PMC.CurrentRecipeResult");
  745. //}
  746. }
  747. private void onHomeAll()
  748. {
  749. InvokeClient.Instance.Service.DoOperation("System.HomeAll");
  750. }
  751. private void onSetAutoMode()
  752. {
  753. InvokeClient.Instance.Service.DoOperation("System.SetAutoMode");
  754. }
  755. private void onSetManualMode()
  756. {
  757. InvokeClient.Instance.Service.DoOperation("System.SetManualMode");
  758. }
  759. private void onStopCycle()
  760. {
  761. InvokeClient.Instance.Service.DoOperation("System.StopSECycle");
  762. }
  763. private void onStartSETMCycle()
  764. {
  765. List<string> stations = new List<string>();
  766. stations.Add("VCEA");
  767. stations.Add("VPA");
  768. if (PMAIsInstalled)
  769. {
  770. stations.Add("PMA");
  771. }
  772. if (PMBIsInstalled)
  773. {
  774. stations.Add("PMB");
  775. }
  776. if (PMCIsInstalled)
  777. {
  778. stations.Add("PMC");
  779. }
  780. if (PMCIsInstalled)
  781. {
  782. stations.Add("PMD");
  783. }
  784. stations.Add("VCEA");
  785. InvokeClient.Instance.Service.DoOperation("System.SETMCycle", stations.ToArray(), 1);
  786. }
  787. private void OnStart(object obj)
  788. {
  789. var info = obj as WaferAssociationInfo;
  790. InvokeClient.Instance.Service.DoOperation("System.StartSEJob", info.LotId);
  791. }
  792. private void OnStop(object obj)
  793. {
  794. var info = obj as WaferAssociationInfo;
  795. InvokeClient.Instance.Service.DoOperation("System.AbortJob", info.JobID);
  796. }
  797. private void OnAbort(object obj)
  798. {
  799. var info = obj as WaferAssociationInfo;
  800. InvokeClient.Instance.Service.DoOperation("System.StopJob", info.JobID);
  801. }
  802. private void vceHome(object obj)
  803. {
  804. InvokeClient.Instance.Service.DoOperation($"{obj}.HOME");
  805. }
  806. private void vceReadMap(object obj)
  807. {
  808. InvokeClient.Instance.Service.DoOperation($"{obj}.ReadMap");
  809. }
  810. private void vceLoadPrepare(object obj)
  811. {
  812. InvokeClient.Instance.Service.DoOperation($"{obj}.LoadPrepare");
  813. }
  814. private void vceLoad(object obj)
  815. {
  816. InvokeClient.Instance.Service.DoOperation($"{obj}.SafeLoad");
  817. }
  818. private void vceLoadWithSMIF(object obj)
  819. {
  820. InvokeClient.Instance.Service.DoOperation($"{obj}.LoadWithSMIF");
  821. }
  822. private void vceUnLoadWithSMIF(object obj)
  823. {
  824. InvokeClient.Instance.Service.DoOperation($"{obj}.UnLoadWithSMIF");
  825. }
  826. private void vceUnLoad(object obj)
  827. {
  828. InvokeClient.Instance.Service.DoOperation($"{obj}.SafeUnload");
  829. }
  830. private void smifLoad() { }
  831. private void smifUnLoad() { }
  832. private void tmhome()
  833. {
  834. InvokeClient.Instance.Service.DoOperation("TM.Home");
  835. }
  836. private void tmpick()
  837. {
  838. ModuleName target = ModuleName.VCE1;
  839. int slot = PickNum;
  840. MoveItem moveItem = new MoveItem(target, slot - 1, ModuleName.TMRobot, 0, 0);
  841. Queue<MoveItem> que = new Queue<MoveItem>();
  842. que.Enqueue(moveItem);
  843. InvokeClient.Instance.Service.DoOperation("TM.Pick", que);
  844. }
  845. private void tmplace()
  846. {
  847. ModuleName target = ModuleName.VCE1;
  848. int slot = PickNum;
  849. MoveItem moveItem = new MoveItem(ModuleName.TMRobot, 0, target, slot - 1, 0);
  850. Queue<MoveItem> que = new Queue<MoveItem>();
  851. que.Enqueue(moveItem);
  852. InvokeClient.Instance.Service.DoOperation("TM.Place", que);
  853. }
  854. #endregion
  855. #region 私有方法
  856. private void Timer_Tick(object sender, EventArgs e)
  857. {
  858. try
  859. {
  860. RtDataValues = QueryDataClient.Instance.Service.PollData(m_RtDataKeys);
  861. VCEADoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "TM.VCEASlitDoorClosed");
  862. VCEBDoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "TM.VCEBSlitDoorClosed");
  863. PMADoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "TM.PMASlitDoorClosed");
  864. PMBDoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "TM.PMBSlitDoorClosed");
  865. PMCDoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "TM.PMCSlitDoorClosed");
  866. PMDDoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "TM.PMDSlitDoorClosed");
  867. VCEAOutDoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "VCEA.VCEOutDoorClosed");
  868. VCEBOutDoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "VCEB.VCEOutDoorClosed");
  869. VCEAPercent = CommonFunction.GetValue<double>(RtDataValues, "TM.VCEAPressure.Value") * 260 / 750000;
  870. VCEBPercent = CommonFunction.GetValue<double>(RtDataValues, "TM.VCEBPressure.Value") * 260 / 750000;
  871. CurrentSlotA = CommonFunction.GetValue<int>(RtDataValues, "VCEA.CurrentSlot");
  872. CurrentSlotB = CommonFunction.GetValue<int>(RtDataValues, "VCEB.CurrentSlot");
  873. TMIsVAC = (CommonFunction.GetValue<int>(RtDataValues, "TM.TMPressure.Value") < Convert.ToInt32(QueryDataClient.Instance.Service.GetConfig($"TM.VACTargetPressure")));
  874. VCEAIsVAC = (CommonFunction.GetValue<int>(RtDataValues, "TM.VCEAPressure.Value") < Convert.ToInt32(QueryDataClient.Instance.Service.GetConfig($"VCEA.VACTargetPressure")));
  875. VCEBIsVAC = (CommonFunction.GetValue<int>(RtDataValues, "TM.VCEBPressure.Value") < Convert.ToInt32(QueryDataClient.Instance.Service.GetConfig($"VCEB.VACTargetPressure")));
  876. if (PMAIsInstalled == true)
  877. {
  878. PMAModuleInfo = ModuleManager.ModuleInfos["PMA"];
  879. PMAWafer = PMAModuleInfo.WaferManager.Wafers[0];
  880. PMAPercent = CommonFunction.GetValue<double>(RtDataValues, "PMA.ChamberPressure") * 260 / 750000;
  881. PMARecipeResult = CommonFunction.GetValue<RecipeResult>(RtDataValues, "PMA.CurrentRecipeResult");
  882. }
  883. if (PMBIsInstalled == true)
  884. {
  885. PMBModuleInfo = ModuleManager.ModuleInfos["PMB"];
  886. PMBWafer = PMBModuleInfo.WaferManager.Wafers[0];
  887. PMBPercent = CommonFunction.GetValue<double>(RtDataValues, "PMB.ChamberPressure") * 260 / 750000;
  888. PMBRecipeResult = CommonFunction.GetValue<RecipeResult>(RtDataValues, "PMB.CurrentRecipeResult");
  889. }
  890. if (PMCIsInstalled == true)
  891. {
  892. PMCModuleInfo = ModuleManager.ModuleInfos["PMC"];
  893. PMCWafer = PMCModuleInfo.WaferManager.Wafers[0];
  894. PMCPercent = CommonFunction.GetValue<double>(RtDataValues, "PMC.ChamberPressure") * 260 / 750000;
  895. PMCRecipeResult = CommonFunction.GetValue<RecipeResult>(RtDataValues, "PMC.CurrentRecipeResult");
  896. }
  897. if (PMDIsInstalled == true)
  898. {
  899. PMDModuleInfo = ModuleManager.ModuleInfos["PMD"];
  900. PMDWafer = PMCModuleInfo.WaferManager.Wafers[0];
  901. PMDPercent = CommonFunction.GetValue<double>(RtDataValues, "PMD.ChamberPressure") * 260 / 750000;
  902. PMDRecipeResult = CommonFunction.GetValue<RecipeResult>(RtDataValues, "PMD.CurrentRecipeResult");
  903. }
  904. if (VCEAIsInstalled == true)
  905. {
  906. VCEAModuleInfo = ModuleManager.ModuleInfos["LP1"];
  907. }
  908. if (VCEBIsInstalled == true)
  909. {
  910. VCEBModuleInfo = ModuleManager.ModuleInfos["LP2"];
  911. }
  912. RobotMoveInfo = (RobotMoveInfo)QueryDataClient.Instance.Service.GetData("TM.RobotMoveAction");
  913. TMModuleInfo = ModuleManager.ModuleInfos["TMRobot"];
  914. RobotUpperWafer = TMModuleInfo.WaferManager.Wafers[0];
  915. RobotLowerWafer = TMModuleInfo.WaferManager.Wafers[1];
  916. PAWafer = ModuleManager.ModuleInfos["Aligner1"].WaferManager.Wafers[0];
  917. }
  918. catch
  919. {
  920. }
  921. }
  922. #endregion
  923. private async void RobotMoveInfoChanged(RobotMoveInfo oldValue, RobotMoveInfo newValue)
  924. {
  925. string RobotTarget;
  926. if (oldValue == null || newValue == null)
  927. {
  928. return;
  929. }
  930. #region Rotating
  931. if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && (newValue.Action == RobotAction.Rotating))
  932. {
  933. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  934. if (TMRobotMoveActionBladeTarget != null)
  935. {
  936. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  937. }
  938. else
  939. {
  940. return;
  941. }
  942. var values = RobotTarget.Split('.');
  943. var arm = values[0];
  944. var module = values[1];
  945. if (arm == "ArmA")
  946. {
  947. Robot1TAction = (SERobotTAction)Enum.Parse(typeof(SERobotTAction), module, true);
  948. }
  949. else if (arm == "ArmB")
  950. {
  951. Robot2TAction = (SERobotTAction)Enum.Parse(typeof(SERobotTAction), module, true);
  952. }
  953. }
  954. #endregion
  955. #region VPA、VCE1 Pick、Place
  956. else if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && (newValue.Action == RobotAction.Placing || newValue.Action == RobotAction.Picking))
  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. var module = values[1];
  970. if (arm == "ArmA")
  971. {
  972. var SERobotTAction = (SERobotTAction)Enum.Parse(typeof(SERobotTAction), module, true);
  973. if (SERobotTAction != Robot1TAction)
  974. {
  975. Robot1TAction = SERobotTAction;
  976. }
  977. else
  978. {
  979. //await Task.Delay(100);
  980. }
  981. await Task.Delay(600);
  982. if (module == "VCE1")
  983. {
  984. Robot1XAction = SERobotXAction.ToVCE;
  985. }
  986. else
  987. {
  988. Robot1XAction = SERobotXAction.Extend;
  989. }
  990. 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))
  991. {
  992. await Task.Delay(100);
  993. }
  994. Robot1XAction = SERobotXAction.Retract;
  995. }
  996. else if (arm == "ArmB")
  997. {
  998. var waferRobotTAction = (SERobotTAction)Enum.Parse(typeof(SERobotTAction), module, true);
  999. if (waferRobotTAction != Robot2TAction)
  1000. {
  1001. Robot2TAction = waferRobotTAction;
  1002. }
  1003. else
  1004. {
  1005. //await Task.Delay(100);
  1006. }
  1007. await Task.Delay(600);
  1008. if (module == "VCE1")
  1009. {
  1010. Robot2XAction = SERobotXAction.ToVCE2;
  1011. }
  1012. else
  1013. {
  1014. Robot2XAction = SERobotXAction.Extend2;
  1015. }
  1016. 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))
  1017. {
  1018. await Task.Delay(100);
  1019. }
  1020. Robot2XAction = SERobotXAction.Retract2;
  1021. }
  1022. }
  1023. #endregion
  1024. #region PM pick、PM place
  1025. else if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && newValue.Action == RobotAction.Extending)
  1026. {
  1027. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  1028. if (TMRobotMoveActionBladeTarget != null)
  1029. {
  1030. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  1031. }
  1032. else
  1033. {
  1034. return;
  1035. }
  1036. var values = RobotTarget.Split('.');
  1037. var arm = values[0];
  1038. var module = values[1];
  1039. if (arm == "ArmA")
  1040. {
  1041. var SERobotTAction = (SERobotTAction)Enum.Parse(typeof(SERobotTAction), module, true);
  1042. if (SERobotTAction != Robot1TAction)
  1043. {
  1044. Robot1TAction = SERobotTAction;
  1045. }
  1046. else
  1047. {
  1048. // await Task.Delay(100);
  1049. }
  1050. await Task.Delay(600);
  1051. Robot1XAction = SERobotXAction.Extend;
  1052. }
  1053. else if (arm == "ArmB")
  1054. {
  1055. var SERobotTAction = (SERobotTAction)Enum.Parse(typeof(SERobotTAction), module, true);
  1056. if (SERobotTAction != Robot2TAction)
  1057. {
  1058. Robot2TAction = SERobotTAction;
  1059. }
  1060. else
  1061. {
  1062. // await Task.Delay(100);
  1063. }
  1064. await Task.Delay(600);
  1065. Robot2XAction = SERobotXAction.Extend2;
  1066. }
  1067. }
  1068. else if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && newValue.Action == RobotAction.Retracting)
  1069. {
  1070. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  1071. if (TMRobotMoveActionBladeTarget != null)
  1072. {
  1073. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  1074. }
  1075. else
  1076. {
  1077. return;
  1078. }
  1079. var values = RobotTarget.Split('.');
  1080. var arm = values[0];
  1081. if (arm == "ArmA")
  1082. {
  1083. Robot1XAction = SERobotXAction.Retract;
  1084. }
  1085. else if (arm == "ArmB")
  1086. {
  1087. Robot2XAction = SERobotXAction.Retract2;
  1088. }
  1089. }
  1090. #endregion
  1091. #region Home
  1092. else if (oldValue.Action == RobotAction.None && newValue.Action == RobotAction.Homing)
  1093. {
  1094. if (Robot1XAction == SERobotXAction.Extend)
  1095. {
  1096. Robot1XAction = SERobotXAction.Retract;
  1097. }
  1098. if (Robot2XAction == SERobotXAction.Extend2)
  1099. {
  1100. Robot2XAction = SERobotXAction.Retract2;
  1101. }
  1102. await Task.Delay(2000);
  1103. if (Robot1TAction != SERobotTAction.T_Origin)
  1104. {
  1105. Robot1TAction = SERobotTAction.T_Origin;
  1106. }
  1107. if (Robot2TAction != SERobotTAction.T_Origin)
  1108. {
  1109. Robot2TAction = SERobotTAction.T_Origin;
  1110. }
  1111. }
  1112. #endregion
  1113. }
  1114. }
  1115. }