VenusSeOperationOverViewModel.cs 35 KB

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