OperationOverViewModel.cs 38 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027
  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 System.Windows;
  14. using System.Windows.Threading;
  15. using Venus_Core;
  16. using Venus_MainPages.Unity;
  17. using Venus_MainPages.Views;
  18. using Venus_Themes.CustomControls;
  19. using Venus_Themes.Unity;
  20. using static Venus_Themes.UserControls.EFEM;
  21. namespace Venus_MainPages.ViewModels
  22. {
  23. public class OperationOverViewModel : BindableBase
  24. {
  25. #region 私有字段
  26. private bool m_TabIsChecked=true;
  27. private ModuleInfo m_LP1ModuleInfo;
  28. private ModuleInfo m_LP2ModuleInfo;
  29. private ModuleInfo m_LLAModuleInfo;
  30. private ModuleInfo m_LLBModuleInfo;
  31. private ModuleInfo m_LP3ModuleInfo;
  32. private ModuleInfo m_EFEMModuleInfo;
  33. private ModuleInfo m_TMModuleInfo;
  34. private WaferRobotTAction m_Robot1TAction;
  35. private WaferRobotXAction m_Robot1XAction;
  36. private WaferRobotTAction m_Robot2TAction;
  37. private WaferRobotXAction m_Robot2XAction;
  38. private WaferRobotTAction m_Robot3TAction;
  39. private WaferRobotXAction m_Robot3XAction;
  40. private WaferRobotTAction m_Robot4TAction;
  41. private WaferRobotXAction m_Robot4XAction;
  42. private RobotMoveInfo m_robotMoveInfo;
  43. int arm1oldWaferStatus = 100;
  44. int arm2oldWaferStatus = 100;
  45. private WaferInfo m_PMAWafer;
  46. private WaferInfo m_PMBWafer;
  47. private WaferInfo m_PMCWafer;
  48. private WaferInfo m_PMDWafer;
  49. private WaferInfo m_LLAWafer;
  50. private WaferInfo m_LLBWafer;
  51. private WaferInfo m_TMBladeAWafer;
  52. private WaferInfo m_TMBladeBWafer;
  53. private List<string> m_RtDataKeys = new List<string>();
  54. private Dictionary<string, object> m_RtDataValues;
  55. private bool m_PMAIsInstalled;
  56. private bool m_PMBIsInstalled;
  57. private bool m_PMCIsInstalled;
  58. private bool m_PMDIsInstalled;
  59. private bool m_LLAIsInstalled;
  60. private bool m_LLBIsInstalled;
  61. private bool m_TMIsInstalled;
  62. private bool m_EFEMIsInstalled;
  63. private WaferInfo m_EFEMBladeAWafer;
  64. private WaferInfo m_EFEMBladeBWafer;
  65. private WaferInfo m_Aligner1Wafer;
  66. private int m_LP1WaferCount;
  67. private int m_LP2WaferCount;
  68. private int m_LP3WaferCount;
  69. private WaferAssociationInfo _lp1WaferAssociation;
  70. private WaferAssociationInfo _lp2WaferAssociation;
  71. private WaferAssociationInfo _lp3WaferAssociation;
  72. private int m_CycledWafer;
  73. private int m_CycleCountDisplay;
  74. private RobotPosition m_CurrentRobotPosition;
  75. private WaferInfo m_BladeAWafer;
  76. private WaferInfo m_BladeBWafer;
  77. private RecipeResult m_PMARecipeResult;
  78. private RecipeResult m_PMBRecipeResult;
  79. private RecipeResult m_PMCRecipeResult;
  80. private RecipeResult m_PMDRecipeResult;
  81. #endregion
  82. #region 属性
  83. public bool TabIsChecked
  84. {
  85. get { return m_TabIsChecked; }
  86. set { SetProperty(ref m_TabIsChecked, value); }
  87. }
  88. public ModuleInfo LP1ModuleInfo
  89. {
  90. get { return m_LP1ModuleInfo; }
  91. set { SetProperty(ref m_LP1ModuleInfo, value); }
  92. }
  93. public ModuleInfo LLAModuleInfo
  94. {
  95. get { return m_LLAModuleInfo; }
  96. set { SetProperty(ref m_LLAModuleInfo, value); }
  97. }
  98. public ModuleInfo LLBModuleInfo
  99. {
  100. get { return m_LLBModuleInfo; }
  101. set { SetProperty(ref m_LLBModuleInfo, value); }
  102. }
  103. public ModuleInfo EFEMModuleInfo
  104. {
  105. get { return m_EFEMModuleInfo; }
  106. set { SetProperty(ref m_EFEMModuleInfo, value); }
  107. }
  108. public ModuleInfo TMModuleInfo
  109. {
  110. get { return m_TMModuleInfo; }
  111. set { SetProperty(ref m_TMModuleInfo, value); }
  112. }
  113. public ModuleInfo LP2ModuleInfo
  114. {
  115. get { return m_LP2ModuleInfo; }
  116. set { SetProperty(ref m_LP2ModuleInfo, value); }
  117. }
  118. public ModuleInfo LP3ModuleInfo
  119. {
  120. get { return m_LP3ModuleInfo; }
  121. set { SetProperty(ref m_LP3ModuleInfo, value); }
  122. }
  123. public WaferRobotTAction Robot1TAction
  124. {
  125. get { return m_Robot1TAction; }
  126. set { SetProperty(ref m_Robot1TAction, value); }
  127. }
  128. public WaferRobotXAction Robot1XAction
  129. {
  130. get { return m_Robot1XAction; }
  131. set { SetProperty(ref m_Robot1XAction, value); }
  132. }
  133. public WaferRobotTAction Robot2TAction
  134. {
  135. get { return m_Robot2TAction; }
  136. set { SetProperty(ref m_Robot2TAction, value); }
  137. }
  138. public WaferRobotXAction Robot2XAction
  139. {
  140. get { return m_Robot2XAction; }
  141. set { SetProperty(ref m_Robot2XAction, value); }
  142. }
  143. public WaferRobotTAction Robot3TAction
  144. {
  145. get{ return m_Robot3TAction;}
  146. set{SetProperty(ref m_Robot3TAction ,value);}
  147. }
  148. public WaferRobotXAction Robot3XAction
  149. {
  150. get{ return m_Robot3XAction;}
  151. set{SetProperty(ref m_Robot3XAction ,value);}
  152. }
  153. public WaferRobotTAction Robot4TAction
  154. {
  155. get{ return m_Robot4TAction;}
  156. set{SetProperty(ref m_Robot4TAction ,value);}
  157. }
  158. public WaferRobotXAction Robot4XAction
  159. {
  160. get{ return m_Robot4XAction;}
  161. set{SetProperty(ref m_Robot4XAction, value);}
  162. }
  163. public RobotMoveInfo RobotMoveInfo
  164. {
  165. get { return m_robotMoveInfo; }
  166. set
  167. {
  168. RobotMoveInfoChanged(m_robotMoveInfo, value);
  169. m_robotMoveInfo = value;
  170. }
  171. }
  172. public WaferInfo LLAWafer
  173. {
  174. get { return m_LLAWafer; }
  175. set { SetProperty(ref m_LLAWafer, value); }
  176. }
  177. public WaferInfo LLBWafer
  178. {
  179. get { return m_LLBWafer; }
  180. set { SetProperty(ref m_LLBWafer, value); }
  181. }
  182. public WaferInfo PMAWafer
  183. {
  184. get { return m_PMAWafer; }
  185. set { SetProperty(ref m_PMAWafer, value); }
  186. }
  187. public WaferInfo PMBWafer
  188. {
  189. get { return m_PMBWafer; }
  190. set { SetProperty(ref m_PMBWafer, value); }
  191. }
  192. public WaferInfo PMCWafer
  193. {
  194. get { return m_PMCWafer; }
  195. set { SetProperty(ref m_PMCWafer, value); }
  196. }
  197. public WaferInfo PMDWafer
  198. {
  199. get { return m_PMDWafer; }
  200. set { SetProperty(ref m_PMDWafer, value); }
  201. }
  202. public WaferInfo TMBladeAWafer
  203. {
  204. get { return m_TMBladeAWafer; }
  205. set { SetProperty(ref m_TMBladeAWafer, value); }
  206. }
  207. public WaferInfo TMBladeBWafer
  208. {
  209. get { return m_TMBladeBWafer; }
  210. set { SetProperty(ref m_TMBladeBWafer, value); }
  211. }
  212. public Dictionary<string, object> RtDataValues
  213. {
  214. get { return m_RtDataValues; }
  215. set { SetProperty(ref m_RtDataValues, value); }
  216. }
  217. public bool PMAIsInstalled
  218. {
  219. get { return m_PMAIsInstalled; }
  220. set { SetProperty(ref m_PMAIsInstalled, value); }
  221. }
  222. public bool PMBIsInstalled
  223. {
  224. get { return m_PMBIsInstalled; }
  225. set { SetProperty(ref m_PMBIsInstalled, value); }
  226. }
  227. public bool PMCIsInstalled
  228. {
  229. get { return m_PMCIsInstalled; }
  230. set { SetProperty(ref m_PMCIsInstalled, value); }
  231. }
  232. public bool PMDIsInstalled
  233. {
  234. get { return m_PMDIsInstalled; }
  235. set { SetProperty(ref m_PMDIsInstalled, value); }
  236. }
  237. public bool LLAIsInstalled
  238. {
  239. get { return m_LLAIsInstalled; }
  240. set { SetProperty(ref m_LLAIsInstalled, value); }
  241. }
  242. public bool LLBIsInstalled
  243. {
  244. get { return m_LLBIsInstalled; }
  245. set { SetProperty(ref m_LLBIsInstalled, value); }
  246. }
  247. public bool TMIsInstalled
  248. {
  249. get { return m_TMIsInstalled; }
  250. set { SetProperty(ref m_TMIsInstalled, value); }
  251. }
  252. public bool EFEMIsInstalled
  253. {
  254. get { return m_EFEMIsInstalled; }
  255. set { SetProperty(ref m_EFEMIsInstalled, value); }
  256. }
  257. public WaferInfo EFEMBladeAWafer
  258. {
  259. get { return m_EFEMBladeAWafer; }
  260. set { SetProperty(ref m_EFEMBladeAWafer, value); }
  261. }
  262. public WaferInfo EFEMBladeBWafer
  263. {
  264. get { return m_EFEMBladeBWafer; }
  265. set { SetProperty(ref m_EFEMBladeBWafer, value); }
  266. }
  267. public WaferInfo Aligner1Wafer
  268. {
  269. get { return m_Aligner1Wafer; }
  270. set { SetProperty(ref m_Aligner1Wafer, value); }
  271. }
  272. public int LP1WaferCount
  273. {
  274. get { return m_LP1WaferCount; }
  275. set { SetProperty(ref m_LP1WaferCount, value); }
  276. }
  277. public int LP2WaferCount
  278. {
  279. get { return m_LP2WaferCount; }
  280. set { SetProperty(ref m_LP2WaferCount, value); }
  281. }
  282. public int LP3WaferCount
  283. {
  284. get { return m_LP3WaferCount; }
  285. set { SetProperty(ref m_LP3WaferCount, value); }
  286. }
  287. public WaferAssociationInfo LP1WaferAssociation
  288. {
  289. get { return _lp1WaferAssociation; }
  290. set { SetProperty(ref _lp1WaferAssociation, value); }
  291. }
  292. public WaferAssociationInfo LP2WaferAssociation
  293. {
  294. get { return _lp2WaferAssociation; }
  295. set { SetProperty(ref _lp2WaferAssociation, value); }
  296. }
  297. public WaferAssociationInfo LP3WaferAssociation
  298. {
  299. get { return _lp3WaferAssociation; }
  300. set { SetProperty(ref _lp3WaferAssociation, value); }
  301. }
  302. public int CycledWafer
  303. {
  304. get { return m_CycledWafer; }
  305. set { SetProperty(ref m_CycledWafer, value); }
  306. }
  307. public int CycleCountDisplay
  308. {
  309. get { return m_CycleCountDisplay; }
  310. set { SetProperty(ref m_CycleCountDisplay, value); }
  311. }
  312. public RobotMoveInfo m_EfemRobotMoveInfo;
  313. public RobotMoveInfo EfemRobotMoveInfo
  314. {
  315. get { return m_EfemRobotMoveInfo; }
  316. set
  317. {
  318. EFEMRobotMoveInfoChanged(m_EfemRobotMoveInfo, value);
  319. m_EfemRobotMoveInfo = value;
  320. }
  321. }
  322. public RobotPosition CurrentRobotPosition
  323. {
  324. get { return m_CurrentRobotPosition; }
  325. set { SetProperty(ref m_CurrentRobotPosition, value); }
  326. }
  327. public WaferInfo BladeAWafer
  328. {
  329. get { return m_BladeAWafer; }
  330. set { SetProperty(ref m_BladeAWafer, value); }
  331. }
  332. public WaferInfo BladeBWafer
  333. {
  334. get { return m_BladeBWafer; }
  335. set { SetProperty(ref m_BladeBWafer, value); }
  336. }
  337. public RecipeResult PMARecipeResult
  338. {
  339. get { return m_PMARecipeResult; }
  340. set { SetProperty(ref m_PMARecipeResult, value); }
  341. }
  342. public RecipeResult PMBRecipeResult
  343. {
  344. get { return m_PMBRecipeResult; }
  345. set { SetProperty(ref m_PMBRecipeResult, value); }
  346. }
  347. public RecipeResult PMCRecipeResult
  348. {
  349. get { return m_PMCRecipeResult; }
  350. set { SetProperty(ref m_PMCRecipeResult, value); }
  351. }
  352. public RecipeResult PMDRecipeResult
  353. {
  354. get { return m_PMDRecipeResult; }
  355. set { SetProperty(ref m_PMDRecipeResult, value); }
  356. }
  357. #endregion
  358. #region 命令
  359. private DelegateCommand _LoadCommand;
  360. public DelegateCommand LoadCommand =>
  361. _LoadCommand ?? (_LoadCommand = new DelegateCommand(OnLoad));
  362. private DelegateCommand<object> _LoadWaferCommand;
  363. public DelegateCommand<object> LoadWaferCommand =>
  364. _LoadWaferCommand ?? (_LoadWaferCommand = new DelegateCommand<object>(OnLoadWafer));
  365. private DelegateCommand<object> _UnLoadWaferCommand;
  366. public DelegateCommand<object> UnLoadWaferCommand =>
  367. _UnLoadWaferCommand ?? (_UnLoadWaferCommand = new DelegateCommand<object>(OnUnLoadWafer));
  368. private DelegateCommand<object> _SelectAllCommand;
  369. public DelegateCommand<object> SelectAllCommand =>
  370. _SelectAllCommand ?? (_SelectAllCommand = new DelegateCommand<object>(OnSelectAll));
  371. private DelegateCommand<object> _UnSelectAllCommand;
  372. public DelegateCommand<object> UnSelectAllCommand =>
  373. _UnSelectAllCommand ?? (_UnSelectAllCommand = new DelegateCommand<object>(OnUnSelectAll));
  374. private DelegateCommand<object> _StartCommand;
  375. public DelegateCommand<object> StartCommand =>
  376. _StartCommand ?? (_StartCommand = new DelegateCommand<object>(OnStart));
  377. private DelegateCommand<object> _StopCommand;
  378. public DelegateCommand<object> StopCommand =>
  379. _StopCommand ?? (_StopCommand = new DelegateCommand<object>(OnStop));
  380. private DelegateCommand<object> _AbortCommand;
  381. public DelegateCommand<object> AbortCommand =>
  382. _AbortCommand ?? (_AbortCommand = new DelegateCommand<object>(OnAbort));
  383. private DelegateCommand _HomeAllCommand;
  384. public DelegateCommand HomeAllCommand =>
  385. _HomeAllCommand ?? (_HomeAllCommand = new DelegateCommand(OnHomeAll));
  386. private DelegateCommand _PauseAllJobCommand;
  387. public DelegateCommand PauseAllJobCommand =>
  388. _PauseAllJobCommand ?? (_PauseAllJobCommand = new DelegateCommand(OnPauseAllJob));
  389. private DelegateCommand _AbortAllCommand;
  390. public DelegateCommand AbortAllCommand =>
  391. _AbortAllCommand ?? (_AbortAllCommand = new DelegateCommand(OnAbortAll));
  392. private DelegateCommand _ReturnAllWaferCommand;
  393. public DelegateCommand ReturnAllWaferCommand =>
  394. _ReturnAllWaferCommand ?? (_ReturnAllWaferCommand = new DelegateCommand(OnReturnAllWafer));
  395. private DelegateCommand<object> _SetSequenceCommand;
  396. public DelegateCommand<object> SetSequenceCommand =>
  397. _SetSequenceCommand ?? (_SetSequenceCommand = new DelegateCommand<object>(OnSetSequence));
  398. private DelegateCommand<object> _CreateJobCommand;
  399. public DelegateCommand<object> CreateJobCommand =>
  400. _CreateJobCommand ?? (_CreateJobCommand = new DelegateCommand<object>(OnCreateJob));
  401. private DelegateCommand _EnableAutoCommand;
  402. public DelegateCommand EnableAutoCommand =>
  403. _EnableAutoCommand ?? (_EnableAutoCommand = new DelegateCommand(OnEnableAuto));
  404. private DelegateCommand _EnableManualCommand;
  405. public DelegateCommand EnableManualCommand =>
  406. _EnableManualCommand ?? (_EnableManualCommand = new DelegateCommand(OnEnableManual));
  407. public bool SwitchFlag;
  408. #endregion
  409. #region 构造函数
  410. public OperationOverViewModel()
  411. {
  412. DispatcherTimer timer = new DispatcherTimer();
  413. timer.Interval = TimeSpan.FromSeconds(0.5);
  414. timer.Tick += Timer_Tick;
  415. timer.Start();
  416. addDataKeys();
  417. string allModules = QueryDataClient.Instance.Service.GetConfig($"System.InstalledModules").ToString();
  418. PMAIsInstalled = allModules.Contains("PMA");
  419. PMBIsInstalled = allModules.Contains("PMB");
  420. PMCIsInstalled = allModules.Contains("PMC");
  421. PMDIsInstalled = allModules.Contains("PMD");
  422. LLAIsInstalled = allModules.Contains("LLA");
  423. LLBIsInstalled = allModules.Contains("LLB");
  424. EFEMIsInstalled = allModules.Contains("EFEM");
  425. TMIsInstalled = allModules.Contains("TM");
  426. UIEvents.PMDoorRaiseChangedEvent += UIEvents_PMDoorRaiseChangedEvent;
  427. UIEvents.LLTDoorRaiseChangedEvent += UIEvents_LLTDoorRaiseChangedEvent;
  428. UIEvents.LLEDoorRaiseChangedEvent += UIEvents_LLEDoorRaiseChangedEvent;
  429. SwitchFlag = false;
  430. }
  431. #endregion
  432. #region 命令方法
  433. private void OnLoad()
  434. {
  435. if (!SwitchFlag)
  436. {
  437. LP1WaferAssociation = new WaferAssociationInfo();
  438. LP3WaferAssociation = new WaferAssociationInfo();
  439. LP2WaferAssociation = new WaferAssociationInfo();
  440. LP1WaferAssociation.ModuleData = ModuleManager.ModuleInfos["LP1"];
  441. LP2WaferAssociation.ModuleData = ModuleManager.ModuleInfos["LP2"];
  442. LP3WaferAssociation.ModuleData = ModuleManager.ModuleInfos["LP3"];
  443. SwitchFlag = true;
  444. }
  445. }
  446. private void OnLoadWafer(object obj)
  447. {
  448. InvokeClient.Instance.Service.DoOperation($"{obj.ToString()}.Load", ModuleManager.ModuleInfos[obj.ToString()].ModuleID);
  449. }
  450. private void OnUnLoadWafer(object obj)
  451. {
  452. InvokeClient.Instance.Service.DoOperation($"{obj.ToString()}.Unload", ModuleManager.ModuleInfos[obj.ToString()].ModuleID);
  453. }
  454. private void OnSelectAll(object obj)
  455. {
  456. var info=obj as WaferAssociationInfo;
  457. waferAssociationInfo = info;
  458. info.SlotFrom = 1;
  459. info.SlotTo = 25;
  460. AssociateSequence(info, true);
  461. }
  462. private void OnUnSelectAll(object obj)
  463. {
  464. var info = obj as WaferAssociationInfo;
  465. info.SlotFrom = 1;
  466. info.SlotTo = 25;
  467. AssociateSequence(info, false);
  468. }
  469. private void OnStart(object obj)
  470. {
  471. var info = obj as WaferAssociationInfo;
  472. InvokeClient.Instance.Service.DoOperation("System.StartJob", info.LotId);
  473. }
  474. private void OnStop(object obj)
  475. {
  476. InvokeClient.Instance.Service.DoOperation("System.PauseJob", obj.ToString());
  477. }
  478. private void OnAbort(object obj)
  479. {
  480. InvokeClient.Instance.Service.DoOperation("System.ResumeJob", obj.ToString());
  481. }
  482. private void OnHomeAll()
  483. {
  484. InvokeClient.Instance.Service.DoOperation("System.HomeAll");
  485. }
  486. private void OnPauseAllJob()
  487. {
  488. InvokeClient.Instance.Service.DoOperation("System.PauseJob", LP1WaferAssociation.JobID);
  489. InvokeClient.Instance.Service.DoOperation("System.PauseJob", LP2WaferAssociation.JobID);
  490. InvokeClient.Instance.Service.DoOperation("System.PauseJob", LP3WaferAssociation.JobID);
  491. }
  492. private void OnAbortAll()
  493. {
  494. InvokeClient.Instance.Service.DoOperation("System.Abort");
  495. }
  496. private void OnReturnAllWafer()
  497. {
  498. //Dialog
  499. WaferDialogView dialog = new WaferDialogView()
  500. {
  501. Owner = Application.Current.MainWindow,
  502. };
  503. dialog.Left = Application.Current.MainWindow.Width / 2 - 150;
  504. dialog.Top = Application.Current.MainWindow.Height / 2 - 200;
  505. dialog.Height = 300;
  506. dialog.Width = 400;
  507. double angel = 0;
  508. double coolingtime = 0;
  509. if (dialog.ShowDialog() == true)
  510. {
  511. if ((bool)dialog.AlignFlag == true && !string.IsNullOrEmpty(dialog.Angle))
  512. {
  513. angel = Convert.ToDouble(dialog.Angle);
  514. }
  515. if ((bool)dialog.CoolingFlag == true && !string.IsNullOrEmpty(dialog.CoolingTime))
  516. {
  517. coolingtime = Convert.ToDouble(dialog.CoolingTime);
  518. }
  519. InvokeClient.Instance.Service.DoOperation("System.ReturnAllWafer", dialog.CoolingFlag,coolingtime, dialog.AlignFlag, angel);
  520. }
  521. }
  522. private WaferAssociationInfo waferAssociationInfo = null;
  523. private void OnSetSequence(object obj)
  524. {
  525. var info = obj as WaferInfo;
  526. bool flag = info.SequenceName != "" ? false : true;
  527. AssociateSequence(waferAssociationInfo, flag,info.SlotID);
  528. }
  529. private void OnCreateJob(object obj)
  530. {
  531. var info = obj as WaferAssociationInfo;
  532. List<string> slotSequence = new List<string>();
  533. info.ModuleData.WaferManager.Wafers.ForEach(key => { slotSequence.Insert(0, key.SequenceName); });
  534. string jobId = info.LotId.Trim();
  535. if (string.IsNullOrEmpty(jobId))
  536. jobId = "CJ_Local_" + info.ModuleData.ModuleID;
  537. info.LotId = jobId;
  538. info.JobID = jobId;
  539. info.JobStatus = "WaitingForStart";
  540. info.LotIdSaved = true;
  541. Dictionary<string, object> param = new Dictionary<string, object>()
  542. {
  543. {"JobId", jobId},
  544. {"Module", info.ModuleData.ModuleID},
  545. {"SlotSequence", slotSequence.ToArray()},
  546. {"AutoStart", true},
  547. };
  548. InvokeClient.Instance.Service.DoOperation("System.CreateJob", param);
  549. }
  550. private void OnEnableAuto()
  551. {
  552. InvokeClient.Instance.Service.DoOperation("System.SetAutoMode");
  553. }
  554. private void OnEnableManual()
  555. {
  556. InvokeClient.Instance.Service.DoOperation("System.SetManualMode");
  557. }
  558. #endregion
  559. #region 私有方法
  560. private void Timer_Tick(object sender, EventArgs e)
  561. {
  562. LP1ModuleInfo = ModuleManager.ModuleInfos["LP1"];
  563. LP2ModuleInfo = ModuleManager.ModuleInfos["LP2"];
  564. LP3ModuleInfo = ModuleManager.ModuleInfos["LP3"];
  565. EFEMModuleInfo = ModuleManager.ModuleInfos["EfemRobot"];
  566. TMModuleInfo = ModuleManager.ModuleInfos["TMRobot"];
  567. BladeAWafer = ModuleManager.ModuleInfos["EfemRobot"].WaferManager.Wafers[0];
  568. BladeBWafer = ModuleManager.ModuleInfos["EfemRobot"].WaferManager.Wafers[1];
  569. RtDataValues = QueryDataClient.Instance.Service.PollData(m_RtDataKeys);
  570. if (LLAIsInstalled == true)
  571. {
  572. LLAModuleInfo = ModuleManager.ModuleInfos["LLA"];
  573. LLAWafer = ModuleManager.ModuleInfos["LLA"].WaferManager.Wafers.FirstOrDefault(x => x.WaferStatus != 0);
  574. }
  575. if (LLBIsInstalled == true)
  576. {
  577. LLBModuleInfo = ModuleManager.ModuleInfos["LLB"];
  578. LLBWafer = ModuleManager.ModuleInfos["LLB"].WaferManager.Wafers.FirstOrDefault(x => x.WaferStatus != 0);
  579. }
  580. if (PMAIsInstalled == true)
  581. {
  582. PMAWafer = ModuleManager.ModuleInfos["PMA"].WaferManager.Wafers[0];
  583. PMARecipeResult = CommonFunction.GetValue<RecipeResult>(RtDataValues, $"PMA.CurrentRecipeResult");
  584. }
  585. if (PMBIsInstalled == true)
  586. {
  587. PMBWafer = ModuleManager.ModuleInfos["PMB"].WaferManager.Wafers[0];
  588. PMBRecipeResult = CommonFunction.GetValue<RecipeResult>(RtDataValues, $"PMB.CurrentRecipeResult");
  589. }
  590. if (PMCIsInstalled == true)
  591. {
  592. PMCWafer = ModuleManager.ModuleInfos["PMC"].WaferManager.Wafers[0];
  593. PMCRecipeResult = CommonFunction.GetValue<RecipeResult>(RtDataValues, $"PMC.CurrentRecipeResult");
  594. }
  595. if (PMDIsInstalled == true)
  596. {
  597. PMDWafer = ModuleManager.ModuleInfos["PMD"].WaferManager.Wafers[0];
  598. PMDRecipeResult = CommonFunction.GetValue<RecipeResult>(RtDataValues, $"PMD.CurrentRecipeResult");
  599. }
  600. if (TMIsInstalled == true)
  601. {
  602. TMBladeAWafer = ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[0];
  603. TMBladeBWafer = ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[1];
  604. }
  605. if (EFEMIsInstalled == true)
  606. {
  607. EFEMBladeAWafer = ModuleManager.ModuleInfos["EfemRobot"].WaferManager.Wafers[0];
  608. EFEMBladeBWafer = ModuleManager.ModuleInfos["EfemRobot"].WaferManager.Wafers[1];
  609. Aligner1Wafer = ModuleManager.ModuleInfos["Aligner1"].WaferManager.Wafers[0];
  610. }
  611. RobotMoveInfo = (RobotMoveInfo)QueryDataClient.Instance.Service.GetData("TM.RobotMoveAction");
  612. EfemRobotMoveInfo=(RobotMoveInfo)QueryDataClient.Instance.Service.GetData("EFEM.RobotMoveAction");
  613. LP1WaferCount = LP1ModuleInfo.WaferManager.Wafers.Where(x=>x.WaferStatus!=0).Count();
  614. LP2WaferCount = LP2ModuleInfo.WaferManager.Wafers.Where(x => x.WaferStatus != 0).Count();
  615. LP3WaferCount = LP3ModuleInfo.WaferManager.Wafers.Where(x => x.WaferStatus != 0).Count();
  616. }
  617. private async void RobotMoveInfoChanged(RobotMoveInfo oldValue, RobotMoveInfo newValue)
  618. {
  619. string RobotTarget;
  620. if (oldValue == null || newValue == null)
  621. {
  622. return;
  623. }
  624. #region pick 和 place LL
  625. if (oldValue.Action == RobotAction.None && (newValue.Action == RobotAction.Placing || newValue.Action == RobotAction.Picking))
  626. {
  627. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  628. if (TMRobotMoveActionBladeTarget != null)
  629. {
  630. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  631. }
  632. else
  633. {
  634. return;
  635. }
  636. var values = RobotTarget.Split('.');
  637. var arm = values[0];
  638. var module = values[1];
  639. if (arm == "ArmA")
  640. {
  641. Robot1TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  642. await Task.Delay(1500);
  643. Robot1XAction = WaferRobotXAction.Extend;
  644. await Task.Delay(3000);
  645. Robot1XAction = WaferRobotXAction.Retract;
  646. }
  647. else if (arm == "ArmB")
  648. {
  649. Robot2TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  650. await Task.Delay(1500);
  651. Robot2XAction = WaferRobotXAction.Extend;
  652. await Task.Delay(3000);
  653. Robot2XAction = WaferRobotXAction.Retract;
  654. }
  655. }
  656. #endregion
  657. #region pick 和 place pm
  658. if (oldValue.Action == RobotAction.None && newValue.Action == RobotAction.Extending)
  659. {
  660. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  661. if (TMRobotMoveActionBladeTarget != null)
  662. {
  663. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  664. }
  665. else
  666. {
  667. return;
  668. }
  669. var values = RobotTarget.Split('.');
  670. var arm = values[0];
  671. var module = values[1];
  672. if (arm == "ArmA")
  673. {
  674. Robot1TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  675. await Task.Delay(1500);
  676. Robot1XAction = WaferRobotXAction.Extend;
  677. }
  678. else if (arm == "ArmB")
  679. {
  680. Robot2TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  681. await Task.Delay(1500);
  682. Robot2XAction = WaferRobotXAction.Extend;
  683. }
  684. }
  685. if (oldValue.Action == RobotAction.None && newValue.Action == RobotAction.Retracting)
  686. {
  687. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  688. if (TMRobotMoveActionBladeTarget != null)
  689. {
  690. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  691. }
  692. else
  693. {
  694. return;
  695. }
  696. var values = RobotTarget.Split('.');
  697. var arm = values[0];
  698. if (arm == "ArmA")
  699. {
  700. Robot1XAction = WaferRobotXAction.Retract;
  701. }
  702. else if (arm == "ArmB")
  703. {
  704. Robot2XAction = WaferRobotXAction.Retract;
  705. }
  706. }
  707. #endregion
  708. arm1oldWaferStatus = ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[0].WaferStatus;
  709. arm2oldWaferStatus = ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[1].WaferStatus;
  710. }
  711. private async void EFEMRobotMoveInfoChanged(RobotMoveInfo oldValue, RobotMoveInfo newValue)
  712. {
  713. string RobotTarget;
  714. if (oldValue == null || newValue == null)
  715. {
  716. return;
  717. }
  718. #region pick 和 place LL
  719. if (oldValue.Action == RobotAction.None && (newValue.Action == RobotAction.Placing || newValue.Action == RobotAction.Picking))
  720. {
  721. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  722. if (TMRobotMoveActionBladeTarget != null)
  723. {
  724. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  725. }
  726. else
  727. {
  728. return;
  729. }
  730. var values = RobotTarget.Split('.');
  731. var arm = values[0];
  732. var module = values[1];
  733. if (arm == "ArmA")
  734. {
  735. var robot3Robot3TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  736. await ChangePosition(robot3Robot3TAction);
  737. Robot3TAction = robot3Robot3TAction;
  738. await Task.Delay(1500);
  739. //ChangePosition(Robot3TAction);
  740. // await Task.Delay(2000);
  741. Robot3XAction = WaferRobotXAction.Extend;
  742. await Task.Delay(3000);
  743. Robot3XAction = WaferRobotXAction.Retract;
  744. }
  745. else if (arm == "ArmB")
  746. {
  747. var robot4Robot4TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  748. await ChangePosition(robot4Robot4TAction);
  749. Robot4TAction = robot4Robot4TAction;
  750. await Task.Delay(1500);
  751. //ChangePosition(Robot4TAction);
  752. //await Task.Delay(2000);
  753. Robot4XAction = WaferRobotXAction.Extend;
  754. await Task.Delay(3000);
  755. Robot4XAction = WaferRobotXAction.Retract;
  756. }
  757. }
  758. #endregion
  759. #region pick 和 place pm
  760. if (oldValue.Action == RobotAction.None && newValue.Action == RobotAction.Extending)
  761. {
  762. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  763. if (TMRobotMoveActionBladeTarget != null)
  764. {
  765. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  766. }
  767. else
  768. {
  769. return;
  770. }
  771. var values = RobotTarget.Split('.');
  772. var arm = values[0];
  773. var module = values[1];
  774. if (arm == "ArmA")
  775. {
  776. Robot3TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  777. await Task.Delay(1500);
  778. //ChangePosition(Robot3TAction);
  779. //await Task.Delay(2000);
  780. Robot3XAction = WaferRobotXAction.Extend;
  781. }
  782. else if (arm == "ArmB")
  783. {
  784. Robot4TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  785. await Task.Delay(1500);
  786. //ChangePosition(Robot4TAction);
  787. //await Task.Delay(2000);
  788. Robot4XAction = WaferRobotXAction.Extend;
  789. }
  790. }
  791. if (oldValue.Action == RobotAction.None && newValue.Action == RobotAction.Retracting)
  792. {
  793. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  794. if (TMRobotMoveActionBladeTarget != null)
  795. {
  796. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  797. }
  798. else
  799. {
  800. return;
  801. }
  802. var values = RobotTarget.Split('.');
  803. var arm = values[0];
  804. if (arm == "ArmA")
  805. {
  806. Robot3XAction = WaferRobotXAction.Retract;
  807. await Task.Delay(3000);
  808. //ChangePosition(Robot3TAction);
  809. //await Task.Delay(2000);
  810. }
  811. else if (arm == "ArmB")
  812. {
  813. Robot4XAction = WaferRobotXAction.Retract;
  814. await Task.Delay(3000);
  815. //ChangePosition(Robot3TAction);
  816. //await Task.Delay(2000);
  817. }
  818. }
  819. #endregion
  820. }
  821. private void addDataKeys()
  822. {
  823. m_RtDataKeys.Add("PMA.IsSlitDoorClosed");
  824. m_RtDataKeys.Add("PMB.IsSlitDoorClosed");
  825. m_RtDataKeys.Add("PMC.IsSlitDoorClosed");
  826. m_RtDataKeys.Add("PMD.IsSlitDoorClosed");
  827. m_RtDataKeys.Add("TM.LLATSlitDoor.IsClosed");
  828. m_RtDataKeys.Add("TM.LLBTSlitDoor.IsClosed");
  829. m_RtDataKeys.Add("TM.LLAESlitDoor.IsClosed");
  830. m_RtDataKeys.Add("TM.LLBESlitDoor.IsClosed");
  831. m_RtDataKeys.Add("System.IsAutoMode");
  832. m_RtDataKeys.Add("Scheduler.CycledCount");
  833. m_RtDataKeys.Add("Scheduler.CycledWafer");
  834. m_RtDataKeys.Add("Scheduler.CycleSetPoint");
  835. m_RtDataKeys.Add("LP1.IsLoaded");
  836. m_RtDataKeys.Add("LP2.IsLoaded");
  837. m_RtDataKeys.Add("LP3.IsLoaded");
  838. m_RtDataKeys.Add("LP1.CassettePlaced");
  839. m_RtDataKeys.Add("LP2.CassettePlaced");
  840. m_RtDataKeys.Add("LP3.CassettePlaced");
  841. m_RtDataKeys.Add("PMA.CurrentRecipeResult");
  842. m_RtDataKeys.Add("PMB.CurrentRecipeResult");
  843. m_RtDataKeys.Add("PMC.CurrentRecipeResult");
  844. m_RtDataKeys.Add("PMD.CurrentRecipeResult");
  845. }
  846. private void AssociateSequence(WaferAssociationInfo info, bool flag, int slot = -1)
  847. {
  848. List<WaferInfo> wafers = info.ModuleData.WaferManager.Wafers;
  849. if (slot >= 0) //by wafer
  850. {
  851. int index = wafers.Count - slot - 1;
  852. if (index < wafers.Count)
  853. {
  854. if (flag && HasWaferOnSlot(wafers, index))
  855. wafers[index].SequenceName = info.SequenceName;
  856. else
  857. wafers[index].SequenceName = string.Empty;
  858. }
  859. }
  860. else //by from-to
  861. {
  862. for (int i = info.SlotFrom - 1; i < info.SlotTo; i++)
  863. {
  864. int index = wafers.Count - i - 1;
  865. if (index < wafers.Count)
  866. {
  867. if (flag && HasWaferOnSlot(wafers, index))
  868. wafers[index].SequenceName = info.SequenceName;
  869. else
  870. wafers[index].SequenceName = string.Empty;
  871. }
  872. }
  873. }
  874. switch (info.ModuleData.ModuleID)
  875. {
  876. case "LP1":
  877. LP1WaferAssociation = info;
  878. break;
  879. case "LP2":
  880. LP2WaferAssociation = info;
  881. break;
  882. case "LP3":
  883. LP3WaferAssociation = info;
  884. break;
  885. }
  886. }
  887. private bool HasWaferOnSlot(List<WaferInfo> wafers, int index)
  888. {
  889. if (wafers[index].WaferStatus == 0)
  890. return false;
  891. return true;
  892. }
  893. private void UIEvents_PMDoorRaiseChangedEvent(DoorPara obj)
  894. {
  895. //InvokeClient.Instance.Service.DoOperation($"{obj?.ModuleName}.SlitDoor.{obj?.IsOpen}");
  896. InvokeClient.Instance.Service.DoOperation($"{obj?.ModuleName}.SetSlitDoor",obj.IsOpen=="Open"?true:false);
  897. }
  898. private void UIEvents_LLTDoorRaiseChangedEvent(DoorPara obj)
  899. {
  900. InvokeClient.Instance.Service.DoOperation($"TM.SetMFSlitDoor",obj.ModuleName, obj.IsOpen == "Open" ? true : false);
  901. }
  902. private void UIEvents_LLEDoorRaiseChangedEvent(DoorPara obj)
  903. {
  904. InvokeClient.Instance.Service.DoOperation($"TM.{obj.ModuleName}ESlitDoor.{obj?.IsOpen}");
  905. }
  906. private async Task ChangePosition(WaferRobotTAction waferRobotTAction)
  907. {
  908. //CurrentRobotPosition = RobotPosition.Origin;
  909. //await Task.Delay(1000);
  910. if (waferRobotTAction == WaferRobotTAction.LP1)
  911. {
  912. CurrentRobotPosition = RobotPosition.Left;
  913. }
  914. else if (waferRobotTAction == WaferRobotTAction.LP3)
  915. {
  916. CurrentRobotPosition = RobotPosition.Right;
  917. }
  918. else if (waferRobotTAction == WaferRobotTAction.LP2)
  919. {
  920. CurrentRobotPosition = RobotPosition.Middle;
  921. }
  922. else
  923. {
  924. CurrentRobotPosition = RobotPosition.Origin;
  925. }
  926. await Task.Delay(1500);
  927. }
  928. #endregion
  929. }
  930. }