cl
2024-07-03 5b755f09d9ffba5f6c67a5894f3887340cccb31c
修改参数采集
已修改2个文件
85 ■■■■■ 文件已修改
jcdm-main/src/main/java/com/jcdm/main/plcserver/CustomRunner.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-main/src/main/java/com/jcdm/main/plcserver/sub/OPCUaSubscription.java 78 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-main/src/main/java/com/jcdm/main/plcserver/CustomRunner.java
@@ -8,6 +8,7 @@
import com.jcdm.main.da.opcuaconfig.service.IDaOpcuaConfigService;
import com.jcdm.main.da.paramCollection.service.IDaParamCollectionService;
import com.jcdm.main.da.passingStationCollection.service.IDaPassingStationCollectionService;
import com.jcdm.main.da.testDeviceInterfaceTemp.service.IDaTestDeviceInterfaceTempService;
import com.jcdm.main.om.productionOrde.service.IOmProductionOrdeInfoService;
import com.jcdm.main.plcserver.sub.OPCUaSubscription;
import com.kangaroohy.milo.service.MiloService;
@@ -42,7 +43,8 @@
    @Autowired
    private IDaOpcuaConfigService daOpcuaConfigService;
    @Autowired
    private IDaTestDeviceInterfaceTempService daTestDeviceInterfaceTempService;
    @Override
    public void run(ApplicationArguments args) throws Exception {
@@ -59,7 +61,8 @@
                daPassingStationCollectionService,
                collectionParamConfService,
                daParamCollectionService,
                omProductionOrdeInfoService);
                omProductionOrdeInfoService,
                daTestDeviceInterfaceTempService);
        List<String> lists = getSubList();
        System.out.println("订阅内容:"+lists);
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;
    }