OperationOverViewModel.cs 51 KB

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