diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/box_palletizing_manipulator/BoxPalletizingManipulatorDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/box_palletizing_manipulator/BoxPalletizingManipulatorDeviceDriver.java index 88363cbfe..7bce24421 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/box_palletizing_manipulator/BoxPalletizingManipulatorDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/box_palletizing_manipulator/BoxPalletizingManipulatorDeviceDriver.java @@ -12,6 +12,7 @@ import org.nl.acs.device_driver.RouteableDeviceDriver; import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; import org.nl.acs.ext.wms.service.AcsToWmsService; +import org.nl.acs.history.ErrorUtil; import org.nl.acs.instruction.service.InstructionService; import org.nl.acs.instruction.service.dto.Instruction; import org.nl.acs.log.service.DeviceExecuteLogService; @@ -171,7 +172,6 @@ public class BoxPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDriv } - public boolean exe_error() { if (this.error == 0) { return true; @@ -219,7 +219,7 @@ public class BoxPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDriv //将扩展表中的字符串数据转换成集合 public List getExtraDeviceCodes(String extraName) { String extraValue = (String) this.getDevice().getExtraValue().get(extraName); - if (StrUtil.isEmpty(extraValue)){ + if (StrUtil.isEmpty(extraValue)) { return new ArrayList<>(); } String devicesString = extraValue.substring(1, extraValue.length() - 1); @@ -273,7 +273,7 @@ public class BoxPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDriv jo.put("task", task); jo.put("walk_y", walk_y); jo.put("isOnline", this.getIsonline()); - jo.put("error", this.getError()); + jo.put("error", ErrorUtil.getDictDetail("mdhj_error_type", String.valueOf(this.getError()))); jo.put("isError", this.getIserror()); jo.put("message", this.getMessage()); return jo; diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hongxiang_conveyor/HongXiangStationDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hongxiang_conveyor/HongXiangStationDeviceDriver.java index 886c2d855..adc44da8d 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hongxiang_conveyor/HongXiangStationDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hongxiang_conveyor/HongXiangStationDeviceDriver.java @@ -14,6 +14,7 @@ import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; import org.nl.acs.ext.wms.service.AcsToWmsService; import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl; +import org.nl.acs.history.ErrorUtil; import org.nl.acs.instruction.service.InstructionService; import org.nl.acs.log.service.DeviceExecuteLogService; import org.nl.acs.monitor.DeviceStageMonitor; @@ -216,7 +217,7 @@ public class HongXiangStationDeviceDriver extends AbstractOpcDeviceDriver implem jo.put("mode", "联机"); jo.put("action", action); jo.put("isOnline", true); - jo.put("error", this.getError()); + jo.put("error", ErrorUtil.getDictDetail("hxdj_error_type", String.valueOf(this.getError()))); jo.put("isError", this.getIserror()); jo.put("task", this.getTask()); return jo; 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 286cdce16..2bb9fe73c 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 @@ -18,6 +18,7 @@ import org.nl.acs.ext.wms.data.ApplyLabelingAndBindingRequest; import org.nl.acs.ext.wms.data.ApplyLabelingAndBindingResponse; import org.nl.acs.ext.wms.service.AcsToWmsService; import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl; +import org.nl.acs.history.ErrorUtil; import org.nl.acs.instruction.service.InstructionService; import org.nl.acs.instruction.service.dto.Instruction; import org.nl.acs.log.service.DeviceExecuteLogService; @@ -321,7 +322,7 @@ public class HongXiangConveyorDeviceDriver extends AbstractOpcDeviceDriver imple jo.put("temperature", temperature); jo.put("finish", finish); jo.put("isOnline", this.getIsonline()); - jo.put("error", this.getError()); + jo.put("error", ErrorUtil.getDictDetail("hx_error_type", String.valueOf(this.getError()))); jo.put("isError", this.getIserror()); jo.put("countdown_house", countdown_house); jo.put("countdown_min", countdown_min); 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 0e6139385..81274c8cc 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 @@ -21,6 +21,7 @@ import org.nl.acs.device_driver.basedriver.standard_inspect_site.StandardInspect import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; import org.nl.acs.ext.wms.service.AcsToWmsService; +import org.nl.acs.history.ErrorUtil; import org.nl.acs.instruction.service.InstructionService; import org.nl.acs.instruction.service.dto.Instruction; import org.nl.acs.log.service.DeviceExecuteLogService; @@ -401,17 +402,17 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) nextDevice.getDeviceDriver(); // hongXiangConveyorDeviceDriver.writing("to_close_door", "1"); - if(!StrUtil.startWith(taskDto.getTask_code(), "-")){ - if(ObjectUtil.isNotEmpty(nextDevice.getExtraValue().get("link_three_lamp"))){ + if (!StrUtil.startWith(taskDto.getTask_code(), "-")) { + if (ObjectUtil.isNotEmpty(nextDevice.getExtraValue().get("link_three_lamp"))) { String lamp = nextDevice.getExtraValue().get("link_three_lamp").toString(); Device lampDevice = deviceAppService.findDeviceByCode(lamp); - if(ObjectUtil.isEmpty(lampDevice)){ + if (ObjectUtil.isEmpty(lampDevice)) { return; } if (lampDevice.getDeviceDriver() instanceof LampThreecolorDeviceDriver) { lampThreecolorDeviceDriver = (LampThreecolorDeviceDriver) lampDevice.getDeviceDriver(); - logServer.deviceExecuteLog(lampDevice.getDeviceDriver().getDeviceCode(), "", "", "下发报警灯"+ lamp +"报警信号"); - lampThreecolorDeviceDriver.writing("to_command","1"); + logServer.deviceExecuteLog(lampDevice.getDeviceDriver().getDeviceCode(), "", "", "下发报警灯" + lamp + "报警信号"); + lampThreecolorDeviceDriver.writing("to_command", "1"); } } } @@ -452,7 +453,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i } catch (Exception var17) { var17.printStackTrace(); feedMessage = var17.getMessage(); - logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17.getMessage()+ ",this.itemProtocol is null:" + ObjectUtil.isEmpty(this.itemProtocol) ); + logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17.getMessage() + ",this.itemProtocol is null:" + ObjectUtil.isEmpty(this.itemProtocol)); } @@ -480,7 +481,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i //行架机械手申请任务 if (mode == 2 && move == 0 && task == 0 && !requireSucess) { boolean res = applyTask(); - if (res){ + if (res) { notCreateInstMessage = ""; notCreateTaskMessage = ""; feedMessage = ""; @@ -513,7 +514,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i last_walk_y = walk_y; last_error = error; last_task = task; - last_heartbeat = heartbeat; + last_heartbeat = heartbeat; } @@ -562,21 +563,21 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i if (startdevice.getDeviceDriver() instanceof PhotoelectricInspectionSiteDeviceDriver) { photoelectricInspectionSiteDeviceDriver = (PhotoelectricInspectionSiteDeviceDriver) startdevice.getDeviceDriver(); if (photoelectricInspectionSiteDeviceDriver.getMove() != 1) { - notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位-烘箱对接位:" + photoelectricInspectionSiteDeviceDriver.getDevice_code() + "无货,无法下发指令!指令号:"+instruction.getInstruction_code(); + notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位-烘箱对接位:" + photoelectricInspectionSiteDeviceDriver.getDevice_code() + "无货,无法下发指令!指令号:" + instruction.getInstruction_code(); return false; } } if (startdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) startdevice.getDeviceDriver(); if (standardInspectSiteDeviceDriver.getMove() != 1) { - notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位-烘箱对接位:" + standardInspectSiteDeviceDriver.getDevice_code() + "无货,无法下发指令!指令号:"+instruction.getInstruction_code(); + notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位-烘箱对接位:" + standardInspectSiteDeviceDriver.getDevice_code() + "无货,无法下发指令!指令号:" + instruction.getInstruction_code(); return false; } } if (startdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) startdevice.getDeviceDriver(); if (hongXiangConveyorDeviceDriver.getMode() == 0 || hongXiangConveyorDeviceDriver.getMove() == 0) { - notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位-烘箱:" + hongXiangConveyorDeviceDriver.getDevice_code() + "未联机或无货,无法下发指令!指令号:"+instruction.getInstruction_code(); + notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位-烘箱:" + hongXiangConveyorDeviceDriver.getDevice_code() + "未联机或无货,无法下发指令!指令号:" + instruction.getInstruction_code(); return false; } } @@ -584,14 +585,14 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i if (nextdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) nextdevice.getDeviceDriver(); if (standardInspectSiteDeviceDriver.getMove() != 0) { - notCreateInstMessage = "手动创建指令未下发电气信号原因->放货位-烘箱对接位:" + standardInspectSiteDeviceDriver.getDevice_code() + "有货,无法下发指令!指令号:"+instruction.getInstruction_code(); + notCreateInstMessage = "手动创建指令未下发电气信号原因->放货位-烘箱对接位:" + standardInspectSiteDeviceDriver.getDevice_code() + "有货,无法下发指令!指令号:" + instruction.getInstruction_code(); return false; } } if (nextdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) nextdevice.getDeviceDriver(); if (hongXiangConveyorDeviceDriver.getMode() == 0 || hongXiangConveyorDeviceDriver.getMove() == 1) { - notCreateInstMessage = "手动创建指令未下发电气信号原因->放货位-烘箱:" + hongXiangConveyorDeviceDriver.getDevice_code() + "未联机或者有货,无法下发指令!指令号:"+instruction.getInstruction_code(); + notCreateInstMessage = "手动创建指令未下发电气信号原因->放货位-烘箱:" + hongXiangConveyorDeviceDriver.getDevice_code() + "未联机或者有货,无法下发指令!指令号:" + instruction.getInstruction_code(); return false; } } @@ -620,11 +621,11 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i this.writing("to_command", "1"); if (startdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) startdevice.getDeviceDriver(); - hongXiangConveyorDeviceDriver.writing("to_open_door","1"); + hongXiangConveyorDeviceDriver.writing("to_open_door", "1"); } if (nextdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) nextdevice.getDeviceDriver(); - hongXiangConveyorDeviceDriver.writing("to_open_door","1"); + hongXiangConveyorDeviceDriver.writing("to_open_door", "1"); } this.setNow_steps_type(2); this.setRequireSucess(true); @@ -954,7 +955,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i jo.put("task", task); jo.put("walk_y", walk_y); jo.put("isOnline", this.getIsonline()); - jo.put("error", this.getError()); + jo.put("error", ErrorUtil.getDictDetail("hxhj_error_type", String.valueOf(this.getError()))); jo.put("isError", this.getIserror()); jo.put("message", this.getMessage()); jo.put("notCreateTaskMessage", notCreateTaskMessage); diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor/SiemensConveyorDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor/SiemensConveyorDeviceDriver.java index e2eb3f95e..4147b638f 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor/SiemensConveyorDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor/SiemensConveyorDeviceDriver.java @@ -26,6 +26,7 @@ import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; import org.nl.acs.ext.wms.data.ApplyLabelingAndBindingRequest; import org.nl.acs.ext.wms.data.ApplyLabelingAndBindingResponse; import org.nl.acs.ext.wms.service.AcsToWmsService; +import org.nl.acs.history.ErrorUtil; import org.nl.acs.instruction.service.InstructionService; import org.nl.acs.instruction.service.dto.Instruction; import org.nl.acs.log.service.DeviceExecuteLogService; @@ -469,7 +470,7 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme jo.put("inst_message", this.inst_message); jo.put("last_inst_message", this.last_inst_message); jo.put("isOnline", this.getIsonline()); - jo.put("error", this.getError()); + jo.put("error", ErrorUtil.getDictDetail("ssx_error_type", String.valueOf(this.getError()))); jo.put("isError", this.getIserror()); jo.put("message", this.getMessage()); jo.put("is_click", true); diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor_ckk/SiemensConveyorCkkDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor_ckk/SiemensConveyorCkkDeviceDriver.java index e147b749b..35fa867f6 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor_ckk/SiemensConveyorCkkDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor_ckk/SiemensConveyorCkkDeviceDriver.java @@ -22,6 +22,7 @@ import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; import org.nl.acs.ext.wms.data.ApplyLabelingAndBindingRequest; import org.nl.acs.ext.wms.data.ApplyLabelingAndBindingResponse; import org.nl.acs.ext.wms.service.AcsToWmsService; +import org.nl.acs.history.ErrorUtil; import org.nl.acs.instruction.service.InstructionService; import org.nl.acs.instruction.service.dto.Instruction; import org.nl.acs.log.service.DeviceExecuteLogService; @@ -429,7 +430,7 @@ public class SiemensConveyorCkkDeviceDriver extends AbstractOpcDeviceDriver impl jo.put("inst_message", this.inst_message); jo.put("last_inst_message", this.last_inst_message); jo.put("isOnline", this.getIsonline()); - jo.put("error", this.getError()); + jo.put("error", ErrorUtil.getDictDetail("ssx_error_type", String.valueOf(this.getError()))); jo.put("isError", this.getIserror()); jo.put("message", this.getMessage()); jo.put("is_click", true); diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor_labeling/SiemensConveyorLabelingDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor_labeling/SiemensConveyorLabelingDeviceDriver.java index 705a8abdc..a30b3e0d1 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor_labeling/SiemensConveyorLabelingDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor_labeling/SiemensConveyorLabelingDeviceDriver.java @@ -21,6 +21,7 @@ import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; import org.nl.acs.ext.wms.data.ApplyLabelingAndBindingRequest; import org.nl.acs.ext.wms.data.ApplyLabelingAndBindingResponse; import org.nl.acs.ext.wms.service.AcsToWmsService; +import org.nl.acs.history.ErrorUtil; import org.nl.acs.instruction.service.InstructionService; import org.nl.acs.instruction.service.dto.Instruction; import org.nl.acs.log.service.DeviceExecuteLogService; @@ -445,7 +446,7 @@ public class SiemensConveyorLabelingDeviceDriver extends AbstractOpcDeviceDriver jo.put("carrier_direction", carrier_direction); jo.put("task", task); jo.put("isOnline", this.getIsonline()); - jo.put("error", this.getError()); + jo.put("error", ErrorUtil.getDictDetail("ssx_error_type", String.valueOf(this.getError()))); jo.put("isError", this.getIserror()); jo.put("message", this.getMessage()); jo.put("is_click", true); diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_onefloor_agv_conveyor/SiemensOneFloorAGVConveyorDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_onefloor_agv_conveyor/SiemensOneFloorAGVConveyorDeviceDriver.java index 91b62d7d6..d2412c4aa 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_onefloor_agv_conveyor/SiemensOneFloorAGVConveyorDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_onefloor_agv_conveyor/SiemensOneFloorAGVConveyorDeviceDriver.java @@ -22,6 +22,7 @@ import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; import org.nl.acs.ext.wms.data.ApplyLabelingAndBindingRequest; import org.nl.acs.ext.wms.data.ApplyLabelingAndBindingResponse; import org.nl.acs.ext.wms.service.AcsToWmsService; +import org.nl.acs.history.ErrorUtil; import org.nl.acs.instruction.service.InstructionService; import org.nl.acs.instruction.service.dto.Instruction; import org.nl.acs.log.service.DeviceExecuteLogService; @@ -304,7 +305,7 @@ public class SiemensOneFloorAGVConveyorDeviceDriver extends AbstractOpcDeviceDri jo.put("inst_message", this.inst_message); jo.put("last_inst_message", this.last_inst_message); jo.put("isOnline", this.getIsonline()); - jo.put("error", this.getError()); + jo.put("error", ErrorUtil.getDictDetail("ssx_error_type", String.valueOf(this.getError()))); jo.put("isError", this.getIserror()); jo.put("message", this.getMessage()); jo.put("is_click", true); diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/slit_two_manipulator/SlitTwoManipulatorDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/slit_two_manipulator/SlitTwoManipulatorDeviceDriver.java index a36d2574c..101d64b15 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/slit_two_manipulator/SlitTwoManipulatorDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/slit_two_manipulator/SlitTwoManipulatorDeviceDriver.java @@ -18,6 +18,7 @@ import org.nl.acs.device_driver.basedriver.siemens_conveyor.SiemensConveyorDevic import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; import org.nl.acs.ext.wms.service.AcsToWmsService; +import org.nl.acs.history.ErrorUtil; import org.nl.acs.instruction.service.InstructionService; import org.nl.acs.instruction.service.dto.Instruction; import org.nl.acs.log.service.DeviceExecuteLogService; @@ -1418,7 +1419,7 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl jo.put("action_1", action1); jo.put("action_2", action2); jo.put("walk_y", walk_y); - jo.put("error", this.getError()); + jo.put("error", ErrorUtil.getDictDetail("fqhj_error_type", String.valueOf(this.getError()))); jo.put("task1", this.getTask1()); jo.put("task2", this.getTask2()); jo.put("isOnline", this.getIsonline()); diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/StandardCoveyorControlWithScannerDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/StandardCoveyorControlWithScannerDeviceDriver.java index 4830d09ce..649f7c11f 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/StandardCoveyorControlWithScannerDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/StandardCoveyorControlWithScannerDeviceDriver.java @@ -21,6 +21,7 @@ import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; import org.nl.acs.ext.wms.data.ApplyLabelingAndBindingRequest; import org.nl.acs.ext.wms.data.ApplyLabelingAndBindingResponse; import org.nl.acs.ext.wms.service.AcsToWmsService; +import org.nl.acs.history.ErrorUtil; import org.nl.acs.instruction.service.InstructionService; import org.nl.acs.instruction.service.dto.Instruction; import org.nl.acs.log.service.DeviceExecuteLogService; @@ -943,7 +944,7 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe jo.put("action", action); jo.put("is_click", true); jo.put("isOnline", this.getIsonline()); - jo.put("error", this.getError()); + jo.put("error", ErrorUtil.getDictDetail("ssx_error_type", String.valueOf(this.getError()))); jo.put("isError", this.getIserror()); jo.put("message", this.getMessage()); jo.put("inst_message", this.inst_message); diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/history/ErrorUtil.java b/acs/nladmin-system/src/main/java/org/nl/acs/history/ErrorUtil.java new file mode 100644 index 000000000..5b12aec70 --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/acs/history/ErrorUtil.java @@ -0,0 +1,63 @@ +package org.nl.acs.history; + +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import org.nl.modules.system.domain.Dict; +import org.nl.modules.system.service.DictDetailService; +import org.nl.modules.system.service.DictService; +import org.nl.modules.system.service.dto.DictDetailDto; +import org.nl.modules.system.service.impl.DictDetailServiceImpl; +import org.nl.modules.system.service.impl.DictServiceImpl; +import org.nl.modules.wql.util.SpringContextHolder; + +import java.util.List; +import java.util.concurrent.ConcurrentHashMap; +import java.util.function.Function; + +/** + * @author: geng by + * @createDate: 2023/3/15 + */ +public class ErrorUtil { + + public static ConcurrentHashMap> dictMap = new ConcurrentHashMap<>(); + + + public static String getDictDetail(String type, String error_code) { + getDict(); + List dictDetailDtos = dictMap.get(type); + String detail = null; + if (ObjectUtil.isNotEmpty(dictDetailDtos)) { + for (int i = 0; i < dictDetailDtos.size(); i++) { + DictDetailDto dictDetailDto = dictDetailDtos.get(i); + String value = dictDetailDto.getValue(); + String label = dictDetailDto.getLabel(); + if (StrUtil.equals(value, error_code)) { + detail = label; + break; + } + } + } + return detail == null ? "字典表未配置对应的报警信息" : detail; + } + + + public static void getDict() { + if (ObjectUtil.isEmpty(dictMap)) { + DictDetailService dictDetailService = SpringContextHolder.getBean(DictDetailServiceImpl.class); + DictService dictService = SpringContextHolder.getBean(DictServiceImpl.class); + List dictDtos = dictService.queryAll(); + for (int i = 0; i < dictDtos.size(); i++) { + Dict dictDto = dictDtos.get(i); + dictMap.put(dictDto.getName(), getDict(dictDto.getName(), t -> { + return dictDetailService.getDictByName(t); + })); + } + } + } + + public static List getDict(String name, Function> f) { + return f.apply(name); + } + +} diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/history/rest/DeviceErrorLogController.java b/acs/nladmin-system/src/main/java/org/nl/acs/history/rest/DeviceErrorLogController.java new file mode 100644 index 000000000..694440fea --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/acs/history/rest/DeviceErrorLogController.java @@ -0,0 +1,77 @@ + +package org.nl.acs.history.rest; + + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.nl.acs.history.service.DeviceErrorLogService; +import org.nl.acs.history.service.dto.DeviceErrorLogDto; +import org.nl.modules.logging.annotation.Log; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.Map; + +/** +* @author gengby +* @date 2023-03-15 +**/ +@RestController +@RequiredArgsConstructor +@Api(tags = "设备报警记录管理") +@RequestMapping("/api/deviceErrorLog") +@Slf4j +public class DeviceErrorLogController { + + private final DeviceErrorLogService acsDeviceErrorLogService; + + @GetMapping + @Log("查询设备报警记录") + @ApiOperation("查询设备报警记录") + //@PreAuthorize("@el.check('acsDeviceErrorLog:list')") + public ResponseEntity query(@RequestParam Map whereJson, Pageable page){ + return new ResponseEntity<>(acsDeviceErrorLogService.queryAll(whereJson,page),HttpStatus.OK); + } + + @PostMapping + @Log("新增设备报警记录") + @ApiOperation("新增设备报警记录") + //@PreAuthorize("@el.check('acsDeviceErrorLog:add')") + public ResponseEntity create(@Validated @RequestBody DeviceErrorLogDto dto){ + acsDeviceErrorLogService.create(dto); + return new ResponseEntity<>(HttpStatus.CREATED); + } + + @PutMapping + @Log("修改设备报警记录") + @ApiOperation("修改设备报警记录") + //@PreAuthorize("@el.check('acsDeviceErrorLog:edit')") + public ResponseEntity update(@Validated @RequestBody DeviceErrorLogDto dto){ + acsDeviceErrorLogService.update(dto); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @Log("删除设备报警记录") + @ApiOperation("删除设备报警记录") + //@PreAuthorize("@el.check('acsDeviceErrorLog:del')") + @DeleteMapping + public ResponseEntity delete(@RequestBody String[] ids) { + acsDeviceErrorLogService.deleteAll(ids); + return new ResponseEntity<>(HttpStatus.OK); + } + + @Log("导出设备报警记录") + @ApiOperation("导出设备报警记录") + @GetMapping(value = "/download") + //@PreAuthorize("@el.check('acsDeviceErrorLog:list')") + public void download(HttpServletResponse response, @RequestParam Map whereJson) throws IOException { + acsDeviceErrorLogService.download(acsDeviceErrorLogService.queryAll(whereJson), response); + } +} diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/history/service/DeviceErrorLogService.java b/acs/nladmin-system/src/main/java/org/nl/acs/history/service/DeviceErrorLogService.java new file mode 100644 index 000000000..e4bcc6c82 --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/acs/history/service/DeviceErrorLogService.java @@ -0,0 +1,74 @@ + +package org.nl.acs.history.service; + +import org.nl.acs.history.service.dto.DeviceErrorLogDto; +import org.springframework.data.domain.Pageable; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** +* @description 服务接口 +* @author gengby +* @date 2023-03-15 +**/ +public interface DeviceErrorLogService { + + /** + * 查询数据分页 + * @param whereJson 条件 + * @param page 分页参数 + * @return Map + */ + Map queryAll(Map whereJson, Pageable page); + + /** + * 查询所有数据不分页 + * @param whereJson 条件参数 + * @return List + */ + List queryAll(Map whereJson); + + /** + * 根据ID查询 + * @param error_log_uuid ID + * @return AcsDeviceErrorLog + */ + DeviceErrorLogDto findById(String error_log_uuid); + + /** + * 根据编码查询 + * @param code code + * @return AcsDeviceErrorLog + */ + DeviceErrorLogDto findByCode(String code); + + + /** + * 创建 + * @param dto / + */ + void create(DeviceErrorLogDto dto); + + /** + * 编辑 + * @param dto / + */ + void update(DeviceErrorLogDto dto); + + /** + * 多选删除 + * @param ids / + */ + void deleteAll(String[] ids); + + /** + * 导出数据 + * @param dtos 待导出的数据 + * @param response / + * @throws IOException / + */ + void download(List dtos, HttpServletResponse response) throws IOException; +} diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/history/service/dto/DeviceErrorLogDto.java b/acs/nladmin-system/src/main/java/org/nl/acs/history/service/dto/DeviceErrorLogDto.java new file mode 100644 index 000000000..eb08cae42 --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/acs/history/service/dto/DeviceErrorLogDto.java @@ -0,0 +1,29 @@ +package org.nl.acs.history.service.dto; + +import lombok.Data; + +import java.io.Serializable; + +/** +* @description / +* @author gengby +* @date 2023-03-15 +**/ +@Data +public class DeviceErrorLogDto implements Serializable { + + /** 报警日志标识 */ + private String error_log_uuid; + + /** 设备编码 */ + private String device_code; + + /** 报警编码 */ + private String error_code; + + /** 报警信息 */ + private String error_info; + + /** 报警时间 */ + private String error_time; +} diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/history/service/impl/DeviceErrorLogServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/acs/history/service/impl/DeviceErrorLogServiceImpl.java new file mode 100644 index 000000000..19120c08a --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/acs/history/service/impl/DeviceErrorLogServiceImpl.java @@ -0,0 +1,137 @@ + +package org.nl.acs.history.service.impl; + + +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.map.MapUtil; +import cn.hutool.core.util.IdUtil; +import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.nl.acs.history.service.DeviceErrorLogService; +import org.nl.acs.history.service.dto.DeviceErrorLogDto; +import org.nl.modules.common.exception.BadRequestException; +import org.nl.modules.common.utils.FileUtil; +import org.nl.modules.common.utils.SecurityUtils; +import org.nl.modules.wql.core.bean.ResultBean; +import org.nl.modules.wql.core.bean.WQLObject; +import org.nl.modules.wql.util.WqlUtil; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +/** + * @author gengby + * @description 服务实现 + * @date 2023-03-15 + **/ +@Service +@RequiredArgsConstructor +@Slf4j +public class DeviceErrorLogServiceImpl implements DeviceErrorLogService { + + @Override + public Map queryAll(Map whereJson, Pageable page) { + String device_code = MapUtil.getStr(whereJson, "device_code"); + String error_code = MapUtil.getStr(whereJson, "error_code"); + String error_info = MapUtil.getStr(whereJson, "error_info"); + WQLObject wo = WQLObject.getWQLObject("acs_device_error_log"); + String where = "1 = 1 "; + if (StrUtil.isNotEmpty(device_code)) { + where += "and device_code like '%" + device_code + "%'"; + } + if (StrUtil.isNotEmpty(error_code)) { + where += "and error_code like '%" + error_code + "%'"; + } + if (StrUtil.isNotEmpty(error_info)) { + where += "and error_info like '%" + error_info + "%'"; + } + ResultBean rb = wo.pagequery(WqlUtil.getHttpContext(page), where, "error_time desc"); + final JSONObject json = rb.pageResult(); + return json; + } + + @Override + public List queryAll(Map whereJson) { + WQLObject wo = WQLObject.getWQLObject("acs_device_error_log"); + JSONArray arr = wo.query().getResultJSONArray(0); + List list = arr.toJavaList(DeviceErrorLogDto.class); + return list; + } + + @Override + public DeviceErrorLogDto findById(String error_log_uuid) { + WQLObject wo = WQLObject.getWQLObject("acs_device_error_log"); + JSONObject json = wo.query("error_log_uuid ='" + error_log_uuid + "'").uniqueResult(0); + final DeviceErrorLogDto obj = (DeviceErrorLogDto) JSONObject.toJavaObject(json, DeviceErrorLogDto.class); + return obj; + } + + @Override + public DeviceErrorLogDto findByCode(String code) { + WQLObject wo = WQLObject.getWQLObject("acs_device_error_log"); + JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0); + final DeviceErrorLogDto obj = (DeviceErrorLogDto) JSONObject.toJavaObject(json, DeviceErrorLogDto.class); + return obj; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void create(DeviceErrorLogDto dto) { + String currentUsername = SecurityUtils.getCurrentUsername(); + String now = DateUtil.now(); + + dto.setError_log_uuid(IdUtil.simpleUUID()); + dto.setDevice_code(dto.getDevice_code()); + dto.setError_code(dto.getError_code()); + dto.setError_info(dto.getError_info()); + dto.setError_time(now); + WQLObject wo = WQLObject.getWQLObject("acs_device_error_log"); + JSONObject json = (JSONObject) JSONObject.toJSON(dto); + wo.insert(json); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(DeviceErrorLogDto dto) { + DeviceErrorLogDto entity = this.findById(dto.getError_log_uuid()); + if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!"); + String currentUsername = SecurityUtils.getCurrentUsername(); + String now = DateUtil.now(); + WQLObject wo = WQLObject.getWQLObject("acs_device_error_log"); + JSONObject json = (JSONObject) JSONObject.toJSON(dto); + wo.update(json); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void deleteAll(String[] ids) { + WQLObject wo = WQLObject.getWQLObject("acs_device_error_log"); + for (String error_log_uuid : ids) { + wo.delete("error_log_uuid = '" + error_log_uuid + "'"); + } + } + + @Override + public void download(List all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (DeviceErrorLogDto acsDeviceErrorLog : all) { + Map map = new LinkedHashMap<>(); + map.put("设备编码", acsDeviceErrorLog.getDevice_code()); + map.put("报警编码", acsDeviceErrorLog.getError_code()); + map.put("报警信息", acsDeviceErrorLog.getError_info()); + map.put("报警时间", acsDeviceErrorLog.getError_time()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } +} diff --git a/acs/nladmin-system/src/main/java/org/nl/modules/system/service/DictService.java b/acs/nladmin-system/src/main/java/org/nl/modules/system/service/DictService.java index 76a0011b4..0b9aaffdc 100644 --- a/acs/nladmin-system/src/main/java/org/nl/modules/system/service/DictService.java +++ b/acs/nladmin-system/src/main/java/org/nl/modules/system/service/DictService.java @@ -47,6 +47,8 @@ public interface DictService { */ List queryAll(DictQueryCriteria dict); + List queryAll(); + /** * 创建 * @param resources / diff --git a/acs/nladmin-system/src/main/java/org/nl/modules/system/service/impl/DictDetailServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/modules/system/service/impl/DictDetailServiceImpl.java index e60fa8e13..ecf78c92b 100644 --- a/acs/nladmin-system/src/main/java/org/nl/modules/system/service/impl/DictDetailServiceImpl.java +++ b/acs/nladmin-system/src/main/java/org/nl/modules/system/service/impl/DictDetailServiceImpl.java @@ -16,6 +16,7 @@ package org.nl.modules.system.service.impl; import lombok.RequiredArgsConstructor; +import org.nl.acs.history.ErrorUtil; import org.nl.modules.common.utils.PageUtil; import org.nl.modules.common.utils.QueryHelp; import org.nl.modules.common.utils.RedisUtils; @@ -39,9 +40,9 @@ import java.util.List; import java.util.Map; /** -* @author Zheng Jie -* @date 2019-04-10 -*/ + * @author Zheng Jie + * @date 2019-04-10 + */ @Service @RequiredArgsConstructor @CacheConfig(cacheNames = "dict") @@ -53,8 +54,8 @@ public class DictDetailServiceImpl implements DictDetailService { private final RedisUtils redisUtils; @Override - public Map queryAll(DictDetailQueryCriteria criteria, Pageable pageable) { - Page page = dictDetailRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); + public Map queryAll(DictDetailQueryCriteria criteria, Pageable pageable) { + Page page = dictDetailRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageable); return PageUtil.toPage(page.map(dictDetailMapper::toDto)); } @@ -64,17 +65,21 @@ public class DictDetailServiceImpl implements DictDetailService { dictDetailRepository.save(resources); // 清理缓存 delCaches(resources); + Dict dict = dictRepository.findById(resources.getDict().getId()).get(); + ErrorUtil.dictMap.put(dict.getName(), this.getDictByName(dict.getName())); } @Override @Transactional(rollbackFor = Exception.class) public void update(DictDetail resources) { DictDetail dictDetail = dictDetailRepository.findById(resources.getId()).orElseGet(DictDetail::new); - ValidationUtil.isNull( dictDetail.getId(),"DictDetail","id",resources.getId()); + ValidationUtil.isNull(dictDetail.getId(), "DictDetail", "id", resources.getId()); resources.setId(dictDetail.getId()); dictDetailRepository.save(resources); // 清理缓存 delCaches(resources); + Dict dict = dictRepository.findById(resources.getDict().getId()).get(); + ErrorUtil.dictMap.put(dict.getName(), this.getDictByName(dict.getName())); } @Override @@ -90,9 +95,11 @@ public class DictDetailServiceImpl implements DictDetailService { // 清理缓存 delCaches(dictDetail); dictDetailRepository.deleteById(id); + Dict dict = dictRepository.findById(id).get(); + ErrorUtil.dictMap.put(dict.getName(), this.getDictByName(dict.getName())); } - public void delCaches(DictDetail dictDetail){ + public void delCaches(DictDetail dictDetail) { Dict dict = dictRepository.findById(dictDetail.getDict().getId()).orElseGet(Dict::new); redisUtils.del("dict::name:" + dict.getName()); } diff --git a/acs/nladmin-system/src/main/java/org/nl/modules/system/service/impl/DictServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/modules/system/service/impl/DictServiceImpl.java index 4b938b44f..aabd36003 100644 --- a/acs/nladmin-system/src/main/java/org/nl/modules/system/service/impl/DictServiceImpl.java +++ b/acs/nladmin-system/src/main/java/org/nl/modules/system/service/impl/DictServiceImpl.java @@ -60,6 +60,12 @@ public class DictServiceImpl implements DictService { return dictMapper.toDto(list); } + @Override + public List queryAll() { + List list = dictRepository.findAll(); + return list; + } + @Override @Transactional(rollbackFor = Exception.class) public void create(Dict resources) { diff --git a/acs/nladmin-system/src/main/java/org/nl/modules/system/wql/sys.xls b/acs/nladmin-system/src/main/java/org/nl/modules/system/wql/sys.xls index 82566ab64..00b251538 100644 Binary files a/acs/nladmin-system/src/main/java/org/nl/modules/system/wql/sys.xls and b/acs/nladmin-system/src/main/java/org/nl/modules/system/wql/sys.xls differ diff --git a/acs/nladmin-ui/src/api/acs/history/acsDeviceErrorLog.js b/acs/nladmin-ui/src/api/acs/history/acsDeviceErrorLog.js new file mode 100644 index 000000000..12f1337d5 --- /dev/null +++ b/acs/nladmin-ui/src/api/acs/history/acsDeviceErrorLog.js @@ -0,0 +1,27 @@ +import request from '@/utils/request' + +export function add(data) { + return request({ + url: 'api/deviceErrorLog', + method: 'post', + data + }) +} + +export function del(ids) { + return request({ + url: 'api/deviceErrorLog/', + method: 'delete', + data: ids + }) +} + +export function edit(data) { + return request({ + url: 'api/deviceErrorLog', + method: 'put', + data + }) +} + +export default { add, edit, del } diff --git a/acs/nladmin-ui/src/views/acs/history/deviceErrorInfo/index.vue b/acs/nladmin-ui/src/views/acs/history/deviceErrorInfo/index.vue new file mode 100644 index 000000000..7a3611a3d --- /dev/null +++ b/acs/nladmin-ui/src/views/acs/history/deviceErrorInfo/index.vue @@ -0,0 +1,145 @@ + + + + + diff --git a/acs/nladmin-ui/src/views/acs/history/instRecord/index.vue b/acs/nladmin-ui/src/views/acs/history/instRecord/index.vue index 5c24d60bc..982e32e8e 100644 --- a/acs/nladmin-ui/src/views/acs/history/instRecord/index.vue +++ b/acs/nladmin-ui/src/views/acs/history/instRecord/index.vue @@ -113,7 +113,7 @@ - +