From ca8c658cd7a7759a14d9962e6af071bedf9d0b36 Mon Sep 17 00:00:00 2001 From: lishuai <1793460677@qq.com> Date: Fri, 23 Aug 2024 12:06:19 +0800 Subject: [PATCH] =?UTF-8?q?fix:opcutl=E4=BF=AE=E6=94=B9=E3=80=81=E5=BC=80?= =?UTF-8?q?=E7=9B=96=E4=BD=8D=E6=9F=A5=E8=AF=A2=E6=95=B0=E6=8D=AE=E5=BA=93?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../UnBoxLableConveyorDeviceDriver.java | 2 +- .../service/impl/InstructionServiceImpl.java | 14 +++++++------- .../org/nl/acs/opc/DeviceOpcProtocolRunable.java | 6 ++++-- .../java/org/nl/acs/opc/OpcServerServiceImpl.java | 12 ++++++++---- .../src/main/java/org/nl/acs/opc/OpcServerUtl.java | 4 ++-- 5 files changed, 22 insertions(+), 16 deletions(-) diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/un_box_lable_conveyor/UnBoxLableConveyorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/un_box_lable_conveyor/UnBoxLableConveyorDeviceDriver.java index 4bd755c5c..340c7b407 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/un_box_lable_conveyor/UnBoxLableConveyorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/un_box_lable_conveyor/UnBoxLableConveyorDeviceDriver.java @@ -202,9 +202,9 @@ public class UnBoxLableConveyorDeviceDriver extends AbstractOpcDeviceDriver impl vehicle_code2 = inst.getVehicle_code2(); } - Instruction instruction = instructionService.findByCode(String.valueOf(task)); //空箱出库开盖位,申请开盖 if (mode == 15 && move == 1 && task > 0 ) { + Instruction instruction = instructionService.findByCode(String.valueOf(task)); //不允许开盖,完成出库任务,自动去扫码位 if (StrUtil.isEmpty(instruction.getVehicle_code())){ message = "任务托盘码为空"; diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java index 95480edd7..d0506d8c8 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java @@ -323,14 +323,14 @@ public class InstructionServiceImpl extends CommonServiceImpl(instructionMapper) - .eq(InstructionMybatis::getInstruction_code, code) - .one(); - if (ObjectUtil.isEmpty(ins)) { - return null; + Iterator var3 = instructions.iterator(); + while (var3.hasNext()) { + Instruction instruction = (Instruction) var3.next(); + if (StrUtil.equals(instruction.getInstruction_code(), code)) { + return instruction; + } } - return ConvertUtil.convert(ins, Instruction.class); + return null; } @Override diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/DeviceOpcProtocolRunable.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/DeviceOpcProtocolRunable.java index 39d7eb413..ace2d5198 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/DeviceOpcProtocolRunable.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/DeviceOpcProtocolRunable.java @@ -105,7 +105,8 @@ public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerC server.disconnect(); log.trace("清理server..."); } - this.server = OpcServerUtl.getServerWithOutException(this.OpcServer.getOpc_host(), this.OpcServer.getCls_id(), this.OpcServer.getUser(), this.OpcServer.getPassword(), this.OpcServer.getDomain()); +// this.server = OpcServerUtl.getServerWithOutException(this.OpcServer.getOpc_host(), this.OpcServer.getCls_id(), this.OpcServer.getUser(), this.OpcServer.getPassword(), this.OpcServer.getDomain()); + this.server = OpcUtl.getServer(this.OpcServer.getOpc_host(), this.OpcServer.getCls_id(), this.OpcServer.getUser(), this.OpcServer.getPassword(), this.OpcServer.getDomain()); this.server.addStateListener(this); group = this.server.addGroup(); List itemsString = new ArrayList(); @@ -322,7 +323,8 @@ public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerC try { if (this.server == null) { - this.server = OpcServerUtl.getServerWithOutException(this.OpcServer.getOpc_host(), this.OpcServer.getCls_id(), this.OpcServer.getUser(), this.OpcServer.getPassword(), this.OpcServer.getDomain()); +// this.server = OpcServerUtl.getServerWithOutException(this.OpcServer.getOpc_host(), this.OpcServer.getCls_id(), this.OpcServer.getUser(), this.OpcServer.getPassword(), this.OpcServer.getDomain()); + this.server = OpcUtl.getServer(this.OpcServer.getOpc_host(), this.OpcServer.getCls_id(), this.OpcServer.getUser(), this.OpcServer.getPassword(), this.OpcServer.getDomain()); this.server.addStateListener(this); accessor = new Async20Access(this.server, OpcConfig.synchronized_millisecond, true); Iterator var9 = this.protocols.iterator(); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/OpcServerServiceImpl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/OpcServerServiceImpl.java index dadd54d3f..7a3e028e9 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/OpcServerServiceImpl.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/OpcServerServiceImpl.java @@ -124,7 +124,8 @@ public class OpcServerServiceImpl implements OpcServerService, ApplicationAutoIn // } if (server == null) { - server = OpcServerUtl.getServerWithOutException(dto.getOpc_host(), StrUtil.trim(dto.getCls_id()), dto.getUser(), dto.getPassword(), StrUtil.trim(dto.getDomain())); +// server = OpcServerUtl.getServerWithOutException(dto.getOpc_host(), StrUtil.trim(dto.getCls_id()), dto.getUser(), dto.getPassword(), StrUtil.trim(dto.getDomain())); + server = OpcUtl.getServer(dto.getOpc_host(), StrUtil.trim(dto.getCls_id()), dto.getUser(), dto.getPassword(), StrUtil.trim(dto.getDomain())); } try { @@ -133,7 +134,8 @@ public class OpcServerServiceImpl implements OpcServerService, ApplicationAutoIn this.clearServer(code); ThreadUtl.sleep(5000L); log.warn("获取opc出错重新获取", code, var12); - server = OpcServerUtl.getServerWithOutException(dto.getOpc_host(), StrUtil.trim(dto.getCls_id()), dto.getUser(), dto.getPassword(), StrUtil.trim(dto.getDomain())); +// server = OpcServerUtl.getServerWithOutException(dto.getOpc_host(), StrUtil.trim(dto.getCls_id()), dto.getUser(), dto.getPassword(), StrUtil.trim(dto.getDomain())); + server = OpcUtl.getServer(dto.getOpc_host(), StrUtil.trim(dto.getCls_id()), dto.getUser(), dto.getPassword(), StrUtil.trim(dto.getDomain())); try { group = server.addGroup(groupName); } catch (Exception var11) { @@ -164,7 +166,8 @@ public class OpcServerServiceImpl implements OpcServerService, ApplicationAutoIn } // if (server == null) { - server = OpcServerUtl.getServerWithOutException(dto.getOpc_host(), StrUtil.trim(dto.getCls_id()), dto.getUser(), dto.getPassword(), StrUtil.trim(dto.getDomain())); +// server = OpcServerUtl.getServerWithOutException(dto.getOpc_host(), StrUtil.trim(dto.getCls_id()), dto.getUser(), dto.getPassword(), StrUtil.trim(dto.getDomain())); + server = OpcUtl.getServer(dto.getOpc_host(), StrUtil.trim(dto.getCls_id()), dto.getUser(), dto.getPassword(), StrUtil.trim(dto.getDomain())); // } String groupName = code; Group group = null; @@ -175,7 +178,8 @@ public class OpcServerServiceImpl implements OpcServerService, ApplicationAutoIn this.clearServer(code); ThreadUtl.sleep(2000L); log.warn("获取opc出错重新获取", code, var12); - server = OpcServerUtl.getServerWithOutException(dto.getOpc_host(), StrUtil.trim(dto.getCls_id()), dto.getUser(), dto.getPassword(), StrUtil.trim(dto.getDomain())); +// server = OpcServerUtl.getServerWithOutException(dto.getOpc_host(), StrUtil.trim(dto.getCls_id()), dto.getUser(), dto.getPassword(), StrUtil.trim(dto.getDomain())); + server = OpcUtl.getServer(dto.getOpc_host(), StrUtil.trim(dto.getCls_id()), dto.getUser(), dto.getPassword(), StrUtil.trim(dto.getDomain())); try { group = server.addGroup(groupName); } catch (Exception var11) { diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/OpcServerUtl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/OpcServerUtl.java index 49dcca47d..0a42cdb90 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/OpcServerUtl.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/OpcServerUtl.java @@ -6,7 +6,7 @@ import org.openscada.opc.lib.da.Server; /** * @author 20220102CG\noblelift */ -public class OpcServerUtl { +/*public class OpcServerUtl { public static synchronized Server getServerWithOutException(String host, String clsid, String user, String password, String domain) { @@ -21,4 +21,4 @@ public class OpcServerUtl { } } -} +}*/