OperationOverViewModel.cs 61 KB

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