ModuleName.cs 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740
  1. using Aitex.Core.RT.Log;
  2. using Aitex.Core.RT.SCCore;
  3. using Aitex.Core.Utilities;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Runtime.Serialization;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. namespace MECF.Framework.Common.Equipment
  11. {
  12. /// <summary>
  13. /// 在框架中,Module指具备放置Wafer的单元
  14. /// </summary>
  15. [DataContract]
  16. [Serializable]
  17. public enum ModuleName
  18. {
  19. [EnumMember]
  20. System = 0,
  21. [EnumMember]
  22. LP1,
  23. [EnumMember]
  24. LP2,
  25. [EnumMember]
  26. LP3,
  27. [EnumMember]
  28. LP4,
  29. [EnumMember]
  30. LP5,
  31. [EnumMember]
  32. LP6,
  33. [EnumMember]
  34. LP7,
  35. [EnumMember]
  36. LP8,
  37. [EnumMember]
  38. LP9,
  39. [EnumMember]
  40. LP10,
  41. //robot modules
  42. //[EnumMember]
  43. //Robot,
  44. [EnumMember]
  45. VaccumRobot,
  46. [EnumMember]
  47. LoadRobot,
  48. [EnumMember]
  49. EfemRobot,
  50. [EnumMember]
  51. TMRobot,
  52. //upenders
  53. [EnumMember]
  54. Upender,
  55. //efem
  56. [EnumMember]
  57. EFEM,
  58. //aligners
  59. [EnumMember]
  60. Aligner,
  61. [EnumMember]
  62. Aligner1,
  63. [EnumMember]
  64. Aligner2,
  65. [EnumMember]
  66. AlignerA,
  67. [EnumMember]
  68. AlignerB,
  69. //load locks
  70. [EnumMember]
  71. LL1,
  72. [EnumMember]
  73. LL2,
  74. [EnumMember]
  75. LL3,
  76. [EnumMember]
  77. LL4,
  78. [EnumMember]
  79. LL5,
  80. [EnumMember]
  81. LL6,
  82. [EnumMember]
  83. LL7,
  84. [EnumMember]
  85. LL8,
  86. //load locks
  87. [EnumMember]
  88. LLA,
  89. [EnumMember]
  90. LLB,
  91. [EnumMember]
  92. LLC,
  93. [EnumMember]
  94. LLD,
  95. [EnumMember]
  96. LLE,
  97. [EnumMember]
  98. LLF,
  99. [EnumMember]
  100. LLG,
  101. [EnumMember]
  102. LLH,
  103. [EnumMember]
  104. VCE1,
  105. [EnumMember]
  106. VCE2,
  107. [EnumMember]
  108. VCEA,
  109. [EnumMember]
  110. VCEB,
  111. //transfer modules
  112. [EnumMember]
  113. TM,
  114. [EnumMember]
  115. Cooling1,
  116. [EnumMember]
  117. Cooling2,
  118. //buffers
  119. [EnumMember]
  120. Buffer,
  121. [EnumMember]
  122. Buffer1,
  123. [EnumMember]
  124. Buffer2,
  125. [EnumMember]
  126. Buffer3,
  127. [EnumMember]
  128. Buffer4,
  129. [EnumMember]
  130. Buffer5,
  131. [EnumMember]
  132. Buffer6,
  133. //PMs
  134. [EnumMember]
  135. PM,
  136. [EnumMember]
  137. PM1,
  138. [EnumMember]
  139. PM2,
  140. [EnumMember]
  141. PM3,
  142. [EnumMember]
  143. PM4,
  144. [EnumMember]
  145. PM5,
  146. [EnumMember]
  147. PM6,
  148. [EnumMember]
  149. PM7,
  150. [EnumMember]
  151. PM8,
  152. [EnumMember]
  153. PMA,
  154. [EnumMember]
  155. PMB,
  156. [EnumMember]
  157. PMC,
  158. [EnumMember]
  159. PMD,
  160. //PMs
  161. [EnumMember]
  162. Spin1L,
  163. [EnumMember]
  164. Spin1H,
  165. [EnumMember]
  166. Spin2L,
  167. [EnumMember]
  168. Spin2H,
  169. [EnumMember]
  170. Spin3L,
  171. [EnumMember]
  172. Spin3H,
  173. [EnumMember]
  174. Spin4L,
  175. [EnumMember]
  176. Spin4H,
  177. [EnumMember]
  178. Spin5L,
  179. [EnumMember]
  180. Spin5H,
  181. [EnumMember]
  182. Spin6L,
  183. [EnumMember]
  184. Spin6H,
  185. [EnumMember]
  186. LDULD,
  187. [EnumMember]
  188. BufferOut,
  189. [EnumMember]
  190. BufferIn,
  191. [EnumMember]
  192. Dryer,
  193. [EnumMember]
  194. QDR,
  195. [EnumMember]
  196. Robot,
  197. [EnumMember]
  198. Handler,
  199. [EnumMember]
  200. WIDReader1,
  201. [EnumMember]
  202. WIDReader2,
  203. [EnumMember]
  204. LL1IN,
  205. [EnumMember]
  206. LL1OUT,
  207. [EnumMember]
  208. LL2IN,
  209. [EnumMember]
  210. LL2OUT,
  211. [EnumMember]
  212. TurnOverStation,
  213. [EnumMember]
  214. Host,
  215. [EnumMember]
  216. PTR,
  217. [EnumMember]
  218. Cooling,
  219. [EnumMember]
  220. Cassette,
  221. [EnumMember]
  222. CassInnerL,
  223. [EnumMember]
  224. CassInnerR,
  225. [EnumMember]
  226. CassOuterL,
  227. [EnumMember]
  228. CassOuterR,
  229. [EnumMember]
  230. CassAL,
  231. [EnumMember]
  232. CassAR,
  233. [EnumMember]
  234. CassBL,
  235. [EnumMember]
  236. CassBR,
  237. [EnumMember]
  238. Shuttle,
  239. [EnumMember]
  240. CoolingBuffer1,
  241. [EnumMember]
  242. CoolingBuffer2,
  243. [EnumMember]
  244. LoadLock,
  245. [EnumMember]
  246. SMIFLeft,
  247. [EnumMember]
  248. SMIFRight,
  249. [EnumMember]
  250. SMIFA,
  251. [EnumMember]
  252. SMIFB,
  253. [EnumMember]
  254. SPM1,
  255. [EnumMember]
  256. SPM2,
  257. [EnumMember]
  258. BRM1,
  259. [EnumMember]
  260. BRM2,
  261. [EnumMember]
  262. CCU,
  263. [EnumMember]
  264. Buffer7,
  265. [EnumMember]
  266. Buffer8,
  267. [EnumMember]
  268. Robot1,
  269. [EnumMember]
  270. Robot2,
  271. [EnumMember]
  272. CassetteRobot,
  273. [EnumMember]
  274. SignalTower,
  275. [EnumMember]
  276. TurnStation,
  277. [EnumMember]
  278. InternalCassette1,
  279. [EnumMember]
  280. InternalCassette2,
  281. [EnumMember]
  282. InternalCassette3,
  283. [EnumMember]
  284. InternalCassette4,
  285. [EnumMember]
  286. InternalCassette5,
  287. [EnumMember]
  288. InternalCassette6,
  289. [EnumMember]
  290. InternalCassette7,
  291. [EnumMember]
  292. InternalCassette8,
  293. [EnumMember]
  294. InternalCassette9,
  295. [EnumMember]
  296. InternalCassette10,
  297. [EnumMember]
  298. Prs1,
  299. [EnumMember]
  300. Prs2,
  301. [EnumMember]
  302. Prs3,
  303. [EnumMember]
  304. Prs4,
  305. [EnumMember]
  306. PerHeat,
  307. [EnumMember]
  308. StageA,
  309. [EnumMember]
  310. StageB,
  311. }
  312. public static class ModuleHelper
  313. {
  314. public static bool IsTurnOverStation(ModuleName unit)
  315. {
  316. return unit == ModuleName.TurnOverStation;
  317. }
  318. public static bool IsLoadPort(ModuleName unit)
  319. {
  320. return unit == ModuleName.LP1
  321. || unit == ModuleName.LP2
  322. || unit == ModuleName.LP3
  323. || unit == ModuleName.LP4
  324. || unit == ModuleName.LP5
  325. || unit == ModuleName.LP6
  326. || unit == ModuleName.LP7
  327. || unit == ModuleName.LP8
  328. || unit == ModuleName.LP9
  329. || unit == ModuleName.LP10;
  330. }
  331. public static bool IsCoolingBuffer(ModuleName unit)
  332. {
  333. return unit == ModuleName.CoolingBuffer1
  334. || unit == ModuleName.CoolingBuffer2;
  335. }
  336. public static bool IsCassette(ModuleName unit)
  337. {
  338. return unit == ModuleName.CassAL
  339. || unit == ModuleName.CassAR
  340. || unit == ModuleName.CassBL
  341. || unit == ModuleName.CassBR
  342. || unit == ModuleName.Cassette;
  343. }
  344. public static bool IsBuffer(ModuleName unit)
  345. {
  346. return unit == ModuleName.Buffer
  347. || unit == ModuleName.Buffer1
  348. || unit == ModuleName.Buffer2
  349. || unit == ModuleName.Buffer3
  350. || unit == ModuleName.Buffer4
  351. || unit == ModuleName.Buffer5
  352. || unit == ModuleName.Buffer6
  353. || unit == ModuleName.Buffer7
  354. || unit == ModuleName.Buffer8
  355. || unit == ModuleName.BufferIn
  356. || unit == ModuleName.BufferOut;
  357. }
  358. public static bool IsPm(string unit)
  359. {
  360. return IsPm(ModuleHelper.Converter(unit));
  361. }
  362. public static bool IsPm(ModuleName unit)
  363. {
  364. return unit == ModuleName.PM1
  365. || unit == ModuleName.PM2
  366. || unit == ModuleName.PM3
  367. || unit == ModuleName.PM4
  368. || unit == ModuleName.PM5
  369. || unit == ModuleName.PM6
  370. || unit == ModuleName.PM7
  371. || unit == ModuleName.PM8
  372. || unit == ModuleName.Spin1L
  373. || unit == ModuleName.Spin1H
  374. || unit == ModuleName.Spin2L
  375. || unit == ModuleName.Spin2H
  376. || unit == ModuleName.Spin3L
  377. || unit == ModuleName.Spin3H
  378. || unit == ModuleName.Spin4L
  379. || unit == ModuleName.Spin4H
  380. || unit == ModuleName.PM
  381. || unit == ModuleName.PMA
  382. || unit == ModuleName.PMB
  383. || unit == ModuleName.PMC
  384. || unit == ModuleName.PMD
  385. || unit == ModuleName.SPM1
  386. || unit == ModuleName.SPM2
  387. || unit == ModuleName.BRM1
  388. || unit == ModuleName.BRM2
  389. ;
  390. }
  391. public static bool IsLoadLock(string unit)
  392. {
  393. return IsLoadLock(ModuleHelper.Converter(unit));
  394. }
  395. public static bool IsLoadLock(ModuleName unit)
  396. {
  397. return unit == ModuleName.LLA
  398. || unit == ModuleName.LLB
  399. || unit == ModuleName.LL1
  400. || unit == ModuleName.LL1IN
  401. || unit == ModuleName.LL1OUT
  402. || unit == ModuleName.LL2
  403. || unit == ModuleName.LL2IN
  404. || unit == ModuleName.LL2OUT
  405. || unit == ModuleName.LL3
  406. || unit == ModuleName.LL4
  407. || unit == ModuleName.LL5
  408. || unit == ModuleName.LL6
  409. || unit == ModuleName.LL7
  410. || unit == ModuleName.LL8
  411. || unit == ModuleName.LLC
  412. || unit == ModuleName.LLD
  413. || unit == ModuleName.LoadLock
  414. || unit == ModuleName.VCEA
  415. || unit == ModuleName.VCEB;
  416. }
  417. public static bool IsCooling(string unit)
  418. {
  419. return IsCooling(ModuleHelper.Converter(unit));
  420. }
  421. public static bool IsCooling(ModuleName unit)
  422. {
  423. return unit == ModuleName.Cooling
  424. || unit == ModuleName.Cooling1
  425. || unit == ModuleName.Cooling2;
  426. }
  427. public static bool IsAligner(string unit)
  428. {
  429. return IsAligner(ModuleHelper.Converter(unit));
  430. }
  431. public static bool IsAligner(ModuleName unit)
  432. {
  433. return unit == ModuleName.Aligner
  434. || unit == ModuleName.Aligner1
  435. || unit == ModuleName.Aligner2;
  436. }
  437. public static bool IsRobot(string unit)
  438. {
  439. return IsRobot(ModuleHelper.Converter(unit));
  440. }
  441. public static bool IsRobot(ModuleName unit)
  442. {
  443. return unit.ToString().Contains("Robot");
  444. }
  445. public static bool IsEfemRobot(string unit)
  446. {
  447. return IsEfemRobot(ModuleHelper.Converter(unit));
  448. }
  449. public static bool IsEfem(ModuleName unit)
  450. {
  451. return unit == ModuleName.EFEM;
  452. }
  453. public static bool IsEfemRobot(ModuleName unit)
  454. {
  455. return unit == ModuleName.EfemRobot;
  456. }
  457. public static bool IsTMRobot(string unit)
  458. {
  459. return IsTMRobot(ModuleHelper.Converter(unit));
  460. }
  461. public static bool IsTM(ModuleName unit)
  462. {
  463. return unit == ModuleName.TM;
  464. }
  465. public static bool IsTMRobot(ModuleName unit)
  466. {
  467. return unit == ModuleName.TMRobot;
  468. }
  469. public static bool IsTurnStation(ModuleName unit)
  470. {
  471. return unit == ModuleName.TurnStation;
  472. }
  473. public static bool IsVCE(string unit)
  474. {
  475. return IsVCE(ModuleHelper.Converter(unit));
  476. }
  477. public static bool IsVCE(ModuleName unit)
  478. {
  479. return unit == ModuleName.VCE1|| unit == ModuleName.VCE2|| unit == ModuleName.VCEA|| unit == ModuleName.VCEB;
  480. }
  481. public static string GetAbbr(ModuleName module)
  482. {
  483. switch (module)
  484. {
  485. case ModuleName.Aligner: return "PA";
  486. case ModuleName.Robot: return "RB";
  487. default: return module.ToString();
  488. }
  489. }
  490. public static string GetE84LpName(string device)
  491. {
  492. string e84 = string.Empty;
  493. switch(device)
  494. {
  495. case "P1":
  496. case "LP1":
  497. e84 = "Loadport1E84";
  498. break;
  499. case "P2":
  500. case "LP2":
  501. e84 = "Loadport2E84";
  502. break;
  503. case "P3":
  504. case "LP3":
  505. e84 = "Loadport3E84";
  506. break;
  507. case "P4":
  508. case "LP4":
  509. e84 = "Loadport4E84";
  510. break;
  511. case "P5":
  512. case "LP5":
  513. e84 = "Loadport5E84";
  514. break;
  515. case "P6":
  516. case "LP6":
  517. e84 = "Loadport6E84";
  518. break;
  519. case "P7":
  520. case "LP7":
  521. e84 = "Loadport7E84";
  522. break;
  523. case "P8":
  524. case "LP8":
  525. e84 = "Loadport8E84";
  526. break;
  527. case "P9":
  528. case "LP9":
  529. e84 = "Loadport9E84";
  530. break;
  531. case "P10":
  532. case "LP10":
  533. e84 = "Loadport10E84";
  534. break;
  535. }
  536. return e84;
  537. }
  538. public static ModuleName Converter(string module)
  539. {
  540. return (ModuleName) Enum.Parse(typeof(ModuleName), module);
  541. }
  542. /// <summary>
  543. ///
  544. /// </summary>
  545. /// <param name="index">0 based</param>
  546. /// <returns></returns>
  547. public static ModuleName GetLoadPort(int index)
  548. {
  549. ModuleName[] lps = new ModuleName[]
  550. {
  551. ModuleName.LP1, ModuleName.LP2, ModuleName.LP3, ModuleName.LP4, ModuleName.LP5,
  552. ModuleName.LP6, ModuleName.LP7, ModuleName.LP8, ModuleName.LP9, ModuleName.LP10,
  553. };
  554. return lps[index];
  555. }
  556. private static List<ModuleName> _lstModules = new List<ModuleName>();
  557. private static readonly object _lock = new object();
  558. public static bool IsInstalled(ModuleName module)
  559. {
  560. if (_lstModules.Count == 0)
  561. {
  562. LoadModules();
  563. }
  564. return _lstModules.Contains(module);
  565. }
  566. public static void LoadModules()
  567. {
  568. lock (_lock)
  569. {
  570. try
  571. {
  572. EnumLoop<ModuleName>.ForEach((item) =>
  573. {
  574. if(SC.GetValueOrDefault<bool>($"System.SetUp.{item}.IsInstalled") && !_lstModules.Contains(item))
  575. _lstModules.Add(item);
  576. });
  577. }
  578. catch (Exception e)
  579. {
  580. LOG.Info($"Loading intalled module error, please check the config item: System.InstalledModules,{e}");
  581. }
  582. }
  583. }
  584. }
  585. public class ModuleNameString
  586. {
  587. public const string System = "System";
  588. public const string LDULD = "LDULD";
  589. public const string BufferOut = "BufferOut";
  590. public const string BufferIn = "BufferIn";
  591. public const string Dryer = "Dryer";
  592. public const string QDR = "QDR";
  593. public const string Robot = "Robot";
  594. public const string Handler = "Handler";
  595. public static ModuleName ToEnum(string value)
  596. {
  597. return (ModuleName)Enum.Parse(typeof(ModuleName), value, true);
  598. }
  599. }
  600. }