OperationOverViewModel.cs 26 KB

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