From dfd793f14e51c48c3322f1b36f543179043bd45d Mon Sep 17 00:00:00 2001
From: jiazx0107@163.com <jiazx0107@163.com>
Date: 星期日, 22 十月 2023 18:25:27 +0800
Subject: [PATCH] 更新仓内抓拍
---
igds-protocol-bhzn/src/main/java/com/ld/igds/protocol/bhzn/grainv2/msg/AnalysisService.java | 22 +++++++++++++---------
1 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/igds-protocol-bhzn/src/main/java/com/ld/igds/protocol/bhzn/grainv2/msg/AnalysisService.java b/igds-protocol-bhzn/src/main/java/com/ld/igds/protocol/bhzn/grainv2/msg/AnalysisService.java
index 5d4e413..462ba97 100644
--- a/igds-protocol-bhzn/src/main/java/com/ld/igds/protocol/bhzn/grainv2/msg/AnalysisService.java
+++ b/igds-protocol-bhzn/src/main/java/com/ld/igds/protocol/bhzn/grainv2/msg/AnalysisService.java
@@ -81,6 +81,7 @@
ser.setPort(message.getPort());
ser.setStatus(Constant.YN_Y);
coreSerService.updateByData(ser);
+ log.info("涓绘満------->>骞冲彴锛氭敞鍐屾垚鍔燂紝鍒嗘満淇℃伅={}", ser);
}
return;
}
@@ -164,7 +165,7 @@
//濡傛灉褰撳墠鍖呯殑鏁版嵁涓暟澶т簬绛変簬褰撳墠浠撳簱鐨勯厤缃偣浣嶅垯琛ㄧず鍗曞寘杩斿洖
if (curPoint >= sumPoint) {
-
+ log.info("鍒嗘満------>>>骞冲彴锛氱伯鎯呮暟鎹崟鍖�=" + grainHex);
//杩斿洖绮儏鎺ユ敹淇℃伅
replayGrain(message);
@@ -188,11 +189,12 @@
if (grainHex.length() >= sumPoint * 4) {
//杩斿洖绮儏鎺ユ敹淇℃伅
replayGrain(message);
-
+ log.info("鍒嗘満------>>>骞冲彴锛氱伯鎯呮暟鎹鍖咃紝瀹屾暣鏁版嵁=" + grainHex);
analysisGrain2(ser, message, exeRequest, depotConf, sysConf, batchId, grainHex);
return;
} else {
+ log.info("鍒嗘満------>>>骞冲彴锛氬皢绗竴鍖呮暟鎹瓨鍏ュ唴瀛�=" + grainHex);
contextMapGrain.put(key, grainHex);
replayGrain(message);
}
@@ -207,10 +209,11 @@
*
* @param message
*/
- private void replayGrain(IoMessage message) {
+ private void replayGrain(IoMessage message) throws InterruptedException {
+ Thread.sleep(50);
String hexStr = CommandBuild.getMsgGrainReply(message.getAddr());
log.info("骞冲彴--------->>>涓绘満锛岃繑鍥炵伯鎯呮姤鏂囨敹鍒颁俊鎭紝鎶ユ枃={}", hexStr);
- serverEngine.pushByMin(hexStr);
+ serverEngine.push(message.getIp(),message.getPort(),BytesUtil.hexStrToBytes(hexStr));
}
private void analysisGrain2(DeviceSer ser, IoMessage message, ExeRequest exeRequest, DepotConf depotConf, DicSysConf sysConf, String batchId, String grainStr) {
@@ -433,6 +436,7 @@
th.setCompanyId(ContextUtil.getDefaultCompanyId());
String data = message.getContent();
String houseNo = data.substring(0, 2);
+ int depotId = BytesUtil.hexToInt(houseNo);
String t = data.substring(4, 8);
String h = data.substring(8, 12);
double temp, humy;
@@ -449,9 +453,9 @@
th.setTempIn(temp);
th.setHumidityIn(humy);
- log.info("涓绘満--------->>>骞冲彴锛岃В鏋愪粨娓╀粨婀夸俊鎭紝浠撳簱={},缁撴灉={}", houseNo, th.toString());
+ log.info("涓绘満--------->>>骞冲彴锛岃В鏋愪粨娓╀粨婀夸俊鎭紝浠撳簱={},缁撴灉={}", depotId, th.toString());
- String key = "TH_" + houseNo;
+ String key = "TH_" + depotId;
contextMapTH.put(key, th);
} catch (Exception e) {
@@ -459,15 +463,15 @@
} finally {
String hexStr = CommandBuild.getMsgTHReply(message.getAddr());
log.info("骞冲彴--------->>>涓绘満锛岃繑鍥炰粨娓╀粨婀挎敹鍒颁俊鎭紝鎶ユ枃={}", hexStr);
- serverEngine.pushByMin(hexStr);
+ serverEngine.push(message.getIp(),message.getPort(),BytesUtil.hexStrToBytes(hexStr));
}
}
private THDto getTH(IoMessage message) {
String data = message.getContent();
String houseNo = data.substring(0, 2);
-
- String key = "TH_" + houseNo;
+ Integer depotId = BytesUtil.hexToInt(houseNo);
+ String key = "TH_" + depotId;
return contextMapTH.get(key);
}
--
Gitblit v1.9.3