OperationOverViewModel.cs 53 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396
  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 bool 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 bool 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"));
  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. //}
  688. InvokeClient.Instance.Service.DoOperation("System.ReturnAllWafer", false, 0, false, 0);
  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.IoSensor.TMATMSwitch.Value");
  1138. m_RtDataKeys.Add("TM.IoSensor.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.IoSensor.LLAVacSwitch.Value");
  1150. m_RtDataKeys.Add($"TM.IoSensor.LLAATMSwitch.Value");
  1151. m_RtDataKeys.Add("LLB.IsOnline");
  1152. m_RtDataKeys.Add($"TM.LLBPressureGauge.Value");
  1153. m_RtDataKeys.Add($"TM.IoSensor.LLBVacSwitch.Value");
  1154. m_RtDataKeys.Add($"TM.IoSensor.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. }