OperationOverViewModel.cs 50 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321
  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. addDataKeys();
  443. RtDataValues = QueryDataClient.Instance.Service.PollData(m_RtDataKeys);
  444. timer.Tick += Timer_Tick;
  445. timer.Start();
  446. string allModules = QueryDataClient.Instance.Service.GetConfig($"System.InstalledModules").ToString();
  447. PMAIsInstalled = allModules.Contains("PMA");
  448. PMBIsInstalled = allModules.Contains("PMB");
  449. PMCIsInstalled = allModules.Contains("PMC");
  450. PMDIsInstalled = allModules.Contains("PMD");
  451. LLAIsInstalled = allModules.Contains("LLA");
  452. LLBIsInstalled = allModules.Contains("LLB");
  453. EFEMIsInstalled = allModules.Contains("EFEM");
  454. TMIsInstalled = allModules.Contains("TM");
  455. SwitchFlag = false;
  456. ATMModeIsOn = Convert.ToBoolean(QueryDataClient.Instance.Service.GetConfig("System.IsATMMode")) == true ? "ATM Mode On" : "ATM Mode Off";
  457. LOG.Info("开启UI界面");
  458. }
  459. #endregion
  460. #region 命令方法
  461. private void OnLoad()
  462. {
  463. if (!SwitchFlag)
  464. {
  465. LP1WaferAssociation = new WaferAssociationInfo();
  466. LP3WaferAssociation = new WaferAssociationInfo();
  467. LP2WaferAssociation = new WaferAssociationInfo();
  468. LP1WaferAssociation.ModuleData = ModuleManager.ModuleInfos["LP1"];
  469. LP2WaferAssociation.ModuleData = ModuleManager.ModuleInfos["LP2"];
  470. LP3WaferAssociation.ModuleData = ModuleManager.ModuleInfos["LP3"];
  471. SwitchFlag = true;
  472. object obj = QueryDataClient.Instance.Service.GetData("System.PressureUnitType");
  473. PressureType = (PressureType)Convert.ToInt32(obj);
  474. }
  475. }
  476. private void OnLoadWafer(object obj)
  477. {
  478. InvokeClient.Instance.Service.DoOperation($"{obj.ToString()}.Load", ModuleManager.ModuleInfos[obj.ToString()].ModuleID);
  479. }
  480. private void OnUnLoadWafer(object obj)
  481. {
  482. InvokeClient.Instance.Service.DoOperation($"{obj.ToString()}.Unload", ModuleManager.ModuleInfos[obj.ToString()].ModuleID);
  483. }
  484. private void OnSelectAll(object obj)
  485. {
  486. var info = obj as WaferAssociationInfo;
  487. var module = info.ModuleData.ModuleID;
  488. if (CommonFunction.GetValue<bool>(RtDataValues, $"{module}.IsLoaded"))
  489. {
  490. info.SlotFrom = 1;
  491. info.SlotTo = 25;
  492. AssociateSequence(info, true);
  493. }
  494. }
  495. private void OnUnSelectAll(object obj)
  496. {
  497. var info = obj as WaferAssociationInfo;
  498. var module = info.ModuleData.ModuleID;
  499. info.SlotFrom = 1;
  500. info.SlotTo = 25;
  501. AssociateSequence(info, false);
  502. }
  503. private void OnStart(object obj)
  504. {
  505. var info = obj as WaferAssociationInfo;
  506. InvokeClient.Instance.Service.DoOperation("System.StartJob", info.LotId);
  507. LOG.Info("System,Start Job");
  508. }
  509. private void OnStop(object obj)
  510. {
  511. var info = obj as WaferAssociationInfo;
  512. InvokeClient.Instance.Service.DoOperation("System.AbortJob", info.JobID);
  513. LOG.Info($"System,Stop Job{info.JobID}");
  514. }
  515. private void OnAbort(object obj)
  516. {
  517. var info = obj as WaferAssociationInfo;
  518. InvokeClient.Instance.Service.DoOperation("System.StopJob", info.JobID);
  519. LOG.Info($"System,Stop Job{info.JobID}");
  520. }
  521. private void OnHomeAll()
  522. {
  523. InvokeClient.Instance.Service.DoOperation("System.HomeAll");
  524. LOG.Info("System,Home All");
  525. }
  526. private void OnResumeAllJob()
  527. {
  528. var t = CommonFunction.GetValue<List<string>>(RtDataValues, "Scheduler.PjNameList");
  529. if (t == null && t.Count == 0)
  530. {
  531. return;
  532. }
  533. if (CommonFunction.GetValue<int>(RtDataValues, "EquipmentStatus") == 4)
  534. {
  535. t.ForEach(x =>
  536. {
  537. InvokeClient.Instance.Service.DoOperation("System.ResumeJob", x);
  538. });
  539. LOG.Info("System,Resume All Job");
  540. }
  541. else
  542. {
  543. t.ForEach(x =>
  544. {
  545. InvokeClient.Instance.Service.DoOperation("System.PauseJob", x);
  546. });
  547. LOG.Info("System,Pause All Job");
  548. }
  549. }
  550. private void OnAbortAll()
  551. {
  552. InvokeClient.Instance.Service.DoOperation("System.Abort");
  553. LOG.Info("System, Abort");
  554. }
  555. private void OnReturnAllWafer()
  556. {
  557. //Dialog
  558. WaferDialogView dialog = new WaferDialogView()
  559. {
  560. Owner = Application.Current.MainWindow,
  561. };
  562. dialog.Height = 300;
  563. dialog.Width = 400;
  564. double angel = 0;
  565. double coolingtime = 0;
  566. string message = "Please Confirm Return Wafer";
  567. WaferDialogViewModel vm = new WaferDialogViewModel();
  568. vm.ConfirmText = message;
  569. dialog.DataContext = vm;
  570. if (dialog.ShowDialog() == true)
  571. {
  572. if ((bool)dialog.AlignFlag == true && !string.IsNullOrEmpty(dialog.Angle))
  573. {
  574. angel = Convert.ToDouble(dialog.Angle);
  575. }
  576. if ((bool)dialog.CoolingFlag == true && !string.IsNullOrEmpty(dialog.CoolingTime))
  577. {
  578. coolingtime = Convert.ToDouble(dialog.CoolingTime);
  579. }
  580. InvokeClient.Instance.Service.DoOperation("System.ReturnAllWafer", dialog.CoolingFlag, coolingtime, dialog.AlignFlag, angel);
  581. }
  582. LOG.Info("System,Return All Wafer");
  583. }
  584. private void OnSetSequence(object obj)
  585. {
  586. var info = obj as WaferInfo;
  587. bool flag = info.SequenceName != "" ? false : true;
  588. if (info.ModuleID == "LP1" && (CommonFunction.GetValue<bool>(RtDataValues, "LP1.IsLoaded")))
  589. {
  590. AssociateSequence(LP1WaferAssociation, flag, info.SlotID);
  591. }
  592. else if (info.ModuleID == "LP2" && (CommonFunction.GetValue<bool>(RtDataValues, "LP2.IsLoaded")))
  593. {
  594. AssociateSequence(LP2WaferAssociation, flag, info.SlotID);
  595. }
  596. else if (info.ModuleID == "LP3" && (CommonFunction.GetValue<bool>(RtDataValues, "LP3.IsLoaded")))
  597. {
  598. AssociateSequence(LP3WaferAssociation, flag, info.SlotID);
  599. }
  600. }
  601. private void OnCreateJob(object obj)
  602. {
  603. var info = obj as WaferAssociationInfo;
  604. List<string> slotSequence = new List<string>();
  605. info.ModuleData.WaferManager.Wafers.ForEach(key => { slotSequence.Insert(0, key.SequenceName); });
  606. string jobId = info.LotId.Trim();
  607. //if (string.IsNullOrEmpty(jobId))
  608. // jobId = "CJ_Local_" + info.ModuleData.ModuleID;
  609. //info.LotId = jobId;
  610. //info.JobID = jobId;
  611. //info.JobStatus = "WaitingForStart";
  612. info.LotIdSaved = true;
  613. Dictionary<string, object> param = new Dictionary<string, object>()
  614. {
  615. {"JobId", ""},
  616. {"Module", info.ModuleData.ModuleID},
  617. {"SlotSequence", slotSequence.ToArray()},
  618. {"AutoStart", true},
  619. { "PreCleanRecipeName",info.PreCleanRecipeName},
  620. { "PostCleanRecipeName",info.PostCleanRecipeName}
  621. };
  622. InvokeClient.Instance.Service.DoOperation("System.CreateJob", param);
  623. }
  624. private void OnAbortJob(object obj)
  625. {
  626. InvokeClient.Instance.Service.DoOperation("System.AbortJob", obj.ToString());
  627. }
  628. private void OnEnableAuto()
  629. {
  630. InvokeClient.Instance.Service.DoOperation("System.SetAutoMode");
  631. }
  632. private void OnEnableManual()
  633. {
  634. InvokeClient.Instance.Service.DoOperation("System.SetManualMode");
  635. }
  636. #endregion
  637. #region 私有方法
  638. private void Timer_Tick(object sender, EventArgs e)
  639. {
  640. LP1ModuleInfo = ModuleManager.ModuleInfos["LP1"];
  641. LP2ModuleInfo = ModuleManager.ModuleInfos["LP2"];
  642. LP3ModuleInfo = ModuleManager.ModuleInfos["LP3"];
  643. EFEMModuleInfo = ModuleManager.ModuleInfos["EfemRobot"];
  644. TMModuleInfo = ModuleManager.ModuleInfos["TMRobot"];
  645. BladeAWafer = ModuleManager.ModuleInfos["EfemRobot"].WaferManager.Wafers[0];
  646. BladeBWafer = ModuleManager.ModuleInfos["EfemRobot"].WaferManager.Wafers[1];
  647. RtDataValues = QueryDataClient.Instance.Service.PollData(m_RtDataKeys);
  648. if (LLAIsInstalled == true)
  649. {
  650. LLAModuleInfo = ModuleManager.ModuleInfos["LLA"];
  651. LLAWafer = ModuleManager.ModuleInfos["LLA"].WaferManager.Wafers.FirstOrDefault(x => x.WaferStatus != 0);
  652. }
  653. if (LLBIsInstalled == true)
  654. {
  655. LLBModuleInfo = ModuleManager.ModuleInfos["LLB"];
  656. LLBWafer = ModuleManager.ModuleInfos["LLB"].WaferManager.Wafers.FirstOrDefault(x => x.WaferStatus != 0);
  657. }
  658. if (PMAIsInstalled == true)
  659. {
  660. PMAWafer = ModuleManager.ModuleInfos["PMA"].WaferManager.Wafers[0];
  661. PMARecipeResult = CommonFunction.GetValue<RecipeResult>(RtDataValues, $"PMA.CurrentRecipeResult");
  662. }
  663. if (PMBIsInstalled == true)
  664. {
  665. PMBWafer = ModuleManager.ModuleInfos["PMB"].WaferManager.Wafers[0];
  666. PMBRecipeResult = CommonFunction.GetValue<RecipeResult>(RtDataValues, $"PMB.CurrentRecipeResult");
  667. }
  668. if (PMCIsInstalled == true)
  669. {
  670. PMCWafer = ModuleManager.ModuleInfos["PMC"].WaferManager.Wafers[0];
  671. PMCRecipeResult = CommonFunction.GetValue<RecipeResult>(RtDataValues, $"PMC.CurrentRecipeResult");
  672. }
  673. if (PMDIsInstalled == true)
  674. {
  675. PMDWafer = ModuleManager.ModuleInfos["PMD"].WaferManager.Wafers[0];
  676. PMDRecipeResult = CommonFunction.GetValue<RecipeResult>(RtDataValues, $"PMD.CurrentRecipeResult");
  677. }
  678. if (TMIsInstalled == true)
  679. {
  680. TMBladeAWafer = ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[0];
  681. TMBladeBWafer = ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[1];
  682. TMPressure = CommonFunction.GetValue<float>(RtDataValues, $"TM.TMProcessGauge.Value");
  683. }
  684. if (EFEMIsInstalled == true)
  685. {
  686. EFEMBladeAWafer = ModuleManager.ModuleInfos["EfemRobot"].WaferManager.Wafers[0];
  687. EFEMBladeBWafer = ModuleManager.ModuleInfos["EfemRobot"].WaferManager.Wafers[1];
  688. Aligner1Wafer = ModuleManager.ModuleInfos["Aligner1"].WaferManager.Wafers[0];
  689. ControlJobInfo lp1Cj = CommonFunction.GetValue<ControlJobInfo>(RtDataValues, "LP1.CurrentControlJob");
  690. UPdateWaferAssociation(LP1WaferAssociation, lp1Cj);
  691. ControlJobInfo lp2Cj = CommonFunction.GetValue<ControlJobInfo>(RtDataValues, "LP2.CurrentControlJob");
  692. UPdateWaferAssociation(LP2WaferAssociation, lp2Cj);
  693. ControlJobInfo lp3Cj = CommonFunction.GetValue<ControlJobInfo>(RtDataValues, "LP3.CurrentControlJob");
  694. UPdateWaferAssociation(LP3WaferAssociation, lp3Cj);
  695. }
  696. RobotMoveInfo = (RobotMoveInfo)QueryDataClient.Instance.Service.GetData("TM.RobotMoveAction");
  697. EfemRobotMoveInfo = (RobotMoveInfo)QueryDataClient.Instance.Service.GetData("EFEM.RobotMoveAction");
  698. LP1WaferCount = LP1ModuleInfo.WaferManager.Wafers.Where(x => x.WaferStatus != 0).Count();
  699. LP2WaferCount = LP2ModuleInfo.WaferManager.Wafers.Where(x => x.WaferStatus != 0).Count();
  700. LP3WaferCount = LP3ModuleInfo.WaferManager.Wafers.Where(x => x.WaferStatus != 0).Count();
  701. if (CommonFunction.GetValue<int>(RtDataValues, "EquipmentStatus") == 4)
  702. {
  703. RouteState = "Resume";
  704. }
  705. else
  706. {
  707. RouteState = "Pause";
  708. }
  709. }
  710. /// <summary>
  711. /// 更新Wafer情况
  712. /// </summary>
  713. /// <param name="info"></param>
  714. /// <param name="cjInfo"></param>
  715. private void UPdateWaferAssociation(WaferAssociationInfo info, ControlJobInfo cjInfo)
  716. {
  717. if (cjInfo != null)
  718. {
  719. info.LotId = cjInfo.Name;
  720. info.JobID = cjInfo.Name;
  721. info.JobStatus = cjInfo.State.ToString();
  722. if (cjInfo.SequenceNameList != null)
  723. {
  724. for (int i = 0; i < cjInfo.SequenceNameList.Length; i++)
  725. {
  726. info.ModuleData.WaferManager.Wafers[24 - i].SequenceName = cjInfo.SequenceNameList[i];
  727. }
  728. }
  729. info.PreCleanRecipeName = cjInfo.PreJobClean;
  730. info.PostCleanRecipeName = cjInfo.PostJobClean;
  731. }
  732. else
  733. {
  734. if (!string.IsNullOrEmpty(info.JobID))
  735. {
  736. info.LotId = "";
  737. info.JobID = "";
  738. info.JobStatus = "";
  739. info.PreCleanRecipeName = "";
  740. info.PostCleanRecipeName = "";
  741. AssociateSequence(info, false);
  742. }
  743. }
  744. }
  745. private async void RobotMoveInfoChanged(RobotMoveInfo oldValue, RobotMoveInfo newValue)
  746. {
  747. string RobotTarget;
  748. if (oldValue == null || newValue == null)
  749. {
  750. return;
  751. }
  752. #region Rotating
  753. if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && (newValue.Action == RobotAction.Rotating))
  754. {
  755. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  756. if (TMRobotMoveActionBladeTarget != null)
  757. {
  758. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  759. }
  760. else
  761. {
  762. return;
  763. }
  764. var values = RobotTarget.Split('.');
  765. var arm = values[0];
  766. var module = values[1];
  767. if (arm == "ArmA")
  768. {
  769. Robot1TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  770. }
  771. else if (arm == "ArmB")
  772. {
  773. Robot2TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  774. }
  775. }
  776. #endregion
  777. #region pick 和 place LL
  778. else if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && (newValue.Action == RobotAction.Placing || newValue.Action == RobotAction.Picking))
  779. {
  780. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  781. if (TMRobotMoveActionBladeTarget != null)
  782. {
  783. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  784. }
  785. else
  786. {
  787. return;
  788. }
  789. var values = RobotTarget.Split('.');
  790. var arm = values[0];
  791. var module = values[1];
  792. if (arm == "ArmA")
  793. {
  794. var waferRobotTAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  795. if (waferRobotTAction != Robot1TAction)
  796. {
  797. Robot1TAction = waferRobotTAction;
  798. }
  799. else
  800. {
  801. //await Task.Delay(100);
  802. }
  803. await Task.Delay(600);
  804. //Robot1TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  805. //await Task.Delay(600);
  806. Robot1XAction = WaferRobotXAction.Extend;
  807. 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))
  808. {
  809. await Task.Delay(100);
  810. }
  811. Robot1XAction = WaferRobotXAction.Retract;
  812. }
  813. else if (arm == "ArmB")
  814. {
  815. var waferRobotTAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  816. if (waferRobotTAction != Robot2TAction)
  817. {
  818. Robot2TAction = waferRobotTAction;
  819. }
  820. else
  821. {
  822. //await Task.Delay(100);
  823. }
  824. await Task.Delay(600);
  825. //Robot2TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  826. //await Task.Delay(600);
  827. Robot2XAction = WaferRobotXAction.Extend;
  828. 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))
  829. {
  830. await Task.Delay(100);
  831. }
  832. Robot2XAction = WaferRobotXAction.Retract;
  833. }
  834. }
  835. #endregion
  836. #region pick 和 place pm
  837. else if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && newValue.Action == RobotAction.Extending)
  838. {
  839. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  840. if (TMRobotMoveActionBladeTarget != null)
  841. {
  842. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  843. }
  844. else
  845. {
  846. return;
  847. }
  848. var values = RobotTarget.Split('.');
  849. var arm = values[0];
  850. var module = values[1];
  851. if (arm == "ArmA")
  852. {
  853. var waferRobotTAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  854. if (waferRobotTAction != Robot1TAction)
  855. {
  856. Robot1TAction = waferRobotTAction;
  857. }
  858. else
  859. {
  860. // await Task.Delay(100);
  861. }
  862. await Task.Delay(600);
  863. Robot1XAction = WaferRobotXAction.Extend;
  864. }
  865. else if (arm == "ArmB")
  866. {
  867. var waferRobotTAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  868. if (waferRobotTAction != Robot2TAction)
  869. {
  870. Robot2TAction = waferRobotTAction;
  871. }
  872. else
  873. {
  874. // await Task.Delay(100);
  875. }
  876. await Task.Delay(600);
  877. Robot2XAction = WaferRobotXAction.Extend;
  878. }
  879. }
  880. else if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && newValue.Action == RobotAction.Retracting)
  881. {
  882. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  883. if (TMRobotMoveActionBladeTarget != null)
  884. {
  885. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  886. }
  887. else
  888. {
  889. return;
  890. }
  891. var values = RobotTarget.Split('.');
  892. var arm = values[0];
  893. if (arm == "ArmA")
  894. {
  895. Robot1XAction = WaferRobotXAction.Retract;
  896. }
  897. else if (arm == "ArmB")
  898. {
  899. Robot2XAction = WaferRobotXAction.Retract;
  900. }
  901. }
  902. #endregion
  903. #region Home
  904. else if (oldValue.Action == RobotAction.None && newValue.Action == RobotAction.Homing)
  905. {
  906. if (Robot1XAction == WaferRobotXAction.Extend)
  907. {
  908. Robot1XAction = WaferRobotXAction.Retract;
  909. }
  910. if (Robot2XAction == WaferRobotXAction.Extend)
  911. {
  912. Robot2XAction = WaferRobotXAction.Retract;
  913. }
  914. await Task.Delay(2000);
  915. if (Robot1TAction != WaferRobotTAction.T_Origin)
  916. {
  917. Robot1TAction = WaferRobotTAction.T_Origin;
  918. }
  919. if (Robot2TAction != WaferRobotTAction.T_Origin)
  920. {
  921. Robot2TAction = WaferRobotTAction.T_Origin;
  922. }
  923. }
  924. #endregion
  925. }
  926. private async void EFEMRobotMoveInfoChanged(RobotMoveInfo oldValue, RobotMoveInfo newValue)
  927. {
  928. string RobotTarget;
  929. if (oldValue == null || newValue == null)
  930. {
  931. return;
  932. }
  933. #region pick 和 place LL
  934. if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && (newValue.Action == RobotAction.Placing || newValue.Action == RobotAction.Picking))
  935. {
  936. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  937. if (TMRobotMoveActionBladeTarget != null)
  938. {
  939. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  940. }
  941. else
  942. {
  943. return;
  944. }
  945. var values = RobotTarget.Split('.');
  946. var arm = values[0];
  947. var module = values[1];
  948. if (arm == "ArmA")
  949. {
  950. var robot3Robot3TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  951. //await Task.Delay(1000);
  952. await ChangePosition(robot3Robot3TAction);
  953. if (Robot3TAction != robot3Robot3TAction)
  954. {
  955. Robot3TAction = robot3Robot3TAction;
  956. await Task.Delay(600);
  957. }
  958. Robot3XAction = WaferRobotXAction.Extend;
  959. 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))
  960. {
  961. await Task.Delay(100);
  962. }
  963. Robot3XAction = WaferRobotXAction.Retract;
  964. }
  965. else if (arm == "ArmB")
  966. {
  967. var robot4Robot4TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  968. //await Task.Delay(1000);
  969. await ChangePosition(robot4Robot4TAction);
  970. if (Robot4TAction != robot4Robot4TAction)
  971. {
  972. Robot4TAction = robot4Robot4TAction;
  973. await Task.Delay(600);
  974. }
  975. //ChangePosition(Robot4TAction);
  976. //await Task.Delay(2000);
  977. Robot4XAction = WaferRobotXAction.Extend;
  978. 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))
  979. {
  980. await Task.Delay(100);
  981. }
  982. Robot4XAction = WaferRobotXAction.Retract;
  983. }
  984. }
  985. #endregion
  986. #region pick 和 place pm
  987. if (oldValue.Action == RobotAction.None && newValue.Action == RobotAction.Extending)
  988. {
  989. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  990. if (TMRobotMoveActionBladeTarget != null)
  991. {
  992. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  993. }
  994. else
  995. {
  996. return;
  997. }
  998. var values = RobotTarget.Split('.');
  999. var arm = values[0];
  1000. var module = values[1];
  1001. if (arm == "ArmA")
  1002. {
  1003. Robot3TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  1004. await Task.Delay(1500);
  1005. //ChangePosition(Robot3TAction);
  1006. //await Task.Delay(2000);
  1007. Robot3XAction = WaferRobotXAction.Extend;
  1008. }
  1009. else if (arm == "ArmB")
  1010. {
  1011. Robot4TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  1012. await Task.Delay(1500);
  1013. //ChangePosition(Robot4TAction);
  1014. //await Task.Delay(2000);
  1015. Robot4XAction = WaferRobotXAction.Extend;
  1016. }
  1017. }
  1018. if (oldValue.Action == RobotAction.None && newValue.Action == RobotAction.Retracting)
  1019. {
  1020. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  1021. if (TMRobotMoveActionBladeTarget != null)
  1022. {
  1023. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  1024. }
  1025. else
  1026. {
  1027. return;
  1028. }
  1029. var values = RobotTarget.Split('.');
  1030. var arm = values[0];
  1031. if (arm == "ArmA")
  1032. {
  1033. Robot3XAction = WaferRobotXAction.Retract;
  1034. await Task.Delay(3000);
  1035. //ChangePosition(Robot3TAction);
  1036. //await Task.Delay(2000);
  1037. }
  1038. else if (arm == "ArmB")
  1039. {
  1040. Robot4XAction = WaferRobotXAction.Retract;
  1041. await Task.Delay(3000);
  1042. //ChangePosition(Robot3TAction);
  1043. //await Task.Delay(2000);
  1044. }
  1045. }
  1046. #endregion
  1047. #region Home
  1048. else if (oldValue.Action == RobotAction.None && newValue.Action == RobotAction.Homing)
  1049. {
  1050. if (Robot3XAction == WaferRobotXAction.Extend)
  1051. {
  1052. Robot3XAction = WaferRobotXAction.Retract;
  1053. }
  1054. if (Robot4XAction == WaferRobotXAction.Extend)
  1055. {
  1056. Robot4XAction = WaferRobotXAction.Retract;
  1057. }
  1058. if (Robot3TAction != WaferRobotTAction.T_Origin)
  1059. {
  1060. Robot3TAction = WaferRobotTAction.T_Origin;
  1061. }
  1062. if (Robot4TAction != WaferRobotTAction.T_Origin)
  1063. {
  1064. Robot4TAction = WaferRobotTAction.T_Origin;
  1065. }
  1066. await Task.Delay(1000);
  1067. await ChangePosition(WaferRobotTAction.T_Origin);
  1068. }
  1069. #endregion
  1070. }
  1071. private void addDataKeys()
  1072. {
  1073. m_RtDataKeys.Add("PMA.IsSlitDoorClosed");
  1074. m_RtDataKeys.Add("PMA.CurrentRecipeResult");
  1075. m_RtDataKeys.Add("PMA.IsOnline");
  1076. m_RtDataKeys.Add("PMA.CalculationPressure");
  1077. m_RtDataKeys.Add("PMA.IsLidClosed");
  1078. m_RtDataKeys.Add("PMB.IsSlitDoorClosed");
  1079. m_RtDataKeys.Add("PMB.CurrentRecipeResult");
  1080. m_RtDataKeys.Add("PMB.IsOnline");
  1081. m_RtDataKeys.Add("PMB.CalculationPressure");
  1082. m_RtDataKeys.Add("PMB.IsLidClosed");
  1083. m_RtDataKeys.Add("PMC.IsSlitDoorClosed");
  1084. m_RtDataKeys.Add("PMC.CurrentRecipeResult");
  1085. m_RtDataKeys.Add("PMC.IsOnline");
  1086. m_RtDataKeys.Add("PMC.CalculationPressure");
  1087. m_RtDataKeys.Add("PMC.IsLidClosed");
  1088. m_RtDataKeys.Add("PMD.IsSlitDoorClosed");
  1089. m_RtDataKeys.Add("PMD.CurrentRecipeResult");
  1090. m_RtDataKeys.Add("PMD.IsOnline");
  1091. m_RtDataKeys.Add("PMD.CalculationPressure");
  1092. m_RtDataKeys.Add("PMD.IsLidClosed");
  1093. m_RtDataKeys.Add("TM.LLATSlitDoor.IsClosed");
  1094. m_RtDataKeys.Add("TM.LLBTSlitDoor.IsClosed");
  1095. m_RtDataKeys.Add("TM.LLAESlitDoor.IsClosed");
  1096. m_RtDataKeys.Add("TM.LLBESlitDoor.IsClosed");
  1097. m_RtDataKeys.Add("TM.IsOnline");
  1098. m_RtDataKeys.Add("TM.TMProcessGauge.Value");
  1099. m_RtDataKeys.Add("TM.TMATMSwitch.Value");
  1100. m_RtDataKeys.Add("TM.TMVacSwitch.Value");
  1101. m_RtDataKeys.Add("TM.TMProcessGauge.Value");
  1102. m_RtDataKeys.Add("TM.TMLidClosed");
  1103. m_RtDataKeys.Add("TM.LLALidClosed");
  1104. m_RtDataKeys.Add("TM.LLBLidClosed");
  1105. m_RtDataKeys.Add("TM.PMASlitDoor.IsClosed");
  1106. m_RtDataKeys.Add("TM.PMBSlitDoor.IsClosed");
  1107. m_RtDataKeys.Add("TM.PMCSlitDoor.IsClosed");
  1108. m_RtDataKeys.Add("TM.PMDSlitDoor.IsClosed");
  1109. m_RtDataKeys.Add("LLA.IsOnline");
  1110. m_RtDataKeys.Add($"TM.LLAPressureGauge.Value");
  1111. m_RtDataKeys.Add($"TM.LLAVacSwitch.Value");
  1112. m_RtDataKeys.Add($"TM.LLAATMSwitch.Value");
  1113. m_RtDataKeys.Add("LLB.IsOnline");
  1114. m_RtDataKeys.Add($"TM.LLBPressureGauge.Value");
  1115. m_RtDataKeys.Add($"TM.LLBVacSwitch.Value");
  1116. m_RtDataKeys.Add($"TM.LLBATMSwitch.Value");
  1117. m_RtDataKeys.Add("LP1.IsLoaded");
  1118. m_RtDataKeys.Add("LP2.IsLoaded");
  1119. m_RtDataKeys.Add("LP3.IsLoaded");
  1120. m_RtDataKeys.Add("LP1.CassettePlaced");
  1121. m_RtDataKeys.Add("LP2.CassettePlaced");
  1122. m_RtDataKeys.Add("LP3.CassettePlaced");
  1123. m_RtDataKeys.Add("LP1.CurrentControlJob");
  1124. m_RtDataKeys.Add("LP2.CurrentControlJob");
  1125. m_RtDataKeys.Add("LP3.CurrentControlJob");
  1126. m_RtDataKeys.Add("EFEM.IsOnline");
  1127. m_RtDataKeys.Add("System.IsAutoMode");
  1128. m_RtDataKeys.Add("System.IsBusy");
  1129. m_RtDataKeys.Add("Scheduler.CycledCount");
  1130. m_RtDataKeys.Add("Scheduler.CycledWafer");
  1131. m_RtDataKeys.Add("Scheduler.CycleSetPoint");
  1132. m_RtDataKeys.Add("Scheduler.Throughput");
  1133. m_RtDataKeys.Add("EquipmentStatus");
  1134. m_RtDataKeys.Add("Scheduler.PjNameList");
  1135. }
  1136. private void AssociateSequence(WaferAssociationInfo info, bool flag, int slot = -1)
  1137. {
  1138. List<WaferInfo> wafers = info.ModuleData.WaferManager.Wafers;
  1139. if (slot >= 0) //by wafer
  1140. {
  1141. int index = wafers.Count - slot - 1;
  1142. if (index < wafers.Count)
  1143. {
  1144. if (flag && HasWaferOnSlot(wafers, index))
  1145. wafers[index].SequenceName = info.SequenceName;
  1146. else
  1147. wafers[index].SequenceName = string.Empty;
  1148. }
  1149. }
  1150. else //by from-to
  1151. {
  1152. for (int i = info.SlotFrom - 1; i < info.SlotTo; i++)
  1153. {
  1154. int index = wafers.Count - i - 1;
  1155. if (index < wafers.Count)
  1156. {
  1157. if (flag && HasWaferOnSlot(wafers, index))
  1158. wafers[index].SequenceName = info.SequenceName;
  1159. else
  1160. wafers[index].SequenceName = string.Empty;
  1161. }
  1162. }
  1163. }
  1164. switch (info.ModuleData.ModuleID)
  1165. {
  1166. case "LP1":
  1167. LP1WaferAssociation = info;
  1168. break;
  1169. case "LP2":
  1170. LP2WaferAssociation = info;
  1171. break;
  1172. case "LP3":
  1173. LP3WaferAssociation = info;
  1174. break;
  1175. }
  1176. }
  1177. private bool HasWaferOnSlot(List<WaferInfo> wafers, int index)
  1178. {
  1179. if (wafers[index].WaferStatus == 0)
  1180. return false;
  1181. return true;
  1182. }
  1183. private async Task ChangePosition(WaferRobotTAction waferRobotTAction)
  1184. {
  1185. await Task.Delay(500);
  1186. int delay = 500;
  1187. if (waferRobotTAction == WaferRobotTAction.LP1)
  1188. {
  1189. CurrentRobotPosition = RobotPosition.Left;
  1190. await Task.Delay(delay);
  1191. }
  1192. else if (waferRobotTAction == WaferRobotTAction.LP3)
  1193. {
  1194. CurrentRobotPosition = RobotPosition.Right;
  1195. await Task.Delay(delay);
  1196. }
  1197. else if (waferRobotTAction == WaferRobotTAction.LP2)
  1198. {
  1199. CurrentRobotPosition = RobotPosition.Middle;
  1200. await Task.Delay(delay);
  1201. }
  1202. else
  1203. {
  1204. CurrentRobotPosition = RobotPosition.Origin;
  1205. await Task.Delay(delay);
  1206. }
  1207. }
  1208. #endregion
  1209. }
  1210. }