OperationOverViewModel.cs 50 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333
  1. using Aitex.Core.RT.Log;
  2. using MECF.Framework.Common.CommonData;
  3. using MECF.Framework.Common.DataCenter;
  4. using MECF.Framework.Common.Equipment;
  5. using MECF.Framework.Common.Jobs;
  6. using MECF.Framework.Common.OperationCenter;
  7. using OpenSEMI.ClientBase;
  8. using Prism.Commands;
  9. using Prism.Mvvm;
  10. using System;
  11. using System.Collections.Generic;
  12. using System.Linq;
  13. using System.Text;
  14. using System.Threading.Tasks;
  15. using System.Windows;
  16. using System.Windows.Threading;
  17. using Venus_Core;
  18. using Venus_MainPages.Unity;
  19. using Venus_MainPages.Views;
  20. using Venus_Themes.CustomControls;
  21. using static Venus_Themes.UserControls.EFEM;
  22. namespace Venus_MainPages.ViewModels
  23. {
  24. public class OperationOverViewModel : BindableBase
  25. {
  26. #region 私有字段
  27. private bool m_TabIsChecked = true;
  28. private ModuleInfo m_LP1ModuleInfo;
  29. private ModuleInfo m_LP2ModuleInfo;
  30. private ModuleInfo m_LLAModuleInfo;
  31. private ModuleInfo m_LLBModuleInfo;
  32. private ModuleInfo m_LP3ModuleInfo;
  33. private ModuleInfo m_EFEMModuleInfo;
  34. private ModuleInfo m_TMModuleInfo;
  35. private WaferRobotTAction m_Robot1TAction;
  36. private WaferRobotXAction m_Robot1XAction;
  37. private WaferRobotTAction m_Robot2TAction;
  38. private WaferRobotXAction m_Robot2XAction;
  39. private WaferRobotTAction m_Robot3TAction;
  40. private WaferRobotXAction m_Robot3XAction;
  41. private WaferRobotTAction m_Robot4TAction;
  42. private WaferRobotXAction m_Robot4XAction;
  43. private RobotMoveInfo m_robotMoveInfo;
  44. private WaferInfo m_PMAWafer;
  45. private WaferInfo m_PMBWafer;
  46. private WaferInfo m_PMCWafer;
  47. private WaferInfo m_PMDWafer;
  48. private WaferInfo m_LLAWafer;
  49. private WaferInfo m_LLBWafer;
  50. private WaferInfo m_TMBladeAWafer;
  51. private WaferInfo m_TMBladeBWafer;
  52. private List<string> m_RtDataKeys = new List<string>();
  53. private Dictionary<string, object> m_RtDataValues;
  54. private bool m_PMAIsInstalled;
  55. private bool m_PMBIsInstalled;
  56. private bool m_PMCIsInstalled;
  57. private bool m_PMDIsInstalled;
  58. private bool m_LLAIsInstalled;
  59. private bool m_LLBIsInstalled;
  60. private bool m_TMIsInstalled;
  61. private bool m_EFEMIsInstalled;
  62. private WaferInfo m_EFEMBladeAWafer;
  63. private WaferInfo m_EFEMBladeBWafer;
  64. private WaferInfo m_Aligner1Wafer;
  65. private int m_LP1WaferCount;
  66. private int m_LP2WaferCount;
  67. private int m_LP3WaferCount;
  68. private WaferAssociationInfo _lp1WaferAssociation;
  69. private WaferAssociationInfo _lp2WaferAssociation;
  70. private WaferAssociationInfo _lp3WaferAssociation;
  71. private int m_CycledWafer;
  72. private int m_CycleCountDisplay;
  73. private RobotPosition m_CurrentRobotPosition;
  74. private WaferInfo m_BladeAWafer;
  75. private WaferInfo m_BladeBWafer;
  76. private RecipeResult m_PMARecipeResult;
  77. private RecipeResult m_PMBRecipeResult;
  78. private RecipeResult m_PMCRecipeResult;
  79. private RecipeResult m_PMDRecipeResult;
  80. private string m_ATMModeIsOn;
  81. private float m_TMPressure;
  82. private string m_RouteState;
  83. private PressureType m_PressureType;
  84. #endregion
  85. #region 属性
  86. public PressureType PressureType
  87. {
  88. get { return m_PressureType; }
  89. set { SetProperty(ref m_PressureType, value); }
  90. }
  91. public bool TabIsChecked
  92. {
  93. get { return m_TabIsChecked; }
  94. set { SetProperty(ref m_TabIsChecked, value); }
  95. }
  96. public ModuleInfo LP1ModuleInfo
  97. {
  98. get { return m_LP1ModuleInfo; }
  99. set { SetProperty(ref m_LP1ModuleInfo, value); }
  100. }
  101. public ModuleInfo LLAModuleInfo
  102. {
  103. get { return m_LLAModuleInfo; }
  104. set { SetProperty(ref m_LLAModuleInfo, value); }
  105. }
  106. public ModuleInfo LLBModuleInfo
  107. {
  108. get { return m_LLBModuleInfo; }
  109. set { SetProperty(ref m_LLBModuleInfo, value); }
  110. }
  111. public ModuleInfo EFEMModuleInfo
  112. {
  113. get { return m_EFEMModuleInfo; }
  114. set { SetProperty(ref m_EFEMModuleInfo, value); }
  115. }
  116. public ModuleInfo TMModuleInfo
  117. {
  118. get { return m_TMModuleInfo; }
  119. set { SetProperty(ref m_TMModuleInfo, value); }
  120. }
  121. public ModuleInfo LP2ModuleInfo
  122. {
  123. get { return m_LP2ModuleInfo; }
  124. set { SetProperty(ref m_LP2ModuleInfo, value); }
  125. }
  126. public ModuleInfo LP3ModuleInfo
  127. {
  128. get { return m_LP3ModuleInfo; }
  129. set { SetProperty(ref m_LP3ModuleInfo, value); }
  130. }
  131. public WaferRobotTAction Robot1TAction
  132. {
  133. get { return m_Robot1TAction; }
  134. set { SetProperty(ref m_Robot1TAction, value); }
  135. }
  136. public WaferRobotXAction Robot1XAction
  137. {
  138. get { return m_Robot1XAction; }
  139. set { SetProperty(ref m_Robot1XAction, value); }
  140. }
  141. public WaferRobotTAction Robot2TAction
  142. {
  143. get { return m_Robot2TAction; }
  144. set { SetProperty(ref m_Robot2TAction, value); }
  145. }
  146. public WaferRobotXAction Robot2XAction
  147. {
  148. get { return m_Robot2XAction; }
  149. set { SetProperty(ref m_Robot2XAction, value); }
  150. }
  151. public WaferRobotTAction Robot3TAction
  152. {
  153. get { return m_Robot3TAction; }
  154. set { SetProperty(ref m_Robot3TAction, value); }
  155. }
  156. public WaferRobotXAction Robot3XAction
  157. {
  158. get { return m_Robot3XAction; }
  159. set { SetProperty(ref m_Robot3XAction, value); }
  160. }
  161. public WaferRobotTAction Robot4TAction
  162. {
  163. get { return m_Robot4TAction; }
  164. set { SetProperty(ref m_Robot4TAction, value); }
  165. }
  166. public WaferRobotXAction Robot4XAction
  167. {
  168. get { return m_Robot4XAction; }
  169. set { SetProperty(ref m_Robot4XAction, value); }
  170. }
  171. public RobotMoveInfo RobotMoveInfo
  172. {
  173. get { return m_robotMoveInfo; }
  174. set
  175. {
  176. RobotMoveInfoChanged(m_robotMoveInfo, value);
  177. //m_robotMoveInfo = value;
  178. SetProperty(ref m_robotMoveInfo, value);
  179. }
  180. }
  181. public WaferInfo LLAWafer
  182. {
  183. get { return m_LLAWafer; }
  184. set { SetProperty(ref m_LLAWafer, value); }
  185. }
  186. public WaferInfo LLBWafer
  187. {
  188. get { return m_LLBWafer; }
  189. set { SetProperty(ref m_LLBWafer, value); }
  190. }
  191. public WaferInfo PMAWafer
  192. {
  193. get { return m_PMAWafer; }
  194. set { SetProperty(ref m_PMAWafer, value); }
  195. }
  196. public WaferInfo PMBWafer
  197. {
  198. get { return m_PMBWafer; }
  199. set { SetProperty(ref m_PMBWafer, value); }
  200. }
  201. public WaferInfo PMCWafer
  202. {
  203. get { return m_PMCWafer; }
  204. set { SetProperty(ref m_PMCWafer, value); }
  205. }
  206. public WaferInfo PMDWafer
  207. {
  208. get { return m_PMDWafer; }
  209. set { SetProperty(ref m_PMDWafer, value); }
  210. }
  211. public WaferInfo TMBladeAWafer
  212. {
  213. get { return m_TMBladeAWafer; }
  214. set { SetProperty(ref m_TMBladeAWafer, value); }
  215. }
  216. public WaferInfo TMBladeBWafer
  217. {
  218. get { return m_TMBladeBWafer; }
  219. set { SetProperty(ref m_TMBladeBWafer, value); }
  220. }
  221. public Dictionary<string, object> RtDataValues
  222. {
  223. get { return m_RtDataValues; }
  224. set { SetProperty(ref m_RtDataValues, value); }
  225. }
  226. public bool PMAIsInstalled
  227. {
  228. get { return m_PMAIsInstalled; }
  229. set { SetProperty(ref m_PMAIsInstalled, value); }
  230. }
  231. public bool PMBIsInstalled
  232. {
  233. get { return m_PMBIsInstalled; }
  234. set { SetProperty(ref m_PMBIsInstalled, value); }
  235. }
  236. public bool PMCIsInstalled
  237. {
  238. get { return m_PMCIsInstalled; }
  239. set { SetProperty(ref m_PMCIsInstalled, value); }
  240. }
  241. public bool PMDIsInstalled
  242. {
  243. get { return m_PMDIsInstalled; }
  244. set { SetProperty(ref m_PMDIsInstalled, value); }
  245. }
  246. public bool LLAIsInstalled
  247. {
  248. get { return m_LLAIsInstalled; }
  249. set { SetProperty(ref m_LLAIsInstalled, value); }
  250. }
  251. public bool LLBIsInstalled
  252. {
  253. get { return m_LLBIsInstalled; }
  254. set { SetProperty(ref m_LLBIsInstalled, value); }
  255. }
  256. public bool TMIsInstalled
  257. {
  258. get { return m_TMIsInstalled; }
  259. set { SetProperty(ref m_TMIsInstalled, value); }
  260. }
  261. public bool EFEMIsInstalled
  262. {
  263. get { return m_EFEMIsInstalled; }
  264. set { SetProperty(ref m_EFEMIsInstalled, value); }
  265. }
  266. public WaferInfo EFEMBladeAWafer
  267. {
  268. get { return m_EFEMBladeAWafer; }
  269. set { SetProperty(ref m_EFEMBladeAWafer, value); }
  270. }
  271. public WaferInfo EFEMBladeBWafer
  272. {
  273. get { return m_EFEMBladeBWafer; }
  274. set { SetProperty(ref m_EFEMBladeBWafer, value); }
  275. }
  276. public WaferInfo Aligner1Wafer
  277. {
  278. get { return m_Aligner1Wafer; }
  279. set { SetProperty(ref m_Aligner1Wafer, value); }
  280. }
  281. public int LP1WaferCount
  282. {
  283. get { return m_LP1WaferCount; }
  284. set { SetProperty(ref m_LP1WaferCount, value); }
  285. }
  286. public int LP2WaferCount
  287. {
  288. get { return m_LP2WaferCount; }
  289. set { SetProperty(ref m_LP2WaferCount, value); }
  290. }
  291. public int LP3WaferCount
  292. {
  293. get { return m_LP3WaferCount; }
  294. set { SetProperty(ref m_LP3WaferCount, value); }
  295. }
  296. public WaferAssociationInfo LP1WaferAssociation
  297. {
  298. get { return _lp1WaferAssociation; }
  299. set { SetProperty(ref _lp1WaferAssociation, value); }
  300. }
  301. public WaferAssociationInfo LP2WaferAssociation
  302. {
  303. get { return _lp2WaferAssociation; }
  304. set { SetProperty(ref _lp2WaferAssociation, value); }
  305. }
  306. public WaferAssociationInfo LP3WaferAssociation
  307. {
  308. get { return _lp3WaferAssociation; }
  309. set { SetProperty(ref _lp3WaferAssociation, value); }
  310. }
  311. public int CycledWafer
  312. {
  313. get { return m_CycledWafer; }
  314. set { SetProperty(ref m_CycledWafer, value); }
  315. }
  316. public int CycleCountDisplay
  317. {
  318. get { return m_CycleCountDisplay; }
  319. set { SetProperty(ref m_CycleCountDisplay, value); }
  320. }
  321. public RobotMoveInfo m_EfemRobotMoveInfo;
  322. public RobotMoveInfo EfemRobotMoveInfo
  323. {
  324. get { return m_EfemRobotMoveInfo; }
  325. set
  326. {
  327. EFEMRobotMoveInfoChanged(m_EfemRobotMoveInfo, value);
  328. //m_EfemRobotMoveInfo = value;
  329. SetProperty(ref m_EfemRobotMoveInfo, value);
  330. }
  331. }
  332. public RobotPosition CurrentRobotPosition
  333. {
  334. get { return m_CurrentRobotPosition; }
  335. set { SetProperty(ref m_CurrentRobotPosition, value); }
  336. }
  337. public WaferInfo BladeAWafer
  338. {
  339. get { return m_BladeAWafer; }
  340. set { SetProperty(ref m_BladeAWafer, value); }
  341. }
  342. public WaferInfo BladeBWafer
  343. {
  344. get { return m_BladeBWafer; }
  345. set { SetProperty(ref m_BladeBWafer, value); }
  346. }
  347. public RecipeResult PMARecipeResult
  348. {
  349. get { return m_PMARecipeResult; }
  350. set { SetProperty(ref m_PMARecipeResult, value); }
  351. }
  352. public RecipeResult PMBRecipeResult
  353. {
  354. get { return m_PMBRecipeResult; }
  355. set { SetProperty(ref m_PMBRecipeResult, value); }
  356. }
  357. public RecipeResult PMCRecipeResult
  358. {
  359. get { return m_PMCRecipeResult; }
  360. set { SetProperty(ref m_PMCRecipeResult, value); }
  361. }
  362. public RecipeResult PMDRecipeResult
  363. {
  364. get { return m_PMDRecipeResult; }
  365. set { SetProperty(ref m_PMDRecipeResult, value); }
  366. }
  367. public string ATMModeIsOn
  368. {
  369. get { return m_ATMModeIsOn; }
  370. set { SetProperty(ref m_ATMModeIsOn, value); }
  371. }
  372. public float TMPressure
  373. {
  374. get { return m_TMPressure; }
  375. set { SetProperty(ref m_TMPressure, value); }
  376. }
  377. public string RouteState
  378. {
  379. get { return m_RouteState; }
  380. set { SetProperty(ref m_RouteState, value); }
  381. }
  382. #endregion
  383. #region 命令
  384. private DelegateCommand _LoadCommand;
  385. public DelegateCommand LoadCommand =>
  386. _LoadCommand ?? (_LoadCommand = new DelegateCommand(OnLoad));
  387. private DelegateCommand<object> _LoadWaferCommand;
  388. public DelegateCommand<object> LoadWaferCommand =>
  389. _LoadWaferCommand ?? (_LoadWaferCommand = new DelegateCommand<object>(OnLoadWafer));
  390. private DelegateCommand<object> _UnLoadWaferCommand;
  391. public DelegateCommand<object> UnLoadWaferCommand =>
  392. _UnLoadWaferCommand ?? (_UnLoadWaferCommand = new DelegateCommand<object>(OnUnLoadWafer));
  393. private DelegateCommand<object> _SelectAllCommand;
  394. public DelegateCommand<object> SelectAllCommand =>
  395. _SelectAllCommand ?? (_SelectAllCommand = new DelegateCommand<object>(OnSelectAll));
  396. private DelegateCommand<object> _UnSelectAllCommand;
  397. public DelegateCommand<object> UnSelectAllCommand =>
  398. _UnSelectAllCommand ?? (_UnSelectAllCommand = new DelegateCommand<object>(OnUnSelectAll));
  399. private DelegateCommand<object> _StartCommand;
  400. public DelegateCommand<object> StartCommand =>
  401. _StartCommand ?? (_StartCommand = new DelegateCommand<object>(OnStart));
  402. private DelegateCommand<object> _StopCommand;
  403. public DelegateCommand<object> StopCommand =>
  404. _StopCommand ?? (_StopCommand = new DelegateCommand<object>(OnStop));
  405. private DelegateCommand<object> _AbortCommand;
  406. public DelegateCommand<object> AbortCommand =>
  407. _AbortCommand ?? (_AbortCommand = new DelegateCommand<object>(OnAbort));
  408. private DelegateCommand _HomeAllCommand;
  409. public DelegateCommand HomeAllCommand =>
  410. _HomeAllCommand ?? (_HomeAllCommand = new DelegateCommand(OnHomeAll));
  411. private DelegateCommand _ResumeAllJobCommand;
  412. public DelegateCommand ResumeAllJobCommand =>
  413. _ResumeAllJobCommand ?? (_ResumeAllJobCommand = new DelegateCommand(OnResumeAllJob));
  414. private DelegateCommand _AbortAllCommand;
  415. public DelegateCommand AbortAllCommand =>
  416. _AbortAllCommand ?? (_AbortAllCommand = new DelegateCommand(OnAbortAll));
  417. private DelegateCommand _ReturnAllWaferCommand;
  418. public DelegateCommand ReturnAllWaferCommand =>
  419. _ReturnAllWaferCommand ?? (_ReturnAllWaferCommand = new DelegateCommand(OnReturnAllWafer));
  420. private DelegateCommand<object> _SetSequenceCommand;
  421. public DelegateCommand<object> SetSequenceCommand =>
  422. _SetSequenceCommand ?? (_SetSequenceCommand = new DelegateCommand<object>(OnSetSequence));
  423. private DelegateCommand<object> _CreateJobCommand;
  424. public DelegateCommand<object> CreateJobCommand =>
  425. _CreateJobCommand ?? (_CreateJobCommand = new DelegateCommand<object>(OnCreateJob));
  426. private DelegateCommand<object> _AbortJobCommand;
  427. public DelegateCommand<object> AbortJobCommand =>
  428. _AbortJobCommand ?? (_AbortJobCommand = new DelegateCommand<object>(OnAbortJob));
  429. private DelegateCommand _EnableAutoCommand;
  430. public DelegateCommand EnableAutoCommand =>
  431. _EnableAutoCommand ?? (_EnableAutoCommand = new DelegateCommand(OnEnableAuto));
  432. private DelegateCommand _EnableManualCommand;
  433. public DelegateCommand EnableManualCommand =>
  434. _EnableManualCommand ?? (_EnableManualCommand = new DelegateCommand(OnEnableManual));
  435. public bool SwitchFlag;
  436. #endregion
  437. #region 构造函数
  438. public OperationOverViewModel()
  439. {
  440. DispatcherTimer timer = new DispatcherTimer();
  441. timer.Interval = TimeSpan.FromSeconds(0.1);
  442. timer.Tick += Timer_Tick;
  443. timer.Start();
  444. string allModules = QueryDataClient.Instance.Service.GetConfig($"System.InstalledModules").ToString();
  445. PMAIsInstalled = allModules.Contains("PMA");
  446. PMBIsInstalled = allModules.Contains("PMB");
  447. PMCIsInstalled = allModules.Contains("PMC");
  448. PMDIsInstalled = allModules.Contains("PMD");
  449. LLAIsInstalled = allModules.Contains("LLA");
  450. LLBIsInstalled = allModules.Contains("LLB");
  451. EFEMIsInstalled = allModules.Contains("EFEM");
  452. TMIsInstalled = allModules.Contains("TM");
  453. addDataKeys();
  454. SwitchFlag = false;
  455. ATMModeIsOn = Convert.ToBoolean(QueryDataClient.Instance.Service.GetConfig("System.IsATMMode")) == true ? "ATM Mode On" : "ATM Mode Off";
  456. LOG.Info("开启UI界面");
  457. }
  458. #endregion
  459. #region 命令方法
  460. private void OnLoad()
  461. {
  462. if (!SwitchFlag)
  463. {
  464. LP1WaferAssociation = new WaferAssociationInfo();
  465. LP3WaferAssociation = new WaferAssociationInfo();
  466. LP2WaferAssociation = new WaferAssociationInfo();
  467. LP1WaferAssociation.ModuleData = ModuleManager.ModuleInfos["LP1"];
  468. LP2WaferAssociation.ModuleData = ModuleManager.ModuleInfos["LP2"];
  469. LP3WaferAssociation.ModuleData = ModuleManager.ModuleInfos["LP3"];
  470. SwitchFlag = true;
  471. object obj = QueryDataClient.Instance.Service.GetData("System.PressureUnitType");
  472. PressureType = (PressureType)Convert.ToInt32(obj);
  473. }
  474. }
  475. private void OnLoadWafer(object obj)
  476. {
  477. InvokeClient.Instance.Service.DoOperation($"{obj.ToString()}.Load", ModuleManager.ModuleInfos[obj.ToString()].ModuleID);
  478. }
  479. private void OnUnLoadWafer(object obj)
  480. {
  481. InvokeClient.Instance.Service.DoOperation($"{obj.ToString()}.Unload", ModuleManager.ModuleInfos[obj.ToString()].ModuleID);
  482. }
  483. private void OnSelectAll(object obj)
  484. {
  485. var info = obj as WaferAssociationInfo;
  486. info.SlotFrom = 1;
  487. info.SlotTo = 25;
  488. AssociateSequence(info, true);
  489. }
  490. private void OnUnSelectAll(object obj)
  491. {
  492. var info = obj as WaferAssociationInfo;
  493. info.SlotFrom = 1;
  494. info.SlotTo = 25;
  495. AssociateSequence(info, false);
  496. }
  497. private void OnStart(object obj)
  498. {
  499. var info = obj as WaferAssociationInfo;
  500. InvokeClient.Instance.Service.DoOperation("System.StartJob", info.LotId);
  501. LOG.Info("System,Start Job");
  502. }
  503. private void OnStop(object obj)
  504. {
  505. var info = obj as WaferAssociationInfo;
  506. InvokeClient.Instance.Service.DoOperation("System.PauseJob", info.JobID);
  507. LOG.Info("System,Pause Job");
  508. }
  509. private void OnAbort(object obj)
  510. {
  511. var info = obj as WaferAssociationInfo;
  512. InvokeClient.Instance.Service.DoOperation("System.ResumeJob", info.JobID);
  513. LOG.Info("System,Resume Job");
  514. }
  515. private void OnHomeAll()
  516. {
  517. InvokeClient.Instance.Service.DoOperation("System.HomeAll");
  518. LOG.Info("System,Home All");
  519. }
  520. private void OnResumeAllJob()
  521. {
  522. var t = CommonFunction.GetValue<List<string>>(RtDataValues, "Scheduler.PjNameList");
  523. if (t == null && t.Count == 0)
  524. {
  525. return;
  526. }
  527. if (CommonFunction.GetValue<int>(RtDataValues, "EquipmentStatus") == 4)
  528. {
  529. t.ForEach(x =>
  530. {
  531. InvokeClient.Instance.Service.DoOperation("System.ResumeJob", x);
  532. });
  533. }
  534. else
  535. {
  536. t.ForEach(x =>
  537. {
  538. InvokeClient.Instance.Service.DoOperation("System.PauseJob", x);
  539. });
  540. }
  541. LOG.Info("System,Resume All Job");
  542. }
  543. private void OnAbortAll()
  544. {
  545. InvokeClient.Instance.Service.DoOperation("System.Abort");
  546. LOG.Info("System, Abort");
  547. }
  548. private void OnReturnAllWafer()
  549. {
  550. //Dialog
  551. WaferDialogView dialog = new WaferDialogView()
  552. {
  553. Owner = Application.Current.MainWindow,
  554. };
  555. dialog.Height = 300;
  556. dialog.Width = 400;
  557. double angel = 0;
  558. double coolingtime = 0;
  559. string message = "Please Confirm Return Wafer";
  560. WaferDialogViewModel vm = new WaferDialogViewModel();
  561. vm.ConfirmText = message;
  562. dialog.DataContext = vm;
  563. if (dialog.ShowDialog() == true)
  564. {
  565. if ((bool)dialog.AlignFlag == true && !string.IsNullOrEmpty(dialog.Angle))
  566. {
  567. angel = Convert.ToDouble(dialog.Angle);
  568. }
  569. if ((bool)dialog.CoolingFlag == true && !string.IsNullOrEmpty(dialog.CoolingTime))
  570. {
  571. coolingtime = Convert.ToDouble(dialog.CoolingTime);
  572. }
  573. InvokeClient.Instance.Service.DoOperation("System.ReturnAllWafer", dialog.CoolingFlag, coolingtime, dialog.AlignFlag, angel);
  574. }
  575. LOG.Info("System,Return All Wafer");
  576. }
  577. private void OnSetSequence(object obj)
  578. {
  579. var info = obj as WaferInfo;
  580. bool flag = info.SequenceName != "" ? false : true;
  581. if (info.ModuleID == "LP1")
  582. {
  583. AssociateSequence(LP1WaferAssociation, flag, info.SlotID);
  584. }
  585. else if (info.ModuleID == "LP2")
  586. {
  587. AssociateSequence(LP2WaferAssociation, flag, info.SlotID);
  588. }
  589. else if (info.ModuleID == "LP3")
  590. {
  591. AssociateSequence(LP3WaferAssociation, flag, info.SlotID);
  592. }
  593. }
  594. private void OnCreateJob(object obj)
  595. {
  596. var info = obj as WaferAssociationInfo;
  597. List<string> slotSequence = new List<string>();
  598. info.ModuleData.WaferManager.Wafers.ForEach(key => { slotSequence.Insert(0, key.SequenceName); });
  599. //string jobId = info.LotId.Trim();
  600. //if (string.IsNullOrEmpty(jobId))
  601. // jobId = "CJ_Local_" + info.ModuleData.ModuleID;
  602. //info.LotId = jobId;
  603. //info.JobID = jobId;
  604. //info.JobStatus = "WaitingForStart";
  605. info.LotIdSaved = true;
  606. Dictionary<string, object> param = new Dictionary<string, object>()
  607. {
  608. {"JobId", ""},
  609. {"Module", info.ModuleData.ModuleID},
  610. {"SlotSequence", slotSequence.ToArray()},
  611. {"AutoStart", true},
  612. { "PreCleanRecipeName",info.PreCleanRecipeName},
  613. { "PostCleanRecipeName",info.PostCleanRecipeName}
  614. };
  615. InvokeClient.Instance.Service.DoOperation("System.CreateJob", param);
  616. }
  617. private void OnAbortJob(object obj)
  618. {
  619. InvokeClient.Instance.Service.DoOperation("System.AbortJob", obj.ToString());
  620. }
  621. private void OnEnableAuto()
  622. {
  623. InvokeClient.Instance.Service.DoOperation("System.SetAutoMode");
  624. }
  625. private void OnEnableManual()
  626. {
  627. InvokeClient.Instance.Service.DoOperation("System.SetManualMode");
  628. }
  629. #endregion
  630. #region 私有方法
  631. private void Timer_Tick(object sender, EventArgs e)
  632. {
  633. LP1ModuleInfo = ModuleManager.ModuleInfos["LP1"];
  634. LP2ModuleInfo = ModuleManager.ModuleInfos["LP2"];
  635. LP3ModuleInfo = ModuleManager.ModuleInfos["LP3"];
  636. EFEMModuleInfo = ModuleManager.ModuleInfos["EfemRobot"];
  637. TMModuleInfo = ModuleManager.ModuleInfos["TMRobot"];
  638. BladeAWafer = ModuleManager.ModuleInfos["EfemRobot"].WaferManager.Wafers[0];
  639. BladeBWafer = ModuleManager.ModuleInfos["EfemRobot"].WaferManager.Wafers[1];
  640. RtDataValues = QueryDataClient.Instance.Service.PollData(m_RtDataKeys);
  641. if (LLAIsInstalled == true)
  642. {
  643. LLAModuleInfo = ModuleManager.ModuleInfos["LLA"];
  644. LLAWafer = ModuleManager.ModuleInfos["LLA"].WaferManager.Wafers.FirstOrDefault(x => x.WaferStatus != 0);
  645. }
  646. if (LLBIsInstalled == true)
  647. {
  648. LLBModuleInfo = ModuleManager.ModuleInfos["LLB"];
  649. LLBWafer = ModuleManager.ModuleInfos["LLB"].WaferManager.Wafers.FirstOrDefault(x => x.WaferStatus != 0);
  650. }
  651. if (PMAIsInstalled == true)
  652. {
  653. PMAWafer = ModuleManager.ModuleInfos["PMA"].WaferManager.Wafers[0];
  654. PMARecipeResult = CommonFunction.GetValue<RecipeResult>(RtDataValues, $"PMA.CurrentRecipeResult");
  655. }
  656. if (PMBIsInstalled == true)
  657. {
  658. PMBWafer = ModuleManager.ModuleInfos["PMB"].WaferManager.Wafers[0];
  659. PMBRecipeResult = CommonFunction.GetValue<RecipeResult>(RtDataValues, $"PMB.CurrentRecipeResult");
  660. }
  661. if (PMCIsInstalled == true)
  662. {
  663. PMCWafer = ModuleManager.ModuleInfos["PMC"].WaferManager.Wafers[0];
  664. PMCRecipeResult = CommonFunction.GetValue<RecipeResult>(RtDataValues, $"PMC.CurrentRecipeResult");
  665. }
  666. if (PMDIsInstalled == true)
  667. {
  668. PMDWafer = ModuleManager.ModuleInfos["PMD"].WaferManager.Wafers[0];
  669. PMDRecipeResult = CommonFunction.GetValue<RecipeResult>(RtDataValues, $"PMD.CurrentRecipeResult");
  670. }
  671. if (TMIsInstalled == true)
  672. {
  673. TMBladeAWafer = ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[0];
  674. TMBladeBWafer = ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[1];
  675. TMPressure= CommonFunction.GetValue<float>(RtDataValues, $"TM.TMProcessGauge.Value");
  676. }
  677. if (EFEMIsInstalled == true)
  678. {
  679. EFEMBladeAWafer = ModuleManager.ModuleInfos["EfemRobot"].WaferManager.Wafers[0];
  680. EFEMBladeBWafer = ModuleManager.ModuleInfos["EfemRobot"].WaferManager.Wafers[1];
  681. Aligner1Wafer = ModuleManager.ModuleInfos["Aligner1"].WaferManager.Wafers[0];
  682. ControlJobInfo lp1Cj = CommonFunction.GetValue<ControlJobInfo>(RtDataValues, "LP1.CurrentControlJob");
  683. if(lp1Cj!=null)
  684. {
  685. UPdateWaferAssociation(LP1WaferAssociation, lp1Cj);
  686. }
  687. ControlJobInfo lp2Cj = CommonFunction.GetValue<ControlJobInfo>(RtDataValues, "LP2.CurrentControlJob");
  688. if (lp2Cj != null)
  689. {
  690. UPdateWaferAssociation(LP2WaferAssociation, lp2Cj);
  691. }
  692. ControlJobInfo lp3Cj = CommonFunction.GetValue<ControlJobInfo>(RtDataValues, "LP3.CurrentControlJob");
  693. if (lp3Cj != null)
  694. {
  695. UPdateWaferAssociation(LP2WaferAssociation, lp3Cj);
  696. }
  697. }
  698. RobotMoveInfo = (RobotMoveInfo)QueryDataClient.Instance.Service.GetData("TM.RobotMoveAction");
  699. EfemRobotMoveInfo = (RobotMoveInfo)QueryDataClient.Instance.Service.GetData("EFEM.RobotMoveAction");
  700. LP1WaferCount = LP1ModuleInfo.WaferManager.Wafers.Where(x => x.WaferStatus != 0).Count();
  701. LP2WaferCount = LP2ModuleInfo.WaferManager.Wafers.Where(x => x.WaferStatus != 0).Count();
  702. LP3WaferCount = LP3ModuleInfo.WaferManager.Wafers.Where(x => x.WaferStatus != 0).Count();
  703. if (CommonFunction.GetValue<int>(RtDataValues, "EquipmentStatus") == 4)
  704. {
  705. RouteState = "Resume";
  706. }
  707. else
  708. {
  709. RouteState = "Pause";
  710. }
  711. }
  712. /// <summary>
  713. /// 更新Wafer情况
  714. /// </summary>
  715. /// <param name="info"></param>
  716. /// <param name="cjInfo"></param>
  717. private void UPdateWaferAssociation(WaferAssociationInfo info,ControlJobInfo cjInfo)
  718. {
  719. info.LotId = cjInfo.Name;
  720. info.JobID = cjInfo.Name;
  721. info.JobStatus = cjInfo.State.ToString() ;
  722. if (cjInfo.LotWafers != null)
  723. {
  724. for (int i=0;i< cjInfo.LotWafers.Count;i++)
  725. {
  726. int index = cjInfo.LotWafers[i].Slot;
  727. info.ModuleData.WaferManager.Wafers[index].SequenceName = cjInfo.LotWafers[i].SequenceName;
  728. }
  729. }
  730. info.PreCleanRecipeName = cjInfo.PreJobClean;
  731. info.PostCleanRecipeName = cjInfo.PostJobClean;
  732. }
  733. private async void RobotMoveInfoChanged(RobotMoveInfo oldValue, RobotMoveInfo newValue)
  734. {
  735. string RobotTarget;
  736. if (oldValue == null || newValue == null)
  737. {
  738. return;
  739. }
  740. #region Rotating
  741. if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && (newValue.Action == RobotAction.Rotating))
  742. {
  743. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  744. if (TMRobotMoveActionBladeTarget != null)
  745. {
  746. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  747. }
  748. else
  749. {
  750. return;
  751. }
  752. var values = RobotTarget.Split('.');
  753. var arm = values[0];
  754. var module = values[1];
  755. if (arm == "ArmA")
  756. {
  757. Robot1TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  758. }
  759. else if (arm == "ArmB")
  760. {
  761. Robot2TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  762. }
  763. }
  764. #endregion
  765. #region pick 和 place LL
  766. else if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && (newValue.Action == RobotAction.Placing || newValue.Action == RobotAction.Picking))
  767. {
  768. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  769. if (TMRobotMoveActionBladeTarget != null)
  770. {
  771. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  772. }
  773. else
  774. {
  775. return;
  776. }
  777. var values = RobotTarget.Split('.');
  778. var arm = values[0];
  779. var module = values[1];
  780. if (arm == "ArmA")
  781. {
  782. var waferRobotTAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  783. if (waferRobotTAction != Robot1TAction)
  784. {
  785. Robot1TAction = waferRobotTAction;
  786. }
  787. else
  788. {
  789. //await Task.Delay(100);
  790. }
  791. await Task.Delay(600);
  792. //Robot1TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  793. //await Task.Delay(600);
  794. Robot1XAction = WaferRobotXAction.Extend;
  795. 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))
  796. {
  797. await Task.Delay(100);
  798. }
  799. Robot1XAction = WaferRobotXAction.Retract;
  800. }
  801. else if (arm == "ArmB")
  802. {
  803. var waferRobotTAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  804. if (waferRobotTAction != Robot2TAction)
  805. {
  806. Robot2TAction = waferRobotTAction;
  807. }
  808. else
  809. {
  810. //await Task.Delay(100);
  811. }
  812. await Task.Delay(600);
  813. //Robot2TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  814. //await Task.Delay(600);
  815. Robot2XAction = WaferRobotXAction.Extend;
  816. 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))
  817. {
  818. await Task.Delay(100);
  819. }
  820. Robot2XAction = WaferRobotXAction.Retract;
  821. }
  822. }
  823. #endregion
  824. #region pick 和 place pm
  825. else if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && newValue.Action == RobotAction.Extending)
  826. {
  827. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  828. if (TMRobotMoveActionBladeTarget != null)
  829. {
  830. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  831. }
  832. else
  833. {
  834. return;
  835. }
  836. var values = RobotTarget.Split('.');
  837. var arm = values[0];
  838. var module = values[1];
  839. if (arm == "ArmA")
  840. {
  841. var waferRobotTAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  842. if (waferRobotTAction != Robot1TAction)
  843. {
  844. Robot1TAction = waferRobotTAction;
  845. }
  846. else
  847. {
  848. // await Task.Delay(100);
  849. }
  850. await Task.Delay(600);
  851. Robot1XAction = WaferRobotXAction.Extend;
  852. }
  853. else if (arm == "ArmB")
  854. {
  855. var waferRobotTAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  856. if (waferRobotTAction != Robot2TAction)
  857. {
  858. Robot2TAction = waferRobotTAction;
  859. }
  860. else
  861. {
  862. // await Task.Delay(100);
  863. }
  864. await Task.Delay(600);
  865. Robot2XAction = WaferRobotXAction.Extend;
  866. }
  867. }
  868. else if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && newValue.Action == RobotAction.Retracting)
  869. {
  870. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  871. if (TMRobotMoveActionBladeTarget != null)
  872. {
  873. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  874. }
  875. else
  876. {
  877. return;
  878. }
  879. var values = RobotTarget.Split('.');
  880. var arm = values[0];
  881. if (arm == "ArmA")
  882. {
  883. Robot1XAction = WaferRobotXAction.Retract;
  884. }
  885. else if (arm == "ArmB")
  886. {
  887. Robot2XAction = WaferRobotXAction.Retract;
  888. }
  889. }
  890. #endregion
  891. #region Home
  892. else if (oldValue.Action == RobotAction.None && newValue.Action == RobotAction.Homing)
  893. {
  894. if (Robot1XAction == WaferRobotXAction.Extend)
  895. {
  896. Robot1XAction = WaferRobotXAction.Retract;
  897. }
  898. if (Robot2XAction == WaferRobotXAction.Extend)
  899. {
  900. Robot2XAction = WaferRobotXAction.Retract;
  901. }
  902. await Task.Delay(2000);
  903. if (Robot1TAction != WaferRobotTAction.T_Origin)
  904. {
  905. Robot1TAction = WaferRobotTAction.T_Origin;
  906. }
  907. if (Robot2TAction != WaferRobotTAction.T_Origin)
  908. {
  909. Robot2TAction = WaferRobotTAction.T_Origin;
  910. }
  911. }
  912. #endregion
  913. }
  914. private async void EFEMRobotMoveInfoChanged(RobotMoveInfo oldValue, RobotMoveInfo newValue)
  915. {
  916. string RobotTarget;
  917. if (oldValue == null || newValue == null)
  918. {
  919. return;
  920. }
  921. #region pick 和 place LL
  922. if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && (newValue.Action == RobotAction.Placing || newValue.Action == RobotAction.Picking))
  923. {
  924. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  925. if (TMRobotMoveActionBladeTarget != null)
  926. {
  927. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  928. }
  929. else
  930. {
  931. return;
  932. }
  933. var values = RobotTarget.Split('.');
  934. var arm = values[0];
  935. var module = values[1];
  936. if (arm == "ArmA")
  937. {
  938. var robot3Robot3TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  939. //await Task.Delay(1000);
  940. await ChangePosition(robot3Robot3TAction);
  941. if (Robot3TAction != robot3Robot3TAction)
  942. {
  943. Robot3TAction = robot3Robot3TAction;
  944. await Task.Delay(600);
  945. }
  946. Robot3XAction = WaferRobotXAction.Extend;
  947. 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))
  948. {
  949. await Task.Delay(100);
  950. }
  951. Robot3XAction = WaferRobotXAction.Retract;
  952. }
  953. else if (arm == "ArmB")
  954. {
  955. var robot4Robot4TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  956. //await Task.Delay(1000);
  957. await ChangePosition(robot4Robot4TAction);
  958. if (Robot4TAction != robot4Robot4TAction)
  959. {
  960. Robot4TAction = robot4Robot4TAction;
  961. await Task.Delay(600);
  962. }
  963. //ChangePosition(Robot4TAction);
  964. //await Task.Delay(2000);
  965. Robot4XAction = WaferRobotXAction.Extend;
  966. 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))
  967. {
  968. await Task.Delay(100);
  969. }
  970. Robot4XAction = WaferRobotXAction.Retract;
  971. }
  972. }
  973. #endregion
  974. #region pick 和 place pm
  975. if (oldValue.Action == RobotAction.None && newValue.Action == RobotAction.Extending)
  976. {
  977. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  978. if (TMRobotMoveActionBladeTarget != null)
  979. {
  980. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  981. }
  982. else
  983. {
  984. return;
  985. }
  986. var values = RobotTarget.Split('.');
  987. var arm = values[0];
  988. var module = values[1];
  989. if (arm == "ArmA")
  990. {
  991. Robot3TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  992. await Task.Delay(1500);
  993. //ChangePosition(Robot3TAction);
  994. //await Task.Delay(2000);
  995. Robot3XAction = WaferRobotXAction.Extend;
  996. }
  997. else if (arm == "ArmB")
  998. {
  999. Robot4TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  1000. await Task.Delay(1500);
  1001. //ChangePosition(Robot4TAction);
  1002. //await Task.Delay(2000);
  1003. Robot4XAction = WaferRobotXAction.Extend;
  1004. }
  1005. }
  1006. if (oldValue.Action == RobotAction.None && newValue.Action == RobotAction.Retracting)
  1007. {
  1008. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  1009. if (TMRobotMoveActionBladeTarget != null)
  1010. {
  1011. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  1012. }
  1013. else
  1014. {
  1015. return;
  1016. }
  1017. var values = RobotTarget.Split('.');
  1018. var arm = values[0];
  1019. if (arm == "ArmA")
  1020. {
  1021. Robot3XAction = WaferRobotXAction.Retract;
  1022. await Task.Delay(3000);
  1023. //ChangePosition(Robot3TAction);
  1024. //await Task.Delay(2000);
  1025. }
  1026. else if (arm == "ArmB")
  1027. {
  1028. Robot4XAction = WaferRobotXAction.Retract;
  1029. await Task.Delay(3000);
  1030. //ChangePosition(Robot3TAction);
  1031. //await Task.Delay(2000);
  1032. }
  1033. }
  1034. #endregion
  1035. #region Home
  1036. else if (oldValue.Action == RobotAction.None && newValue.Action == RobotAction.Homing)
  1037. {
  1038. if (Robot3XAction == WaferRobotXAction.Extend)
  1039. {
  1040. Robot3XAction = WaferRobotXAction.Retract;
  1041. }
  1042. if (Robot4XAction == WaferRobotXAction.Extend)
  1043. {
  1044. Robot4XAction = WaferRobotXAction.Retract;
  1045. }
  1046. if (Robot3TAction != WaferRobotTAction.T_Origin)
  1047. {
  1048. Robot3TAction = WaferRobotTAction.T_Origin;
  1049. }
  1050. if (Robot4TAction != WaferRobotTAction.T_Origin)
  1051. {
  1052. Robot4TAction = WaferRobotTAction.T_Origin;
  1053. }
  1054. await Task.Delay(1000);
  1055. await ChangePosition(WaferRobotTAction.T_Origin);
  1056. }
  1057. #endregion
  1058. }
  1059. private void addDataKeys()
  1060. {
  1061. if (PMAIsInstalled == true)
  1062. {
  1063. m_RtDataKeys.Add("PMA.IsSlitDoorClosed");
  1064. m_RtDataKeys.Add("PMA.CurrentRecipeResult");
  1065. m_RtDataKeys.Add("PMA.IsOnline");
  1066. m_RtDataKeys.Add("PMA.CalculationPressure");
  1067. }
  1068. if (PMBIsInstalled == true)
  1069. {
  1070. m_RtDataKeys.Add("PMB.IsSlitDoorClosed");
  1071. m_RtDataKeys.Add("PMB.CurrentRecipeResult");
  1072. m_RtDataKeys.Add("PMB.IsOnline");
  1073. m_RtDataKeys.Add("PMB.CalculationPressure");
  1074. }
  1075. if (PMCIsInstalled == true)
  1076. {
  1077. m_RtDataKeys.Add("PMC.IsSlitDoorClosed");
  1078. m_RtDataKeys.Add("PMC.CurrentRecipeResult");
  1079. m_RtDataKeys.Add("PMC.IsOnline");
  1080. m_RtDataKeys.Add("PMC.CalculationPressure");
  1081. }
  1082. if (PMDIsInstalled == true)
  1083. {
  1084. m_RtDataKeys.Add("PMD.IsSlitDoorClosed");
  1085. m_RtDataKeys.Add("PMD.CurrentRecipeResult");
  1086. m_RtDataKeys.Add("PMD.IsOnline");
  1087. m_RtDataKeys.Add("PMD.CalculationPressure");
  1088. }
  1089. if (TMIsInstalled == true)
  1090. {
  1091. m_RtDataKeys.Add("TM.LLATSlitDoor.IsClosed");
  1092. m_RtDataKeys.Add("TM.LLBTSlitDoor.IsClosed");
  1093. m_RtDataKeys.Add("TM.LLAESlitDoor.IsClosed");
  1094. m_RtDataKeys.Add("TM.LLBESlitDoor.IsClosed");
  1095. m_RtDataKeys.Add("TM.IsOnline");
  1096. m_RtDataKeys.Add("TM.TMProcessGauge.Value");
  1097. m_RtDataKeys.Add("TM.TMATMSwitch.Value");
  1098. m_RtDataKeys.Add("TM.TMVacSwitch.Value");
  1099. m_RtDataKeys.Add("TM.TMProcessGauge.Value");
  1100. m_RtDataKeys.Add("TM.TMLidClosed");
  1101. m_RtDataKeys.Add("TM.LLALidClosed");
  1102. m_RtDataKeys.Add("TM.LLBLidClosed");
  1103. m_RtDataKeys.Add("TM.PMASlitDoor.IsClosed");
  1104. m_RtDataKeys.Add("TM.PMBSlitDoor.IsClosed");
  1105. m_RtDataKeys.Add("TM.PMCSlitDoor.IsClosed");
  1106. m_RtDataKeys.Add("TM.PMDSlitDoor.IsClosed");
  1107. }
  1108. if (LLAIsInstalled == true)
  1109. {
  1110. m_RtDataKeys.Add("LLA.IsOnline");
  1111. m_RtDataKeys.Add($"TM.LLAPressureGauge.Value");
  1112. m_RtDataKeys.Add($"TM.LLAVacSwitch.Value");
  1113. m_RtDataKeys.Add($"TM.LLAATMSwitch.Value");
  1114. }
  1115. if (LLBIsInstalled == true)
  1116. {
  1117. m_RtDataKeys.Add("LLB.IsOnline");
  1118. m_RtDataKeys.Add($"TM.LLBPressureGauge.Value");
  1119. m_RtDataKeys.Add($"TM.LLBVacSwitch.Value");
  1120. m_RtDataKeys.Add($"TM.LLBATMSwitch.Value");
  1121. }
  1122. if (EFEMIsInstalled == true)
  1123. {
  1124. m_RtDataKeys.Add("LP1.IsLoaded");
  1125. m_RtDataKeys.Add("LP2.IsLoaded");
  1126. m_RtDataKeys.Add("LP3.IsLoaded");
  1127. m_RtDataKeys.Add("LP1.CassettePlaced");
  1128. m_RtDataKeys.Add("LP2.CassettePlaced");
  1129. m_RtDataKeys.Add("LP3.CassettePlaced");
  1130. m_RtDataKeys.Add("LP1.CurrentControlJob");
  1131. m_RtDataKeys.Add("LP2.CurrentControlJob");
  1132. m_RtDataKeys.Add("LP3.CurrentControlJob");
  1133. m_RtDataKeys.Add("EFEM.IsOnline");
  1134. }
  1135. m_RtDataKeys.Add("System.IsAutoMode");
  1136. m_RtDataKeys.Add("System.IsBusy");
  1137. m_RtDataKeys.Add("Scheduler.CycledCount");
  1138. m_RtDataKeys.Add("Scheduler.CycledWafer");
  1139. m_RtDataKeys.Add("Scheduler.CycleSetPoint");
  1140. m_RtDataKeys.Add("Scheduler.Throughput");
  1141. m_RtDataKeys.Add("EquipmentStatus");
  1142. m_RtDataKeys.Add("Scheduler.PjNameList");
  1143. }
  1144. private void AssociateSequence(WaferAssociationInfo info, bool flag, int slot = -1)
  1145. {
  1146. List<WaferInfo> wafers = info.ModuleData.WaferManager.Wafers;
  1147. if (slot >= 0) //by wafer
  1148. {
  1149. int index = wafers.Count - slot - 1;
  1150. if (index < wafers.Count)
  1151. {
  1152. if (flag && HasWaferOnSlot(wafers, index))
  1153. wafers[index].SequenceName = info.SequenceName;
  1154. else
  1155. wafers[index].SequenceName = string.Empty;
  1156. }
  1157. }
  1158. else //by from-to
  1159. {
  1160. for (int i = info.SlotFrom - 1; i < info.SlotTo; i++)
  1161. {
  1162. int index = wafers.Count - i - 1;
  1163. if (index < wafers.Count)
  1164. {
  1165. if (flag && HasWaferOnSlot(wafers, index))
  1166. wafers[index].SequenceName = info.SequenceName;
  1167. else
  1168. wafers[index].SequenceName = string.Empty;
  1169. }
  1170. }
  1171. }
  1172. switch (info.ModuleData.ModuleID)
  1173. {
  1174. case "LP1":
  1175. LP1WaferAssociation = info;
  1176. break;
  1177. case "LP2":
  1178. LP2WaferAssociation = info;
  1179. break;
  1180. case "LP3":
  1181. LP3WaferAssociation = info;
  1182. break;
  1183. }
  1184. }
  1185. private bool HasWaferOnSlot(List<WaferInfo> wafers, int index)
  1186. {
  1187. if (wafers[index].WaferStatus == 0)
  1188. return false;
  1189. return true;
  1190. }
  1191. private async Task ChangePosition(WaferRobotTAction waferRobotTAction)
  1192. {
  1193. await Task.Delay(500);
  1194. int delay = 500;
  1195. if (waferRobotTAction == WaferRobotTAction.LP1)
  1196. {
  1197. CurrentRobotPosition = RobotPosition.Left;
  1198. await Task.Delay(delay);
  1199. }
  1200. else if (waferRobotTAction == WaferRobotTAction.LP3)
  1201. {
  1202. CurrentRobotPosition = RobotPosition.Right;
  1203. await Task.Delay(delay);
  1204. }
  1205. else if (waferRobotTAction == WaferRobotTAction.LP2)
  1206. {
  1207. CurrentRobotPosition = RobotPosition.Middle;
  1208. await Task.Delay(delay);
  1209. }
  1210. else
  1211. {
  1212. CurrentRobotPosition = RobotPosition.Origin;
  1213. await Task.Delay(delay);
  1214. }
  1215. }
  1216. #endregion
  1217. }
  1218. }