春风项目四线(合箱线、总装线)
wujian
2024-04-27 0d85b1ed7d9254779f7b5e2ac80b60cf1c9e121a
jcdm-main/src/main/java/com/jcdm/main/plcserver/sub/OPCUaSubscription.java
@@ -226,10 +226,12 @@
        if (CollUtil.isNotEmpty(collect1)){
            collect3 = collect3.stream().filter(x -> !collect1.contains(x)).collect(Collectors.toList());
        }
        String[] parts = Node.split("[.]");
        String par = parts[0]+"."+parts[1];
        if (CollUtil.isNotEmpty(collect3)){
            collect3.forEach(x -> {
                ReadWriteEntity readWriteEntity = new ReadWriteEntity();
                readWriteEntity.setIdentifier(x);
                readWriteEntity.setIdentifier(par+"."+x);
                readWriteEntity.setValue(2);
                writeList.add(readWriteEntity);
            });
@@ -244,7 +246,7 @@
            //数据库查询出的工位
            collect4.forEach(x -> {
                ReadWriteEntity readWriteEntity = new ReadWriteEntity();
                readWriteEntity.setIdentifier(x);
                readWriteEntity.setIdentifier(par+"."+x);
                readWriteEntity.setValue(1);
                writeList.add(readWriteEntity);
            });
@@ -268,7 +270,7 @@
//                writeList.add(readWriteEntity);
//            });
//        }
        String[] parts = Node.split("[.]");
        String a=passingStationCollectionServiceImpl.SelectSN(SNCode,parts[1]);
        if (StrUtil.isNotBlank(a)){
            int input = Integer.parseInt(a);
@@ -279,11 +281,29 @@
        readWriteEntity.setIdentifier("Repair_sign");
        readWriteEntity.setValue(minOP);
        writeList.add(readWriteEntity);
        miloService.writeToOpcByte(writeList);
        if (CollUtil.isNotEmpty(writeList)){
            List<ReadWriteEntity> tempList = new ArrayList<>();
            for (int i = 0; i < writeList.size(); i++) {
                tempList.add(writeList.get(i));
                if (tempList.size()>10){
                    miloService.writeToOpcByte(tempList);
                    log.info("写入返修:,{}",tempList);
                    tempList = new ArrayList<>();
                }
            }
            if (CollUtil.isNotEmpty(tempList)){
                miloService.writeToOpcByte(tempList);
                log.info("写入返修:,{}",tempList);
            }
        }
//        miloService.writeToOpcByte(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){