OperationOverViewModel.cs 61 KB

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