OperationOverViewModel.cs 50 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338
  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.StopJob", 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. UPdateWaferAssociation(LP1WaferAssociation, lp1Cj);
  684. ControlJobInfo lp2Cj = CommonFunction.GetValue<ControlJobInfo>(RtDataValues, "LP2.CurrentControlJob");
  685. UPdateWaferAssociation(LP2WaferAssociation, lp2Cj);
  686. ControlJobInfo lp3Cj = CommonFunction.GetValue<ControlJobInfo>(RtDataValues, "LP3.CurrentControlJob");
  687. UPdateWaferAssociation(LP3WaferAssociation, lp3Cj);
  688. }
  689. RobotMoveInfo = (RobotMoveInfo)QueryDataClient.Instance.Service.GetData("TM.RobotMoveAction");
  690. EfemRobotMoveInfo = (RobotMoveInfo)QueryDataClient.Instance.Service.GetData("EFEM.RobotMoveAction");
  691. LP1WaferCount = LP1ModuleInfo.WaferManager.Wafers.Where(x => x.WaferStatus != 0).Count();
  692. LP2WaferCount = LP2ModuleInfo.WaferManager.Wafers.Where(x => x.WaferStatus != 0).Count();
  693. LP3WaferCount = LP3ModuleInfo.WaferManager.Wafers.Where(x => x.WaferStatus != 0).Count();
  694. if (CommonFunction.GetValue<int>(RtDataValues, "EquipmentStatus") == 4)
  695. {
  696. RouteState = "Resume";
  697. }
  698. else
  699. {
  700. RouteState = "Pause";
  701. }
  702. }
  703. /// <summary>
  704. /// 更新Wafer情况
  705. /// </summary>
  706. /// <param name="info"></param>
  707. /// <param name="cjInfo"></param>
  708. private void UPdateWaferAssociation(WaferAssociationInfo info,ControlJobInfo cjInfo)
  709. {
  710. if (cjInfo != null)
  711. {
  712. info.LotId = cjInfo.Name;
  713. info.JobID = cjInfo.Name;
  714. info.JobStatus = cjInfo.State.ToString();
  715. if (cjInfo.SequenceNameList != null)
  716. {
  717. for (int i = 0; i < cjInfo.SequenceNameList.Length; i++)
  718. {
  719. info.ModuleData.WaferManager.Wafers[24-i].SequenceName = cjInfo.SequenceNameList[i];
  720. }
  721. }
  722. info.PreCleanRecipeName = cjInfo.PreJobClean;
  723. info.PostCleanRecipeName = cjInfo.PostJobClean;
  724. }
  725. else
  726. {
  727. if (!string.IsNullOrEmpty(info.JobID))
  728. {
  729. info.LotId = "";
  730. info.JobID = "";
  731. info.JobStatus = "";
  732. info.PreCleanRecipeName = "";
  733. info.PostCleanRecipeName = "";
  734. AssociateSequence(info, false);
  735. }
  736. }
  737. }
  738. private async void RobotMoveInfoChanged(RobotMoveInfo oldValue, RobotMoveInfo newValue)
  739. {
  740. string RobotTarget;
  741. if (oldValue == null || newValue == null)
  742. {
  743. return;
  744. }
  745. #region Rotating
  746. if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && (newValue.Action == RobotAction.Rotating))
  747. {
  748. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  749. if (TMRobotMoveActionBladeTarget != null)
  750. {
  751. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  752. }
  753. else
  754. {
  755. return;
  756. }
  757. var values = RobotTarget.Split('.');
  758. var arm = values[0];
  759. var module = values[1];
  760. if (arm == "ArmA")
  761. {
  762. Robot1TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  763. }
  764. else if (arm == "ArmB")
  765. {
  766. Robot2TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  767. }
  768. }
  769. #endregion
  770. #region pick 和 place LL
  771. else if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && (newValue.Action == RobotAction.Placing || newValue.Action == RobotAction.Picking))
  772. {
  773. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  774. if (TMRobotMoveActionBladeTarget != null)
  775. {
  776. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  777. }
  778. else
  779. {
  780. return;
  781. }
  782. var values = RobotTarget.Split('.');
  783. var arm = values[0];
  784. var module = values[1];
  785. if (arm == "ArmA")
  786. {
  787. var waferRobotTAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  788. if (waferRobotTAction != Robot1TAction)
  789. {
  790. Robot1TAction = waferRobotTAction;
  791. }
  792. else
  793. {
  794. //await Task.Delay(100);
  795. }
  796. await Task.Delay(600);
  797. //Robot1TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  798. //await Task.Delay(600);
  799. Robot1XAction = WaferRobotXAction.Extend;
  800. 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))
  801. {
  802. await Task.Delay(100);
  803. }
  804. Robot1XAction = WaferRobotXAction.Retract;
  805. }
  806. else if (arm == "ArmB")
  807. {
  808. var waferRobotTAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  809. if (waferRobotTAction != Robot2TAction)
  810. {
  811. Robot2TAction = waferRobotTAction;
  812. }
  813. else
  814. {
  815. //await Task.Delay(100);
  816. }
  817. await Task.Delay(600);
  818. //Robot2TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  819. //await Task.Delay(600);
  820. Robot2XAction = WaferRobotXAction.Extend;
  821. 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))
  822. {
  823. await Task.Delay(100);
  824. }
  825. Robot2XAction = WaferRobotXAction.Retract;
  826. }
  827. }
  828. #endregion
  829. #region pick 和 place pm
  830. else if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && newValue.Action == RobotAction.Extending)
  831. {
  832. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  833. if (TMRobotMoveActionBladeTarget != null)
  834. {
  835. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  836. }
  837. else
  838. {
  839. return;
  840. }
  841. var values = RobotTarget.Split('.');
  842. var arm = values[0];
  843. var module = values[1];
  844. if (arm == "ArmA")
  845. {
  846. var waferRobotTAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  847. if (waferRobotTAction != Robot1TAction)
  848. {
  849. Robot1TAction = waferRobotTAction;
  850. }
  851. else
  852. {
  853. // await Task.Delay(100);
  854. }
  855. await Task.Delay(600);
  856. Robot1XAction = WaferRobotXAction.Extend;
  857. }
  858. else if (arm == "ArmB")
  859. {
  860. var waferRobotTAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  861. if (waferRobotTAction != Robot2TAction)
  862. {
  863. Robot2TAction = waferRobotTAction;
  864. }
  865. else
  866. {
  867. // await Task.Delay(100);
  868. }
  869. await Task.Delay(600);
  870. Robot2XAction = WaferRobotXAction.Extend;
  871. }
  872. }
  873. else if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && newValue.Action == RobotAction.Retracting)
  874. {
  875. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  876. if (TMRobotMoveActionBladeTarget != null)
  877. {
  878. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  879. }
  880. else
  881. {
  882. return;
  883. }
  884. var values = RobotTarget.Split('.');
  885. var arm = values[0];
  886. if (arm == "ArmA")
  887. {
  888. Robot1XAction = WaferRobotXAction.Retract;
  889. }
  890. else if (arm == "ArmB")
  891. {
  892. Robot2XAction = WaferRobotXAction.Retract;
  893. }
  894. }
  895. #endregion
  896. #region Home
  897. else if (oldValue.Action == RobotAction.None && newValue.Action == RobotAction.Homing)
  898. {
  899. if (Robot1XAction == WaferRobotXAction.Extend)
  900. {
  901. Robot1XAction = WaferRobotXAction.Retract;
  902. }
  903. if (Robot2XAction == WaferRobotXAction.Extend)
  904. {
  905. Robot2XAction = WaferRobotXAction.Retract;
  906. }
  907. await Task.Delay(2000);
  908. if (Robot1TAction != WaferRobotTAction.T_Origin)
  909. {
  910. Robot1TAction = WaferRobotTAction.T_Origin;
  911. }
  912. if (Robot2TAction != WaferRobotTAction.T_Origin)
  913. {
  914. Robot2TAction = WaferRobotTAction.T_Origin;
  915. }
  916. }
  917. #endregion
  918. }
  919. private async void EFEMRobotMoveInfoChanged(RobotMoveInfo oldValue, RobotMoveInfo newValue)
  920. {
  921. string RobotTarget;
  922. if (oldValue == null || newValue == null)
  923. {
  924. return;
  925. }
  926. #region pick 和 place LL
  927. if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && (newValue.Action == RobotAction.Placing || newValue.Action == RobotAction.Picking))
  928. {
  929. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  930. if (TMRobotMoveActionBladeTarget != null)
  931. {
  932. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  933. }
  934. else
  935. {
  936. return;
  937. }
  938. var values = RobotTarget.Split('.');
  939. var arm = values[0];
  940. var module = values[1];
  941. if (arm == "ArmA")
  942. {
  943. var robot3Robot3TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  944. //await Task.Delay(1000);
  945. await ChangePosition(robot3Robot3TAction);
  946. if (Robot3TAction != robot3Robot3TAction)
  947. {
  948. Robot3TAction = robot3Robot3TAction;
  949. await Task.Delay(600);
  950. }
  951. Robot3XAction = WaferRobotXAction.Extend;
  952. 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))
  953. {
  954. await Task.Delay(100);
  955. }
  956. Robot3XAction = WaferRobotXAction.Retract;
  957. }
  958. else if (arm == "ArmB")
  959. {
  960. var robot4Robot4TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  961. //await Task.Delay(1000);
  962. await ChangePosition(robot4Robot4TAction);
  963. if (Robot4TAction != robot4Robot4TAction)
  964. {
  965. Robot4TAction = robot4Robot4TAction;
  966. await Task.Delay(600);
  967. }
  968. //ChangePosition(Robot4TAction);
  969. //await Task.Delay(2000);
  970. Robot4XAction = WaferRobotXAction.Extend;
  971. 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))
  972. {
  973. await Task.Delay(100);
  974. }
  975. Robot4XAction = WaferRobotXAction.Retract;
  976. }
  977. }
  978. #endregion
  979. #region pick 和 place pm
  980. if (oldValue.Action == RobotAction.None && newValue.Action == RobotAction.Extending)
  981. {
  982. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  983. if (TMRobotMoveActionBladeTarget != null)
  984. {
  985. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  986. }
  987. else
  988. {
  989. return;
  990. }
  991. var values = RobotTarget.Split('.');
  992. var arm = values[0];
  993. var module = values[1];
  994. if (arm == "ArmA")
  995. {
  996. Robot3TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  997. await Task.Delay(1500);
  998. //ChangePosition(Robot3TAction);
  999. //await Task.Delay(2000);
  1000. Robot3XAction = WaferRobotXAction.Extend;
  1001. }
  1002. else if (arm == "ArmB")
  1003. {
  1004. Robot4TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  1005. await Task.Delay(1500);
  1006. //ChangePosition(Robot4TAction);
  1007. //await Task.Delay(2000);
  1008. Robot4XAction = WaferRobotXAction.Extend;
  1009. }
  1010. }
  1011. if (oldValue.Action == RobotAction.None && newValue.Action == RobotAction.Retracting)
  1012. {
  1013. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  1014. if (TMRobotMoveActionBladeTarget != null)
  1015. {
  1016. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  1017. }
  1018. else
  1019. {
  1020. return;
  1021. }
  1022. var values = RobotTarget.Split('.');
  1023. var arm = values[0];
  1024. if (arm == "ArmA")
  1025. {
  1026. Robot3XAction = WaferRobotXAction.Retract;
  1027. await Task.Delay(3000);
  1028. //ChangePosition(Robot3TAction);
  1029. //await Task.Delay(2000);
  1030. }
  1031. else if (arm == "ArmB")
  1032. {
  1033. Robot4XAction = WaferRobotXAction.Retract;
  1034. await Task.Delay(3000);
  1035. //ChangePosition(Robot3TAction);
  1036. //await Task.Delay(2000);
  1037. }
  1038. }
  1039. #endregion
  1040. #region Home
  1041. else if (oldValue.Action == RobotAction.None && newValue.Action == RobotAction.Homing)
  1042. {
  1043. if (Robot3XAction == WaferRobotXAction.Extend)
  1044. {
  1045. Robot3XAction = WaferRobotXAction.Retract;
  1046. }
  1047. if (Robot4XAction == WaferRobotXAction.Extend)
  1048. {
  1049. Robot4XAction = WaferRobotXAction.Retract;
  1050. }
  1051. if (Robot3TAction != WaferRobotTAction.T_Origin)
  1052. {
  1053. Robot3TAction = WaferRobotTAction.T_Origin;
  1054. }
  1055. if (Robot4TAction != WaferRobotTAction.T_Origin)
  1056. {
  1057. Robot4TAction = WaferRobotTAction.T_Origin;
  1058. }
  1059. await Task.Delay(1000);
  1060. await ChangePosition(WaferRobotTAction.T_Origin);
  1061. }
  1062. #endregion
  1063. }
  1064. private void addDataKeys()
  1065. {
  1066. if (PMAIsInstalled == true)
  1067. {
  1068. m_RtDataKeys.Add("PMA.IsSlitDoorClosed");
  1069. m_RtDataKeys.Add("PMA.CurrentRecipeResult");
  1070. m_RtDataKeys.Add("PMA.IsOnline");
  1071. m_RtDataKeys.Add("PMA.CalculationPressure");
  1072. }
  1073. if (PMBIsInstalled == true)
  1074. {
  1075. m_RtDataKeys.Add("PMB.IsSlitDoorClosed");
  1076. m_RtDataKeys.Add("PMB.CurrentRecipeResult");
  1077. m_RtDataKeys.Add("PMB.IsOnline");
  1078. m_RtDataKeys.Add("PMB.CalculationPressure");
  1079. }
  1080. if (PMCIsInstalled == true)
  1081. {
  1082. m_RtDataKeys.Add("PMC.IsSlitDoorClosed");
  1083. m_RtDataKeys.Add("PMC.CurrentRecipeResult");
  1084. m_RtDataKeys.Add("PMC.IsOnline");
  1085. m_RtDataKeys.Add("PMC.CalculationPressure");
  1086. }
  1087. if (PMDIsInstalled == true)
  1088. {
  1089. m_RtDataKeys.Add("PMD.IsSlitDoorClosed");
  1090. m_RtDataKeys.Add("PMD.CurrentRecipeResult");
  1091. m_RtDataKeys.Add("PMD.IsOnline");
  1092. m_RtDataKeys.Add("PMD.CalculationPressure");
  1093. }
  1094. if (TMIsInstalled == true)
  1095. {
  1096. m_RtDataKeys.Add("TM.LLATSlitDoor.IsClosed");
  1097. m_RtDataKeys.Add("TM.LLBTSlitDoor.IsClosed");
  1098. m_RtDataKeys.Add("TM.LLAESlitDoor.IsClosed");
  1099. m_RtDataKeys.Add("TM.LLBESlitDoor.IsClosed");
  1100. m_RtDataKeys.Add("TM.IsOnline");
  1101. m_RtDataKeys.Add("TM.TMProcessGauge.Value");
  1102. m_RtDataKeys.Add("TM.TMATMSwitch.Value");
  1103. m_RtDataKeys.Add("TM.TMVacSwitch.Value");
  1104. m_RtDataKeys.Add("TM.TMProcessGauge.Value");
  1105. m_RtDataKeys.Add("TM.TMLidClosed");
  1106. m_RtDataKeys.Add("TM.LLALidClosed");
  1107. m_RtDataKeys.Add("TM.LLBLidClosed");
  1108. m_RtDataKeys.Add("TM.PMASlitDoor.IsClosed");
  1109. m_RtDataKeys.Add("TM.PMBSlitDoor.IsClosed");
  1110. m_RtDataKeys.Add("TM.PMCSlitDoor.IsClosed");
  1111. m_RtDataKeys.Add("TM.PMDSlitDoor.IsClosed");
  1112. }
  1113. if (LLAIsInstalled == true)
  1114. {
  1115. m_RtDataKeys.Add("LLA.IsOnline");
  1116. m_RtDataKeys.Add($"TM.LLAPressureGauge.Value");
  1117. m_RtDataKeys.Add($"TM.LLAVacSwitch.Value");
  1118. m_RtDataKeys.Add($"TM.LLAATMSwitch.Value");
  1119. }
  1120. if (LLBIsInstalled == true)
  1121. {
  1122. m_RtDataKeys.Add("LLB.IsOnline");
  1123. m_RtDataKeys.Add($"TM.LLBPressureGauge.Value");
  1124. m_RtDataKeys.Add($"TM.LLBVacSwitch.Value");
  1125. m_RtDataKeys.Add($"TM.LLBATMSwitch.Value");
  1126. }
  1127. if (EFEMIsInstalled == true)
  1128. {
  1129. m_RtDataKeys.Add("LP1.IsLoaded");
  1130. m_RtDataKeys.Add("LP2.IsLoaded");
  1131. m_RtDataKeys.Add("LP3.IsLoaded");
  1132. m_RtDataKeys.Add("LP1.CassettePlaced");
  1133. m_RtDataKeys.Add("LP2.CassettePlaced");
  1134. m_RtDataKeys.Add("LP3.CassettePlaced");
  1135. m_RtDataKeys.Add("LP1.CurrentControlJob");
  1136. m_RtDataKeys.Add("LP2.CurrentControlJob");
  1137. m_RtDataKeys.Add("LP3.CurrentControlJob");
  1138. m_RtDataKeys.Add("EFEM.IsOnline");
  1139. }
  1140. m_RtDataKeys.Add("System.IsAutoMode");
  1141. m_RtDataKeys.Add("System.IsBusy");
  1142. m_RtDataKeys.Add("Scheduler.CycledCount");
  1143. m_RtDataKeys.Add("Scheduler.CycledWafer");
  1144. m_RtDataKeys.Add("Scheduler.CycleSetPoint");
  1145. m_RtDataKeys.Add("Scheduler.Throughput");
  1146. m_RtDataKeys.Add("EquipmentStatus");
  1147. m_RtDataKeys.Add("Scheduler.PjNameList");
  1148. }
  1149. private void AssociateSequence(WaferAssociationInfo info, bool flag, int slot = -1)
  1150. {
  1151. List<WaferInfo> wafers = info.ModuleData.WaferManager.Wafers;
  1152. if (slot >= 0) //by wafer
  1153. {
  1154. int index = wafers.Count - slot - 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. else //by from-to
  1164. {
  1165. for (int i = info.SlotFrom - 1; i < info.SlotTo; i++)
  1166. {
  1167. int index = wafers.Count - i - 1;
  1168. if (index < wafers.Count)
  1169. {
  1170. if (flag && HasWaferOnSlot(wafers, index))
  1171. wafers[index].SequenceName = info.SequenceName;
  1172. else
  1173. wafers[index].SequenceName = string.Empty;
  1174. }
  1175. }
  1176. }
  1177. switch (info.ModuleData.ModuleID)
  1178. {
  1179. case "LP1":
  1180. LP1WaferAssociation = info;
  1181. break;
  1182. case "LP2":
  1183. LP2WaferAssociation = info;
  1184. break;
  1185. case "LP3":
  1186. LP3WaferAssociation = info;
  1187. break;
  1188. }
  1189. }
  1190. private bool HasWaferOnSlot(List<WaferInfo> wafers, int index)
  1191. {
  1192. if (wafers[index].WaferStatus == 0)
  1193. return false;
  1194. return true;
  1195. }
  1196. private async Task ChangePosition(WaferRobotTAction waferRobotTAction)
  1197. {
  1198. await Task.Delay(500);
  1199. int delay = 500;
  1200. if (waferRobotTAction == WaferRobotTAction.LP1)
  1201. {
  1202. CurrentRobotPosition = RobotPosition.Left;
  1203. await Task.Delay(delay);
  1204. }
  1205. else if (waferRobotTAction == WaferRobotTAction.LP3)
  1206. {
  1207. CurrentRobotPosition = RobotPosition.Right;
  1208. await Task.Delay(delay);
  1209. }
  1210. else if (waferRobotTAction == WaferRobotTAction.LP2)
  1211. {
  1212. CurrentRobotPosition = RobotPosition.Middle;
  1213. await Task.Delay(delay);
  1214. }
  1215. else
  1216. {
  1217. CurrentRobotPosition = RobotPosition.Origin;
  1218. await Task.Delay(delay);
  1219. }
  1220. }
  1221. #endregion
  1222. }
  1223. }