VenusSeOperationOverViewModel.cs 38 KB

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