From 6e12d8bd8cffc16878a6dd6ca3201720a5c5d6d1 Mon Sep 17 00:00:00 2001 From: liejiu946 Date: Thu, 16 Jan 2025 10:22:09 +0800 Subject: [PATCH] =?UTF-8?q?opt:Redis=E5=8F=8D=E9=A6=88=20=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=8F=96=E6=94=BE=E8=B4=A7=E5=AE=8C=E6=88=90=E3=80=81?= =?UTF-8?q?=E8=BD=BD=E8=B4=A7=E5=BC=80=E5=85=B3=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../run/OneNDCSocketConnectionAutoRun.java | 2 +- .../agv/ndcone/AgvNdcOneDeviceDriver.java | 18 +++++------------- .../service/impl/InstructionServiceImpl.java | 2 -- .../org/nl/quartz/task/SyncDeviceStatus.java | 5 +++-- 4 files changed, 9 insertions(+), 18 deletions(-) diff --git a/nlsso-server/src/main/java/org/nl/acs/auto/run/OneNDCSocketConnectionAutoRun.java b/nlsso-server/src/main/java/org/nl/acs/auto/run/OneNDCSocketConnectionAutoRun.java index 73457aa..53e5359 100644 --- a/nlsso-server/src/main/java/org/nl/acs/auto/run/OneNDCSocketConnectionAutoRun.java +++ b/nlsso-server/src/main/java/org/nl/acs/auto/run/OneNDCSocketConnectionAutoRun.java @@ -197,7 +197,7 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable { } else { //上报异常信息 //(不需要WCS反馈) - if (phase == 0x70 || phase == 0x71 || phase == 0x72 || phase == 0x73 || phase == 0x74) { + if (phase == 0x70 || phase == 0x71 || phase == 0x72 || phase == 0x73 || phase == 0x74 || phase == 0x75) { device = deviceAppService.findDeviceByCode(String.valueOf(agvaddr)); } else { //todo NDC根据车辆编号123456进行查找特定车辆 diff --git a/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java b/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java index f47b9eb..3b4079f 100644 --- a/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java +++ b/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java @@ -199,6 +199,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic return; } // "========================================================================请求取货=================================================================================" + agv_status = 1; //到达桁架1请求取货 if (device.getDeviceDriver() instanceof Hj1DeviceDriver) { hj1DeviceDriver = (Hj1DeviceDriver) device.getDeviceDriver(); @@ -209,7 +210,6 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic if (hj1DeviceDriver.getMode() != 0) { if (hj1DeviceDriver.getAction() == 2) { log.info("设备" + device_code + "的Action信号已变更为2允许进入,当前信号值为:Mode:" + hj1DeviceDriver.getMode() + ",Move:" + hj1DeviceDriver.getMove() + ",Action:" + hj1DeviceDriver.getAction() + ",agv开始进入取货。"); - agv_status = 1; flag = true; data = ndcAgvService.sendAgvOneModeInst(phase, index, 0); } else { @@ -236,7 +236,6 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic if (hj2DeviceDriver.getMode() != 0) { if (hj2DeviceDriver.getAction() == 2) { log.info("设备" + device_code + "的Action信号已变更为2允许进入,当前信号值为:Mode:" + hj2DeviceDriver.getMode() + ",Move:" + hj2DeviceDriver.getMove() + ",Action:" + hj2DeviceDriver.getAction() + ",agv开始进入取货。"); - agv_status = 1; flag = true; data = ndcAgvService.sendAgvOneModeInst(phase, index, 0); } else { @@ -335,6 +334,8 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic return; } // "========================================================================取货完成=================================================================================" + //反馈车辆动作 + agv_status = 2; //到达桁架1取货完成 if (device.getDeviceDriver() instanceof Hj1DeviceDriver) { hj1DeviceDriver = (Hj1DeviceDriver) device.getDeviceDriver(); @@ -343,8 +344,6 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic hj1DeviceDriver.writing(3); if (hj1DeviceDriver.getMode() == 3) { flag = true; - //反馈车辆动作 - agv_status = 0; log.info("设备" + device_code + "的Mode信号已变更为3,当前信号值为:Mode:" + hj1DeviceDriver.getMode() + ",Move:" + hj1DeviceDriver.getMove() + ",Action:" + hj1DeviceDriver.getAction() + ",开始写入0清除mode信号。"); hj1DeviceDriver.writing(0); data = actionComplete(index, inst, device_code, hj1DeviceDriver.getTo_command(), Integer.parseInt(AgvActionEnum.ACTION_STATUS.code("取货完成")), "取货完成"); @@ -371,8 +370,6 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic hj2DeviceDriver.writing(3); if (hj2DeviceDriver.getMode() == 3) { flag = true; - //反馈车辆动作 - agv_status = 0; log.info("设备" + device_code + "的Mode信号已变更为3,当前信号值为:Mode:" + hj2DeviceDriver.getMode() + ",Move:" + hj2DeviceDriver.getMove() + ",Action:" + hj2DeviceDriver.getAction() + ",开始写入0清除mode信号。"); hj2DeviceDriver.writing(0); data = actionComplete(index, inst, device_code, hj2DeviceDriver.getTo_command(), Integer.parseInt(AgvActionEnum.ACTION_STATUS.code("取货完成")), "取货完成"); @@ -398,8 +395,6 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic log.info("agv进入" + device_code + ",取货完成,开始写入信号3进行安全交互,当前信号值为:Mode:" + ssxDeviceDriver.getMode() + ",Move:" + ssxDeviceDriver.getMove() + ",Action:" + ssxDeviceDriver.getAction()); ssxDeviceDriver.writing(3); if (ssxDeviceDriver.getMode() == 3) { - //反馈车辆动作 - agv_status = 2; flag = true; log.info("设备" + device_code + "的Mode信号已变更为3,当前信号值为:Mode:" + ssxDeviceDriver.getMode() + ",Move:" + ssxDeviceDriver.getMove() + ",Action:" + ssxDeviceDriver.getAction() + ",开始写入0清除mode信号。"); ssxDeviceDriver.writing(0); @@ -463,6 +458,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic return; } // "========================================================================请求放货=================================================================================" + agv_status = 3; //到达桁架1请求放货 if (device.getDeviceDriver() instanceof Hj1DeviceDriver) { hj1DeviceDriver = (Hj1DeviceDriver) device.getDeviceDriver(); @@ -473,7 +469,6 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic if (hj1DeviceDriver.getMode() != 0 && hj1DeviceDriver.getMove() == 0) { if (hj1DeviceDriver.getAction() == 3) { log.info("设备" + device_code + "的Action信号已变更为3允许进入,当前信号值为:Mode:" + hj1DeviceDriver.getMode() + ",Move:" + hj1DeviceDriver.getMove() + ",Action:" + hj1DeviceDriver.getAction() + ",agv开始进入放货。"); - agv_status = 2; flag = true; data = getData(data, index, inst, task); } else { @@ -509,7 +504,6 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic if (hj2DeviceDriver.getMode() != 0 && hj2DeviceDriver.getMove() == 0) { if (hj2DeviceDriver.getAction() == 3) { log.info("设备" + device_code + "的Action信号已变更为3允许进入,当前信号值为:Mode:" + hj2DeviceDriver.getMode() + ",Move:" + hj2DeviceDriver.getMove() + ",Action:" + hj2DeviceDriver.getAction() + ",agv开始进入放货。"); - agv_status = 2; flag = true; data = getData(data, index, inst, task); } else { @@ -605,6 +599,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic } transportOrder = ""; // "========================================================================放货完成=================================================================================" + agv_status = 4; //到达桁架1放货完成 if (device.getDeviceDriver() instanceof Hj1DeviceDriver) { hj1DeviceDriver = (Hj1DeviceDriver) device.getDeviceDriver(); @@ -613,7 +608,6 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic if (hj1DeviceDriver.getMode() == 4) { log.info("设备" + device_code + "的Mode信号已变更为4,当前信号值为:Mode:" + hj1DeviceDriver.getMode() + ",Move:" + hj1DeviceDriver.getMove() + ",Action:" + hj1DeviceDriver.getAction() + ",开始写入0清除mode信号。"); hj1DeviceDriver.writing(0); - agv_status = 0; flag = true; data = actionComplete(index, inst, device_code, hj1DeviceDriver.getTo_command(), Integer.parseInt(AgvActionEnum.ACTION_STATUS.code("放货完成")), "放货完成"); log.info("设备" + device_code + "已完成信号0写入,当前信号值为:" + "Mode:" + hj1DeviceDriver.getMode() + ",Move:" + hj1DeviceDriver.getMove() + ",Action:" + hj1DeviceDriver.getAction() + ",agv开始离开。"); @@ -632,7 +626,6 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic if (hj2DeviceDriver.getMode() == 4) { log.info("设备" + device_code + "的Mode信号已变更为4,当前信号值为:Mode:" + hj2DeviceDriver.getMode() + ",Move:" + hj2DeviceDriver.getMove() + ",Action:" + hj2DeviceDriver.getAction() + ",开始写入0清除mode信号。"); hj2DeviceDriver.writing(0); - agv_status = 0; flag = true; data = actionComplete(index, inst, device_code, hj2DeviceDriver.getTo_command(), Integer.parseInt(AgvActionEnum.ACTION_STATUS.code("放货完成")), "放货完成"); log.info("设备" + device_code + "已完成信号0写入,当前信号值为:" + "Mode:" + hj2DeviceDriver.getMode() + ",Move:" + hj2DeviceDriver.getMove() + ",Action:" + hj2DeviceDriver.getAction() + ",agv开始离开。"); @@ -651,7 +644,6 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic if (ssxDeviceDriver.getMode() == 4) { log.info("设备" + device_code + "的Mode信号已变更为4,当前信号值为:Mode:" + ssxDeviceDriver.getMode() + ",Move:" + ssxDeviceDriver.getMove() + ",Action:" + ssxDeviceDriver.getAction() + ",开始写入0清除mode信号。"); ssxDeviceDriver.writing(0); - agv_status = 0; flag = true; data = actionComplete(index, inst, device_code, ssxDeviceDriver.getTo_command(), Integer.parseInt(AgvActionEnum.ACTION_STATUS.code("放货完成")), "放货完成"); log.info("设备" + device_code + "已完成信号0写入,当前信号值为:" + "Mode:" + ssxDeviceDriver.getMode() + ",Move:" + ssxDeviceDriver.getMove() + ",Action:" + ssxDeviceDriver.getAction() + ",agv开始离开。"); diff --git a/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java b/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java index 946998c..613af1a 100644 --- a/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java +++ b/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java @@ -1053,8 +1053,6 @@ public class InstructionServiceImpl extends CommonServiceImpl(taskMapper) .eq(Task::getTask_id, insttaskid) diff --git a/nlsso-server/src/main/java/org/nl/quartz/task/SyncDeviceStatus.java b/nlsso-server/src/main/java/org/nl/quartz/task/SyncDeviceStatus.java index 0af9171..63656bb 100644 --- a/nlsso-server/src/main/java/org/nl/quartz/task/SyncDeviceStatus.java +++ b/nlsso-server/src/main/java/org/nl/quartz/task/SyncDeviceStatus.java @@ -68,14 +68,15 @@ public class SyncDeviceStatus { JSONObject json = new JSONObject(); json.put("device_code", agvNdcOneDeviceDriver.getDevice_code()); json.put("device_name", agvNdcOneDeviceDriver.getDevice_code()); - json.put("device_status", AgvActionEnum.DEVICE_STATUS.check(String.valueOf(agvNdcOneDeviceDriver.getStatus()))); - json.put("agv_status", AgvActionEnum.DEVICE_STATUS.check(String.valueOf(agvNdcOneDeviceDriver.getAgv_status()))); + json.put("device_status", agvNdcOneDeviceDriver.getStatus()); + json.put("agv_status", AgvActionEnum.ACTION_STATUS.check(String.valueOf(agvNdcOneDeviceDriver.getAgv_status()))); json.put("energyLevel", agvNdcOneDeviceDriver.getElectric_qty()); json.put("transportOrder", agvNdcOneDeviceDriver.getTransportOrder()); json.put("positionX", agvNdcOneDeviceDriver.getX()); json.put("positionY", agvNdcOneDeviceDriver.getY()); json.put("positionAngle", agvNdcOneDeviceDriver.getAngle()); json.put("message", agvNdcOneDeviceDriver.getAgv_message()); + json.put("isLaden", agvNdcOneDeviceDriver.getIs_have()); AGV.add(json); } }