opt:中鼎842优化

This commit is contained in:
2026-06-03 16:20:55 +08:00
parent 263a3a9f01
commit 3b097ea907
5 changed files with 300 additions and 252 deletions

View File

@@ -209,7 +209,7 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
}
//任务完毕
//无车id及状态
else if (phase == 0x14) {
else if (phase == 0x0A) {
if (ObjectUtil.isEmpty(inst)) {
log.info("未找到指令号{}对应的指令", ikey);
} else {

View File

@@ -250,9 +250,6 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
standardOrdinarySiteDeviceDriver.setIndex(index);
standardOrdinarySiteDeviceDriver.setInst(inst);
}
}
if (ObjectUtil.isNotEmpty(data)) {
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase" + phase + "反馈:" + Bytes2HexString(data));

View File

@@ -52,6 +52,7 @@ import org.nl.system.service.dict.ISysDictService;
import org.nl.system.service.dict.dao.Dict;
import org.nl.system.service.param.ISysParamService;
import org.nl.config.SpringContextHolder;
import org.springframework.util.StringUtils;
import java.time.LocalTime;
import java.util.Arrays;
@@ -193,17 +194,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
if (agvaddr != 0) {
old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr);
CommonFinalParam commonFinalParam = new CommonFinalParam();
if (StrUtil.contains(old_device_code, commonFinalParam.getBARRE())) {
String[] point = old_device_code.split(commonFinalParam.getBARRE());
device_code = point[0];
} else if (StrUtil.contains(old_device_code, commonFinalParam.getPOINT())) {
String[] point = old_device_code.split("\\.");
device_code = point[0];
emptyNum = point[1];
} else {
device_code = old_device_code;
}
device_code = old_device_code;
}
device = deviceAppService.findDeviceByCode(device_code);
@@ -238,17 +229,9 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
device_code = deviceService.queryDeviceCodeByAddress(agvaddr);
if (agvaddr != 0) {
old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr);
CommonFinalParam commonFinalParam = new CommonFinalParam();
if (StrUtil.contains(old_device_code, commonFinalParam.getBARRE())) {
String[] point = old_device_code.split(commonFinalParam.getBARRE());
device_code = point[0];
} else if (StrUtil.contains(old_device_code, commonFinalParam.getPOINT())) {
String[] point = old_device_code.split("\\.");
device_code = point[0];
emptyNum = point[1];
} else {
device_code = old_device_code;
}
}
HongXiangLocationInfo hongXiangLocationInfo = CodeParserUtil.parseCode(device_code);
@@ -297,28 +280,38 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
.build();
logDto3.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto3);
HttpResponse httpResponse2 = acsToWcsService.feedbackTaskStatusToWcs(param3);
if (ObjectUtil.isNotEmpty(httpResponse2)) {
String responseBody = httpResponse2.body();
JSONObject responseJson = JSONObject.parseObject(responseBody);
int responseCode = responseJson.getIntValue("responseCode");
if(!StringUtils.isEmpty(param3.getString("taskCode")) && !param3.getString("taskCode").contains(CommonFinalParam.HYPHEN_)) {
HttpResponse httpResponse2 = acsToWcsService.feedbackTaskStatusToWcs(param3);
if (ObjectUtil.isNotEmpty(httpResponse2)) {
String responseBody = httpResponse2.body();
JSONObject responseJson = JSONObject.parseObject(responseBody);
int responseCode = responseJson.getIntValue("responseCode");
LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(device_code)
.content("申请取货返回参数:" + responseBody)
.build();
logDto2.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto2);
// 判断 responseCode 是否为 0非 0 则返回
if (responseCode != 0) {
LuceneLogDto errorLog = LuceneLogDto.builder()
LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(device_code)
.content("WCS反馈失败, responseCode:" + responseCode
+ ", responseMessage:" + responseJson.getString("responseMessage"))
.content("申请取货返回参数:" + responseBody)
.build();
errorLog.setLog_level(2);
luceneExecuteLogService.deviceExecuteLog(errorLog);
logDto2.setLog_level(4);
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;
}
} else {
LuceneLogDto wcsNullLog = LuceneLogDto.builder()
.device_code(device_code)
.content("[WCS响应] 取货完成响应为空")
.build();
wcsNullLog.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(wcsNullLog);
return;
}
}
@@ -404,19 +397,19 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
luceneExecuteLogService.deviceExecuteLog(doorStatusLog);
if (door_open != 1) {
// 下发开门指令
String doorOpenCmd = "to_oven" + hongXiangLocationInfo.getOvenNo()
+ "_door" + hongXiangLocationInfo.getShutterDoor() + "_open";
LuceneLogDto doorOpenLog = LuceneLogDto.builder()
.device_code(device_code)
.content("[烘箱指令] 下发开门指令: " + doorOpenCmd + " = 2")
.build();
doorOpenLog.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(doorOpenLog);
hongXiangStationDeviceDriver.writing(doorOpenCmd, "2");
return;
} else {
String safeCmd = "to_oven" + hongXiangLocationInfo.getOvenNo()
+ "_door" + hongXiangLocationInfo.getShutterDoor() + "_agv_safe";
LuceneLogDto safeLog = LuceneLogDto.builder()
.device_code(device_code)
.content("[烘箱指令] 下发安全指令: " + safeCmd + " = " + 0)
.build();
safeLog.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(safeLog);
hongXiangStationDeviceDriver.writing(safeCmd, "0");
//到达取货点
//门已经开了,此时请求取料
// to_oven1_door1_storage
@@ -430,8 +423,6 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
luceneExecuteLogService.deviceExecuteLog(storageLog);
hongXiangStationDeviceDriver.writing(storageCmd, String.valueOf(hongXiangLocationInfo.getStorageNo()));
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
// AGV反馈日志
LuceneLogDto agvFeedbackLog = LuceneLogDto.builder()
.device_code(device_code)
@@ -441,7 +432,35 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
luceneExecuteLogService.deviceExecuteLog(agvFeedbackLog);
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
// 下发开门指令
String doorOpenCmd = "to_oven" + hongXiangLocationInfo.getOvenNo()
+ "_door" + hongXiangLocationInfo.getShutterDoor() + "_open";
LuceneLogDto doorOpenLog = LuceneLogDto.builder()
.device_code(device_code)
.content("[烘箱指令] 下发开门指令: " + doorOpenCmd + " = 2")
.build();
doorOpenLog.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(doorOpenLog);
hongXiangStationDeviceDriver.writing(doorOpenCmd, "2");
return;
}
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
String safeCmd = "to_oven" + hongXiangLocationInfo.getOvenNo()
+ "_door" + hongXiangLocationInfo.getShutterDoor() + "_agv_safe";
LuceneLogDto safeLog = LuceneLogDto.builder()
.device_code(device_code)
.content("[烘箱指令] 下发安全指令: " + safeCmd + " = " + 1)
.build();
safeLog.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(safeLog);
hongXiangStationDeviceDriver.writing(safeCmd, "1");
} else {
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
@@ -471,17 +490,9 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
}
if (agvaddr != 0) {
old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr);
CommonFinalParam commonFinalParam = new CommonFinalParam();
if (StrUtil.contains(old_device_code, commonFinalParam.getBARRE())) {
String[] point = old_device_code.split(commonFinalParam.getBARRE());
device_code = point[0];
} else if (StrUtil.contains(old_device_code, commonFinalParam.getPOINT())) {
String[] point = old_device_code.split("\\.");
device_code = point[0];
emptyNum = point[1];
} else {
device_code = old_device_code;
}
}
HongXiangLocationInfo hongXiangLocationInfo = CodeParserUtil.parseCode(device_code);
@@ -518,6 +529,59 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
inst.setCarno(String.valueOf(carno));
instructionService.update(inst);
}
//更新agv状态 - WCS系统交互
JSONObject param3 = new JSONObject();
param3.put("containerCode", inst.getVehicle_code());
param3.put("taskCode", inst.getTask_code());
param3.put("carId", inst.getCarno());
param3.put("taskType", inst.getInstruction_type());
param3.put("feedbackStatus", FeedbackStatusEnum.TAKE_FINISH.getCode());
// WCS交互日志
LuceneLogDto wcsLog = LuceneLogDto.builder()
.device_code(device_code)
.content("[WCS交互] 反馈取货完成, 参数:" + param3.toJSONString())
.build();
wcsLog.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(wcsLog);
if(!StringUtils.isEmpty(param3.getString("taskCode")) && !param3.getString("taskCode").contains(CommonFinalParam.HYPHEN_)) {
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);
return;
}
}
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
LuceneLogDto logDto = LuceneLogDto.builder()
@@ -557,6 +621,19 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
luceneExecuteLogService.deviceExecuteLog(completeCmdLog);
hongXiangStationDeviceDriver.writing(completeCmd, "1");
String safeCmd = "to_oven" + hongXiangLocationInfo.getOvenNo()
+ "_door" + hongXiangLocationInfo.getShutterDoor() + "_agv_safe";
LuceneLogDto safeLog = LuceneLogDto.builder()
.device_code(device_code)
.content("[烘箱指令] 下发安全指令: " + safeCmd + " = " + 0)
.build();
safeLog.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(safeLog);
hongXiangStationDeviceDriver.writing(safeCmd, "0");
}
else {
LuceneLogDto logDto = LuceneLogDto.builder()
@@ -567,57 +644,9 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
luceneExecuteLogService.deviceExecuteLog(logDto);
}
//更新agv状态 - WCS系统交互
JSONObject param3 = new JSONObject();
param3.put("containerCode", inst.getVehicle_code());
param3.put("taskCode", inst.getTask_code());
param3.put("carId", inst.getCarno());
param3.put("taskType", inst.getInstruction_type());
param3.put("feedbackStatus", FeedbackStatusEnum.TAKE_FINISH.getCode());
// 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);
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
}
@@ -639,16 +668,9 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
if (agvaddr != 0) {
CommonFinalParam commonFinalParam = new CommonFinalParam();
old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr);
if (StrUtil.contains(old_device_code, commonFinalParam.getBARRE())) {
String[] point = old_device_code.split(commonFinalParam.getBARRE());
device_code = point[0];
} else if (StrUtil.contains(old_device_code, commonFinalParam.getPOINT())) {
String[] point = old_device_code.split("\\.");
device_code = point[0];
emptyNum = point[1];
} else {
device_code = old_device_code;
}
}
HongXiangLocationInfo hongXiangLocationInfo = CodeParserUtil.parseCode(device_code);
if(null != hongXiangLocationInfo ){
@@ -688,28 +710,38 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
.build();
logDto3.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto3);
HttpResponse httpResponse2 = acsToWcsService.feedbackTaskStatusToWcs(param3);
if (ObjectUtil.isNotEmpty(httpResponse2)) {
String responseBody = httpResponse2.body();
JSONObject responseJson = JSONObject.parseObject(responseBody);
int responseCode = responseJson.getIntValue("responseCode");
if(!StringUtils.isEmpty(param3.getString("taskCode")) && !param3.getString("taskCode").contains(CommonFinalParam.HYPHEN_)) {
HttpResponse httpResponse2 = acsToWcsService.feedbackTaskStatusToWcs(param3);
if (ObjectUtil.isNotEmpty(httpResponse2)) {
String responseBody = httpResponse2.body();
JSONObject responseJson = JSONObject.parseObject(responseBody);
int responseCode = responseJson.getIntValue("responseCode");
LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(device_code)
.content("申请放货返回参数:" + responseBody)
.build();
logDto2.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto2);
// 判断 responseCode 是否为 0非 0 则返回
if (responseCode != 0) {
LuceneLogDto errorLog = LuceneLogDto.builder()
LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(device_code)
.content("WCS反馈失败, responseCode:" + responseCode
+ ", responseMessage:" + responseJson.getString("responseMessage"))
.content("申请放货返回参数:" + responseBody)
.build();
errorLog.setLog_level(2);
luceneExecuteLogService.deviceExecuteLog(errorLog);
logDto2.setLog_level(4);
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;
}
} else {
LuceneLogDto wcsNullLog = LuceneLogDto.builder()
.device_code(device_code)
.content("[WCS响应] 取货完成响应为空")
.build();
wcsNullLog.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(wcsNullLog);
return;
}
}
@@ -792,20 +824,18 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
luceneExecuteLogService.deviceExecuteLog(doorStatusLog);
if (door_open != 1) {
String doorOpenCmd = "to_oven" + hongXiangLocationInfo.getOvenNo()
+ "_door" + hongXiangLocationInfo.getShutterDoor() + "_open";
LuceneLogDto doorOpenLog = LuceneLogDto.builder()
.device_code(device_code)
.content("[烘箱指令] 下发开门指令: " + doorOpenCmd + " = 1")
.build();
doorOpenLog.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(doorOpenLog);
hongXiangStationDeviceDriver.writing(doorOpenCmd, "1");
return;
} else {
//到达放货点
//门已经开了,此时请求放货
String safeCmd = "to_oven" + hongXiangLocationInfo.getOvenNo()
+ "_door" + hongXiangLocationInfo.getShutterDoor() + "_agv_safe";
LuceneLogDto safeLog = LuceneLogDto.builder()
.device_code(device_code)
.content("[烘箱指令] 下发安全指令: " + safeCmd + " = " + 0)
.build();
safeLog.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(safeLog);
hongXiangStationDeviceDriver.writing(safeCmd, "0");
String storageCmd = "to_oven" + hongXiangLocationInfo.getOvenNo()
+ "_door" + hongXiangLocationInfo.getShutterDoor() + "_storage";
LuceneLogDto storageLog = LuceneLogDto.builder()
@@ -816,7 +846,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
luceneExecuteLogService.deviceExecuteLog(storageLog);
hongXiangStationDeviceDriver.writing(storageCmd, String.valueOf(hongXiangLocationInfo.getStorageNo()));
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
// AGV反馈日志
LuceneLogDto agvFeedbackLog = LuceneLogDto.builder()
@@ -827,7 +857,33 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
luceneExecuteLogService.deviceExecuteLog(agvFeedbackLog);
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
String doorOpenCmd = "to_oven" + hongXiangLocationInfo.getOvenNo()
+ "_door" + hongXiangLocationInfo.getShutterDoor() + "_open";
LuceneLogDto doorOpenLog = LuceneLogDto.builder()
.device_code(device_code)
.content("[烘箱指令] 下发开门指令: " + doorOpenCmd + " = 1")
.build();
doorOpenLog.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(doorOpenLog);
hongXiangStationDeviceDriver.writing(doorOpenCmd, "1");
return;
}
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
String safeCmd = "to_oven" + hongXiangLocationInfo.getOvenNo()
+ "_door" + hongXiangLocationInfo.getShutterDoor() + "_agv_safe";
LuceneLogDto safeLog = LuceneLogDto.builder()
.device_code(device_code)
.content("[烘箱指令] 下发安全指令: " + safeCmd + " = " + 1)
.build();
safeLog.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(safeLog);
hongXiangStationDeviceDriver.writing(safeCmd, "1");
} else {
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
@@ -860,16 +916,9 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
if (agvaddr != 0) {
CommonFinalParam commonFinalParam = new CommonFinalParam();
old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr);
if (StrUtil.contains(old_device_code, commonFinalParam.getBARRE())) {
String[] point = old_device_code.split(commonFinalParam.getBARRE());
device_code = point[0];
} else if (StrUtil.contains(old_device_code, commonFinalParam.getPOINT())) {
String[] point = old_device_code.split("\\.");
device_code = point[0];
emptyNum = point[1];
} else {
device_code = old_device_code;
}
}
HongXiangLocationInfo hongXiangLocationInfo = CodeParserUtil.parseCode(device_code);
@@ -896,6 +945,57 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
log.info("未找到指令号{}对应的指令", ikey);
return;
}
//更新agv状态 - WCS系统交互
JSONObject param3 = new JSONObject();
param3.put("containerCode", inst.getVehicle_code());
param3.put("taskCode", inst.getTask_code());
param3.put("carId", inst.getCarno());
param3.put("taskType", inst.getInstruction_type());
param3.put("feedbackStatus", FeedbackStatusEnum.PUT_FINISH.getCode());
// WCS交互日志
LuceneLogDto wcsLog = LuceneLogDto.builder()
.device_code(device_code)
.content("[WCS交互] 反馈放货完成, 参数:" + param3.toJSONString())
.build();
wcsLog.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(wcsLog);
if(!StringUtils.isEmpty(param3.getString("taskCode")) && !param3.getString("taskCode").contains(CommonFinalParam.HYPHEN_)) {
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);
}
}
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
@@ -932,6 +1032,19 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
hongXiangStationDeviceDriver.writing(completeCmd, "1");
String safeCmd = "to_oven" + hongXiangLocationInfo.getOvenNo()
+ "_door" + hongXiangLocationInfo.getShutterDoor() + "_agv_safe";
LuceneLogDto safeLog = LuceneLogDto.builder()
.device_code(device_code)
.content("[烘箱指令] 下发安全指令: " + safeCmd + " = " + 0)
.build();
safeLog.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(safeLog);
hongXiangStationDeviceDriver.writing(safeCmd, "0");
}
else {
LuceneLogDto logDto = LuceneLogDto.builder()
@@ -942,55 +1055,6 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
luceneExecuteLogService.deviceExecuteLog(logDto);
}
//更新agv状态 - WCS系统交互
JSONObject param3 = new JSONObject();
param3.put("containerCode", inst.getVehicle_code());
param3.put("taskCode", inst.getTask_code());
param3.put("carId", inst.getCarno());
param3.put("taskType", inst.getInstruction_type());
param3.put("feedbackStatus", FeedbackStatusEnum.PUT_FINISH.getCode());
// 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);

View File

@@ -16,6 +16,7 @@ import lombok.extern.slf4j.Slf4j;
import org.nl.acs.AcsConfig;
import org.nl.acs.address.service.AddressService;
import org.nl.acs.address.service.dto.AddressDto;
import org.nl.acs.common.base.CommonFinalParam;
import org.nl.acs.device.service.DeviceService;
import org.nl.acs.ext.wms.RetryableUtil;
import org.nl.acs.ext.wms.service.AcsToWcsService;
@@ -32,6 +33,7 @@ import org.nl.system.service.param.ISysParamService;
import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
@Service
@RequiredArgsConstructor
@@ -69,9 +71,16 @@ public class AcsToWcsServiceImpl implements AcsToWcsService {
@Override
public HttpResponse feedbackTaskStatusToWcs(JSONObject jo) {
try {
//查询task
if(!StringUtils.isEmpty(jo.getString("taskCode")) && jo.getString("taskCode").contains(CommonFinalParam.HYPHEN_)){
return null;
}
MDC.put(log_file_type, log_type);
log.info("feedbackTaskStatusToWcs-----agv状态更新输入参数{}", jo);
String wcsurl = paramService.findByCode(AcsConfig.WCSURL).getValue();

View File

@@ -17,6 +17,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import groovy.lang.Lazy;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.jetbrains.annotations.NotNull;
import org.nl.acs.AcsConfig;
import org.nl.acs.agv.server.AcsToWmsZDService;
@@ -627,10 +628,8 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
task_code = CodeUtil.getNewCode("TASK_NO");
task_code = CommonFinalParam.HYPHEN_ + task_code;
}
String start_point_code;
String next_point_code = dto.getNext_point_code();
String start_device_code = dto.getStart_device_code();
String next_device_code = dto.getNext_device_code();
String start_point_code = dto.getStart_point_code();
String route_plan_code = dto.getRoute_plan_code();
//本项目默认为2
dto.setAgv_system_type("2");
@@ -643,7 +642,8 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
dto.setTask_status(TaskStatusEnum.READY.getIndex());
dto.setStart_device_code2(dto.getStart_point_code2());
dto.setNext_device_code2(dto.getNext_point_code2());
dto.setStart_device_code(dto.getStart_point_code());
dto.setNext_device_code(dto.getNext_point_code());
if (StrUtil.isEmpty(dto.getPriority())) {
dto.setPriority(CommonFinalParam.ONE);
@@ -652,50 +652,28 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
// 判断起点终点设备类型
String startDeviceType = deviceAppService.findDeviceTypeByCode(dto.getStart_device_code());
String nextDeviceType = deviceAppService.findDeviceTypeByCode(dto.getNext_device_code());
// 同一排转库任务不做路由校验
if (!(StrUtil.equals(DeviceType.storage.toString(), startDeviceType) && StrUtil.equals(DeviceType.storage.toString(), nextDeviceType) && StrUtil.equals(start_device_code, next_device_code))) {
if (routeLineService
.getShortPathLines(dto.getStart_device_code(), dto.getNext_device_code(), plan_code)
.size()
== 0) {
throw new BadRequestException(dto.getStart_point_code() + "->" + dto.getNext_point_code() + " " + LangProcess.msg("route_isNull"));
}
}
String createTaskCheck = paramService.findByCode(AcsConfig.CREATETASKCHECK).getValue();
DeviceService deviceService = SpringContextHolder.getBean(DeviceServiceImpl.class);
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
Device nextdevice = appService.findDeviceByCode(next_device_code);
Device nextdevice = appService.findDeviceByCode(next_point_code);
if (nextdevice == null) {
//TODO 国际化处理
throw new BadRequestException("终点设备未配置");
}
Device startdevice = appService.findDeviceByCode(start_device_code);
Device startdevice = appService.findDeviceByCode(start_point_code);
if (startdevice == null) {
//TODO 国际化处理
throw new BadRequestException("起点设备未配置");
}
dto.setMaterial(startdevice.getMaterial_type());
if (StrUtil.equals(DeviceType.storage.toString(), startDeviceType)) {
start_point_code = start_device_code + CommonFinalParam.HYPHEN_ + dto.getFrom_y() + CommonFinalParam.HYPHEN_ + dto.getFrom_z();
dto.setStart_point_code(start_point_code);
List<RouteLineDto> shortPathsList =
routeLineService.getShortPathLines(
dto.getStart_device_code(), dto.getNext_device_code(), dto.getRoute_plan_code());
if (ObjectUtils.isEmpty(shortPathsList)) {
throw new Exception(dto.getStart_device_code() + "->" + dto.getNext_device_code() + "路由不通");
}
if (StrUtil.equals(DeviceType.storage.toString(), nextDeviceType)) {
next_point_code = next_device_code + CommonFinalParam.HYPHEN_ + dto.getTo_y() + CommonFinalParam.HYPHEN_ + dto.getTo_z();
dto.setNext_point_code(next_point_code);
}
if (StrUtil.equals(createTaskCheck, CommonFinalParam.ONE)) {
// 判断起点为输送设备
if (StrUtil.equals(DeviceType.conveyor.toString(), startDeviceType)) {
}
if (StrUtil.equals(DeviceType.conveyor.toString(), nextDeviceType)) {
}
} else {
// 判断起点为输送设备
if (StrUtil.equals(DeviceType.conveyor.toString(), startDeviceType)) {
}
if (!StrUtil.equals(createTaskCheck, CommonFinalParam.ONE)) {
if (StrUtil.equals(DeviceType.conveyor.toString(), nextDeviceType)) {
// if (nextdevice.getDeviceDriver() instanceof
// XgAgvCarDeviceDriver) {