VenusSeOperationOverViewModel.cs 34 KB

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