OperationOverViewModel.cs 25 KB

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