From 46d68076bfa7b706549e0420dfe09314024e3696 Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期五, 22 十一月 2024 21:02:39 +0800
Subject: [PATCH] #读取地图文件优化
---
src/main/java/com/zy/core/thread/BarcodeThread.java | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/main/java/com/zy/core/thread/BarcodeThread.java b/src/main/java/com/zy/core/thread/BarcodeThread.java
index 60c83c6..25887dc 100644
--- a/src/main/java/com/zy/core/thread/BarcodeThread.java
+++ b/src/main/java/com/zy/core/thread/BarcodeThread.java
@@ -56,7 +56,10 @@
String devNo = slave.getId() == 13 ? "310-1" : slave.getId() == 15 ? "312-2" : slave.getId() == 17 ? "314-1" : slave.getId() == 19 ? "316-1" : null;
if(!Cools.isEmpty(devNo)){
barcode = barcode.substring(3,barcode.length());
- agvBasDevpService.updateBarcode(devNo,barcode);
+ int updateBarcode = agvBasDevpService.updateBarcode(devNo, barcode);
+ if (updateBarcode <= 0) {
+ News.info("{}鍙锋潯鐮佸櫒锛屾绱㈡暟鎹細{}锛屾洿鏂扮珯鐐规潯鐮佸け璐�", slave.getId(), this.barcode);
+ }
}
News.info("{}鍙锋潯鐮佸櫒锛屾洿鏂版垚鍔�", slave.getId());
JSONObject jsonObject = new JSONObject();
@@ -77,7 +80,7 @@
close(); //1.涓诲姩閲婃斁杩炴帴 //2.鏌愪簺鏈嶅姟鍣ㄥ鎸囧畾ip鏈夐摼璺暟闄愬埗
socket = new Socket();
SocketAddress socketAddress = new InetSocketAddress(slave.getIp(), slave.getPort());
- socket.connect(socketAddress, 1000); //鏌愪簺鏈嶅姟鍣╬ing寤惰繜楂樻椂瑕佸鍔�,鍚﹀垯浼氭姤閿檆onnect timeout
+ socket.connect(socketAddress, 10000); //鏌愪簺鏈嶅姟鍣╬ing寤惰繜楂樻椂瑕佸鍔�,鍚﹀垯浼氭姤閿檆onnect timeout
dataOutputStream = new DataOutputStream(socket.getOutputStream());
dataInputStream = new DataInputStream(socket.getInputStream());
// log.info("鏉$爜鎵弿浠繛鎺ユ垚鍔� ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort());
@@ -113,15 +116,17 @@
connect();
while (true) {
try {
- byte[] read = read(14, 15000);
+ byte[] read = read(14, 3 * 60 * 1000);
if (null != read) {
String s = new String(read);
+ log.warn("ip:{},id:{},璇诲彇鍒版潯鐮侊細{}",slave.getIp(),slave.getId(),s);
if (!Cools.isEmpty(s)) {
setBarcode(new String(read));
}
}
Thread.sleep(50);
}catch (Exception e) {
+ log.warn("ip:{},id:{},璇诲彇鏉$爜寮傚父锛歿}",slave.getIp(),slave.getId(),e);
setBarcode("");
log.error("run" + e);
// e.printStackTrace();
--
Gitblit v1.9.1