OperationOverViewModel.cs 38 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019
  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;
  14. using System.Windows.Threading;
  15. using Venus_Core;
  16. using Venus_MainPages.Unity;
  17. using Venus_MainPages.Views;
  18. using Venus_Themes.CustomControls;
  19. using Venus_Themes.Unity;
  20. using static Venus_Themes.UserControls.EFEM;
  21. namespace Venus_MainPages.ViewModels
  22. {
  23. public class OperationOverViewModel : BindableBase
  24. {
  25. #region 私有字段
  26. private bool m_TabIsChecked=true;
  27. private ModuleInfo m_LP1ModuleInfo;
  28. private ModuleInfo m_LP2ModuleInfo;
  29. private ModuleInfo m_LLAModuleInfo;
  30. private ModuleInfo m_LLBModuleInfo;
  31. private ModuleInfo m_LP3ModuleInfo;
  32. private ModuleInfo m_EFEMModuleInfo;
  33. private ModuleInfo m_TMModuleInfo;
  34. private WaferRobotTAction m_Robot1TAction;
  35. private WaferRobotXAction m_Robot1XAction;
  36. private WaferRobotTAction m_Robot2TAction;
  37. private WaferRobotXAction m_Robot2XAction;
  38. private WaferRobotTAction m_Robot3TAction;
  39. private WaferRobotXAction m_Robot3XAction;
  40. private WaferRobotTAction m_Robot4TAction;
  41. private WaferRobotXAction m_Robot4XAction;
  42. private RobotMoveInfo m_robotMoveInfo;
  43. int arm1oldWaferStatus = 100;
  44. int arm2oldWaferStatus = 100;
  45. private WaferInfo m_PMAWafer;
  46. private WaferInfo m_PMBWafer;
  47. private WaferInfo m_PMCWafer;
  48. private WaferInfo m_PMDWafer;
  49. private WaferInfo m_LLAWafer;
  50. private WaferInfo m_LLBWafer;
  51. private WaferInfo m_TMBladeAWafer;
  52. private WaferInfo m_TMBladeBWafer;
  53. private List<string> m_RtDataKeys = new List<string>();
  54. private Dictionary<string, object> m_RtDataValues;
  55. private bool m_PMAIsInstalled;
  56. private bool m_PMBIsInstalled;
  57. private bool m_PMCIsInstalled;
  58. private bool m_PMDIsInstalled;
  59. private bool m_LLAIsInstalled;
  60. private bool m_LLBIsInstalled;
  61. private bool m_TMIsInstalled;
  62. private bool m_EFEMIsInstalled;
  63. private WaferInfo m_EFEMBladeAWafer;
  64. private WaferInfo m_EFEMBladeBWafer;
  65. private WaferInfo m_Aligner1Wafer;
  66. private int m_LP1WaferCount;
  67. private int m_LP2WaferCount;
  68. private int m_LP3WaferCount;
  69. private WaferAssociationInfo _lp1WaferAssociation;
  70. private WaferAssociationInfo _lp2WaferAssociation;
  71. private WaferAssociationInfo _lp3WaferAssociation;
  72. private int m_CycledWafer;
  73. private int m_CycleCountDisplay;
  74. private RobotPosition m_CurrentRobotPosition;
  75. private WaferInfo m_BladeAWafer;
  76. private WaferInfo m_BladeBWafer;
  77. private RecipeResult m_PMARecipeResult;
  78. private RecipeResult m_PMBRecipeResult;
  79. private RecipeResult m_PMCRecipeResult;
  80. private RecipeResult m_PMDRecipeResult;
  81. #endregion
  82. #region 属性
  83. public bool TabIsChecked
  84. {
  85. get { return m_TabIsChecked; }
  86. set { SetProperty(ref m_TabIsChecked, value); }
  87. }
  88. public ModuleInfo LP1ModuleInfo
  89. {
  90. get { return m_LP1ModuleInfo; }
  91. set { SetProperty(ref m_LP1ModuleInfo, value); }
  92. }
  93. public ModuleInfo LLAModuleInfo
  94. {
  95. get { return m_LLAModuleInfo; }
  96. set { SetProperty(ref m_LLAModuleInfo, value); }
  97. }
  98. public ModuleInfo LLBModuleInfo
  99. {
  100. get { return m_LLBModuleInfo; }
  101. set { SetProperty(ref m_LLBModuleInfo, value); }
  102. }
  103. public ModuleInfo EFEMModuleInfo
  104. {
  105. get { return m_EFEMModuleInfo; }
  106. set { SetProperty(ref m_EFEMModuleInfo, value); }
  107. }
  108. public ModuleInfo TMModuleInfo
  109. {
  110. get { return m_TMModuleInfo; }
  111. set { SetProperty(ref m_TMModuleInfo, value); }
  112. }
  113. public ModuleInfo LP2ModuleInfo
  114. {
  115. get { return m_LP2ModuleInfo; }
  116. set { SetProperty(ref m_LP2ModuleInfo, value); }
  117. }
  118. public ModuleInfo LP3ModuleInfo
  119. {
  120. get { return m_LP3ModuleInfo; }
  121. set { SetProperty(ref m_LP3ModuleInfo, value); }
  122. }
  123. public WaferRobotTAction Robot1TAction
  124. {
  125. get { return m_Robot1TAction; }
  126. set { SetProperty(ref m_Robot1TAction, value); }
  127. }
  128. public WaferRobotXAction Robot1XAction
  129. {
  130. get { return m_Robot1XAction; }
  131. set { SetProperty(ref m_Robot1XAction, value); }
  132. }
  133. public WaferRobotTAction Robot2TAction
  134. {
  135. get { return m_Robot2TAction; }
  136. set { SetProperty(ref m_Robot2TAction, value); }
  137. }
  138. public WaferRobotXAction Robot2XAction
  139. {
  140. get { return m_Robot2XAction; }
  141. set { SetProperty(ref m_Robot2XAction, value); }
  142. }
  143. public WaferRobotTAction Robot3TAction
  144. {
  145. get{ return m_Robot3TAction;}
  146. set{SetProperty(ref m_Robot3TAction ,value);}
  147. }
  148. public WaferRobotXAction Robot3XAction
  149. {
  150. get{ return m_Robot3XAction;}
  151. set{SetProperty(ref m_Robot3XAction ,value);}
  152. }
  153. public WaferRobotTAction Robot4TAction
  154. {
  155. get{ return m_Robot4TAction;}
  156. set{SetProperty(ref m_Robot4TAction ,value);}
  157. }
  158. public WaferRobotXAction Robot4XAction
  159. {
  160. get{ return m_Robot4XAction;}
  161. set{SetProperty(ref m_Robot4XAction, value);}
  162. }
  163. public RobotMoveInfo RobotMoveInfo
  164. {
  165. get { return m_robotMoveInfo; }
  166. set
  167. {
  168. RobotMoveInfoChanged(m_robotMoveInfo, value);
  169. m_robotMoveInfo = value;
  170. }
  171. }
  172. public WaferInfo LLAWafer
  173. {
  174. get { return m_LLAWafer; }
  175. set { SetProperty(ref m_LLAWafer, value); }
  176. }
  177. public WaferInfo LLBWafer
  178. {
  179. get { return m_LLBWafer; }
  180. set { SetProperty(ref m_LLBWafer, value); }
  181. }
  182. public WaferInfo PMAWafer
  183. {
  184. get { return m_PMAWafer; }
  185. set { SetProperty(ref m_PMAWafer, value); }
  186. }
  187. public WaferInfo PMBWafer
  188. {
  189. get { return m_PMBWafer; }
  190. set { SetProperty(ref m_PMBWafer, value); }
  191. }
  192. public WaferInfo PMCWafer
  193. {
  194. get { return m_PMCWafer; }
  195. set { SetProperty(ref m_PMCWafer, value); }
  196. }
  197. public WaferInfo PMDWafer
  198. {
  199. get { return m_PMDWafer; }
  200. set { SetProperty(ref m_PMDWafer, value); }
  201. }
  202. public WaferInfo TMBladeAWafer
  203. {
  204. get { return m_TMBladeAWafer; }
  205. set { SetProperty(ref m_TMBladeAWafer, value); }
  206. }
  207. public WaferInfo TMBladeBWafer
  208. {
  209. get { return m_TMBladeBWafer; }
  210. set { SetProperty(ref m_TMBladeBWafer, value); }
  211. }
  212. public Dictionary<string, object> RtDataValues
  213. {
  214. get { return m_RtDataValues; }
  215. set { SetProperty(ref m_RtDataValues, value); }
  216. }
  217. public bool PMAIsInstalled
  218. {
  219. get { return m_PMAIsInstalled; }
  220. set { SetProperty(ref m_PMAIsInstalled, value); }
  221. }
  222. public bool PMBIsInstalled
  223. {
  224. get { return m_PMBIsInstalled; }
  225. set { SetProperty(ref m_PMBIsInstalled, value); }
  226. }
  227. public bool PMCIsInstalled
  228. {
  229. get { return m_PMCIsInstalled; }
  230. set { SetProperty(ref m_PMCIsInstalled, value); }
  231. }
  232. public bool PMDIsInstalled
  233. {
  234. get { return m_PMDIsInstalled; }
  235. set { SetProperty(ref m_PMDIsInstalled, value); }
  236. }
  237. public bool LLAIsInstalled
  238. {
  239. get { return m_LLAIsInstalled; }
  240. set { SetProperty(ref m_LLAIsInstalled, value); }
  241. }
  242. public bool LLBIsInstalled
  243. {
  244. get { return m_LLBIsInstalled; }
  245. set { SetProperty(ref m_LLBIsInstalled, value); }
  246. }
  247. public bool TMIsInstalled
  248. {
  249. get { return m_TMIsInstalled; }
  250. set { SetProperty(ref m_TMIsInstalled, value); }
  251. }
  252. public bool EFEMIsInstalled
  253. {
  254. get { return m_EFEMIsInstalled; }
  255. set { SetProperty(ref m_EFEMIsInstalled, value); }
  256. }
  257. public WaferInfo EFEMBladeAWafer
  258. {
  259. get { return m_EFEMBladeAWafer; }
  260. set { SetProperty(ref m_EFEMBladeAWafer, value); }
  261. }
  262. public WaferInfo EFEMBladeBWafer
  263. {
  264. get { return m_EFEMBladeBWafer; }
  265. set { SetProperty(ref m_EFEMBladeBWafer, value); }
  266. }
  267. public WaferInfo Aligner1Wafer
  268. {
  269. get { return m_Aligner1Wafer; }
  270. set { SetProperty(ref m_Aligner1Wafer, value); }
  271. }
  272. public int LP1WaferCount
  273. {
  274. get { return m_LP1WaferCount; }
  275. set { SetProperty(ref m_LP1WaferCount, value); }
  276. }
  277. public int LP2WaferCount
  278. {
  279. get { return m_LP2WaferCount; }
  280. set { SetProperty(ref m_LP2WaferCount, value); }
  281. }
  282. public int LP3WaferCount
  283. {
  284. get { return m_LP3WaferCount; }
  285. set { SetProperty(ref m_LP3WaferCount, value); }
  286. }
  287. public WaferAssociationInfo LP1WaferAssociation
  288. {
  289. get { return _lp1WaferAssociation; }
  290. set { SetProperty(ref _lp1WaferAssociation, value); }
  291. }
  292. public WaferAssociationInfo LP2WaferAssociation
  293. {
  294. get { return _lp2WaferAssociation; }
  295. set { SetProperty(ref _lp2WaferAssociation, value); }
  296. }
  297. public WaferAssociationInfo LP3WaferAssociation
  298. {
  299. get { return _lp3WaferAssociation; }
  300. set { SetProperty(ref _lp3WaferAssociation, value); }
  301. }
  302. public int CycledWafer
  303. {
  304. get { return m_CycledWafer; }
  305. set { SetProperty(ref m_CycledWafer, value); }
  306. }
  307. public int CycleCountDisplay
  308. {
  309. get { return m_CycleCountDisplay; }
  310. set { SetProperty(ref m_CycleCountDisplay, value); }
  311. }
  312. public RobotMoveInfo m_EfemRobotMoveInfo;
  313. public RobotMoveInfo EfemRobotMoveInfo
  314. {
  315. get { return m_EfemRobotMoveInfo; }
  316. set
  317. {
  318. EFEMRobotMoveInfoChanged(m_EfemRobotMoveInfo, value);
  319. m_EfemRobotMoveInfo = value;
  320. }
  321. }
  322. public RobotPosition CurrentRobotPosition
  323. {
  324. get { return m_CurrentRobotPosition; }
  325. set { SetProperty(ref m_CurrentRobotPosition, value); }
  326. }
  327. public WaferInfo BladeAWafer
  328. {
  329. get { return m_BladeAWafer; }
  330. set { SetProperty(ref m_BladeAWafer, value); }
  331. }
  332. public WaferInfo BladeBWafer
  333. {
  334. get { return m_BladeBWafer; }
  335. set { SetProperty(ref m_BladeBWafer, value); }
  336. }
  337. public RecipeResult PMARecipeResult
  338. {
  339. get { return m_PMARecipeResult; }
  340. set { SetProperty(ref m_PMARecipeResult, value); }
  341. }
  342. public RecipeResult PMBRecipeResult
  343. {
  344. get { return m_PMBRecipeResult; }
  345. set { SetProperty(ref m_PMBRecipeResult, value); }
  346. }
  347. public RecipeResult PMCRecipeResult
  348. {
  349. get { return m_PMCRecipeResult; }
  350. set { SetProperty(ref m_PMCRecipeResult, value); }
  351. }
  352. public RecipeResult PMDRecipeResult
  353. {
  354. get { return m_PMDRecipeResult; }
  355. set { SetProperty(ref m_PMDRecipeResult, value); }
  356. }
  357. #endregion
  358. #region 命令
  359. private DelegateCommand _LoadCommand;
  360. public DelegateCommand LoadCommand =>
  361. _LoadCommand ?? (_LoadCommand = new DelegateCommand(OnLoad));
  362. private DelegateCommand<object> _LoadWaferCommand;
  363. public DelegateCommand<object> LoadWaferCommand =>
  364. _LoadWaferCommand ?? (_LoadWaferCommand = new DelegateCommand<object>(OnLoadWafer));
  365. private DelegateCommand<object> _UnLoadWaferCommand;
  366. public DelegateCommand<object> UnLoadWaferCommand =>
  367. _UnLoadWaferCommand ?? (_UnLoadWaferCommand = new DelegateCommand<object>(OnUnLoadWafer));
  368. private DelegateCommand<object> _SelectAllCommand;
  369. public DelegateCommand<object> SelectAllCommand =>
  370. _SelectAllCommand ?? (_SelectAllCommand = new DelegateCommand<object>(OnSelectAll));
  371. private DelegateCommand<object> _UnSelectAllCommand;
  372. public DelegateCommand<object> UnSelectAllCommand =>
  373. _UnSelectAllCommand ?? (_UnSelectAllCommand = new DelegateCommand<object>(OnUnSelectAll));
  374. private DelegateCommand<object> _StartCommand;
  375. public DelegateCommand<object> StartCommand =>
  376. _StartCommand ?? (_StartCommand = new DelegateCommand<object>(OnStart));
  377. private DelegateCommand<object> _StopCommand;
  378. public DelegateCommand<object> StopCommand =>
  379. _StopCommand ?? (_StopCommand = new DelegateCommand<object>(OnStop));
  380. private DelegateCommand<object> _AbortCommand;
  381. public DelegateCommand<object> AbortCommand =>
  382. _AbortCommand ?? (_AbortCommand = new DelegateCommand<object>(OnAbort));
  383. private DelegateCommand _HomeAllCommand;
  384. public DelegateCommand HomeAllCommand =>
  385. _HomeAllCommand ?? (_HomeAllCommand = new DelegateCommand(OnHomeAll));
  386. private DelegateCommand _PauseAllJobCommand;
  387. public DelegateCommand PauseAllJobCommand =>
  388. _PauseAllJobCommand ?? (_PauseAllJobCommand = new DelegateCommand(OnPauseAllJob));
  389. private DelegateCommand _AbortAllCommand;
  390. public DelegateCommand AbortAllCommand =>
  391. _AbortAllCommand ?? (_AbortAllCommand = new DelegateCommand(OnAbortAll));
  392. private DelegateCommand _ReturnAllWaferCommand;
  393. public DelegateCommand ReturnAllWaferCommand =>
  394. _ReturnAllWaferCommand ?? (_ReturnAllWaferCommand = new DelegateCommand(OnReturnAllWafer));
  395. private DelegateCommand _SetSequenceCommand;
  396. public DelegateCommand SetSequenceCommand =>
  397. _SetSequenceCommand ?? (_SetSequenceCommand = new DelegateCommand(OnSetSequence));
  398. private DelegateCommand<object> _CreateJobCommand;
  399. public DelegateCommand<object> CreateJobCommand =>
  400. _CreateJobCommand ?? (_CreateJobCommand = new DelegateCommand<object>(OnCreateJob));
  401. private DelegateCommand _EnableAutoCommand;
  402. public DelegateCommand EnableAutoCommand =>
  403. _EnableAutoCommand ?? (_EnableAutoCommand = new DelegateCommand(OnEnableAuto));
  404. private DelegateCommand _EnableManualCommand;
  405. public DelegateCommand EnableManualCommand =>
  406. _EnableManualCommand ?? (_EnableManualCommand = new DelegateCommand(OnEnableManual));
  407. public bool SwitchFlag;
  408. #endregion
  409. #region 构造函数
  410. public OperationOverViewModel()
  411. {
  412. DispatcherTimer timer = new DispatcherTimer();
  413. timer.Interval = TimeSpan.FromSeconds(0.5);
  414. timer.Tick += Timer_Tick;
  415. timer.Start();
  416. addDataKeys();
  417. string allModules = QueryDataClient.Instance.Service.GetConfig($"System.InstalledModules").ToString();
  418. PMAIsInstalled = allModules.Contains("PMA");
  419. PMBIsInstalled = allModules.Contains("PMB");
  420. PMCIsInstalled = allModules.Contains("PMC");
  421. PMDIsInstalled = allModules.Contains("PMD");
  422. LLAIsInstalled = allModules.Contains("LLA");
  423. LLBIsInstalled = allModules.Contains("LLB");
  424. EFEMIsInstalled = allModules.Contains("EFEM");
  425. TMIsInstalled = allModules.Contains("TM");
  426. UIEvents.PMDoorRaiseChangedEvent += UIEvents_PMDoorRaiseChangedEvent;
  427. UIEvents.LLTDoorRaiseChangedEvent += UIEvents_LLTDoorRaiseChangedEvent;
  428. UIEvents.LLEDoorRaiseChangedEvent += UIEvents_LLEDoorRaiseChangedEvent;
  429. SwitchFlag = false;
  430. }
  431. #endregion
  432. #region 命令方法
  433. private void OnLoad()
  434. {
  435. if (!SwitchFlag)
  436. {
  437. LP1WaferAssociation = new WaferAssociationInfo();
  438. LP3WaferAssociation = new WaferAssociationInfo();
  439. LP2WaferAssociation = new WaferAssociationInfo();
  440. LP1WaferAssociation.ModuleData = ModuleManager.ModuleInfos["LP1"];
  441. LP2WaferAssociation.ModuleData = ModuleManager.ModuleInfos["LP2"];
  442. LP3WaferAssociation.ModuleData = ModuleManager.ModuleInfos["LP3"];
  443. SwitchFlag = true;
  444. }
  445. }
  446. private void OnLoadWafer(object obj)
  447. {
  448. InvokeClient.Instance.Service.DoOperation($"{obj.ToString()}.Load", ModuleManager.ModuleInfos[obj.ToString()].ModuleID);
  449. }
  450. private void OnUnLoadWafer(object obj)
  451. {
  452. InvokeClient.Instance.Service.DoOperation($"{obj.ToString()}.Unload", ModuleManager.ModuleInfos[obj.ToString()].ModuleID);
  453. }
  454. private void OnSelectAll(object obj)
  455. {
  456. var info=obj as WaferAssociationInfo;
  457. info.SlotFrom = 1;
  458. info.SlotTo = 25;
  459. AssociateSequence(info, true);
  460. }
  461. private void OnUnSelectAll(object obj)
  462. {
  463. var info = obj as WaferAssociationInfo;
  464. info.SlotFrom = 1;
  465. info.SlotTo = 25;
  466. AssociateSequence(info, false);
  467. }
  468. private void OnStart(object obj)
  469. {
  470. var info = obj as WaferAssociationInfo;
  471. InvokeClient.Instance.Service.DoOperation("System.StartJob", info.LotId);
  472. }
  473. private void OnStop(object obj)
  474. {
  475. InvokeClient.Instance.Service.DoOperation("System.PauseJob", obj.ToString());
  476. }
  477. private void OnAbort(object obj)
  478. {
  479. InvokeClient.Instance.Service.DoOperation("System.ResumeJob", obj.ToString());
  480. }
  481. private void OnHomeAll()
  482. {
  483. InvokeClient.Instance.Service.DoOperation("System.HomeAll");
  484. }
  485. private void OnPauseAllJob()
  486. {
  487. InvokeClient.Instance.Service.DoOperation("System.PauseJob", LP1WaferAssociation.JobID);
  488. InvokeClient.Instance.Service.DoOperation("System.PauseJob", LP2WaferAssociation.JobID);
  489. InvokeClient.Instance.Service.DoOperation("System.PauseJob", LP3WaferAssociation.JobID);
  490. }
  491. private void OnAbortAll()
  492. {
  493. InvokeClient.Instance.Service.DoOperation("System.Abort");
  494. }
  495. private void OnReturnAllWafer()
  496. {
  497. //Dialog
  498. WaferDialogView dialog = new WaferDialogView()
  499. {
  500. Owner = Application.Current.MainWindow,
  501. };
  502. dialog.Left = Application.Current.MainWindow.Width / 2 - 150;
  503. dialog.Top = Application.Current.MainWindow.Height / 2 - 200;
  504. dialog.Height = 300;
  505. dialog.Width = 400;
  506. double angel = 0;
  507. double coolingtime = 0;
  508. if (dialog.ShowDialog() == true)
  509. {
  510. if ((bool)dialog.AlignFlag == true && !string.IsNullOrEmpty(dialog.Angle))
  511. {
  512. angel = Convert.ToDouble(dialog.Angle);
  513. }
  514. if ((bool)dialog.CoolingFlag == true && !string.IsNullOrEmpty(dialog.CoolingTime))
  515. {
  516. coolingtime = Convert.ToDouble(dialog.CoolingTime);
  517. }
  518. InvokeClient.Instance.Service.DoOperation("System.ReturnAllWafer", dialog.CoolingFlag,coolingtime, dialog.AlignFlag, angel);
  519. }
  520. }
  521. private void OnSetSequence()
  522. {
  523. //var info = obj as WaferAssociationInfo;
  524. }
  525. private void OnCreateJob(object obj)
  526. {
  527. var info = obj as WaferAssociationInfo;
  528. List<string> slotSequence = new List<string>();
  529. info.ModuleData.WaferManager.Wafers.ForEach(key => { slotSequence.Insert(0, key.SequenceName); });
  530. string jobId = info.LotId.Trim();
  531. if (string.IsNullOrEmpty(jobId))
  532. jobId = "CJ_Local_" + info.ModuleData.ModuleID;
  533. info.LotId = jobId;
  534. info.JobID = jobId;
  535. info.JobStatus = "WaitingForStart";
  536. info.LotIdSaved = true;
  537. Dictionary<string, object> param = new Dictionary<string, object>()
  538. {
  539. {"JobId", jobId},
  540. {"Module", info.ModuleData.ModuleID},
  541. {"SlotSequence", slotSequence.ToArray()},
  542. {"AutoStart", true},
  543. };
  544. InvokeClient.Instance.Service.DoOperation("System.CreateJob", param);
  545. }
  546. private void OnEnableAuto()
  547. {
  548. InvokeClient.Instance.Service.DoOperation("System.SetAutoMode");
  549. }
  550. private void OnEnableManual()
  551. {
  552. InvokeClient.Instance.Service.DoOperation("System.SetManualMode");
  553. }
  554. #endregion
  555. #region 私有方法
  556. private void Timer_Tick(object sender, EventArgs e)
  557. {
  558. LP1ModuleInfo = ModuleManager.ModuleInfos["LP1"];
  559. LP2ModuleInfo = ModuleManager.ModuleInfos["LP2"];
  560. LP3ModuleInfo = ModuleManager.ModuleInfos["LP3"];
  561. EFEMModuleInfo = ModuleManager.ModuleInfos["EfemRobot"];
  562. TMModuleInfo = ModuleManager.ModuleInfos["TMRobot"];
  563. BladeAWafer = ModuleManager.ModuleInfos["EfemRobot"].WaferManager.Wafers[0];
  564. BladeBWafer = ModuleManager.ModuleInfos["EfemRobot"].WaferManager.Wafers[1];
  565. RtDataValues = QueryDataClient.Instance.Service.PollData(m_RtDataKeys);
  566. if (LLAIsInstalled == true)
  567. {
  568. LLAModuleInfo = ModuleManager.ModuleInfos["LLA"];
  569. LLAWafer = ModuleManager.ModuleInfos["LLA"].WaferManager.Wafers.FirstOrDefault(x => x.WaferStatus != 0);
  570. }
  571. if (LLBIsInstalled == true)
  572. {
  573. LLBModuleInfo = ModuleManager.ModuleInfos["LLB"];
  574. LLBWafer = ModuleManager.ModuleInfos["LLB"].WaferManager.Wafers.FirstOrDefault(x => x.WaferStatus != 0);
  575. }
  576. if (PMAIsInstalled == true)
  577. {
  578. PMAWafer = ModuleManager.ModuleInfos["PMA"].WaferManager.Wafers[0];
  579. PMARecipeResult = CommonFunction.GetValue<RecipeResult>(RtDataValues, $"PMA.CurrentRecipeResult");
  580. }
  581. if (PMBIsInstalled == true)
  582. {
  583. PMBWafer = ModuleManager.ModuleInfos["PMB"].WaferManager.Wafers[0];
  584. PMBRecipeResult = CommonFunction.GetValue<RecipeResult>(RtDataValues, $"PMB.CurrentRecipeResult");
  585. }
  586. if (PMCIsInstalled == true)
  587. {
  588. PMCWafer = ModuleManager.ModuleInfos["PMC"].WaferManager.Wafers[0];
  589. PMCRecipeResult = CommonFunction.GetValue<RecipeResult>(RtDataValues, $"PMC.CurrentRecipeResult");
  590. }
  591. if (PMDIsInstalled == true)
  592. {
  593. PMDWafer = ModuleManager.ModuleInfos["PMD"].WaferManager.Wafers[0];
  594. PMDRecipeResult = CommonFunction.GetValue<RecipeResult>(RtDataValues, $"PMD.CurrentRecipeResult");
  595. }
  596. if (TMIsInstalled == true)
  597. {
  598. TMBladeAWafer = ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[0];
  599. TMBladeBWafer = ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[1];
  600. }
  601. if (EFEMIsInstalled == true)
  602. {
  603. EFEMBladeAWafer = ModuleManager.ModuleInfos["EfemRobot"].WaferManager.Wafers[0];
  604. EFEMBladeBWafer = ModuleManager.ModuleInfos["EfemRobot"].WaferManager.Wafers[1];
  605. Aligner1Wafer = ModuleManager.ModuleInfos["Aligner1"].WaferManager.Wafers[0];
  606. }
  607. RobotMoveInfo = (RobotMoveInfo)QueryDataClient.Instance.Service.GetData("TM.RobotMoveAction");
  608. EfemRobotMoveInfo=(RobotMoveInfo)QueryDataClient.Instance.Service.GetData("EFEM.RobotMoveAction");
  609. LP1WaferCount = LP1ModuleInfo.WaferManager.Wafers.Where(x=>x.WaferStatus!=0).Count();
  610. LP2WaferCount = LP2ModuleInfo.WaferManager.Wafers.Where(x => x.WaferStatus != 0).Count();
  611. LP3WaferCount = LP3ModuleInfo.WaferManager.Wafers.Where(x => x.WaferStatus != 0).Count();
  612. }
  613. private async void RobotMoveInfoChanged(RobotMoveInfo oldValue, RobotMoveInfo newValue)
  614. {
  615. string RobotTarget;
  616. if (oldValue == null || newValue == null)
  617. {
  618. return;
  619. }
  620. #region pick 和 place LL
  621. if (oldValue.Action == RobotAction.None && (newValue.Action == RobotAction.Placing || newValue.Action == RobotAction.Picking))
  622. {
  623. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  624. if (TMRobotMoveActionBladeTarget != null)
  625. {
  626. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  627. }
  628. else
  629. {
  630. return;
  631. }
  632. var values = RobotTarget.Split('.');
  633. var arm = values[0];
  634. var module = values[1];
  635. if (arm == "ArmA")
  636. {
  637. Robot1TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  638. await Task.Delay(1500);
  639. Robot1XAction = WaferRobotXAction.Extend;
  640. await Task.Delay(3000);
  641. Robot1XAction = WaferRobotXAction.Retract;
  642. }
  643. else if (arm == "ArmB")
  644. {
  645. Robot2TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  646. await Task.Delay(1500);
  647. Robot2XAction = WaferRobotXAction.Extend;
  648. await Task.Delay(3000);
  649. Robot2XAction = WaferRobotXAction.Retract;
  650. }
  651. }
  652. #endregion
  653. #region pick 和 place pm
  654. if (oldValue.Action == RobotAction.None && newValue.Action == RobotAction.Extending)
  655. {
  656. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  657. if (TMRobotMoveActionBladeTarget != null)
  658. {
  659. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  660. }
  661. else
  662. {
  663. return;
  664. }
  665. var values = RobotTarget.Split('.');
  666. var arm = values[0];
  667. var module = values[1];
  668. if (arm == "ArmA")
  669. {
  670. Robot1TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  671. await Task.Delay(1500);
  672. Robot1XAction = WaferRobotXAction.Extend;
  673. }
  674. else if (arm == "ArmB")
  675. {
  676. Robot2TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  677. await Task.Delay(1500);
  678. Robot2XAction = WaferRobotXAction.Extend;
  679. }
  680. }
  681. if (oldValue.Action == RobotAction.None && newValue.Action == RobotAction.Retracting)
  682. {
  683. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  684. if (TMRobotMoveActionBladeTarget != null)
  685. {
  686. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  687. }
  688. else
  689. {
  690. return;
  691. }
  692. var values = RobotTarget.Split('.');
  693. var arm = values[0];
  694. if (arm == "ArmA")
  695. {
  696. Robot1XAction = WaferRobotXAction.Retract;
  697. }
  698. else if (arm == "ArmB")
  699. {
  700. Robot2XAction = WaferRobotXAction.Retract;
  701. }
  702. }
  703. #endregion
  704. arm1oldWaferStatus = ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[0].WaferStatus;
  705. arm2oldWaferStatus = ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[1].WaferStatus;
  706. }
  707. private async void EFEMRobotMoveInfoChanged(RobotMoveInfo oldValue, RobotMoveInfo newValue)
  708. {
  709. string RobotTarget;
  710. if (oldValue == null || newValue == null)
  711. {
  712. return;
  713. }
  714. #region pick 和 place LL
  715. if (oldValue.Action == RobotAction.None && (newValue.Action == RobotAction.Placing || newValue.Action == RobotAction.Picking))
  716. {
  717. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  718. if (TMRobotMoveActionBladeTarget != null)
  719. {
  720. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  721. }
  722. else
  723. {
  724. return;
  725. }
  726. var values = RobotTarget.Split('.');
  727. var arm = values[0];
  728. var module = values[1];
  729. if (arm == "ArmA")
  730. {
  731. var robot3Robot3TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  732. await ChangePosition(robot3Robot3TAction);
  733. Robot3TAction = robot3Robot3TAction;
  734. await Task.Delay(1500);
  735. //ChangePosition(Robot3TAction);
  736. // await Task.Delay(2000);
  737. Robot3XAction = WaferRobotXAction.Extend;
  738. await Task.Delay(3000);
  739. Robot3XAction = WaferRobotXAction.Retract;
  740. }
  741. else if (arm == "ArmB")
  742. {
  743. var robot4Robot4TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  744. await ChangePosition(robot4Robot4TAction);
  745. Robot4TAction = robot4Robot4TAction;
  746. await Task.Delay(1500);
  747. //ChangePosition(Robot4TAction);
  748. //await Task.Delay(2000);
  749. Robot4XAction = WaferRobotXAction.Extend;
  750. await Task.Delay(3000);
  751. Robot4XAction = WaferRobotXAction.Retract;
  752. }
  753. }
  754. #endregion
  755. #region pick 和 place pm
  756. if (oldValue.Action == RobotAction.None && newValue.Action == RobotAction.Extending)
  757. {
  758. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  759. if (TMRobotMoveActionBladeTarget != null)
  760. {
  761. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  762. }
  763. else
  764. {
  765. return;
  766. }
  767. var values = RobotTarget.Split('.');
  768. var arm = values[0];
  769. var module = values[1];
  770. if (arm == "ArmA")
  771. {
  772. Robot3TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  773. await Task.Delay(1500);
  774. //ChangePosition(Robot3TAction);
  775. //await Task.Delay(2000);
  776. Robot3XAction = WaferRobotXAction.Extend;
  777. }
  778. else if (arm == "ArmB")
  779. {
  780. Robot4TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  781. await Task.Delay(1500);
  782. //ChangePosition(Robot4TAction);
  783. //await Task.Delay(2000);
  784. Robot4XAction = WaferRobotXAction.Extend;
  785. }
  786. }
  787. if (oldValue.Action == RobotAction.None && newValue.Action == RobotAction.Retracting)
  788. {
  789. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  790. if (TMRobotMoveActionBladeTarget != null)
  791. {
  792. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  793. }
  794. else
  795. {
  796. return;
  797. }
  798. var values = RobotTarget.Split('.');
  799. var arm = values[0];
  800. if (arm == "ArmA")
  801. {
  802. Robot3XAction = WaferRobotXAction.Retract;
  803. await Task.Delay(3000);
  804. //ChangePosition(Robot3TAction);
  805. //await Task.Delay(2000);
  806. }
  807. else if (arm == "ArmB")
  808. {
  809. Robot4XAction = WaferRobotXAction.Retract;
  810. await Task.Delay(3000);
  811. //ChangePosition(Robot3TAction);
  812. //await Task.Delay(2000);
  813. }
  814. }
  815. #endregion
  816. }
  817. private void addDataKeys()
  818. {
  819. m_RtDataKeys.Add("PMA.IsSlitDoorClosed");
  820. m_RtDataKeys.Add("PMB.IsSlitDoorClosed");
  821. m_RtDataKeys.Add("PMC.IsSlitDoorClosed");
  822. m_RtDataKeys.Add("PMD.IsSlitDoorClosed");
  823. m_RtDataKeys.Add("TM.LLATSlitDoor.IsClosed");
  824. m_RtDataKeys.Add("TM.LLBTSlitDoor.IsClosed");
  825. m_RtDataKeys.Add("TM.LLAESlitDoor.IsClosed");
  826. m_RtDataKeys.Add("TM.LLBESlitDoor.IsClosed");
  827. m_RtDataKeys.Add("System.IsAutoMode");
  828. m_RtDataKeys.Add("Scheduler.CycledCount");
  829. m_RtDataKeys.Add("Scheduler.CycledWafer");
  830. m_RtDataKeys.Add("Scheduler.CycleSetPoint");
  831. m_RtDataKeys.Add("LP1.IsLoaded");
  832. m_RtDataKeys.Add("LP2.IsLoaded");
  833. m_RtDataKeys.Add("LP3.IsLoaded");
  834. m_RtDataKeys.Add("LP1.CassettePlaced");
  835. m_RtDataKeys.Add("LP2.CassettePlaced");
  836. m_RtDataKeys.Add("LP3.CassettePlaced");
  837. m_RtDataKeys.Add("PMA.CurrentRecipeResult");
  838. m_RtDataKeys.Add("PMB.CurrentRecipeResult");
  839. m_RtDataKeys.Add("PMC.CurrentRecipeResult");
  840. m_RtDataKeys.Add("PMD.CurrentRecipeResult");
  841. }
  842. private void AssociateSequence(WaferAssociationInfo info, bool flag, int slot = -1)
  843. {
  844. List<WaferInfo> wafers = info.ModuleData.WaferManager.Wafers;
  845. if (slot >= 0) //by wafer
  846. {
  847. int index = wafers.Count - slot - 1;
  848. if (index < wafers.Count)
  849. {
  850. if (flag && HasWaferOnSlot(wafers, index))
  851. wafers[index].SequenceName = info.SequenceName;
  852. else
  853. wafers[index].SequenceName = string.Empty;
  854. }
  855. }
  856. else //by from-to
  857. {
  858. for (int i = info.SlotFrom - 1; i < info.SlotTo; i++)
  859. {
  860. int index = wafers.Count - i - 1;
  861. if (index < wafers.Count)
  862. {
  863. if (flag && HasWaferOnSlot(wafers, index))
  864. wafers[index].SequenceName = info.SequenceName;
  865. else
  866. wafers[index].SequenceName = string.Empty;
  867. }
  868. }
  869. }
  870. switch (info.ModuleData.ModuleID)
  871. {
  872. case "LP1":
  873. LP1WaferAssociation = info;
  874. break;
  875. case "LP2":
  876. LP2WaferAssociation = info;
  877. break;
  878. case "LP3":
  879. LP3WaferAssociation = info;
  880. break;
  881. }
  882. }
  883. private bool HasWaferOnSlot(List<WaferInfo> wafers, int index)
  884. {
  885. if (wafers[index].WaferStatus == 0)
  886. return false;
  887. return true;
  888. }
  889. private void UIEvents_PMDoorRaiseChangedEvent(DoorPara obj)
  890. {
  891. //InvokeClient.Instance.Service.DoOperation($"{obj?.ModuleName}.SlitDoor.{obj?.IsOpen}");
  892. InvokeClient.Instance.Service.DoOperation($"{obj?.ModuleName}.SetSlitDoor",obj.IsOpen=="Open"?true:false);
  893. }
  894. private void UIEvents_LLTDoorRaiseChangedEvent(DoorPara obj)
  895. {
  896. InvokeClient.Instance.Service.DoOperation($"TM.SetMFSlitDoor",obj.ModuleName, obj.IsOpen == "Open" ? true : false);
  897. }
  898. private void UIEvents_LLEDoorRaiseChangedEvent(DoorPara obj)
  899. {
  900. InvokeClient.Instance.Service.DoOperation($"TM.{obj.ModuleName}ESlitDoor.{obj?.IsOpen}");
  901. }
  902. private async Task ChangePosition(WaferRobotTAction waferRobotTAction)
  903. {
  904. //CurrentRobotPosition = RobotPosition.Origin;
  905. //await Task.Delay(1000);
  906. if (waferRobotTAction == WaferRobotTAction.LP1)
  907. {
  908. CurrentRobotPosition = RobotPosition.Left;
  909. }
  910. else if (waferRobotTAction == WaferRobotTAction.LP3)
  911. {
  912. CurrentRobotPosition = RobotPosition.Right;
  913. }
  914. else if (waferRobotTAction == WaferRobotTAction.LP2)
  915. {
  916. CurrentRobotPosition = RobotPosition.Middle;
  917. }
  918. else
  919. {
  920. CurrentRobotPosition = RobotPosition.Origin;
  921. }
  922. await Task.Delay(1500);
  923. }
  924. #endregion
  925. }
  926. }