OperationOverViewModel.cs 53 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416
  1. using Aitex.Core.RT.Log;
  2. using MECF.Framework.Common.CommonData;
  3. using MECF.Framework.Common.DataCenter;
  4. using MECF.Framework.Common.Equipment;
  5. using MECF.Framework.Common.Jobs;
  6. using MECF.Framework.Common.OperationCenter;
  7. using OpenSEMI.ClientBase;
  8. using Prism.Commands;
  9. using Prism.Mvvm;
  10. using System;
  11. using System.Collections.Generic;
  12. using System.Linq;
  13. using System.Text;
  14. using System.Threading.Tasks;
  15. using System.Windows;
  16. using System.Windows.Threading;
  17. using Venus_Core;
  18. using Venus_MainPages.Unity;
  19. using Venus_MainPages.Views;
  20. using Venus_Themes.CustomControls;
  21. using static Venus_Themes.UserControls.EFEM;
  22. namespace Venus_MainPages.ViewModels
  23. {
  24. public class OperationOverViewModel : BindableBase
  25. {
  26. #region 私有字段
  27. private bool m_TabIsChecked = true;
  28. private ModuleInfo m_LP1ModuleInfo;
  29. private ModuleInfo m_LP2ModuleInfo;
  30. private ModuleInfo m_LLAModuleInfo;
  31. private ModuleInfo m_LLBModuleInfo;
  32. private ModuleInfo m_LP3ModuleInfo;
  33. private ModuleInfo m_EFEMModuleInfo;
  34. private ModuleInfo m_TMModuleInfo;
  35. private WaferRobotTAction m_Robot1TAction;
  36. private WaferRobotXAction m_Robot1XAction;
  37. private WaferRobotTAction m_Robot2TAction;
  38. private WaferRobotXAction m_Robot2XAction;
  39. private WaferRobotTAction m_Robot3TAction;
  40. private WaferRobotXAction m_Robot3XAction;
  41. private WaferRobotTAction m_Robot4TAction;
  42. private WaferRobotXAction m_Robot4XAction;
  43. private RobotMoveInfo m_robotMoveInfo;
  44. private WaferInfo m_PMAWafer;
  45. private WaferInfo m_PMBWafer;
  46. private WaferInfo m_PMCWafer;
  47. private WaferInfo m_PMDWafer;
  48. private WaferInfo m_LLAWafer;
  49. private WaferInfo m_LLBWafer;
  50. private WaferInfo m_TMBladeAWafer;
  51. private WaferInfo m_TMBladeBWafer;
  52. private List<string> m_RtDataKeys = new List<string>();
  53. private Dictionary<string, object> m_RtDataValues;
  54. private bool m_PMAIsInstalled;
  55. private bool m_PMBIsInstalled;
  56. private bool m_PMCIsInstalled;
  57. private bool m_PMDIsInstalled;
  58. private bool m_LLAIsInstalled;
  59. private bool m_LLBIsInstalled;
  60. private bool m_TMIsInstalled;
  61. private bool m_EFEMIsInstalled;
  62. private bool m_ButtonIsEnableLP1;
  63. private bool m_ButtonIsEnableLP2;
  64. private bool m_ButtonIsEnableLP3;
  65. private WaferInfo m_EFEMBladeAWafer;
  66. private WaferInfo m_EFEMBladeBWafer;
  67. private WaferInfo m_Aligner1Wafer;
  68. private int m_LP1WaferCount;
  69. private int m_LP2WaferCount;
  70. private int m_LP3WaferCount;
  71. private WaferAssociationInfo _lp1WaferAssociation;
  72. private WaferAssociationInfo _lp2WaferAssociation;
  73. private WaferAssociationInfo _lp3WaferAssociation;
  74. private int m_CycledWafer;
  75. private int m_CycleCountDisplay;
  76. private RobotPosition m_CurrentRobotPosition;
  77. private WaferInfo m_BladeAWafer;
  78. private WaferInfo m_BladeBWafer;
  79. private RecipeResult m_PMARecipeResult;
  80. private RecipeResult m_PMBRecipeResult;
  81. private RecipeResult m_PMCRecipeResult;
  82. private RecipeResult m_PMDRecipeResult;
  83. private string m_ATMModeIsOn;
  84. private float m_TMPressure;
  85. private string m_RouteState;
  86. private PressureType m_PressureType;
  87. DispatcherTimer timer;
  88. #endregion
  89. #region 属性
  90. public PressureType PressureType
  91. {
  92. get { return m_PressureType; }
  93. set { SetProperty(ref m_PressureType, value); }
  94. }
  95. public bool TabIsChecked
  96. {
  97. get { return m_TabIsChecked; }
  98. set { SetProperty(ref m_TabIsChecked, value); }
  99. }
  100. public ModuleInfo LP1ModuleInfo
  101. {
  102. get { return m_LP1ModuleInfo; }
  103. set { SetProperty(ref m_LP1ModuleInfo, value); }
  104. }
  105. public ModuleInfo LLAModuleInfo
  106. {
  107. get { return m_LLAModuleInfo; }
  108. set { SetProperty(ref m_LLAModuleInfo, value); }
  109. }
  110. public ModuleInfo LLBModuleInfo
  111. {
  112. get { return m_LLBModuleInfo; }
  113. set { SetProperty(ref m_LLBModuleInfo, value); }
  114. }
  115. public ModuleInfo EFEMModuleInfo
  116. {
  117. get { return m_EFEMModuleInfo; }
  118. set { SetProperty(ref m_EFEMModuleInfo, value); }
  119. }
  120. public ModuleInfo TMModuleInfo
  121. {
  122. get { return m_TMModuleInfo; }
  123. set { SetProperty(ref m_TMModuleInfo, value); }
  124. }
  125. public ModuleInfo LP2ModuleInfo
  126. {
  127. get { return m_LP2ModuleInfo; }
  128. set { SetProperty(ref m_LP2ModuleInfo, value); }
  129. }
  130. public ModuleInfo LP3ModuleInfo
  131. {
  132. get { return m_LP3ModuleInfo; }
  133. set { SetProperty(ref m_LP3ModuleInfo, value); }
  134. }
  135. public WaferRobotTAction Robot1TAction
  136. {
  137. get { return m_Robot1TAction; }
  138. set { SetProperty(ref m_Robot1TAction, value); }
  139. }
  140. public WaferRobotXAction Robot1XAction
  141. {
  142. get { return m_Robot1XAction; }
  143. set { SetProperty(ref m_Robot1XAction, value); }
  144. }
  145. public WaferRobotTAction Robot2TAction
  146. {
  147. get { return m_Robot2TAction; }
  148. set { SetProperty(ref m_Robot2TAction, value); }
  149. }
  150. public WaferRobotXAction Robot2XAction
  151. {
  152. get { return m_Robot2XAction; }
  153. set { SetProperty(ref m_Robot2XAction, value); }
  154. }
  155. public WaferRobotTAction Robot3TAction
  156. {
  157. get { return m_Robot3TAction; }
  158. set { SetProperty(ref m_Robot3TAction, value); }
  159. }
  160. public WaferRobotXAction Robot3XAction
  161. {
  162. get { return m_Robot3XAction; }
  163. set { SetProperty(ref m_Robot3XAction, value); }
  164. }
  165. public WaferRobotTAction Robot4TAction
  166. {
  167. get { return m_Robot4TAction; }
  168. set { SetProperty(ref m_Robot4TAction, value); }
  169. }
  170. public WaferRobotXAction Robot4XAction
  171. {
  172. get { return m_Robot4XAction; }
  173. set { SetProperty(ref m_Robot4XAction, value); }
  174. }
  175. public RobotMoveInfo RobotMoveInfo
  176. {
  177. get { return m_robotMoveInfo; }
  178. set
  179. {
  180. RobotMoveInfoChanged(m_robotMoveInfo, value);
  181. //m_robotMoveInfo = value;
  182. SetProperty(ref m_robotMoveInfo, value);
  183. }
  184. }
  185. public WaferInfo LLAWafer
  186. {
  187. get { return m_LLAWafer; }
  188. set { SetProperty(ref m_LLAWafer, value); }
  189. }
  190. public WaferInfo LLBWafer
  191. {
  192. get { return m_LLBWafer; }
  193. set { SetProperty(ref m_LLBWafer, value); }
  194. }
  195. public WaferInfo PMAWafer
  196. {
  197. get { return m_PMAWafer; }
  198. set { SetProperty(ref m_PMAWafer, value); }
  199. }
  200. public WaferInfo PMBWafer
  201. {
  202. get { return m_PMBWafer; }
  203. set { SetProperty(ref m_PMBWafer, value); }
  204. }
  205. public WaferInfo PMCWafer
  206. {
  207. get { return m_PMCWafer; }
  208. set { SetProperty(ref m_PMCWafer, value); }
  209. }
  210. public WaferInfo PMDWafer
  211. {
  212. get { return m_PMDWafer; }
  213. set { SetProperty(ref m_PMDWafer, value); }
  214. }
  215. public WaferInfo TMBladeAWafer
  216. {
  217. get { return m_TMBladeAWafer; }
  218. set { SetProperty(ref m_TMBladeAWafer, value); }
  219. }
  220. public WaferInfo TMBladeBWafer
  221. {
  222. get { return m_TMBladeBWafer; }
  223. set { SetProperty(ref m_TMBladeBWafer, value); }
  224. }
  225. public Dictionary<string, object> RtDataValues
  226. {
  227. get { return m_RtDataValues; }
  228. set { SetProperty(ref m_RtDataValues, value); }
  229. }
  230. public bool PMAIsInstalled
  231. {
  232. get { return m_PMAIsInstalled; }
  233. set { SetProperty(ref m_PMAIsInstalled, value); }
  234. }
  235. public bool PMBIsInstalled
  236. {
  237. get { return m_PMBIsInstalled; }
  238. set { SetProperty(ref m_PMBIsInstalled, value); }
  239. }
  240. public bool PMCIsInstalled
  241. {
  242. get { return m_PMCIsInstalled; }
  243. set { SetProperty(ref m_PMCIsInstalled, value); }
  244. }
  245. public bool PMDIsInstalled
  246. {
  247. get { return m_PMDIsInstalled; }
  248. set { SetProperty(ref m_PMDIsInstalled, value); }
  249. }
  250. public bool LLAIsInstalled
  251. {
  252. get { return m_LLAIsInstalled; }
  253. set { SetProperty(ref m_LLAIsInstalled, value); }
  254. }
  255. public bool LLBIsInstalled
  256. {
  257. get { return m_LLBIsInstalled; }
  258. set { SetProperty(ref m_LLBIsInstalled, value); }
  259. }
  260. public bool TMIsInstalled
  261. {
  262. get { return m_TMIsInstalled; }
  263. set { SetProperty(ref m_TMIsInstalled, value); }
  264. }
  265. public bool EFEMIsInstalled
  266. {
  267. get { return m_EFEMIsInstalled; }
  268. set { SetProperty(ref m_EFEMIsInstalled, value); }
  269. }
  270. public bool ButtonIsEnableLP1
  271. {
  272. get { return m_ButtonIsEnableLP1; }
  273. set { SetProperty(ref m_ButtonIsEnableLP1, value); }
  274. }
  275. public bool ButtonIsEnableLP2
  276. {
  277. get { return m_ButtonIsEnableLP2; }
  278. set { SetProperty(ref m_ButtonIsEnableLP2, value); }
  279. }
  280. public bool ButtonIsEnableLP3
  281. {
  282. get { return m_ButtonIsEnableLP3; }
  283. set { SetProperty(ref m_ButtonIsEnableLP3, value); }
  284. }
  285. public WaferInfo EFEMBladeAWafer
  286. {
  287. get { return m_EFEMBladeAWafer; }
  288. set { SetProperty(ref m_EFEMBladeAWafer, value); }
  289. }
  290. public WaferInfo EFEMBladeBWafer
  291. {
  292. get { return m_EFEMBladeBWafer; }
  293. set { SetProperty(ref m_EFEMBladeBWafer, value); }
  294. }
  295. public WaferInfo Aligner1Wafer
  296. {
  297. get { return m_Aligner1Wafer; }
  298. set { SetProperty(ref m_Aligner1Wafer, value); }
  299. }
  300. public int LP1WaferCount
  301. {
  302. get { return m_LP1WaferCount; }
  303. set { SetProperty(ref m_LP1WaferCount, value); }
  304. }
  305. public int LP2WaferCount
  306. {
  307. get { return m_LP2WaferCount; }
  308. set { SetProperty(ref m_LP2WaferCount, value); }
  309. }
  310. public int LP3WaferCount
  311. {
  312. get { return m_LP3WaferCount; }
  313. set { SetProperty(ref m_LP3WaferCount, value); }
  314. }
  315. public WaferAssociationInfo LP1WaferAssociation
  316. {
  317. get { return _lp1WaferAssociation; }
  318. set { SetProperty(ref _lp1WaferAssociation, value); }
  319. }
  320. public WaferAssociationInfo LP2WaferAssociation
  321. {
  322. get { return _lp2WaferAssociation; }
  323. set { SetProperty(ref _lp2WaferAssociation, value); }
  324. }
  325. public WaferAssociationInfo LP3WaferAssociation
  326. {
  327. get { return _lp3WaferAssociation; }
  328. set { SetProperty(ref _lp3WaferAssociation, value); }
  329. }
  330. public int CycledWafer
  331. {
  332. get { return m_CycledWafer; }
  333. set { SetProperty(ref m_CycledWafer, value); }
  334. }
  335. public int CycleCountDisplay
  336. {
  337. get { return m_CycleCountDisplay; }
  338. set { SetProperty(ref m_CycleCountDisplay, value); }
  339. }
  340. public RobotMoveInfo m_EfemRobotMoveInfo;
  341. public RobotMoveInfo EfemRobotMoveInfo
  342. {
  343. get { return m_EfemRobotMoveInfo; }
  344. set
  345. {
  346. EFEMRobotMoveInfoChanged(m_EfemRobotMoveInfo, value);
  347. //m_EfemRobotMoveInfo = value;
  348. SetProperty(ref m_EfemRobotMoveInfo, value);
  349. }
  350. }
  351. public RobotPosition CurrentRobotPosition
  352. {
  353. get { return m_CurrentRobotPosition; }
  354. set { SetProperty(ref m_CurrentRobotPosition, value); }
  355. }
  356. public WaferInfo BladeAWafer
  357. {
  358. get { return m_BladeAWafer; }
  359. set { SetProperty(ref m_BladeAWafer, value); }
  360. }
  361. public WaferInfo BladeBWafer
  362. {
  363. get { return m_BladeBWafer; }
  364. set { SetProperty(ref m_BladeBWafer, value); }
  365. }
  366. public RecipeResult PMARecipeResult
  367. {
  368. get { return m_PMARecipeResult; }
  369. set { SetProperty(ref m_PMARecipeResult, value); }
  370. }
  371. public RecipeResult PMBRecipeResult
  372. {
  373. get { return m_PMBRecipeResult; }
  374. set { SetProperty(ref m_PMBRecipeResult, value); }
  375. }
  376. public RecipeResult PMCRecipeResult
  377. {
  378. get { return m_PMCRecipeResult; }
  379. set { SetProperty(ref m_PMCRecipeResult, value); }
  380. }
  381. public RecipeResult PMDRecipeResult
  382. {
  383. get { return m_PMDRecipeResult; }
  384. set { SetProperty(ref m_PMDRecipeResult, value); }
  385. }
  386. public string ATMModeIsOn
  387. {
  388. get { return m_ATMModeIsOn; }
  389. set { SetProperty(ref m_ATMModeIsOn, value); }
  390. }
  391. public float TMPressure
  392. {
  393. get { return m_TMPressure; }
  394. set { SetProperty(ref m_TMPressure, value); }
  395. }
  396. public string RouteState
  397. {
  398. get { return m_RouteState; }
  399. set { SetProperty(ref m_RouteState, value); }
  400. }
  401. #endregion
  402. #region 命令
  403. private DelegateCommand<object> _LoadCommand;
  404. public DelegateCommand<object> LoadCommand =>
  405. _LoadCommand ?? (_LoadCommand = new DelegateCommand<object>(OnLoad));
  406. private DelegateCommand<object> _LoadWaferCommand;
  407. public DelegateCommand<object> LoadWaferCommand =>
  408. _LoadWaferCommand ?? (_LoadWaferCommand = new DelegateCommand<object>(OnLoadWafer));
  409. private DelegateCommand<object> _UnLoadWaferCommand;
  410. public DelegateCommand<object> UnLoadWaferCommand =>
  411. _UnLoadWaferCommand ?? (_UnLoadWaferCommand = new DelegateCommand<object>(OnUnLoadWafer));
  412. private DelegateCommand<object> _SelectAllCommand;
  413. public DelegateCommand<object> SelectAllCommand =>
  414. _SelectAllCommand ?? (_SelectAllCommand = new DelegateCommand<object>(OnSelectAll));
  415. private DelegateCommand<object> _UnSelectAllCommand;
  416. public DelegateCommand<object> UnSelectAllCommand =>
  417. _UnSelectAllCommand ?? (_UnSelectAllCommand = new DelegateCommand<object>(OnUnSelectAll));
  418. private DelegateCommand<object> _StartCommand;
  419. public DelegateCommand<object> StartCommand =>
  420. _StartCommand ?? (_StartCommand = new DelegateCommand<object>(OnStart));
  421. private DelegateCommand<object> _StopCommand;
  422. public DelegateCommand<object> StopCommand =>
  423. _StopCommand ?? (_StopCommand = new DelegateCommand<object>(OnStop));
  424. private DelegateCommand<object> _AbortCommand;
  425. public DelegateCommand<object> AbortCommand =>
  426. _AbortCommand ?? (_AbortCommand = new DelegateCommand<object>(OnAbort));
  427. private DelegateCommand _HomeAllCommand;
  428. public DelegateCommand HomeAllCommand =>
  429. _HomeAllCommand ?? (_HomeAllCommand = new DelegateCommand(OnHomeAll));
  430. private DelegateCommand _ResumeAllJobCommand;
  431. public DelegateCommand ResumeAllJobCommand =>
  432. _ResumeAllJobCommand ?? (_ResumeAllJobCommand = new DelegateCommand(OnResumeAllJob));
  433. private DelegateCommand _AbortAllCommand;
  434. public DelegateCommand AbortAllCommand =>
  435. _AbortAllCommand ?? (_AbortAllCommand = new DelegateCommand(OnAbortAll));
  436. private DelegateCommand _ReturnAllWaferCommand;
  437. public DelegateCommand ReturnAllWaferCommand =>
  438. _ReturnAllWaferCommand ?? (_ReturnAllWaferCommand = new DelegateCommand(OnReturnAllWafer));
  439. private DelegateCommand<object> _SetSequenceCommand;
  440. public DelegateCommand<object> SetSequenceCommand =>
  441. _SetSequenceCommand ?? (_SetSequenceCommand = new DelegateCommand<object>(OnSetSequence));
  442. private DelegateCommand<object> _CreateJobCommand;
  443. public DelegateCommand<object> CreateJobCommand =>
  444. _CreateJobCommand ?? (_CreateJobCommand = new DelegateCommand<object>(OnCreateJob));
  445. private DelegateCommand<object> _AbortJobCommand;
  446. public DelegateCommand<object> AbortJobCommand =>
  447. _AbortJobCommand ?? (_AbortJobCommand = new DelegateCommand<object>(OnAbortJob));
  448. private DelegateCommand _EnableAutoCommand;
  449. public DelegateCommand EnableAutoCommand =>
  450. _EnableAutoCommand ?? (_EnableAutoCommand = new DelegateCommand(OnEnableAuto));
  451. private DelegateCommand _EnableManualCommand;
  452. public DelegateCommand EnableManualCommand =>
  453. _EnableManualCommand ?? (_EnableManualCommand = new DelegateCommand(OnEnableManual));
  454. private DelegateCommand _LostFocusCommand;
  455. public DelegateCommand LostFocusCommand =>
  456. _LostFocusCommand ?? (_LostFocusCommand = new DelegateCommand(OnLostFocus));
  457. private DelegateCommand _GotFocusCommand;
  458. public DelegateCommand GotFocusCommand =>
  459. _GotFocusCommand ?? (_GotFocusCommand = new DelegateCommand(OnGotFocus));
  460. public bool SwitchFlag;
  461. #endregion
  462. #region 构造函数
  463. public OperationOverViewModel()
  464. {
  465. timer = new DispatcherTimer();
  466. timer.Interval = TimeSpan.FromSeconds(0.5);
  467. addDataKeys();
  468. RtDataValues = QueryDataClient.Instance.Service.PollData(m_RtDataKeys);
  469. timer.Tick += Timer_Tick;
  470. string allModules = QueryDataClient.Instance.Service.GetConfig($"System.InstalledModules").ToString();
  471. PMAIsInstalled = allModules.Contains("PMA");
  472. PMBIsInstalled = allModules.Contains("PMB");
  473. PMCIsInstalled = allModules.Contains("PMC");
  474. PMDIsInstalled = allModules.Contains("PMD");
  475. LLAIsInstalled = allModules.Contains("LLA");
  476. LLBIsInstalled = allModules.Contains("LLB");
  477. EFEMIsInstalled = allModules.Contains("EFEM");
  478. TMIsInstalled = allModules.Contains("TM");
  479. SwitchFlag = false;
  480. ATMModeIsOn = Convert.ToBoolean(QueryDataClient.Instance.Service.GetConfig("System.IsATMMode")) == true ? "ATM Mode On" : "ATM Mode Off";
  481. LOG.Info("开启UI界面");
  482. }
  483. #endregion
  484. #region 命令方法
  485. private void OnLoad(object obj)
  486. {
  487. if (!SwitchFlag)
  488. {
  489. var t = (obj as OperationOverView);
  490. LP1WaferAssociation = new WaferAssociationInfo();
  491. LP3WaferAssociation = new WaferAssociationInfo();
  492. LP2WaferAssociation = new WaferAssociationInfo();
  493. LP1WaferAssociation.ModuleData = ModuleManager.ModuleInfos["LP1"];
  494. LP2WaferAssociation.ModuleData = ModuleManager.ModuleInfos["LP2"];
  495. LP3WaferAssociation.ModuleData = ModuleManager.ModuleInfos["LP3"];
  496. SwitchFlag = true;
  497. PressureType = (PressureType)Convert.ToInt32(QueryDataClient.Instance.Service.GetData("System.PressureUnitType"));
  498. }
  499. }
  500. private void T_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
  501. {
  502. if (timer.IsEnabled)
  503. {
  504. timer.Stop();
  505. }
  506. else
  507. {
  508. timer.Start();
  509. }
  510. }
  511. private void OnLoadWafer(object obj)
  512. {
  513. InvokeClient.Instance.Service.DoOperation($"{obj.ToString()}.Load", ModuleManager.ModuleInfos[obj.ToString()].ModuleID);
  514. }
  515. private void OnUnLoadWafer(object obj)
  516. {
  517. InvokeClient.Instance.Service.DoOperation($"{obj.ToString()}.Unload", ModuleManager.ModuleInfos[obj.ToString()].ModuleID);
  518. }
  519. private void OnSelectAll(object obj)
  520. {
  521. var info = obj as WaferAssociationInfo;
  522. var module = info.ModuleData.ModuleID;
  523. if (CommonFunction.GetValue<bool>(RtDataValues, $"{module}.IsLoaded"))
  524. {
  525. info.SlotFrom = 1;
  526. info.SlotTo = 25;
  527. AssociateSequence(info, true);
  528. }
  529. }
  530. private void OnUnSelectAll(object obj)
  531. {
  532. var info = obj as WaferAssociationInfo;
  533. var module = info.ModuleData.ModuleID;
  534. info.SlotFrom = 1;
  535. info.SlotTo = 25;
  536. AssociateSequence(info, false);
  537. }
  538. private void OnStart(object obj)
  539. {
  540. var info = obj as WaferAssociationInfo;
  541. InvokeClient.Instance.Service.DoOperation("System.StartJob", info.LotId);
  542. LOG.Info("System,Start Job");
  543. }
  544. private void OnStop(object obj)
  545. {
  546. var info = obj as WaferAssociationInfo;
  547. InvokeClient.Instance.Service.DoOperation("System.AbortJob", info.JobID);
  548. LOG.Info($"System,Stop Job{info.JobID}");
  549. }
  550. private void OnAbort(object obj)
  551. {
  552. var info = obj as WaferAssociationInfo;
  553. InvokeClient.Instance.Service.DoOperation("System.StopJob", info.JobID);
  554. LOG.Info($"System,Stop Job{info.JobID}");
  555. }
  556. private void OnHomeAll()
  557. {
  558. InvokeClient.Instance.Service.DoOperation("System.HomeAll");
  559. LOG.Info("System,Home All");
  560. }
  561. private void OnResumeAllJob()
  562. {
  563. var t = CommonFunction.GetValue<List<string>>(RtDataValues, "Scheduler.PjNameList");
  564. if (t == null && t.Count == 0)
  565. {
  566. return;
  567. }
  568. if (CommonFunction.GetValue<int>(RtDataValues, "EquipmentStatus") == 4)
  569. {
  570. t.ForEach(x =>
  571. {
  572. InvokeClient.Instance.Service.DoOperation("System.ResumeJob", x);
  573. });
  574. LOG.Info("System,Resume All Job");
  575. }
  576. else
  577. {
  578. t.ForEach(x =>
  579. {
  580. InvokeClient.Instance.Service.DoOperation("System.PauseJob", x);
  581. });
  582. LOG.Info("System,Pause All Job");
  583. }
  584. }
  585. private void OnAbortAll()
  586. {
  587. InvokeClient.Instance.Service.DoOperation("System.Abort");
  588. LOG.Info("System, Abort");
  589. }
  590. private void OnReturnAllWafer()
  591. {
  592. //Dialog
  593. WaferDialogView dialog = new WaferDialogView()
  594. {
  595. Owner = Application.Current.MainWindow,
  596. };
  597. dialog.Height = 300;
  598. dialog.Width = 400;
  599. double angel = 0;
  600. double coolingtime = 0;
  601. string message = "Please Confirm Return Wafer";
  602. WaferDialogViewModel vm = new WaferDialogViewModel();
  603. vm.ConfirmText = message;
  604. dialog.DataContext = vm;
  605. if (dialog.ShowDialog() == true)
  606. {
  607. if ((bool)dialog.AlignFlag == true && !string.IsNullOrEmpty(dialog.Angle))
  608. {
  609. angel = Convert.ToDouble(dialog.Angle);
  610. }
  611. if ((bool)dialog.CoolingFlag == true && !string.IsNullOrEmpty(dialog.CoolingTime))
  612. {
  613. coolingtime = Convert.ToDouble(dialog.CoolingTime);
  614. }
  615. InvokeClient.Instance.Service.DoOperation("System.ReturnAllWafer", dialog.CoolingFlag, coolingtime, dialog.AlignFlag, angel);
  616. }
  617. LOG.Info("System,Return All Wafer");
  618. }
  619. private void OnSetSequence(object obj)
  620. {
  621. var info = obj as WaferInfo;
  622. bool flag = info.SequenceName != "" ? false : true;
  623. if (info.ModuleID == "LP1" && (CommonFunction.GetValue<bool>(RtDataValues, "LP1.IsLoaded")))
  624. {
  625. AssociateSequence(LP1WaferAssociation, flag, info.SlotID);
  626. }
  627. else if (info.ModuleID == "LP2" && (CommonFunction.GetValue<bool>(RtDataValues, "LP2.IsLoaded")))
  628. {
  629. AssociateSequence(LP2WaferAssociation, flag, info.SlotID);
  630. }
  631. else if (info.ModuleID == "LP3" && (CommonFunction.GetValue<bool>(RtDataValues, "LP3.IsLoaded")))
  632. {
  633. AssociateSequence(LP3WaferAssociation, flag, info.SlotID);
  634. }
  635. }
  636. private void OnCreateJob(object obj)
  637. {
  638. var info = obj as WaferAssociationInfo;
  639. List<string> slotSequence = new List<string>();
  640. info.ModuleData.WaferManager.Wafers.ForEach(key => { slotSequence.Insert(0, key.SequenceName); });
  641. string jobId = info.LotId.Trim();
  642. //if (string.IsNullOrEmpty(jobId))
  643. // jobId = "CJ_Local_" + info.ModuleData.ModuleID;
  644. //info.LotId = jobId;
  645. //info.JobID = jobId;
  646. //info.JobStatus = "WaitingForStart";
  647. info.LotIdSaved = true;
  648. Dictionary<string, object> param = new Dictionary<string, object>()
  649. {
  650. {"JobId", ""},
  651. {"Module", info.ModuleData.ModuleID},
  652. {"SlotSequence", slotSequence.ToArray()},
  653. {"AutoStart", true},
  654. { "PreCleanRecipeName",info.PreCleanRecipeName},
  655. { "PostCleanRecipeName",info.PostCleanRecipeName}
  656. };
  657. InvokeClient.Instance.Service.DoOperation("System.CreateJob", param);
  658. }
  659. private void OnAbortJob(object obj)
  660. {
  661. InvokeClient.Instance.Service.DoOperation("System.AbortJob", obj.ToString());
  662. }
  663. private void OnEnableAuto()
  664. {
  665. InvokeClient.Instance.Service.DoOperation("System.SetAutoMode");
  666. }
  667. private void OnEnableManual()
  668. {
  669. InvokeClient.Instance.Service.DoOperation("System.SetManualMode");
  670. }
  671. private void OnLostFocus()
  672. {
  673. timer.Stop();
  674. }
  675. private void OnGotFocus()
  676. {
  677. timer.Start();
  678. }
  679. #endregion
  680. #region 私有方法
  681. private void Timer_Tick(object sender, EventArgs e)
  682. {
  683. RtDataValues = QueryDataClient.Instance.Service.PollData(m_RtDataKeys);
  684. if (RtDataValues == null || RtDataValues.Count==0)
  685. {
  686. return;
  687. }
  688. LP1ModuleInfo = ModuleManager.ModuleInfos["LP1"];
  689. LP2ModuleInfo = ModuleManager.ModuleInfos["LP2"];
  690. LP3ModuleInfo = ModuleManager.ModuleInfos["LP3"];
  691. EFEMModuleInfo = ModuleManager.ModuleInfos["EfemRobot"];
  692. TMModuleInfo = ModuleManager.ModuleInfos["TMRobot"];
  693. BladeAWafer = ModuleManager.ModuleInfos["EfemRobot"].WaferManager.Wafers[0];
  694. BladeBWafer = ModuleManager.ModuleInfos["EfemRobot"].WaferManager.Wafers[1];
  695. if (LLAIsInstalled == true)
  696. {
  697. LLAModuleInfo = ModuleManager.ModuleInfos["LLA"];
  698. LLAWafer = ModuleManager.ModuleInfos["LLA"].WaferManager.Wafers.FirstOrDefault(x => x.WaferStatus != 0);
  699. }
  700. if (LLBIsInstalled == true)
  701. {
  702. LLBModuleInfo = ModuleManager.ModuleInfos["LLB"];
  703. LLBWafer = ModuleManager.ModuleInfos["LLB"].WaferManager.Wafers.FirstOrDefault(x => x.WaferStatus != 0);
  704. }
  705. if (PMAIsInstalled == true)
  706. {
  707. PMAWafer = ModuleManager.ModuleInfos["PMA"].WaferManager.Wafers[0];
  708. PMARecipeResult = CommonFunction.GetValue<RecipeResult>(RtDataValues, $"PMA.CurrentRecipeResult");
  709. }
  710. if (PMBIsInstalled == true)
  711. {
  712. PMBWafer = ModuleManager.ModuleInfos["PMB"].WaferManager.Wafers[0];
  713. PMBRecipeResult = CommonFunction.GetValue<RecipeResult>(RtDataValues, $"PMB.CurrentRecipeResult");
  714. }
  715. if (PMCIsInstalled == true)
  716. {
  717. PMCWafer = ModuleManager.ModuleInfos["PMC"].WaferManager.Wafers[0];
  718. PMCRecipeResult = CommonFunction.GetValue<RecipeResult>(RtDataValues, $"PMC.CurrentRecipeResult");
  719. }
  720. if (PMDIsInstalled == true)
  721. {
  722. PMDWafer = ModuleManager.ModuleInfos["PMD"].WaferManager.Wafers[0];
  723. PMDRecipeResult = CommonFunction.GetValue<RecipeResult>(RtDataValues, $"PMD.CurrentRecipeResult");
  724. }
  725. if (TMIsInstalled == true)
  726. {
  727. TMBladeAWafer = ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[0];
  728. TMBladeBWafer = ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[1];
  729. TMPressure = CommonFunction.GetValue<float>(RtDataValues, $"TM.TMProcessGauge.Value");
  730. }
  731. if (EFEMIsInstalled == true)
  732. {
  733. EFEMBladeAWafer = ModuleManager.ModuleInfos["EfemRobot"].WaferManager.Wafers[0];
  734. EFEMBladeBWafer = ModuleManager.ModuleInfos["EfemRobot"].WaferManager.Wafers[1];
  735. Aligner1Wafer = ModuleManager.ModuleInfos["Aligner1"].WaferManager.Wafers[0];
  736. ControlJobInfo lp1Cj = CommonFunction.GetValue<ControlJobInfo>(RtDataValues, "LP1.CurrentControlJob");
  737. if (lp1Cj == null)
  738. {
  739. ButtonIsEnableLP1 = true;
  740. }
  741. else
  742. {
  743. ButtonIsEnableLP1= false;
  744. }
  745. UPdateWaferAssociation(LP1WaferAssociation, lp1Cj);
  746. ControlJobInfo lp2Cj = CommonFunction.GetValue<ControlJobInfo>(RtDataValues, "LP2.CurrentControlJob");
  747. if (lp2Cj == null)
  748. {
  749. ButtonIsEnableLP2 = true;
  750. }
  751. else
  752. {
  753. ButtonIsEnableLP2 = false;
  754. }
  755. UPdateWaferAssociation(LP2WaferAssociation, lp2Cj);
  756. ControlJobInfo lp3Cj = CommonFunction.GetValue<ControlJobInfo>(RtDataValues, "LP3.CurrentControlJob");
  757. if (lp3Cj == null)
  758. {
  759. ButtonIsEnableLP3 = true;
  760. }
  761. else
  762. {
  763. ButtonIsEnableLP3 = false;
  764. }
  765. UPdateWaferAssociation(LP3WaferAssociation, lp3Cj);
  766. }
  767. RobotMoveInfo = (RobotMoveInfo)QueryDataClient.Instance.Service.GetData("TM.RobotMoveAction");
  768. EfemRobotMoveInfo = (RobotMoveInfo)QueryDataClient.Instance.Service.GetData("EFEM.RobotMoveAction");
  769. LP1WaferCount = LP1ModuleInfo.WaferManager.Wafers.Where(x => x.WaferStatus != 0).Count();
  770. LP2WaferCount = LP2ModuleInfo.WaferManager.Wafers.Where(x => x.WaferStatus != 0).Count();
  771. LP3WaferCount = LP3ModuleInfo.WaferManager.Wafers.Where(x => x.WaferStatus != 0).Count();
  772. if (CommonFunction.GetValue<int>(RtDataValues, "EquipmentStatus") == 4)
  773. {
  774. RouteState = "Resume";
  775. }
  776. else
  777. {
  778. RouteState = "Pause";
  779. }
  780. }
  781. /// <summary>
  782. /// 更新Wafer情况
  783. /// </summary>
  784. /// <param name="info"></param>
  785. /// <param name="cjInfo"></param>
  786. private void UPdateWaferAssociation(WaferAssociationInfo info, ControlJobInfo cjInfo)
  787. {
  788. if(info==null)
  789. {
  790. return;
  791. }
  792. if (cjInfo != null)
  793. {
  794. info.LotId = cjInfo.Name;
  795. info.JobID = cjInfo.Name;
  796. info.JobStatus = cjInfo.State.ToString();
  797. if (cjInfo.SequenceNameList != null)
  798. {
  799. for (int i = 0; i < cjInfo.SequenceNameList.Length; i++)
  800. {
  801. info.ModuleData.WaferManager.Wafers[24 - i].SequenceName = cjInfo.SequenceNameList[i];
  802. }
  803. }
  804. info.PreCleanRecipeName = cjInfo.PreJobClean;
  805. info.PostCleanRecipeName = cjInfo.PostJobClean;
  806. }
  807. else
  808. {
  809. if (!string.IsNullOrEmpty(info.JobID))
  810. {
  811. info.LotId = "";
  812. info.JobID = "";
  813. info.JobStatus = "";
  814. info.PreCleanRecipeName = "";
  815. info.PostCleanRecipeName = "";
  816. AssociateSequence(info, false);
  817. }
  818. }
  819. }
  820. private async void RobotMoveInfoChanged(RobotMoveInfo oldValue, RobotMoveInfo newValue)
  821. {
  822. string RobotTarget;
  823. if (oldValue == null || newValue == null)
  824. {
  825. return;
  826. }
  827. #region Rotating
  828. if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && (newValue.Action == RobotAction.Rotating))
  829. {
  830. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  831. if (TMRobotMoveActionBladeTarget != null)
  832. {
  833. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  834. }
  835. else
  836. {
  837. return;
  838. }
  839. var values = RobotTarget.Split('.');
  840. var arm = values[0];
  841. var module = values[1];
  842. if (arm == "ArmA")
  843. {
  844. Robot1TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  845. }
  846. else if (arm == "ArmB")
  847. {
  848. Robot2TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  849. }
  850. }
  851. #endregion
  852. #region pick 和 place LL
  853. else if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && (newValue.Action == RobotAction.Placing || newValue.Action == RobotAction.Picking))
  854. {
  855. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  856. if (TMRobotMoveActionBladeTarget != null)
  857. {
  858. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  859. }
  860. else
  861. {
  862. return;
  863. }
  864. var values = RobotTarget.Split('.');
  865. var arm = values[0];
  866. var module = values[1];
  867. if (arm == "ArmA")
  868. {
  869. var waferRobotTAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  870. if (waferRobotTAction != Robot1TAction)
  871. {
  872. Robot1TAction = waferRobotTAction;
  873. }
  874. else
  875. {
  876. //await Task.Delay(100);
  877. }
  878. await Task.Delay(600);
  879. //Robot1TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  880. //await Task.Delay(600);
  881. Robot1XAction = WaferRobotXAction.Extend;
  882. while ((newValue.Action == RobotAction.Placing && ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[0].WaferStatus != 0) || (newValue.Action == RobotAction.Picking && ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[0].WaferStatus == 0))
  883. {
  884. await Task.Delay(100);
  885. }
  886. Robot1XAction = WaferRobotXAction.Retract;
  887. }
  888. else if (arm == "ArmB")
  889. {
  890. var waferRobotTAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  891. if (waferRobotTAction != Robot2TAction)
  892. {
  893. Robot2TAction = waferRobotTAction;
  894. }
  895. else
  896. {
  897. //await Task.Delay(100);
  898. }
  899. await Task.Delay(600);
  900. //Robot2TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  901. //await Task.Delay(600);
  902. Robot2XAction = WaferRobotXAction.Extend;
  903. while ((newValue.Action == RobotAction.Placing && ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[1].WaferStatus != 0) || (newValue.Action == RobotAction.Picking && ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[1].WaferStatus == 0))
  904. {
  905. await Task.Delay(100);
  906. }
  907. Robot2XAction = WaferRobotXAction.Retract;
  908. }
  909. }
  910. #endregion
  911. #region pick 和 place pm
  912. else if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && newValue.Action == RobotAction.Extending)
  913. {
  914. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  915. if (TMRobotMoveActionBladeTarget != null)
  916. {
  917. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  918. }
  919. else
  920. {
  921. return;
  922. }
  923. var values = RobotTarget.Split('.');
  924. var arm = values[0];
  925. var module = values[1];
  926. if (arm == "ArmA")
  927. {
  928. var waferRobotTAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  929. if (waferRobotTAction != Robot1TAction)
  930. {
  931. Robot1TAction = waferRobotTAction;
  932. }
  933. else
  934. {
  935. // await Task.Delay(100);
  936. }
  937. await Task.Delay(600);
  938. Robot1XAction = WaferRobotXAction.Extend;
  939. }
  940. else if (arm == "ArmB")
  941. {
  942. var waferRobotTAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  943. if (waferRobotTAction != Robot2TAction)
  944. {
  945. Robot2TAction = waferRobotTAction;
  946. }
  947. else
  948. {
  949. // await Task.Delay(100);
  950. }
  951. await Task.Delay(600);
  952. Robot2XAction = WaferRobotXAction.Extend;
  953. }
  954. }
  955. else if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && newValue.Action == RobotAction.Retracting)
  956. {
  957. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  958. if (TMRobotMoveActionBladeTarget != null)
  959. {
  960. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  961. }
  962. else
  963. {
  964. return;
  965. }
  966. var values = RobotTarget.Split('.');
  967. var arm = values[0];
  968. if (arm == "ArmA")
  969. {
  970. Robot1XAction = WaferRobotXAction.Retract;
  971. }
  972. else if (arm == "ArmB")
  973. {
  974. Robot2XAction = WaferRobotXAction.Retract;
  975. }
  976. }
  977. #endregion
  978. #region Home
  979. else if (oldValue.Action == RobotAction.None && newValue.Action == RobotAction.Homing)
  980. {
  981. if (Robot1XAction == WaferRobotXAction.Extend)
  982. {
  983. Robot1XAction = WaferRobotXAction.Retract;
  984. }
  985. if (Robot2XAction == WaferRobotXAction.Extend)
  986. {
  987. Robot2XAction = WaferRobotXAction.Retract;
  988. }
  989. await Task.Delay(2000);
  990. if (Robot1TAction != WaferRobotTAction.T_Origin)
  991. {
  992. Robot1TAction = WaferRobotTAction.T_Origin;
  993. }
  994. if (Robot2TAction != WaferRobotTAction.T_Origin)
  995. {
  996. Robot2TAction = WaferRobotTAction.T_Origin;
  997. }
  998. }
  999. #endregion
  1000. }
  1001. private async void EFEMRobotMoveInfoChanged(RobotMoveInfo oldValue, RobotMoveInfo newValue)
  1002. {
  1003. string RobotTarget;
  1004. if (oldValue == null || newValue == null)
  1005. {
  1006. return;
  1007. }
  1008. #region pick 和 place LL
  1009. if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && (newValue.Action == RobotAction.Placing || newValue.Action == RobotAction.Picking))
  1010. {
  1011. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  1012. if (TMRobotMoveActionBladeTarget != null)
  1013. {
  1014. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  1015. }
  1016. else
  1017. {
  1018. return;
  1019. }
  1020. var values = RobotTarget.Split('.');
  1021. var arm = values[0];
  1022. var module = values[1];
  1023. if (arm == "ArmA")
  1024. {
  1025. var robot3Robot3TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  1026. //await Task.Delay(1000);
  1027. await ChangePosition(robot3Robot3TAction);
  1028. if (Robot3TAction != robot3Robot3TAction)
  1029. {
  1030. Robot3TAction = robot3Robot3TAction;
  1031. await Task.Delay(600);
  1032. }
  1033. Robot3XAction = WaferRobotXAction.Extend;
  1034. while ((newValue.Action == RobotAction.Placing && ModuleManager.ModuleInfos["EfemRobot"].WaferManager.Wafers[0].WaferStatus != 0) || (newValue.Action == RobotAction.Picking && ModuleManager.ModuleInfos["EfemRobot"].WaferManager.Wafers[0].WaferStatus == 0))
  1035. {
  1036. await Task.Delay(100);
  1037. }
  1038. Robot3XAction = WaferRobotXAction.Retract;
  1039. }
  1040. else if (arm == "ArmB")
  1041. {
  1042. var robot4Robot4TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  1043. //await Task.Delay(1000);
  1044. await ChangePosition(robot4Robot4TAction);
  1045. if (Robot4TAction != robot4Robot4TAction)
  1046. {
  1047. Robot4TAction = robot4Robot4TAction;
  1048. await Task.Delay(600);
  1049. }
  1050. //ChangePosition(Robot4TAction);
  1051. //await Task.Delay(2000);
  1052. Robot4XAction = WaferRobotXAction.Extend;
  1053. while ((newValue.Action == RobotAction.Placing && ModuleManager.ModuleInfos["EfemRobot"].WaferManager.Wafers[1].WaferStatus != 0) || (newValue.Action == RobotAction.Picking && ModuleManager.ModuleInfos["EfemRobot"].WaferManager.Wafers[1].WaferStatus == 0))
  1054. {
  1055. await Task.Delay(100);
  1056. }
  1057. Robot4XAction = WaferRobotXAction.Retract;
  1058. }
  1059. }
  1060. #endregion
  1061. #region pick 和 place pm
  1062. if (oldValue.Action == RobotAction.None && newValue.Action == RobotAction.Extending)
  1063. {
  1064. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  1065. if (TMRobotMoveActionBladeTarget != null)
  1066. {
  1067. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  1068. }
  1069. else
  1070. {
  1071. return;
  1072. }
  1073. var values = RobotTarget.Split('.');
  1074. var arm = values[0];
  1075. var module = values[1];
  1076. if (arm == "ArmA")
  1077. {
  1078. Robot3TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  1079. await Task.Delay(1500);
  1080. //ChangePosition(Robot3TAction);
  1081. //await Task.Delay(2000);
  1082. Robot3XAction = WaferRobotXAction.Extend;
  1083. }
  1084. else if (arm == "ArmB")
  1085. {
  1086. Robot4TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  1087. await Task.Delay(1500);
  1088. //ChangePosition(Robot4TAction);
  1089. //await Task.Delay(2000);
  1090. Robot4XAction = WaferRobotXAction.Extend;
  1091. }
  1092. }
  1093. if (oldValue.Action == RobotAction.None && newValue.Action == RobotAction.Retracting)
  1094. {
  1095. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  1096. if (TMRobotMoveActionBladeTarget != null)
  1097. {
  1098. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  1099. }
  1100. else
  1101. {
  1102. return;
  1103. }
  1104. var values = RobotTarget.Split('.');
  1105. var arm = values[0];
  1106. if (arm == "ArmA")
  1107. {
  1108. Robot3XAction = WaferRobotXAction.Retract;
  1109. await Task.Delay(3000);
  1110. //ChangePosition(Robot3TAction);
  1111. //await Task.Delay(2000);
  1112. }
  1113. else if (arm == "ArmB")
  1114. {
  1115. Robot4XAction = WaferRobotXAction.Retract;
  1116. await Task.Delay(3000);
  1117. //ChangePosition(Robot3TAction);
  1118. //await Task.Delay(2000);
  1119. }
  1120. }
  1121. #endregion
  1122. #region Home
  1123. else if (oldValue.Action == RobotAction.None && newValue.Action == RobotAction.Homing)
  1124. {
  1125. if (Robot3XAction == WaferRobotXAction.Extend)
  1126. {
  1127. Robot3XAction = WaferRobotXAction.Retract;
  1128. }
  1129. if (Robot4XAction == WaferRobotXAction.Extend)
  1130. {
  1131. Robot4XAction = WaferRobotXAction.Retract;
  1132. }
  1133. if (Robot3TAction != WaferRobotTAction.T_Origin)
  1134. {
  1135. Robot3TAction = WaferRobotTAction.T_Origin;
  1136. }
  1137. if (Robot4TAction != WaferRobotTAction.T_Origin)
  1138. {
  1139. Robot4TAction = WaferRobotTAction.T_Origin;
  1140. }
  1141. await Task.Delay(1000);
  1142. await ChangePosition(WaferRobotTAction.T_Origin);
  1143. }
  1144. #endregion
  1145. }
  1146. private void addDataKeys()
  1147. {
  1148. m_RtDataKeys.Add("PMA.IsSlitDoorClosed");
  1149. m_RtDataKeys.Add("PMA.CurrentRecipeResult");
  1150. m_RtDataKeys.Add("PMA.IsOnline");
  1151. m_RtDataKeys.Add("PMA.CalculationPressure");
  1152. m_RtDataKeys.Add("PMA.IsLidClosed");
  1153. m_RtDataKeys.Add("PMB.IsSlitDoorClosed");
  1154. m_RtDataKeys.Add("PMB.CurrentRecipeResult");
  1155. m_RtDataKeys.Add("PMB.IsOnline");
  1156. m_RtDataKeys.Add("PMB.CalculationPressure");
  1157. m_RtDataKeys.Add("PMB.IsLidClosed");
  1158. m_RtDataKeys.Add("PMC.IsSlitDoorClosed");
  1159. m_RtDataKeys.Add("PMC.CurrentRecipeResult");
  1160. m_RtDataKeys.Add("PMC.IsOnline");
  1161. m_RtDataKeys.Add("PMC.CalculationPressure");
  1162. m_RtDataKeys.Add("PMC.IsLidClosed");
  1163. m_RtDataKeys.Add("PMD.IsSlitDoorClosed");
  1164. m_RtDataKeys.Add("PMD.CurrentRecipeResult");
  1165. m_RtDataKeys.Add("PMD.IsOnline");
  1166. m_RtDataKeys.Add("PMD.CalculationPressure");
  1167. m_RtDataKeys.Add("PMD.IsLidClosed");
  1168. m_RtDataKeys.Add("TM.LLATSlitDoor.IsClosed");
  1169. m_RtDataKeys.Add("TM.LLBTSlitDoor.IsClosed");
  1170. m_RtDataKeys.Add("TM.LLAESlitDoor.IsClosed");
  1171. m_RtDataKeys.Add("TM.LLBESlitDoor.IsClosed");
  1172. m_RtDataKeys.Add("TM.IsOnline");
  1173. m_RtDataKeys.Add("TM.TMProcessGauge.Value");
  1174. m_RtDataKeys.Add("TM.TMATMSwitch.Value");
  1175. m_RtDataKeys.Add("TM.TMVacSwitch.Value");
  1176. m_RtDataKeys.Add("TM.TMProcessGauge.Value");
  1177. m_RtDataKeys.Add("TM.TMLidClosed");
  1178. m_RtDataKeys.Add("TM.LLALidClosed");
  1179. m_RtDataKeys.Add("TM.LLBLidClosed");
  1180. m_RtDataKeys.Add("TM.PMASlitDoor.IsClosed");
  1181. m_RtDataKeys.Add("TM.PMBSlitDoor.IsClosed");
  1182. m_RtDataKeys.Add("TM.PMCSlitDoor.IsClosed");
  1183. m_RtDataKeys.Add("TM.PMDSlitDoor.IsClosed");
  1184. m_RtDataKeys.Add("LLA.IsOnline");
  1185. m_RtDataKeys.Add($"TM.LLAPressureGauge.Value");
  1186. m_RtDataKeys.Add($"TM.LLAVacSwitch.Value");
  1187. m_RtDataKeys.Add($"TM.LLAATMSwitch.Value");
  1188. m_RtDataKeys.Add("LLB.IsOnline");
  1189. m_RtDataKeys.Add($"TM.LLBPressureGauge.Value");
  1190. m_RtDataKeys.Add($"TM.LLBVacSwitch.Value");
  1191. m_RtDataKeys.Add($"TM.LLBATMSwitch.Value");
  1192. m_RtDataKeys.Add("LP1.IsLoaded");
  1193. m_RtDataKeys.Add("LP2.IsLoaded");
  1194. m_RtDataKeys.Add("LP3.IsLoaded");
  1195. m_RtDataKeys.Add("LP1.CassettePlaced");
  1196. m_RtDataKeys.Add("LP2.CassettePlaced");
  1197. m_RtDataKeys.Add("LP3.CassettePlaced");
  1198. m_RtDataKeys.Add("LP1.CurrentControlJob");
  1199. m_RtDataKeys.Add("LP2.CurrentControlJob");
  1200. m_RtDataKeys.Add("LP3.CurrentControlJob");
  1201. m_RtDataKeys.Add("EFEM.IsOnline");
  1202. m_RtDataKeys.Add("System.IsAutoMode");
  1203. m_RtDataKeys.Add("System.IsBusy");
  1204. m_RtDataKeys.Add("Scheduler.CycledCount");
  1205. m_RtDataKeys.Add("Scheduler.CycledWafer");
  1206. m_RtDataKeys.Add("Scheduler.CycleSetPoint");
  1207. m_RtDataKeys.Add("Scheduler.Throughput");
  1208. m_RtDataKeys.Add("EquipmentStatus");
  1209. m_RtDataKeys.Add("Scheduler.PjNameList");
  1210. }
  1211. private void AssociateSequence(WaferAssociationInfo info, bool flag, int slot = -1)
  1212. {
  1213. List<WaferInfo> wafers = info.ModuleData.WaferManager.Wafers;
  1214. if (slot >= 0) //by wafer
  1215. {
  1216. int index = wafers.Count - slot - 1;
  1217. if (index < wafers.Count)
  1218. {
  1219. if (flag && HasWaferOnSlot(wafers, index))
  1220. wafers[index].SequenceName = info.SequenceName;
  1221. else
  1222. wafers[index].SequenceName = string.Empty;
  1223. }
  1224. }
  1225. else //by from-to
  1226. {
  1227. for (int i = info.SlotFrom - 1; i < info.SlotTo; i++)
  1228. {
  1229. int index = wafers.Count - i - 1;
  1230. if (index < wafers.Count)
  1231. {
  1232. if (flag && HasWaferOnSlot(wafers, index))
  1233. wafers[index].SequenceName = info.SequenceName;
  1234. else
  1235. wafers[index].SequenceName = string.Empty;
  1236. }
  1237. }
  1238. }
  1239. switch (info.ModuleData.ModuleID)
  1240. {
  1241. case "LP1":
  1242. LP1WaferAssociation = info;
  1243. break;
  1244. case "LP2":
  1245. LP2WaferAssociation = info;
  1246. break;
  1247. case "LP3":
  1248. LP3WaferAssociation = info;
  1249. break;
  1250. }
  1251. }
  1252. private bool HasWaferOnSlot(List<WaferInfo> wafers, int index)
  1253. {
  1254. if (wafers[index].WaferStatus == 0)
  1255. return false;
  1256. return true;
  1257. }
  1258. private async Task ChangePosition(WaferRobotTAction waferRobotTAction)
  1259. {
  1260. await Task.Delay(500);
  1261. int delay = 500;
  1262. if (waferRobotTAction == WaferRobotTAction.LP1)
  1263. {
  1264. CurrentRobotPosition = RobotPosition.Left;
  1265. await Task.Delay(delay);
  1266. }
  1267. else if (waferRobotTAction == WaferRobotTAction.LP3)
  1268. {
  1269. CurrentRobotPosition = RobotPosition.Right;
  1270. await Task.Delay(delay);
  1271. }
  1272. else if (waferRobotTAction == WaferRobotTAction.LP2)
  1273. {
  1274. CurrentRobotPosition = RobotPosition.Middle;
  1275. await Task.Delay(delay);
  1276. }
  1277. else
  1278. {
  1279. CurrentRobotPosition = RobotPosition.Origin;
  1280. await Task.Delay(delay);
  1281. }
  1282. }
  1283. public void EnterExitView(bool isEnter)
  1284. {
  1285. if (isEnter)
  1286. {
  1287. Timer_Tick(null, null);
  1288. timer.Start();
  1289. }
  1290. else
  1291. {
  1292. timer.Stop();
  1293. }
  1294. }
  1295. #endregion
  1296. }
  1297. }