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/plcserver/sub/OPCUaSubscription.java | 51 ++++++++++++++++++++++++++++++++++++++------------- 1 files changed, 38 insertions(+), 13 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 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