diff --git a/web/pom.xml b/web/pom.xml
index 3ceb44d..5ada756 100644
--- a/web/pom.xml
+++ b/web/pom.xml
@@ -102,6 +102,14 @@
true
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+ 9
+ 9
+
+
diff --git a/web/src/main/java/com/zhehekeji/web/service/PlcService.java b/web/src/main/java/com/zhehekeji/web/service/PlcService.java
index 9eb6002..bd4b358 100644
--- a/web/src/main/java/com/zhehekeji/web/service/PlcService.java
+++ b/web/src/main/java/com/zhehekeji/web/service/PlcService.java
@@ -28,6 +28,11 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import javax.annotation.Resource;
+import java.nio.CharBuffer;
+import java.nio.charset.CharacterCodingException;
+import java.nio.charset.Charset;
+import java.nio.charset.CharsetEncoder;
+import java.nio.charset.StandardCharsets;
import java.time.LocalDateTime;
import java.util.*;
import java.util.concurrent.ArrayBlockingQueue;
@@ -142,6 +147,8 @@ public class PlcService {
order.setColumn1(plcCmdInfo.getColumn2());
order.setRow1(plcCmdInfo.getRow2());
order.setIntoStockOverTime(LocalDateTime.now());
+ //2d图左右为相机id
+ order.setIntoStockOverPic("http://" + street.getPlcIp() + ":8007"+"/storeData/"+street.getPlcId()+"/"+plcCmdInfo.getRow2()+"/"+plcCmdInfo.getColumn2()+"/"+(plcCmdInfo.getLeftRight2()+2)+".PNG");
//todo 昆船的项目 ,取货 放货是独立的
//取货是是不知道放货的位置的,所以订单开始的时候只写1位置
//订单结束写2位置
@@ -149,7 +156,7 @@ public class PlcService {
OrderRealtime.startOrder(street.getId(), plcCmdInfo.getOrderNum());
TransmissionPojo transmissionPojo = new TransmissionPojo( street, plcCmdInfo.getRow2(), plcCmdInfo.getColumn2(),plcCmdInfo.getLeftRight2(),order.getId().toString());
- ClientChanel.get(street.getPlcId()).writeAndFlush(transmissionPojo.toString(TransmissionType.SGPS));
+ ClientChanel.get(street.getPlcId()).writeAndFlush(transmissionPojo.toString(TransmissionType.GPS));
}
}
@@ -376,6 +383,23 @@ public class PlcService {
}
}
+ public static void main(String[] args) {
+ String str = "GPE&001/5/7&823&20240425095316&2&130681&30&1&.\\\\storeData\\\\001\\\\2\\\\71\\\\4.PNG;.\\\\fileData\\\\1234\\\\814\\\\4.PNG;.\\\\fileData\\\\1234\\\\814\\\\4.PNG;.\\\\storeData\\\\001\\\\2\\\\71\\\\4.PNG;.\\\\fileData\\\\1234\\\\815\\\\4.PNG;.\\\\fileData\\\\1234\\\\815\\\\4.PNG;.\\\\fileData\\\\1234\\\\816\\\\4.PNG;.\\\\fileData\\\\1234\\\\816\\\\4.PNG;.\\\\storeData\\\\001\\\\2\\\\71\\\\4.PNG;.\\\\fileData\\\\1234\\\\817\\\\4.PNG;.\\\\fileData\\\\1234\\\\817\\\\4.PNG;.\\\\storeData\\\\001\\\\4\\\\67\\\\4.PNG;.\\\\storeData\\\\001\\\\8\\\\54\\\\4.PNG;.\\\\storeData\\\\001\\\\3\\\\44\\\\4.PNG;.\\\\storeData\\\\001\\\\6\\\\32\\\\4.PNG;.\\\\storeData\\\\001\\\\6\\\\17\\\\4.PNG;.\\\\storeData\\\\001\\\\6\\\\17\\\\4.PNG;.\\\\storeData\\\\001\\\\9\\\\5\\\\4.PNG;.\\\\storeData\\\\001\\\\9\\\\5\\\\4.PNG;.\\\\storeData\\\\001\\\\9\\\\5\\\\4.PNG;.\\\\storeData\\\\001\\\\7\\\\1\\\\3.PNG;.\\\\storeData\\\\001\\\\5\\\\7\\\\3.PNG;.\\\\storeData\\\\001\\\\4\\\\25\\\\3.PNG;.\\\\storeData\\\\001\\\\8\\\\34\\\\3.PNG;.\\\\storeData\\\\001\\\\6\\\\51\\\\3.PNG;.\\\\storeData\\\\001\\\\9\\\\66\\\\3.PNG;.\\\\storeData\\\\001\\\\1\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\1\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\8\\\\64\\\\4.PNG;.\\\\storeData\\\\001\\\\8\\\\64\\\\3.PNG;.\\\\storeData\\\\001\\\\3\\\\63\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\8\\\\43\\\\3.PNG;.\\\\storeData\\\\001\\\\3\\\\55\\\\4.PNG;.\\\\storeData\\\\001\\\\3\\\\55\\\\4.PNG;.\\\\storeData\\\\001\\\\3\\\\55\\\\4.PNG;.\\\\storeData\\\\001\\\\3\\\\55\\\\4.PNG;.\\\\storeData\\\\001\\\\4\\\\33\\\\4.PNG;.\\\\storeData\\\\001\\\\4\\\\33\\\\4.PNG;.\\\\storeData\\\\001\\\\3\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\3\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\3\\\\71\\\\3.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\68\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\68\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\68\\\\3.PNG;.\\\\storeData\\\\001\\\\4\\\\64\\\\3.PNG;.\\\\storeData\\\\001\\\\4\\\\64\\\\4.PNG;.\\\\storeData\\\\001\\\\4\\\\64\\\\4.PNG;.\\\\storeData\\\\001\\\\7\\\\25\\\\4.PNG;.\\\\storeData\\\\001\\\\7\\\\25\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\1\\\\71\\\\3.PNG;.\\\\storeData\\\\001\\\\1\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\1\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\1\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\2\\\\32\\\\3.PNG;.\\\\storeData\\\\001\\\\2\\\\32\\\\3.PNG;.\\\\storeData\\\\001\\\\1\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\1\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\1\\\\71\\\\3.PNG;.\\\\storeData\\\\001\\\\1\\\\71\\\\3.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\3\\\\19\\\\4.PNG;.\\\\storeData\\\\001\\\\3\\\\19\\\\4.PNG;.\\\\storeData\\\\001\\\\1\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\2\\\\21\\\\3.PNG;.\\\\storeData\\\\001\\\\2\\\\21\\\\4.PNG;.\\\\storeData\\\\001\\\\2\\\\21\\\\3.PNG;.\\\\storeData\\\\001\\\\5\\\\40\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\40\\\\3.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\3.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\1\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\1\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\1\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\1\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\1\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\44\\\\4.PNG;.\\\\storeData\\\\001\\\\1\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\1\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\21\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\21\\\\3.PNG;.\\\\storeData\\\\001\\\\1\\\\71\\\\3.PNG;.\\\\storeData\\\\001\\\\1\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\4\\\\35\\\\4.PNG;.\\\\storeData\\\\001\\\\4\\\\35\\\\4.PNG;.\\\\storeData\\\\001\\\\4\\\\35\\\\3.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\1\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\1\\\\71\\\\3.PNG;.\\\\storeData\\\\001\\\\1\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\3.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\66\\\\4.PNG;.\\\\storeData\\\\001\\\\3\\\\20\\\\4.PNG;.\\\\storeData\\\\001\\\\3\\\\20\\\\4.PNG;.\\\\storeData\\\\001\\\\3\\\\20\\\\4.PNG;.\\\\storeData\\\\001\\\\3\\\\20\\\\4.PNG;.\\\\storeData\\\\001\\\\3\\\\20\\\\4.PNG;.\\\\storeData\\\\001\\\\1\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\1\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\1\\\\71\\\\3.PNG;.\\\\storeData\\\\001\\\\1\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\1\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\3\\\\55\\\\4.PNG;.\\\\storeData\\\\001\\\\3\\\\55\\\\3.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\3.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\3.PNG;.\\\\storeData\\\\001\\\\1\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\4\\\\21\\\\4.PNG;.\\\\storeData\\\\001\\\\4\\\\21\\\\4.PNG;.\\\\storeData\\\\001\\\\4\\\\21\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\3.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\3\\\\42\\\\4.PNG;.\\\\storeData\\\\001\\\\3\\\\42\\\\4.PNG;.\\\\storeData\\\\001\\\\1\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\1\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\1\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\4\\\\22\\\\4.PNG;.\\\\storeData\\\\001\\\\4\\\\22\\\\3.PNG;.\\\\storeData\\\\001\\\\4\\\\22\\\\3.PNG;.\\\\storeData\\\\001\\\\8\\\\52\\\\3.PNG;.\\\\storeData\\\\001\\\\3\\\\33\\\\4.PNG;.\\\\storeData\\\\001\\\\3\\\\33\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\1\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\3\\\\70\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\51\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\51\\\\4.PNG;.\\\\storeData\\\\001\\\\7\\\\51\\\\4.PNG;.\\\\storeData\\\\001\\\\7\\\\51\\\\3.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\24\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\1\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\1\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\1\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\1\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\4\\\\69\\\\4.PNG;.\\\\storeData\\\\001\\\\4\\\\69\\\\4.PNG;.\\\\storeData\\\\001\\\\3\\\\44\\\\4.PNG;.\\\\storeData\\\\001\\\\3\\\\44\\\\4.PNG;.\\\\storeData\\\\001\\\\1\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\1\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\1\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\6\\\\61\\\\4.PNG;.\\\\storeData\\\\001\\\\6\\\\61\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\7\\\\47\\\\3.PNG;.\\\\storeData\\\\001\\\\7\\\\47\\\\4.PNG;.\\\\storeData\\\\001\\\\7\\\\47\\\\3.PNG;.\\\\storeData\\\\001\\\\1\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\1\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\1\\\\71\\\\3.PNG;.\\\\storeData\\\\001\\\\1\\\\71\\\\3.PNG;.\\\\storeData\\\\001\\\\1\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\64\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\64\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\64\\\\4.PNG;.\\\\storeData\\\\001\\\\6\\\\28\\\\3.PNG;.\\\\storeData\\\\001\\\\6\\\\28\\\\4.PNG;.\\\\storeData\\\\001\\\\6\\\\35\\\\3.PNG;.\\\\storeData\\\\001\\\\8\\\\69\\\\4.PNG;.\\\\storeData\\\\001\\\\8\\\\69\\\\3.PNG;.\\\\storeData\\\\001\\\\1\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\1\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\1\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\1\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\1\\\\71\\\\3.PNG;.\\\\storeData\\\\001\\\\1\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\1\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\1\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\1\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\1\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\2\\\\19\\\\3.PNG;.\\\\storeData\\\\001\\\\2\\\\19\\\\4.PNG;.\\\\storeData\\\\001\\\\2\\\\19\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\1\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\1\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\1\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\1\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\1\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\3.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\6\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\6\\\\71\\\\3.PNG;.\\\\storeData\\\\001\\\\1\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\1\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\2\\\\36\\\\4.PNG;.\\\\storeData\\\\001\\\\2\\\\36\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\7\\\\57\\\\4.PNG;.\\\\storeData\\\\001\\\\7\\\\57\\\\4.PNG;.\\\\storeData\\\\001\\\\4\\\\65\\\\4.PNG;.\\\\storeData\\\\001\\\\4\\\\65\\\\4.PNG;.\\\\storeData\\\\001\\\\1\\\\71\\\\3.PNG;.\\\\storeData\\\\001\\\\4\\\\53\\\\4.PNG;.\\\\storeData\\\\001\\\\1\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\3\\\\43\\\\4.PNG;.\\\\storeData\\\\001\\\\3\\\\43\\\\4.PNG;.\\\\storeData\\\\001\\\\9\\\\45\\\\3.PNG;.\\\\storeData\\\\001\\\\8\\\\26\\\\3.PNG;.\\\\storeData\\\\001\\\\8\\\\26\\\\3.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\3\\\\43\\\\4.PNG;.\\\\storeData\\\\001\\\\3\\\\43\\\\4.PNG;.\\\\storeData\\\\001\\\\3\\\\19\\\\4.PNG;.\\\\storeData\\\\001\\\\1\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\1\\\\71\\\\3.PNG;.\\\\storeData\\\\001\\\\5\\\\71\\\\4.PNG;.\\\\storeData\\\\001\\\\2\\\\20\\\\4.PNG;.\\\\storeData\\\\001\\\\2\\\\20\\\\4.PNG;.\\\\storeData\\\\001\\\\2\\\\20\\\\4.PNG;.\\\\storeData\\\\001\\\\2\\\\20\\\\3.PNG;.\\\\fileData\\\\20240425095316\\\\821\\\\3.PNG;.\\\\fileData\\\\20240425095316\\\\823\\\\4.PNG>\"";
+ Charset charset = StandardCharsets.UTF_8;
+ CharsetEncoder encoder = charset.newEncoder();
+
+// 获取编码所需的缓冲区大小
+ int byteCount = 0;
+ try {
+ byteCount = (int) encoder.encode(CharBuffer.wrap(str)).limit();
+ } catch (CharacterCodingException e) {
+ throw new RuntimeException(e);
+ }
+
+ System.out.println("The string occupies " + byteCount + " bytes using UTF-8 encoding.");
+ System.out.println("".length());
+ }
+
/**
* 收到告警异常信号
@@ -737,12 +761,12 @@ public class PlcService {
stock.setCategory(transmissionPojo.getCategory());
}
- if(transmissionPojo.getPcd() != null && "".equals(transmissionPojo.getPcd())) {
+ if(transmissionPojo.getPcd() != null && !"".equals(transmissionPojo.getPcd())) {
stock.setPcd("http://" + street.getPlcIp() + ":8007" + transmissionPojo.getPcd());
}
- if (transmissionPojo.getPicsPath() != null && transmissionPojo.getPicsPath().length > 0) {
+ if (transmissionPojo.getPicsPath() != null && transmissionPojo.getPicsPath().size() > 0) {
- String pics = Arrays.stream(transmissionPojo.getPicsPath()).distinct().map(v -> {
+ String pics = transmissionPojo.getPicsPath().stream().map(v -> {
return "http://" + street.getPlcIp() + ":8007" + v;
}).collect(Collectors.joining(";"));
checkLog.setPic(pics);
@@ -784,10 +808,6 @@ public class PlcService {
}
public void saveFollowPhoto(TransmissionPojo transmissionPojo) {
- Street street = streetMapper.getStreetByPlcId(transmissionPojo.getStreetNumber());
- Order order = orderMapper.selectById(transmissionPojo.getTaskId());
- order.setIntoStockOverPic(transmissionPojo.getPicsPath()[0]);
- orderMapper.updateById(order);
}
}
diff --git a/web/src/main/java/com/zhehekeji/web/service/StockService.java b/web/src/main/java/com/zhehekeji/web/service/StockService.java
index 8c3b75b..8770a57 100644
--- a/web/src/main/java/com/zhehekeji/web/service/StockService.java
+++ b/web/src/main/java/com/zhehekeji/web/service/StockService.java
@@ -329,6 +329,7 @@ public class StockService {
}
Order order = orderMapper.selectOne(new QueryWrapper()
+ .eq("street_Id",street.getId())
.eq("left_right1",stockCheck.getDirection())
.eq("column1",stock.getColumn())
.eq("row1",stock.getRow())
@@ -345,7 +346,7 @@ public class StockService {
// Assert.notNull(shelveId,"无该货架信息");
Street street = streetService.getStreetByPlcId(stockCheckSearch.getSRMNumber());
Stock stock = stockMapper.getByStreetAndDirectionAndSideAndRowColumn(street.getId(),stockCheckSearch.getDirection(),stockCheckSearch.getSeparation(),stockCheckSearch.getRow(),stockCheckSearch.getColumn());
- if(stock.getCheckPic()!=null){
+ if(stock != null && stock.getCheckPic()!=null){
stock.setCheckPics(stock.getCheckPic().split(";"));
}
diff --git a/web/src/main/java/com/zhehekeji/web/service/client/Decoder.java b/web/src/main/java/com/zhehekeji/web/service/client/Decoder.java
index 0bde1ef..2648807 100644
--- a/web/src/main/java/com/zhehekeji/web/service/client/Decoder.java
+++ b/web/src/main/java/com/zhehekeji/web/service/client/Decoder.java
@@ -99,7 +99,9 @@ public class Decoder extends DelimiterBasedFrameDecoder {
}
//获取照片后发送进行计算逻辑,并在拍照队列中取出拍照发送
else if(GET_PHOTO_END.equals(transmissionPojo.getHeader())){
- ClientChanel.get(transmissionPojo.getStreetNumber()).writeAndFlush(transmissionPojo.toString(TransmissionType.RTS));
+ if(transmissionPojo.getTaskId() != null && !"0".equals(transmissionPojo.getTaskId())) {
+ ClientChanel.get(transmissionPojo.getStreetNumber()).writeAndFlush(transmissionPojo.toString(TransmissionType.RTS));
+ }
try {
Thread.sleep(50L);
} catch (InterruptedException e) {
@@ -113,6 +115,7 @@ public class Decoder extends DelimiterBasedFrameDecoder {
TransmissionPojo pojo = new TransmissionPojo(cameraDelayTask.getCommand());
ClientChanel.get(pojo.getStreetNumber()).writeAndFlush(pojo.toString(TransmissionType.GPS));
}
+
}
//照片和结果保存,并发送给上位机
else if(RETURN_CHECK.equals(transmissionPojo.getHeader())){
diff --git a/web/src/main/java/com/zhehekeji/web/service/client/TransmissionPojo.java b/web/src/main/java/com/zhehekeji/web/service/client/TransmissionPojo.java
index 44ce5f3..7c52061 100644
--- a/web/src/main/java/com/zhehekeji/web/service/client/TransmissionPojo.java
+++ b/web/src/main/java/com/zhehekeji/web/service/client/TransmissionPojo.java
@@ -8,7 +8,7 @@ import lombok.Data;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
-import java.util.UUID;
+import java.util.*;
@Data
public class TransmissionPojo {
@@ -22,16 +22,16 @@ public class TransmissionPojo {
private String pcd;//点位文件路径
private String taskId;
- private Integer checkId;
+ private String checkId;
private Integer direction;//左右
- private Integer count; //数量
- private String category; //品规
- private String[] picsPath; //照片
+ private Integer count = 0; //数量
+ private String category = ""; //品规
+ private Set picsPath; //照片
private Integer result;
public TransmissionPojo(CheckLog checkLog , Street street){
- this.checkId = checkLog.getId();
+ this.checkId = checkLog.getId().toString();
this.streetNumber = street.getPlcId();
this.taskId = checkLog.getLotnum();
this.row = checkLog.getRow();
@@ -46,14 +46,32 @@ public class TransmissionPojo {
}
+ /**
+ * 将给定数字转换为指定长度(默认3位)的字符,不足部分用“0”补全。
+ *
+ * @param number 需要转换的数字
+ * @param length 目标字符长度(默认3)
+ * @return 符合要求的字符串
+ */
+ public static String convertNumberToFixedLengthChars(int number, int length) {
+ if (length < 1) {
+ throw new IllegalArgumentException("Length must be a positive integer.");
+ }
+
+ String numStr = Integer.toString(number);
+ while (numStr.length() < length) {
+ numStr = "0" + numStr;
+ }
+ return numStr;
+ }
public TransmissionPojo( Street street,Integer row , Integer column,Integer direction,String orderId){
this.streetNumber = street.getPlcId();
this.row = row;
- this.taskId = orderId;
+ this.taskId = "0";
this.direction = direction;
this.column = column;
- this.checkId = 0;
+ this.checkId = convertNumberToFixedLengthChars(row, 3) + convertNumberToFixedLengthChars(column, 3);
}
public String toString(TransmissionType type) {
@@ -64,8 +82,6 @@ public class TransmissionPojo {
return "GPS&" + streetNumber +"/"+row +"/"+column+ "&" + checkId + "&" + taskId + "&" + direction+ "&" + category + "&" + count;
}else if (type == TransmissionType.RTS) {
return "RTS&" + streetNumber +"/"+row +"/"+column+ "&" + checkId + "&" + taskId + "&" + direction + "&" + category + "&" + count;
- }else if (type == TransmissionType.SGPS) {
- return "SGPS&" + streetNumber +"/"+row +"/"+column+ "&" + checkId + "&" + taskId + "&" + direction ;
}
return "";
}
@@ -79,35 +95,64 @@ public class TransmissionPojo {
String[] dataArr = dataArray[1].split("/");
this.streetNumber = dataArr[0];
this.row = Integer.valueOf(dataArr[1]);
- this.column = Integer.valueOf(dataArr[2]);
+ if(dataArr.length > 2) {
+ this.column = Integer.valueOf(dataArr[2]);
+ }
}else {
this.streetNumber = dataArray[1];
}
if (dataArray.length > 2) {
- this.checkId = Integer.valueOf(dataArray[2]);
+ this.checkId = dataArray[2];
this.taskId = (dataArray[3]);
- this.direction = Integer.valueOf(dataArray[4]);
+ if(dataArray[4] != null && !"".equals(dataArray[4]) && !"null".equals(dataArray[4])) {
+ this.direction = Integer.valueOf(dataArray[4]);
+ }
}
if (dataArray.length > 5) {
- this.category = dataArray[5];
- if(!"".equals(dataArray[6]) && dataArray[6] != null) {
+ if(dataArray[5] != null &&!"".equals(dataArray[5]) && !"null".equals(dataArray[5]) ) {
+
+ this.category = dataArray[5];
+ }
+ if( dataArray.length > 6 && dataArray[6] != null && !"".equals(dataArray[6]) && ! "null".equals(dataArray[5])) {
this.count = Integer.valueOf(dataArray[6]);
}
}
if (dataArray.length > 7) {
this.result = Integer.parseInt(dataArray[7])==0 ?0:1;
- this.picsPath = dataArray[8].split(";");
+ //不记录2d图像
+ //String path2D = "/fileData/"+this.taskId+"/"+this.checkId+"/"+this.direction+".jpg";
+ String path3D = "/fileData/"+this.taskId+"/"+this.checkId+"/"+(this.direction+2)+".PNG";
+ Set strings = new HashSet<>();
+ //strings.add(path2D);
+ strings.add(path3D);
+
+ // 将数组中的元素添加到 Set 集合中
+ if(dataArray.length > 8 && dataArray[8].split(";").length>0) {
+ String[] s = dataArray[8].split(";");
+ for (int i = 0; i < s.length; i++) {
+ s[i] = s[i].replace("\\\\","/");
+ s[i] = s[i].replace("\\","/");
+ if(s[i].startsWith(".")) {
+ s[i] = s[i].replaceFirst(".", ""); // 移除单个字符
+ }
+ // 或者
+ // stringArray[i] = stringArray[i].replaceAll(regexToRemove, ""); // 使用正则表达式移除字符类别
+ }
+ Collections.addAll(strings,s);
+ strings.remove("");
+ }
+ this.picsPath = strings;
}
- if (dataArray.length > 9) {
- this.pcd = dataArray[9];
+ if(this.taskId != null && !"".equals(this.taskId) && this.checkId != null && !"".equals(this.checkId))
+ this.pcd = "/fileData/"+this.taskId+"/"+this.checkId+"/"+(this.direction+2)+".pcd";
- }
}
public static void main(String[] args) {
- TransmissionPojo transmissionPojo = new TransmissionPojo("RTE&6/3&562493&2121&1&S001&25&1&1.jpg;2.jpg&1.pcd>");
+ TransmissionPojo transmissionPojo = new TransmissionPojo("GPE&002/1/18&7&2&123&41111&30&0&fff;.\\\\f.png;/f.png>");
System.out.println(transmissionPojo);
}
+
}
diff --git a/web/src/main/java/com/zhehekeji/web/service/ksec/KsecNettyClient.java b/web/src/main/java/com/zhehekeji/web/service/ksec/KsecNettyClient.java
index 832640c..c6497a9 100644
--- a/web/src/main/java/com/zhehekeji/web/service/ksec/KsecNettyClient.java
+++ b/web/src/main/java/com/zhehekeji/web/service/ksec/KsecNettyClient.java
@@ -60,6 +60,10 @@ public class KsecNettyClient {
* @param upId
*/
public void reconnect(Integer upId) {
+ if (channel != null) {
+ channel.disconnect();
+ channel.close();
+ }
Boolean isConnected = false;
int num = 0;
ConfigProperties.KSEC ksec = configProperties.getKsec();
@@ -73,9 +77,7 @@ public class KsecNettyClient {
e.printStackTrace();
}
while ((ksec.getReconnectNum() == -1 || num < ksec.getReconnectNum()) && !isConnected) {
- if (channel != null) {
- channel.close();
- }
+
try {
Thread.sleep(ksec.getReconnectInterval());