From 7d681334d465d9c22fdaa8f30633d8ce7df0d88a Mon Sep 17 00:00:00 2001 From: liangzhou <594755172@qq.com> Date: Tue, 31 Dec 2024 18:34:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=9B=B4=E6=96=B0=EF=BC=9A?= =?UTF-8?q?=201.=20=E5=A2=9E=E5=8A=A0=E5=B7=A5=E4=BD=9C=E6=97=A5=E6=9C=9F?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wms/constants/enums/ConfigMapKeyEnum.java | 4 ++- .../WmsTaskServiceImplements.java | 4 ++- .../WorkServiceImplements.java | 29 +++++++++++++++---- 3 files changed, 30 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/wms/constants/enums/ConfigMapKeyEnum.java b/src/main/java/com/wms/constants/enums/ConfigMapKeyEnum.java index 7c3b852..166afdb 100644 --- a/src/main/java/com/wms/constants/enums/ConfigMapKeyEnum.java +++ b/src/main/java/com/wms/constants/enums/ConfigMapKeyEnum.java @@ -20,7 +20,9 @@ public enum ConfigMapKeyEnum { URL_WCS_CHANGE_TASK("URL_WCS_CHANGE_TASK"), LOG_DELETE_INTERVAL("LOG_DELETE_INTERVAL"), RECORD_DELETE_INTERVAL("RECORD_DELETE_INTERVAL"), - IMPORTANT_RECORD_DELETE_INTERVAL("IMPORTANT_RECORD_DELETE_INTERVAL"); + IMPORTANT_RECORD_DELETE_INTERVAL("IMPORTANT_RECORD_DELETE_INTERVAL"), + USE_SETTING_DATE("USE_SETTING_DATE"), + SETTING_DATE("SETTING_DATE"); private final String configKey; ConfigMapKeyEnum(String configKey) { this.configKey = configKey; diff --git a/src/main/java/com/wms/service/business/serviceImplements/WmsTaskServiceImplements.java b/src/main/java/com/wms/service/business/serviceImplements/WmsTaskServiceImplements.java index f18e57e..8c51bcd 100644 --- a/src/main/java/com/wms/service/business/serviceImplements/WmsTaskServiceImplements.java +++ b/src/main/java/com/wms/service/business/serviceImplements/WmsTaskServiceImplements.java @@ -355,7 +355,9 @@ public class WmsTaskServiceImplements implements IWmsTaskService { outsideVehiclesService.updateBatchById(usedOutsideVehiclesList); // 生成拣选任务 List vehicleIds = usedOutsideVehiclesList.stream().map(OutsideVehicles::getVehicleId).distinct().toList(); - createPickTasks(vehicleIds, workStation, PickTaskStatusEnum.NEW.getCode()); + if (!vehicleIds.isEmpty()) { + createPickTasks(vehicleIds, workStation, PickTaskStatusEnum.NEW.getCode()); + } } return needNum; } catch (Exception e) { diff --git a/src/main/java/com/wms/service/business/serviceImplements/WorkServiceImplements.java b/src/main/java/com/wms/service/business/serviceImplements/WorkServiceImplements.java index a24c15c..2278f7d 100644 --- a/src/main/java/com/wms/service/business/serviceImplements/WorkServiceImplements.java +++ b/src/main/java/com/wms/service/business/serviceImplements/WorkServiceImplements.java @@ -81,7 +81,26 @@ public class WorkServiceImplements implements IWorkService { } try { // 先判断当日是否是工作日 - if (!localWorkDateList.contains(LocalDate.now())) { + LocalDate currentWorkDate = LocalDate.now(); + // 获取当前配置日期 + try { + String useSettingDate = configMap.get(ConfigMapKeyEnum.USE_SETTING_DATE.getConfigKey()); + if (!StringUtils.isEmpty(useSettingDate) && useSettingDate.equals("1")) { + String settingDate = configMap.get(ConfigMapKeyEnum.SETTING_DATE.getConfigKey()); + if (!StringUtils.isEmpty(settingDate)) { + String[] settingDateArray = settingDate.split("-"); + int settingDateYear = Integer.parseInt(settingDateArray[0]); + int settingDateMonth = Integer.parseInt(settingDateArray[1]); + int settingDateDay = Integer.parseInt(settingDateArray[2]); + // 系统配置的当前日期 + currentWorkDate = LocalDate.of(settingDateYear, settingDateMonth, settingDateDay); + } + } + } catch (Exception e) { + logger.error("获取配置工作日期错误,使用当前系统日期。"); + } + + if (!localWorkDateList.contains(currentWorkDate)) { return; } // 先查看当前站台已经生成的工作流是否为空 @@ -94,10 +113,10 @@ public class WorkServiceImplements implements IWorkService { // 当前站台分配的工位 List currentStationWorkFlows = new ArrayList<>(); // 先找MWL机型 - findWorks(workStation, currentStationWorkFlows, "MWL"); + findWorks(workStation, currentStationWorkFlows, "MWL", currentWorkDate); if (currentStationWorkFlows.isEmpty()) { // 找非MWL机型 - findWorks(workStation, currentStationWorkFlows, "NOT_MWL"); + findWorks(workStation, currentStationWorkFlows, "NOT_MWL", currentWorkDate); } // 如果当前站台有任务 if (!currentStationWorkFlows.isEmpty()) { @@ -507,7 +526,7 @@ public class WorkServiceImplements implements IWorkService { * @param workFlows 工作流/工作任务 * @param model 机型 */ - private void findWorks(String workStation, List workFlows, String model) { + private void findWorks(String workStation, List workFlows, String model, LocalDate currentWorkDate) { // 查到当前站台所有的小工位 LambdaQueryWrapper stationConfigQueryWrapper = new LambdaQueryWrapper().eq(WorkStationConfig::getWorkStation, workStation); if (Objects.equals(model, "MWL")) { @@ -564,7 +583,7 @@ public class WorkServiceImplements implements IWorkService { // 调整后的日期不再工作日范围 continue; } - if (localWorkDateList.get(indexAfterAdjust).equals(LocalDate.now())) { + if (localWorkDateList.get(indexAfterAdjust).equals(currentWorkDate)) { // 已经查询过的为了不重复查询,添加map ordersAndDBSMap.put(kateWorkOrder.getWorkOrder(), kateDBS); // 添加工作计划