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

---
 guns-vip-main/src/main/java/cn/stylefeng/guns/plcserver/callback/OP050Callback.java |   45 +++++++++++++++++++++++++++------------------
 1 files changed, 27 insertions(+), 18 deletions(-)

diff --git a/guns-vip-main/src/main/java/cn/stylefeng/guns/plcserver/callback/OP050Callback.java b/guns-vip-main/src/main/java/cn/stylefeng/guns/plcserver/callback/OP050Callback.java
index f39dd75..aa181db 100644
--- a/guns-vip-main/src/main/java/cn/stylefeng/guns/plcserver/callback/OP050Callback.java
+++ b/guns-vip-main/src/main/java/cn/stylefeng/guns/plcserver/callback/OP050Callback.java
@@ -194,10 +194,18 @@
     }
 
     public void handleFinsh() throws Exception{
+
+
+
         logger.info("handleFinsh PC澶勭悊寮�濮嬶紒");
-        String S_PRODUCT_STATE_CODE = miloService.
+
+        Object object = miloService.
                 readFromOpcUa(OPCElement.OP050_S_PRODUCT_STATE_CODE)
-                .getValue().toString();
+                .getValue();
+        String S_PRODUCT_STATE_CODE = "";
+        if(null != object){
+            S_PRODUCT_STATE_CODE = object.toString();
+        }
 
         PassingStationCollectionParam param = new PassingStationCollectionParam();
         param.setWorkOrderNo(S_ORDER_CODE);
@@ -211,26 +219,27 @@
         passingStationCollectionService.add(param);
 
 
-        String copSfcCode = miloService.
+        Object copSfcCode = miloService.
                 readFromOpcUa(OPCElement.OP050_S_SFC_CODE_COP)
-                .getValue().toString();
-        String bopSfcCode = miloService.
+                .getValue();
+        Object bopSfcCode = miloService.
                 readFromOpcUa(OPCElement.OP050_S_SFC_CODE_BOP)
-                .getValue().toString();
+                .getValue();
 
+        if(null != copSfcCode && null != bopSfcCode){
         //鏍规嵁鍒嗘�绘垚缂栫爜锛屽皢EOP鐗╂枡鏁版嵁缁戝畾鍏崇郴淇敼涓烘�绘垚缂栫爜
-        materialTraceabilityService.updateSFC(S_SFC_CODE,copSfcCode);
-        materialTraceabilityService.updateSFC(S_SFC_CODE,bopSfcCode);
+            materialTraceabilityService.updateSFC(S_SFC_CODE,copSfcCode.toString());
+            materialTraceabilityService.updateSFC(S_SFC_CODE,bopSfcCode.toString());
 
-        //鏍规嵁鍒嗘�绘垚缂栫爜锛屽皢EOP杩囩珯鏁版嵁缁戝畾鍏崇郴淇敼涓烘�绘垚缂栫爜
-        passingStationCollectionService.updateSFC(S_SFC_CODE,copSfcCode);
-        passingStationCollectionService.updateSFC(S_SFC_CODE,bopSfcCode);
+            //鏍规嵁鍒嗘�绘垚缂栫爜锛屽皢EOP杩囩珯鏁版嵁缁戝畾鍏崇郴淇敼涓烘�绘垚缂栫爜
+            passingStationCollectionService.updateSFC(S_SFC_CODE,copSfcCode.toString());
+            passingStationCollectionService.updateSFC(S_SFC_CODE,bopSfcCode.toString());
 
 
-        //鏍规嵁鍒嗘�绘垚缂栫爜锛屽皢EOP閲囬泦鏁版嵁缁戝畾鍏崇郴淇敼涓烘�绘垚缂栫爜
-        paramCollectionService.updateSFC(S_SFC_CODE,copSfcCode);
-        paramCollectionService.updateSFC(S_SFC_CODE,bopSfcCode);
-
+            //鏍规嵁鍒嗘�绘垚缂栫爜锛屽皢EOP閲囬泦鏁版嵁缁戝畾鍏崇郴淇敼涓烘�绘垚缂栫爜
+            paramCollectionService.updateSFC(S_SFC_CODE,copSfcCode.toString());
+            paramCollectionService.updateSFC(S_SFC_CODE,bopSfcCode.toString());
+        }
         logger.info("S_SFC_CODE:"+S_SFC_CODE);
         logger.info("copSfcCode:"+copSfcCode);
         logger.info("bopSfcCode:"+bopSfcCode);
@@ -244,13 +253,13 @@
         String isProductState = "true";
         for(int i=0;i<passingStationCollectionResultList.size();i++){
             PassingStationCollectionResult passingStationCollectionResult = passingStationCollectionResultList.get(i);
-            if("false".equals(passingStationCollectionResult.getOutRsSign())){
+            if("2".equals(passingStationCollectionResult.getOutRsSign())){
                 isProductState = "false";
                 break;
             }
         }
         //淇敼鎶ュ伐璁板綍
-        if("false".equals(S_PRODUCT_STATE_CODE) || "false".equals(isProductState)){
+        if("2".equals(S_PRODUCT_STATE_CODE) || "false".equals(isProductState)){
             ProductionOrderRecordsParam productionOrderRecordsParam = new ProductionOrderRecordsParam();
             productionOrderRecordsParam.setWorkOrderNo(S_ORDER_CODE);
             productionOrderRecordsParam.setProductNo(S_SFC_CODE);
@@ -258,7 +267,7 @@
             if(list.size()>0){
                 ProductionOrderRecordsResult productionOrderRecordsResult = list.get(0);
                 productionOrderRecordsParam.setId(productionOrderRecordsResult.getId());
-                productionOrderRecordsParam.setWhetherPass("false");
+                productionOrderRecordsParam.setWhetherPass("2");
                 productionOrderRecordsService.update(productionOrderRecordsParam);
             }
         }

--
Gitblit v1.9.3