VenusSeOperationOverViewModel.cs 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947
  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> _UnSelectAllCommand;
  341. public DelegateCommand<object> UnSelectAllCommand =>
  342. _UnSelectAllCommand ?? (_UnSelectAllCommand = new DelegateCommand<object>(OnDeSelectAll));
  343. private DelegateCommand<object> _ReturnAllWafer;
  344. public DelegateCommand<object> ReturnAllWafer =>
  345. _ReturnAllWafer ?? (_ReturnAllWafer = new DelegateCommand<object>(OnReturnAllWafer));
  346. #endregion
  347. #region 构造函数
  348. public VenusSeOperationOverViewModel()
  349. {
  350. //页面不刷错的方法 页面中的PM做成List的形式 通过itemsource显示 同时提供各个位置的pm点位 旋转角度
  351. VCE1WaferCount = 25;
  352. string[] allModules = QueryDataClient.Instance.Service.GetConfig($"System.InstalledModules").ToString().Split(',');
  353. PMAIsInstalled = allModules.Contains("PMA");
  354. PMBIsInstalled = allModules.Contains("PMB");
  355. PMCIsInstalled = allModules.Contains("PMC");
  356. VCEIsInstalled = allModules.Contains("VCE1");
  357. addDataKeys();
  358. RtDataValues = QueryDataClient.Instance.Service.PollData(m_RtDataKeys);
  359. VCEDoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "SETM.VCESlitDoorClosed");
  360. PMADoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "SETM.PMASlitDoorClosed");
  361. PMBDoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "SETM.PMBSlitDoorClosed");
  362. PMCDoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "SETM.PMCSlitDoorClosed");
  363. VCEOutDoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "VCE1.VCEOutDoorClosed");
  364. loadflag = false;
  365. DispatcherTimer timer = new DispatcherTimer();
  366. timer.Interval = TimeSpan.FromSeconds(0.1);
  367. timer.Tick += Timer_Tick;
  368. timer.Start();
  369. }
  370. #endregion
  371. #region 命令实现
  372. private void OnLoad()
  373. {
  374. if (VCEIsInstalled && !loadflag && VCEwaferAssociation == null)
  375. {
  376. VCEwaferAssociation = new WaferAssociationInfo
  377. {
  378. ModuleData = ModuleManager.ModuleInfos["VCE1"]
  379. };
  380. loadflag = true;
  381. }
  382. }
  383. private void OnSelectAll(object obj)
  384. {
  385. var info = obj as WaferAssociationInfo;
  386. info.SlotFrom = 1;
  387. info.SlotTo = 25;
  388. AssociateSequence(info, true);
  389. }
  390. private void OnDeSelectAll(object obj)
  391. {
  392. var info = obj as WaferAssociationInfo;
  393. info.SlotFrom = 1;
  394. info.SlotTo = 25;
  395. AssociateSequence(info, false);
  396. }
  397. private void OnReturnAllWafer(object obj)
  398. {
  399. WaferDialogView dialog = new WaferDialogView()
  400. {
  401. Owner = Application.Current.MainWindow,
  402. };
  403. dialog.Height = 300;
  404. dialog.Width = 400;
  405. double angel = 0;
  406. double coolingtime = 0;
  407. string message = "Please Confirm Return Wafer";
  408. WaferDialogViewModel vm = new WaferDialogViewModel();
  409. vm.ConfirmText = message;
  410. dialog.DataContext = vm;
  411. if (dialog.ShowDialog() == true)
  412. {
  413. if ((bool)dialog.AlignFlag == true && !string.IsNullOrEmpty(dialog.Angle))
  414. {
  415. angel = Convert.ToDouble(dialog.Angle);
  416. }
  417. if ((bool)dialog.CoolingFlag == true && !string.IsNullOrEmpty(dialog.CoolingTime))
  418. {
  419. coolingtime = Convert.ToDouble(dialog.CoolingTime);
  420. }
  421. InvokeClient.Instance.Service.DoOperation("System.ReturnAllSEWafer", dialog.CoolingFlag, coolingtime, dialog.AlignFlag, angel);
  422. }
  423. }
  424. private void OnCreateJob(object obj)
  425. {
  426. var info = obj as WaferAssociationInfo;
  427. List<string> slotSequence = new List<string>();
  428. info.ModuleData.WaferManager.Wafers.ForEach(key => { slotSequence.Insert(0, key.SequenceName); });
  429. string jobId = info.LotId.Trim();
  430. if (string.IsNullOrEmpty(jobId))
  431. jobId = "CJ_Local_" + info.ModuleData.ModuleID;
  432. info.LotId = jobId;
  433. info.JobID = jobId;
  434. info.JobStatus = "WaitingForStart";
  435. info.LotIdSaved = true;
  436. Dictionary<string, object> param = new Dictionary<string, object>()
  437. {
  438. {"JobId", jobId},
  439. {"Module", info.ModuleData.ModuleID},
  440. {"SlotSequence", slotSequence.ToArray()},
  441. {"AutoStart", true},
  442. };
  443. InvokeClient.Instance.Service.DoOperation("System.CreateSEJob", param);
  444. }
  445. private void OnSetSequence(object obj)
  446. {
  447. var info = obj as WaferInfo;
  448. bool flag = info.SequenceName != "" ? false : true;
  449. if (info.ModuleID == "VCE1")
  450. {
  451. AssociateSequence(VCEwaferAssociation, flag, info.SlotID);
  452. }
  453. }
  454. private void OnPauseAllJob()
  455. {
  456. InvokeClient.Instance.Service.DoOperation("System.PauseJob", VCEwaferAssociation.JobID);
  457. }
  458. private void OnAbortAll()
  459. {
  460. InvokeClient.Instance.Service.DoOperation("System.SEAbort");
  461. }
  462. private void AssociateSequence(WaferAssociationInfo info, bool flag, int slot = -1)
  463. {
  464. List<WaferInfo> wafers = info.ModuleData.WaferManager.Wafers;
  465. if (slot >= 0) //by wafer
  466. {
  467. int index = wafers.Count - slot - 1;
  468. if (index < wafers.Count)
  469. {
  470. //has wafer
  471. if (flag && !(wafers[index].WaferStatus == 0))
  472. wafers[index].SequenceName = info.SequenceName;
  473. else
  474. wafers[index].SequenceName = string.Empty;
  475. }
  476. }
  477. else //by from-to
  478. {
  479. for (int i = info.SlotFrom - 1; i < info.SlotTo; i++)
  480. {
  481. int index = wafers.Count - i - 1;
  482. if (index < wafers.Count)
  483. {
  484. if (flag && !(wafers[index].WaferStatus == 0))
  485. wafers[index].SequenceName = info.SequenceName;
  486. else
  487. wafers[index].SequenceName = string.Empty;
  488. }
  489. }
  490. }
  491. if (VCEIsInstalled)
  492. {
  493. VCEwaferAssociation = info;
  494. }
  495. }
  496. private void addDataKeys()
  497. {
  498. m_RtDataKeys.Add($"SETM.VCESlitDoorClosed");
  499. m_RtDataKeys.Add($"SETM.PMASlitDoorClosed");
  500. m_RtDataKeys.Add($"SETM.PMBSlitDoorClosed");
  501. m_RtDataKeys.Add($"SETM.PMCSlitDoorClosed");
  502. m_RtDataKeys.Add($"SETM.VCEPressure.Value");
  503. m_RtDataKeys.Add($"VCE1.VCEOutDoorClosed");
  504. m_RtDataKeys.Add($"VCE1.CassetteArrive");
  505. m_RtDataKeys.Add($"SEScheduler.CycledWafer");
  506. m_RtDataKeys.Add($"SEScheduler.CycleSetPoint");
  507. m_RtDataKeys.Add($"SEScheduler.CycleCount");
  508. m_RtDataKeys.Add($"SEScheduler.ThroughPut");
  509. m_RtDataKeys.Add($"PMA.ChamberPressure");
  510. m_RtDataKeys.Add($"PMA.VentingFlag");
  511. m_RtDataKeys.Add($"PMA.CurrentRecipeResult");
  512. m_RtDataKeys.Add($"PMB.ChamberPressure");
  513. m_RtDataKeys.Add($"PMB.VentingFlag");
  514. m_RtDataKeys.Add($"PMB.CurrentRecipeResult");
  515. m_RtDataKeys.Add($"PMC.ChamberPressure");
  516. m_RtDataKeys.Add($"PMC.VentingFlag");
  517. m_RtDataKeys.Add($"PMC.CurrentRecipeResult");
  518. //if (PMAIsInstalled)
  519. //{
  520. // m_RtDataKeys.Add($"PMA.ChamberPressure");
  521. // m_RtDataKeys.Add($"PMA.VentingFlag");
  522. // m_RtDataKeys.Add($"PMA.CurrentRecipeResult");
  523. //}
  524. //if (PMBIsInstalled)
  525. //{
  526. // m_RtDataKeys.Add($"PMB.ChamberPressure");
  527. // m_RtDataKeys.Add($"PMB.VentingFlag");
  528. // m_RtDataKeys.Add($"PMB.CurrentRecipeResult");
  529. //}
  530. //if (PMCIsInstalled)
  531. //{
  532. // m_RtDataKeys.Add($"PMC.ChamberPressure");
  533. // m_RtDataKeys.Add($"PMC.VentingFlag");
  534. // m_RtDataKeys.Add($"PMC.CurrentRecipeResult");
  535. //}
  536. }
  537. private void onHomeAll()
  538. {
  539. InvokeClient.Instance.Service.DoOperation("System.HomeAll");
  540. }
  541. private void onSetAutoMode()
  542. {
  543. InvokeClient.Instance.Service.DoOperation("System.SetAutoMode");
  544. }
  545. private void onSetManualMode()
  546. {
  547. InvokeClient.Instance.Service.DoOperation("System.SetManualMode");
  548. }
  549. private void onStopCycle()
  550. {
  551. InvokeClient.Instance.Service.DoOperation("System.StopSECycle");
  552. }
  553. private void onStartSETMCycle()
  554. {
  555. List<string> stations = new List<string>();
  556. stations.Add("VCE1");
  557. stations.Add("VPA");
  558. if (PMAIsInstalled)
  559. {
  560. stations.Add("PMA");
  561. }
  562. if (PMBIsInstalled)
  563. {
  564. stations.Add("PMB");
  565. }
  566. if (PMCIsInstalled)
  567. {
  568. stations.Add("PMC");
  569. }
  570. stations.Add("VCE1");
  571. InvokeClient.Instance.Service.DoOperation("System.SETMCycle", stations.ToArray(), 1);
  572. }
  573. private void OnStart(object obj)
  574. {
  575. var info = obj as WaferAssociationInfo;
  576. InvokeClient.Instance.Service.DoOperation("System.StartSEJob", info.LotId);
  577. }
  578. private void vceHome()
  579. {
  580. InvokeClient.Instance.Service.DoOperation("VCE1.HOME");
  581. }
  582. private void vceReadMap()
  583. {
  584. InvokeClient.Instance.Service.DoOperation("VCE1.ReadMap");
  585. }
  586. private void vceLoadPrepare()
  587. {
  588. InvokeClient.Instance.Service.DoOperation("VCE1.LoadPrepare");
  589. }
  590. private void vceLoad()
  591. {
  592. InvokeClient.Instance.Service.DoOperation("VCE1.SafeLoad");
  593. }
  594. private void vceLoadWithSMIF()
  595. {
  596. InvokeClient.Instance.Service.DoOperation("VCE1.LoadWithSMIF");
  597. }
  598. private void vceUnLoadWithSMIF()
  599. {
  600. InvokeClient.Instance.Service.DoOperation("VCE1.UnLoadWithSMIF");
  601. }
  602. private void vceUnLoad()
  603. {
  604. InvokeClient.Instance.Service.DoOperation("VCE1.SafeUnload");
  605. }
  606. private void smifLoad() { }
  607. private void smifUnLoad() { }
  608. private void tmhome()
  609. {
  610. InvokeClient.Instance.Service.DoOperation("SETM.Home");
  611. }
  612. private void tmpick()
  613. {
  614. ModuleName target = ModuleName.VCE1;
  615. int slot = PickNum;
  616. MoveItem moveItem = new MoveItem(target, slot - 1, ModuleName.TMRobot, 0, 0);
  617. Queue<MoveItem> que = new Queue<MoveItem>();
  618. que.Enqueue(moveItem);
  619. InvokeClient.Instance.Service.DoOperation("SETM.Pick", que);
  620. }
  621. private void tmplace()
  622. {
  623. ModuleName target = ModuleName.VCE1;
  624. int slot = PickNum;
  625. MoveItem moveItem = new MoveItem( ModuleName.TMRobot, 0, target, slot - 1, 0);
  626. Queue<MoveItem> que = new Queue<MoveItem>();
  627. que.Enqueue(moveItem);
  628. InvokeClient.Instance.Service.DoOperation("SETM.Place", que);
  629. }
  630. #endregion
  631. #region 私有方法
  632. private void Timer_Tick(object sender, EventArgs e)
  633. {
  634. try
  635. {
  636. RtDataValues = QueryDataClient.Instance.Service.PollData(m_RtDataKeys);
  637. VCEDoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "SETM.VCESlitDoorClosed");
  638. PMADoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "SETM.PMASlitDoorClosed");
  639. PMBDoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "SETM.PMBSlitDoorClosed");
  640. PMCDoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "SETM.PMCSlitDoorClosed");
  641. VCEOutDoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "VCE1.VCEOutDoorClosed");
  642. VCEPercent = CommonFunction.GetValue<double>(RtDataValues, "SETM.VCEPressure.Value") * 260 / 750000;
  643. if (PMAIsInstalled == true)
  644. {
  645. PMAModuleInfo = ModuleManager.ModuleInfos["PMA"];
  646. PMAWafer = PMAModuleInfo.WaferManager.Wafers[0];
  647. PMAPercent = CommonFunction.GetValue<double>(RtDataValues, "PMA.ChamberPressure") * 260 / 750000;
  648. PMARecipeResult = CommonFunction.GetValue<RecipeResult>(RtDataValues, "PMA.CurrentRecipeResult");
  649. }
  650. if (PMBIsInstalled == true)
  651. {
  652. PMBModuleInfo = ModuleManager.ModuleInfos["PMB"];
  653. PMBWafer = PMBModuleInfo.WaferManager.Wafers[0];
  654. PMBPercent = CommonFunction.GetValue<double>(RtDataValues, "PMB.ChamberPressure") * 260 / 750000;
  655. PMBRecipeResult = CommonFunction.GetValue<RecipeResult>(RtDataValues, "PMB.CurrentRecipeResult");
  656. }
  657. if (PMCIsInstalled == true)
  658. {
  659. PMCModuleInfo = ModuleManager.ModuleInfos["PMC"];
  660. PMCWafer = PMCModuleInfo.WaferManager.Wafers[0];
  661. PMCPercent = CommonFunction.GetValue<double>(RtDataValues, "PMC.ChamberPressure") * 260 / 750000;
  662. PMCRecipeResult = CommonFunction.GetValue<RecipeResult>(RtDataValues, "PMC.CurrentRecipeResult");
  663. }
  664. if (VCEIsInstalled == true)
  665. {
  666. VCE1ModuleInfo = ModuleManager.ModuleInfos["VCE1"];
  667. }
  668. RobotMoveInfo = (RobotMoveInfo)QueryDataClient.Instance.Service.GetData("SETM.RobotMoveAction");
  669. TMModuleInfo = ModuleManager.ModuleInfos["TMRobot"];
  670. RobotUpperWafer = TMModuleInfo.WaferManager.Wafers[0];
  671. RobotLowerWafer = TMModuleInfo.WaferManager.Wafers[1];
  672. PAWafer = ModuleManager.ModuleInfos["VPA"].WaferManager.Wafers[0];
  673. }
  674. catch
  675. {
  676. }
  677. }
  678. #endregion
  679. private async void RobotMoveInfoChanged(RobotMoveInfo oldValue, RobotMoveInfo newValue)
  680. {
  681. string RobotTarget;
  682. if (oldValue == null || newValue == null)
  683. {
  684. return;
  685. }
  686. #region Rotating
  687. if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && (newValue.Action == RobotAction.Rotating))
  688. {
  689. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  690. if (TMRobotMoveActionBladeTarget != null)
  691. {
  692. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  693. }
  694. else
  695. {
  696. return;
  697. }
  698. var values = RobotTarget.Split('.');
  699. var arm = values[0];
  700. var module = values[1];
  701. if (arm == "ArmA")
  702. {
  703. Robot1TAction = (SERobotTAction)Enum.Parse(typeof(SERobotTAction), module, true);
  704. }
  705. else if (arm == "ArmB")
  706. {
  707. Robot2TAction = (SERobotTAction)Enum.Parse(typeof(SERobotTAction), module, true);
  708. }
  709. }
  710. #endregion
  711. #region VPA、VCE1 Pick、Place
  712. else if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && (newValue.Action == RobotAction.Placing || newValue.Action == RobotAction.Picking))
  713. {
  714. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  715. if (TMRobotMoveActionBladeTarget != null)
  716. {
  717. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  718. }
  719. else
  720. {
  721. return;
  722. }
  723. var values = RobotTarget.Split('.');
  724. var arm = values[0];
  725. var module = values[1];
  726. if (arm == "ArmA")
  727. {
  728. var SERobotTAction = (SERobotTAction)Enum.Parse(typeof(SERobotTAction), module, true);
  729. if (SERobotTAction != Robot1TAction)
  730. {
  731. Robot1TAction = SERobotTAction;
  732. }
  733. else
  734. {
  735. //await Task.Delay(100);
  736. }
  737. await Task.Delay(600);
  738. if (module == "VCE1")
  739. {
  740. Robot1XAction = SERobotXAction.ToVCE;
  741. }
  742. else
  743. {
  744. Robot1XAction = SERobotXAction.Extend;
  745. }
  746. 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))
  747. {
  748. await Task.Delay(100);
  749. }
  750. Robot1XAction = SERobotXAction.Retract;
  751. }
  752. else if (arm == "ArmB")
  753. {
  754. var waferRobotTAction = (SERobotTAction)Enum.Parse(typeof(SERobotTAction), module, true);
  755. if (waferRobotTAction != Robot2TAction)
  756. {
  757. Robot2TAction = waferRobotTAction;
  758. }
  759. else
  760. {
  761. //await Task.Delay(100);
  762. }
  763. await Task.Delay(600);
  764. if (module == "VCE1")
  765. {
  766. Robot2XAction = SERobotXAction.ToVCE2;
  767. }
  768. else
  769. {
  770. Robot2XAction = SERobotXAction.Extend2;
  771. }
  772. 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))
  773. {
  774. await Task.Delay(100);
  775. }
  776. Robot2XAction = SERobotXAction.Retract2;
  777. }
  778. }
  779. #endregion
  780. #region PM pick、PM place
  781. else if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && newValue.Action == RobotAction.Extending)
  782. {
  783. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  784. if (TMRobotMoveActionBladeTarget != null)
  785. {
  786. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  787. }
  788. else
  789. {
  790. return;
  791. }
  792. var values = RobotTarget.Split('.');
  793. var arm = values[0];
  794. var module = values[1];
  795. if (arm == "ArmA")
  796. {
  797. var SERobotTAction = (SERobotTAction)Enum.Parse(typeof(SERobotTAction), module, true);
  798. if (SERobotTAction != Robot1TAction)
  799. {
  800. Robot1TAction = SERobotTAction;
  801. }
  802. else
  803. {
  804. // await Task.Delay(100);
  805. }
  806. await Task.Delay(600);
  807. Robot1XAction = SERobotXAction.Extend;
  808. }
  809. else if (arm == "ArmB")
  810. {
  811. var SERobotTAction = (SERobotTAction)Enum.Parse(typeof(SERobotTAction), module, true);
  812. if (SERobotTAction != Robot2TAction)
  813. {
  814. Robot2TAction = SERobotTAction;
  815. }
  816. else
  817. {
  818. // await Task.Delay(100);
  819. }
  820. await Task.Delay(600);
  821. Robot2XAction = SERobotXAction.Extend2;
  822. }
  823. }
  824. else if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && newValue.Action == RobotAction.Retracting)
  825. {
  826. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  827. if (TMRobotMoveActionBladeTarget != null)
  828. {
  829. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  830. }
  831. else
  832. {
  833. return;
  834. }
  835. var values = RobotTarget.Split('.');
  836. var arm = values[0];
  837. if (arm == "ArmA")
  838. {
  839. Robot1XAction = SERobotXAction.Retract;
  840. }
  841. else if (arm == "ArmB")
  842. {
  843. Robot2XAction = SERobotXAction.Retract2;
  844. }
  845. }
  846. #endregion
  847. #region Home
  848. else if (oldValue.Action == RobotAction.None && newValue.Action == RobotAction.Homing)
  849. {
  850. if (Robot1XAction == SERobotXAction.Extend)
  851. {
  852. Robot1XAction = SERobotXAction.Retract;
  853. }
  854. if (Robot2XAction == SERobotXAction.Extend2)
  855. {
  856. Robot2XAction = SERobotXAction.Retract2;
  857. }
  858. await Task.Delay(2000);
  859. if (Robot1TAction != SERobotTAction.T_Origin)
  860. {
  861. Robot1TAction = SERobotTAction.T_Origin;
  862. }
  863. if (Robot2TAction != SERobotTAction.T_Origin)
  864. {
  865. Robot2TAction = SERobotTAction.T_Origin;
  866. }
  867. }
  868. #endregion
  869. }
  870. }
  871. }