From 6dadf36ef118fbb3b2cd5aca94cde88e29fb55dc Mon Sep 17 00:00:00 2001
From: cl <418351270@qq.com>
Date: 星期二, 23 一月 2024 11:22:04 +0800
Subject: [PATCH] 修改数据采集

---
 guns-vip-main/src/main/java/cn/stylefeng/guns/plcserver/callback/EOP060Callback.java |   36 +++++++++++++++++++-----------------
 1 files changed, 19 insertions(+), 17 deletions(-)

diff --git a/guns-vip-main/src/main/java/cn/stylefeng/guns/plcserver/callback/EOP060Callback.java b/guns-vip-main/src/main/java/cn/stylefeng/guns/plcserver/callback/EOP060Callback.java
index e126fcf..0440bc0 100644
--- a/guns-vip-main/src/main/java/cn/stylefeng/guns/plcserver/callback/EOP060Callback.java
+++ b/guns-vip-main/src/main/java/cn/stylefeng/guns/plcserver/callback/EOP060Callback.java
@@ -255,24 +255,26 @@
         if(null != list && !list.isEmpty()) {
             for (int i = 0; i < list.size(); i++) {
                 CollectionParamConfResult result = (CollectionParamConfResult) list.get(i);
-                String value = miloService.
+                Object value = miloService.
                         readFromOpcUa(result.getGatherAddress())
-                        .getValue().toString();//璇诲弬鏁板��
-                ParamCollectionParam paramCollectionParam = new ParamCollectionParam();
-                paramCollectionParam.setParamCode(result.getParamCode());
-                paramCollectionParam.setParamName(result.getParamName());
-                paramCollectionParam.setWorkOrderNo(S_ORDER_CODE);
-                paramCollectionParam.setSfcCode(S_SFC_CODE);
-                paramCollectionParam.setProductCode(S_PRODUCT_CODE);
-                paramCollectionParam.setProductionLine(result.getProductionLine());
-                paramCollectionParam.setLocationCode(result.getLocationCode());
-                paramCollectionParam.setParamValue(value);
-                paramCollectionParam.setParamLower(result.getParamLower());
-                paramCollectionParam.setParamUpper(result.getParamUpper());
-                paramCollectionParam.setParamStandard(result.getParamCentral());
-                paramCollectionParam.setCollectionTime(DateTool.getLocalTimeForDate());
-                paramCollectionParam.setUnit(result.getUnit());
-                paramCollectionService.add(paramCollectionParam);
+                        .getValue();//璇诲弬鏁板��
+                if(null != value) {
+                    ParamCollectionParam paramCollectionParam = new ParamCollectionParam();
+                    paramCollectionParam.setParamCode(result.getParamCode());
+                    paramCollectionParam.setParamName(result.getParamName());
+                    paramCollectionParam.setWorkOrderNo(S_ORDER_CODE);
+                    paramCollectionParam.setSfcCode(S_SFC_CODE);
+                    paramCollectionParam.setProductCode(S_PRODUCT_CODE);
+                    paramCollectionParam.setProductionLine(result.getProductionLine());
+                    paramCollectionParam.setLocationCode(result.getLocationCode());
+                    paramCollectionParam.setParamValue(value.toString());
+                    paramCollectionParam.setParamLower(result.getParamLower());
+                    paramCollectionParam.setParamUpper(result.getParamUpper());
+                    paramCollectionParam.setParamStandard(result.getParamCentral());
+                    paramCollectionParam.setCollectionTime(DateTool.getLocalTimeForDate());
+                    paramCollectionParam.setUnit(result.getUnit());
+                    paramCollectionService.add(paramCollectionParam);
+                }
             }
         }
 

--
Gitblit v1.9.3