Bläddra i källkod

修改牧场端上传每次称重数据。

zhuoning 3 år sedan
förälder
incheckning
d00476e388

+ 12 - 5
huimv-farm-device/huimv-farm-local-weight/src/main/java/com/huimv/weight/service/impl/WeightImpl.java

@@ -58,9 +58,12 @@ public class WeightImpl implements IWeight {
     //发送日总称重服务
     @Value("${dataCenter.service.dayWeight}")
     private String dayWeightService;
-    //发送称重服务
+    //发送批次称重服务
     @Value("${dataCenter.service.batchWeight}")
     private String batchWeightService;
+    //发送每次称重服务
+    @Value("${dataCenter.service.batchWeight}")
+    private String everyTimeWeightService;
     //重量批次计算间隔
     @Value("${weight.batch_interval}")
     private Integer batchIntervalHours;
@@ -92,6 +95,8 @@ public class WeightImpl implements IWeight {
                 //保存称重数据
 //                ProdWeightEntity addeightEntity = _saveWeight(farmID,weightMap);
                 ProdWeightEntity newWeightEntity = _saveWeight(weightMap);
+                //发送每次重量到数据中心
+                sendEveryTimeWeightToCenter(newWeightEntity);
 
                 //计算每天总重
 //                _sendWeightToCenter(JSON.toJSON(addeightEntity).toString());
@@ -109,6 +114,12 @@ public class WeightImpl implements IWeight {
         }
     }
 
+    private void sendEveryTimeWeightToCenter(ProdWeightEntity newWeightEntity) {
+        System.out.println("发送每次称重数据到数据中心" + newWeightEntity);
+        //发送数据
+        _doPostSimple(everyTimeWeightService, JSON.toJSONString(newWeightEntity));
+    }
+
     //发送批次数据到数据中心
     private void sendBatchWeightToCenter(ProdBatchWeightEntity updateBatchWeightEntity) {
         System.out.println("发送批次数据到数据中心" + updateBatchWeightEntity);
@@ -290,10 +301,6 @@ public class WeightImpl implements IWeight {
     private Map _parseReceiveWeight(String receiveInfo) {
         receiveInfo = receiveInfo.replace("T", "").replace("N", "").replace("\n", "");
         String[] weightArray = receiveInfo.split("kg");
-
-//        for(int a=0;a<weightArray.length;a++){
-//            System.out.println((a+1)+","+weightArray[a].trim());
-//        }
         Map weightMap = new HashMap();
         weightMap.put("grossWeight", weightArray[0].trim());
         weightMap.put("tareWeight", weightArray[1].trim());

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 1 - 1
huimv-farm-device/huimv-farm-local-weight/src/main/resources/application-prod.yml


+ 7 - 4
huimv-farm-device/huimv-farm-local-weight/src/main/resources/application.properties

@@ -6,12 +6,15 @@ spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
 spring.jackson.time-zone=GMT+8
 
 # 数据中心数据推送地址
-dataCenter.ipAddr=http://115.238.57.190
-dataCenter.port=:10091
+dataCenter.ipAddr=http://120.27.234.126
+#dataCenter.port=:10091
+dataCenter.port=:8010
 # 日总称重数据服务
-dataCenter.service.dayWeight=/receiver/farm/weight/putDayWeight
+dataCenter.service.dayWeight=/receiver/receiver/farm/weight/putDayWeight
 # 批次称重数据服务
-dataCenter.service.batchWeight=/receiver/farm/weight/putBatchWeight
+dataCenter.service.batchWeight=/receiver/receiver/farm/weight/putBatchWeight
+# 每次称重数据服务
+dataCenter.service.everyTimeWeight=/receiver/receiver/farm/weight/putEveryTimeWeight
 # 部署牧场ID(base_farm.id)
 local.farmID=1
 # 批次计算间隔