VenusDeOperationOverViewModel.cs 45 KB

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