opt:中鼎842优化

This commit is contained in:
2026-05-07 17:45:52 +08:00
parent 936a8ca6a9
commit 263a3a9f01
6 changed files with 170 additions and 331 deletions

View File

@@ -68,19 +68,8 @@ public class WmsZDToAcsServiceImpl implements WmsZDToAcsService {
return map;
}
if (start_point_code.indexOf("-") > 0) {
String str[] = start_point_code.split("-");
start_device_code = str[0];
} else {
start_device_code = start_point_code;
}
if (next_point_code.indexOf("-") > 0) {
String str[] = next_point_code.split("-");
next_device_code = str[0];
} else {
next_device_code = next_point_code;
}
//查询wcs传过来的起点终点路由
List<RouteLineDto> list = routeLineService.getShortPathLines(start_device_code, next_device_code, "normal");

View File

@@ -895,10 +895,7 @@ public class DeviceServiceImpl extends CommonServiceImpl<DeviceMapper, Device> i
@Override
public void changeDeviceStatus(JSONObject form) {
String device_code = form.getString("device_code");
if (StrUtil.contains(device_code, "-") && StrUtil.count(device_code, "-") == 2) {
String[] point = device_code.split("-");
device_code = point[0];
}
//需要数量
String hasGoodStatus = form.getString("hasGoodStatus");
if (StrUtil.isEmpty(hasGoodStatus)) {

View File

@@ -252,12 +252,20 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
}
HongXiangLocationInfo hongXiangLocationInfo = CodeParserUtil.parseCode(device_code);
if(null != hongXiangLocationInfo){
if(null != hongXiangLocationInfo ){
log.info("【设备编码解析】满足三段式格式device_code={},解析结果:{}",
device_code, hongXiangLocationInfo);
device = deviceAppService.findDeviceByCode("hongxiang");
}
else {
log.info("【设备编码解析】不满足三段式格式走默认查询device_code={}", device_code);
device = deviceAppService.findDeviceByCode(device_code);
}
// 必须判空,防止空指针
if (device == null) {
log.error("【设备查询失败】未查询到设备信息当前device_code={}", device_code);
return;
}
if (ObjectUtil.isEmpty(device_code)) {
log.info(agvaddr + "对应设备号为空!");
LuceneLogDto logDto = LuceneLogDto.builder()
@@ -378,6 +386,8 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
ovenLog.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(ovenLog);
if (hongxiangError(device_code, hongXiangStationDeviceDriver, hongXiangLocationInfo)) return;
//判断对应点位是卷帘门是否开门到位
int door_open = (int) hongXiangStationDeviceDriver.getPropertyValue("item_oven"
+ hongXiangLocationInfo.getOvenNo()
@@ -406,7 +416,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
hongXiangStationDeviceDriver.writing(doorOpenCmd, "2");
return;
}
} else {
//到达取货点
//门已经开了,此时请求取料
// to_oven1_door1_storage
@@ -431,6 +441,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
luceneExecuteLogService.deviceExecuteLog(agvFeedbackLog);
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
}
} else {
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
@@ -474,12 +485,20 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
}
HongXiangLocationInfo hongXiangLocationInfo = CodeParserUtil.parseCode(device_code);
if(null != hongXiangLocationInfo){
if(null != hongXiangLocationInfo ){
log.info("【设备编码解析】满足三段式格式device_code={},解析结果:{}",
device_code, hongXiangLocationInfo);
device = deviceAppService.findDeviceByCode("hongxiang");
}
else {
log.info("【设备编码解析】不满足三段式格式走默认查询device_code={}", device_code);
device = deviceAppService.findDeviceByCode(device_code);
}
// 必须判空,防止空指针
if (device == null) {
log.error("【设备查询失败】未查询到设备信息当前device_code={}", device_code);
return;
}
if (ObjectUtil.isEmpty(device_code)) {
log.info(agvaddr + "对应设备号为空!");
@@ -513,6 +532,9 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
else if (device.getDeviceDriver() instanceof HongXiangStationDeviceDriver) {
hongXiangStationDeviceDriver = (HongXiangStationDeviceDriver) device.getDeviceDriver();
if (hongxiangError(device_code, hongXiangStationDeviceDriver, hongXiangLocationInfo)) return;
//取货完毕
// to_oven1_door1_storage
String completeCmd = "to_oven" + hongXiangLocationInfo.getOvenNo()
@@ -629,12 +651,21 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
}
}
HongXiangLocationInfo hongXiangLocationInfo = CodeParserUtil.parseCode(device_code);
if(null != hongXiangLocationInfo){
if(null != hongXiangLocationInfo ){
log.info("【设备编码解析】满足三段式格式device_code={},解析结果:{}",
device_code, hongXiangLocationInfo);
device = deviceAppService.findDeviceByCode("hongxiang");
}
else {
log.info("【设备编码解析】不满足三段式格式走默认查询device_code={}", device_code);
device = deviceAppService.findDeviceByCode(device_code);
}
// 必须判空,防止空指针
if (device == null) {
log.error("【设备查询失败】未查询到设备信息当前device_code={}", device_code);
return;
}
if (ObjectUtil.isEmpty(device_code)) {
log.info(agvaddr + "对应设备号为空!");
return;
@@ -729,10 +760,12 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
luceneExecuteLogService.deviceExecuteLog(logDto);
standardOrdinarySiteDeviceDriver.setOption(0);
} //烘箱
} //烘箱 //到达放货点
else if (device.getDeviceDriver() instanceof HongXiangStationDeviceDriver) {
hongXiangStationDeviceDriver = (HongXiangStationDeviceDriver) device.getDeviceDriver();
if (hongxiangError(device_code, hongXiangStationDeviceDriver, hongXiangLocationInfo)) return;
// 烘箱放货点日志
LuceneLogDto ovenPutLog = LuceneLogDto.builder()
.device_code(device_code)
@@ -770,8 +803,8 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
hongXiangStationDeviceDriver.writing(doorOpenCmd, "1");
return;
}
} else {
//到达放货点
//门已经开了,此时请求放货
String storageCmd = "to_oven" + hongXiangLocationInfo.getOvenNo()
+ "_door" + hongXiangLocationInfo.getShutterDoor() + "_storage";
@@ -794,7 +827,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
luceneExecuteLogService.deviceExecuteLog(agvFeedbackLog);
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
}
} else {
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
@@ -840,12 +873,20 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
}
HongXiangLocationInfo hongXiangLocationInfo = CodeParserUtil.parseCode(device_code);
if(null != hongXiangLocationInfo){
if(null != hongXiangLocationInfo ){
log.info("【设备编码解析】满足三段式格式device_code={},解析结果:{}",
device_code, hongXiangLocationInfo);
device = deviceAppService.findDeviceByCode("hongxiang");
}
else {
log.info("【设备编码解析】不满足三段式格式走默认查询device_code={}", device_code);
device = deviceAppService.findDeviceByCode(device_code);
}
// 必须判空,防止空指针
if (device == null) {
log.error("【设备查询失败】未查询到设备信息当前device_code={}", device_code);
return;
}
if (ObjectUtil.isEmpty(device_code)) {
log.info(agvaddr + "对应设备号为空!");
@@ -868,6 +909,9 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
else if (device.getDeviceDriver() instanceof HongXiangStationDeviceDriver) {
hongXiangStationDeviceDriver = (HongXiangStationDeviceDriver) device.getDeviceDriver();
if (hongxiangError(device_code, hongXiangStationDeviceDriver, hongXiangLocationInfo)) return;
// 烘箱放货完成日志
LuceneLogDto ovenPutCompleteLog = LuceneLogDto.builder()
.device_code(device_code)
@@ -1094,6 +1138,23 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
}
private boolean hongxiangError(String device_code, HongXiangStationDeviceDriver hongXiangStationDeviceDriver, HongXiangLocationInfo hongXiangLocationInfo) {
int error = (int) hongXiangStationDeviceDriver.getPropertyValue("item_oven"
+ hongXiangLocationInfo.getOvenNo()
+ "_error");
if(error == 1){
LuceneLogDto doorStatusLog = LuceneLogDto.builder()
.device_code(device_code)
.content("[烘箱] oven" + hongXiangLocationInfo.getOvenNo()
+ "异常")
.build();
doorStatusLog.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(doorStatusLog);
return true;
}
return false;
}
@Override
public JSONObject getDeviceStatusName() {
JSONObject jo = new JSONObject();

View File

@@ -18,7 +18,7 @@ public class CodeParserUtil {
}
// 解析规则:全部转整数(自动去掉前导零)
int ovenNo = Integer.parseInt(parts[0]); // 100 → 100
int ovenNo = Integer.parseInt(parts[0].replace("0","")); // 100 → 100
int shutterDoor = Integer.parseInt(parts[1]); // 001 → 1
int storageNo = Integer.parseInt(parts[2]); // 041 → 41

View File

@@ -463,7 +463,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
if (ObjectUtils.isEmpty(shortPathsList)) {
throw new Exception(dto.getStart_device_code() + "->" + dto.getNext_device_code() + "路由不通");
}
if (StrUtil.equals(shortPathsList.get(0).getType(), CommonFinalParam.ONE)) {
if (!StrUtil.equals(shortPathsList.get(0).getType(), CommonFinalParam.ONE)) {
throw new BadRequestException(dto.getStart_device_code() + "->" + dto.getNext_device_code() + "路由类型不是agv类型");
}
if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue(), "2")) {
@@ -1514,78 +1514,6 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
@Override
public Instruction foramte(Instruction inst) {
CommonFinalParam commonFinalParam = new CommonFinalParam();
String start_point_code = inst.getStart_point_code();
String next_point_code = inst.getNext_point_code();
String start_device_code = "";
String next_device_code = "";
if (StrUtil.contains(start_point_code, commonFinalParam.getPOINT())) {
String[] point = start_point_code.split("\\.");
start_device_code = point[0];
} else {
start_device_code = start_point_code;
}
if (StrUtil.contains(next_point_code, commonFinalParam.getPOINT())) {
String[] point = next_point_code.split("\\.");
next_device_code = point[0];
} else {
next_device_code = next_point_code;
}
if (StrUtil.contains(start_point_code, commonFinalParam.getBARRE()) && StrUtil.count(start_point_code, commonFinalParam.getBARRE()) == 2) {
String[] start_point = start_point_code.split(commonFinalParam.getBARRE());
Device starPoint = deviceAppService.findDeviceByCode(start_point[0]);
inst.setFrom_x(starPoint.getExtraValue().get("x").toString());
inst.setStart_device_code(start_point[0]);
inst.setFrom_y(start_point[1]);
inst.setFrom_z(start_point[2]);
} else {
DeviceDriverDefination deviceDriverDefination = deviceAppService.findDeviceByCode(start_point_code).getDeviceDriverDefination();
if (BeanUtil.isNotEmpty(deviceDriverDefination)) {
String start_device =
deviceDriverDefination
.getFitDeviceTypes()
.get(0)
.name();
if (StrUtil.equals("storage", start_device)) {
String[] start_point = start_point_code.split(commonFinalParam.getBARRE());
Device starPoint = deviceAppService.findDeviceByCode(start_point[0]);
inst.setFrom_x(starPoint.getExtraValue().get("x").toString());
inst.setStart_device_code(start_point[0]);
inst.setFrom_y(start_point[1]);
inst.setFrom_z(start_point[2]);
} else {
inst.setStart_device_code(start_device_code);
}
}
}
if (StrUtil.contains(next_point_code, commonFinalParam.getBARRE()) && StrUtil.count(next_point_code, commonFinalParam.getBARRE()) == 2) {
String[] next_point = next_point_code.split(commonFinalParam.getBARRE());
Device nextDevice = deviceAppService.findDeviceByCode(next_point[0]);
inst.setTo_x(nextDevice.getExtraValue().get("x").toString());
inst.setNext_device_code(next_point[0]);
inst.setTo_y(next_point[1]);
inst.setTo_z(next_point[2]);
} else {
DeviceDriverDefination deviceDriverDefination = deviceAppService.findDeviceByCode(next_device_code).getDeviceDriverDefination();
if (BeanUtil.isNotEmpty(deviceDriverDefination)) {
String next_device =
deviceDriverDefination
.getFitDeviceTypes()
.get(0)
.name();
if (StrUtil.equals("storage", next_device)) {
String[] next_point = start_point_code.split("-");
Device nextDevice = deviceAppService.findDeviceByCode(next_point[0]);
inst.setTo_x(nextDevice.getExtraValue().get("x").toString());
inst.setNext_device_code(next_point[0]);
inst.setTo_y(next_point[1]);
inst.setTo_z(next_point[2]);
} else {
inst.setNext_device_code(next_device_code);
}
}
}
return inst;
}

View File

@@ -608,7 +608,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
@Override
public void create(TaskDto dto) throws Exception {
dto = foramte(dto);
//dto = foramte(dto);
dto.setInteraction_json(ObjectUtil.isNotEmpty(dto.getInteractionJson()) ? dto.getInteractionJson().toJSONString() : "");
if (!StrUtil.isEmpty(dto.getVehicle_code())) {
TaskDto vehicle_dto = this.findByContainer(dto.getVehicle_code());
@@ -1323,143 +1323,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
@Override
public TaskDto foramte(TaskDto task) {
String start_point_code = task.getStart_point_code();
String next_point_code = task.getNext_point_code();
String from_y = null;
String from_z = null;
String to_y = null;
String to_z = null;
CommonFinalParam commonFinalParam = new CommonFinalParam();
if (StrUtil.contains(start_point_code, commonFinalParam.getBARRE()) && StrUtil.count(start_point_code, commonFinalParam.getBARRE()) == 2) {
String[] start_point = start_point_code.split(commonFinalParam.getBARRE());
Device starPoint = deviceAppService.findDeviceByCode(start_point[0]);
task.setFrom_x(starPoint.getExtraValue().get("x").toString());
task.setStart_device_code(start_point[0]);
if (Integer.parseInt(start_point[1]) < 10 && start_point[1].length() == 1) {
from_y = "0" + start_point[1];
task.setFrom_y(from_y);
} else {
from_y = start_point[1];
task.setFrom_y(from_y);
}
if (Integer.parseInt(start_point[2]) < 10 && start_point[2].length() == 1) {
from_z = "0" + start_point[2];
task.setFrom_z(from_z);
} else if (start_point[2].length() == 2) {
from_z = start_point[2];
task.setFrom_z(start_point[2]);
} else {
from_z = start_point[2];
}
task.setStart_point_code(task.getStart_device_code() + commonFinalParam.getBARRE() + from_y + commonFinalParam.getBARRE() + from_z);
task.setStart_device_code(task.getStart_device_code());
} else {
DeviceDriverDefination deviceDriverDefination = deviceAppService.findDeviceByCode(start_point_code).getDeviceDriverDefination();
if (BeanUtil.isNotEmpty(deviceDriverDefination)) {
String start_device =
deviceDriverDefination
.getFitDeviceTypes()
.get(0)
.name();
// 如果point_device为货架则不包含列层信息需要重新拼接
if (StrUtil.equals("storage", start_device)) {
if (StrUtil.isEmpty(task.getFrom_x())) {
throw new BadRequestException(LangProcess.msg("start_point_column"));
}
if (StrUtil.isEmpty(task.getFrom_y())) {
throw new BadRequestException(LangProcess.msg("start_point_layer"));
}
if (Integer.parseInt(task.getFrom_y()) < 10 && task.getFrom_y().length() == 1) {
from_y = "0" + task.getFrom_y();
task.setFrom_y(from_y);
} else {
from_y = task.getFrom_y();
}
if (Integer.parseInt(task.getFrom_z()) < 10 && task.getFrom_z().length() == 1) {
from_z = "0" + task.getFrom_z();
task.setFrom_z(from_z);
} else if (task.getFrom_z().length() == 2) {
from_z = task.getFrom_z();
task.setFrom_z(from_z);
} else {
from_z = task.getFrom_z();
}
Device starPoint = deviceAppService.findDeviceByCode(start_point_code);
task.setFrom_x(starPoint.getExtraValue().get("x").toString());
task.setStart_point_code(start_point_code + commonFinalParam.getBARRE() + from_y + commonFinalParam.getBARRE() + from_z);
task.setStart_device_code(start_point_code);
}
} else {
task.setStart_device_code(start_point_code);
task.setStart_device_code(start_point_code);
}
}
if (StrUtil.contains(next_point_code, commonFinalParam.getBARRE()) && StrUtil.count(next_point_code, commonFinalParam.getBARRE()) == 2) {
String[] next_point = next_point_code.split(commonFinalParam.getBARRE());
task.setNext_device_code(next_point[0]);
Device nextDevice = deviceAppService.findDeviceByCode(next_point[0]);
task.setTo_x(nextDevice.getExtraValue().get("x").toString());
if (Integer.parseInt(next_point[1]) < 10 && next_point[1].length() == 1) {
to_y = "0" + next_point[1];
task.setTo_y(to_y);
} else {
to_y = next_point[1];
task.setTo_y(to_y);
}
if (Integer.parseInt(next_point[2]) < 10 && next_point[2].length() == 1) {
to_z = "0" + next_point[2];
task.setTo_z(to_z);
} else if (next_point[2].length() == 2) {
to_z = next_point[2];
task.setTo_z(to_z);
} else {
to_z = next_point[2];
task.setTo_z(to_z);
}
task.setNext_point_code(task.getNext_device_code() + commonFinalParam.getBARRE() + to_y + commonFinalParam.getBARRE() + to_z);
task.setNext_device_code(task.getNext_device_code());
} else {
DeviceDriverDefination deviceDriverDefination = deviceAppService.findDeviceByCode(next_point_code).getDeviceDriverDefination();
if (BeanUtil.isNotEmpty(deviceDriverDefination)) {
String next_device =
deviceDriverDefination
.getFitDeviceTypes()
.get(0)
.name();
if (StrUtil.equals("storage", next_device)) {
if (StrUtil.isEmpty(task.getTo_x())) {
throw new BadRequestException(LangProcess.msg("endpoint_column"));
}
if (StrUtil.isEmpty(task.getTo_y())) {
throw new BadRequestException(LangProcess.msg("endpoint_layer"));
}
if (Integer.parseInt(task.getTo_y()) < 10 && task.getTo_y().length() == 1) {
to_y = "0" + task.getTo_y();
task.setTo_y(to_y);
} else {
to_y = task.getTo_y();
}
if (Integer.parseInt(task.getTo_z()) < 10 && task.getTo_z().length() == 1) {
to_z = "0" + task.getTo_z();
task.setTo_z(to_z);
} else if (task.getTo_z().length() == 2) {
to_z = task.getTo_z();
task.setTo_z(to_z);
} else {
to_z = task.getTo_z();
}
task.setTo_x(next_point_code);
task.setNext_point_code(next_point_code + commonFinalParam.getBARRE() + to_y + commonFinalParam.getBARRE() + to_z);
task.setNext_device_code(next_point_code);
}
} else {
task.setNext_device_code(next_point_code);
task.setNext_device_code(next_point_code);
}
}
return task;
}