From 69cd9f59a0fabf12f8c9147fcba7f69817a870b3 Mon Sep 17 00:00:00 2001
From: jiazx0107@163.com <jiazx0107@163.com>
Date: 星期一, 06 十一月 2023 23:40:59 +0800
Subject: [PATCH] 更新仓内抓拍2

---
 igds-protocol-bhzn/src/main/java/com/ld/igds/protocol/bhzn/grainv2/msg/AnalysisService.java |   18 +++++++++++-------
 1 files changed, 11 insertions(+), 7 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 3a46bff..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,7 +209,8 @@
      *
      * @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.push(message.getIp(),message.getPort(),BytesUtil.hexStrToBytes(hexStr));
@@ -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) {
@@ -466,8 +470,8 @@
     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