Browse Source

fix 记录日志

master
汪菘 2 years ago
parent
commit
351995334e
  1. 162
      acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/agv/xg_agv/XgagvDeviceDriver.java
  2. 2
      acs/nladmin-system/src/main/java/org/nl/modules/lucence/service/dto/LuceneLogDto.java

162
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);
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<String, Object> itemMap = new HashMap<String, Object>();
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);

2
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 {
/* 日志标识 */

Loading…
Cancel
Save