From ea9cb45a3adc78dba75cf2368acd6a1b48aafe08 Mon Sep 17 00:00:00 2001 From: LENOVO <1793460677@qq.com> Date: Wed, 20 Mar 2024 13:42:36 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=8E=B0=E5=9C=BA=E8=81=94=E8=B0=83?= =?UTF-8?q?=E8=A1=8C=E5=AE=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BoxStorageManipulatorDeviceDriver.java | 11 ++--- .../box_storage_manipulator/ItemProtocol.java | 36 ++++++++++++++++ .../return_good_manipulator/ItemProtocol.java | 35 ++++++++++++++++ .../ReturnGoodManipulatorDeviceDriver.java | 12 +++--- .../trapped_manipulator/ItemProtocol.java | 42 +++++++++++++++++++ .../volume_two_manipulator/ItemProtocol.java | 21 ++++++++-- ...TwoManipulatorManipulatorDeviceDriver.java | 20 ++++----- 7 files changed, 150 insertions(+), 27 deletions(-) diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_storage_manipulator/BoxStorageManipulatorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_storage_manipulator/BoxStorageManipulatorDeviceDriver.java index 1ee2a9e81..0cc460828 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_storage_manipulator/BoxStorageManipulatorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_storage_manipulator/BoxStorageManipulatorDeviceDriver.java @@ -17,6 +17,7 @@ import org.nl.acs.device.service.impl.DeviceExtraServiceImpl; import org.nl.acs.device_driver.DeviceDriver; import org.nl.acs.device_driver.FeedLmsRealFailed; import org.nl.acs.device_driver.RouteableDeviceDriver; +import org.nl.acs.device_driver.conveyor.belt_conveyor.BeltConveyorDeviceDriver; import org.nl.acs.device_driver.conveyor.siemens_conveyor.SiemensConveyorDeviceDriver; import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; @@ -350,10 +351,10 @@ public class BoxStorageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i notCreateInstMessage = "universal_notCreateInstMessage1"; throw new BadRequestException("设备:" + nextDevice.getDevice_code() + "未设置电气调度号!"); } - SiemensConveyorDeviceDriver siemensConveyorDeviceDriver; - if (nextDevice.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) { - siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) nextDevice.getDeviceDriver(); - if (siemensConveyorDeviceDriver.getMove() != 1) { + BeltConveyorDeviceDriver beltConveyorDeviceDriver; + if (startDevice.getDeviceDriver() instanceof BeltConveyorDeviceDriver) { + beltConveyorDeviceDriver = (BeltConveyorDeviceDriver) startDevice.getDeviceDriver(); + if (beltConveyorDeviceDriver.getMove() != 1) { notCreateInstMessage = "universal_notCreateInstMessage2"; return false; } @@ -430,7 +431,7 @@ public class BoxStorageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i list.add(map5); } if (ObjectUtil.isNotEmpty(interactionJsonDTO.getLength())) { - map6.put("code", "to_length"); + map6.put("code", "to_lenght"); map6.put("value", interactionJsonDTO.getLength()); list.add(map6); } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_storage_manipulator/ItemProtocol.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_storage_manipulator/ItemProtocol.java index 796dee308..fd5d762b9 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_storage_manipulator/ItemProtocol.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_storage_manipulator/ItemProtocol.java @@ -42,6 +42,18 @@ public class ItemProtocol { public static String item_walk_y = "walk_y"; + + /** + * 行走列 + */ + public static String item_x = "x"; + + /** + * 行走层号 + */ + public static String item_y = "y"; + + /** * 下发命令 */ @@ -86,6 +98,16 @@ public class ItemProtocol { private BoxStorageManipulatorDeviceDriver driver; + + + public float getX() { + return this.getOpcFloatValue(item_x); + } + + public float getY() { + return this.getOpcFloatValue(item_y); + } + public ItemProtocol(BoxStorageManipulatorDeviceDriver driver){ this.driver=driver; } @@ -161,6 +183,18 @@ public class ItemProtocol { return 0; } + public float getOpcFloatValue(String protocol) { + Float value = this.driver.getDoubleValue(protocol); + if (value == null) { + // log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!"); + setIsonline(false); + } else { + setIsonline(true); + return value; + } + return 0; + + } public String getOpcStringValue(String protocol) { String value = this.driver.getStringValue(protocol); if (StrUtil.isBlank(value)) { @@ -180,6 +214,8 @@ public class ItemProtocol { list.add(new ItemDto(item_error, "报警信号", "DB1.B5")); list.add(new ItemDto(item_task, "任务号", "DB1.D6")); list.add(new ItemDto(item_walk_y, "行走列", "DB1.B4")); + list.add(new ItemDto(item_x, "行走列号", "DB101.B10")); + list.add(new ItemDto(item_y, "行走层号", "DB101.B11")); return list; } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/return_good_manipulator/ItemProtocol.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/return_good_manipulator/ItemProtocol.java index fd72628f2..9ee088013 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/return_good_manipulator/ItemProtocol.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/return_good_manipulator/ItemProtocol.java @@ -85,6 +85,26 @@ public class ItemProtocol { private ReturnGoodManipulatorDeviceDriver driver; + + /** + * 行走列 + */ + public static String item_x = "x"; + + /** + * 行走层号 + */ + public static String item_y = "y"; + + + public float getX() { + return this.getOpcFloatValue(item_x); + } + + public float getY() { + return this.getOpcFloatValue(item_y); + } + public ItemProtocol(ReturnGoodManipulatorDeviceDriver driver){ this.driver=driver; } @@ -143,6 +163,19 @@ public class ItemProtocol { Boolean isonline; + + public float getOpcFloatValue(String protocol) { + Float value = this.driver.getDoubleValue(protocol); + if (value == null) { + // log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!"); + setIsonline(false); + } else { + setIsonline(true); + return value; + } + return 0; + + } public int getOpcIntegerValue(String protocol) { Integer value = this.driver.getIntegeregerValue(protocol); if (value == null) { @@ -163,6 +196,8 @@ public class ItemProtocol { list.add(new ItemDto(item_error, "报警信号", "DB1.B5")); list.add(new ItemDto(item_task, "任务号", "DB1.D6")); list.add(new ItemDto(item_walk_y, "行走列", "DB1.B4")); + list.add(new ItemDto(item_x, "行走列号", "DB101.B10")); + list.add(new ItemDto(item_y, "行走层号", "DB101.B11")); return list; } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/return_good_manipulator/ReturnGoodManipulatorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/return_good_manipulator/ReturnGoodManipulatorDeviceDriver.java index 3cfcb0df2..7d346a879 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/return_good_manipulator/ReturnGoodManipulatorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/return_good_manipulator/ReturnGoodManipulatorDeviceDriver.java @@ -18,6 +18,7 @@ import org.nl.acs.device_driver.DeviceDriver; import org.nl.acs.device_driver.FeedLmsRealFailed; import org.nl.acs.device_driver.RouteableDeviceDriver; import org.nl.acs.device_driver.box_manipulator_site.BoxManipulatorSiteDeviceDriver; +import org.nl.acs.device_driver.conveyor.belt_conveyor.BeltConveyorDeviceDriver; import org.nl.acs.device_driver.conveyor.siemens_conveyor.SiemensConveyorDeviceDriver; import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; @@ -373,15 +374,14 @@ public class ReturnGoodManipulatorDeviceDriver extends AbstractOpcDeviceDriver i throw new BadRequestException("设备:" + nextDevice.getDevice_code() + "未设置电气调度号!"); } - SiemensConveyorDeviceDriver siemensConveyorDeviceDriver; - if (nextDevice.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) { - siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) nextDevice.getDeviceDriver(); - if (siemensConveyorDeviceDriver.getMove() != 1) { + BeltConveyorDeviceDriver beltConveyorDeviceDriver; + if (startDevice.getDeviceDriver() instanceof BeltConveyorDeviceDriver) { + beltConveyorDeviceDriver = (BeltConveyorDeviceDriver) startDevice.getDeviceDriver(); + if (beltConveyorDeviceDriver.getMove() != 1) { notCreateInstMessage = "universal_notCreateInstMessage2"; return false; } } - String taskid = taskDto.getTask_id(); String taskcode = taskDto.getTask_code(); String start_point_code = taskDto.getStart_point_code(); @@ -450,7 +450,7 @@ public class ReturnGoodManipulatorDeviceDriver extends AbstractOpcDeviceDriver i list.add(map5); } if (ObjectUtil.isNotEmpty(interactionJsonDTO.getLength())) { - map6.put("code", "to_length"); + map6.put("code", "to_lenght"); map6.put("value", interactionJsonDTO.getLength()); list.add(map6); } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/trapped_manipulator/ItemProtocol.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/trapped_manipulator/ItemProtocol.java index 63e94d08f..ad011548c 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/trapped_manipulator/ItemProtocol.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/trapped_manipulator/ItemProtocol.java @@ -36,6 +36,21 @@ public class ItemProtocol { */ public static String item_error = "error"; + /** + * 行走列 + */ + public static String item_walk_y = "walk_y"; + + /** + * 行走列 + */ + public static String item_x = "x"; + + /** + * 行走层号 + */ + public static String item_y = "y"; + /** * 下发托盘类型 @@ -92,6 +107,18 @@ public class ItemProtocol { private TrappedManipulatorManipulatorDeviceDriver driver; + public float getX() { + return this.getOpcFloatValue(item_x); + } + + public float getY() { + return this.getOpcFloatValue(item_y); + } + public int getWalk_y() { + return this.getOpcIntegerValue(item_walk_y); + } + + public ItemProtocol(TrappedManipulatorManipulatorDeviceDriver driver){ this.driver=driver; } @@ -158,6 +185,19 @@ public class ItemProtocol { return 0; } + public float getOpcFloatValue(String protocol) { + Float value = this.driver.getDoubleValue(protocol); + if (value == null) { + // log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!"); + setIsonline(false); + } else { + setIsonline(true); + return value; + } + return 0; + + } + public static List getReadableItemDtos() { ArrayList list = new ArrayList<>(); list.add(new ItemDto(item_heartbeat, "心跳", "DB1.B0")); @@ -166,6 +206,8 @@ public class ItemProtocol { list.add(new ItemDto(item_action, "动作信号", "DB1.B3")); list.add(new ItemDto(item_error, "报警信号", "DB1.B5")); list.add(new ItemDto(item_task, "任务号", "DB1.D6")); + list.add(new ItemDto(item_x, "行走列号", "DB101.B10")); + list.add(new ItemDto(item_y, "行走层号", "DB101.B11")); return list; } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/volume_two_manipulator/ItemProtocol.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/volume_two_manipulator/ItemProtocol.java index cf261edcf..ba1bafc0b 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/volume_two_manipulator/ItemProtocol.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/volume_two_manipulator/ItemProtocol.java @@ -138,12 +138,12 @@ public class ItemProtocol { public int getWalk_y() { return this.getOpcIntegerValue(item_walk_y); } - public Integer getItem_x() { - return this.getOpcIntegerValue(item_x); + public float getX() { + return this.getOpcFloatValue(item_x); } - public Integer getItem_y() { - return this.getOpcIntegerValue(item_y); + public float getY() { + return this.getOpcFloatValue(item_y); } @@ -180,6 +180,19 @@ public class ItemProtocol { return 0; } + public float getOpcFloatValue(String protocol) { + Float value = this.driver.getDoubleValue(protocol); + if (value == null) { + // log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!"); + setIsonline(false); + } else { + setIsonline(true); + return value; + } + return 0; + + } + public static List getReadableItemDtos() { ArrayList list = new ArrayList<>(); list.add(new ItemDto(item_heartbeat, "心跳", "DB1.B0")); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/volume_two_manipulator/VolumeTwoManipulatorManipulatorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/volume_two_manipulator/VolumeTwoManipulatorManipulatorDeviceDriver.java index d9ea1bc4e..8d539bdcc 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/volume_two_manipulator/VolumeTwoManipulatorManipulatorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/volume_two_manipulator/VolumeTwoManipulatorManipulatorDeviceDriver.java @@ -101,16 +101,12 @@ public class VolumeTwoManipulatorManipulatorDeviceDriver extends AbstractOpcDevi int last_to_onset2 = 0; int to_type = 0; int last_to_type = 0; - /** - * 行走列 - */ - Integer x = null; - Integer last_x = null; - /** - * 行走层号 - */ - Integer y = 0; - Integer last_y = 0; + // x坐标 + float x = 0.0f; + float last_x = 0.0f; + // y坐标 + float y = 0.0f; + float last_y = 0.0f; int to_task = 0; int last_to_task = 0; @@ -169,8 +165,8 @@ public class VolumeTwoManipulatorManipulatorDeviceDriver extends AbstractOpcDevi error = this.itemProtocol.getError(); task = this.itemProtocol.getTask(); heartbeat = this.itemProtocol.getHeartbeat(); - x = this.itemProtocol.getItem_x(); - y = this.itemProtocol.getItem_y(); + x = this.itemProtocol.getX(); + y = this.itemProtocol.getY(); to_command = this.itemProtocol.getTo_command(); to_target1 = this.itemProtocol.getTo_target1(); to_onset1 = this.itemProtocol.getTo_onset1();