VenusDeOperationOverViewModel.cs 47 KB

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