VenusSeOperationOverViewModel.cs 40 KB

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