From ba1a7a9ef126296e2798e313dc5b43f775a1123c Mon Sep 17 00:00:00 2001
From: cl <418351270@qq.com>
Date: 星期四, 23 五月 2024 17:44:36 +0800
Subject: [PATCH] 修改数据采集

---
 guns-vip-main/src/main/java/cn/stylefeng/guns/plcserver/callback/OP170Callback.java |   32 ++++++++++++++++++--------------
 1 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/guns-vip-main/src/main/java/cn/stylefeng/guns/plcserver/callback/OP170Callback.java b/guns-vip-main/src/main/java/cn/stylefeng/guns/plcserver/callback/OP170Callback.java
index 961102e..2950bcd 100644
--- a/guns-vip-main/src/main/java/cn/stylefeng/guns/plcserver/callback/OP170Callback.java
+++ b/guns-vip-main/src/main/java/cn/stylefeng/guns/plcserver/callback/OP170Callback.java
@@ -28,7 +28,6 @@
 import cn.stylefeng.guns.modular.sc.serialNumbersConf.service.SerialNumbersConfService;
 import cn.stylefeng.guns.plcserver.opc.GlobalVariable;
 import cn.stylefeng.guns.plcserver.opc.OPCElement;
-import cn.stylefeng.guns.plcserver.opc.unit.OPCUnit;
 import cn.stylefeng.guns.plcserver.tool.DateTool;
 import cn.stylefeng.guns.plcserver.tool.LogUtil;
 import com.kangaroohy.milo.model.ReadWriteEntity;
@@ -166,18 +165,21 @@
                 .getValue().toString();
         ReadWriteEntity entity = new ReadWriteEntity(OPCElement.OP170_J_PC_FINISH,true);
         miloService.writeToOpcUa(entity);//鍐橮C瀹屾垚
-        //淇敼鎶ュ伐璁板綍
-        ProductionOrderRecordsParam productionOrderRecordsParam = new ProductionOrderRecordsParam();
-        productionOrderRecordsParam.setWorkOrderNo(S_ORDER_CODE);
-        productionOrderRecordsParam.setProductNo(S_SFC_CODE);
-        List<ProductionOrderRecordsResult> list2 = productionOrderRecordsService.findListBySpec(productionOrderRecordsParam);
-        if(!list2.isEmpty()){
-            ProductionOrderRecordsResult productionOrderRecordsResult = list2.get(0);
-            productionOrderRecordsParam.setId(productionOrderRecordsResult.getId());
-            productionOrderRecordsParam.setWhetherPass(S_PRODUCT_STATE_CODE);
-            productionOrderRecordsParam.setEndTime(DateTool.getLocalTimeForDate());
-            productionOrderRecordsService.update(productionOrderRecordsParam);
-        }
+
+            //淇敼鎶ュ伐璁板綍
+            ProductionOrderRecordsParam productionOrderRecordsParam = new ProductionOrderRecordsParam();
+            productionOrderRecordsParam.setWorkOrderNo(S_ORDER_CODE);
+            productionOrderRecordsParam.setProductNo(S_SFC_CODE);
+            List<ProductionOrderRecordsResult> list2 = productionOrderRecordsService.findListBySpec(productionOrderRecordsParam);
+            if (!list2.isEmpty()) {
+                ProductionOrderRecordsResult productionOrderRecordsResult = list2.get(0);
+                productionOrderRecordsParam.setId(productionOrderRecordsResult.getId());
+                if("2".equals(S_PRODUCT_STATE_CODE)) {
+                    productionOrderRecordsParam.setWhetherPass("涓嶅悎鏍�");
+                }
+                productionOrderRecordsParam.setEndTime(DateTool.getLocalTimeForDate());
+                productionOrderRecordsService.update(productionOrderRecordsParam);
+            }
 
         PassingStationCollectionParam param = new PassingStationCollectionParam();
         param.setWorkOrderNo(S_ORDER_CODE);
@@ -210,7 +212,9 @@
         logger.info("OP170宸ヤ綅,handleFinsh PC澶勭悊瀹屾垚锛�");
     }
     public void handleMaterial() {
-
+        if(S_ORDER_CODE.isEmpty()){
+            return;
+        }
         //鏌ヨ鎵规涓婃枡淇℃伅
         ProductionOrderBatchInfoParam productionOrderBatchInfoParam = new ProductionOrderBatchInfoParam();
         productionOrderBatchInfoParam.setWorkOrderNo(S_ORDER_CODE);

--
Gitblit v1.9.3