From 02e3fbfc96e08c9285daaa5a6ec53716c747a671 Mon Sep 17 00:00:00 2001 From: zhang <zc857179121@qq.com> Date: 星期五, 29 八月 2025 10:42:18 +0800 Subject: [PATCH] 1 --- zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/ValidService.java | 66 +++++++++++++++++++-------------- 1 files changed, 38 insertions(+), 28 deletions(-) diff --git a/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/ValidService.java b/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/ValidService.java index 31435f3..400c064 100644 --- a/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/ValidService.java +++ b/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/ValidService.java @@ -37,7 +37,7 @@ @Autowired private SnowflakeIdWorker snowflakeIdWorker; - public List<Task> validBusDto(List<TaskDto> taskDtoList) { + public List<Task> validTaskDtoList(List<TaskDto> taskDtoList) { List<Task> taskList = new ArrayList<>(); for (TaskDto taskDto : taskDtoList) { if (Cools.isEmpty(taskDto.getSeqNum())) { @@ -49,6 +49,7 @@ task.setSeqNum(taskDto.getSeqNum()); task.setPriority(taskDto.getPriority()); + // ori -------------------------- if (!Cools.isEmpty(taskDto.getOriLoc())) { Loc oriLoc = locService.selecatByLocNo(taskDto.getOriLoc()); @@ -56,13 +57,16 @@ throw new BusinessException("oriLoc: " + taskDto.getOriLoc() + " doesn't exist!"); } task.setOriLoc(oriLoc.getId()); +// task.setOriCode(oriLoc.getCode()); } if (!Cools.isEmpty(taskDto.getOriSta())) { - Sta oriSta = staService.selectByStaNo(taskDto.getOriSta()); + Sta oriSta = staService.selectByStaNoOrName(taskDto.getOriSta()); + if (null == oriSta) { throw new BusinessException("oriSta: " + taskDto.getOriSta() + " doesn't exist!"); } task.setOriSta(oriSta.getId()); +// task.setOriCode(oriSta.getCode()); } // dest -------------------------- if (!Cools.isEmpty(taskDto.getDestLoc())) { @@ -74,7 +78,7 @@ task.setDestCode(destLoc.getCode()); } if (!Cools.isEmpty(taskDto.getDestSta())) { - Sta destSta = staService.selectByStaNo(taskDto.getDestSta()); + Sta destSta = staService.selectByStaNoOrName(taskDto.getDestSta()); if (null == destSta) { throw new BusinessException("destSta: " + taskDto.getDestSta() + " doesn't exist!"); } @@ -95,20 +99,24 @@ if (null != task.getDestLoc() && null != task.getDestSta()) { throw new BusinessException("seNum:" + task.getSeqNum() + " is wrong锛宔ither destLoc and destSta must be present"); } - if (null != task.getOriSta()) { - if (null != task.getDestLoc()) { - task.setTaskType(TaskTypeType.STA_TO_LOC.val()); + if (!Cools.isEmpty(taskDto.getTaskType())) { + task.setTaskType(TaskTypeType.valueOf(taskDto.getTaskType()).val()); + } else { + if (null != task.getOriSta()) { + if (null != task.getDestLoc()) { + task.setTaskType(TaskTypeType.STA_TO_LOC.val()); + } + if (null != task.getDestSta()) { + task.setTaskType(TaskTypeType.STA_TO_STA.val()); + } } - if (null != task.getDestSta()) { - task.setTaskType(TaskTypeType.STA_TO_STA.val()); - } - } - if (null != task.getOriLoc()) { - if (null != task.getDestLoc()) { - task.setTaskType(TaskTypeType.LOC_TO_LOC.val()); - } - if (null != task.getDestSta()) { - task.setTaskType(TaskTypeType.LOC_TO_STA.val()); + if (null != task.getOriLoc()) { + if (null != task.getDestLoc()) { + task.setTaskType(TaskTypeType.LOC_TO_LOC.val()); + } + if (null != task.getDestSta()) { + task.setTaskType(TaskTypeType.LOC_TO_STA.val()); + } } } } @@ -117,16 +125,18 @@ for (Task task : taskList) { Code startCode = null; Code endCode = null; - Loc oriLoc = null; Loc destLoc = null; - Sta oriSta = null; Sta destSta = null; + Loc oriLoc = null; + Loc destLoc = null; + Sta oriSta = null; + Sta destSta = null; List<String> pathList = null; switch (Objects.requireNonNull(TaskTypeType.get(task.getTaskTypeEl()))) { case LOC_TO_LOC: oriLoc = locService.getById(task.getOriLoc()); destLoc = locService.getById(task.getDestLoc()); - startCode = codeService.getById(oriLoc.getCode()); - endCode = codeService.getById(destLoc.getCode()); + startCode = codeService.getCacheById(oriLoc.getCode()); + endCode = codeService.getCacheById(destLoc.getCode()); if (null == startCode) { throw new BusinessException("oriLoc锛�" + oriLoc.getLocNo() + " hasn't been bound to a QrCode yet"); } @@ -143,8 +153,8 @@ oriLoc = locService.getById(task.getOriLoc()); destSta = staService.getById(task.getDestSta()); - startCode = codeService.getById(oriLoc.getCode()); - endCode = codeService.getById(destSta.getCode()); + startCode = codeService.getCacheById(oriLoc.getCode()); + endCode = codeService.getCacheById(destSta.getCode()); if (null == startCode) { throw new BusinessException("oriLoc锛�" + oriLoc.getLocNo() + " hasn't been bound to QrCode yet"); } @@ -161,8 +171,8 @@ oriSta = staService.getById(task.getOriSta()); destLoc = locService.getById(task.getDestLoc()); - startCode = codeService.getById(oriSta.getCode()); - endCode = codeService.getById(destLoc.getCode()); + startCode = codeService.getCacheById(oriSta.getCode()); + endCode = codeService.getCacheById(destLoc.getCode()); if (null == startCode) { throw new BusinessException("oriSta锛�" + oriSta.getStaNo() + " hasn't bound to QrCode yet"); } @@ -179,13 +189,13 @@ oriSta = staService.getById(task.getOriSta()); destSta = staService.getById(task.getDestSta()); - startCode = codeService.getById(oriSta.getCode()); - endCode = codeService.getById(destSta.getCode()); + startCode = codeService.getCacheById(oriSta.getCode()); + endCode = codeService.getCacheById(destSta.getCode()); if (null == startCode) { - throw new BusinessException("oriSta锛�" + oriSta.getStaNo() + " 鏈粦瀹氬湴闈㈢爜"); + throw new BusinessException("oriSta锛�" + oriSta.getStaNo() + " hasn't been bound to a QrCode yet"); } if (null == endCode) { - throw new BusinessException("destSta锛�" + destSta.getStaNo() + " 鏈粦瀹氬湴闈㈢爜"); + throw new BusinessException("destSta锛�" + destSta.getStaNo() + " is not bound to a QrCode yet"); } pathList = mapService.validFeasibility(startCode, endCode); if (Cools.isEmpty(pathList)) { -- Gitblit v1.9.1