代码更新:

1. 增加工作日期配置
This commit is contained in:
梁州 2024-12-31 18:34:27 +08:00
parent c327a8032f
commit 7d681334d4
3 changed files with 30 additions and 7 deletions

View File

@ -20,7 +20,9 @@ public enum ConfigMapKeyEnum {
URL_WCS_CHANGE_TASK("URL_WCS_CHANGE_TASK"), URL_WCS_CHANGE_TASK("URL_WCS_CHANGE_TASK"),
LOG_DELETE_INTERVAL("LOG_DELETE_INTERVAL"), LOG_DELETE_INTERVAL("LOG_DELETE_INTERVAL"),
RECORD_DELETE_INTERVAL("RECORD_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; private final String configKey;
ConfigMapKeyEnum(String configKey) { ConfigMapKeyEnum(String configKey) {
this.configKey = configKey; this.configKey = configKey;

View File

@ -355,8 +355,10 @@ public class WmsTaskServiceImplements implements IWmsTaskService {
outsideVehiclesService.updateBatchById(usedOutsideVehiclesList); outsideVehiclesService.updateBatchById(usedOutsideVehiclesList);
// 生成拣选任务 // 生成拣选任务
List<String> vehicleIds = usedOutsideVehiclesList.stream().map(OutsideVehicles::getVehicleId).distinct().toList(); List<String> vehicleIds = usedOutsideVehiclesList.stream().map(OutsideVehicles::getVehicleId).distinct().toList();
if (!vehicleIds.isEmpty()) {
createPickTasks(vehicleIds, workStation, PickTaskStatusEnum.NEW.getCode()); createPickTasks(vehicleIds, workStation, PickTaskStatusEnum.NEW.getCode());
} }
}
return needNum; return needNum;
} catch (Exception e) { } catch (Exception e) {
logger.error("呼叫物料时发生异常:{}", convertJsonString(e)); logger.error("呼叫物料时发生异常:{}", convertJsonString(e));

View File

@ -81,7 +81,26 @@ public class WorkServiceImplements implements IWorkService {
} }
try { 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; return;
} }
// 先查看当前站台已经生成的工作流是否为空 // 先查看当前站台已经生成的工作流是否为空
@ -94,10 +113,10 @@ public class WorkServiceImplements implements IWorkService {
// 当前站台分配的工位 // 当前站台分配的工位
List<WorkFlow> currentStationWorkFlows = new ArrayList<>(); List<WorkFlow> currentStationWorkFlows = new ArrayList<>();
// 先找MWL机型 // 先找MWL机型
findWorks(workStation, currentStationWorkFlows, "MWL"); findWorks(workStation, currentStationWorkFlows, "MWL", currentWorkDate);
if (currentStationWorkFlows.isEmpty()) { if (currentStationWorkFlows.isEmpty()) {
// 找非MWL机型 // 找非MWL机型
findWorks(workStation, currentStationWorkFlows, "NOT_MWL"); findWorks(workStation, currentStationWorkFlows, "NOT_MWL", currentWorkDate);
} }
// 如果当前站台有任务 // 如果当前站台有任务
if (!currentStationWorkFlows.isEmpty()) { if (!currentStationWorkFlows.isEmpty()) {
@ -507,7 +526,7 @@ public class WorkServiceImplements implements IWorkService {
* @param workFlows 工作流/工作任务 * @param workFlows 工作流/工作任务
* @param model 机型 * @param model 机型
*/ */
private void findWorks(String workStation, List<WorkFlow> workFlows, String model) { private void findWorks(String workStation, List<WorkFlow> workFlows, String model, LocalDate currentWorkDate) {
// 查到当前站台所有的小工位 // 查到当前站台所有的小工位
LambdaQueryWrapper<WorkStationConfig> stationConfigQueryWrapper = new LambdaQueryWrapper<WorkStationConfig>().eq(WorkStationConfig::getWorkStation, workStation); LambdaQueryWrapper<WorkStationConfig> stationConfigQueryWrapper = new LambdaQueryWrapper<WorkStationConfig>().eq(WorkStationConfig::getWorkStation, workStation);
if (Objects.equals(model, "MWL")) { if (Objects.equals(model, "MWL")) {
@ -564,7 +583,7 @@ public class WorkServiceImplements implements IWorkService {
// 调整后的日期不再工作日范围 // 调整后的日期不再工作日范围
continue; continue;
} }
if (localWorkDateList.get(indexAfterAdjust).equals(LocalDate.now())) { if (localWorkDateList.get(indexAfterAdjust).equals(currentWorkDate)) {
// 已经查询过的为了不重复查询添加map // 已经查询过的为了不重复查询添加map
ordersAndDBSMap.put(kateWorkOrder.getWorkOrder(), kateDBS); ordersAndDBSMap.put(kateWorkOrder.getWorkOrder(), kateDBS);
// 添加工作计划 // 添加工作计划