CarrierUnload.cs 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586
  1. using Aitex.Core.RT.Routine;
  2. using Aitex.Core.RT.SCCore;
  3. using Aitex.Core.Util;
  4. using Aitex.Sorter.Common;
  5. using MECF.Framework.Common.Equipment;
  6. using MECF.Framework.Common.Schedulers;
  7. using MECF.Framework.Common.SubstrateTrackings;
  8. using MECF.Framework.RT.EquipmentLibrary.LogicUnits;
  9. using System;
  10. using System.Collections.Generic;
  11. using FurnaceRT.Equipments.FIMSs;
  12. using FurnaceRT.Equipments.LPs;
  13. using FurnaceRT.Equipments.Stockers;
  14. using FurnaceRT.Equipments.Systems;
  15. using static FurnaceRT.Equipments.FIMSs.FIMSModule;
  16. namespace FurnaceRT.Equipments.CarrierRobots
  17. {
  18. public class CarrierUnload : ModuleRoutine, IRoutine
  19. {
  20. enum RoutineStep
  21. {
  22. SetRobotActionCommand,
  23. Place,
  24. DoorOpen,
  25. DoorClose,
  26. RobotRequestCassettePresent,
  27. CheckCassetteInfoByRobotSensor,
  28. SetStageLock,
  29. SetStageUnlock,
  30. CheckBeforePlace,
  31. }
  32. private CarrierRobotModule _cassetteRobotModule;
  33. private ModuleName _destination;
  34. private int _destinationSlot;
  35. private Hand _blade;
  36. private int _timeout = 0;
  37. private RD_TRIG _holdTrig = new RD_TRIG();
  38. private R_TRIG _emergencyStopTrig = new R_TRIG();
  39. private R_TRIG _pauseTrig = new R_TRIG();
  40. private R_TRIG _resumeTrig = new R_TRIG();
  41. private RoutineStep _routineStep;
  42. private double _durationTime = 0;
  43. private bool _isHasAlarm = false;
  44. private bool _needStartCheck = true;
  45. public CarrierUnload(CarrierRobotModule cassetteModule)
  46. {
  47. _cassetteRobotModule = cassetteModule;
  48. Module = cassetteModule.Module;
  49. Name = "Unload";
  50. }
  51. public void Init(ModuleName destination, int destinationSlot, Hand blade, bool isHasAlarm)
  52. {
  53. _destination = destination;
  54. _destinationSlot = destinationSlot;
  55. _blade = blade;
  56. var para = new List<object> { _destination, _destinationSlot, _blade, true };
  57. _cassetteRobotModule.PlaceCassetteFailAlarm.RetryMessage = (int)CarrierRobotModule.MSG.UnloadRetry;
  58. _cassetteRobotModule.PlaceCassetteFailAlarm.RetryMessageParas = para.ToArray();
  59. _cassetteRobotModule.PlaceCassetteTimeoutAlarm.RetryMessage = (int)CarrierRobotModule.MSG.UnloadRetry;
  60. _cassetteRobotModule.PlaceCassetteTimeoutAlarm.RetryMessageParas = para.ToArray();
  61. _cassetteRobotModule.RequestCassettePresentFailAlarm.RetryMessage = (int)CarrierRobotModule.MSG.UnloadRetry;
  62. _cassetteRobotModule.RequestCassettePresentFailAlarm.RetryMessageParas = para.ToArray();
  63. _cassetteRobotModule.RequestCassettePresentTimeoutAlarm.RetryMessage = (int)CarrierRobotModule.MSG.UnloadRetry;
  64. _cassetteRobotModule.RequestCassettePresentTimeoutAlarm.RetryMessageParas = para.ToArray();
  65. _cassetteRobotModule.RobotHasError.RetryMessage = (int)CarrierRobotModule.MSG.UnloadRetry;
  66. _cassetteRobotModule.RobotHasError.RetryMessageParas = para.ToArray();
  67. _cassetteRobotModule.ShutterOpenTimeoutAlarm.RetryMessage = (int)CarrierRobotModule.MSG.UnloadRetry;
  68. _cassetteRobotModule.ShutterOpenTimeoutAlarm.RetryMessageParas = para.ToArray();
  69. _cassetteRobotModule.ShutterCloseTimeoutAlarm.RetryMessage = (int)CarrierRobotModule.MSG.UnloadRetry;
  70. _cassetteRobotModule.ShutterCloseTimeoutAlarm.RetryMessageParas = para.ToArray();
  71. _isHasAlarm = isHasAlarm;
  72. if (!_isHasAlarm)
  73. _needStartCheck = true;
  74. }
  75. public Result Start(params object[] objs)
  76. {
  77. // 抛出过alarm就不reset
  78. if (!_isHasAlarm)
  79. {
  80. Reset();
  81. }
  82. else
  83. {
  84. _historySteps.Remove((int)_routineStep);
  85. _isHasAlarm = false;
  86. ResetState();
  87. }
  88. _holdTrig.RST = true;
  89. _emergencyStopTrig.RST = true;
  90. _pauseTrig.RST = true;
  91. _resumeTrig.RST = true;
  92. _timeout = SC.GetValue<int>($"{Module}.MotionTimeout");
  93. if (_needStartCheck)
  94. {
  95. if (!Singleton<EquipmentManager>.Instance.Modules.ContainsKey(_destination))
  96. {
  97. _cassetteRobotModule.PlaceCassetteFailAlarm.Set($"place to {_destination} failed for not install");
  98. return Result.FAIL;
  99. }
  100. if (ModuleHelper.IsLoadPort(_destination))
  101. {
  102. var lpModule = Singleton<EquipmentManager>.Instance.Modules[_destination] as LoadPortModule;
  103. if (lpModule == null)
  104. {
  105. _cassetteRobotModule.PlaceCassetteFailAlarm.Set($"place to {_destination} failed for not install");
  106. return Result.FAIL;
  107. }
  108. if (lpModule != null && !lpModule.CheckReadyForTransfer(ModuleHelper.Converter(Module), _blade, _destinationSlot, EnumTransferType.Place, out string reason))
  109. {
  110. _cassetteRobotModule.PlaceCassetteFailAlarm.Set($"place to {_destination} failed for {reason}");
  111. return Result.FAIL;
  112. }
  113. }
  114. else if (_destination == ModuleName.FIMS1 || _destination == ModuleName.FIMS2)
  115. {
  116. var fims = Singleton<EquipmentManager>.Instance.Modules[_destination] as FIMSModule;
  117. if (fims == null)
  118. {
  119. _cassetteRobotModule.PlaceCassetteFailAlarm.Set($"place to {_destination} failed for not install");
  120. return Result.FAIL;
  121. }
  122. if (fims != null && !fims.CheckReadyForTransfer(ModuleHelper.Converter(Module), _blade, _destinationSlot, EnumTransferType.Place, out string reason))
  123. {
  124. _cassetteRobotModule.PlaceCassetteFailAlarm.Set($"place to {_destination} failed for {reason}");
  125. return Result.FAIL;
  126. }
  127. if (!SC.GetValue<bool>("System.IsSimulatorMode"))
  128. {
  129. if (fims != null && fims.IsFoupExist)
  130. {
  131. _cassetteRobotModule.PlaceCassetteFailAlarm.Set($"place to {_destination} failed for carrier is present");
  132. return Result.FAIL;
  133. }
  134. }
  135. }
  136. else
  137. {
  138. var stockerModule = Singleton<EquipmentManager>.Instance.Modules[_destination] as StockerModule;
  139. if (stockerModule == null)
  140. {
  141. _cassetteRobotModule.PlaceCassetteFailAlarm.Set($"place to {_destination} failed for not install");
  142. return Result.FAIL;
  143. }
  144. if (!SC.GetValue<bool>("System.IsSimulatorMode"))
  145. {
  146. if (stockerModule != null && stockerModule.IsFoupPresent)
  147. {
  148. _cassetteRobotModule.PlaceCassetteFailAlarm.Set($"place to {_destination} failed for carrier is present");
  149. return Result.FAIL;
  150. }
  151. }
  152. }
  153. if (SC.GetValue<bool>("System.IsSimulatorMode"))
  154. {
  155. if (!CarrierManager.Instance.CheckHasCarrier(ModuleName.CarrierRobot, 0))
  156. {
  157. _cassetteRobotModule.BladeCassetteNotPresentWarning.Set($"{ModuleName.CarrierRobot} cassette not present");
  158. return Result.FAIL;
  159. }
  160. }
  161. else
  162. {
  163. if (!_cassetteRobotModule.CarrierRobotDevice.IsWaferPresenceOnBlade1 || !CarrierManager.Instance.CheckHasCarrier(ModuleName.CarrierRobot, 0))
  164. {
  165. _cassetteRobotModule.BladeCassetteNotPresentWarning.Set($"{ModuleName.CarrierRobot} cassette not present");
  166. return Result.FAIL;
  167. }
  168. }
  169. if (!CarrierManager.Instance.CheckNoCarrier(_destination, 0))
  170. {
  171. _cassetteRobotModule.PlaceCassetteFailAlarm.Set($"place to {_destination} failed for carrier is present");
  172. return Result.FAIL;
  173. }
  174. }
  175. Notify($"Start");
  176. return Result.RUN;
  177. }
  178. public void Abort()
  179. {
  180. _cassetteRobotModule.ResetRobotActionCommand();
  181. _cassetteRobotModule.Stop();
  182. (Singleton<EquipmentManager>.Instance.Modules[_destination] as ITransferTarget)?.NoteTransferStop(ModuleHelper.Converter(_cassetteRobotModule.Module), _blade, _destinationSlot, EnumTransferType.Place);
  183. }
  184. public override Result Monitor()
  185. {
  186. try
  187. {
  188. PauseRountine(_cassetteRobotModule.CarrierRobotDevice.IsPause);
  189. if (_cassetteRobotModule.CarrierRobotDevice.IsPause)
  190. return Result.RUN;
  191. CheckBeforePlace((int)RoutineStep.CheckBeforePlace, _destination, _destinationSlot, _blade);
  192. if (_destination == ModuleName.LP1 || _destination == ModuleName.LP2)
  193. SaferDoorOpen((int)RoutineStep.DoorOpen, true, _timeout);
  194. if (_cassetteRobotModule.TrigActionCommand != null)
  195. SetRobotActionCommand((int)RoutineStep.SetRobotActionCommand, _destination, _timeout);
  196. Place((int)RoutineStep.Place, _destination, _destinationSlot, _blade, _timeout);
  197. if (_destination == ModuleName.LP1 || _destination == ModuleName.LP2)
  198. SaferDoorOpen((int)RoutineStep.DoorClose, false, _timeout);
  199. RobotRequestCassettePresent((int)RoutineStep.RobotRequestCassettePresent, _blade, _timeout);
  200. CheckCassetteInfoByRobotSensor((int)RoutineStep.CheckCassetteInfoByRobotSensor, _blade, false);
  201. }
  202. catch (RoutineBreakException)
  203. {
  204. return Result.RUN;
  205. }
  206. catch (RoutineFaildException ex)
  207. {
  208. _cassetteRobotModule.ResetRobotActionCommand();
  209. (Singleton<EquipmentManager>.Instance.Modules[_destination] as ITransferTarget)?.NoteTransferStop(ModuleHelper.Converter(_cassetteRobotModule.Module), _blade, _destinationSlot, EnumTransferType.Place);
  210. return Result.FAIL;
  211. }
  212. _cassetteRobotModule.ResetRobotActionCommand();
  213. if (SC.GetValue<bool>("System.IsSimulatorMode"))
  214. CarrierManager.Instance.DeleteCarrier(_destination.ToString());
  215. (Singleton<EquipmentManager>.Instance.Modules[_destination] as ITransferTarget)?.NoteTransferStop(ModuleHelper.Converter(_cassetteRobotModule.Module), _blade, _destinationSlot, EnumTransferType.Place);
  216. Notify("Finished");
  217. return Result.DONE;
  218. }
  219. private void SetRobotActionCommand(int id, ModuleName source, int timeout)
  220. {
  221. _routineStep = (RoutineStep)Enum.Parse(typeof(RoutineStep), id.ToString());
  222. Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
  223. {
  224. Notify($"Set robot action command target position {source}");
  225. _cassetteRobotModule.SetRobotActionCommand(source, EnumTransferType.Place);
  226. return true;
  227. }, () =>
  228. {
  229. return _cassetteRobotModule.CheckRobotActionCommand(source, EnumTransferType.Place);
  230. }, timeout * 1000);
  231. if (ret.Item1)
  232. {
  233. if (ret.Item2 == Result.FAIL)
  234. {
  235. _cassetteRobotModule.PlaceCassetteTimeoutAlarm.Set($"place to {source} failed for robot action command interlock");
  236. throw (new RoutineFaildException());
  237. }
  238. else if (ret.Item2 == Result.TIMEOUT) //timeout
  239. {
  240. _cassetteRobotModule.PlaceCassetteTimeoutAlarm.Set($"timeout over {timeout} seconds");
  241. throw (new RoutineFaildException());
  242. }
  243. else
  244. throw (new RoutineBreakException());
  245. }
  246. }
  247. private void Place(int id, ModuleName target, int slot, Hand hand, int timeout)
  248. {
  249. _routineStep = (RoutineStep)Enum.Parse(typeof(RoutineStep), id.ToString());
  250. Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
  251. {
  252. Notify($"Send place to {target} command to robot device");
  253. string reason;
  254. (Singleton<EquipmentManager>.Instance.Modules[target] as ITransferTarget)?.NoteTransferStart(ModuleHelper.Converter(_cassetteRobotModule.Module), hand, slot, EnumTransferType.Place);
  255. if (!_cassetteRobotModule.RobotPlace(target, slot, hand, out reason))
  256. {
  257. //_cassetteRobotModule.PlaceCassetteFailAlarm.Description = reason;
  258. _cassetteRobotModule.PlaceCassetteFailAlarm.Set(reason);
  259. return false;
  260. }
  261. return true;
  262. }, () =>
  263. {
  264. if (_cassetteRobotModule.CarrierRobotDevice.IsReady() && !_cassetteRobotModule.CarrierRobotDevice.IsError)
  265. {
  266. return true;
  267. }
  268. return false;
  269. }, timeout * 1000);
  270. if (ret.Item1)
  271. {
  272. if (ret.Item2 == Result.FAIL)
  273. {
  274. //_cassetteRobotModule.PlaceCassetteFailAlarm.Description = $"{_cassetteRobotModule.CassetteRobotDevice.ErrorCode}";
  275. _cassetteRobotModule.PlaceCassetteFailAlarm.Set($"place to {target} failed for robot error, error code={_cassetteRobotModule.CarrierRobotDevice.ErrorCode}");
  276. throw (new RoutineFaildException());
  277. }
  278. else if (ret.Item2 == Result.TIMEOUT) //timeout
  279. {
  280. //_cassetteRobotModule.PlaceCassetteTimeoutAlarm.Description = $"timeout over {timeout} seconds";
  281. _cassetteRobotModule.PlaceCassetteTimeoutAlarm.Set($"timeout over {timeout} seconds");
  282. throw (new RoutineFaildException());
  283. }
  284. else
  285. throw (new RoutineBreakException());
  286. }
  287. }
  288. private void RobotRequestCassettePresent(int id, Hand hand, int timeout)
  289. {
  290. Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
  291. {
  292. Notify("Request cassette present");
  293. if (!_cassetteRobotModule.RequestCassettePresent(hand, out string reason))
  294. {
  295. //_cassetteRobotModule.RequestCassettePresentFailAlarm.Description = reason;
  296. _cassetteRobotModule.RequestCassettePresentFailAlarm.Set(reason);
  297. return false;
  298. }
  299. return true;
  300. }, () =>
  301. {
  302. if (_cassetteRobotModule.CarrierRobotDevice.IsReady() && !_cassetteRobotModule.CarrierRobotDevice.IsError)
  303. {
  304. return true;
  305. }
  306. return false;
  307. }, timeout * 1000);
  308. if (ret.Item1)
  309. {
  310. if (ret.Item2 == Result.FAIL)
  311. {
  312. throw (new RoutineFaildException());
  313. }
  314. else if (ret.Item2 == Result.TIMEOUT) //timeout
  315. {
  316. //_cassetteRobotModule.RequestCassettePresentTimeoutAlarm.Description = $"timeout over {timeout} seconds";
  317. _cassetteRobotModule.RequestCassettePresentTimeoutAlarm.Set($"timeout over {timeout} seconds");
  318. throw (new RoutineFaildException());
  319. }
  320. else
  321. throw (new RoutineBreakException());
  322. }
  323. }
  324. private void CheckCassetteInfoByRobotSensor(int id, Hand hand, bool isAfterPick)
  325. {
  326. Tuple<bool, Result> ret = Execute(id, () =>
  327. {
  328. Notify($"Check cassette info by robot RQ present");
  329. if (SC.GetValue<bool>("System.IsSimulatorMode"))
  330. return true;
  331. if (hand == Hand.Blade1 || hand == Hand.Both)
  332. {
  333. if (!isAfterPick && _cassetteRobotModule.CarrierRobotDevice.IsWaferPresenceOnBlade1)
  334. {
  335. //_cassetteRobotModule.RobotSensorFoundCassetteOnBladeAfterPlaceAlarm.Description = "Cassette Robot sensor found cassette on blade 1";
  336. _cassetteRobotModule.RobotSensorFoundCassetteOnBladeAfterPlaceAlarm.Set("Cassette Robot sensor found cassette on blade 1");
  337. return false;
  338. }
  339. if (isAfterPick && !_cassetteRobotModule.CarrierRobotDevice.IsWaferPresenceOnBlade1)
  340. {
  341. //_cassetteRobotModule.RobotSensorNotFoundCassetteOnBladeAfterPickAlarm.Description = "Cassette Robot sensor no cassette on blade 1";
  342. _cassetteRobotModule.RobotSensorNotFoundCassetteOnBladeAfterPickAlarm.Set("Cassette Robot sensor no cassette on blade 1");
  343. return false;
  344. }
  345. }
  346. if (hand == Hand.Blade2 || hand == Hand.Both)
  347. {
  348. if (!isAfterPick && _cassetteRobotModule.CarrierRobotDevice.IsWaferPresenceOnBlade2)
  349. {
  350. //_cassetteRobotModule.RobotSensorFoundCassetteOnBladeAfterPlaceAlarm.Description = "Cassette Robot sensor found cassette on blade 2";
  351. _cassetteRobotModule.RobotSensorFoundCassetteOnBladeAfterPlaceAlarm.Set("Cassette Robot sensor found cassette on blade 2");
  352. return false;
  353. }
  354. if (isAfterPick && !_cassetteRobotModule.CarrierRobotDevice.IsWaferPresenceOnBlade2)
  355. {
  356. //_cassetteRobotModule.RobotSensorNotFoundCassetteOnBladeAfterPickAlarm.Description = "Cassette Robot sensor no cassette on blade 2";
  357. _cassetteRobotModule.RobotSensorNotFoundCassetteOnBladeAfterPickAlarm.Set("Cassette Robot sensor no cassette on blade 2");
  358. return false;
  359. }
  360. }
  361. return true;
  362. });
  363. if (ret.Item1)
  364. {
  365. if (ret.Item2 == Result.FAIL)
  366. {
  367. //_cassetteRobotModule.CheckCassetteInformationFailAlarm.Description = $"check cassette info failed.";
  368. _cassetteRobotModule.CheckCassetteInformationFailAlarm.Set($"check cassette info failed.");
  369. throw (new RoutineFaildException());
  370. }
  371. else
  372. throw (new RoutineBreakException());
  373. }
  374. }
  375. private void CheckBeforePlace(int id, ModuleName target, int slot, Hand blade)
  376. {
  377. Tuple<bool, Result> ret = Execute(id, () =>
  378. {
  379. Notify($"Check place to {target} condition");
  380. string reason = string.Empty;
  381. if (_cassetteRobotModule.CarrierRobotDevice.IsError)
  382. {
  383. _cassetteRobotModule.PlaceCassetteFailAlarm.Set($"place to {target} failed for robot error, error code={_cassetteRobotModule.CarrierRobotDevice.ErrorCode}");
  384. return false;
  385. }
  386. if (!_cassetteRobotModule.CarrierRobotDevice.IsReady())
  387. {
  388. _cassetteRobotModule.PlaceCassetteFailAlarm.Set($"place to {target} failed for robot isn't Ready");
  389. return false;
  390. }
  391. if (!CarrierManager.Instance.CheckNoCarrier(_destination, 0))
  392. {
  393. _cassetteRobotModule.PlaceCassetteFailAlarm.Set($"place to {_destination} failed for pod is present");
  394. return false;
  395. }
  396. if (target == ModuleName.LP1 || target == ModuleName.LP2)
  397. {
  398. var lpModule = Singleton<EquipmentManager>.Instance.Modules[_destination] as LoadPortModule;
  399. if (lpModule != null && !lpModule.CheckReadyForTransfer(ModuleHelper.Converter(Module), blade, slot, EnumTransferType.Place, out reason))
  400. {
  401. _cassetteRobotModule.PlaceCassetteFailAlarm.Set($"place to {_destination} failed for {reason}");
  402. return false;
  403. }
  404. }
  405. else if (target == ModuleName.FIMS1 || target == ModuleName.FIMS2)
  406. {
  407. var fims = Singleton<EquipmentManager>.Instance.Modules[_destination] as FIMSModule;
  408. if (fims != null && !fims.CheckReadyForTransfer(ModuleHelper.Converter(Module), _blade, _destinationSlot, EnumTransferType.Place, out reason))
  409. {
  410. _cassetteRobotModule.PlaceCassetteFailAlarm.Set($"place to {_destination} failed for {reason}");
  411. return false;
  412. }
  413. if (!SC.GetValue<bool>("System.IsSimulatorMode"))
  414. {
  415. if (fims != null && fims.IsFoupExist)
  416. {
  417. _cassetteRobotModule.PlaceCassetteFailAlarm.Set($"place to {_destination} failed for carrier is present");
  418. return false;
  419. }
  420. }
  421. }
  422. else
  423. {
  424. if (!SC.GetValue<bool>("System.IsSimulatorMode"))
  425. {
  426. var stockerModule = Singleton<EquipmentManager>.Instance.Modules[target] as StockerModule;
  427. if (stockerModule != null && stockerModule.IsFoupPresent)
  428. {
  429. _cassetteRobotModule.PlaceCassetteFailAlarm.Set($"place to {target} failed for carrier is present");
  430. return false;
  431. }
  432. }
  433. }
  434. if (blade == Hand.Blade1)
  435. {
  436. if (!CarrierManager.Instance.CheckNoCarrier(target, 0))
  437. {
  438. _cassetteRobotModule.PlaceCassetteFailAlarm.Set($"place to {target} failed for {target} has carrier");
  439. return false;
  440. }
  441. if (!CarrierManager.Instance.CheckHasCarrier(Module, 0))
  442. {
  443. _cassetteRobotModule.PlaceCassetteFailAlarm.Set($"place to {target} failed for blade no carrier");
  444. return false;
  445. }
  446. }
  447. else if (blade == Hand.Blade2)
  448. {
  449. if (!CarrierManager.Instance.CheckNoCarrier(target, 0))
  450. {
  451. _cassetteRobotModule.PlaceCassetteFailAlarm.Set($"place to {target} failed for {target} has carrier");
  452. return false;
  453. }
  454. if (!CarrierManager.Instance.CheckHasCarrier(Module, 0))
  455. {
  456. _cassetteRobotModule.PlaceCassetteFailAlarm.Set($"place to {target} failed for blade no carrier");
  457. return false;
  458. }
  459. }
  460. else
  461. {
  462. if (!CarrierManager.Instance.CheckNoCarrier(target, 0))
  463. {
  464. _cassetteRobotModule.PlaceCassetteFailAlarm.Set($"place to {target} failed for {target} has carrier");
  465. return false;
  466. }
  467. if (!CarrierManager.Instance.CheckHasCarrier(Module, 0))
  468. {
  469. _cassetteRobotModule.PlaceCassetteFailAlarm.Set($"place to {target} failed for blade no carrier");
  470. return false;
  471. }
  472. }
  473. return true;
  474. });
  475. if (ret.Item1)
  476. {
  477. if (ret.Item2 == Result.FAIL)
  478. {
  479. throw (new RoutineFaildException());
  480. }
  481. }
  482. _needStartCheck = false;
  483. }
  484. private void SaferDoorOpen(int id, bool isOpen, int timeout)
  485. {
  486. Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
  487. {
  488. Notify($"Shutter Door {(isOpen ? "Open" : "Close")}");
  489. if (isOpen)
  490. _cassetteRobotModule.DoorDevice.Open();
  491. else
  492. _cassetteRobotModule.DoorDevice.Close();
  493. return true;
  494. }, () =>
  495. {
  496. return isOpen ? _cassetteRobotModule.DoorDevice.OpenCloseStatus == Devices.DeviceStatus.Open : _cassetteRobotModule.DoorDevice.OpenCloseStatus == Devices.DeviceStatus.Close;
  497. }, timeout * 1000);
  498. if (ret.Item1)
  499. {
  500. if (ret.Item2 == Result.FAIL)
  501. {
  502. throw new RoutineFaildException();
  503. }
  504. else if (ret.Item2 == Result.TIMEOUT) //timeout
  505. {
  506. if (isOpen)
  507. _cassetteRobotModule.ShutterOpenTimeoutAlarm.Set($"timeout over {timeout} seconds");
  508. else
  509. _cassetteRobotModule.ShutterCloseTimeoutAlarm.Set($"timeout over {timeout} seconds");
  510. throw (new RoutineFaildException());
  511. }
  512. else
  513. throw new RoutineBreakException();
  514. }
  515. }
  516. }
  517. }