From 778d3d8b387ca0a8d1b51ef68f783fb0b407ef20 Mon Sep 17 00:00:00 2001
From: wujian <14790700720@163.com>
Date: 星期五, 26 七月 2024 11:52:34 +0800
Subject: [PATCH] fix6

---
 jcdm-main/src/main/java/com/jcdm/main/da/tileMatchMiddleware/controller/DaTileMatchMiddlewareController.java |    5 ++++-
 jcdm-main/src/main/java/com/jcdm/main/da/opcuaconfig/controller/DaOpcuaConfigController.java                 |    3 +++
 jcdm-main/src/main/java/com/jcdm/main/plcserver/sub/OPCUaSubscription.java                                   |   51 ++++++++++++++++++++++++++++++++++++++-------------
 3 files changed, 45 insertions(+), 14 deletions(-)

diff --git a/jcdm-main/src/main/java/com/jcdm/main/da/opcuaconfig/controller/DaOpcuaConfigController.java b/jcdm-main/src/main/java/com/jcdm/main/da/opcuaconfig/controller/DaOpcuaConfigController.java
index 06f3b62..7baf984 100644
--- a/jcdm-main/src/main/java/com/jcdm/main/da/opcuaconfig/controller/DaOpcuaConfigController.java
+++ b/jcdm-main/src/main/java/com/jcdm/main/da/opcuaconfig/controller/DaOpcuaConfigController.java
@@ -1,5 +1,6 @@
 package com.jcdm.main.da.opcuaconfig.controller;
 
+import java.util.Date;
 import java.util.List;
 import java.util.stream.Collectors;
 import javax.annotation.Resource;
@@ -198,6 +199,8 @@
                     TileMatchMiddleware.setCrankshaftNo(barcode);
                     TileMatchMiddleware.setCylinder(i);
                     TileMatchMiddleware.setState(1);
+                    TileMatchMiddleware.setCreateTime(new Date());
+                    TileMatchMiddleware.setUpdateTime(new Date());
                     daTileMatchMiddlewareService.insertDaTileMatchMiddleware(TileMatchMiddleware);
                 }
 
diff --git a/jcdm-main/src/main/java/com/jcdm/main/da/tileMatchMiddleware/controller/DaTileMatchMiddlewareController.java b/jcdm-main/src/main/java/com/jcdm/main/da/tileMatchMiddleware/controller/DaTileMatchMiddlewareController.java
index ebfaa83..e5f44cd 100644
--- a/jcdm-main/src/main/java/com/jcdm/main/da/tileMatchMiddleware/controller/DaTileMatchMiddlewareController.java
+++ b/jcdm-main/src/main/java/com/jcdm/main/da/tileMatchMiddleware/controller/DaTileMatchMiddlewareController.java
@@ -1,6 +1,8 @@
 package com.jcdm.main.da.tileMatchMiddleware.controller;
 
+import java.util.Comparator;
 import java.util.List;
+import java.util.stream.Collectors;
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletResponse;
 
@@ -158,7 +160,8 @@
         rMiddleware.setState(1);
         List<DaTileMatchMiddleware> TileMatchMiddlewareList=daTileMatchMiddlewareService.selectDaTileMatchMiddlewareList(rMiddleware);
         String SNCode="";
-        if(TileMatchMiddlewareList.size()>0){
+        if(CollUtil.isNotEmpty(TileMatchMiddlewareList)){
+            TileMatchMiddlewareList = TileMatchMiddlewareList.stream().sorted(Comparator.comparing(DaTileMatchMiddleware::getCreateTime)).collect(Collectors.toList());
             rMiddleware=TileMatchMiddlewareList.get(0);
             rMiddleware.setPalletNo(locationCode);
             rMiddleware.setConnectingrodNo(barcode);
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 05fb1e6..cb447d8 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
@@ -169,23 +169,48 @@
                             Object SNCodeObject = miloService.readFromOpcUa("CFL4HX.OP020.Code").getValue();
                             if (ObjectUtil.isNotEmpty(SNCodeObject)){
                                 String snCode = SNCodeObject.toString();
-                                if (snCode.startsWith("380")){
-                                    log.info("enter-380");
-                                    String[] split = snCode.split(StrUtil.SPACE);
-                                    if (split.length>1){
-                                        ReadWriteEntity entity = new ReadWriteEntity("CFL4HX.OP020.PrintSN1", split[0]);
-                                        OPCUaSubscription.miloService.writeToOpcUa(entity);//鍐欏畬鎴�
-                                        ReadWriteEntity entity2 = new ReadWriteEntity("CFL4HX.OP020.PrintSN2", "鈽�"+split[1]+"鈽�");
-                                        OPCUaSubscription.miloService.writeToOpcUa(entity2);//鍐欏畬鎴�
-                                        ReadWriteEntity entity3 = new ReadWriteEntity("CFL4HX.OP020.SendSNDone", 1);
+                                DaPassingStationCollection passingStationCollectionCheck = new DaPassingStationCollection();
+                                passingStationCollectionCheck.setLocationCode("OP020");
+                                passingStationCollectionCheck.setSfcCode(snCode);
+                                List<DaPassingStationCollection> checkList = passingStationCollectionServiceImpl.selectDaPassingStationCollectionList(passingStationCollectionCheck);
+                                if (CollUtil.isNotEmpty(checkList)){
+                                    if (snCode.startsWith("380")){
+                                        log.info("enter-380");
+                                        String[] split = snCode.split(StrUtil.SPACE);
+                                        if (split.length>1){
+                                            ReadWriteEntity entity = new ReadWriteEntity("CFL4HX.OP020.PrintSN1", split[0]);
+                                            OPCUaSubscription.miloService.writeToOpcUa(entity);//鍐欏畬鎴�
+                                            ReadWriteEntity entity2 = new ReadWriteEntity("CFL4HX.OP020.PrintSN2", "鈽�"+split[1]+"鈽�");
+                                            OPCUaSubscription.miloService.writeToOpcUa(entity2);//鍐欏畬鎴�
+                                            ReadWriteEntity entity3 = new ReadWriteEntity("CFL4HX.OP020.SendSNDone", 2);
+                                            OPCUaSubscription.miloService.writeToOpcByte(entity3);//鍐欏畬鎴�
+                                        }
+                                    } else {
+                                        ReadWriteEntity entity = new ReadWriteEntity("CFL4HX.OP020.PrintSN1", snCode);
+                                        OPCUaSubscription.miloService.writeToOpcByte(entity);//鍐欏畬鎴�
+                                        ReadWriteEntity entity3 = new ReadWriteEntity("CFL4HX.OP020.SendSNDone", 2);
                                         OPCUaSubscription.miloService.writeToOpcByte(entity3);//鍐欏畬鎴�
                                     }
                                 } else {
-                                    ReadWriteEntity entity = new ReadWriteEntity("CFL4HX.OP020.PrintSN1", snCode);
-                                    OPCUaSubscription.miloService.writeToOpcByte(entity);//鍐欏畬鎴�
-                                    ReadWriteEntity entity3 = new ReadWriteEntity("CFL4HX.OP020.SendSNDone", 1);
-                                    OPCUaSubscription.miloService.writeToOpcByte(entity3);//鍐欏畬鎴�
+                                    if (snCode.startsWith("380")){
+                                        log.info("enter-380");
+                                        String[] split = snCode.split(StrUtil.SPACE);
+                                        if (split.length>1){
+                                            ReadWriteEntity entity = new ReadWriteEntity("CFL4HX.OP020.PrintSN1", split[0]);
+                                            OPCUaSubscription.miloService.writeToOpcUa(entity);//鍐欏畬鎴�
+                                            ReadWriteEntity entity2 = new ReadWriteEntity("CFL4HX.OP020.PrintSN2", "鈽�"+split[1]+"鈽�");
+                                            OPCUaSubscription.miloService.writeToOpcUa(entity2);//鍐欏畬鎴�
+                                            ReadWriteEntity entity3 = new ReadWriteEntity("CFL4HX.OP020.SendSNDone", 1);
+                                            OPCUaSubscription.miloService.writeToOpcByte(entity3);//鍐欏畬鎴�
+                                        }
+                                    } else {
+                                        ReadWriteEntity entity = new ReadWriteEntity("CFL4HX.OP020.PrintSN1", snCode);
+                                        OPCUaSubscription.miloService.writeToOpcByte(entity);//鍐欏畬鎴�
+                                        ReadWriteEntity entity3 = new ReadWriteEntity("CFL4HX.OP020.SendSNDone", 1);
+                                        OPCUaSubscription.miloService.writeToOpcByte(entity3);//鍐欏畬鎴�
+                                    }
                                 }
+
                             }
                         } else if (OPCElement.OP030_SAVE_REQUEST.equals(identifier)) {
                             cleanForm("CFL4HX.OP030.SaveFeed");

--
Gitblit v1.9.3