VenusSeOperationOverViewModel.cs 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957
  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. { "PreCleanRecipeName",info.PreCleanRecipeName},
  450. { "PostCleanRecipeName",info.PostCleanRecipeName}
  451. };
  452. InvokeClient.Instance.Service.DoOperation("System.CreateSEJob", param);
  453. }
  454. private void OnSetSequence(object obj)
  455. {
  456. var info = obj as WaferInfo;
  457. bool flag = info.SequenceName != "" ? false : true;
  458. if (info.ModuleID == "VCE1")
  459. {
  460. AssociateSequence(VCEwaferAssociation, flag, info.SlotID);
  461. }
  462. }
  463. private void OnPauseAllJob()
  464. {
  465. InvokeClient.Instance.Service.DoOperation("System.PauseJob", VCEwaferAssociation.JobID);
  466. }
  467. private void OnAbortAll()
  468. {
  469. InvokeClient.Instance.Service.DoOperation("System.SEAbort");
  470. }
  471. private void AssociateSequence(WaferAssociationInfo info, bool flag, int slot = -1)
  472. {
  473. List<WaferInfo> wafers = info.ModuleData.WaferManager.Wafers;
  474. if (slot >= 0) //by wafer
  475. {
  476. int index = wafers.Count - slot - 1;
  477. if (index < wafers.Count)
  478. {
  479. //has wafer
  480. if (flag && !(wafers[index].WaferStatus == 0))
  481. wafers[index].SequenceName = info.SequenceName;
  482. else
  483. wafers[index].SequenceName = string.Empty;
  484. }
  485. }
  486. else //by from-to
  487. {
  488. for (int i = info.SlotFrom - 1; i < info.SlotTo; i++)
  489. {
  490. int index = wafers.Count - i - 1;
  491. if (index < wafers.Count)
  492. {
  493. if (flag && !(wafers[index].WaferStatus == 0))
  494. wafers[index].SequenceName = info.SequenceName;
  495. else
  496. wafers[index].SequenceName = string.Empty;
  497. }
  498. }
  499. }
  500. if (VCEIsInstalled)
  501. {
  502. VCEwaferAssociation = info;
  503. }
  504. }
  505. private void addDataKeys()
  506. {
  507. m_RtDataKeys.Add($"SETM.VCESlitDoorClosed");
  508. m_RtDataKeys.Add($"SETM.PMASlitDoorClosed");
  509. m_RtDataKeys.Add($"SETM.PMBSlitDoorClosed");
  510. m_RtDataKeys.Add($"SETM.PMCSlitDoorClosed");
  511. m_RtDataKeys.Add($"SETM.VCEPressure.Value");
  512. m_RtDataKeys.Add($"VCE1.VCEOutDoorClosed");
  513. m_RtDataKeys.Add($"VCE1.CassetteArrive");
  514. m_RtDataKeys.Add($"SEScheduler.CycledWafer");
  515. m_RtDataKeys.Add($"SEScheduler.CycleSetPoint");
  516. m_RtDataKeys.Add($"SEScheduler.CycleCount");
  517. m_RtDataKeys.Add($"SEScheduler.ThroughPut");
  518. m_RtDataKeys.Add($"PMA.ChamberPressure");
  519. m_RtDataKeys.Add($"PMA.VentingFlag");
  520. m_RtDataKeys.Add($"PMA.CurrentRecipeResult");
  521. m_RtDataKeys.Add($"PMB.ChamberPressure");
  522. m_RtDataKeys.Add($"PMB.VentingFlag");
  523. m_RtDataKeys.Add($"PMB.CurrentRecipeResult");
  524. m_RtDataKeys.Add($"PMC.ChamberPressure");
  525. m_RtDataKeys.Add($"PMC.VentingFlag");
  526. m_RtDataKeys.Add($"PMC.CurrentRecipeResult");
  527. //if (PMAIsInstalled)
  528. //{
  529. // m_RtDataKeys.Add($"PMA.ChamberPressure");
  530. // m_RtDataKeys.Add($"PMA.VentingFlag");
  531. // m_RtDataKeys.Add($"PMA.CurrentRecipeResult");
  532. //}
  533. //if (PMBIsInstalled)
  534. //{
  535. // m_RtDataKeys.Add($"PMB.ChamberPressure");
  536. // m_RtDataKeys.Add($"PMB.VentingFlag");
  537. // m_RtDataKeys.Add($"PMB.CurrentRecipeResult");
  538. //}
  539. //if (PMCIsInstalled)
  540. //{
  541. // m_RtDataKeys.Add($"PMC.ChamberPressure");
  542. // m_RtDataKeys.Add($"PMC.VentingFlag");
  543. // m_RtDataKeys.Add($"PMC.CurrentRecipeResult");
  544. //}
  545. }
  546. private void onHomeAll()
  547. {
  548. InvokeClient.Instance.Service.DoOperation("System.HomeAll");
  549. }
  550. private void onSetAutoMode()
  551. {
  552. InvokeClient.Instance.Service.DoOperation("System.SetAutoMode");
  553. }
  554. private void onSetManualMode()
  555. {
  556. InvokeClient.Instance.Service.DoOperation("System.SetManualMode");
  557. }
  558. private void onStopCycle()
  559. {
  560. InvokeClient.Instance.Service.DoOperation("System.StopSECycle");
  561. }
  562. private void onStartSETMCycle()
  563. {
  564. List<string> stations = new List<string>();
  565. stations.Add("VCE1");
  566. stations.Add("VPA");
  567. if (PMAIsInstalled)
  568. {
  569. stations.Add("PMA");
  570. }
  571. if (PMBIsInstalled)
  572. {
  573. stations.Add("PMB");
  574. }
  575. if (PMCIsInstalled)
  576. {
  577. stations.Add("PMC");
  578. }
  579. stations.Add("VCE1");
  580. InvokeClient.Instance.Service.DoOperation("System.SETMCycle", stations.ToArray(), 1);
  581. }
  582. private void OnStart(object obj)
  583. {
  584. var info = obj as WaferAssociationInfo;
  585. InvokeClient.Instance.Service.DoOperation("System.StartSEJob", info.LotId);
  586. }
  587. private void vceHome()
  588. {
  589. InvokeClient.Instance.Service.DoOperation("VCE1.HOME");
  590. }
  591. private void vceReadMap()
  592. {
  593. InvokeClient.Instance.Service.DoOperation("VCE1.ReadMap");
  594. }
  595. private void vceLoadPrepare()
  596. {
  597. InvokeClient.Instance.Service.DoOperation("VCE1.LoadPrepare");
  598. }
  599. private void vceLoad()
  600. {
  601. InvokeClient.Instance.Service.DoOperation("VCE1.SafeLoad");
  602. }
  603. private void vceLoadWithSMIF()
  604. {
  605. InvokeClient.Instance.Service.DoOperation("VCE1.LoadWithSMIF");
  606. }
  607. private void vceUnLoadWithSMIF()
  608. {
  609. InvokeClient.Instance.Service.DoOperation("VCE1.UnLoadWithSMIF");
  610. }
  611. private void vceUnLoad()
  612. {
  613. InvokeClient.Instance.Service.DoOperation("VCE1.SafeUnload");
  614. }
  615. private void smifLoad() { }
  616. private void smifUnLoad() { }
  617. private void tmhome()
  618. {
  619. InvokeClient.Instance.Service.DoOperation("SETM.Home");
  620. }
  621. private void tmpick()
  622. {
  623. ModuleName target = ModuleName.VCE1;
  624. int slot = PickNum;
  625. MoveItem moveItem = new MoveItem(target, slot - 1, ModuleName.TMRobot, 0, 0);
  626. Queue<MoveItem> que = new Queue<MoveItem>();
  627. que.Enqueue(moveItem);
  628. InvokeClient.Instance.Service.DoOperation("SETM.Pick", que);
  629. }
  630. private void tmplace()
  631. {
  632. ModuleName target = ModuleName.VCE1;
  633. int slot = PickNum;
  634. MoveItem moveItem = new MoveItem( ModuleName.TMRobot, 0, target, slot - 1, 0);
  635. Queue<MoveItem> que = new Queue<MoveItem>();
  636. que.Enqueue(moveItem);
  637. InvokeClient.Instance.Service.DoOperation("SETM.Place", que);
  638. }
  639. #endregion
  640. #region 私有方法
  641. private void Timer_Tick(object sender, EventArgs e)
  642. {
  643. try
  644. {
  645. RtDataValues = QueryDataClient.Instance.Service.PollData(m_RtDataKeys);
  646. VCEDoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "SETM.VCESlitDoorClosed");
  647. PMADoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "SETM.PMASlitDoorClosed");
  648. PMBDoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "SETM.PMBSlitDoorClosed");
  649. PMCDoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "SETM.PMCSlitDoorClosed");
  650. VCEOutDoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "VCE1.VCEOutDoorClosed");
  651. VCEPercent = CommonFunction.GetValue<double>(RtDataValues, "SETM.VCEPressure.Value") * 260 / 750000;
  652. if (PMAIsInstalled == true)
  653. {
  654. PMAModuleInfo = ModuleManager.ModuleInfos["PMA"];
  655. PMAWafer = PMAModuleInfo.WaferManager.Wafers[0];
  656. PMAPercent = CommonFunction.GetValue<double>(RtDataValues, "PMA.ChamberPressure") * 260 / 750000;
  657. PMARecipeResult = CommonFunction.GetValue<RecipeResult>(RtDataValues, "PMA.CurrentRecipeResult");
  658. }
  659. if (PMBIsInstalled == true)
  660. {
  661. PMBModuleInfo = ModuleManager.ModuleInfos["PMB"];
  662. PMBWafer = PMBModuleInfo.WaferManager.Wafers[0];
  663. PMBPercent = CommonFunction.GetValue<double>(RtDataValues, "PMB.ChamberPressure") * 260 / 750000;
  664. PMBRecipeResult = CommonFunction.GetValue<RecipeResult>(RtDataValues, "PMB.CurrentRecipeResult");
  665. }
  666. if (PMCIsInstalled == true)
  667. {
  668. PMCModuleInfo = ModuleManager.ModuleInfos["PMC"];
  669. PMCWafer = PMCModuleInfo.WaferManager.Wafers[0];
  670. PMCPercent = CommonFunction.GetValue<double>(RtDataValues, "PMC.ChamberPressure") * 260 / 750000;
  671. PMCRecipeResult = CommonFunction.GetValue<RecipeResult>(RtDataValues, "PMC.CurrentRecipeResult");
  672. }
  673. if (VCEIsInstalled == true)
  674. {
  675. VCE1ModuleInfo = ModuleManager.ModuleInfos["VCE1"];
  676. }
  677. RobotMoveInfo = (RobotMoveInfo)QueryDataClient.Instance.Service.GetData("SETM.RobotMoveAction");
  678. TMModuleInfo = ModuleManager.ModuleInfos["TMRobot"];
  679. RobotUpperWafer = TMModuleInfo.WaferManager.Wafers[0];
  680. RobotLowerWafer = TMModuleInfo.WaferManager.Wafers[1];
  681. PAWafer = ModuleManager.ModuleInfos["VPA"].WaferManager.Wafers[0];
  682. }
  683. catch
  684. {
  685. }
  686. }
  687. #endregion
  688. private async void RobotMoveInfoChanged(RobotMoveInfo oldValue, RobotMoveInfo newValue)
  689. {
  690. string RobotTarget;
  691. if (oldValue == null || newValue == null)
  692. {
  693. return;
  694. }
  695. #region Rotating
  696. if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && (newValue.Action == RobotAction.Rotating))
  697. {
  698. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  699. if (TMRobotMoveActionBladeTarget != null)
  700. {
  701. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  702. }
  703. else
  704. {
  705. return;
  706. }
  707. var values = RobotTarget.Split('.');
  708. var arm = values[0];
  709. var module = values[1];
  710. if (arm == "ArmA")
  711. {
  712. Robot1TAction = (SERobotTAction)Enum.Parse(typeof(SERobotTAction), module, true);
  713. }
  714. else if (arm == "ArmB")
  715. {
  716. Robot2TAction = (SERobotTAction)Enum.Parse(typeof(SERobotTAction), module, true);
  717. }
  718. }
  719. #endregion
  720. #region VPA、VCE1 Pick、Place
  721. else if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && (newValue.Action == RobotAction.Placing || newValue.Action == RobotAction.Picking))
  722. {
  723. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  724. if (TMRobotMoveActionBladeTarget != null)
  725. {
  726. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  727. }
  728. else
  729. {
  730. return;
  731. }
  732. var values = RobotTarget.Split('.');
  733. var arm = values[0];
  734. var module = values[1];
  735. if (arm == "ArmA")
  736. {
  737. var SERobotTAction = (SERobotTAction)Enum.Parse(typeof(SERobotTAction), module, true);
  738. if (SERobotTAction != Robot1TAction)
  739. {
  740. Robot1TAction = SERobotTAction;
  741. }
  742. else
  743. {
  744. //await Task.Delay(100);
  745. }
  746. await Task.Delay(600);
  747. if (module == "VCE1")
  748. {
  749. Robot1XAction = SERobotXAction.ToVCE;
  750. }
  751. else
  752. {
  753. Robot1XAction = SERobotXAction.Extend;
  754. }
  755. 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))
  756. {
  757. await Task.Delay(100);
  758. }
  759. Robot1XAction = SERobotXAction.Retract;
  760. }
  761. else if (arm == "ArmB")
  762. {
  763. var waferRobotTAction = (SERobotTAction)Enum.Parse(typeof(SERobotTAction), module, true);
  764. if (waferRobotTAction != Robot2TAction)
  765. {
  766. Robot2TAction = waferRobotTAction;
  767. }
  768. else
  769. {
  770. //await Task.Delay(100);
  771. }
  772. await Task.Delay(600);
  773. if (module == "VCE1")
  774. {
  775. Robot2XAction = SERobotXAction.ToVCE2;
  776. }
  777. else
  778. {
  779. Robot2XAction = SERobotXAction.Extend2;
  780. }
  781. 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))
  782. {
  783. await Task.Delay(100);
  784. }
  785. Robot2XAction = SERobotXAction.Retract2;
  786. }
  787. }
  788. #endregion
  789. #region PM pick、PM place
  790. else if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && newValue.Action == RobotAction.Extending)
  791. {
  792. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  793. if (TMRobotMoveActionBladeTarget != null)
  794. {
  795. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  796. }
  797. else
  798. {
  799. return;
  800. }
  801. var values = RobotTarget.Split('.');
  802. var arm = values[0];
  803. var module = values[1];
  804. if (arm == "ArmA")
  805. {
  806. var SERobotTAction = (SERobotTAction)Enum.Parse(typeof(SERobotTAction), module, true);
  807. if (SERobotTAction != Robot1TAction)
  808. {
  809. Robot1TAction = SERobotTAction;
  810. }
  811. else
  812. {
  813. // await Task.Delay(100);
  814. }
  815. await Task.Delay(600);
  816. Robot1XAction = SERobotXAction.Extend;
  817. }
  818. else if (arm == "ArmB")
  819. {
  820. var SERobotTAction = (SERobotTAction)Enum.Parse(typeof(SERobotTAction), module, true);
  821. if (SERobotTAction != Robot2TAction)
  822. {
  823. Robot2TAction = SERobotTAction;
  824. }
  825. else
  826. {
  827. // await Task.Delay(100);
  828. }
  829. await Task.Delay(600);
  830. Robot2XAction = SERobotXAction.Extend2;
  831. }
  832. }
  833. else if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && newValue.Action == RobotAction.Retracting)
  834. {
  835. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  836. if (TMRobotMoveActionBladeTarget != null)
  837. {
  838. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  839. }
  840. else
  841. {
  842. return;
  843. }
  844. var values = RobotTarget.Split('.');
  845. var arm = values[0];
  846. if (arm == "ArmA")
  847. {
  848. Robot1XAction = SERobotXAction.Retract;
  849. }
  850. else if (arm == "ArmB")
  851. {
  852. Robot2XAction = SERobotXAction.Retract2;
  853. }
  854. }
  855. #endregion
  856. #region Home
  857. else if (oldValue.Action == RobotAction.None && newValue.Action == RobotAction.Homing)
  858. {
  859. if (Robot1XAction == SERobotXAction.Extend)
  860. {
  861. Robot1XAction = SERobotXAction.Retract;
  862. }
  863. if (Robot2XAction == SERobotXAction.Extend2)
  864. {
  865. Robot2XAction = SERobotXAction.Retract2;
  866. }
  867. await Task.Delay(2000);
  868. if (Robot1TAction != SERobotTAction.T_Origin)
  869. {
  870. Robot1TAction = SERobotTAction.T_Origin;
  871. }
  872. if (Robot2TAction != SERobotTAction.T_Origin)
  873. {
  874. Robot2TAction = SERobotTAction.T_Origin;
  875. }
  876. }
  877. #endregion
  878. }
  879. }
  880. }