From f131aef6c4587b3e1db946e6a3e59886f783c525 Mon Sep 17 00:00:00 2001 From: gengby <858962040@qq.com> Date: Wed, 23 Nov 2022 09:02:37 +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 --- .../service/impl/DeviceServiceImpl.java | 9 +++- .../HongXiangConveyorDeviceDriver.java | 32 +++++++++--- .../hongxiang_device/ItemProtocol.java | 52 +++++++++++++------ .../OvenGantryManipulatorDeviceDriver.java | 12 ++--- .../acs/device/driver/oven_manipulator.vue | 1 + 5 files changed, 75 insertions(+), 31 deletions(-) diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java index e836fd3bf..9850e6328 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java @@ -1123,7 +1123,14 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial "false".equalsIgnoreCase(json.getString("extra_value"))) { extraObj.put(json.getString("extra_code"), json.getBoolean("extra_value")); } else { - extraObj.put(json.getString("extra_code"), json.get("extra_value")); + boolean endsWith = json.getString("extra_value").endsWith("]"); + boolean startsWith = json.getString("extra_value").startsWith("["); + if (endsWith && startsWith){ + JSONArray extraValue = JSONArray.parseArray(json.getString("extra_value")); + extraObj.put(json.getString("extra_code"), extraValue); + } else { + extraObj.put(json.getString("extra_code"), json.get("extra_value")); + } } } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hongxiang_device/HongXiangConveyorDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hongxiang_device/HongXiangConveyorDeviceDriver.java index d06f7e571..ff9f350a3 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hongxiang_device/HongXiangConveyorDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hongxiang_device/HongXiangConveyorDeviceDriver.java @@ -78,8 +78,12 @@ public class HongXiangConveyorDeviceDriver extends AbstractOpcDeviceDriver imple public int error1 = 0; public int material = 0; public int consumption = 0; - public int voltage = 0; - public int current = 0; + public int voltageA = 0; + public int voltageB = 0; + public int voltageC = 0; + public int currentA = 0; + public int currentB = 0; + public int currentC = 0; public int last_heartbeat = 0; public int last_mode = 0; @@ -94,8 +98,12 @@ public class HongXiangConveyorDeviceDriver extends AbstractOpcDeviceDriver imple public int last_error1 = 0; public int last_material = 0; public int last_consumption = 0; - public int last_voltage = 0; - public int last_current = 0; + public int last_voltageA = 0; + public int last_voltageB = 0; + public int last_voltageC = 0; + public int last_currentA = 0; + public int last_currentB = 0; + public int last_currentC = 0; Boolean isonline = true; @@ -132,8 +140,12 @@ public class HongXiangConveyorDeviceDriver extends AbstractOpcDeviceDriver imple error1 = this.itemProtocol.getItem_error1(); material = this.itemProtocol.getItem_material(); consumption = this.itemProtocol.getItem_consumption(); - voltage = this.itemProtocol.getItem_voltage(); - current = this.itemProtocol.getItem_current(); + voltageA = this.itemProtocol.getItem_voltageA(); + voltageB = this.itemProtocol.getItem_voltageB(); + voltageC = this.itemProtocol.getItem_voltageC(); + currentA = this.itemProtocol.getItem_currentA(); + currentB = this.itemProtocol.getItem_currentB(); + currentC = this.itemProtocol.getItem_currentC(); if (mode != last_mode) { this.setRequireSucess(false); @@ -179,8 +191,12 @@ public class HongXiangConveyorDeviceDriver extends AbstractOpcDeviceDriver imple last_error1 = error1; last_material = material; last_consumption = consumption; - last_voltage = voltage; - last_current = current; + last_voltageA = voltageA; + last_voltageB = voltageB; + last_voltageC = voltageC; + last_currentA = currentA; + last_currentB = currentB; + last_currentC = currentC; } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hongxiang_device/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hongxiang_device/ItemProtocol.java index d81216a18..41ff6b324 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hongxiang_device/ItemProtocol.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hongxiang_device/ItemProtocol.java @@ -25,12 +25,17 @@ public class ItemProtocol { public static String item_error1 = "error1"; public static String item_material = "material"; public static String item_consumption = "consumption"; - public static String item_voltage = "voltage"; - public static String item_current = "current"; + public static String item_voltageA = "voltageA"; + public static String item_voltageB = "voltageB"; + public static String item_voltageC = "voltageC"; + public static String item_currentA = "currentA"; + public static String item_currentB = "currentB"; + public static String item_currentC = "currentC"; public static String item_to_command = "to_command"; - public static String item_to_door = "to_door"; + public static String item_to_open_door = "to_open_door"; + public static String item_to_close_door = "to_close_door"; public static String item_to_temperature = "to_temperature"; public static String item_to_material = "to_material"; public static String item_to_time = "to_time"; @@ -82,11 +87,23 @@ public class ItemProtocol { public int getItem_consumption(){ return this.getOpcIntegerValue(item_consumption); } ; - public int getItem_voltage(){ - return this.getOpcIntegerValue(item_voltage); + public int getItem_voltageA(){ + return this.getOpcIntegerValue(item_voltageA); } ; - public int getItem_current(){ - return this.getOpcIntegerValue(item_current); + public int getItem_voltageB(){ + return this.getOpcIntegerValue(item_voltageB); + } ; + public int getItem_voltageC(){ + return this.getOpcIntegerValue(item_voltageC); + } ; + public int getItem_currentA(){ + return this.getOpcIntegerValue(item_currentA); + } ; + public int getItem_currentB(){ + return this.getOpcIntegerValue(item_currentB); + } ; + public int getItem_currentC(){ + return this.getOpcIntegerValue(item_currentC); } ; Boolean isonline; @@ -108,27 +125,30 @@ public class ItemProtocol { list.add(new ItemDto(item_heartbeat, "心跳", "251")); list.add(new ItemDto(item_mode, "工作模式", "7990")); list.add(new ItemDto(item_move, "光电信号", "550")); - list.add(new ItemDto(item_action, "取放信号", "450")); - list.add(new ItemDto(item_error, "故障", "8055")); - list.add(new ItemDto(item_error1, "故障1", "216")); list.add(new ItemDto(item_door, "门状态", "450")); list.add(new ItemDto(item_temperature, "工位温度", "7991")); list.add(new ItemDto(item_countdown, "恒温倒计时", "200")); list.add(new ItemDto(item_finish, "烘干完成", "8025")); - list.add(new ItemDto(item_consumption, "电能耗", "8092")); - list.add(new ItemDto(item_voltage, "电压", "8086")); - list.add(new ItemDto(item_current, "电流", "8080")); + list.add(new ItemDto(item_action, "取放信号", "450")); list.add(new ItemDto(item_task, "任务号", "220")); + list.add(new ItemDto(item_error, "故障", "8055")); + list.add(new ItemDto(item_error1, "故障1", "216")); list.add(new ItemDto(item_material, "物料", "223")); - - + list.add(new ItemDto(item_consumption, "电能耗", "8092")); + list.add(new ItemDto(item_voltageA, "A相电压", "8080")); + list.add(new ItemDto(item_voltageB, "B相电压", "8082")); + list.add(new ItemDto(item_voltageC, "C相电压", "8084")); + list.add(new ItemDto(item_currentA, "A相电流", "8086")); + list.add(new ItemDto(item_currentB, "B相电流", "8088")); + list.add(new ItemDto(item_currentC, "C相电流", "8090")); return list; } public static List getWriteableItemDtos() { ArrayList list = new ArrayList(); list.add(new ItemDto(item_to_command, "下发命令", "226")); - list.add(new ItemDto(item_to_door, "开关门", "8030")); + list.add(new ItemDto(item_to_open_door, "开门", "8030")); + list.add(new ItemDto(item_to_close_door, "关门", "8031")); list.add(new ItemDto(item_to_temperature, "生产温度", "8100")); list.add(new ItemDto(item_to_material, "生产物料", "229")); list.add(new ItemDto(item_to_time, "生产时间", "210")); diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/oven_manipulator/OvenGantryManipulatorDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/oven_manipulator/OvenGantryManipulatorDeviceDriver.java index 69bbf1e52..7bb9a1955 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/oven_manipulator/OvenGantryManipulatorDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/oven_manipulator/OvenGantryManipulatorDeviceDriver.java @@ -163,7 +163,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i } } - //申请取货 判断取货位是否有货 有货就下发允许取货命令 + //申请取货 if (mode == 3 && action == 1 && move == 0 && task > 0) { Instruction inst2 = instructionService.findByCodeFromCache(String.valueOf(task)); if (ObjectUtil.isNotEmpty(inst2)) { @@ -172,7 +172,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver; if (device.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) device.getDeviceDriver(); - hongXiangConveyorDeviceDriver.writing("to_door", "1"); + hongXiangConveyorDeviceDriver.writing("to_open_door", "1"); if (hongXiangConveyorDeviceDriver.getDoor() == 1 && hongXiangConveyorDeviceDriver.getAction() == 1 && hongXiangConveyorDeviceDriver.getError1() == 0) { this.writing("to_command", "2"); } @@ -190,7 +190,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver; if (nextDevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) nextDevice.getDeviceDriver(); - hongXiangConveyorDeviceDriver.writing("to_door", "1"); + hongXiangConveyorDeviceDriver.writing("to_open_door", "1"); if (hongXiangConveyorDeviceDriver.getDoor() == 1 && hongXiangConveyorDeviceDriver.getAction() == 1 && hongXiangConveyorDeviceDriver.getError1() == 0) { this.writing("to_command", "3"); } @@ -223,11 +223,11 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver; if (startDevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) startDevice.getDeviceDriver(); - hongXiangConveyorDeviceDriver.writing("to_door", "0"); + hongXiangConveyorDeviceDriver.writing("to_close_door", "1"); } if (nextDevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) nextDevice.getDeviceDriver(); - hongXiangConveyorDeviceDriver.writing("to_door", "0"); + hongXiangConveyorDeviceDriver.writing("to_close_door", "1"); } this.writing("to_command", "0"); this.writing("to_onset", "0"); @@ -358,7 +358,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i instdto.setStart_point_code(start_point_code); instdto.setNext_point_code(next_point_code); instdto.setPriority(priority); - instdto.setInstruction_status("1"); + instdto.setInstruction_status("0"); instdto.setExecute_device_code(start_point_code); try { diff --git a/acs/nladmin-ui/src/views/acs/device/driver/oven_manipulator.vue b/acs/nladmin-ui/src/views/acs/device/driver/oven_manipulator.vue index 0c2e79dc3..232b4a6cb 100644 --- a/acs/nladmin-ui/src/views/acs/device/driver/oven_manipulator.vue +++ b/acs/nladmin-ui/src/views/acs/device/driver/oven_manipulator.vue @@ -102,6 +102,7 @@ v-model="form.link_device_code" filterable multiple + clearable placeholder="请选择" >