OperationOverViewModel.cs 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650
  1. using MECF.Framework.Common.CommonData;
  2. using MECF.Framework.Common.DataCenter;
  3. using MECF.Framework.Common.Equipment;
  4. using MECF.Framework.Common.OperationCenter;
  5. using OpenSEMI.ClientBase;
  6. using Prism.Commands;
  7. using Prism.Mvvm;
  8. using System;
  9. using System.Collections.Generic;
  10. using System.Linq;
  11. using System.Text;
  12. using System.Threading.Tasks;
  13. using System.Windows.Threading;
  14. using Venus_MainPages.Unity;
  15. using Venus_Themes.CustomControls;
  16. namespace Venus_MainPages.ViewModels
  17. {
  18. public class OperationOverViewModel : BindableBase
  19. {
  20. #region 私有字段
  21. private bool m_TabIsChecked=true;
  22. private ModuleInfo m_LP1ModuleInfo;
  23. private ModuleInfo m_LP2ModuleInfo;
  24. private ModuleInfo m_LP3ModuleInfo;
  25. private WaferRobotTAction m_Robot1TAction;
  26. private WaferRobotXAction m_Robot1XAction;
  27. private WaferRobotTAction m_Robot2TAction;
  28. private WaferRobotXAction m_Robot2XAction;
  29. private RobotMoveInfo m_robotMoveInfo;
  30. int arm1oldWaferStatus = 100;
  31. int arm2oldWaferStatus = 100;
  32. private WaferInfo m_PMAWafer;
  33. private WaferInfo m_PMBWafer;
  34. private WaferInfo m_PMCWafer;
  35. private WaferInfo m_PMDWafer;
  36. private WaferInfo m_LLAWafer;
  37. private WaferInfo m_LLBWafer;
  38. private WaferInfo m_TMBladeAWafer;
  39. private WaferInfo m_TMBladeBWafer;
  40. private List<string> m_RtDataKeys = new List<string>();
  41. private Dictionary<string, object> m_RtDataValues;
  42. private bool m_PMAIsInstalled;
  43. private bool m_PMBIsInstalled;
  44. private bool m_PMCIsInstalled;
  45. private bool m_PMDIsInstalled;
  46. private bool m_LLAIsInstalled;
  47. private bool m_LLBIsInstalled;
  48. private bool m_TMIsInstalled;
  49. private bool m_EFEMIsInstalled;
  50. private WaferInfo m_EFEMBladeAWafer;
  51. private WaferInfo m_EFEMBladeBWafer;
  52. private WaferInfo m_Aligner1Wafer;
  53. private int m_LP1WaferCount;
  54. private int m_LP2WaferCount;
  55. private int m_LP3WaferCount;
  56. private WaferAssociationInfo _lp1WaferAssociation;
  57. private WaferAssociationInfo _lp2WaferAssociation;
  58. private WaferAssociationInfo _lp3WaferAssociation;
  59. #endregion
  60. #region 属性
  61. public bool TabIsChecked
  62. {
  63. get { return m_TabIsChecked; }
  64. set { SetProperty(ref m_TabIsChecked, value); }
  65. }
  66. public ModuleInfo LP1ModuleInfo
  67. {
  68. get { return m_LP1ModuleInfo; }
  69. set { SetProperty(ref m_LP1ModuleInfo, value); }
  70. }
  71. public ModuleInfo LP2ModuleInfo
  72. {
  73. get { return m_LP2ModuleInfo; }
  74. set { SetProperty(ref m_LP2ModuleInfo, value); }
  75. }
  76. public ModuleInfo LP3ModuleInfo
  77. {
  78. get { return m_LP3ModuleInfo; }
  79. set { SetProperty(ref m_LP3ModuleInfo, value); }
  80. }
  81. public WaferRobotTAction Robot1TAction
  82. {
  83. get { return m_Robot1TAction; }
  84. set { SetProperty(ref m_Robot1TAction, value); }
  85. }
  86. public WaferRobotXAction Robot1XAction
  87. {
  88. get { return m_Robot1XAction; }
  89. set { SetProperty(ref m_Robot1XAction, value); }
  90. }
  91. public WaferRobotTAction Robot2TAction
  92. {
  93. get { return m_Robot2TAction; }
  94. set { SetProperty(ref m_Robot2TAction, value); }
  95. }
  96. public WaferRobotXAction Robot2XAction
  97. {
  98. get { return m_Robot2XAction; }
  99. set { SetProperty(ref m_Robot2XAction, value); }
  100. }
  101. public RobotMoveInfo RobotMoveInfo
  102. {
  103. get { return m_robotMoveInfo; }
  104. set
  105. {
  106. RobotMoveInfoChanged(m_robotMoveInfo, value);
  107. m_robotMoveInfo = value;
  108. }
  109. }
  110. public WaferInfo LLAWafer
  111. {
  112. get { return m_LLAWafer; }
  113. set { SetProperty(ref m_LLAWafer, value); }
  114. }
  115. public WaferInfo LLBWafer
  116. {
  117. get { return m_LLBWafer; }
  118. set { SetProperty(ref m_LLBWafer, value); }
  119. }
  120. public WaferInfo PMAWafer
  121. {
  122. get { return m_PMAWafer; }
  123. set { SetProperty(ref m_PMAWafer, value); }
  124. }
  125. public WaferInfo PMBWafer
  126. {
  127. get { return m_PMBWafer; }
  128. set { SetProperty(ref m_PMBWafer, value); }
  129. }
  130. public WaferInfo PMCWafer
  131. {
  132. get { return m_PMCWafer; }
  133. set { SetProperty(ref m_PMCWafer, value); }
  134. }
  135. public WaferInfo PMDWafer
  136. {
  137. get { return m_PMDWafer; }
  138. set { SetProperty(ref m_PMDWafer, value); }
  139. }
  140. public WaferInfo TMBladeAWafer
  141. {
  142. get { return m_TMBladeAWafer; }
  143. set { SetProperty(ref m_TMBladeAWafer, value); }
  144. }
  145. public WaferInfo TMBladeBWafer
  146. {
  147. get { return m_TMBladeBWafer; }
  148. set { SetProperty(ref m_TMBladeBWafer, value); }
  149. }
  150. public Dictionary<string, object> RtDataValues
  151. {
  152. get { return m_RtDataValues; }
  153. set { SetProperty(ref m_RtDataValues, value); }
  154. }
  155. public bool PMAIsInstalled
  156. {
  157. get { return m_PMAIsInstalled; }
  158. set { SetProperty(ref m_PMAIsInstalled, value); }
  159. }
  160. public bool PMBIsInstalled
  161. {
  162. get { return m_PMBIsInstalled; }
  163. set { SetProperty(ref m_PMBIsInstalled, value); }
  164. }
  165. public bool PMCIsInstalled
  166. {
  167. get { return m_PMCIsInstalled; }
  168. set { SetProperty(ref m_PMCIsInstalled, value); }
  169. }
  170. public bool PMDIsInstalled
  171. {
  172. get { return m_PMDIsInstalled; }
  173. set { SetProperty(ref m_PMDIsInstalled, value); }
  174. }
  175. public bool LLAIsInstalled
  176. {
  177. get { return m_LLAIsInstalled; }
  178. set { SetProperty(ref m_LLAIsInstalled, value); }
  179. }
  180. public bool LLBIsInstalled
  181. {
  182. get { return m_LLBIsInstalled; }
  183. set { SetProperty(ref m_LLBIsInstalled, value); }
  184. }
  185. public bool TMIsInstalled
  186. {
  187. get { return m_TMIsInstalled; }
  188. set { SetProperty(ref m_TMIsInstalled, value); }
  189. }
  190. public bool EFEMIsInstalled
  191. {
  192. get { return m_EFEMIsInstalled; }
  193. set { SetProperty(ref m_EFEMIsInstalled, value); }
  194. }
  195. public WaferInfo EFEMBladeAWafer
  196. {
  197. get { return m_EFEMBladeAWafer; }
  198. set { SetProperty(ref m_EFEMBladeAWafer, value); }
  199. }
  200. public WaferInfo EFEMBladeBWafer
  201. {
  202. get { return m_EFEMBladeBWafer; }
  203. set { SetProperty(ref m_EFEMBladeBWafer, value); }
  204. }
  205. public WaferInfo Aligner1Wafer
  206. {
  207. get { return m_Aligner1Wafer; }
  208. set { SetProperty(ref m_Aligner1Wafer, value); }
  209. }
  210. public int LP1WaferCount
  211. {
  212. get { return m_LP1WaferCount; }
  213. set { SetProperty(ref m_LP1WaferCount, value); }
  214. }
  215. public int LP2WaferCount
  216. {
  217. get { return m_LP2WaferCount; }
  218. set { SetProperty(ref m_LP2WaferCount, value); }
  219. }
  220. public int LP3WaferCount
  221. {
  222. get { return m_LP3WaferCount; }
  223. set { SetProperty(ref m_LP3WaferCount, value); }
  224. }
  225. public WaferAssociationInfo LP1WaferAssociation
  226. {
  227. get { return _lp1WaferAssociation; }
  228. set { SetProperty(ref _lp1WaferAssociation, value); }
  229. }
  230. public WaferAssociationInfo LP2WaferAssociation
  231. {
  232. get { return _lp2WaferAssociation; }
  233. set { SetProperty(ref _lp2WaferAssociation, value); }
  234. }
  235. public WaferAssociationInfo LP3WaferAssociation
  236. {
  237. get { return _lp3WaferAssociation; }
  238. set { SetProperty(ref _lp3WaferAssociation, value); }
  239. }
  240. #endregion
  241. #region 命令
  242. private DelegateCommand _LoadCommand;
  243. public DelegateCommand LoadCommand =>
  244. _LoadCommand ?? (_LoadCommand = new DelegateCommand(OnLoad));
  245. private DelegateCommand<object> _LoadWaferCommand;
  246. public DelegateCommand<object> LoadWaferCommand =>
  247. _LoadWaferCommand ?? (_LoadWaferCommand = new DelegateCommand<object>(OnLoadWafer));
  248. private DelegateCommand<object> _UnLoadWaferCommand;
  249. public DelegateCommand<object> UnLoadWaferCommand =>
  250. _UnLoadWaferCommand ?? (_UnLoadWaferCommand = new DelegateCommand<object>(OnUnLoadWafer));
  251. private DelegateCommand<object> _SelectAllCommand;
  252. public DelegateCommand<object> SelectAllCommand =>
  253. _SelectAllCommand ?? (_SelectAllCommand = new DelegateCommand<object>(OnSelectAll));
  254. private DelegateCommand<object> _UnSelectAllCommand;
  255. public DelegateCommand<object> UnSelectAllCommand =>
  256. _UnSelectAllCommand ?? (_UnSelectAllCommand = new DelegateCommand<object>(OnUnSelectAll));
  257. private DelegateCommand<object> _StartCommand;
  258. public DelegateCommand<object> StartCommand =>
  259. _StartCommand ?? (_StartCommand = new DelegateCommand<object>(OnStart));
  260. private DelegateCommand<object> _StopCommand;
  261. public DelegateCommand<object> StopCommand =>
  262. _StopCommand ?? (_StopCommand = new DelegateCommand<object>(OnStop));
  263. private DelegateCommand<object> _AbortCommand;
  264. public DelegateCommand<object> AbortCommand =>
  265. _AbortCommand ?? (_AbortCommand = new DelegateCommand<object>(OnAbort));
  266. private DelegateCommand _HomeAllCommand;
  267. public DelegateCommand HomeAllCommand =>
  268. _HomeAllCommand ?? (_HomeAllCommand = new DelegateCommand(OnHomeAll));
  269. private DelegateCommand _PauseAllJobCommand;
  270. public DelegateCommand PauseAllJobCommand =>
  271. _PauseAllJobCommand ?? (_PauseAllJobCommand = new DelegateCommand(OnPauseAllJob));
  272. private DelegateCommand _AbortAllCommand;
  273. public DelegateCommand AbortAllCommand =>
  274. _AbortAllCommand ?? (_AbortAllCommand = new DelegateCommand(OnAbortAll));
  275. private DelegateCommand _ReturnAllWaferCommand;
  276. public DelegateCommand ReturnAllWaferCommand =>
  277. _ReturnAllWaferCommand ?? (_ReturnAllWaferCommand = new DelegateCommand(OnReturnAllWafer));
  278. private DelegateCommand _SetSequenceCommand;
  279. public DelegateCommand SetSequenceCommand =>
  280. _SetSequenceCommand ?? (_SetSequenceCommand = new DelegateCommand(OnSetSequence));
  281. private DelegateCommand<object> _CreateJobCommand;
  282. public DelegateCommand<object> CreateJobCommand =>
  283. _CreateJobCommand ?? (_CreateJobCommand = new DelegateCommand<object>(OnCreateJob));
  284. private DelegateCommand _EnableAutoCommand;
  285. public DelegateCommand EnableAutoCommand =>
  286. _EnableAutoCommand ?? (_EnableAutoCommand = new DelegateCommand(OnEnableAuto));
  287. private DelegateCommand _EnableManualCommand;
  288. public DelegateCommand EnableManualCommand =>
  289. _EnableManualCommand ?? (_EnableManualCommand = new DelegateCommand(OnEnableManual));
  290. #endregion
  291. #region 构造函数
  292. public OperationOverViewModel()
  293. {
  294. DispatcherTimer timer = new DispatcherTimer();
  295. timer.Interval = TimeSpan.FromSeconds(0.5);
  296. timer.Tick += Timer_Tick;
  297. timer.Start();
  298. addDataKeys();
  299. string allModules = QueryDataClient.Instance.Service.GetConfig($"System.InstalledModules").ToString();
  300. PMAIsInstalled = allModules.Contains("PMA");
  301. PMBIsInstalled = allModules.Contains("PMB");
  302. PMCIsInstalled = allModules.Contains("PMC");
  303. PMDIsInstalled = allModules.Contains("PMD");
  304. LLAIsInstalled = allModules.Contains("LLA");
  305. LLBIsInstalled = allModules.Contains("LLB");
  306. EFEMIsInstalled = allModules.Contains("EFEM");
  307. }
  308. #endregion
  309. #region 命令方法
  310. private void OnLoad()
  311. {
  312. LP1WaferAssociation = new WaferAssociationInfo();
  313. LP1WaferAssociation.ModuleData = ModuleManager.ModuleInfos["LP1"];
  314. LP2WaferAssociation = new WaferAssociationInfo();
  315. LP2WaferAssociation.ModuleData = ModuleManager.ModuleInfos["LP2"];
  316. LP3WaferAssociation = new WaferAssociationInfo();
  317. LP3WaferAssociation.ModuleData = ModuleManager.ModuleInfos["LP3"];
  318. }
  319. private void OnLoadWafer(object obj)
  320. {
  321. InvokeClient.Instance.Service.DoOperation($"{obj.ToString()}.Load", ModuleManager.ModuleInfos[obj.ToString()].ModuleID);
  322. }
  323. private void OnUnLoadWafer(object obj)
  324. {
  325. InvokeClient.Instance.Service.DoOperation($"{obj.ToString()}.UnLoad", ModuleManager.ModuleInfos[obj.ToString()].ModuleID);
  326. }
  327. private void OnSelectAll(object obj)
  328. {
  329. var info=obj as WaferAssociationInfo;
  330. info.SlotFrom = 1;
  331. info.SlotTo = 25;
  332. AssociateSequence(info, true);
  333. }
  334. private void OnUnSelectAll(object obj)
  335. {
  336. var info = obj as WaferAssociationInfo;
  337. info.SlotFrom = 1;
  338. info.SlotTo = 25;
  339. AssociateSequence(info, false);
  340. }
  341. private void OnStart(object obj)
  342. {
  343. InvokeClient.Instance.Service.DoOperation("System.StartJob", obj.ToString());
  344. }
  345. private void OnStop(object obj)
  346. {
  347. InvokeClient.Instance.Service.DoOperation("System.PauseJob", obj.ToString());
  348. }
  349. private void OnAbort(object obj)
  350. {
  351. InvokeClient.Instance.Service.DoOperation("System.ResumeJob", obj.ToString());
  352. }
  353. private void OnHomeAll()
  354. {
  355. InvokeClient.Instance.Service.DoOperation("System.HomeAll");
  356. }
  357. private void OnPauseAllJob()
  358. {
  359. InvokeClient.Instance.Service.DoOperation("System.PauseJob", LP1WaferAssociation.JobID);
  360. InvokeClient.Instance.Service.DoOperation("System.PauseJob", LP2WaferAssociation.JobID);
  361. InvokeClient.Instance.Service.DoOperation("System.PauseJob", LP3WaferAssociation.JobID);
  362. }
  363. private void OnAbortAll()
  364. {
  365. InvokeClient.Instance.Service.DoOperation("System.Abort");
  366. }
  367. private void OnReturnAllWafer()
  368. {
  369. InvokeClient.Instance.Service.DoOperation("System.Abort");
  370. }
  371. private void OnSetSequence()
  372. {
  373. //var info = obj as WaferAssociationInfo;
  374. }
  375. private void OnCreateJob(object obj)
  376. {
  377. var info = obj as WaferAssociationInfo;
  378. List<string> slotSequence = new List<string>();
  379. info.ModuleData.WaferManager.Wafers.ForEach(key => { slotSequence.Insert(0, key.SequenceName); });
  380. string jobId = info.LotId.Trim();
  381. if (string.IsNullOrEmpty(jobId))
  382. jobId = "CJ_Local_" + info.ModuleData.ModuleID;
  383. info.LotId = jobId;
  384. info.LotIdSaved = true;
  385. Dictionary<string, object> param = new Dictionary<string, object>()
  386. {
  387. {"JobId", jobId},
  388. {"Module", info.ModuleData.ModuleID},
  389. {"SlotSequence", slotSequence.ToArray()},
  390. {"AutoStart", true},
  391. };
  392. InvokeClient.Instance.Service.DoOperation("System.CreateJob", param);
  393. }
  394. private void OnEnableAuto()
  395. {
  396. InvokeClient.Instance.Service.DoOperation("System.SetAutoMode");
  397. }
  398. private void OnEnableManual()
  399. {
  400. InvokeClient.Instance.Service.DoOperation("System.SetManualMode");
  401. }
  402. #endregion
  403. #region 私有方法
  404. private void Timer_Tick(object sender, EventArgs e)
  405. {
  406. LP1ModuleInfo = ModuleManager.ModuleInfos["LP1"];
  407. LP2ModuleInfo = ModuleManager.ModuleInfos["LP2"];
  408. LP3ModuleInfo = ModuleManager.ModuleInfos["LP3"];
  409. if (LLAIsInstalled == true)
  410. {
  411. LLAWafer = ModuleManager.ModuleInfos["LLA"].WaferManager.Wafers.FirstOrDefault(x => x.WaferStatus != 0);
  412. }
  413. if (LLBIsInstalled == true)
  414. {
  415. LLBWafer = ModuleManager.ModuleInfos["LLB"].WaferManager.Wafers.FirstOrDefault(x => x.WaferStatus != 0);
  416. }
  417. if (PMAIsInstalled == true)
  418. {
  419. PMAWafer = ModuleManager.ModuleInfos["PMA"].WaferManager.Wafers[0];
  420. }
  421. if (PMBIsInstalled == true)
  422. {
  423. PMBWafer = ModuleManager.ModuleInfos["PMB"].WaferManager.Wafers[0];
  424. }
  425. if (PMCIsInstalled == true)
  426. {
  427. PMCWafer = ModuleManager.ModuleInfos["PMC"].WaferManager.Wafers[0];
  428. }
  429. if (PMDIsInstalled == true)
  430. {
  431. PMDWafer = ModuleManager.ModuleInfos["PMD"].WaferManager.Wafers[0];
  432. }
  433. if (TMIsInstalled == true)
  434. {
  435. TMBladeAWafer = ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[0];
  436. TMBladeBWafer = ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[1];
  437. }
  438. if (EFEMIsInstalled == true)
  439. {
  440. EFEMBladeAWafer = ModuleManager.ModuleInfos["EfemRobot"].WaferManager.Wafers[0];
  441. EFEMBladeBWafer = ModuleManager.ModuleInfos["EfemRobot"].WaferManager.Wafers[1];
  442. Aligner1Wafer = ModuleManager.ModuleInfos["Aligner1"].WaferManager.Wafers[0];
  443. }
  444. RobotMoveInfo = (RobotMoveInfo)QueryDataClient.Instance.Service.GetData("TM.RobotMoveAction");
  445. RtDataValues = QueryDataClient.Instance.Service.PollData(m_RtDataKeys);
  446. LP1WaferCount = LP1ModuleInfo.WaferManager.Wafers.Where(x=>x.WaferStatus!=0).Count();
  447. LP2WaferCount = LP2ModuleInfo.WaferManager.Wafers.Where(x => x.WaferStatus != 0).Count();
  448. LP3WaferCount = LP3ModuleInfo.WaferManager.Wafers.Where(x => x.WaferStatus != 0).Count();
  449. }
  450. private async void RobotMoveInfoChanged(RobotMoveInfo oldValue, RobotMoveInfo newValue)
  451. {
  452. string RobotTarget;
  453. if (oldValue == null || newValue == null)
  454. {
  455. return;
  456. }
  457. #region pick 和 place LL
  458. if (oldValue.Action == RobotAction.None && (newValue.Action == RobotAction.Placing || newValue.Action == RobotAction.Picking))
  459. {
  460. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  461. if (TMRobotMoveActionBladeTarget != null)
  462. {
  463. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  464. }
  465. else
  466. {
  467. return;
  468. }
  469. var values = RobotTarget.Split('.');
  470. var arm = values[0];
  471. var module = values[1];
  472. if (arm == "ArmA")
  473. {
  474. Robot1TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  475. await Task.Delay(1500);
  476. Robot1XAction = WaferRobotXAction.Extend;
  477. await Task.Delay(3000);
  478. Robot1XAction = WaferRobotXAction.Retract;
  479. }
  480. else if (arm == "ArmB")
  481. {
  482. Robot2TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  483. await Task.Delay(1500);
  484. Robot2XAction = WaferRobotXAction.Extend;
  485. await Task.Delay(3000);
  486. Robot2XAction = WaferRobotXAction.Retract;
  487. }
  488. }
  489. #endregion
  490. #region pick 和 place pm
  491. if (oldValue.Action == RobotAction.None && newValue.Action == RobotAction.Extending)
  492. {
  493. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  494. if (TMRobotMoveActionBladeTarget != null)
  495. {
  496. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  497. }
  498. else
  499. {
  500. return;
  501. }
  502. var values = RobotTarget.Split('.');
  503. var arm = values[0];
  504. var module = values[1];
  505. if (arm == "ArmA")
  506. {
  507. Robot1TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  508. await Task.Delay(1500);
  509. Robot1XAction = WaferRobotXAction.Extend;
  510. }
  511. else if (arm == "ArmB")
  512. {
  513. Robot2TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  514. await Task.Delay(1500);
  515. Robot2XAction = WaferRobotXAction.Extend;
  516. }
  517. }
  518. if (oldValue.Action == RobotAction.None && newValue.Action == RobotAction.Retracting)
  519. {
  520. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  521. if (TMRobotMoveActionBladeTarget != null)
  522. {
  523. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  524. }
  525. else
  526. {
  527. return;
  528. }
  529. var values = RobotTarget.Split('.');
  530. var arm = values[0];
  531. if (arm == "ArmA")
  532. {
  533. Robot1XAction = WaferRobotXAction.Retract;
  534. }
  535. else if (arm == "ArmB")
  536. {
  537. Robot2XAction = WaferRobotXAction.Retract;
  538. }
  539. }
  540. #endregion
  541. arm1oldWaferStatus = ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[0].WaferStatus;
  542. arm2oldWaferStatus = ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[1].WaferStatus;
  543. }
  544. private void addDataKeys()
  545. {
  546. m_RtDataKeys.Add("PMA.IsSlitDoorClosed");
  547. m_RtDataKeys.Add("PMB.IsSlitDoorClosed");
  548. m_RtDataKeys.Add("PMC.IsSlitDoorClosed");
  549. m_RtDataKeys.Add("PMD.IsSlitDoorClosed");
  550. m_RtDataKeys.Add("TM.LLATSlitDoor.IsClosed");
  551. m_RtDataKeys.Add("TM.LLBTSlitDoor.IsClosed");
  552. m_RtDataKeys.Add("System.IsAutoMode");
  553. }
  554. private void AssociateSequence(WaferAssociationInfo info, bool flag, int slot = -1)
  555. {
  556. List<WaferInfo> wafers = info.ModuleData.WaferManager.Wafers;
  557. if (slot >= 0) //by wafer
  558. {
  559. int index = wafers.Count - slot - 1;
  560. if (index < wafers.Count)
  561. {
  562. if (flag && HasWaferOnSlot(wafers, index))
  563. wafers[index].SequenceName = info.SequenceName;
  564. else
  565. wafers[index].SequenceName = string.Empty;
  566. }
  567. }
  568. else //by from-to
  569. {
  570. for (int i = info.SlotFrom - 1; i < info.SlotTo; i++)
  571. {
  572. int index = wafers.Count - i - 1;
  573. if (index < wafers.Count)
  574. {
  575. if (flag && HasWaferOnSlot(wafers, index))
  576. wafers[index].SequenceName = info.SequenceName;
  577. else
  578. wafers[index].SequenceName = string.Empty;
  579. }
  580. }
  581. }
  582. }
  583. private bool HasWaferOnSlot(List<WaferInfo> wafers, int index)
  584. {
  585. if (wafers[index].WaferStatus == 0)
  586. return false;
  587. return true;
  588. }
  589. #endregion
  590. }
  591. }