From a096990b0c01d9fe92b402651d753f9a79d727de Mon Sep 17 00:00:00 2001 From: loujf Date: Tue, 13 Dec 2022 11:17:56 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../acs/agv/server/impl/AgvServiceImpl.java | 27 +++++++++++++++++-- .../ItemProtocol.java | 11 +++++--- .../StandardInspectSiteSmartDeviceDriver.java | 16 +++++++++++ 3 files changed, 49 insertions(+), 5 deletions(-) diff --git a/hd/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/AgvServiceImpl.java b/hd/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/AgvServiceImpl.java index eafa4ab..82e5f0d 100644 --- a/hd/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/AgvServiceImpl.java +++ b/hd/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/AgvServiceImpl.java @@ -960,9 +960,21 @@ public class AgvServiceImpl implements AgvService { } if (addressdevice.getDeviceDriver() instanceof StandardInspectSiteSmartDeviceDriver) { standardInspectSiteSmartDeviceDriver = (StandardInspectSiteSmartDeviceDriver) addressdevice.getDeviceDriver(); + String apply_task = addressdevice.getExtraValue().get("apply_task").toString(); //取货完成 if ("Load".equals(action)) { - if (standardInspectSiteSmartDeviceDriver.getMode() != 0 && standardInspectSiteSmartDeviceDriver.getMove() == 0) { + //如果开启呼叫按钮,那么就需要判断进出动作信号 + if (ObjectUtil.isNotEmpty(apply_task) && apply_task.equals("true")) { + if (standardInspectSiteSmartDeviceDriver.getMode() != 0 + && standardInspectSiteSmartDeviceDriver.getMove() == 0 + && standardInspectSiteSmartDeviceDriver.getAction() == 3 + && standardInspectSiteSmartDeviceDriver.getIo_action() == 3) { + inst.setExecute_device_code(processingVehicle); + inst.setExecute_status("2"); + standardInspectSiteSmartDeviceDriver.writing(2); + is_feedback = true; + } + } else if (standardInspectSiteSmartDeviceDriver.getMode() != 0 && standardInspectSiteSmartDeviceDriver.getMove() == 0) { inst.setExecute_device_code(processingVehicle); inst.setExecute_status("2"); standardInspectSiteSmartDeviceDriver.writing(2); @@ -970,7 +982,18 @@ public class AgvServiceImpl implements AgvService { } //放货完成 } else if ("Unload".equals(action)) { - if (standardInspectSiteSmartDeviceDriver.getMode() != 0 && standardInspectSiteSmartDeviceDriver.getMove() > 0) { + + if (ObjectUtil.isNotEmpty(apply_task) && apply_task.equals("true")) { + if (standardInspectSiteSmartDeviceDriver.getMode() != 0 + && standardInspectSiteSmartDeviceDriver.getMove() > 0 + && standardInspectSiteSmartDeviceDriver.getAction() == 3 + && standardInspectSiteSmartDeviceDriver.getIo_action() == 3) { + inst.setExecute_device_code(address); + inst.setExecute_status("4"); + standardInspectSiteSmartDeviceDriver.writing(3); + is_feedback = true; + } + } else if (standardInspectSiteSmartDeviceDriver.getMode() != 0 && standardInspectSiteSmartDeviceDriver.getMove() > 0) { inst.setExecute_device_code(address); inst.setExecute_status("4"); standardInspectSiteSmartDeviceDriver.writing(3); diff --git a/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_inspect_site_smart200/ItemProtocol.java b/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_inspect_site_smart200/ItemProtocol.java index 782bb3c..2e49e2e 100644 --- a/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_inspect_site_smart200/ItemProtocol.java +++ b/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_inspect_site_smart200/ItemProtocol.java @@ -15,7 +15,7 @@ public class ItemProtocol { public static String item_mode = "mode"; public static String item_move = "move"; public static String item_action = "action"; - public static String item_ioaction = "ioaction"; + public static String item_ioaction = "io_action"; public static String item_error = "error"; public static String item_task = "task"; public static String item_to_command = "to_command"; @@ -41,7 +41,11 @@ public class ItemProtocol { return this.getOpcIntegerValue(item_move); } - public int getIoaction() { + public int getAction() { + return this.getOpcIntegerValue(item_action); + } + + public int getIo_action() { return this.getOpcIntegerValue(item_ioaction); } @@ -90,7 +94,8 @@ public class ItemProtocol { list.add(new ItemDto(item_heartbeat, "心跳", "VW0")); list.add(new ItemDto(item_mode, "工作状态", "VW2", Boolean.valueOf(true))); list.add(new ItemDto(item_move, "光电开关信号", "VW4")); - list.add(new ItemDto(item_action, "动作信号", "VW8")); + list.add(new ItemDto(item_action, "动作信号", "VW6")); + list.add(new ItemDto(item_ioaction, "进出信号", "VW8")); list.add(new ItemDto(item_error, "报警信号", "VW12")); list.add(new ItemDto(item_task, "任务号", "VD14")); return list; diff --git a/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_inspect_site_smart200/StandardInspectSiteSmartDeviceDriver.java b/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_inspect_site_smart200/StandardInspectSiteSmartDeviceDriver.java index c465ca4..a3ea0e3 100644 --- a/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_inspect_site_smart200/StandardInspectSiteSmartDeviceDriver.java +++ b/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_inspect_site_smart200/StandardInspectSiteSmartDeviceDriver.java @@ -68,6 +68,10 @@ public class StandardInspectSiteSmartDeviceDriver extends AbstractOpcDeviceDrive int error = 0; int move = 0; int task = 0; + int action = 0; + int io_action = 0; + int last_action = 0; + int last_io_action = 0; int last_mode = 0; int last_error = 0; int last_move = 0; @@ -162,6 +166,8 @@ public class StandardInspectSiteSmartDeviceDriver extends AbstractOpcDeviceDrive mode = this.itemProtocol.getMode(); error = this.itemProtocol.getError(); move = this.itemProtocol.getMove(); + action = this.itemProtocol.getAction(); + io_action = this.itemProtocol.getIo_action(); task = this.itemProtocol.getTask(); hasGoods = this.itemProtocol.getMove(); @@ -198,6 +204,14 @@ public class StandardInspectSiteSmartDeviceDriver extends AbstractOpcDeviceDrive this.execute_log.setResource(this.devicecode, this.device.getDevice_name()); this.execute_log.log("设备:" + device_code + ",last_move -> move:" + last_mode + "->" + move); } + if (action != last_action) { + this.execute_log.setResource(this.devicecode, this.device.getDevice_name()); + this.execute_log.log("设备:" + device_code + ",last_action -> action:" + last_action + "->" + action); + } + if (io_action != last_io_action) { + this.execute_log.setResource(this.devicecode, this.device.getDevice_name()); + this.execute_log.log("设备:" + device_code + ",last_io_action -> io_action:" + last_io_action + "->" + io_action); + } if (error != last_error) { this.execute_log.setResource(this.devicecode, this.device.getDevice_name()); this.execute_log.log("设备:" + device_code + ",last_error -> error:" + last_error + "->" + error); @@ -370,6 +384,8 @@ public class StandardInspectSiteSmartDeviceDriver extends AbstractOpcDeviceDrive last_mode = mode; last_error = error; last_move = move; + last_action = action; + last_io_action = io_action; last_task = task; }