From 5b755f09d9ffba5f6c67a5894f3887340cccb31c Mon Sep 17 00:00:00 2001
From: cl <418351270@qq.com>
Date: 星期三, 03 七月 2024 17:29:36 +0800
Subject: [PATCH] 修改参数采集

---
 jcdm-main/src/main/java/com/jcdm/main/plcserver/sub/OPCUaSubscription.java |   78 +++++++++++++++++++++++---------------
 1 files changed, 47 insertions(+), 31 deletions(-)

diff --git a/jcdm-main/src/main/java/com/jcdm/main/plcserver/sub/OPCUaSubscription.java b/jcdm-main/src/main/java/com/jcdm/main/plcserver/sub/OPCUaSubscription.java
index 8948ed1..ba6d43d 100644
--- a/jcdm-main/src/main/java/com/jcdm/main/plcserver/sub/OPCUaSubscription.java
+++ b/jcdm-main/src/main/java/com/jcdm/main/plcserver/sub/OPCUaSubscription.java
@@ -16,6 +16,8 @@
 import com.jcdm.main.da.paramCollection.service.IDaParamCollectionService;
 import com.jcdm.main.da.passingStationCollection.domain.DaPassingStationCollection;
 import com.jcdm.main.da.passingStationCollection.service.IDaPassingStationCollectionService;
+import com.jcdm.main.da.testDeviceInterfaceTemp.domain.DaTestDeviceInterfaceTemp;
+import com.jcdm.main.da.testDeviceInterfaceTemp.service.IDaTestDeviceInterfaceTempService;
 import com.jcdm.main.om.productionOrde.domain.OmProductionOrdeInfo;
 import com.jcdm.main.om.productionOrde.service.IOmProductionOrdeInfoService;
 import com.jcdm.main.plcserver.util.TimeUtil;
@@ -54,6 +56,8 @@
 
     public static IOmProductionOrdeInfoService omProductionOrdeInfoService;
 
+    public static IDaTestDeviceInterfaceTempService daTestDeviceInterfaceTempService;
+
     @Value("${orderLineUrl}")
     private static String orderLineUrl;
 
@@ -61,12 +65,14 @@
                              IDaPassingStationCollectionService daPassingStationCollectionService,
                              IDaCollectionParamConfService collectionParamConfService,
                              IDaParamCollectionService daParamCollectionService,
-                             IOmProductionOrdeInfoService omProductionOrdeInfoService) {
+                             IOmProductionOrdeInfoService omProductionOrdeInfoService,
+                             IDaTestDeviceInterfaceTempService daTestDeviceInterfaceTempService) {
         OPCUaSubscription.miloService = miloService;
         OPCUaSubscription.daPassingStationCollectionService = daPassingStationCollectionService;
         OPCUaSubscription.collectionParamConfService = collectionParamConfService;
         OPCUaSubscription.daParamCollectionService = daParamCollectionService;
         OPCUaSubscription.omProductionOrdeInfoService = omProductionOrdeInfoService;
+        OPCUaSubscription.daTestDeviceInterfaceTempService = daTestDeviceInterfaceTempService;
     }
 
 
@@ -134,8 +140,7 @@
                         //1:鍛婄煡MES鎵樼洏宸插埌绔欙紝璇锋眰涓嬪彂杩涚珯鐘舵��
                         if (Constants.OP030.equals(device)){
                             //鍙嶉鐢佃姱ocv妫�娴嬬粨鏋�
-                            boolean b = true;//OCVResultFeedBack(thoroughfare, device);
-
+                            boolean b = OCVResultFeedBack(thoroughfare, device);
                             //鍥涗釜鐢佃姱鐨勭姸鎬�
                             if (b){
                                 miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordDataDone").value(11).build());
@@ -670,65 +675,76 @@
     private boolean OCVResultFeedBack(String thoroughfare, String device) throws Exception {
         boolean flag = true;
         Object value1 = miloService.readFromOpcUa(thoroughfare + "." + device + ".CellCode_1").getValue();
-        /*if (ObjectUtil.isNotNull(value1)){
-            String string = value1.toString();
-            List<QingYanTestInfo> list = qingYanTestInfoService.list(new LambdaQueryWrapper<QingYanTestInfo>()
-                    .eq(QingYanTestInfo::getKeyCode, string));
+        if (ObjectUtil.isNotNull(value1)){
+            String cellCode = value1.toString();
+            List<DaTestDeviceInterfaceTemp> list = daTestDeviceInterfaceTempService.list(new LambdaQueryWrapper<DaTestDeviceInterfaceTemp>()
+                    .eq(DaTestDeviceInterfaceTemp::getStationCode, device)
+                    .eq(DaTestDeviceInterfaceTemp::getProductNum,cellCode));
             if (CollUtil.isNotEmpty(list)){
-                QingYanTestInfo qingYanTestInfo = list.get(0);
-                if (Constants.ONE.equals(qingYanTestInfo.getStatus())){
+                DaTestDeviceInterfaceTemp daTestDeviceInterfaceTemp = list.get(0);
+                if (Constants.ONE.equals(daTestDeviceInterfaceTemp.getTotalResult())){
                     miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".CellStatus_1").value(1).build());
                 }else {
                     flag = false;
                     miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".CellStatus_1").value(2).build());
                 }
+                daTestDeviceInterfaceTempService.deleteDaTestDeviceInterfaceTempById(daTestDeviceInterfaceTemp.getId());
             }
-        }*/
+        }
         Object value2 = miloService.readFromOpcUa(thoroughfare + "." + device + ".CellCode_2").getValue();
-        /*if (ObjectUtil.isNotNull(value2)){
-            String string = value2.toString();
-            List<QingYanTestInfo> list = qingYanTestInfoService.list(new LambdaQueryWrapper<QingYanTestInfo>()
-                    .eq(QingYanTestInfo::getKeyCode, string));
+        if (ObjectUtil.isNotNull(value2)){
+            String cellCode = value2.toString();
+            List<DaTestDeviceInterfaceTemp> list = daTestDeviceInterfaceTempService.list(new LambdaQueryWrapper<DaTestDeviceInterfaceTemp>()
+                    .eq(DaTestDeviceInterfaceTemp::getStationCode, device)
+                    .eq(DaTestDeviceInterfaceTemp::getProductNum,cellCode));
             if (CollUtil.isNotEmpty(list)){
-                QingYanTestInfo qingYanTestInfo = list.get(0);
-                if (Constants.ONE.equals(qingYanTestInfo.getStatus())){
+                DaTestDeviceInterfaceTemp daTestDeviceInterfaceTemp = list.get(0);
+                if (Constants.ONE.equals(daTestDeviceInterfaceTemp.getTotalResult())){
                     miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".CellStatus_2").value(1).build());
                 }else {
                     flag = false;
                     miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".CellStatus_2").value(2).build());
                 }
+                daTestDeviceInterfaceTempService.deleteDaTestDeviceInterfaceTempById(daTestDeviceInterfaceTemp.getId());
             }
-        }*/
+        }
+
         Object value3 = miloService.readFromOpcUa(thoroughfare + "." + device + ".CellCode_3").getValue();
-        /*if (ObjectUtil.isNotNull(value3)){
-            String string = value3.toString();
-            List<QingYanTestInfo> list = qingYanTestInfoService.list(new LambdaQueryWrapper<QingYanTestInfo>()
-                    .eq(QingYanTestInfo::getKeyCode, string));
+        if (ObjectUtil.isNotNull(value3)){
+            String cellCode = value3.toString();
+            List<DaTestDeviceInterfaceTemp> list = daTestDeviceInterfaceTempService.list(new LambdaQueryWrapper<DaTestDeviceInterfaceTemp>()
+                    .eq(DaTestDeviceInterfaceTemp::getStationCode, device)
+                    .eq(DaTestDeviceInterfaceTemp::getProductNum,cellCode));
             if (CollUtil.isNotEmpty(list)){
-                QingYanTestInfo qingYanTestInfo = list.get(0);
-                if (Constants.ONE.equals(qingYanTestInfo.getStatus())){
+                DaTestDeviceInterfaceTemp daTestDeviceInterfaceTemp = list.get(0);
+                if (Constants.ONE.equals(daTestDeviceInterfaceTemp.getTotalResult())){
                     miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".CellStatus_3").value(1).build());
                 }else {
                     flag = false;
                     miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".CellStatus_3").value(2).build());
                 }
+                daTestDeviceInterfaceTempService.deleteDaTestDeviceInterfaceTempById(daTestDeviceInterfaceTemp.getId());
             }
-        }*/
+        }
+
         Object value4 = miloService.readFromOpcUa(thoroughfare + "." + device + ".CellCode_4").getValue();
-        /*if (ObjectUtil.isNotNull(value4)){
-            String string = value4.toString();
-            List<QingYanTestInfo> list = qingYanTestInfoService.list(new LambdaQueryWrapper<QingYanTestInfo>()
-                    .eq(QingYanTestInfo::getKeyCode, string));
+        if (ObjectUtil.isNotNull(value4)){
+            String cellCode = value4.toString();
+            List<DaTestDeviceInterfaceTemp> list = daTestDeviceInterfaceTempService.list(new LambdaQueryWrapper<DaTestDeviceInterfaceTemp>()
+                    .eq(DaTestDeviceInterfaceTemp::getStationCode, device)
+                    .eq(DaTestDeviceInterfaceTemp::getProductNum,cellCode));
             if (CollUtil.isNotEmpty(list)){
-                QingYanTestInfo qingYanTestInfo = list.get(0);
-                if (Constants.ONE.equals(qingYanTestInfo.getStatus())){
+                DaTestDeviceInterfaceTemp daTestDeviceInterfaceTemp = list.get(0);
+                if (Constants.ONE.equals(daTestDeviceInterfaceTemp.getTotalResult())){
                     miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".CellStatus_4").value(1).build());
                 }else {
                     flag = false;
                     miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".CellStatus_4").value(2).build());
                 }
+                daTestDeviceInterfaceTempService.deleteDaTestDeviceInterfaceTempById(daTestDeviceInterfaceTemp.getId());
             }
-        }*/
+        }
+
         return flag;
     }
 

--
Gitblit v1.9.3