OperationOverViewModel.cs 39 KB

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