VenusDeOperationOverViewModel.cs 41 KB

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