VenusSeOperationOverViewModel.cs 40 KB

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