From 59e2283a10aee45e6a98e34b432ba345095116db Mon Sep 17 00:00:00 2001
From: wujian <14790700720@163.com>
Date: 星期三, 10 七月 2024 16:36:42 +0800
Subject: [PATCH] add 选瓦

---
 jcdm-main/src/main/java/com/jcdm/main/plcserver/sub/OPCUaSubscription.java |  359 +++++++++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 298 insertions(+), 61 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 0b7e813..73087f6 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
@@ -3,6 +3,7 @@
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.StrUtil;
+import com.jcdm.common.core.domain.BaseEntity;
 import com.jcdm.main.bs.domain.BsTechnologyRouteChildInfo;
 import com.jcdm.main.bs.orderScheduling.domain.BsOrderScheduling;
 import com.jcdm.main.bs.orderScheduling.service.IBsOrderSchedulingService;
@@ -13,6 +14,8 @@
 import com.jcdm.main.da.paramCollection.domain.DaParamCollection;
 import com.jcdm.main.da.paramCollection.service.IDaParamCollectionService;
 import com.jcdm.main.da.passingStationCollection.domain.DaPassingStationCollection;
+import com.jcdm.main.da.passingStationCollection.domain.ProductNewPassStation;
+import com.jcdm.main.da.passingStationCollection.service.ProductNewPassStationService;
 import com.jcdm.main.da.passingStationCollection.service.impl.DaPassingStationCollectionServiceImpl;
 import com.jcdm.main.plcserver.conf.OPCElement;
 import com.jcdm.main.rm.repairRecord.domain.RmRepairRecord;
@@ -21,6 +24,7 @@
 import com.kangaroohy.milo.runner.subscription.SubscriptionCallback;
 import com.kangaroohy.milo.service.MiloService;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.ObjectUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Component;
@@ -55,6 +59,7 @@
     public IRmRepairRecordService rmRepairRecordService;
 
     public IBsTechnologyRouteChildInfoService bsTechnologyRouteChildInfoService;
+    public ProductNewPassStationService productNewPassStationService;
 
     public HashMap<String,List<DaCollectionParamConf>> allCollectParamList = new HashMap<>();
 
@@ -65,7 +70,8 @@
                              IBsOrderSchedulingService bsOrderSchedulingService,
                              List<DaOpcuaConfig> lists,
                              IRmRepairRecordService rmRepairRecordService,
-                             IBsTechnologyRouteChildInfoService bsTechnologyRouteChildInfoService) {
+                             IBsTechnologyRouteChildInfoService bsTechnologyRouteChildInfoService,
+                             ProductNewPassStationService productNewPassStationService) {
         OPCUaSubscription.miloService = miloService;
         this.collectionParamConfService = collectionParamConfService;
         this.daParamCollectionService = daParamCollectionService;
@@ -74,6 +80,7 @@
         this.lists = lists;
         this.rmRepairRecordService = rmRepairRecordService;
         this.bsTechnologyRouteChildInfoService = bsTechnologyRouteChildInfoService;
+        this.productNewPassStationService = productNewPassStationService;
 
 
     }
@@ -93,45 +100,104 @@
                     logger.info("-------鐩戝惉鍒�,{}鐨凜ODE_CHECK鐨勪俊鍙�",identifier);
                     //logger.info("-------time--------------,{}",LocalDateTime.now());
                     //sn
-                    this.SNRetrieval(identifier,value.toString());
-                    if (identifier.equals(OPCElement.OP120_ZZ_CODE_CHECK) && "1".equals(value.toString())){
-                        //鎬昏涓婄嚎鎵爜浼犺緭鏁版嵁
-                        logger.info("-------鐩戝惉鍒�,{}鐨勬壂鐮佹灙鎵爜鐨凜ODE_CHECK鐨勪俊鍙�",identifier);
-                        scannerGunMessage();
-                    }
-                    if (identifier.equals(OPCElement.OP060_HX_CODE_CHECK) && "1".equals(value.toString())){
-                        Object SNCodeObject = miloService.readFromOpcUa("CFL4HX.OP060.Code1").getValue();
-                        if (null == SNCodeObject){
-                            SNCodeObject = miloService.readFromOpcUa("CFL4HX.OP060.Code").getValue();
+                    if (OPCElement.OP010_CODE_CHECK.equals(identifier)){
+                        ReadWriteEntity entity = new ReadWriteEntity("CFL4HX.OP010.CodeCheckFeed", 1);
+                        OPCUaSubscription.miloService.writeToOpcByte(entity);//鍐欏畬鎴�
+                    } else if (OPCElement.OP020_CODE_CHECK.equals(identifier)) {
+                        ReadWriteEntity entity = new ReadWriteEntity("CFL4HX.OP020.CodeCheckFeed", 1);
+                        OPCUaSubscription.miloService.writeToOpcByte(entity);//鍐欏畬鎴�
+                    } else if (OPCElement.OP030_CODE_CHECK.equals(identifier)) {
+                        ReadWriteEntity entity = new ReadWriteEntity("CFL4HX.OP030.CodeCheckFeed", 1);
+                        OPCUaSubscription.miloService.writeToOpcByte(entity);//鍐欏畬鎴�
+                        Object SNCodeObject = miloService.readFromOpcUa("CFL4HX.OP030.Code").getValue();
+                        if (ObjectUtil.isNotEmpty(SNCodeObject)){
+                            String snCode = SNCodeObject.toString();
+                            if (StrUtil.isNotBlank(snCode)){
+                                String type = productNewFlag(snCode);
+                                if ("280".equals(type) || "380".equals(type)){
+                                    //鑾峰彇绠变綋鐮�
+                                    ProductNewPassStation productNewPassStation = new ProductNewPassStation();
+                                    productNewPassStation.setFinishFlag(OPCElement.UN_FINISH);
+                                    productNewPassStation.setSfcCode(snCode);
+                                    List<ProductNewPassStation> productPassStationList = productNewPassStationService.getProductPassStationList(productNewPassStation);
+                                    if (CollUtil.isNotEmpty(productPassStationList)){
+                                        List<ProductNewPassStation> collect = productPassStationList.stream().sorted(Comparator.comparing(ProductNewPassStation::getCreateTime).reversed()).collect(Collectors.toList());
+                                        ProductNewPassStation productNewPassStation1 = collect.get(0);
+                                        String boxCode = productNewPassStation1.getBoxCode();
+                                        passingStationCollectionServiceImpl.sendMessage(type+"*"+boxCode,"OP030");
+                                    }
+
+                                }
+                            }
+
                         }
-                        if (null != SNCodeObject){
-                            String XT=null;
-                            String CZ=null;
-                            String SNCode = SNCodeObject.toString();
-                            DaParamCollection ParamCollection = new DaParamCollection();
-                            ParamCollection.setSfcCode(SNCode);
-                            List<DaParamCollection> DaParamCollectionlist=daParamCollectionService.selectDaParamCollectionList(ParamCollection);
-                            List<DaParamCollection> XTParamCollection = DaParamCollectionlist.stream().filter(x -> "绠变綋".equals(x.getParamName())).collect(Collectors.toList());
-                            if (CollUtil.isNotEmpty(XTParamCollection)){
-                                DaParamCollection lastOne = XTParamCollection.get(0);
-                                XT = lastOne.getParamValue();
-                            }
-                            List<DaParamCollection> CZParamCollection = DaParamCollectionlist.stream().filter(x -> "鏇茶酱".equals(x.getParamName())).collect(Collectors.toList());
-                            if (CollUtil.isNotEmpty(CZParamCollection)){
-                                DaParamCollection lastOne = CZParamCollection.get(0);
-                                CZ = lastOne.getParamValue();
-                            }
-                            if(null != XT&&null != CZ) {
-                                passingStationCollectionServiceImpl.sendMessage(XT+"*"+CZ,"OP060");
-                            }
+                    } else if (OPCElement.OP040_CODE_CHECK.equals(identifier)) {
+                        ReadWriteEntity entity = new ReadWriteEntity("CFL4HX.OP040.CodeCheckFeed", 1);
+                        OPCUaSubscription.miloService.writeToOpcByte(entity);//鍐欏畬鎴�
+                        //鎺ㄩ�佹暟鎹�
+                        log.info("杩涘叆OP040.CodeCheck");
+                        tile2("CFL4HX.OP040.CodeCheck");
+                    } else {
+                        this.SNRetrieval(identifier,value.toString());
+                        if (identifier.equals(OPCElement.OP120_ZZ_CODE_CHECK) && "1".equals(value.toString())){
+                            //鎬昏涓婄嚎鎵爜浼犺緭鏁版嵁
+                            logger.info("-------鐩戝惉鍒�,{}鐨勬壂鐮佹灙鎵爜鐨凜ODE_CHECK鐨勪俊鍙�",identifier);
+                            scannerGunMessage();
                         }
                     }
+
                 }
                 if (collect2.contains(identifier)){
                     if ("1".equals(value.toString())){
                         logger.info("-------鐩戝惉鍒�,{}鐨凷AVE_REQUEST_LAST鐨勪俊鍙�",identifier);
                         //logger.info("-------time--------------,{}",LocalDateTime.now());
-                        this.SaveData(identifier);
+                        //HX绾挎敼瑁�
+                        if (OPCElement.OP010_REQUEST_PRODUCT_TYPE.equals(identifier)){
+                           Object SNCodeObject = miloService.readFromOpcUa("CFL4HX.OP010.Code").getValue();
+                           if (ObjectUtil.isNotEmpty(SNCodeObject)){
+                               String snCode = SNCodeObject.toString();
+                               ReadWriteEntity entity3 = new ReadWriteEntity("CFL4HX.OP010.ProductTypeSN",snCode);
+                               OPCUaSubscription.miloService.writeToOpcUa(entity3);//鍐欎骇鍝丼N鍙峰弽棣�
+                               ReadWriteEntity entity2 = new ReadWriteEntity("CFL4HX.OP010.SNDone", 1);
+                               OPCUaSubscription.miloService.writeToOpcByte(entity2);//鍐欏畬鎴�
+
+                           }
+                        } else if (OPCElement.OP010_SAVE_REQUEST.equals(identifier)) {
+                            ReadWriteEntity entity2 = new ReadWriteEntity("CFL4HX.OP010.SaveFeed", 1);
+                            OPCUaSubscription.miloService.writeToOpcByte(entity2);//鍐欏畬鎴�
+                        } else if (OPCElement.OP020_PRINT_REQUEST.equals(identifier)) {
+                            Object SNCodeObject = miloService.readFromOpcUa("CFL4HX.OP020.Code").getValue();
+                            if (ObjectUtil.isNotEmpty(SNCodeObject)){
+                                String snCode = SNCodeObject.toString();
+                                if (snCode.startsWith("380")){
+                                    String[] split = snCode.split(StrUtil.SPACE);
+                                    if (split.length>1){
+                                        ReadWriteEntity entity = new ReadWriteEntity("CFL4HX.OP020.PrintSN1", split[0]);
+                                        OPCUaSubscription.miloService.writeToOpcByte(entity);//鍐欏畬鎴�
+                                        ReadWriteEntity entity2 = new ReadWriteEntity("CFL4HX.OP020.PrintSN2", split[1]);
+                                        OPCUaSubscription.miloService.writeToOpcByte(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)) {
+                            ReadWriteEntity entity2 = new ReadWriteEntity("CFL4HX.OP030.SaveFeed", 1);
+                            OPCUaSubscription.miloService.writeToOpcByte(entity2);//鍐欏畬鎴�
+                            cleanForm("CFL4HX.OP030.SaveFeed");
+                        } else if (OPCElement.OP040_SAVE_REQUEST.equals(identifier)) {
+                            cleanForm040(OPCElement.OP040_SAVE_REQUEST);
+                            ReadWriteEntity entity2 = new ReadWriteEntity("CFL4HX.OP040.SaveFeed", 1);
+                            OPCUaSubscription.miloService.writeToOpcByte(entity2);//鍐欏畬鎴�
+                        } else {
+                            this.SaveData(identifier);
+                        }
+
                     }
                 }
             }
@@ -210,34 +276,56 @@
                     miloService.writeToOpcByte(entity);
                     logger.info("鐩戝惉鍒拌繑鍥瀋odecheckfeed淇″彿锛寋}",entity);
                     //棣栫珯浼犺緭璁㈠崟鍙�
-                    if (OPCElement.OP050_HX_CODE_CHECK.equals(Node)){
-                        //鏌ヨ璁㈠崟鍙�
-                        BsOrderScheduling bsOrderScheduling = new BsOrderScheduling();
-                        bsOrderScheduling.setEngineNo(SNCode);
-                        List<BsOrderScheduling> tempList = bsOrderSchedulingService.selectBsOrderSchedulingList(bsOrderScheduling);
-                        String orderNum = "";
-                        if (CollUtil.isNotEmpty(tempList)){
-                            BsOrderScheduling bsOrderScheduling1 = tempList.get(0);
-                            orderNum = bsOrderScheduling1.getOrderNo();
-                        }
-                        ReadWriteEntity entity2 = new ReadWriteEntity(parts[0]+"."+parts[1]+".OrderNumber", orderNum);
-                        miloService.writeToOpcUa(entity2);
-                    }
+//                    if (OPCElement.OP050_HX_CODE_CHECK.equals(Node)){
+//                        //鏌ヨ璁㈠崟鍙�
+//                        BsOrderScheduling bsOrderScheduling = new BsOrderScheduling();
+//                        bsOrderScheduling.setEngineNo(SNCode);
+//                        List<BsOrderScheduling> tempList = bsOrderSchedulingService.selectBsOrderSchedulingList(bsOrderScheduling);
+//                        String orderNum = "";
+//                        if (CollUtil.isNotEmpty(tempList)){
+//                            BsOrderScheduling bsOrderScheduling1 = tempList.get(0);
+//                            orderNum = bsOrderScheduling1.getOrderNo();
+//                        }
+//                        ReadWriteEntity entity2 = new ReadWriteEntity(parts[0]+"."+parts[1]+".OrderNumber", orderNum);
+//                        miloService.writeToOpcUa(entity2);
+//                    }
                     //濡傛灉鏄繑淇伐浣嶉渶瑕佷紶杈撹繑淇伐浣嶅彿
                     if (OPCElement.OP465_ZZ_CODE_CHECK.equals(Node) || OPCElement.OP355_ZZ_CODE_CHECK.equals(Node)
                     || OPCElement.OP695_ZZ_CODE_CHECK.equals(Node) || OPCElement.OP755_ZZ_CODE_CHECK.equals(Node)){
                         rework(SNCode,Node,daPassingStationCollections,rmRepairRecords);
                     }
-                    if (OPCElement.OP020_HX_CODE_CHECK.equals(Node)) {
-                        //婵�鍏夋墦鐮�
-                        String[] printcode=SNCode.split("\\s+");
-                        ReadWriteEntity entity3 = new ReadWriteEntity("CFL4HX.HOP020.PrintCode1", printcode[0]);
-                        OPCUaSubscription.miloService.writeToOpcUa(entity3);//鍐橲N
-                        ReadWriteEntity entity5 = new ReadWriteEntity("CFL4HX.HOP020.PrintCode2", printcode[1]);
-                        OPCUaSubscription.miloService.writeToOpcUa(entity5);//鍐橲N
-                        ReadWriteEntity entity6 = new ReadWriteEntity("CFL4HX.HOP020.SNDoor", "1");
-                        logger.info("鍙戝姩鏈哄彿{}锛岃姹傛墦鐮佸唴瀹瑰啓鍏ユ垚鍔燂紝杩斿洖SNDoor淇″彿淇″彿1",SNCode);
-                        miloService.writeToOpcByte(entity6);
+                    if (OPCElement.OP050_CODE_CHECK.equals(Node)) {
+                        //鏂版満鍨�050
+                        String type = productNewFlag(SNCode);
+                        if ("280".equals(type) || "380".equals(type)){
+                            ProductNewPassStation productNewPassStation = new ProductNewPassStation();
+                            productNewPassStation.setSfcCode(SNCode);
+                            List<ProductNewPassStation> passStationList = productNewPassStationService.getProductPassStationList(productNewPassStation);
+                            ProductNewPassStation productNewPassStation2 = new ProductNewPassStation();
+                            productNewPassStation2.setFinishFlag("0");
+                            List<ProductNewPassStation> collect = productNewPassStationService.getProductPassStationList(productNewPassStation2)
+                                    .stream().sorted(Comparator.comparing(ProductNewPassStation::getCreateTime))
+                                    .collect(Collectors.toList());
+                            String partSfcCode = "";
+                            if (CollUtil.isNotEmpty(collect)){
+                                ProductNewPassStation passStation = collect.get(0);
+                                partSfcCode = passStation.getSfcCode();
+                            }
+                            if (CollUtil.isNotEmpty(passStationList)){
+                                ProductNewPassStation passStation = passStationList.get(0);
+                                String productType = "";
+                                if (ObjectUtils.isNotEmpty(passStation)){
+                                    productType = passStation.getProductType();
+                                }
+                                passingStationCollectionServiceImpl.sendMessage(SNCode+"*sfcCode*"+productType+"*"+partSfcCode,"OP050");
+                            }
+                        }
+                    }
+                    if (OPCElement.OP060_CODE_CHECK.equals(Node)){
+                        String type = productNewFlag(SNCode);
+                        if ("280".equals(type) || "380".equals(type)){
+                            checkBoxRod(Node);
+                        }
                     }
                     System.out.println(entity);
 
@@ -415,7 +503,26 @@
                     allCollectParamList.put(gatherAddress,list);
                 }
             }
+            //60鍙噰闆嗚�佽溅鍨�
+            if (OPCElement.OP060_SAVE_REQUEST.equals(Node) || OPCElement.OP060_SAVE_REQUEST_LAST.equals(Node)){
+                String s = productNewFlag(SNCode);
+                if ("280".equals(s) || "380".equals(s)){
+                    list = new ArrayList<>();
+                }
+            }
+            //80銆�100鍙噰闆嗘柊杞﹀瀷
+            if (OPCElement.OP080_SAVE_REQUEST.equals(Node)
+                    || OPCElement.OP080_SAVE_REQUEST_LAST.equals(Node)
+                    || OPCElement.OP100_SAVE_REQUEST.equals(Node)
+                    || OPCElement.OP100_SAVE_REQUEST_LAST.equals(Node)){
+                String s = productNewFlag(SNCode);
+                if (StrUtil.isNotEmpty(s)){
+                    if (!"280".equals(s) && !"380".equals(s)){
+                        list = new ArrayList<>();
+                    }
+                }
 
+            }
             List<String> nodeIdList = list.stream().map(info -> {
                 String nodeid = info.getGatherAddress();
                 return nodeid;
@@ -431,9 +538,19 @@
                 //杩斿洖plc淇濆瓨鎴愬姛
                 if (parts.length==3){
                     if ("SaveRequest".equals(parts[2])){
+                        if (OPCElement.OP050_SAVE_REQUEST.equals(Node)){
+                            cleanForm050(Node);
+                        } else if (OPCElement.OP060_SAVE_REQUEST.equals(Node)){
+                            cleanForm060(Node);
+                        }
                         ReadWriteEntity entity = new ReadWriteEntity(parts[0] + "." + parts[1] + ".SaveFeed", 1);
                                 miloService.writeToOpcByte(entity);
                     }else if ("SaveRequestLast".equals(parts[2])){
+                        if (OPCElement.OP050_SAVE_REQUEST_LAST.equals(Node)){
+                            cleanForm050(Node);
+                        } else if (OPCElement.OP060_SAVE_REQUEST_LAST.equals(Node)){
+                            cleanForm060(Node);
+                        }
                         ReadWriteEntity entity = new ReadWriteEntity(parts[0] + "." + parts[1] + ".SaveFeedLast", 1);
                                 miloService.writeToOpcByte(entity);
                     }
@@ -470,21 +587,22 @@
                     daParamCollectionService.saveBeachDaParamCollection(daParamCollectionlist);
                     logger.info("{}鍙戝姩鏈猴紙{}锛夐噰闆嗘暟鎹繚瀛樺畬鎴�",SNCode,Node);
                 }
-            Long beatTime = 0L;
-            if (ObjectUtil.isNotEmpty(object)){
-                String str = object.toString();
-                beatTime = Float.valueOf(str).longValue();
-            }
+
             Object ProductStatus = miloService.readFromOpcUa(parts[0] + "." + parts[1] + ".ProductStatus").getValue();
-            logger.info("ProductStatus,{}",ProductStatus.toString());
             String str1="鍚堟牸" ;
             if (ObjectUtil.isNotEmpty(ProductStatus)){
+                logger.info("ProductStatus,{}",ProductStatus.toString());
                 String productStatusString = ProductStatus.toString();
                 if (productStatusString.contains("2") || productStatusString.contains("3")){
                     str1="涓嶅悎鏍�";
                 }else {
                     str1="鍚堟牸";
                 }
+            }
+            Long beatTime = 0L;
+            if (ObjectUtil.isNotEmpty(object)){
+                String str = object.toString();
+                beatTime = Float.valueOf(str).longValue();
             }
             DaPassingStationCollection PassingStationCollection=new DaPassingStationCollection();
             PassingStationCollection.setSfcCode(SNCode);
@@ -518,4 +636,123 @@
             bsOrderSchedulingService.updateBsOrderScheduling(bsOrderScheduling);
         }
     }
+
+
+    public String productNewFlag(String SNCode){
+        String type;
+        if (SNCode.startsWith("280")){
+            type = "280";
+        } else if (SNCode.startsWith("380")){
+            type = "380";
+        }else {
+            type = "oldType";
+        }
+        return type;
+    }
+
+    public void tile2(String Node) throws Exception {
+        String[] parts = Node.split("[.]");
+        Object SNCodeObject = miloService.readFromOpcUa(parts[0] + "." + parts[1] + ".Code").getValue();
+        if (null != SNCodeObject) {
+            String SNCode = SNCodeObject.toString();
+            String productNewFlag = productNewFlag(SNCode);
+            if ("380".equals(productNewFlag)){
+                ProductNewPassStation passStation = new ProductNewPassStation();
+                passStation.setSfcCode(SNCode);
+                List<ProductNewPassStation> productPassStationList = productNewPassStationService.getProductPassStationList(passStation);
+                if (CollUtil.isNotEmpty(productPassStationList)){
+                    ProductNewPassStation productNewPassStation = productPassStationList.get(0);
+                    String boxCode = productNewPassStation.getBoxCode();
+                    String productType = productNewPassStation.getProductType();
+                    passingStationCollectionServiceImpl.sendMessage(productType+"*"+boxCode, "OP040");
+                }
+            } else if ("280".equals(productNewFlag)){
+
+            }
+        }
+    }
+
+
+    public void cleanForm(String Node) throws Exception {
+        String[] parts = Node.split("[.]");
+        Object SNCodeObject = miloService.readFromOpcUa(parts[0] + "." + parts[1] + ".Code").getValue();
+        if (ObjectUtils.isNotEmpty(SNCodeObject)){
+            String snCode = SNCodeObject.toString();
+            String s = productNewFlag(snCode);
+            if ("280".equals(s) || "380".equals(s)){
+                passingStationCollectionServiceImpl.sendMessage("clean","OP030");
+            }
+        }
+
+    }
+
+    public void cleanForm040(String Node) throws Exception {
+        String[] parts = Node.split("[.]");
+        Object SNCodeObject = miloService.readFromOpcUa(parts[0] + "." + parts[1] + ".Code").getValue();
+        if (ObjectUtils.isNotEmpty(SNCodeObject)){
+            String snCode = SNCodeObject.toString();
+            String s = productNewFlag(snCode);
+            if ("280".equals(s) || "380".equals(s)){
+                passingStationCollectionServiceImpl.sendMessage("clean*clean","OP040");
+            }
+        }
+    }
+
+    public void cleanForm050(String Node) throws Exception {
+        String[] parts = Node.split("[.]");
+        Object SNCodeObject = miloService.readFromOpcUa(parts[0] + "." + parts[1] + ".Code").getValue();
+        if (ObjectUtils.isNotEmpty(SNCodeObject)){
+            String snCode = SNCodeObject.toString();
+            String s = productNewFlag(snCode);
+            if ("280".equals(s) || "380".equals(s)){
+                ProductNewPassStation passStation = new ProductNewPassStation();
+                passStation.setSfcCode(snCode);
+                List<ProductNewPassStation> productPassStationList = productNewPassStationService.getProductPassStationList(passStation);
+                if (CollUtil.isNotEmpty(productPassStationList)){
+                    productNewPassStationService.updatePassStationBySfcCode(snCode);
+                }
+                passingStationCollectionServiceImpl.sendMessage("clean*clean","OP050");
+            }
+        }
+    }
+
+    public void cleanForm060(String Node) throws Exception {
+        String[] parts = Node.split("[.]");
+        Object SNCodeObject = miloService.readFromOpcUa(parts[0] + "." + parts[1] + ".Code").getValue();
+        if (ObjectUtils.isNotEmpty(SNCodeObject)){
+            String snCode = SNCodeObject.toString();
+            String s = productNewFlag(snCode);
+            if ("280".equals(s) || "380".equals(s)){
+                passingStationCollectionServiceImpl.sendMessage("clean*clean","OP060");
+            }
+        }
+    }
+
+
+    public void checkBoxRod(String Node) throws Exception {
+        String[] parts = Node.split("[.]");
+        Object SNCodeObject = miloService.readFromOpcUa(parts[0] + "." + parts[1] + ".Code").getValue();
+        if (null != SNCodeObject) {
+            String SNCode = SNCodeObject.toString();
+            String s = productNewFlag(SNCode);
+            if ("280".equals(s) || "380".equals(s)){
+                sendTo060(SNCode,parts);
+            }
+        }
+    }
+
+    private void sendTo060(String SNCode, String[] parts) throws Exception {
+        String boxCode = "";
+        String rodCode = "";
+        ProductNewPassStation productNewPassStation = new ProductNewPassStation();
+        productNewPassStation.setSfcCode(SNCode);
+        List<ProductNewPassStation> productPassStationList = productNewPassStationService.getProductPassStationList(productNewPassStation);
+        if (CollUtil.isNotEmpty(productPassStationList)){
+            ProductNewPassStation passStation = productPassStationList.get(0);
+            boxCode = passStation.getBoxCode();
+            rodCode = passStation.getRodCode();
+        }
+        //閰嶇摝鏍¢獙
+        passingStationCollectionServiceImpl.sendMessage(boxCode + "*" + rodCode + "*" + SNCode, parts[1]);
+    }
 }

--
Gitblit v1.9.3