VenusDeOperationOverViewModel.cs 48 KB

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