OperationOverViewModel.cs 38 KB

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