OperationOverViewModel.cs 55 KB

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