From 0e3cac8d5d9603cdd5ff8935e4054f0018a35ed9 Mon Sep 17 00:00:00 2001
From: wujian <14790700720@163.com>
Date: 星期日, 28 四月 2024 15:08:56 +0800
Subject: [PATCH] change model10

---
 jcdm-main/src/main/java/com/jcdm/main/plcserver/sub/OPCUaSubscription.java |  426 +++++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 376 insertions(+), 50 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 c6a201f..d8ea123 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
@@ -1,22 +1,39 @@
 package com.jcdm.main.plcserver.sub;
 
 
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.StrUtil;
+import com.jcdm.main.bs.domain.BsTechnologyRouteChildInfo;
+import com.jcdm.main.bs.orderScheduling.domain.BsOrderScheduling;
+import com.jcdm.main.bs.orderScheduling.service.IBsOrderSchedulingService;
+import com.jcdm.main.bs.technologyRouteChild.service.IBsTechnologyRouteChildInfoService;
 import com.jcdm.main.da.collectionParamConf.domain.DaCollectionParamConf;
 import com.jcdm.main.da.collectionParamConf.service.IDaCollectionParamConfService;
+import com.jcdm.main.da.opcuaconfig.domain.DaOpcuaConfig;
 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.service.impl.DaPassingStationCollectionServiceImpl;
 import com.jcdm.main.plcserver.conf.OPCElement;
+import com.jcdm.main.rm.repairRecord.domain.RmRepairRecord;
+import com.jcdm.main.rm.repairRecord.service.IRmRepairRecordService;
 import com.kangaroohy.milo.model.ReadWriteEntity;
 import com.kangaroohy.milo.runner.subscription.SubscriptionCallback;
 import com.kangaroohy.milo.service.MiloService;
+import javafx.animation.Timeline;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Component;
 
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
+import java.math.BigDecimal;
+import java.sql.Time;
+import java.time.LocalDateTime;
+import java.util.*;
+import java.util.concurrent.TimeUnit;
 import java.util.stream.Collectors;
 
 
+@Slf4j
 @Component
 public class OPCUaSubscription implements SubscriptionCallback {
 
@@ -26,86 +43,395 @@
 
     public IDaParamCollectionService daParamCollectionService;
 
+    public DaPassingStationCollectionServiceImpl passingStationCollectionServiceImpl;
+
+    public List<DaOpcuaConfig> lists;
+
+    public static final HashMap<String,Integer> map = new HashMap<>();
+
+    public IBsOrderSchedulingService bsOrderSchedulingService;
+
+    public IRmRepairRecordService rmRepairRecordService;
+
+    public IBsTechnologyRouteChildInfoService bsTechnologyRouteChildInfoService;
+
+    public HashMap<String,List<DaCollectionParamConf>> allCollectParamList = new HashMap<>();
+
     public OPCUaSubscription(MiloService miloService,
                              IDaCollectionParamConfService collectionParamConfService,
-                             IDaParamCollectionService daParamCollectionService) {
+                             IDaParamCollectionService daParamCollectionService,
+                             DaPassingStationCollectionServiceImpl passingStationCollectionServiceImpl,
+                             IBsOrderSchedulingService bsOrderSchedulingService,
+                             List<DaOpcuaConfig> lists,
+                             IRmRepairRecordService rmRepairRecordService,
+                             IBsTechnologyRouteChildInfoService bsTechnologyRouteChildInfoService) {
         OPCUaSubscription.miloService = miloService;
         this.collectionParamConfService = collectionParamConfService;
         this.daParamCollectionService = daParamCollectionService;
+        this.passingStationCollectionServiceImpl = passingStationCollectionServiceImpl;
+        this.bsOrderSchedulingService = bsOrderSchedulingService;
+        this.lists = lists;
+        this.rmRepairRecordService = rmRepairRecordService;
+        this.bsTechnologyRouteChildInfoService = bsTechnologyRouteChildInfoService;
+
 
     }
-
-
     @Override
     public void onSubscribe(String identifier, Object value) {
         String ecpStr = "";//寮傚父璁板綍鏍囪
         try {
-            if(null != value) {
+            if(null != value && "1".equals(value.toString())) {
+//                if (OPCElement.OP121_ZZ_CODE_CHECK.equals(identifier)){
+//                    rework("2V91Y RD25D080",identifier);
+//                }
+                //1銆佹绱N鍙�
+                //2銆佽繃绔欏弬鏁伴噰闆�
+                //3銆佹壂鐮佹灙鏁版嵁鍥炰紶
+                List<String> collect1 = lists.stream().filter(x -> OPCElement.SN_CHECK.equals(x.getrFunction()))
+                        .map(DaOpcuaConfig::getNode).collect(Collectors.toList());
+                List<String> collect2 = lists.stream().filter(x -> OPCElement.SAVE_DATA.equals(x.getrFunction()))
+                        .map(DaOpcuaConfig::getNode).collect(Collectors.toList());
+                if (collect1.contains(identifier)){
+                    log.info("-------鐩戝惉鍒�,{}鐨凜ODE_CHECK鐨勪俊鍙�",identifier);
+                    log.info("-------time--------------,{}",LocalDateTime.now());
+                    //sn
+                    this.SNRetrieval(identifier,value.toString());
+                    if (identifier.equals(OPCElement.OP120_ZZ_CODE_CHECK) && "1".equals(value.toString())){
+                        //鎬昏涓婄嚎鎵爜浼犺緭鏁版嵁
+                        log.info("-------鐩戝惉鍒�,{}鐨勬壂鐮佹灙鎵爜鐨凜ODE_CHECK鐨勪俊鍙�",identifier);
+                        scannerGunMessage();
+                    }
+                }
+                if (collect2.contains(identifier)){
+                    if ("1".equals(value.toString())){
+                        log.info("-------鐩戝惉鍒�,{}鐨凷AVE_REQUEST_LAST鐨勪俊鍙�",identifier);
+                        log.info("-------time--------------,{}",LocalDateTime.now());
+                        //save
+                        this.SaveData(identifier);
 
-                //OP010淇濆瓨璇锋眰
-                if (identifier.equals(OPCElement.OP010_SaveRequest) && null != value && "1".equals(value.toString())) {
-                    SaveData(OPCElement.OP010_SaveRequest);
-                    ReadWriteEntity entity = new ReadWriteEntity(OPCElement.OP010_MesSaveFeed, 1);
-                    miloService.writeToOpcByte(entity);
+                    }
                 }
-                //OP010璇锋眰妫�绱㈡潯鐮�
-                else if (identifier.equals(OPCElement.OP010_CodeCheck) && null != value && "1".equals(value.toString())) {
-                    ReadWriteEntity entity = new ReadWriteEntity(OPCElement.OP010_MesCodeCheckFeed, 1);
-                    miloService.writeToOpcByte(entity);
-                }
+
             }
-
-
-
         } catch (Exception e) {
-
+            System.out.println(e.getMessage());
         } finally {
             if (!"".equals(ecpStr)) {
                 System.out.println(ecpStr + "\r\n");
+            }
+        }
+    }
+
+    private void scannerGunMessage() throws Exception {
+        String[] parts = OPCElement.OP120_ZZ_CODE_CHECK.split("[.]");
+        Object SNCodeObject = miloService.readFromOpcUa(parts[0] + "." + parts[1] + ".Code1").getValue();
+        if (null == SNCodeObject){
+            SNCodeObject = miloService.readFromOpcUa(parts[0] + "." + parts[1] + ".Code").getValue();
+        }
+        if (null != SNCodeObject){
+            String SNCode = SNCodeObject.toString();
+            passingStationCollectionServiceImpl.sendMessage(SNCode);
+        }
+    }
+
+    public void SNRetrieval(String Node, String value) throws Exception {
+        String[] parts = Node.split("[.]");
+        if(value.equals("1")) {
+            //SN鍙锋绱�
+            Object SNCodeObject = miloService.readFromOpcUa(parts[0] + "." + parts[1] + ".Code").getValue();
+            if(null != SNCodeObject) {
+                String SNCode=SNCodeObject.toString();
+//                String a=passingStationCollectionServiceImpl.SelectSN(SNCode,parts[1]);
+                String a;
+                BsOrderScheduling bsOrderSchedulingQuery = new BsOrderScheduling();
+                bsOrderSchedulingQuery.setEngineNo(SNCode);
+                List<BsOrderScheduling> queryOrderList = bsOrderSchedulingService.selectBsOrderSchedulingList(bsOrderSchedulingQuery);
+                if (CollUtil.isNotEmpty(queryOrderList)){
+                    a = "1";
+                }else {
+                    a = "4";
+                }
+                //濡傛灉鏄繑淇伐浣嶉渶瑕佷紶杈撹繑淇伐浣嶅彿
+                List<DaPassingStationCollection> daPassingStationCollections = new ArrayList<>();
+                List<RmRepairRecord> rmRepairRecords = new ArrayList<>();
+                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)){
+                    //杩囩珯璁板綍
+                    DaPassingStationCollection PassingStationCollection=new DaPassingStationCollection();
+                    PassingStationCollection.setSfcCode(SNCode);
+                    daPassingStationCollections = passingStationCollectionServiceImpl.selectDaPassingStationCollectionList(PassingStationCollection);
+                    if (CollUtil.isNotEmpty(daPassingStationCollections)){
+                        DaPassingStationCollection lastOne = daPassingStationCollections.get(daPassingStationCollections.size() - 1);
+                        String outRsSign = lastOne.getOutRsSign();
+                        if ("鍚堟牸".equals(outRsSign)){
+                            a = "1";
+                        }else {
+                            a = "2";
+                        }
+                    }
+                    RmRepairRecord rmRepairRecord = new RmRepairRecord();
+                    rmRepairRecord.setBoxCode(SNCode);
+                    rmRepairRecords = rmRepairRecordService.selectRmRepairRecordList(rmRepairRecord);
+                    if (CollUtil.isNotEmpty(rmRepairRecords)){
+                        a = "1";
+                    }
+
+                }
+                log.info("-----杩斿洖codeCheckFeed-----,{}",a);
+//                String a="1";
+                // 1:OK鍙敓浜� 2:NG涓嶅彲鐢熶骇 3:NG鍙繑宸� 4:PC妫�绱㈠け璐ワ紙鏃犺褰曪級5:PC妫�绱㈠け璐ワ紙杞欢锛�
+                if (StrUtil.isNotBlank(a)){
+                    int input = Integer.parseInt(a);
+                    ReadWriteEntity entity = new ReadWriteEntity(parts[0]+"."+parts[1]+".CodeCheckFeed", input);
+                    log.info("-------鐩戝惉鍒�,{}鐨凜odeCheck鐨勪俊鍙�",Node);
+                    miloService.writeToOpcByte(entity);
+                    log.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.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);
+                    }
+                    System.out.println(entity);
+
+                }
 
             }
         }
     }
 
-    public void SaveData(String Node) throws Exception {
-        /*String[] parts = Node.split("[.]");
-        Object SNCodeObject = miloService.readFromOpcUa(parts[0] + "." + parts[1] + ".Code1").getValue();
+    private void rework(String SNCode,String Node,List<DaPassingStationCollection> daPassingStationCollections,List<RmRepairRecord> rmRepairRecords)  throws Exception{
+        BsOrderScheduling bsOrderScheduling = new BsOrderScheduling();
+        bsOrderScheduling.setEngineNo(SNCode);
+        List<String> allProcessCoed = new ArrayList<>();
+        List<BsTechnologyRouteChildInfo> bsTechnologyRouteChildInfos = new ArrayList<>();
+        List<String> collect = bsOrderSchedulingService.selectBsOrderSchedulingList(bsOrderScheduling).stream().map(BsOrderScheduling::getModel).collect(Collectors.toList());
+        if (CollUtil.isNotEmpty(collect)){
+            String s = collect.get(0);
+            //鏌ユ壘娆℃満鍨嬬殑瀹屾暣宸ュ簭
+            bsTechnologyRouteChildInfos = bsTechnologyRouteChildInfoService.selectAllTechnologyRouteByProductCode(s);
+            if (CollUtil.isNotEmpty(bsTechnologyRouteChildInfos)){
+                allProcessCoed = bsTechnologyRouteChildInfos.stream().map(BsTechnologyRouteChildInfo::getProcessesCode).collect(Collectors.toList());
+            }
+        }
+//        RmRepairRecord rmRepairRecord = new RmRepairRecord();
+//        rmRepairRecord.setBoxCode(SNCode);
+        List<ReadWriteEntity> writeList = new ArrayList<>();
+//        List<RmRepairRecord> rmRepairRecords = rmRepairRecordService.selectRmRepairRecordList(rmRepairRecord);
+        //杩囩珯璁板綍
+//        DaPassingStationCollection PassingStationCollection=new DaPassingStationCollection();
+//        PassingStationCollection.setSfcCode(SNCode);
+        //杩囩珯璁板綍
+//        List<DaPassingStationCollection> daPassingStationCollections = passingStationCollectionServiceImpl.selectDaPassingStationCollectionList(PassingStationCollection);
 
+        //鎵�鏈夊弽宸ュ伐浣�
+        List<String> collect1 = rmRepairRecords.stream().map(RmRepairRecord::getProcessesCode).collect(Collectors.toList());
+        if (CollUtil.isNotEmpty(collect1)){
+            //鏌ヨ鍑烘墍鏈夐渶瑕佽繑淇伐浣嶇殑鏈�灏弌p鍧�
+            Integer minOP = 0;
+            if (CollUtil.isNotEmpty(collect1)){
+
+                List<Integer> sortList = new ArrayList<>();
+                collect1.stream().forEach(x ->{
+                    String op = x.replace("OP", "");
+                    if (StrUtil.isNotBlank(op)){
+                        int i = Integer.parseInt(op);
+                        sortList.add(i);
+                    }
+                });
+                if (CollUtil.isNotEmpty(sortList)){
+                    List<Integer> collect2 = sortList.stream().filter(Objects::nonNull).sorted().collect(Collectors.toList());
+                    minOP = collect2.get(0);
+                }
+            }
+            //鑾峰彇杩囩珯璁板綍鐨勬渶澶у伐浣�
+            String maxCode = null;
+            if (CollUtil.isNotEmpty(daPassingStationCollections)){
+                DaPassingStationCollection lastOne = daPassingStationCollections.get(daPassingStationCollections.size() - 1);
+                maxCode = lastOne.getLocationCode();
+            }
+
+
+            //鎵�鏈夋斁琛屽伐浣�
+            List<String> passStation = new ArrayList<>();
+            //鎵�鏈夌敓浜у伐浣�
+            List<String> productStation = new ArrayList<>();
+            //鏈�澶у伐浣嶇紪鍙�
+            Integer maxCodeNum = 0;
+            if (StrUtil.isNotEmpty(maxCode)){
+                String finalMaxCode = maxCode;
+                //鑾峰彇褰撳墠宸ヤ綅瀵瑰簲宸ユ鍙�
+                List<String> collect2 = bsTechnologyRouteChildInfos.stream()
+                        .filter(x -> x.getProcessesCode().equals(finalMaxCode))
+                        .map(BsTechnologyRouteChildInfo::getStepNo).collect(Collectors.toList());
+                if (CollUtil.isNotEmpty(collect2)){
+                    String s = collect2.get(0);
+                    if (StrUtil.isNotBlank(s)){
+                        maxCodeNum = Integer.parseInt(s);
+                    }
+                }
+                if (CollUtil.isNotEmpty(bsTechnologyRouteChildInfos)){
+                    bsTechnologyRouteChildInfos.forEach(x -> {
+                        x.setStepNoNum(Integer.parseInt(x.getStepNo()));
+                    });
+                    Integer finalMaxCodeNum = maxCodeNum;
+                    //鍕鹃�夌殑杩斾慨宸ヤ綅涓渶澶х殑宸ヤ綅涔嬪悗鐨勫伐浣�----1
+                    List<BsTechnologyRouteChildInfo> collect3 = bsTechnologyRouteChildInfos.stream()
+                            .filter(x -> x.getStepNoNum() >= finalMaxCodeNum).collect(Collectors.toList());
+                    if (CollUtil.isNotEmpty(collect3)){
+                        //闇�瑕佺敓浜�
+                        productStation.addAll(collect3.stream().map(BsTechnologyRouteChildInfo::getProcessesCode).collect(Collectors.toList()));
+                    }
+                    //浠庣涓�涓伐浣嶅埌杩斾慨鐨勬渶澶у伐浣嶄箣闂达紝
+                    //鍕鹃�変簡杩斾慨鏍囪鐨勯渶瑕佺敓浜�---1锛屾湭鍕鹃�夌殑涓嶇敓浜�---2
+                    productStation.addAll(collect1);
+                }
+            }
+            if (CollUtil.isNotEmpty(productStation)){
+                List<String> collect2 = allProcessCoed.stream().filter(x -> !productStation.contains(x)).collect(Collectors.toList());
+                passStation.addAll(collect2);
+            }
+            String[] parts = Node.split("[.]");
+            String par = parts[0]+"."+parts[1];
+            if (CollUtil.isNotEmpty(passStation)){
+                passStation.forEach(x -> {
+                    ReadWriteEntity readWriteEntity = new ReadWriteEntity();
+                    readWriteEntity.setIdentifier(par+"."+x);
+                    readWriteEntity.setValue(2);
+                    writeList.add(readWriteEntity);
+                });
+            }
+            if (CollUtil.isNotEmpty(productStation)){
+                productStation.forEach(x -> {
+                    ReadWriteEntity readWriteEntity = new ReadWriteEntity();
+                    readWriteEntity.setIdentifier(par+"."+x);
+                    readWriteEntity.setValue(1);
+                    writeList.add(readWriteEntity);
+                });
+            }
+            ReadWriteEntity readWriteEntity = new ReadWriteEntity();
+            readWriteEntity.setIdentifier(parts[0]+"."+parts[1]+".Repair_sign");
+            readWriteEntity.setValue(minOP);
+            miloService.writeToOpcShort(readWriteEntity);
+            miloService.writeToOpcByte(writeList);
+            log.info("杩斾慨鍐欏叆锛�,{}",writeList);
+        }
+
+    }
+
+
+    public void SaveData(String Node) throws Exception {
+
+        String[] parts = Node.split("[.]");
+        Object SNCodeObject = miloService.readFromOpcUa(parts[0] + "." + parts[1] + ".Code1").getValue();
+        if (null == SNCodeObject){
+            SNCodeObject = miloService.readFromOpcUa(parts[0] + "." + parts[1] + ".Code").getValue();
+        }
         if(null != SNCodeObject)
         {
             String SNCode = SNCodeObject.toString();
-            List<DaCollectionParamConf> list;
-            DaCollectionParamConf daCollectionParamConf = new DaCollectionParamConf();
-            daCollectionParamConf.setGatherAddress(parts[0] + "." + parts[1]);
-            list = collectionParamConfService.selectDaCollectionParamConfList(daCollectionParamConf);
+            Object object = miloService.readFromOpcUa(parts[0] + "." + parts[1] + ".Runtime").getValue();
+            String gatherAddress = parts[0] + "." + parts[1];
+            List<DaCollectionParamConf> list = new ArrayList<>();
+            if (allCollectParamList.containsKey(gatherAddress)){
+                list = allCollectParamList.get(gatherAddress);
+            }else {
+                DaCollectionParamConf daCollectionParamConf = new DaCollectionParamConf();
+                daCollectionParamConf.setGatherAddress(gatherAddress);
+                daCollectionParamConf.setRemarks("1");
+                list = collectionParamConfService.selectDaCollectionParamConfList(daCollectionParamConf);
+                if (CollUtil.isNotEmpty(list)){
+                    //鍔犲叆hashmap
+                    allCollectParamList.put(gatherAddress,list);
+                }
+            }
 
             List<String> nodeIdList = list.stream().map(info -> {
                 String nodeid = info.getGatherAddress();
                 return nodeid;
             }).collect(Collectors.toList());
 
-            if(!nodeIdList.isEmpty()){
-                List<ReadWriteEntity> readWriteEntityList = miloService.readFromOpcUa(nodeIdList);
-                List<DaParamCollection> daParamCollectionlist = new ArrayList<>();
-                for(int i=0;i<nodeIdList.size();i++){
-                    DaParamCollection ParamCollection = new DaParamCollection();
-                    if(!readWriteEntityList.get(i).getValue().toString().equals("0.0")){
-                        ParamCollection.setParamCode(readWriteEntityList.get(i).getIdentifier().toString().split("[.]")[2]);
-                        ParamCollection.setLocationCode(parts[1]);
-                        ParamCollection.setParamValue(readWriteEntityList.get(i).getValue().toString());
-                        ParamCollection.setSfcCode(SNCode);
-                        ParamCollection.setParamName(list.get(i).getCollectParameterName());
-                        ParamCollection.setParamUpper(list.get(i).getParamUpper());
-                        ParamCollection.setParamLower(list.get(i).getParamLower());
-                        ParamCollection.setUnit(list.get(i).getCollectParameterUnit());
-                        ParamCollection.setState("鍚堟牸");
-                        ParamCollection.setType(list.get(i).getCollectParameterType());
-                        ParamCollection.setCollectionTime(new Date());
-                        daParamCollectionlist.add(ParamCollection);
-                    }
-                }
-                daParamCollectionService.saveBeachDaParamCollection(daParamCollectionlist);
+            List<ReadWriteEntity> readWriteEntityList = new ArrayList<>();
+            if(CollUtil.isNotEmpty(nodeIdList)){
+                long time1 = new Date().getTime();
+                readWriteEntityList = miloService.readFromOpcUa(nodeIdList);
+                long time2 = new Date().getTime();
+                log.info("璇诲彇鐐逛綅鑺辫垂鏃堕棿锛歿},",time2-time1);
             }
-        }*/
+                //杩斿洖plc淇濆瓨鎴愬姛
+                if (parts.length==3){
+                    if ("SaveRequest".equals(parts[2])){
+                        ReadWriteEntity entity = new ReadWriteEntity(parts[0] + "." + parts[1] + ".SaveFeed", 1);
+                                miloService.writeToOpcByte(entity);
+                    }else if ("SaveRequestLast".equals(parts[2])){
+                        ReadWriteEntity entity = new ReadWriteEntity(parts[0] + "." + parts[1] + ".SaveFeedLast", 1);
+                                miloService.writeToOpcByte(entity);
+                    }
+                    log.info("-------璇锋眰杩斿洖,{}鐨凷aveFeedLast鐨勪俊鍙�",Node);
+                    log.info("-------璇锋眰杩斿洖-----,{}",LocalDateTime.now());
+                }
+                List<DaParamCollection> daParamCollectionlist = new ArrayList<>();
+                if (CollUtil.isNotEmpty(nodeIdList)){
+                    for(int i=0;i<nodeIdList.size();i++){
+                        if(!readWriteEntityList.get(i).getValue().toString().equals("0.0")){
+                            DaParamCollection ParamCollection = new DaParamCollection();
+                            ParamCollection.setParamCode(readWriteEntityList.get(i).getIdentifier().toString().split("[.]")[2]);
+                            ParamCollection.setLocationCode(parts[1]);
+                            if (readWriteEntityList.get(i) == null){
+                                ParamCollection.setParamValue("0");
+                            }else {
+                                ParamCollection.setParamValue(readWriteEntityList.get(i).getValue().toString());
+                            }
+                            ParamCollection.setSfcCode(SNCode);
+                            ParamCollection.setParamName(list.get(i).getCollectParameterName());
+                            ParamCollection.setParamUpper(list.get(i).getParamUpper());
+                            ParamCollection.setParamLower(list.get(i).getParamLower());
+                            ParamCollection.setUnit(list.get(i).getCollectParameterUnit());
+                            ParamCollection.setState("鍚堟牸");
+                            ParamCollection.setType(list.get(i).getCollectParameterType());
+                            ParamCollection.setCollectionTime(new Date());
+                            daParamCollectionlist.add(ParamCollection);
+                        }
+                    }
+                    daParamCollectionService.saveBeachDaParamCollection(daParamCollectionlist);
+                    log.info("-------淇濆瓨鏁版嵁瀹屾垚---------");
+                }
+
+
+
+
+            Long beatTime = 0L;
+            if (ObjectUtil.isNotEmpty(object)){
+                String str = object.toString();
+                beatTime = Float.valueOf(str).longValue();
+            }
+            DaPassingStationCollection PassingStationCollection=new DaPassingStationCollection();
+            PassingStationCollection.setSfcCode(SNCode);
+            PassingStationCollection.setLocationCode(parts[1]);
+            PassingStationCollection.setOutboundTime(new Date());
+            PassingStationCollection.setInboundTime(new Date(new Date().getTime()-beatTime*1000));
+            PassingStationCollection.setCollectionTime(new Date());
+            PassingStationCollection.setCreateTime(new Date());
+            PassingStationCollection.setBeatTime(beatTime.toString());
+            PassingStationCollection.setOutRsSign("鍚堟牸");
+            passingStationCollectionServiceImpl.insertDaPassingStationCollection(PassingStationCollection);
+            log.info("-------淇濆瓨杩囩珯璁板綍鏁版嵁瀹屾垚---------");
+
+        }
     }
 }

--
Gitblit v1.9.3