OperationOverViewModel.cs 53 KB

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