From 51a2fed110bd71f1e02f50c952a50a78063781da Mon Sep 17 00:00:00 2001 From: "USER-20220102CG\\noblelift" <546428999@qq.com> Date: Mon, 8 Aug 2022 14:49:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=B8=89=E8=89=B2=E7=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../acs/agv/server/impl/AgvServiceImpl.java | 49 +++++++++++++++++++ .../LampThreecolorDeviceDriver.java | 8 +-- .../main/java/org/nl/acs/opc/DeviceType.java | 3 +- .../nl/modules/quartz/task/AutoCleanLog.java | 1 + 4 files changed, 54 insertions(+), 7 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 aa23773..c6ee065 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 @@ -15,6 +15,7 @@ import org.nl.acs.config.server.AcsConfigService; import org.nl.acs.device.service.DeviceService; import org.nl.acs.device.service.impl.DeviceServiceImpl; import org.nl.acs.device_driver.agv_site.AgvSiteDeviceDriver; +import org.nl.acs.device_driver.lamp_three_color.LampThreecolorDeviceDriver; import org.nl.acs.device_driver.machines_site.MachinesSiteDeviceDriver; import org.nl.acs.device_driver.magic3.Magic3DeviceDriver; import org.nl.acs.device_driver.ndxy_special_two.NdxySpecialTwoDeviceDriver; @@ -1348,6 +1349,7 @@ public class AgvServiceImpl implements AgvService { break; default: StandardAutodoorDeviceDriver autodoor; + LampThreecolorDeviceDriver lampThreecolorDeviceDriver; Device doordevice = deviceAppService.findDeviceByCode(device); if (ObjectUtil.isEmpty(doordevice)) { throw new BadRequestException("未找到对应设备"); @@ -1363,6 +1365,17 @@ public class AgvServiceImpl implements AgvService { log.info("下发关门请求"); } } + if (doordevice.getDeviceDriver() instanceof LampThreecolorDeviceDriver) { + lampThreecolorDeviceDriver = (LampThreecolorDeviceDriver) doordevice.getDeviceDriver(); + if (StrUtil.equals("open", param)) { + lampThreecolorDeviceDriver.OpenOrClose("3"); + log.info("下发红灯"); + + } else if (StrUtil.equals("close", param)) { + lampThreecolorDeviceDriver.OpenOrClose("2"); + log.info("下发绿灯"); + } + } break; } @@ -1400,6 +1413,22 @@ public class AgvServiceImpl implements AgvService { JSONObject jo = JSONObject.fromObject(mes); ja.add(jo); } + + List list2 = deviceAppService.findDevice(DeviceType.三色灯); + for (int i = 0; i < list.size(); i++) { + Device doordevice = deviceAppService.findDeviceByCode(list.get(i).getDevice_code()); + if (ObjectUtil.isEmpty(doordevice)) { + throw new BadRequestException("未找到对应设备"); + } + String mes = null; + LampThreecolorDeviceDriver lampThreecolorDeviceDriver; + if (doordevice.getDeviceDriver() instanceof LampThreecolorDeviceDriver) { + lampThreecolorDeviceDriver = (LampThreecolorDeviceDriver) doordevice.getDeviceDriver(); + mes = lampThreecolorDeviceDriver.getStatus(); + } + JSONObject jo = JSONObject.fromObject(mes); + ja.add(jo); + } log.info("AGV查询自动门状态,反馈:{}", ja.toString()); return ja.toString(); @@ -1414,6 +1443,11 @@ public class AgvServiceImpl implements AgvService { autodoor = (StandardAutodoorDeviceDriver) doordevice.getDeviceDriver(); mes = autodoor.getStatus(); } + LampThreecolorDeviceDriver lampThreecolorDeviceDriver; + if (doordevice.getDeviceDriver() instanceof LampThreecolorDeviceDriver) { + lampThreecolorDeviceDriver = (LampThreecolorDeviceDriver) doordevice.getDeviceDriver(); + mes = lampThreecolorDeviceDriver.getStatus(); + } JSONObject jo = JSONObject.fromObject(mes); log.info("AGV查询自动门状态,反馈:{}", jo.toString()); return jo.toString(); @@ -1440,6 +1474,21 @@ public class AgvServiceImpl implements AgvService { JSONObject jo = JSONObject.fromObject(mes); ja.add(jo); } + List list2 = deviceAppService.findDevice(DeviceType.三色灯); + for (int i = 0; i < list2.size(); i++) { + Device doordevice = deviceAppService.findDeviceByCode(list2.get(i).getDevice_code()); + if (ObjectUtil.isEmpty(doordevice)) { + throw new BadRequestException("未找到对应设备"); + } + String mes = null; + LampThreecolorDeviceDriver lampThreecolorDeviceDriver; + if (doordevice.getDeviceDriver() instanceof LampThreecolorDeviceDriver) { + lampThreecolorDeviceDriver = (LampThreecolorDeviceDriver) doordevice.getDeviceDriver(); + mes = lampThreecolorDeviceDriver.getStatus(); + } + JSONObject jo = JSONObject.fromObject(mes); + ja.add(jo); + } log.info("AGV查询全部自动门状态,反馈:{}", ja.toString()); return ja.toString(); } diff --git a/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lamp_three_color/LampThreecolorDeviceDriver.java b/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lamp_three_color/LampThreecolorDeviceDriver.java index ec12ac2..1535954 100644 --- a/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lamp_three_color/LampThreecolorDeviceDriver.java +++ b/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lamp_three_color/LampThreecolorDeviceDriver.java @@ -121,17 +121,13 @@ public class LampThreecolorDeviceDriver extends AbstractOpcDeviceDriver implemen public synchronized String getStatus() { JSONObject jo = new JSONObject(); - if (action == 1) { + if (action == 2) { jo.put("name", this.getDevice().getDevice_code()); jo.put("status", "OPEN"); - } else if (action == 2) { - jo.put("name", this.getDevice().getDevice_code()); - jo.put("status", "CLOSE"); - } else { jo.put("name", this.getDevice().getDevice_code()); - jo.put("status", "ERROR"); + jo.put("status", "CLOSE"); } return jo.toString(); } diff --git a/hd/nladmin-system/src/main/java/org/nl/acs/opc/DeviceType.java b/hd/nladmin-system/src/main/java/org/nl/acs/opc/DeviceType.java index f4daf6b..38e71d8 100644 --- a/hd/nladmin-system/src/main/java/org/nl/acs/opc/DeviceType.java +++ b/hd/nladmin-system/src/main/java/org/nl/acs/opc/DeviceType.java @@ -16,7 +16,8 @@ public enum DeviceType { plcDb("plcDb块", 13), autodoor("自动门", 14), shadow("影子设备", 20), - other("其他设备", 14); + 三色灯("三色灯",16), + other("其他设备", 15); private String description; private int order; diff --git a/hd/nladmin-system/src/main/java/org/nl/modules/quartz/task/AutoCleanLog.java b/hd/nladmin-system/src/main/java/org/nl/modules/quartz/task/AutoCleanLog.java index a7f8987..3d42473 100644 --- a/hd/nladmin-system/src/main/java/org/nl/modules/quartz/task/AutoCleanLog.java +++ b/hd/nladmin-system/src/main/java/org/nl/modules/quartz/task/AutoCleanLog.java @@ -25,6 +25,7 @@ public class AutoCleanLog { WQLObject logTab = WQLObject.getWQLObject("sys_log"); int days = Integer.parseInt(acsConfigService.findConfigFromCache().get(AcsConfig.AutoCleanDays)); logTab.delete("DATE(create_time) <= DATE(DATE_SUB(NOW(),INTERVAL " + days + " day)) limit 50"); + log.info("自动清理日志执行成功...!"); }