From cef0811fa1ee3b7791900d87f5f7fe3a053a708b Mon Sep 17 00:00:00 2001 From: Junjie <540245094@qq.com> Date: 星期五, 01 八月 2025 17:49:48 +0800 Subject: [PATCH] # --- src/main/java/com/zy/core/thread/impl/NyShuttleThread.java | 48 ++++++++++++++++++++++++++++++++++-------------- 1 files changed, 34 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/zy/core/thread/impl/NyShuttleThread.java b/src/main/java/com/zy/core/thread/impl/NyShuttleThread.java index 58ecf5e..724ba7a 100644 --- a/src/main/java/com/zy/core/thread/impl/NyShuttleThread.java +++ b/src/main/java/com/zy/core/thread/impl/NyShuttleThread.java @@ -52,6 +52,7 @@ private DeviceConfig deviceConfig; private RedisUtil redisUtil; private ShuttleProtocol shuttleProtocol; + private ShuttleAction shuttleAction = null; private static final boolean DEBUG = false;//璋冭瘯妯″紡 @@ -92,14 +93,11 @@ // Thread executeThread = new Thread(() -> { // while (true) { // try { -// ShuttleAction shuttleAction = null; -// try { -// shuttleAction = SpringUtils.getBean(ShuttleAction.class); -// }catch (Exception e){ -// continue; -// } -// // if (shuttleAction == null) { +// try { +// shuttleAction = SpringUtils.getBean(ShuttleAction.class); +// }catch (Exception e){ +// } // continue; // } // @@ -934,6 +932,28 @@ if (commands == null) { return false; } + + if (assignCommand.getTaskMode() == ShuttleTaskModeType.TRANSPORT.id) { + List<ShuttleCommand> originCommands = assignCommand.getCommands(); + if (originCommands == null) { + return false; + } + + ShuttleCommand firstCommand = originCommands.get(0); + ShuttleCommand endCommand = originCommands.get(originCommands.size() - 1); + + if (firstCommand.getMode() != ShuttleCommandModeType.PALLET_LIFT.id) { + return false; + } + + if (endCommand.getMode() != ShuttleCommandModeType.PALLET_DOWN.id) { + return false; + } + + commands.add(0, firstCommand); + commands.add(endCommand); + } + assignCommand.setCommands(commands); //涓嬪彂浠诲姟 @@ -1192,16 +1212,16 @@ private JSONObject queryCommandStatus(String resultKey) { // 鑾峰彇鏈嶅姟鍣ㄥ搷搴� - // 灏濊瘯50娆� JSONObject result = null; - for (int i = 0; i < 50; i++) { + long startTime = System.currentTimeMillis(); + while (true) { + if((System.currentTimeMillis() - startTime) > 1000 * 10) { + break; + } + result = getRequestBody(resultKey); if (result == null) { - try { - Thread.sleep(500); - } catch (Exception e) { - e.printStackTrace(); - } + continue; }else { break; } -- Gitblit v1.9.1