SunWayRobot.cs 46 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Collections;
  7. using CyberX8_Core;
  8. using CyberX8_RT.Modules;
  9. using MECF.Framework.Common.CommonData;
  10. using MECF.Framework.Common.Equipment;
  11. using MECF.Framework.Common.SubstrateTrackings;
  12. using Aitex.Sorter.Common;
  13. using Aitex.Core.Common;
  14. using Aitex.Core.RT.SCCore;
  15. using Aitex.Core.RT.Log;
  16. using Aitex.Core.Util;
  17. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robot;
  18. using CyberX8_RT.Devices.YASKAWA;
  19. using System.Collections.Concurrent;
  20. using System.Diagnostics;
  21. using System.Data.SqlTypes;
  22. using System.Windows.Media.Media3D;
  23. using System.ComponentModel;
  24. using MECF.Framework.Common.Beckhoff.Station;
  25. using System.Runtime.Remoting.Contexts;
  26. using System.Windows.Markup;
  27. using CyberX8_RT.Modules.LPs;
  28. using MECF.Framework.Common.ToolLayout;
  29. namespace CyberX8_RT.Devices.EFEM
  30. {
  31. public class SunWayRobot : EfemBase
  32. {
  33. #region 常量
  34. private const string NONE = "None";
  35. #endregion
  36. private RState _status;
  37. private bool _IsHomed;
  38. private bool _bIsUnloadClamp;
  39. private RobotMoveInfo _robotMoveInfo = new RobotMoveInfo();
  40. private readonly SignalTower _signalT = new SignalTower();
  41. private readonly AsyncSocket _socket;
  42. private EfemMessage _currentMessage;
  43. private string _error;
  44. private bool _LiftIsUp = false;
  45. private bool _LiftIsDown = false;
  46. private R_TRIG _busyTrig = new R_TRIG();
  47. private Stopwatch _busyWatch = new Stopwatch();
  48. private Dictionary<string, int> _moduleStationNumberDictionary = new Dictionary<string, int>();
  49. private Dictionary<Hand, string> _armString = new Dictionary<Hand, string>
  50. {
  51. [Hand.Blade1] = "A",
  52. [Hand.Blade2] = "B"
  53. };
  54. public override RState Status
  55. {
  56. get
  57. {
  58. _busyTrig.CLK = _status == RState.Running;
  59. if (_busyTrig.Q)
  60. {
  61. _busyWatch.Restart();
  62. }
  63. else if (_busyTrig.M)
  64. {
  65. int timeOut = 5000;
  66. if (
  67. _currentMessage.Operation == EfemOperation.Home ||
  68. _currentMessage.Operation == EfemOperation.Map ||
  69. _currentMessage.Operation == EfemOperation.Pick ||
  70. _currentMessage.Operation == EfemOperation.Place)
  71. {
  72. timeOut = 30000;
  73. }
  74. if (_busyWatch.ElapsedMilliseconds > timeOut)
  75. {
  76. _busyWatch.Stop();
  77. _status = RState.Timeout;
  78. }
  79. }
  80. return _status;
  81. }
  82. }
  83. public override bool IsHomed { get { return _IsHomed; } }
  84. public override RobotMoveInfo TMRobotMoveInfo { get { return _robotMoveInfo; } }
  85. public override bool LiftIsUp { get { return _LiftIsUp; } }
  86. public override bool LiftIsDown { get { return _LiftIsDown; } }
  87. private BlockingCollection<RobotAnimationData> blockingCollection = new BlockingCollection<RobotAnimationData>();
  88. private string _address = "";
  89. public SunWayRobot()
  90. {
  91. _socket = new AsyncSocket("","",DataType.Ascii,true);
  92. try
  93. {
  94. _address = SC.GetStringValue($"EFEM.IPAddress");
  95. _socket.Connect(_address);
  96. _socket.OnConnect += Socket_OnConnect;
  97. _socket.OnDataChanged += OnReceiveMessage;
  98. _socket.OnErrorHappened += OnErrorHappen;
  99. }
  100. catch(Exception ex)
  101. {
  102. LOG.WriteLog(eEvent.ERR_EFEM_COMMON_FAILED, "EFEM", ex.Message);
  103. }
  104. _status = RState.Init;
  105. _IsHomed = false;
  106. _busyTrig.RST = true;
  107. InitializeModuleStation(ModuleName.LP1);
  108. InitializeModuleStation(ModuleName.LP2);
  109. InitializeModuleStation(ModuleName.LP3);
  110. InitializeModuleStation(ModuleName.Dummy1);
  111. InitializeModuleStation(ModuleName.Dummy2);
  112. InitializeModuleStation(ModuleName.Aligner1);
  113. InitializeModuleStation(ModuleName.SRD1);
  114. InitializeModuleStation(ModuleName.SRD2);
  115. InitializeModuleStation(ModuleName.PUF1);
  116. CarrierManager.Instance.SubscribeLocation(ModuleName.LP1.ToString(), 1);
  117. CarrierManager.Instance.SubscribeLocation(ModuleName.LP2.ToString(), 1);
  118. CarrierManager.Instance.SubscribeLocation(ModuleName.LP3.ToString(), 1);
  119. WaferManager.Instance.SubscribeLocation(ModuleName.EfemRobot, 2);
  120. WaferManager.Instance.SubscribeLocation(ModuleName.Aligner1, 1);
  121. WaferManager.Instance.SubscribeLocation(ModuleName.LP1, SC.GetValue<int>("EFEM.LoadPort.SlotNumber"));
  122. WaferManager.Instance.SubscribeLocation(ModuleName.LP2, SC.GetValue<int>("EFEM.LoadPort.SlotNumber"));
  123. WaferManager.Instance.SubscribeLocation(ModuleName.LP3, SC.GetValue<int>("EFEM.LoadPort.SlotNumber"));
  124. Task.Run(() =>
  125. {
  126. foreach (var data in blockingCollection.GetConsumingEnumerable())
  127. {
  128. _robotMoveInfo.Action = data.Action;
  129. _robotMoveInfo.ArmTarget = data.Hand == Hand.Blade1 ? RobotArm.ArmA : (data.Hand == Hand.Both ? RobotArm.Both : RobotArm.ArmB);
  130. _robotMoveInfo.BladeTarget = $"{_robotMoveInfo.ArmTarget}.{data.Target}";
  131. System.Threading.Thread.Sleep(600);
  132. }
  133. });
  134. }
  135. /// <summary>
  136. /// 初始化Module Station
  137. /// </summary>
  138. /// <param name="module"></param>
  139. private void InitializeModuleStation(ModuleName module)
  140. {
  141. int cassete200Station = SC.GetValue<int>($"EFEM.{module}.Cassete200Station");
  142. _moduleStationNumberDictionary[$"{module}_200"] = cassete200Station;
  143. int cassete150Station = SC.GetValue<int>($"EFEM.{module}.Cassete150Station");
  144. _moduleStationNumberDictionary[$"{module}_150"] = cassete150Station;
  145. int cassete100Station = SC.GetValue<int>($"EFEM.{module}.Cassete100Station");
  146. _moduleStationNumberDictionary[$"{module}_100"]=cassete100Station;
  147. }
  148. private void Socket_OnConnect()
  149. {
  150. Singleton<RouteManager>.Instance.EFEM.PostMsg(EfemEntity.MSG.CommReady);
  151. LOG.WriteLog(eEvent.EV_EFEM_COMMON_INFO, Module.ToString(), $"connect {_address} success");
  152. }
  153. private void OnErrorHappen(ErrorEventArgs args)
  154. {
  155. _status = RState.Failed;
  156. if (_error != args.Reason)
  157. {
  158. _error = args.Reason;
  159. LOG.Write(eEvent.ERR_EFEM_COMMON_FAILED, Module, $"{Module} {_error}");
  160. }
  161. Singleton<RouteManager>.Instance.EFEM.PostMsg(EfemEntity.MSG.Error);
  162. }
  163. public override void Monitor()
  164. {
  165. }
  166. public override void Terminate()
  167. {
  168. }
  169. public override void Reset()
  170. {
  171. _status = RState.End;
  172. _currentMessage = null;
  173. }
  174. public override void SetOnline(bool online)
  175. {
  176. }
  177. public override void SetOnline(ModuleName mod, bool online)
  178. {
  179. }
  180. public override void SetBusy(ModuleName mod, bool online)
  181. {
  182. _status = RState.Running;
  183. }
  184. public override bool HomeAll()
  185. {
  186. if (_status == RState.Running&&_currentMessage!=null)
  187. {
  188. LOG.WriteLog(eEvent.ERR_EFEM_COMMON_FAILED, Module.ToString(), $"Current Msg {_currentMessage.Operation} is Running,cannot home All");
  189. return false;
  190. }
  191. //判断socket是否链接
  192. if (!_socket.IsConnected)
  193. {
  194. LOG.WriteLog(eEvent.ERROR_EFEM_COMMUNICATION, Module.ToString(), $"Socket is not Conntected");
  195. return false ;
  196. }
  197. _status = RState.Running;
  198. string data = "HOME ALL\r";
  199. _currentMessage =new EfemMessage(){
  200. Operation= EfemOperation.Home,
  201. Module=ModuleName.EFEM
  202. };
  203. //SetRobotMovingInfo(RobotAction.Homing, Hand.Both, ModuleName.EFEM);
  204. return WriteCommand(data);
  205. }
  206. public override bool Home(ModuleName mod)
  207. {
  208. if (_status == RState.Running && _currentMessage!= null)
  209. {
  210. LOG.WriteLog(eEvent.ERR_EFEM_COMMON_FAILED, Module.ToString(), $"Current Msg {_currentMessage.Operation} is Running,cannot home {mod}");
  211. return false;
  212. }
  213. if (mod != ModuleName.Aligner1&&mod!=ModuleName.EfemRobot)
  214. {
  215. LOG.WriteLog(eEvent.ERR_EFEM_COMMON_FAILED, Module.ToString(), $"{mod} can not support home method");
  216. return false;
  217. }
  218. //判断socket是否链接
  219. if (!_socket.IsConnected)
  220. {
  221. LOG.WriteLog(eEvent.ERROR_EFEM_COMMUNICATION, Module.ToString(), $"Socket is not Conntected");
  222. return false;
  223. }
  224. if(mod == ModuleName.EfemRobot) SetRobotMovingInfo(RobotAction.Homing, Hand.Blade1, ModuleName.EfemRobot);
  225. _status = RState.Running;
  226. string cmd = "Home ALL\r";
  227. if (mod == ModuleName.Aligner1)
  228. {
  229. cmd = "ALIGNER HOME\r";
  230. }
  231. _currentMessage = new EfemMessage()
  232. {
  233. Operation = EfemOperation.Home,
  234. Module = ModuleName.Aligner1
  235. };
  236. return WriteCommand(cmd);
  237. }
  238. public override bool OriginalSearch(ModuleName mod)
  239. {
  240. return true;
  241. }
  242. public override bool CheckWaferPresence()
  243. {
  244. if (_status == RState.Running && _currentMessage != null)
  245. {
  246. LOG.WriteLog(eEvent.ERR_EFEM_COMMON_FAILED, Module.ToString(), $"Current Msg {_currentMessage.Operation} is Running,cannot check wafer");
  247. return false;
  248. }
  249. //判断socket是否链接
  250. if (!_socket.IsConnected)
  251. {
  252. LOG.WriteLog(eEvent.ERROR_EFEM_COMMUNICATION, Module.ToString(), $"Socket is not Conntected");
  253. return false;
  254. }
  255. if (!CheckEfemStatus())
  256. return false;
  257. _currentMessage = new EfemMessage()
  258. {
  259. Operation = EfemOperation.StateTrack,
  260. Module = ModuleName.EfemRobot
  261. };
  262. _status = RState.Running;
  263. string cmd = $"RQ LOAD {_armString[Hand.Blade1]}\r";
  264. return WriteCommand(cmd);
  265. }
  266. public override string GetWaferPresence()
  267. {
  268. return "";
  269. }
  270. public override bool Halt()
  271. {
  272. //判断socket是否链接
  273. if (!_socket.IsConnected)
  274. {
  275. LOG.WriteLog(eEvent.ERROR_EFEM_COMMUNICATION, Module.ToString(), $"Socket is not Conntected");
  276. return false;
  277. }
  278. _currentMessage = new EfemMessage()
  279. {
  280. Operation = EfemOperation.Abort,
  281. Module = ModuleName.EfemRobot
  282. };
  283. SetRobotMovingInfo(RobotAction.None, Hand.Both, ModuleName.EFEM);
  284. string cmd = "HALT\r";
  285. return WriteCommand(cmd);
  286. }
  287. public override bool Pause()
  288. {
  289. return true;
  290. }
  291. public override bool Resume()
  292. {
  293. return true;
  294. }
  295. public override bool ClearError()
  296. {
  297. return true;
  298. }
  299. public override bool CloseBuzzer()
  300. {
  301. LOG.WriteLog(eEvent.ERR_EFEM_COMMON_FAILED, Module.ToString(), $"System cannot support {EfemConstant.OperationString[EfemOperation.TurnOffBuzzer]}");
  302. return false;
  303. }
  304. public override bool PickExtend(ModuleName chamber, int slot, Hand hand)
  305. {
  306. LOG.WriteLog(eEvent.ERR_EFEM_COMMON_FAILED, Module.ToString(), $"System cannot support {EfemConstant.OperationString[EfemOperation.Extend]}");
  307. return false;
  308. }
  309. public override bool PickRetract(ModuleName chamber, int slot, Hand hand)
  310. {
  311. LOG.WriteLog(eEvent.ERR_EFEM_COMMON_FAILED, Module.ToString(), $"System cannot support {EfemConstant.OperationString[EfemOperation.Extend]}");
  312. return false;
  313. }
  314. public override bool PlaceExtend(ModuleName chamber, int slot, Hand hand)
  315. {
  316. LOG.WriteLog(eEvent.ERR_EFEM_COMMON_FAILED, Module.ToString(), $"System cannot support {EfemConstant.OperationString[EfemOperation.Extend]}");
  317. return false;
  318. }
  319. public override bool PlaceRetract(ModuleName chamber, int slot, Hand hand)
  320. {
  321. LOG.WriteLog(eEvent.ERR_EFEM_COMMON_FAILED, Module.ToString(), $"System cannot support {EfemConstant.OperationString[EfemOperation.Extend]}");
  322. return false;
  323. }
  324. public override bool Pick(ModuleName station, int slot, Hand hand)
  325. {
  326. if (_status == RState.Running && _currentMessage != null)
  327. {
  328. LOG.WriteLog(eEvent.ERR_EFEM_COMMON_FAILED, Module.ToString(), $"Current Msg {_currentMessage.Operation} is Running,cannot pick");
  329. return false;
  330. }
  331. //判断socket是否链接
  332. if (!_socket.IsConnected)
  333. {
  334. LOG.WriteLog(eEvent.ERROR_EFEM_COMMUNICATION, Module.ToString(), $"Socket is not Conntected");
  335. return false;
  336. }
  337. //判断Loadport的门是否打开
  338. //if (ModuleHelper.IsLoadPort(station) && !GetLoadPort(station).IsDoorOpened)
  339. //{
  340. // LOG.WriteLog(eEvent.ERR_EFEM_COMMON_FAILED, Module.ToString(), $"{station}'s Door is Closed, Cannot Execute Pick Action");
  341. // return false;
  342. //}
  343. if (!CheckEfemStatus())
  344. return false;
  345. int waferSize = GetModuleSlotWaferSize(station,slot);
  346. if (waferSize == 0)
  347. {
  348. LOG.WriteLog(eEvent.ERR_EFEM_COMMON_FAILED, Module.ToString(), $"{station} slot {slot} wafer size is 0, Cannot Execute Pick Action");
  349. return false;
  350. }
  351. string strModuleWaferSize = $"{station}_{waferSize}";
  352. if (!_moduleStationNumberDictionary.ContainsKey(strModuleWaferSize))
  353. {
  354. LOG.WriteLog(eEvent.ERR_EFEM_COMMON_FAILED, Module.ToString(), $"{station}'s number is not exist, Cannot Execute Pick Action");
  355. return false;
  356. }
  357. int stationNumber= _moduleStationNumberDictionary[strModuleWaferSize];
  358. string cmd = $"PICK {stationNumber} SLOT {slot+1} ARM {_armString[hand]}\r";
  359. if(ModuleHelper.IsPUF(station)||ModuleHelper.IsAligner(station)||ModuleHelper.IsSRD(station))
  360. {
  361. cmd = $"PICK {stationNumber} SLOT 1 ARM {_armString[hand]}\r";
  362. }
  363. _currentMessage = new EfemMessage()
  364. {
  365. Operation=EfemOperation.Pick
  366. };
  367. _status = RState.Running;
  368. SetRobotMovingInfo(RobotAction.Picking, hand, station);
  369. return WriteCommand(cmd);
  370. }
  371. private Loadport GetLoadPort(ModuleName station)
  372. {
  373. LoadPortModule loadPortModule = Singleton<RouteManager>.Instance.EFEM.GetLoadportModule(station - ModuleName.LP1);
  374. return loadPortModule.LPDevice;
  375. }
  376. public override bool Place(ModuleName station, int slot, Hand hand)
  377. {
  378. if (_status == RState.Running && _currentMessage != null)
  379. {
  380. LOG.WriteLog(eEvent.ERR_EFEM_COMMON_FAILED, Module.ToString(), $"Current Msg {_currentMessage.Operation} is Running,cannot place");
  381. return false;
  382. }
  383. //判断socket是否链接
  384. if (!_socket.IsConnected)
  385. {
  386. LOG.WriteLog(eEvent.ERROR_EFEM_COMMUNICATION, Module.ToString(), $"Socket is not Conntected");
  387. return false;
  388. }
  389. //判断Loadport的门是否打开
  390. //if (ModuleHelper.IsLoadPort(station) && !GetLoadPort(station).IsDoorOpened)
  391. //{
  392. // LOG.WriteLog(eEvent.ERR_EFEM_COMMON_FAILED, Module.ToString(), $"{station}'s Door is Closed, Cannot Execute Pick Action");
  393. // return false;
  394. //}
  395. if (!CheckEfemStatus())
  396. return false;
  397. int waferSize = GetModuleSlotWaferSize(ModuleName.EfemRobot, (int)hand);
  398. if (waferSize == 0)
  399. {
  400. LOG.WriteLog(eEvent.ERR_EFEM_COMMON_FAILED, Module.ToString(), $"{station} slot {slot} wafer size is 0, Cannot Execute Place Action");
  401. return false;
  402. }
  403. string strModuleWaferSize = $"{station}_{waferSize}";
  404. _currentMessage = new EfemMessage()
  405. {
  406. Operation = EfemOperation.Place
  407. };
  408. _status = RState.Running;
  409. int stationNumber = _moduleStationNumberDictionary[strModuleWaferSize];
  410. string cmd = $"PLACE {stationNumber} SLOT {slot+1} ARM {_armString[hand]}\r";
  411. if (ModuleHelper.IsPUF(station)||ModuleHelper.IsSRD(station))
  412. {
  413. cmd = $"PLACE {stationNumber} SLOT 1 ARM {_armString[hand]}\r";
  414. }
  415. if (ModuleHelper.IsAligner(station))
  416. {
  417. cmd = $"PLACE {stationNumber} PHOME\r";
  418. }
  419. SetRobotMovingInfo(RobotAction.Placing, hand, station);
  420. return WriteCommand(cmd);
  421. }
  422. public override bool Goto(ModuleName station, Hand hand, string updown = "UP")
  423. {
  424. if (_status == RState.Running && _currentMessage != null)
  425. {
  426. LOG.WriteLog(eEvent.ERR_EFEM_COMMON_FAILED, Module.ToString(), $"Current Msg {_currentMessage.Operation} is Running,cannot goto");
  427. return false;
  428. }
  429. if (!CheckEfemStatus())
  430. return false;
  431. //判断socket是否链接
  432. if (!_socket.IsConnected)
  433. {
  434. LOG.WriteLog(eEvent.ERROR_EFEM_COMMUNICATION, Module.ToString(), $"Socket is not Conntected");
  435. return false;
  436. }
  437. _currentMessage = new EfemMessage()
  438. {
  439. Operation = EfemOperation.Goto
  440. };
  441. int waferSize = GetModuleNameWaferSize(station);
  442. if (waferSize == 0)
  443. {
  444. LOG.WriteLog(eEvent.ERROR_EFEM_COMMUNICATION, Module.ToString(), $"wafersize is 0");
  445. return false;
  446. }
  447. string strModuleWaferSize = $"{station}_{waferSize}";
  448. int stationNumber = _moduleStationNumberDictionary[strModuleWaferSize];
  449. string cmd = $"GOTO N {stationNumber} R EX Z {updown} ARM SLOT 1 {_armString[hand]}\r";
  450. _status = RState.Running;
  451. return WriteCommand(cmd);
  452. }
  453. public override bool Grip(Hand blade, bool isGrip)
  454. {
  455. LOG.WriteLog(eEvent.ERR_EFEM_COMMON_FAILED, Module.ToString(), $"System cannot support {EfemConstant.OperationString[EfemOperation.Grip]}");
  456. return false;
  457. }
  458. public override bool GotoMap(ModuleName mod,Hand hand,string extend="EX")
  459. {
  460. if (_status == RState.Running && _currentMessage != null)
  461. {
  462. LOG.WriteLog(eEvent.ERR_EFEM_COMMON_FAILED, Module.ToString(), $"Current Msg {_currentMessage.Operation} is Running,cannot goto map");
  463. return false;
  464. }
  465. //判断socket是否链接
  466. if (!_socket.IsConnected)
  467. {
  468. LOG.WriteLog(eEvent.ERROR_EFEM_COMMUNICATION, Module.ToString(), $"Socket is not Conntected");
  469. return false;
  470. }
  471. if (!CheckEfemStatus())
  472. return false;
  473. int waferSize = GetModuleNameWaferSize(mod);
  474. if (waferSize == 0)
  475. {
  476. LOG.WriteLog(eEvent.ERROR_EFEM_COMMUNICATION, Module.ToString(), $"wafersize is 0");
  477. return false;
  478. }
  479. string strModuleWaferSize = $"{mod}_{waferSize}";
  480. int stationNumber = _moduleStationNumberDictionary[strModuleWaferSize];
  481. string cmd = $"GOTO N {stationNumber} MAP {extend} ARM {_armString[hand]}\r";
  482. _currentMessage = new EfemMessage()
  483. {
  484. Operation = EfemOperation.Goto,
  485. Module= mod
  486. };
  487. _status = RState.Running;
  488. return WriteCommand(cmd);
  489. }
  490. public override bool Map(ModuleName mod)
  491. {
  492. if (_status == RState.Running && _currentMessage != null)
  493. {
  494. LOG.WriteLog(eEvent.ERR_EFEM_COMMON_FAILED, Module.ToString(), $"Current Msg {_currentMessage.Operation} is Running,cannot map");
  495. return false;
  496. }
  497. //判断socket是否链接
  498. if (!_socket.IsConnected)
  499. {
  500. LOG.WriteLog(eEvent.ERROR_EFEM_COMMUNICATION, Module.ToString(), $"Socket is not Conntected");
  501. return false;
  502. }
  503. if (!CheckEfemStatus())
  504. return false;
  505. int waferSize = GetModuleNameWaferSize(mod);
  506. if (waferSize == 0)
  507. {
  508. LOG.WriteLog(eEvent.ERROR_EFEM_COMMUNICATION, Module.ToString(), $"wafersize is 0");
  509. return false;
  510. }
  511. string strModuleWaferSize = $"{mod}_{waferSize}";
  512. int stationNumber = _moduleStationNumberDictionary[strModuleWaferSize];
  513. _currentMessage = new EfemMessage()
  514. {
  515. Operation = EfemOperation.Map,
  516. Module = mod
  517. };
  518. string cmd = $"MAP {stationNumber} ARM {_armString[Hand.Blade1]}\r";
  519. _status = RState.Running;
  520. return WriteCommand(cmd);
  521. }
  522. public override bool RequestMapResult(ModuleName mod)
  523. {
  524. if (_status == RState.Running && _currentMessage != null)
  525. {
  526. LOG.WriteLog(eEvent.ERR_EFEM_COMMON_FAILED, Module.ToString(), $"Current Msg {_currentMessage.Operation} is Running,cannot request map");
  527. return false;
  528. }
  529. //判断socket是否链接
  530. if (!_socket.IsConnected)
  531. {
  532. LOG.WriteLog(eEvent.ERROR_EFEM_COMMUNICATION, Module.ToString(), $"Socket is not Conntected");
  533. return false;
  534. }
  535. if (!CheckEfemStatus())
  536. return false;
  537. int waferSize = GetModuleNameWaferSize(mod);
  538. if (waferSize == 0)
  539. {
  540. LOG.WriteLog(eEvent.ERROR_EFEM_COMMUNICATION, Module.ToString(), $"wafersize is 0");
  541. return false;
  542. }
  543. string strModuleWaferSize = $"{mod}_{waferSize}";
  544. int stationNumber = _moduleStationNumberDictionary[strModuleWaferSize];
  545. _currentMessage = new EfemMessage()
  546. {
  547. Operation = EfemOperation.RequestMapResult,
  548. Module = mod
  549. };
  550. string cmd = $"RSR {stationNumber} ARM {_armString[Hand.Blade1]}\r";
  551. _status = RState.Running;
  552. return WriteCommand(cmd);
  553. }
  554. public override bool Vacuum(ModuleName mod,bool VacuumState)
  555. {
  556. if (_status == RState.Running && _currentMessage != null)
  557. {
  558. LOG.WriteLog(eEvent.ERR_EFEM_COMMON_FAILED, Module.ToString(), $"Current Msg {_currentMessage.Operation} is Running,cannot vacuum");
  559. return false;
  560. }
  561. //判断socket是否链接
  562. if (!_socket.IsConnected)
  563. {
  564. LOG.WriteLog(eEvent.ERROR_EFEM_COMMUNICATION, Module.ToString(), $"Socket is not Conntected");
  565. return false;
  566. }
  567. _currentMessage = new EfemMessage()
  568. {
  569. Operation = EfemOperation.Vacuum,
  570. Module = mod
  571. };
  572. _status = RState.Running;
  573. string strVacuum = VacuumState ? "ON" : "OFF";
  574. string cmd = "";
  575. if (ModuleName.Aligner1 == mod)
  576. {
  577. cmd = $"ALIGNER VAC {strVacuum}\r";
  578. }
  579. else
  580. {
  581. cmd = $"VAC {strVacuum} ARM {_armString[Hand.Blade1]}\r";
  582. }
  583. return WriteCommand(cmd);
  584. }
  585. public override bool GetWaferSize(ModuleName mod)
  586. {
  587. LOG.WriteLog(eEvent.ERR_EFEM_COMMON_FAILED, Module.ToString(), $"System cannot support GetWaferSize");
  588. return false;
  589. }
  590. public override bool SetWaferSize(ModuleName mod, int WaferSize)
  591. {
  592. LOG.WriteLog(eEvent.ERR_EFEM_COMMON_FAILED, Module.ToString(), $"System cannot support SetWaferSize");
  593. return false;
  594. }
  595. public override bool SetPinUp(ModuleName mod)
  596. {
  597. LOG.WriteLog(eEvent.ERR_EFEM_COMMON_FAILED, Module.ToString(), $"System cannot support {EfemConstant.OperationString[EfemOperation.Lift]}");
  598. return false;
  599. }
  600. public override bool SetPinDown(ModuleName mod)
  601. {
  602. LOG.WriteLog(eEvent.ERR_EFEM_COMMON_FAILED, Module.ToString(), $"System cannot support {EfemConstant.OperationString[EfemOperation.Lift]}");
  603. return false;
  604. }
  605. public override bool SetAlignWaferSize()
  606. {
  607. if (_status == RState.Running && _currentMessage != null)
  608. {
  609. LOG.WriteLog(eEvent.ERR_EFEM_COMMON_FAILED, Module.ToString(), $"Current Msg {_currentMessage.Operation} is Running,cannot Align Wafer Size");
  610. return false;
  611. }
  612. if (!CheckEfemStatus())
  613. return false;
  614. if (!WaferManager.Instance.CheckHasWafer(ModuleName.EfemRobot, 0))
  615. {
  616. LOG.WriteLog(eEvent.ERR_EFEM_COMMON_FAILED, Module.ToString(), $"{ModuleName.EfemRobot} has no wafer, Cannot Execute Set aligner wafersize");
  617. return false;
  618. }
  619. int waferSize = GetModuleSlotWaferSize(ModuleName.EfemRobot, 0);
  620. if (waferSize == 0)
  621. {
  622. LOG.WriteLog(eEvent.ERR_EFEM_COMMON_FAILED, Module.ToString(), $"{ModuleName.EfemRobot} wafer size is 0, Cannot Execute Set aligner wafersize");
  623. return false;
  624. }
  625. //判断socket是否链接
  626. if (!_socket.IsConnected)
  627. {
  628. LOG.WriteLog(eEvent.ERROR_EFEM_COMMUNICATION, Module.ToString(), $"Socket is not Conntected");
  629. return false;
  630. }
  631. _currentMessage = new EfemMessage()
  632. {
  633. Operation = EfemOperation.AlignWaferSize
  634. };
  635. string cmd = $"SET ALIGNER WAFERSIZE {waferSize}\r";
  636. _status = RState.Running;
  637. return WriteCommand(cmd);
  638. }
  639. public override bool SetAlignFlatType(int flatType)
  640. {
  641. if (_status == RState.Running && _currentMessage != null)
  642. {
  643. LOG.WriteLog(eEvent.ERR_EFEM_COMMON_FAILED, Module.ToString(), $"Current Msg {_currentMessage.Operation} is Running,cannot Align flat type");
  644. return false;
  645. }
  646. if (!CheckEfemStatus())
  647. return false;
  648. //判断socket是否链接
  649. if (!_socket.IsConnected)
  650. {
  651. LOG.WriteLog(eEvent.ERROR_EFEM_COMMUNICATION, Module.ToString(), $"Socket is not Conntected");
  652. return false;
  653. }
  654. _currentMessage = new EfemMessage()
  655. {
  656. Operation = EfemOperation.AlignFlatType
  657. };
  658. string cmd = $"SET ALIGNER WAFERTYPE {flatType}\r";
  659. _status = RState.Running;
  660. return WriteCommand(cmd);
  661. }
  662. public override bool SetAlignDistance()
  663. {
  664. int distance200 = SC.GetValue<int>("EFEM.Aligner1.Aligner200Distance");
  665. int distance150 = SC.GetValue<int>("EFEM.Aligner1.Aligner150Distance");
  666. int distance100 = SC.GetValue<int>("EFEM.Aligner1.Aligner100Distance");
  667. if (_status == RState.Running && _currentMessage != null)
  668. {
  669. LOG.WriteLog(eEvent.ERR_EFEM_COMMON_FAILED, Module.ToString(), $"Current Msg {_currentMessage.Operation} is Running,cannot Align flat type");
  670. return false;
  671. }
  672. if (!CheckEfemStatus())
  673. return false;
  674. //判断socket是否链接
  675. if (!_socket.IsConnected)
  676. {
  677. LOG.WriteLog(eEvent.ERROR_EFEM_COMMUNICATION, Module.ToString(), $"Socket is not Conntected");
  678. return false;
  679. }
  680. if (!WaferManager.Instance.CheckHasWafer(ModuleName.EfemRobot, 0))
  681. {
  682. LOG.WriteLog(eEvent.ERR_EFEM_COMMON_FAILED, Module.ToString(), $"{ModuleName.EfemRobot} has no wafer, Cannot Execute Set aligner wafersize");
  683. return false;
  684. }
  685. int waferSize = GetModuleSlotWaferSize(ModuleName.EfemRobot, 0);
  686. if (waferSize == 0)
  687. {
  688. LOG.WriteLog(eEvent.ERR_EFEM_COMMON_FAILED, Module.ToString(), $"{ModuleName.EfemRobot} wafer size is 0, Cannot Execute Set aligner wafersize");
  689. return false;
  690. }
  691. _currentMessage = new EfemMessage()
  692. {
  693. Operation = EfemOperation.AlignDistance
  694. };
  695. int distance = distance200;
  696. if (waferSize == (int)WaferSize.WS6)
  697. {
  698. distance = distance150;
  699. }
  700. else if (waferSize == (int)WaferSize.WS4)
  701. {
  702. distance = distance100;
  703. }
  704. string cmd = $"SET ALIGNER WAFERDISTANCE {distance}\r";
  705. _status = RState.Running;
  706. return WriteCommand(cmd);
  707. }
  708. public override bool SetAlignAngle(ModuleName mod, double angle)
  709. {
  710. if (_status == RState.Running && _currentMessage != null)
  711. {
  712. LOG.WriteLog(eEvent.ERR_EFEM_COMMON_FAILED, Module.ToString(), $"Current Msg {_currentMessage.Operation} is Running,cannot Align Angle");
  713. return false;
  714. }
  715. if (!CheckEfemStatus())
  716. return false;
  717. //判断socket是否链接
  718. if (!_socket.IsConnected)
  719. {
  720. LOG.WriteLog(eEvent.ERROR_EFEM_COMMUNICATION, Module.ToString(), $"Socket is not Conntected");
  721. return false;
  722. }
  723. _currentMessage = new EfemMessage()
  724. {
  725. Operation = EfemOperation.Align,
  726. };
  727. string cmd = $"SET ALIGNER POSTPOS 1 POS {angle*1000}\r";
  728. _status = RState.Running;
  729. return WriteCommand(cmd);
  730. }
  731. public override bool SetRobotSpeed(ModuleName mod, int speed)
  732. {
  733. if (_status == RState.Running && _currentMessage != null)
  734. {
  735. LOG.WriteLog(eEvent.ERR_EFEM_COMMON_FAILED, Module.ToString(), $"Current Msg {_currentMessage.Operation} is Running,cannot Speed");
  736. return false;
  737. }
  738. //判断socket是否链接
  739. if (!_socket.IsConnected)
  740. {
  741. LOG.WriteLog(eEvent.ERROR_EFEM_COMMUNICATION, Module.ToString(), $"Socket is not Conntected");
  742. return false;
  743. }
  744. _currentMessage = new EfemMessage()
  745. {
  746. Operation = EfemOperation.Speed
  747. };
  748. string cmd = $"SET ACTION SPEEDS {speed}\r";
  749. _status = RState.Running;
  750. return WriteCommand(cmd);
  751. }
  752. public override bool RobotPowerOn(ModuleName mod, bool Status)
  753. {
  754. if (_status == RState.Running && _currentMessage != null)
  755. {
  756. LOG.WriteLog(eEvent.ERR_EFEM_COMMON_FAILED, Module.ToString(), $"Current Msg {_currentMessage.Operation} is Running,cannot PowerOn");
  757. return false;
  758. }
  759. //判断socket是否链接
  760. if (!_socket.IsConnected)
  761. {
  762. LOG.WriteLog(eEvent.ERROR_EFEM_COMMUNICATION, Module.ToString(), $"Socket is not Conntected");
  763. return false;
  764. }
  765. string status = Status? "ON":"OFF";
  766. _currentMessage = new EfemMessage()
  767. {
  768. Operation = EfemOperation.PowerOn
  769. };
  770. string cmd = $"SET SERVOS {status}\r";
  771. _status = RState.Running;
  772. return WriteCommand(cmd);
  773. }
  774. public override bool Align(ModuleName mod, double angle, float delayTime, WaferSize size)
  775. {
  776. if (_status == RState.Running && _currentMessage != null)
  777. {
  778. LOG.WriteLog(eEvent.ERR_EFEM_COMMON_FAILED, Module.ToString(), $"Current Msg {_currentMessage.Operation} is Running,cannot Align");
  779. return false;
  780. }
  781. //判断socket是否链接
  782. if (!_socket.IsConnected)
  783. {
  784. LOG.WriteLog(eEvent.ERROR_EFEM_COMMUNICATION, Module.ToString(), $"Socket is not Conntected");
  785. return false;
  786. }
  787. if (!CheckEfemStatus())
  788. return false;
  789. _currentMessage = new EfemMessage()
  790. {
  791. Operation = EfemOperation.Align
  792. };
  793. _status = RState.Running;
  794. string cmd = "ALIGNER ALGN\r";
  795. return WriteCommand(cmd);
  796. }
  797. public override bool SetLamp(LightType light, LightStatus status)
  798. {
  799. return false;
  800. }
  801. public override bool Load(ModuleName mod)
  802. {
  803. LOG.WriteLog(eEvent.ERR_EFEM_COMMON_FAILED, Module.ToString(), $"System cannot support Load");
  804. return false;
  805. }
  806. public override bool Unload(ModuleName mod)
  807. {
  808. LOG.WriteLog(eEvent.ERR_EFEM_COMMON_FAILED, Module.ToString(), $"System cannot support Unload");
  809. return false;
  810. }
  811. public override bool ReadCarrierId(ModuleName mod)
  812. {
  813. LOG.WriteLog(eEvent.ERR_EFEM_COMMON_FAILED, Module.ToString(), $"System cannot support ReadCarrierId");
  814. return false;
  815. }
  816. public override bool WriteCarrierId(ModuleName mod, string id)
  817. {
  818. LOG.WriteLog(eEvent.ERR_EFEM_COMMON_FAILED, Module.ToString(), $"System cannot support WriteCarrierId");
  819. return false;
  820. }
  821. public override bool ReadTagData(ModuleName mod)
  822. {
  823. return ReadCarrierId(mod);
  824. }
  825. public override bool WriteTagData(ModuleName mod, string tagData)
  826. {
  827. return WriteCarrierId(mod, tagData);
  828. }
  829. public override bool Dock(ModuleName mod)
  830. {
  831. LOG.WriteLog(eEvent.ERR_EFEM_COMMON_FAILED, Module.ToString(), $"System cannot support Dock");
  832. return false;
  833. }
  834. public override bool Undock(ModuleName mod)
  835. {
  836. LOG.WriteLog(eEvent.ERR_EFEM_COMMON_FAILED, Module.ToString(), $"System cannot support Undock");
  837. return false;
  838. }
  839. public override bool Clamp(ModuleName mod, bool isUnloadClamp)
  840. {
  841. LOG.WriteLog(eEvent.ERR_EFEM_COMMON_FAILED, Module.ToString(), $"System cannot support Clamp");
  842. return false;
  843. }
  844. public override bool Unclamp(ModuleName mod)
  845. {
  846. LOG.WriteLog(eEvent.ERR_EFEM_COMMON_FAILED, Module.ToString(), $"System cannot support Unclamp");
  847. return false;
  848. }
  849. public override bool SetThickness(ModuleName mod, string thickness)
  850. {
  851. LOG.WriteLog(eEvent.ERR_EFEM_COMMON_FAILED, Module.ToString(), $"System cannot support {EfemConstant.OperationString[EfemOperation.SetThickness]}");
  852. return false;
  853. }
  854. public override void SetRobotMovingInfo(RobotAction action, Hand hand, ModuleName target)
  855. {
  856. blockingCollection.Add(new RobotAnimationData(action, hand, target));
  857. }
  858. private void OnReceiveMessage(string msg)
  859. {
  860. LOG.WriteLog(eEvent.EV_EFEM_COMMON_INFO, Module.ToString(), msg.Replace("\r",""));
  861. if (_currentMessage == null)
  862. {
  863. return;
  864. }
  865. if(msg.StartsWith("_ERR"))
  866. {
  867. string error = msg.Replace("_ERR", "").Trim();
  868. OnErrorOccurred(error);
  869. _currentMessage = null;
  870. SetRobotMovingInfo(RobotAction.None, Hand.Both, ModuleName.EFEM);
  871. return;
  872. }
  873. else if(msg.StartsWith("_RDY"))
  874. {
  875. _status = RState.End;
  876. switch (_currentMessage.Operation)
  877. {
  878. case EfemOperation.Home:
  879. SetRobotMovingInfo(RobotAction.Homing, Hand.Both, ModuleName.EFEM);
  880. break;
  881. case EfemOperation.Map:
  882. case EfemOperation.GotoMap:
  883. if (ModuleHelper.IsLoadPort(_currentMessage.Module))
  884. {
  885. GetLoadPort(_currentMessage.Module).OnMaped();
  886. }
  887. break;
  888. case EfemOperation.Pick:
  889. case EfemOperation.Place:
  890. SetRobotMovingInfo(RobotAction.None, Hand.Both, ModuleName.EfemRobot);
  891. break;
  892. }
  893. }
  894. else
  895. {
  896. switch (_currentMessage.Operation)
  897. {
  898. case EfemOperation.StateTrack:
  899. DealStateTrack(msg);
  900. break;
  901. case EfemOperation.RequestMapResult:
  902. DealMapResult(msg);
  903. break;
  904. }
  905. _status = RState.End;
  906. _currentMessage = null;
  907. }
  908. }
  909. /// <summary>
  910. /// 处理StateTrack结果
  911. /// </summary>
  912. /// <param name="msg"></param>
  913. private void DealStateTrack(string msg)
  914. {
  915. if (msg.StartsWith("LOAD"))
  916. {
  917. string[] strAry = msg.Trim().Split(' ');
  918. if (strAry.Length >= 2)
  919. {
  920. bool hasWafer = strAry[2] == "ON" ? true : false;
  921. if (strAry[1] == _armString[Hand.Blade1])
  922. {
  923. if (WaferManager.Instance.CheckNoWafer(ModuleName.EfemRobot, 0)&& hasWafer)
  924. {
  925. WaferManager.Instance.CreateWafer(ModuleName.EfemRobot, 0, WaferStatus.Normal);
  926. }
  927. }
  928. else if (strAry[1] == _armString[Hand.Blade2])
  929. {
  930. if (WaferManager.Instance.CheckNoWafer(ModuleName.EfemRobot, 1) && hasWafer)
  931. {
  932. WaferManager.Instance.CreateWafer(ModuleName.EfemRobot, 1, WaferStatus.Normal);
  933. }
  934. }
  935. }
  936. }
  937. }
  938. /// <summary>
  939. /// 处理Map结果
  940. /// </summary>
  941. /// <param name="msg"></param>
  942. private void DealMapResult(string msg)
  943. {
  944. if (_currentMessage.Operation != EfemOperation.RequestMapResult)
  945. {
  946. return;
  947. }
  948. if(!msg.StartsWith("MAP"))
  949. {
  950. return;
  951. }
  952. string[] sWaferInfo = msg.Split(new char[] { ' ', '\r', '\n' });
  953. if (sWaferInfo.Length <= 2)
  954. {
  955. return;
  956. }
  957. int slotMap = SC.GetValue<int>("EFEM.LoadPort.SlotNumber");
  958. WaferType waferType = WaferType.Production;
  959. if (ModuleHelper.IsDummy(_currentMessage.Module))
  960. {
  961. DummyCassetteItem item = DummyCasseteItemManager.Instance.GetDummyCassetteItem(_currentMessage.Module.ToString());
  962. if (item != null)
  963. {
  964. slotMap = item.MaxNumberOfSlots;
  965. }
  966. waferType = WaferType.Assit;
  967. }
  968. int waferSize = GetModuleNameWaferSize(_currentMessage.Module);
  969. //Map 结果(1 1 1 1 1 1 1 ...0)
  970. int startIndex = 1;
  971. int count = slotMap >= sWaferInfo.Length-startIndex? sWaferInfo.Length-startIndex : slotMap;
  972. bool result = true;
  973. for (int index = startIndex; index <= count; index++)
  974. {
  975. string strState = sWaferInfo[index];
  976. int waferState = 0;
  977. //合理的映射到内部支持的叠片/交叉片
  978. if (strState == "1") waferState = (int)WaferStatus.Normal;
  979. else if (strState == "2") waferState = (int)WaferStatus.Double;
  980. else if (strState == "3") waferState = (int)WaferStatus.Crossed;
  981. else if (strState == "5") waferState = (int)WaferStatus.Thin;
  982. else if(strState=="?") waferState=(int)WaferStatus.Unknown;
  983. WaferStatus st = (WaferStatus)waferState;
  984. if (st != WaferStatus.Empty)
  985. {
  986. WaferManager.Instance.CreateWafer(_currentMessage.Module, index-startIndex, st,(WaferSize)waferSize,waferType);
  987. if (st != WaferStatus.Normal)
  988. {
  989. result = false;
  990. }
  991. }
  992. else
  993. {
  994. WaferManager.Instance.DeleteWafer(_currentMessage.Module, index-startIndex);
  995. }
  996. }
  997. if (!result)
  998. {
  999. LOG.WriteLog(eEvent.ERROR_EFEM_ERROR_WAFER, Module.ToString(), $"{_currentMessage.Module} slot map failed {msg}");
  1000. }
  1001. if (ModuleHelper.IsLoadPort(_currentMessage.Module))
  1002. {
  1003. GetLoadPort(_currentMessage.Module).UpdateMapResult(result);
  1004. }
  1005. }
  1006. private void OnErrorOccurred(string errorCode)
  1007. {
  1008. _status = RState.Failed;
  1009. string description = errorCode;
  1010. if (SumWayRobotErrorCode.ErrorCodeDescription.ContainsKey(errorCode))
  1011. {
  1012. description=SumWayRobotErrorCode.ErrorCodeDescription[errorCode];
  1013. }
  1014. Singleton<RouteManager>.Instance.EFEM.PostMsg(EfemEntity.MSG.Error, description);
  1015. if (_currentMessage != null)
  1016. {
  1017. LOG.Write(eEvent.ERR_EFEM_COMMON_FAILED, ModuleName.EFEM, $"current operation {_currentMessage.Operation} failed,{description}");
  1018. }
  1019. _currentMessage=null;
  1020. }
  1021. private bool WriteCommand(string cmd)
  1022. {
  1023. LOG.WriteLog(eEvent.EV_EFEM_COMMON_INFO, Module.ToString(), cmd.Replace("\r", ""));
  1024. return _socket.Write(cmd);
  1025. }
  1026. /// <summary>
  1027. /// 获取模块Wafer尺寸
  1028. /// </summary>
  1029. /// <param name="moduleName"></param>
  1030. /// <returns></returns>
  1031. private int GetModuleNameWaferSize(ModuleName moduleName)
  1032. {
  1033. if (ModuleHelper.IsLoadPort(moduleName))
  1034. {
  1035. Loadport loadport = GetLoadPort(moduleName);
  1036. if (!loadport.HasCassette)
  1037. {
  1038. LOG.WriteLog(eEvent.ERR_EFEM_COMMON_FAILED, Module.ToString(), $"{moduleName} does not have cassete.");
  1039. return 0;
  1040. }
  1041. return (int)loadport.WaferSize;
  1042. }
  1043. else if (ModuleHelper.IsDummy(moduleName))
  1044. {
  1045. DummyDevice dummyDevice = Singleton<RouteManager>.Instance.EFEM.GetDummyDevice(moduleName - ModuleName.Dummy1);
  1046. if (!dummyDevice.HasCassette)
  1047. {
  1048. LOG.WriteLog(eEvent.ERR_EFEM_COMMON_FAILED, Module.ToString(), $"{moduleName} does not have cassete.");
  1049. return 0;
  1050. }
  1051. return (int)dummyDevice.WaferSize;
  1052. }
  1053. return 0;
  1054. }
  1055. /// <summary>
  1056. /// 获取模块尺寸
  1057. /// </summary>
  1058. /// <param name="moduleName"></param>
  1059. /// <returns></returns>
  1060. private int GetModuleSlotWaferSize(ModuleName moduleName,int slotNumber)
  1061. {
  1062. if(WaferManager.Instance.CheckHasWafer(moduleName,slotNumber))
  1063. {
  1064. WaferInfo waferInfo=WaferManager.Instance.GetWafer(moduleName, slotNumber);
  1065. return (int)waferInfo.Size;
  1066. }
  1067. else
  1068. {
  1069. return 0;
  1070. }
  1071. }
  1072. }
  1073. }