VenusSeOperationOverViewModel.cs 40 KB

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