From cdca466c533197157f3255b77fbdb4aac89be064 Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期三, 30 八月 2023 08:26:10 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/core/model/protocol/NyShuttleProtocol.java | 20 +++
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java | 4
src/main/java/com/zy/common/utils/NyHttpUtils.java | 109 +++++++++++++--------
src/main/java/com/zy/core/model/command/NyShuttleHttpCommand.java | 3
src/main/java/com/zy/core/thread/NyShuttleThread.java | 131 ++++++++++++++------------
src/main/webapp/views/shuttle.html | 26 +++--
6 files changed, 177 insertions(+), 116 deletions(-)
diff --git a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
index 92adad4..8f706d1 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -1484,7 +1484,7 @@
if (wrkMast == null) {
continue;
}
- BasShuttleErr basShuttleErr = basShuttleErrService.queryByCode(shuttleProtocol.getErrCode().get(0));
+ BasShuttleErr basShuttleErr = basShuttleErrService.queryByCode(shuttleProtocol.getErrCode());
String errName = basShuttleErr==null? "鏈煡寮傚父":basShuttleErr.getErrName();
BasShuttleErrLog basShuttleErrLog = new BasShuttleErrLog(
null, // 缂栧彿
@@ -1500,7 +1500,7 @@
wrkMast.getSourceStaNo(), // 婧愮珯
wrkMast.getSourceLocNo(), // 婧愬簱浣�
wrkMast.getBarcode(), // 鏉$爜
- shuttleProtocol.getErrCode().get(0), // 寮傚父鐮�
+ shuttleProtocol.getErrCode(), // 寮傚父鐮�
errName, // 寮傚父
1, // 寮傚父鎯呭喌
now, // 娣诲姞鏃堕棿
diff --git a/src/main/java/com/zy/common/utils/NyHttpUtils.java b/src/main/java/com/zy/common/utils/NyHttpUtils.java
index 8af6760..12d8c2c 100644
--- a/src/main/java/com/zy/common/utils/NyHttpUtils.java
+++ b/src/main/java/com/zy/common/utils/NyHttpUtils.java
@@ -6,6 +6,8 @@
import com.zy.core.model.command.NyShuttleHttpCommand;
import com.zy.core.model.protocol.NyShuttleProtocol;
+import java.io.*;
+import java.net.Socket;
import java.util.*;
/**
@@ -13,13 +15,12 @@
*/
public class NyHttpUtils {
- private static final String requestUrl = "localhost:9090/tzskwcs";
-
//鑾峰彇HTTP璇锋眰鏍囧噯缁撴瀯浣�
- public static NyShuttleHttpCommand getHttpStandard(Integer shuttleNo) {
+ public static NyShuttleHttpCommand getHttpStandard(Integer shuttleNo, Integer wrkNo) {
NyShuttleHttpCommand httpStandard = new NyShuttleHttpCommand();
httpStandard.setMsgType("requestMsg");//璇锋眰娑堟伅
httpStandard.setRobotId(shuttleNo);//杞﹁締缂栧彿
+ httpStandard.setWrkNo(wrkNo);//宸ヤ綔鍙�
//璁剧疆璇锋眰娑堟伅
NyShuttleHttpCommand.NyRequest request = new NyShuttleHttpCommand.NyRequest();
@@ -35,7 +36,7 @@
//鑾峰彇FAS 鎵嬪姩/鑷姩鍒囨崲
public static NyShuttleHttpCommand getFASSwitchCommand(Integer shuttleNo, boolean auto) {
- NyShuttleHttpCommand httpStandard = getHttpStandard(shuttleNo);
+ NyShuttleHttpCommand httpStandard = getHttpStandard(shuttleNo, 9999);
NyShuttleHttpCommand.NyRequest request = httpStandard.getRequest();
HashMap<String, Object> body = new HashMap<>();
@@ -48,12 +49,12 @@
//鑾峰彇绉诲姩璇锋眰
public static NyShuttleHttpCommand getMoveCommand(Integer shuttleNo, Integer wrkNo, NavigateNode start, NavigateNode target) {
- NyShuttleHttpCommand httpStandard = getHttpStandard(shuttleNo);
+ NyShuttleHttpCommand httpStandard = getHttpStandard(shuttleNo, wrkNo);
NyShuttleHttpCommand.NyRequest request = httpStandard.getRequest();
HashMap<String, Object> body = new HashMap<>();
body.put("requestType", "move");//绉诲姩鍛戒护
- body.put("taskId", wrkNo);//浠诲姟鍙�
+ body.put("taskId", getTaskId());//TaskID闇�瑕侀殢鏈�
body.put("start", navigateNodeToNyPointNode(start));//璧风偣
body.put("target", navigateNodeToNyPointNode(target));//缁堢偣
request.setBody(body);
@@ -64,12 +65,12 @@
//鑾峰彇杩涘嚭鎻愬崌鏈鸿姹�
public static NyShuttleHttpCommand getInOutLiftCommand(Integer shuttleNo, Integer wrkNo, NavigateNode start, NavigateNode target, boolean in) {
- NyShuttleHttpCommand httpStandard = getHttpStandard(shuttleNo);
+ NyShuttleHttpCommand httpStandard = getHttpStandard(shuttleNo, wrkNo);
NyShuttleHttpCommand.NyRequest request = httpStandard.getRequest();
HashMap<String, Object> body = new HashMap<>();
body.put("requestType", in ? "intoLift" : "outLift");//杩涘嚭鎻愬崌鏈�
- body.put("taskId", wrkNo);//浠诲姟鍙�
+ body.put("taskId", getTaskId());//TaskID闇�瑕侀殢鏈�
body.put("start", navigateNodeToNyPointNode(start));//璧风偣
body.put("target", navigateNodeToNyPointNode(target));//缁堢偣
request.setBody(body);
@@ -80,12 +81,12 @@
//鑾峰彇椤跺崌鍛戒护
public static NyShuttleHttpCommand getPalletLiftCommand(Integer shuttleNo, Integer wrkNo, boolean lift) {
- NyShuttleHttpCommand httpStandard = getHttpStandard(shuttleNo);
+ NyShuttleHttpCommand httpStandard = getHttpStandard(shuttleNo, wrkNo);
NyShuttleHttpCommand.NyRequest request = httpStandard.getRequest();
HashMap<String, Object> body = new HashMap<>();
body.put("requestType", lift ? "liftUp" : "liftDown");//椤跺崌鎴栦笅闄嶅懡浠�
- body.put("taskId", wrkNo);//浠诲姟鍙�
+ body.put("taskId", getTaskId());//TaskID闇�瑕侀殢鏈�
request.setBody(body);
httpStandard.setRequest(request);
@@ -94,12 +95,12 @@
//鑾峰彇鍏呯數鍛戒护
public static NyShuttleHttpCommand getChargeCommand(Integer shuttleNo, Integer wrkNo, boolean charge) {
- NyShuttleHttpCommand httpStandard = getHttpStandard(shuttleNo);
+ NyShuttleHttpCommand httpStandard = getHttpStandard(shuttleNo, wrkNo);
NyShuttleHttpCommand.NyRequest request = httpStandard.getRequest();
HashMap<String, Object> body = new HashMap<>();
body.put("requestType", charge ? "charge" : "stopCharge");//鍏呯數鎴栧仠姝㈠厖鐢�
- body.put("taskId", wrkNo);//浠诲姟鍙�
+ body.put("taskId", getTaskId());//TaskID闇�瑕侀殢鏈�
request.setBody(body);
httpStandard.setRequest(request);
@@ -108,12 +109,12 @@
//鑾峰彇绠″埗鍛戒护
public static NyShuttleHttpCommand getSuspendCommand(Integer shuttleNo, Integer wrkNo, boolean suspend) {
- NyShuttleHttpCommand httpStandard = getHttpStandard(shuttleNo);
+ NyShuttleHttpCommand httpStandard = getHttpStandard(shuttleNo, wrkNo);
NyShuttleHttpCommand.NyRequest request = httpStandard.getRequest();
HashMap<String, Object> body = new HashMap<>();
body.put("requestType", suspend ? "stop" : "resume");//绠″埗鎴栧彇娑堢鍒�
- body.put("taskId", wrkNo);//浠诲姟鍙�
+ body.put("taskId", getTaskId());//TaskID闇�瑕侀殢鏈�
request.setBody(body);
httpStandard.setRequest(request);
@@ -122,7 +123,7 @@
//鑾峰彇鏇存柊灞傚潗鏍嘮(妤煎眰)鍛戒护
public static NyShuttleHttpCommand getUpdateZCommand(Integer shuttleNo, Integer z) {
- NyShuttleHttpCommand httpStandard = getHttpStandard(shuttleNo);
+ NyShuttleHttpCommand httpStandard = getHttpStandard(shuttleNo, 9999);
NyShuttleHttpCommand.NyRequest request = httpStandard.getRequest();
HashMap<String, Object> body = new HashMap<>();
@@ -136,7 +137,7 @@
//鑾峰彇璇籉AS鐘舵�佷俊鎭懡浠�
public static NyShuttleHttpCommand getReadStatusCommand(Integer shuttleNo) {
- NyShuttleHttpCommand httpStandard = getHttpStandard(shuttleNo);
+ NyShuttleHttpCommand httpStandard = getHttpStandard(shuttleNo, 9999);
NyShuttleHttpCommand.NyRequest request = httpStandard.getRequest();
HashMap<String, Object> body = new HashMap<>();
@@ -149,7 +150,7 @@
//鑾峰彇鏇存柊FAS鍩哄噯鍦板浘鍛戒护
public static NyShuttleHttpCommand getUpdateFASBaseMapCommand(Integer shuttleNo, Integer xBase, Integer yBase, Integer zBase, Integer xEnd, Integer yEnd, Integer zEnd, Integer xBaseCoord, Integer yBaseCoord, Integer xDefaultSpace, Integer yDefaultSpace) {
- NyShuttleHttpCommand httpStandard = getHttpStandard(shuttleNo);
+ NyShuttleHttpCommand httpStandard = getHttpStandard(shuttleNo, 9999);
NyShuttleHttpCommand.NyRequest request = httpStandard.getRequest();
HashMap<String, Object> body = new HashMap<>();
@@ -175,7 +176,7 @@
//鑾峰彇鏇存柊FAS鐗规畩X杞村湴鍥惧懡浠�
public static NyShuttleHttpCommand getUpdateMapSpecialXAxisCommand(Integer shuttleNo, List<Map<String, Object>> list) {
- NyShuttleHttpCommand httpStandard = getHttpStandard(shuttleNo);
+ NyShuttleHttpCommand httpStandard = getHttpStandard(shuttleNo, 9999);
NyShuttleHttpCommand.NyRequest request = httpStandard.getRequest();
HashMap<String, Object> body = new HashMap<>();
@@ -189,7 +190,7 @@
//鑾峰彇鏇存柊FAS鐗规畩Y杞村湴鍥惧懡浠�
public static NyShuttleHttpCommand getUpdateMapSpecialYAxisCommand(Integer shuttleNo, List<Map<String, Object>> list) {
- NyShuttleHttpCommand httpStandard = getHttpStandard(shuttleNo);
+ NyShuttleHttpCommand httpStandard = getHttpStandard(shuttleNo, 9999);
NyShuttleHttpCommand.NyRequest request = httpStandard.getRequest();
HashMap<String, Object> body = new HashMap<>();
@@ -203,7 +204,7 @@
//鑾峰彇鏇存柊FAS鐗规畩搴撲綅鐐瑰湴鍥惧懡浠�
public static NyShuttleHttpCommand getUpdateMapSpecialPointCommand(Integer shuttleNo, List<Map<String, Object>> list) {
- NyShuttleHttpCommand httpStandard = getHttpStandard(shuttleNo);
+ NyShuttleHttpCommand httpStandard = getHttpStandard(shuttleNo, 9999);
NyShuttleHttpCommand.NyRequest request = httpStandard.getRequest();
HashMap<String, Object> body = new HashMap<>();
@@ -217,7 +218,7 @@
//鑾峰彇鏇存柊FAS鎻愬崌鏈虹偣浣嶅湴鍥惧懡浠�
public static NyShuttleHttpCommand getUpdateMapDevicePointCommand(Integer shuttleNo, List<Map<String, Object>> list) {
- NyShuttleHttpCommand httpStandard = getHttpStandard(shuttleNo);
+ NyShuttleHttpCommand httpStandard = getHttpStandard(shuttleNo, 9999);
NyShuttleHttpCommand.NyRequest request = httpStandard.getRequest();
HashMap<String, Object> body = new HashMap<>();
@@ -231,7 +232,7 @@
//鑾峰彇鍗曚釜RFID褰曞啓鍛戒护
public static NyShuttleHttpCommand getWriteSingleRFIDCommand(Integer shuttleNo, Integer xPoint, Integer yPoint, Integer zPoint) {
- NyShuttleHttpCommand httpStandard = getHttpStandard(shuttleNo);
+ NyShuttleHttpCommand httpStandard = getHttpStandard(shuttleNo, 9999);
NyShuttleHttpCommand.NyRequest request = httpStandard.getRequest();
HashMap<String, Object> body = new HashMap<>();
@@ -247,7 +248,7 @@
//鑾峰彇鑷姩褰曞啓RFID鍛戒护
public static NyShuttleHttpCommand getAutoWriteRFIDCommand(Integer shuttleNo, Integer dir, Integer xBase, Integer yBase, Integer zBase, Integer pointEnd, List<Integer> specialPoint) {
- NyShuttleHttpCommand httpStandard = getHttpStandard(shuttleNo);
+ NyShuttleHttpCommand httpStandard = getHttpStandard(shuttleNo, 9999);
NyShuttleHttpCommand.NyRequest request = httpStandard.getRequest();
HashMap<String, Object> body = new HashMap<>();
@@ -270,32 +271,60 @@
return random.nextInt(9999999);
}
+ //鑾峰彇TaskId
+ public static Integer getTaskId() {
+ Random random = new Random();
+ return random.nextInt(999999);
+ }
+
//鍙戝嚭璇锋眰
- public static JSONObject requestCommand(NyShuttleHttpCommand httpCommand) {
+ public static JSONObject requestCommand(Socket socket, NyShuttleHttpCommand httpCommand) {
try {
- String response = new HttpHandler.Builder()
- .setUri(requestUrl)
- .setPath("/static/readStatus.json")
- .setJson(JSON.toJSONString(httpCommand))
- .build()
- .doGet();
- JSONObject jsonObject = JSON.parseObject(response);
- JSONObject response2 = jsonObject.getJSONObject("response");
- JSONObject body = response2.getJSONObject("body");
-
- if (body.get("responseType").equals("state")) {//璇诲彇鐘舵�侊紝涓嶉渶瑕佸垽鏂璼uccess
- return body;
+ if (socket == null) {
+ return null;
}
+ // 鑾峰彇杈撳叆娴佸拰杈撳嚭娴�
+ BufferedReader reader = new BufferedReader(new InputStreamReader(socket.getInputStream()));
+ OutputStreamWriter writer = new OutputStreamWriter(socket.getOutputStream());
+ writer.write(JSON.toJSONString(httpCommand) + "\r\n");
+ writer.flush();
+// System.out.println("Sent message to server: " + JSON.toJSONString(httpCommand));
- if (body.get("result").equals("success")) {
- return body;
- }
+ // 璇诲彇鏈嶅姟鍣ㄧ殑鍝嶅簲
+ StringBuffer sb = new StringBuffer();
+ String response = null;
+ char[] chars = new char[2048];//缂撳啿鍖�
+ do {
+ reader.read(chars);
+ String trim = new String(chars).trim();
+ sb.append(trim);
+ if (sb.lastIndexOf("\r\n") != -1) {
+ break;
+ }
+ } while (response != null);
+// System.out.println("Received response from server: " + sb);
+ return JSON.parseObject(sb.toString());
} catch (Exception e) {
-// e.printStackTrace();
+ e.printStackTrace();
}
return null;
}
+ public static JSONObject filterData(JSONObject data) {
+ Object response = data.get("response");
+ if (response == null) {
+ return null;
+ }
+
+ JSONObject result = JSON.parseObject(response.toString());
+ Object body = result.get("body");
+ if (body == null) {
+ return null;
+ }
+ JSONObject jsonBody = JSON.parseObject(body.toString());
+ return jsonBody;
+ }
+
//鍦板浘鑺傜偣杞崲鐗涚溂鑺傜偣
public static NyShuttleProtocol.NyShuttlePointClass navigateNodeToNyPointNode(NavigateNode node) {
int[] NyPosition = NavigatePositionConvert.WCSXyzToNyXyz(node.getX(), node.getY(), node.getZ());//WCS绯荤粺鍧愭爣杞墰鐪煎潗鏍�
diff --git a/src/main/java/com/zy/core/model/command/NyShuttleHttpCommand.java b/src/main/java/com/zy/core/model/command/NyShuttleHttpCommand.java
index 50cbb35..bab7844 100644
--- a/src/main/java/com/zy/core/model/command/NyShuttleHttpCommand.java
+++ b/src/main/java/com/zy/core/model/command/NyShuttleHttpCommand.java
@@ -18,6 +18,9 @@
//璇锋眰娑堟伅
private NyRequest request;
+ //宸ヤ綔鍙�
+ private Integer wrkNo;
+
@Data
public static class NyRequest {
diff --git a/src/main/java/com/zy/core/model/protocol/NyShuttleProtocol.java b/src/main/java/com/zy/core/model/protocol/NyShuttleProtocol.java
index c6d3533..8d62e39 100644
--- a/src/main/java/com/zy/core/model/protocol/NyShuttleProtocol.java
+++ b/src/main/java/com/zy/core/model/protocol/NyShuttleProtocol.java
@@ -186,7 +186,7 @@
/**
* 鏁呴殰鐮�
*/
- private List<Integer> errCode;
+ private Integer errCode;
/**
* mileage鎬婚噷绋嬫暟(绫�)锛宭iftNumber椤跺崌鎬绘暟dropNumber涓嬮檷鎬绘暟reversingX鎹鎬绘暟reversingY鎹鎬绘暟
@@ -235,7 +235,14 @@
if (this.getFree() == null) {
return "";
}
- return this.getFree() == 1 ? "绌洪棽" : "杩愯涓�";
+ return this.getFree() == 0 ? "杩愯涓�" : "绌洪棽";
+ }
+
+ public String getWorkingMode$() {
+ if (this.getWorkingMode() == null) {
+ return "";
+ }
+ return this.getWorkingMode() == 0 ? "鎵嬪姩" : "鑷姩";
}
public String getLoadState$() {
@@ -264,7 +271,7 @@
return "";
}
- switch (this.getRunDir()) {
+ switch (this.getLiftPosition()) {
case 0:
return "鏈煡";
case 1:
@@ -393,6 +400,13 @@
return NavigatePositionConvert.nyXyzToLocNo(this.getPoint().getX(), this.getPoint().getY(), this.getPoint().getZ());
}
+ public String getPoint$$() {
+ if (this.getPoint() == null) {
+ return "";
+ }
+ return JSON.toJSONString(this.getPoint());
+ }
+
public String getCoord$() {
if (this.getCoord() == null) {
return "";
diff --git a/src/main/java/com/zy/core/thread/NyShuttleThread.java b/src/main/java/com/zy/core/thread/NyShuttleThread.java
index 1ab039c..687766c 100644
--- a/src/main/java/com/zy/core/thread/NyShuttleThread.java
+++ b/src/main/java/com/zy/core/thread/NyShuttleThread.java
@@ -28,6 +28,8 @@
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
+import java.io.IOException;
+import java.net.Socket;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Date;
@@ -43,6 +45,7 @@
private ShuttleSlave slave;
private NyShuttleProtocol shuttleProtocol;
private RedisUtil redisUtil;
+ private Socket socket;
public NyShuttleThread(ShuttleSlave slave,RedisUtil redisUtil) {
this.slave = slave;
@@ -108,10 +111,11 @@
//----------璇诲彇鍥涘悜绌挎杞︾姸鎬�-----------
NyShuttleHttpCommand readStatusCommand = NyHttpUtils.getReadStatusCommand(slave.getId());
- JSONObject jsonObject = NyHttpUtils.requestCommand(readStatusCommand);
- if (jsonObject == null) {
+ JSONObject result = NyHttpUtils.requestCommand(socket, readStatusCommand);
+ if (result == null) {
OutputQueue.SHUTTLE.offer(MessageFormat.format("銆恵0}銆戝洓鍚戠┛姊溅plc鐘舵�佷俊鎭け璐� ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort()));
}else {
+ JSONObject jsonObject = NyHttpUtils.filterData(result);
//鎵嬪姩鐘舵��/鑷姩鐘舵��
shuttleProtocol.setWorkingMode(jsonObject.getInteger("workingMode"));
//鍏佽鐘舵�� 0:杩愯涓�1锛氱┖闂�
@@ -159,7 +163,7 @@
errCode.add(Integer.parseInt(o.toString()));
}
//鏁呴殰鐮�
- shuttleProtocol.setErrCode(errCode);
+ shuttleProtocol.setErrCode(errCode.get(0));
//鎬婚噷绋嬫暟
shuttleProtocol.setStatusSum(jsonObject.getObject("statusSum", NyShuttleProtocol.StatusSumClass.class));
//闈炶嚜鍔ㄧ姸鎬佹椂闂磋鏃�
@@ -242,6 +246,13 @@
@Override
public boolean connect() {
+ try {
+ Socket socket = new Socket(slave.getIp(),slave.getPort());
+ socket.setSoTimeout(60000);
+ this.socket = socket;
+ } catch (IOException e) {
+ OutputQueue.SHUTTLE.offer(MessageFormat.format("銆恵0}銆戝洓鍚戠┛姊溅Socket閾炬帴澶辫触 ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort()));
+ }
return true;
}
@@ -268,7 +279,7 @@
}
//鍙戝嚭璇锋眰
- JSONObject result = NyHttpUtils.requestCommand(command);
+ JSONObject result = NyHttpUtils.requestCommand(socket, command);
if (result == null) {
return false;//璇锋眰澶辫触
}
@@ -318,62 +329,62 @@
NavigateMapData navigateMapData = new NavigateMapData(Utils.getLev(shuttleProtocol.getCurrentLocNo()));
//鍙栧嚭鍛戒护
NyShuttleHttpCommand command = commands.get(commandStep);//褰撳墠鍛戒护
- if (commandStep != 0) {
- //鍒ゆ柇涓婁竴鏉℃寚浠ゆ槸鍚﹀畬鎴�
- NyShuttleHttpCommand lastCommand = commands.get(commandStep - 1);
- String requestType = lastCommand.getRequest().getBody().get("requestType").toString();
- if (requestType.equals("move") || requestType.equals("intoLift") || requestType.equals("outLift")) {
- //绉诲姩鍛戒护銆佸嚭鍏ユ彁鍗囨満鍛戒护
- NyShuttleProtocol.NyShuttlePointClass target = JSON.parseObject(lastCommand.getRequest().getBody().get("target").toString(), NyShuttleProtocol.NyShuttlePointClass.class);
- if (shuttleProtocol.getPoint().equals(target)) {
- //涓婁竴鏉℃寚浠ょ殑鐩爣浣嶇疆鍜屽綋鍓嶅皬杞︿綅缃浉鍚岋紝鍒欒瀹氫笂涓�鏉′换鍔″畬鎴�
- lastCommand.setComplete(true);
- //瑙i攣閿佸畾璺緞锛屼笂涓�鏉¤矾寰勫拰褰撳墠璺緞
- List<NavigateNode> nodes = lastCommand.getNodes();
- nodes.addAll(command.getNodes());
- navigateMapData.writeNavigateNodeToRedisMap(nodes, false);//瑙i攣璺緞
- }
- }else {
- lastCommand.setComplete(true);//鍏朵粬鍛戒护榛樿璁や负瀹屾垚
- }
- //浠诲姟鏁版嵁淇濆瓨鍒皉edis
- redisUtil.set("shuttle_wrk_no_" + redisCommand.getWrkNo(), JSON.toJSONString(redisCommand));
-
- if (!lastCommand.getComplete()) {
- //涓婁竴鏉′换鍔℃湭瀹屾垚锛岀姝笅鍙戝懡浠�
- return false;
- }
- }
-
- List<NavigateNode> nextNodes = null;//涓嬩竴姝ュ懡浠よ璧拌矾寰�
- if (commandStep + 1 < commands.size()) {
- NyShuttleHttpCommand nextCommand = commands.get(commandStep + 1);//涓嬩竴姝ュ懡浠�
- nextNodes = nextCommand.getNodes();//涓嬩竴姝ュ懡浠よ璧拌矾寰�
- }
-
- if (shuttleProtocol.getFree() == ShuttleStatusType.BUSY.id) {
- return false;//灏忚溅鐘舵�佸繖锛岀姝㈡墽琛屽懡浠�
- }
-
- //妫�娴嬪皬杞︽槸鍚﹁杩涙彁鍗囨満锛屽闇�瑕佽繘鎻愬崌鏈哄垯璋冨害鎻愬崌鏈�
- if (!checkLiftStation(wrkNo)) {
- return false;
- }
-
- //妫�娴嬬┛姊溅鏄惁鍦ㄦ彁鍗囨満鍐�
- if (!checkShuttleInTheLift(wrkNo)) {
- return false;
- }
-
- //妫�娴嬭矾寰勬槸鍚﹀彲琛岃蛋
- if (!checkPath(command.getNodes(), nextNodes, redisCommand)) {
- return false;
- }
-
- //閿佸畾璺緞锛岄攣瀹氬綋鍓嶈矾寰勫拰涓嬩竴姝ヨ矾寰�
- List<NavigateNode> nodes = command.getNodes();
- nodes.addAll(nextNodes);
- navigateMapData.writeNavigateNodeToRedisMap(nodes, true);//鎵�浣跨敤鐨勮矾寰勮繘琛岄攣瀹氱鐢�
+// if (commandStep != 0) {
+// //鍒ゆ柇涓婁竴鏉℃寚浠ゆ槸鍚﹀畬鎴�
+// NyShuttleHttpCommand lastCommand = commands.get(commandStep - 1);
+// String requestType = lastCommand.getRequest().getBody().get("requestType").toString();
+// if (requestType.equals("move") || requestType.equals("intoLift") || requestType.equals("outLift")) {
+// //绉诲姩鍛戒护銆佸嚭鍏ユ彁鍗囨満鍛戒护
+// NyShuttleProtocol.NyShuttlePointClass target = JSON.parseObject(lastCommand.getRequest().getBody().get("target").toString(), NyShuttleProtocol.NyShuttlePointClass.class);
+// if (shuttleProtocol.getPoint().equals(target)) {
+// //涓婁竴鏉℃寚浠ょ殑鐩爣浣嶇疆鍜屽綋鍓嶅皬杞︿綅缃浉鍚岋紝鍒欒瀹氫笂涓�鏉′换鍔″畬鎴�
+// lastCommand.setComplete(true);
+// //瑙i攣閿佸畾璺緞锛屼笂涓�鏉¤矾寰勫拰褰撳墠璺緞
+// List<NavigateNode> nodes = lastCommand.getNodes();
+// nodes.addAll(command.getNodes());
+// navigateMapData.writeNavigateNodeToRedisMap(nodes, false);//瑙i攣璺緞
+// }
+// }else {
+// lastCommand.setComplete(true);//鍏朵粬鍛戒护榛樿璁や负瀹屾垚
+// }
+// //浠诲姟鏁版嵁淇濆瓨鍒皉edis
+// redisUtil.set("shuttle_wrk_no_" + redisCommand.getWrkNo(), JSON.toJSONString(redisCommand));
+//
+// if (!lastCommand.getComplete()) {
+// //涓婁竴鏉′换鍔℃湭瀹屾垚锛岀姝笅鍙戝懡浠�
+// return false;
+// }
+// }
+//
+// List<NavigateNode> nextNodes = null;//涓嬩竴姝ュ懡浠よ璧拌矾寰�
+// if (commandStep + 1 < commands.size()) {
+// NyShuttleHttpCommand nextCommand = commands.get(commandStep + 1);//涓嬩竴姝ュ懡浠�
+// nextNodes = nextCommand.getNodes();//涓嬩竴姝ュ懡浠よ璧拌矾寰�
+// }
+//
+// if (shuttleProtocol.getFree() == ShuttleStatusType.BUSY.id) {
+// return false;//灏忚溅鐘舵�佸繖锛岀姝㈡墽琛屽懡浠�
+// }
+//
+// //妫�娴嬪皬杞︽槸鍚﹁杩涙彁鍗囨満锛屽闇�瑕佽繘鎻愬崌鏈哄垯璋冨害鎻愬崌鏈�
+// if (!checkLiftStation(wrkNo)) {
+// return false;
+// }
+//
+// //妫�娴嬬┛姊溅鏄惁鍦ㄦ彁鍗囨満鍐�
+// if (!checkShuttleInTheLift(wrkNo)) {
+// return false;
+// }
+//
+// //妫�娴嬭矾寰勬槸鍚﹀彲琛岃蛋
+// if (!checkPath(command.getNodes(), nextNodes, redisCommand)) {
+// return false;
+// }
+//
+// //閿佸畾璺緞锛岄攣瀹氬綋鍓嶈矾寰勫拰涓嬩竴姝ヨ矾寰�
+// List<NavigateNode> nodes = command.getNodes();
+// nodes.addAll(nextNodes);
+// navigateMapData.writeNavigateNodeToRedisMap(nodes, true);//鎵�浣跨敤鐨勮矾寰勮繘琛岄攣瀹氱鐢�
//鍙墽琛屽懡浠�
if (!write(command)) {
diff --git a/src/main/webapp/views/shuttle.html b/src/main/webapp/views/shuttle.html
index d553a77..eaf588b 100644
--- a/src/main/webapp/views/shuttle.html
+++ b/src/main/webapp/views/shuttle.html
@@ -35,6 +35,7 @@
<th>鍥涘悜绌挎杞�</th>
<th>浠诲姟鐘舵��</th>
<th>灏忚溅鐘舵��</th>
+ <th>宸ヤ綔妯″紡</th>
<th>瀹為檯搴撲綅</th>
<th>瀹為檯鍧愭爣</th>
<th>鐢甸噺</th>
@@ -46,6 +47,7 @@
<th>鍏呯數鐘舵��</th>
<th>鏁呴殰鐘舵��</th>
<th>鏁呴殰鐮�</th>
+ <th>绠″埗鐘舵��</th>
</tr>
</thead>
<tbody>
@@ -302,17 +304,19 @@
setVal(tr.children("td").eq(0), table[i-1].shuttleNo);
setVal(tr.children("td").eq(1), table[i-1].protocolStatus$);
setVal(tr.children("td").eq(2), table[i-1].free$);
- setVal(tr.children("td").eq(3), table[i-1].point$);
- setVal(tr.children("td").eq(4), table[i-1].coord$);
- setVal(tr.children("td").eq(5), table[i-1].powerPercent$);
- setVal(tr.children("td").eq(6), table[i-1].speed);
- setVal(tr.children("td").eq(7), table[i-1].loadState$);
- setVal(tr.children("td").eq(8), table[i-1].liftPosition$);
- setVal(tr.children("td").eq(9), table[i-1].runDir$);
- setVal(tr.children("td").eq(10), table[i-1].runDir2$);
- setVal(tr.children("td").eq(11), table[i-1].chargState$);
- setVal(tr.children("td").eq(12), table[i-1].errState$);
- setVal(tr.children("td").eq(13), table[i-1].errCode);
+ setVal(tr.children("td").eq(3), table[i-1].workingMode$);
+ setVal(tr.children("td").eq(4), table[i-1].point$);
+ setVal(tr.children("td").eq(5), table[i-1].point$$);
+ setVal(tr.children("td").eq(6), table[i-1].powerPercent$);
+ setVal(tr.children("td").eq(7), table[i-1].speed);
+ setVal(tr.children("td").eq(8), table[i-1].loadState$);
+ setVal(tr.children("td").eq(9), table[i-1].liftPosition$);
+ setVal(tr.children("td").eq(10), table[i-1].runDir$);
+ setVal(tr.children("td").eq(11), table[i-1].runDir2$);
+ setVal(tr.children("td").eq(12), table[i-1].chargState$);
+ setVal(tr.children("td").eq(13), table[i-1].errState$);
+ setVal(tr.children("td").eq(14), table[i-1].errCode);
+ setVal(tr.children("td").eq(15), table[i-1].suspendState$);
}
} else if (res.code === 403){
window.location.href = baseUrl+"/login";
--
Gitblit v1.9.1