opt:烘箱优化

This commit is contained in:
2026-04-24 15:11:46 +08:00
parent 97a762e454
commit 64b7301fd8

View File

@@ -54,6 +54,7 @@ import org.nl.system.service.param.ISysParamService;
import org.nl.config.SpringContextHolder; import org.nl.config.SpringContextHolder;
import java.time.LocalTime; import java.time.LocalTime;
import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.Map; import java.util.Map;
@@ -116,6 +117,15 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
public synchronized void processSocket(int[] arr) throws Exception { public synchronized void processSocket(int[] arr) throws Exception {
device_code = this.getDeviceCode(); device_code = this.getDeviceCode();
// 方法入口日志:记录接收到的原始数据
LuceneLogDto entryLog = LuceneLogDto.builder()
.device_code(device_code)
.content("[processSocket] 开始处理AGV数据, arr长度:" + arr.length + ", device_code:" + device_code)
.build();
entryLog.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(entryLog);
byte[] data = null; byte[] data = null;
phase = arr[16] * 256 + arr[17]; phase = arr[16] * 256 + arr[17];
// agv任务号 // agv任务号
@@ -128,10 +138,26 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
agvaddr = arr[18] * 256 + arr[19]; agvaddr = arr[18] * 256 + arr[19];
//车号 //车号
int carno = arr[20]; int carno = arr[20];
// 记录关键参数
LuceneLogDto paramLog = LuceneLogDto.builder()
.device_code(device_code)
.content("[AGV参数] phase:" + phase + "(0x" + Integer.toHexString(phase) + "), index:" + index + ", ikey:" + ikey + ", agvaddr:" + agvaddr + ", carno:" + carno)
.build();
paramLog.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(paramLog);
Instruction inst = null; Instruction inst = null;
Device agv_device = null; Device agv_device = null;
if (carno != 0) { if (carno != 0) {
agv_device = deviceAppService.findDeviceByCode(String.valueOf(carno)); agv_device = deviceAppService.findDeviceByCode(String.valueOf(carno));
// AGV设备查询日志
LuceneLogDto agvDeviceLog = LuceneLogDto.builder()
.device_code(device_code)
.content("[AGV设备查询] carno:" + carno + ", 设备存在:" + (agv_device != null))
.build();
agvDeviceLog.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(agvDeviceLog);
} }
TaskDto task = null; TaskDto task = null;
if (ikey != 0) { if (ikey != 0) {
@@ -140,15 +166,18 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
this.instruction = inst; this.instruction = inst;
} }
if (ObjectUtil.isNotEmpty(inst)) { if (ObjectUtil.isNotEmpty(inst)) {
// log.info("该指令号未找到对应指令:" + ikey);
// message = "该指令号未找到对应指令:" + ikey;
// logServer.deviceExecuteLog(this.device_code, "", "", "该指令号未找到对应指令:" + ikey);
// return;
task = taskService.findByTaskCode(inst.getTask_code()); task = taskService.findByTaskCode(inst.getTask_code());
// 任务查询日志
LuceneLogDto taskLog = LuceneLogDto.builder()
.device_code(device_code)
.content("[任务查询] ikey:" + ikey + ", 指令存在, task_code:" + inst.getTask_code() + ", task存在:" + (task != null))
.build();
taskLog.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(taskLog);
} else { } else {
LuceneLogDto logDto = LuceneLogDto.builder() LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code) .device_code(device_code)
.content("指令号为空!") .content("[指令查询] 未找到指令号:" + ikey)
.build(); .build();
logDto.setLog_level(4); logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto); luceneExecuteLogService.deviceExecuteLog(logDto);
@@ -262,15 +291,28 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
luceneExecuteLogService.deviceExecuteLog(logDto3); luceneExecuteLogService.deviceExecuteLog(logDto3);
HttpResponse httpResponse2 = acsToWcsService.feedbackTaskStatusToWcs(param3); HttpResponse httpResponse2 = acsToWcsService.feedbackTaskStatusToWcs(param3);
if (ObjectUtil.isNotEmpty(httpResponse2)) { if (ObjectUtil.isNotEmpty(httpResponse2)) {
JSONObject param2 = new JSONObject(); String responseBody = httpResponse2.body();
param2.put("device_code", device_code); JSONObject responseJson = JSONObject.parseObject(responseBody);
int responseCode = responseJson.getIntValue("responseCode");
LuceneLogDto logDto2 = LuceneLogDto.builder() LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(device_code) .device_code(device_code)
.content("申请取货返回参数:" + param2) .content("申请取货返回参数:" + responseBody)
.build(); .build();
logDto2.setLog_level(4); logDto2.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto2); luceneExecuteLogService.deviceExecuteLog(logDto2);
// 判断 responseCode 是否为 0非 0 则返回
if (responseCode != 0) {
LuceneLogDto errorLog = LuceneLogDto.builder()
.device_code(device_code)
.content("WCS反馈失败, responseCode:" + responseCode
+ ", responseMessage:" + responseJson.getString("responseMessage"))
.build();
errorLog.setLog_level(2);
luceneExecuteLogService.deviceExecuteLog(errorLog);
return;
}
} }
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
@@ -326,26 +368,68 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
else if (device.getDeviceDriver() instanceof HongXiangStationDeviceDriver) { else if (device.getDeviceDriver() instanceof HongXiangStationDeviceDriver) {
hongXiangStationDeviceDriver = (HongXiangStationDeviceDriver) device.getDeviceDriver(); hongXiangStationDeviceDriver = (HongXiangStationDeviceDriver) device.getDeviceDriver();
// 烘箱交互日志:开始处理烘箱取货
LuceneLogDto ovenLog = LuceneLogDto.builder()
.device_code(device_code)
.content("[烘箱交互] 到达取货点, ovenNo:" + hongXiangLocationInfo.getOvenNo()
+ ", shutterDoor:" + hongXiangLocationInfo.getShutterDoor()
+ ", storageNo:" + hongXiangLocationInfo.getStorageNo())
.build();
ovenLog.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(ovenLog);
//判断对应点位是卷帘门是否开门到位 //判断对应点位是卷帘门是否开门到位
int door_open = (int) hongXiangStationDeviceDriver.getPropertyValue("item_oven" int door_open = (int) hongXiangStationDeviceDriver.getPropertyValue("item_oven"
+ hongXiangLocationInfo.getOvenNo() + hongXiangLocationInfo.getOvenNo()
+ "_door" + "_door"
+ hongXiangLocationInfo.getShutterDoor() + "_open"); + hongXiangLocationInfo.getShutterDoor() + "_open");
// 记录门状态
LuceneLogDto doorStatusLog = LuceneLogDto.builder()
.device_code(device_code)
.content("[烘箱门状态] oven" + hongXiangLocationInfo.getOvenNo()
+ "_door" + hongXiangLocationInfo.getShutterDoor() + "_open = " + door_open)
.build();
doorStatusLog.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(doorStatusLog);
if (door_open != 1) { if (door_open != 1) {
hongXiangStationDeviceDriver.writing("to_oven" // 下发开门指令
+ hongXiangLocationInfo.getOvenNo() String doorOpenCmd = "to_oven" + hongXiangLocationInfo.getOvenNo()
+ "_door" + "_door" + hongXiangLocationInfo.getShutterDoor() + "_open";
+ hongXiangLocationInfo.getShutterDoor() + "_open","2"); LuceneLogDto doorOpenLog = LuceneLogDto.builder()
.device_code(device_code)
.content("[烘箱指令] 下发开门指令: " + doorOpenCmd + " = 2")
.build();
doorOpenLog.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(doorOpenLog);
hongXiangStationDeviceDriver.writing(doorOpenCmd, "2");
return; return;
} }
//到达取货点 //到达取货点
//门已经开了,此时请求取料 //门已经开了,此时请求取料
// to_oven1_door1_storage // to_oven1_door1_storage
hongXiangStationDeviceDriver.writing("to_oven" String storageCmd = "to_oven" + hongXiangLocationInfo.getOvenNo()
+ hongXiangLocationInfo.getOvenNo() + "_door" + hongXiangLocationInfo.getShutterDoor() + "_storage";
+ "_door" LuceneLogDto storageLog = LuceneLogDto.builder()
+ hongXiangLocationInfo.getShutterDoor() + "_storage",String.valueOf(hongXiangLocationInfo.getStorageNo())); .device_code(device_code)
.content("[烘箱指令] 下发取料指令: " + storageCmd + " = " + hongXiangLocationInfo.getStorageNo())
.build();
storageLog.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(storageLog);
hongXiangStationDeviceDriver.writing(storageCmd, String.valueOf(hongXiangLocationInfo.getStorageNo()));
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
// AGV反馈日志
LuceneLogDto agvFeedbackLog = LuceneLogDto.builder()
.device_code(device_code)
.content("[AGV反馈] 取货点处理完成, phase:" + phase + ", 反馈数据:" + Arrays.toString(data))
.build();
agvFeedbackLog.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(agvFeedbackLog);
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data); logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
} else { } else {
LuceneLogDto logDto = LuceneLogDto.builder() LuceneLogDto logDto = LuceneLogDto.builder()
@@ -431,44 +515,84 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
//取货完毕 //取货完毕
// to_oven1_door1_storage // to_oven1_door1_storage
hongXiangStationDeviceDriver.writing("to_oven" String completeCmd = "to_oven" + hongXiangLocationInfo.getOvenNo()
+ hongXiangLocationInfo.getOvenNo() + "_door" + hongXiangLocationInfo.getShutterDoor() + "_completed";
+ "_door"
+ hongXiangLocationInfo.getShutterDoor() + "_completed","1"); // 烘箱取货完成日志
LuceneLogDto ovenCompleteLog = LuceneLogDto.builder()
.device_code(device_code)
.content("[烘箱交互] 取货完成, ovenNo:" + hongXiangLocationInfo.getOvenNo()
+ ", shutterDoor:" + hongXiangLocationInfo.getShutterDoor())
.build();
ovenCompleteLog.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(ovenCompleteLog);
LuceneLogDto completeCmdLog = LuceneLogDto.builder()
.device_code(device_code)
.content("[烘箱指令] 下发取货完成指令: " + completeCmd + " = 1")
.build();
completeCmdLog.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(completeCmdLog);
hongXiangStationDeviceDriver.writing(completeCmd, "1");
} }
else { else {
LuceneLogDto logDto = LuceneLogDto.builder() LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode()) .device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data) .content("[设备处理] 其他设备类型, agvphase:" + phase + ", data:" + data)
.build(); .build();
logDto.setLog_level(4); logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto); luceneExecuteLogService.deviceExecuteLog(logDto);
} }
//更新agv状态 //更新agv状态 - WCS系统交互
JSONObject param3 = new JSONObject(); JSONObject param3 = new JSONObject();
param3.put("containerCode", inst.getVehicle_code()); param3.put("containerCode", inst.getVehicle_code());
param3.put("taskCode", inst.getTask_code()); param3.put("taskCode", inst.getTask_code());
param3.put("carId", inst.getCarno()); param3.put("carId", inst.getCarno());
param3.put("taskType", inst.getInstruction_type()); param3.put("taskType", inst.getInstruction_type());
param3.put("feedbackStatus", FeedbackStatusEnum.TAKE_FINISH.getCode()); param3.put("feedbackStatus", FeedbackStatusEnum.TAKE_FINISH.getCode());
LuceneLogDto logDto3 = LuceneLogDto.builder()
.device_code(device_code)
.content("取货完成,参数:" + param3)
.build();
logDto3.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto3);
HttpResponse httpResponse2 = acsToWcsService.feedbackTaskStatusToWcs(param3);
if (ObjectUtil.isNotEmpty(httpResponse2)) {
JSONObject param2 = new JSONObject();
param2.put("device_code", device_code);
LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(device_code)
.content("取货完成返回参数:" + param2)
.build();
logDto2.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto2);
// WCS交互日志
LuceneLogDto wcsLog = LuceneLogDto.builder()
.device_code(device_code)
.content("[WCS交互] 反馈取货完成, 参数:" + param3.toJSONString())
.build();
wcsLog.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(wcsLog);
HttpResponse httpResponse2 = acsToWcsService.feedbackTaskStatusToWcs(param3);
if (ObjectUtil.isNotEmpty(httpResponse2)) {
String responseBody = httpResponse2.body();
JSONObject responseJson = JSONObject.parseObject(responseBody);
int responseCode = responseJson.getIntValue("responseCode");
LuceneLogDto wcsResponseLog = LuceneLogDto.builder()
.device_code(device_code)
.content("[WCS响应] 取货完成响应, status:" + httpResponse2.getStatus() + ", body:" + responseBody)
.build();
wcsResponseLog.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(wcsResponseLog);
// 判断 responseCode 是否为 0非 0 则返回
if (responseCode != 0) {
LuceneLogDto errorLog = LuceneLogDto.builder()
.device_code(device_code)
.content("[WCS响应] 取货完成失败, responseCode:" + responseCode
+ ", responseMessage:" + responseJson.getString("responseMessage"))
.build();
errorLog.setLog_level(2);
luceneExecuteLogService.deviceExecuteLog(errorLog);
return;
}
} else {
LuceneLogDto wcsNullLog = LuceneLogDto.builder()
.device_code(device_code)
.content("[WCS响应] 取货完成响应为空")
.build();
wcsNullLog.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(wcsNullLog);
} }
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
@@ -535,15 +659,28 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
luceneExecuteLogService.deviceExecuteLog(logDto3); luceneExecuteLogService.deviceExecuteLog(logDto3);
HttpResponse httpResponse2 = acsToWcsService.feedbackTaskStatusToWcs(param3); HttpResponse httpResponse2 = acsToWcsService.feedbackTaskStatusToWcs(param3);
if (ObjectUtil.isNotEmpty(httpResponse2)) { if (ObjectUtil.isNotEmpty(httpResponse2)) {
JSONObject param2 = new JSONObject(); String responseBody = httpResponse2.body();
param2.put("device_code", device_code); JSONObject responseJson = JSONObject.parseObject(responseBody);
int responseCode = responseJson.getIntValue("responseCode");
LuceneLogDto logDto2 = LuceneLogDto.builder() LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(device_code) .device_code(device_code)
.content("申请放货返回参数:" + param2) .content("申请放货返回参数:" + responseBody)
.build(); .build();
logDto2.setLog_level(4); logDto2.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto2); luceneExecuteLogService.deviceExecuteLog(logDto2);
// 判断 responseCode 是否为 0非 0 则返回
if (responseCode != 0) {
LuceneLogDto errorLog = LuceneLogDto.builder()
.device_code(device_code)
.content("WCS反馈失败, responseCode:" + responseCode
+ ", responseMessage:" + responseJson.getString("responseMessage"))
.build();
errorLog.setLog_level(2);
luceneExecuteLogService.deviceExecuteLog(errorLog);
return;
}
} }
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
@@ -596,32 +733,72 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
else if (device.getDeviceDriver() instanceof HongXiangStationDeviceDriver) { else if (device.getDeviceDriver() instanceof HongXiangStationDeviceDriver) {
hongXiangStationDeviceDriver = (HongXiangStationDeviceDriver) device.getDeviceDriver(); hongXiangStationDeviceDriver = (HongXiangStationDeviceDriver) device.getDeviceDriver();
// 烘箱放货点日志
LuceneLogDto ovenPutLog = LuceneLogDto.builder()
.device_code(device_code)
.content("[烘箱交互] 到达放货点, ovenNo:" + hongXiangLocationInfo.getOvenNo()
+ ", shutterDoor:" + hongXiangLocationInfo.getShutterDoor()
+ ", storageNo:" + hongXiangLocationInfo.getStorageNo())
.build();
ovenPutLog.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(ovenPutLog);
//判断对应点位是卷帘门是否开门到位 //判断对应点位是卷帘门是否开门到位
int door_open = (int) hongXiangStationDeviceDriver.getPropertyValue("item_oven" int door_open = (int) hongXiangStationDeviceDriver.getPropertyValue("item_oven"
+ hongXiangLocationInfo.getOvenNo() + hongXiangLocationInfo.getOvenNo()
+ "_door" + "_door"
+ hongXiangLocationInfo.getShutterDoor() + "_open"); + hongXiangLocationInfo.getShutterDoor() + "_open");
// 门状态日志
LuceneLogDto doorStatusLog = LuceneLogDto.builder()
.device_code(device_code)
.content("[烘箱门状态] oven" + hongXiangLocationInfo.getOvenNo()
+ "_door" + hongXiangLocationInfo.getShutterDoor() + "_open = " + door_open)
.build();
doorStatusLog.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(doorStatusLog);
if (door_open != 1) { if (door_open != 1) {
hongXiangStationDeviceDriver.writing("to_oven" String doorOpenCmd = "to_oven" + hongXiangLocationInfo.getOvenNo()
+ hongXiangLocationInfo.getOvenNo() + "_door" + hongXiangLocationInfo.getShutterDoor() + "_open";
+ "_door" LuceneLogDto doorOpenLog = LuceneLogDto.builder()
+ hongXiangLocationInfo.getShutterDoor() + "_open","1"); .device_code(device_code)
.content("[烘箱指令] 下发开门指令: " + doorOpenCmd + " = 1")
.build();
doorOpenLog.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(doorOpenLog);
hongXiangStationDeviceDriver.writing(doorOpenCmd, "1");
return; return;
} }
//门已经开了,此时请求取料 //门已经开了,此时请求放货
// to_oven1_door1_storage String storageCmd = "to_oven" + hongXiangLocationInfo.getOvenNo()
hongXiangStationDeviceDriver.writing("to_oven" + "_door" + hongXiangLocationInfo.getShutterDoor() + "_storage";
+ hongXiangLocationInfo.getOvenNo() LuceneLogDto storageLog = LuceneLogDto.builder()
+ "_door" .device_code(device_code)
+ hongXiangLocationInfo.getShutterDoor() + "_storage",String.valueOf(hongXiangLocationInfo.getStorageNo())); .content("[烘箱指令] 下发放货指令: " + storageCmd + " = " + hongXiangLocationInfo.getStorageNo())
.build();
storageLog.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(storageLog);
hongXiangStationDeviceDriver.writing(storageCmd, String.valueOf(hongXiangLocationInfo.getStorageNo()));
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
// AGV反馈日志
LuceneLogDto agvFeedbackLog = LuceneLogDto.builder()
.device_code(device_code)
.content("[AGV反馈] 放货点处理完成, phase:" + phase + ", 反馈数据:" + Arrays.toString(data))
.build();
agvFeedbackLog.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(agvFeedbackLog);
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data); logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
} else { } else {
LuceneLogDto logDto = LuceneLogDto.builder() LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode()) .device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data) .content("[设备处理] 其他设备类型, agvphase:" + phase + ", data:" + data)
.build(); .build();
logDto.setLog_level(4); logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto); luceneExecuteLogService.deviceExecuteLog(logDto);
@@ -690,45 +867,85 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
//烘箱 //烘箱
else if (device.getDeviceDriver() instanceof HongXiangStationDeviceDriver) { else if (device.getDeviceDriver() instanceof HongXiangStationDeviceDriver) {
hongXiangStationDeviceDriver = (HongXiangStationDeviceDriver) device.getDeviceDriver(); hongXiangStationDeviceDriver = (HongXiangStationDeviceDriver) device.getDeviceDriver();
hongXiangStationDeviceDriver.writing("to_oven"
+ hongXiangLocationInfo.getOvenNo() // 烘箱放货完成日志
+ "_door" LuceneLogDto ovenPutCompleteLog = LuceneLogDto.builder()
+ hongXiangLocationInfo.getShutterDoor() + "_completed","1"); .device_code(device_code)
.content("[烘箱交互] 放货完成, ovenNo:" + hongXiangLocationInfo.getOvenNo()
+ ", shutterDoor:" + hongXiangLocationInfo.getShutterDoor())
.build();
ovenPutCompleteLog.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(ovenPutCompleteLog);
String completeCmd = "to_oven" + hongXiangLocationInfo.getOvenNo()
+ "_door" + hongXiangLocationInfo.getShutterDoor() + "_completed";
LuceneLogDto completeCmdLog = LuceneLogDto.builder()
.device_code(device_code)
.content("[烘箱指令] 下发放货完成指令: " + completeCmd + " = 1")
.build();
completeCmdLog.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(completeCmdLog);
hongXiangStationDeviceDriver.writing(completeCmd, "1");
} }
else { else {
LuceneLogDto logDto = LuceneLogDto.builder() LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode()) .device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data) .content("[设备处理] 其他设备类型, agvphase:" + phase + ", data:" + data)
.build(); .build();
logDto.setLog_level(4); logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto); luceneExecuteLogService.deviceExecuteLog(logDto);
} }
//更新agv状态 //更新agv状态 - WCS系统交互
JSONObject param3 = new JSONObject(); JSONObject param3 = new JSONObject();
param3.put("containerCode", inst.getVehicle_code()); param3.put("containerCode", inst.getVehicle_code());
param3.put("taskCode", inst.getTask_code()); param3.put("taskCode", inst.getTask_code());
param3.put("carId", inst.getCarno()); param3.put("carId", inst.getCarno());
param3.put("taskType", inst.getInstruction_type()); param3.put("taskType", inst.getInstruction_type());
param3.put("feedbackStatus", FeedbackStatusEnum.PUT_FINISH.getCode()); param3.put("feedbackStatus", FeedbackStatusEnum.PUT_FINISH.getCode());
LuceneLogDto logDto3 = LuceneLogDto.builder()
.device_code(device_code)
.content("取货完成,参数:" + param3)
.build();
logDto3.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto3);
HttpResponse httpResponse2 = acsToWcsService.feedbackTaskStatusToWcs(param3);
if (ObjectUtil.isNotEmpty(httpResponse2)) {
JSONObject param2 = new JSONObject();
param2.put("device_code", device_code);
LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(device_code)
.content("取货完成返回参数:" + param2)
.build();
logDto2.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto2);
// WCS交互日志
LuceneLogDto wcsLog = LuceneLogDto.builder()
.device_code(device_code)
.content("[WCS交互] 反馈放货完成, 参数:" + param3.toJSONString())
.build();
wcsLog.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(wcsLog);
HttpResponse httpResponse2 = acsToWcsService.feedbackTaskStatusToWcs(param3);
if (ObjectUtil.isNotEmpty(httpResponse2)) {
String responseBody = httpResponse2.body();
JSONObject responseJson = JSONObject.parseObject(responseBody);
int responseCode = responseJson.getIntValue("responseCode");
LuceneLogDto wcsResponseLog = LuceneLogDto.builder()
.device_code(device_code)
.content("[WCS响应] 放货完成响应, status:" + httpResponse2.getStatus() + ", body:" + responseBody)
.build();
wcsResponseLog.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(wcsResponseLog);
// 判断 responseCode 是否为 0非 0 则返回
if (responseCode != 0) {
LuceneLogDto errorLog = LuceneLogDto.builder()
.device_code(device_code)
.content("[WCS响应] 放货完成失败, responseCode:" + responseCode
+ ", responseMessage:" + responseJson.getString("responseMessage"))
.build();
errorLog.setLog_level(2);
luceneExecuteLogService.deviceExecuteLog(errorLog);
return;
}
} else {
LuceneLogDto wcsNullLog = LuceneLogDto.builder()
.device_code(device_code)
.content("[WCS响应] 放货完成响应为空")
.build();
wcsNullLog.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(wcsNullLog);
} }
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
@@ -855,10 +1072,26 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
// TwoNDC2SocketConnectionAutoRun.write(data); // TwoNDC2SocketConnectionAutoRun.write(data);
// } // }
if (StrUtil.equals(inst.getAgv_system_type(), "2")) { if (StrUtil.equals(inst.getAgv_system_type(), "2")) {
// AGV指令下发日志
LuceneLogDto agvWriteLog = LuceneLogDto.builder()
.device_code(device_code)
.content("[AGV指令下发] 发送数据到AGV, data:" + Arrays.toString(data))
.build();
agvWriteLog.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(agvWriteLog);
TwoNDCSocketConnectionAutoRun.write(data); TwoNDCSocketConnectionAutoRun.write(data);
} }
} }
// 方法出口日志
LuceneLogDto exitLog = LuceneLogDto.builder()
.device_code(device_code)
.content("[processSocket] 处理AGV数据完成, phase:" + phase + "(0x" + Integer.toHexString(phase) + ")")
.build();
exitLog.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(exitLog);
} }
@Override @Override