From 351995334e6d47bbd23627c6a4644f7a36c1d6ba Mon Sep 17 00:00:00 2001 From: "USER-20220102CG\\noblelift" <546428999@qq.com> Date: Sun, 23 Apr 2023 14:52:54 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E8=AE=B0=E5=BD=95=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../agv/xg_agv/XgagvDeviceDriver.java | 164 ++++++++++++------ .../lucence/service/dto/LuceneLogDto.java | 2 + 2 files changed, 114 insertions(+), 52 deletions(-) diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/agv/xg_agv/XgagvDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/agv/xg_agv/XgagvDeviceDriver.java index 216af47..6d34438 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/agv/xg_agv/XgagvDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/agv/xg_agv/XgagvDeviceDriver.java @@ -172,31 +172,34 @@ public class XgagvDeviceDriver extends AbstractOpcDeviceDriver implements Device stop = this.itemProtocol.getStop(); if (home_relocation != last_home_relocation) { - LuceneLogDto logDto = new LuceneLogDto(); - logDto.setDevice_code(device_code); - logDto.setContent("信号" + this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.device_code + "." + ItemProtocol.to_home_relocation + "变更从" + this.last_home_relocation + "->" + this.home_relocation); - luceneExecuteLogService.deviceExecuteLog(logDto); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("信号" + this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.device_code + "." + ItemProtocol.to_home_relocation + "变更从" + this.last_home_relocation + "->" + this.home_relocation) + .build(); + luceneExecuteLogService.deviceExecuteLog(logDto); } if (stop != last_stop) { - LuceneLogDto logDto = new LuceneLogDto(); - logDto.setDevice_code(device_code); - logDto.setContent("信号" + this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.device_code + "." + ItemProtocol.stop + "变更从" + this.last_stop + "->" + this.stop); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("信号" + this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.device_code + "." + ItemProtocol.stop + "变更从" + this.last_stop + "->" + this.stop) + .build(); luceneExecuteLogService.deviceExecuteLog(logDto); } if (address != last_address) { - - LuceneLogDto logDto = new LuceneLogDto(); - logDto.setDevice_code(device_code); - logDto.setContent("信号" + this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.device_code + "." + ItemProtocol.address + "变更从" + this.last_address + "->" + this.address); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("信号" + this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.device_code + "." + ItemProtocol.address + this.last_address + "->" + this.address) + .build(); luceneExecuteLogService.deviceExecuteLog(logDto); } if (electricity != last_electricity) { - LuceneLogDto logDto = new LuceneLogDto(); - logDto.setDevice_code(device_code); - logDto.setContent("信号" + this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.device_code + "." + ItemProtocol.electricity + "变更从" + this.last_electricity + "->" + this.electricity); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("信号" + this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.device_code + "." + ItemProtocol.electricity + this.last_electricity + "->" + this.electricity) + .build(); luceneExecuteLogService.deviceExecuteLog(logDto); } @@ -320,7 +323,11 @@ public class XgagvDeviceDriver extends AbstractOpcDeviceDriver implements Device Server server = ReadUtil.getServer(opcservcerid); Map itemMap = new HashMap(); itemMap.put(to_command, value); - log.info("下发信号{},值{}", to_command, value); + LuceneLogDto resplogDto = LuceneLogDto.builder() + .device_code(device_code) + .content("下发信号"+ this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.device_code + "." + key + "value:"+ value ) + .build(); + ReadUtil.write(itemMap, server); } @@ -371,13 +378,22 @@ public class XgagvDeviceDriver extends AbstractOpcDeviceDriver implements Device jo.put("device_code", this.device_code); jo.put("task_code", inst.getTask_code()); ja.add(jo); + LuceneLogDto reqlogDto = LuceneLogDto.builder() + .device_code(device_code) + .content("请求参数:"+jo) + .requestparam("请求参数:"+jo) + .method("feedAgvTaskStatus") + .build(); + luceneExecuteLogService.deviceExecuteLog(reqlogDto); HttpResponse resp = acsToWmsService.feedAgvTaskStatus(ja); - LuceneLogDto logDto = new LuceneLogDto(); - - logDto.setDevice_code(device_code); - logDto.setContent("请求参数:" + ja.toString() ); - luceneExecuteLogService.deviceExecuteLog(logDto); - luceneExecuteLogService.deviceExecuteLog(logDto); + LuceneLogDto resplogDto = LuceneLogDto.builder() + .device_code(device_code) + .content("返回参数:"+resp.body()) + .requestparam("返回参数:"+resp.body()) + .method("feedAgvTaskStatus") + .status_code(String.valueOf(resp.getStatus())) + .build(); + luceneExecuteLogService.deviceExecuteLog(resplogDto); if (resp.getStatus() ==200) { @@ -403,7 +419,22 @@ public class XgagvDeviceDriver extends AbstractOpcDeviceDriver implements Device jo.put("device_code", this.device_code); jo.put("task_code", inst.getTask_code()); ja.add(jo); + LuceneLogDto reqlogDto = LuceneLogDto.builder() + .device_code(device_code) + .content("请求参数:"+jo) + .requestparam("请求参数:"+jo) + .method("feedAgvTaskStatus") + .build(); + luceneExecuteLogService.deviceExecuteLog(reqlogDto); HttpResponse resp = acsToWmsService.feedAgvTaskStatus(ja); + LuceneLogDto resplogDto = LuceneLogDto.builder() + .device_code(device_code) + .content("返回参数:"+resp.body()) + .requestparam("返回参数:"+resp.body()) + .method("feedAgvTaskStatus") + .status_code(String.valueOf(resp.getStatus())) + .build(); + luceneExecuteLogService.deviceExecuteLog(resplogDto); if (resp.getStatus() ==200) { inst.setInstruction_status("1"); @@ -425,7 +456,22 @@ public class XgagvDeviceDriver extends AbstractOpcDeviceDriver implements Device jo.put("device_code", this.device_code); jo.put("task_code", inst.getTask_code()); ja.add(jo); + LuceneLogDto reqlogDto = LuceneLogDto.builder() + .device_code(device_code) + .content("请求参数:"+jo) + .requestparam("请求参数:"+jo) + .method("feedAgvTaskStatus") + .build(); + luceneExecuteLogService.deviceExecuteLog(reqlogDto); HttpResponse resp = acsToWmsService.feedAgvTaskStatus(ja); + LuceneLogDto resplogDto = LuceneLogDto.builder() + .device_code(device_code) + .content("返回参数:"+resp.body()) + .requestparam("返回参数:"+resp.body()) + .method("feedAgvTaskStatus") + .status_code(String.valueOf(resp.getStatus())) + .build(); + luceneExecuteLogService.deviceExecuteLog(resplogDto); if (resp.getStatus() ==200) { inst.setInstruction_status("1"); inst.setExecute_status("3"); @@ -445,14 +491,23 @@ public class XgagvDeviceDriver extends AbstractOpcDeviceDriver implements Device jo.put("device_code", this.device_code); jo.put("task_code", inst.getTask_code()); ja.add(jo); + LuceneLogDto reqlogDto = LuceneLogDto.builder() + .device_code(device_code) + .content("请求参数:"+jo) + .requestparam("请求参数:"+jo) + .method("feedAgvTaskStatus") + .build(); + luceneExecuteLogService.deviceExecuteLog(reqlogDto); HttpResponse resp = acsToWmsService.feedAgvTaskStatus(ja); + LuceneLogDto resplogDto = LuceneLogDto.builder() + .device_code(device_code) + .content("返回参数:"+resp.body()) + .requestparam("返回参数:"+resp.body()) + .method("feedAgvTaskStatus") + .status_code(String.valueOf(resp.getStatus())) + .build(); + luceneExecuteLogService.deviceExecuteLog(resplogDto); if (resp.getStatus() ==200) { - LuceneLogDto logDto = new LuceneLogDto(); - logDto.setDevice_code(device_code); - logDto.setInstruct_code(inst.getInstruction_code()); - logDto.setTask_code(inst.getTask_code()); - logDto.setContent("下发信号" + this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.device_code + "." + ItemProtocol.to_line + " value:" + 2); - luceneExecuteLogService.deviceExecuteLog(logDto); writing("to_line", 2); inst.setInstruction_status("2"); inst.setExecute_status("4"); @@ -466,12 +521,23 @@ public class XgagvDeviceDriver extends AbstractOpcDeviceDriver implements Device jo.put("status", "5"); jo.put("device_code", this.address); ja.add(jo); + LuceneLogDto reqlogDto = LuceneLogDto.builder() + .device_code(device_code) + .content("请求参数:"+jo) + .requestparam("请求参数:"+jo) + .method("feedAgvTaskStatus") + .build(); + luceneExecuteLogService.deviceExecuteLog(reqlogDto); HttpResponse resp = acsToWmsService.feedAgvTaskStatus(ja); + LuceneLogDto resplogDto = LuceneLogDto.builder() + .device_code(device_code) + .content("返回参数:"+resp.body()) + .requestparam("返回参数:"+resp.body()) + .method("feedAgvTaskStatus") + .status_code(String.valueOf(resp.getStatus())) + .build(); + luceneExecuteLogService.deviceExecuteLog(resplogDto); if (resp.getStatus() == 200) { - LuceneLogDto logDto = new LuceneLogDto(); - logDto.setDevice_code(device_code); - logDto.setContent("下发信号" + this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.device_code + "." + ItemProtocol.to_di_low + " value:" + 0); - luceneExecuteLogService.deviceExecuteLog(logDto); writing("to_di_low", 0); writing("to_di_height", 0); } else { @@ -485,10 +551,6 @@ public class XgagvDeviceDriver extends AbstractOpcDeviceDriver implements Device ja.add(jo); HttpResponse resp = acsToWmsService.feedAgvTaskStatus(ja); if (resp.getStatus() == 200) { - LuceneLogDto logDto = new LuceneLogDto(); - logDto.setDevice_code(device_code); - logDto.setContent("下发信号" + this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.device_code + "." + ItemProtocol.to_di_low + " value:" + 0); - luceneExecuteLogService.deviceExecuteLog(logDto); writing("to_di_height", 0); writing("to_di_low", 0); } else { @@ -502,10 +564,6 @@ public class XgagvDeviceDriver extends AbstractOpcDeviceDriver implements Device ja.add(jo); HttpResponse resp = acsToWmsService.feedAgvTaskStatus(ja); if (resp.getStatus() == 200) { - LuceneLogDto logDto = new LuceneLogDto(); - logDto.setDevice_code(device_code); - logDto.setContent("下发信号" + this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.device_code + "." + ItemProtocol.to_di_low + " value:" + 0); - luceneExecuteLogService.deviceExecuteLog(logDto); writing("to_di_low", 0); } else { @@ -527,12 +585,22 @@ public class XgagvDeviceDriver extends AbstractOpcDeviceDriver implements Device jo.put("status", "5"); jo.put("device_code", "A4"); ja.add(jo); + LuceneLogDto reqlogDto = LuceneLogDto.builder() + .device_code(device_code) + .content("请求参数:"+jo) + .requestparam("请求参数:"+jo) + .method("feedAgvTaskStatus") + .build(); + luceneExecuteLogService.deviceExecuteLog(reqlogDto); HttpResponse resp = acsToWmsService.feedAgvTaskStatus(ja); - if (resp.getStatus() == 200) { - LuceneLogDto logDto = new LuceneLogDto(); - logDto.setDevice_code(device_code); - logDto.setContent("下发信号" + this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.device_code + "." + ItemProtocol.to_di_low + " value:" + 0); - luceneExecuteLogService.deviceExecuteLog(logDto); + LuceneLogDto resplogDto = LuceneLogDto.builder() + .device_code(device_code) + .content("返回参数:"+resp.body()) + .requestparam("返回参数:"+resp.body()) + .method("feedAgvTaskStatus") + .status_code(String.valueOf(resp.getStatus())) + .build(); + luceneExecuteLogService.deviceExecuteLog(resplogDto); if (resp.getStatus() == 200) { writing("to_di_low", 0); writing("to_di_height", 0); } else { @@ -547,10 +615,6 @@ public class XgagvDeviceDriver extends AbstractOpcDeviceDriver implements Device ja.add(jo); HttpResponse resp = acsToWmsService.feedAgvTaskStatus(ja); if (resp.getStatus() == 200) { - LuceneLogDto logDto = new LuceneLogDto(); - logDto.setDevice_code(device_code); - logDto.setContent("下发信号" + this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.device_code + "." + ItemProtocol.to_di_low + " value:" + 0); - luceneExecuteLogService.deviceExecuteLog(logDto); writing("to_di_height", 0); writing("to_di_low", 0); } else { @@ -565,10 +629,6 @@ public class XgagvDeviceDriver extends AbstractOpcDeviceDriver implements Device ja.add(jo); HttpResponse resp = acsToWmsService.feedAgvTaskStatus(ja); if (resp.getStatus() == 200) { - LuceneLogDto logDto = new LuceneLogDto(); - logDto.setDevice_code(device_code); - logDto.setContent("下发信号" + this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.device_code + "." + ItemProtocol.to_di_low + " value:" + 0); - luceneExecuteLogService.deviceExecuteLog(logDto); writing("to_di_height", 0); } else { writing("to_di_height", 0); diff --git a/acs/nladmin-system/src/main/java/org/nl/modules/lucence/service/dto/LuceneLogDto.java b/acs/nladmin-system/src/main/java/org/nl/modules/lucence/service/dto/LuceneLogDto.java index 6d7794b..cdc0b5b 100644 --- a/acs/nladmin-system/src/main/java/org/nl/modules/lucence/service/dto/LuceneLogDto.java +++ b/acs/nladmin-system/src/main/java/org/nl/modules/lucence/service/dto/LuceneLogDto.java @@ -1,8 +1,10 @@ package org.nl.modules.lucence.service.dto; +import lombok.Builder; import lombok.Data; @Data +@Builder public class LuceneLogDto { /* 日志标识 */