From cc1c7f4236abdd62fa79368d7cc1d32d7648860f Mon Sep 17 00:00:00 2001
From: Junjie <540245094@qq.com>
Date: 星期日, 05 五月 2024 09:56:46 +0800
Subject: [PATCH] #移动指令分段发送
---
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/NyShuttleThread.java | 36 ++++++++++++++++++++++++++++++++----
1 files changed, 32 insertions(+), 4 deletions(-)
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/NyShuttleThread.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/NyShuttleThread.java
index 71c9f91..b0ff86f 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/NyShuttleThread.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/NyShuttleThread.java
@@ -364,11 +364,39 @@
try {
//鍙戝嚭璇锋眰
NyShuttleHttpCommand httpCommand = JSON.parseObject(command.getBody(), NyShuttleHttpCommand.class);
- JSONObject result = requestCommand(httpCommand);
- if (result == null) {
- return false;//璇锋眰澶辫触
+ Map<String, Object> body = httpCommand.getRequest().getBody();
+ Object pathObj = body.get("path");
+ List<JSONObject> path = JSON.parseArray(JSON.toJSONString(pathObj), JSONObject.class);
+ ArrayList<NyShuttleHttpCommand> commandList = new ArrayList<>();
+ while (!path.isEmpty()) {
+ ArrayList<Map<String, Object>> list = new ArrayList<>();
+ if (path.size() > 10) {
+ List<JSONObject> subList = path.subList(0, 10);
+ list.addAll(subList);
+ subList.clear();
+ }else {
+ list.addAll(path);
+ path.clear();
+ }
+
+ NyShuttleHttpCommand httpCommandCopy = JSON.parseObject(JSON.toJSONString(httpCommand), NyShuttleHttpCommand.class);
+ JSONObject bodyCopy = JSON.parseObject(JSON.toJSONString(body));
+
+ NyShuttleHttpCommand.NyRequest request = httpCommandCopy.getRequest();
+ bodyCopy.put("path", list);
+ request.setBody(bodyCopy);
+ httpCommandCopy.setRequest(request);
+
+ commandList.add(httpCommandCopy);//add copy
}
- this.shuttleProtocol.setSendTime(System.currentTimeMillis());//鎸囦护涓嬪彂鏃堕棿
+
+ for (NyShuttleHttpCommand requestCommand : commandList) {
+ JSONObject result = requestCommand(requestCommand);
+ if (result == null) {
+ return false;//璇锋眰澶辫触
+ }
+ this.shuttleProtocol.setSendTime(System.currentTimeMillis());//鎸囦护涓嬪彂鏃堕棿
+ }
return true;
} catch (IOException e) {
return false;
--
Gitblit v1.9.1