1. 控制工作流的生成。

This commit is contained in:
梁州 2025-04-27 17:11:09 +08:00
parent 5d6b17bc77
commit 9d0b5c3132
2 changed files with 46 additions and 9 deletions

View File

@ -6,6 +6,7 @@ import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
/**
@ -88,4 +89,19 @@ public class WorkFlowVo {
*/
@JsonProperty("opUser")
private String opUser;
/**
* 机器类型
*/
@JsonProperty("machineType")
private Integer machineType;
/**
* 计划日期
*/
@JsonProperty("planDate")
private LocalDate planDate;
/**
* 大盒子号
*/
@JsonProperty("bigBox")
private String bigBox;
}

View File

@ -523,33 +523,54 @@ public class WorkServiceImplements implements IWorkService {
// 获取当天所有的装载机工作
List<WorkFlow> thisDayMWLWorks = new ArrayList<>();
findWorks("", thisDayMWLWorks, "MWL", currentWorkDate);
if (!thisDayMWLWorks.isEmpty()) {
allFlows.addAll(thisDayMWLWorks);
} else {
System.out.println("查询MWL为空");
}
// 获取到当天所有的平地机工作
List<WorkFlow> thisDayMGWorks = new ArrayList<>();
// 需要合并第二天的平地机工作
List<WorkFlow> nextDayMGWorks = new ArrayList<>();
findWorks("", thisDayMGWorks, "NOT_MWL", currentWorkDate);
if (!thisDayMGWorks.isEmpty()) {
allFlows.addAll(thisDayMGWorks);
// 查询配置是否需要合并第二天的配置
String ifMergeTomorrow = configMap.get(ConfigMapKeyEnum.IF_MERGE_TOMORROW.getConfigKey());
if (!StringUtils.isEmpty(ifMergeTomorrow) && ifMergeTomorrow.equals("1")) {
// 需要合并第二天的平地机工作
List<WorkFlow> nextDayMGWorks = new ArrayList<>();
// 获取下一个工作日
LocalDate nextWorkDate = nextWorkDate(currentWorkDate);
if (nextWorkDate != null && nextWorkDate.isAfter(currentWorkDate)) {
findWorks("", nextDayMGWorks, "NOT_MWL", nextWorkDate);
}
}
}
// 获取工作优先级
String workPriority = configMap.get(ConfigMapKeyEnum.WORK_PRIORITY.getConfigKey());
if (!StringUtils.isEmpty(workPriority) && workPriority.equals("1")) {
// 先平地机再装载机
if (!thisDayMGWorks.isEmpty()) {
allFlows.addAll(thisDayMGWorks);
if (!nextDayMGWorks.isEmpty()) {
// 添加第二天的平地机工作进汇总
allFlows.addAll(nextDayMGWorks);
}
} else {
List<WorkFlow> oldMgWorkFlows = workFlowService.list(new LambdaQueryWrapper<WorkFlow>()
.eq(WorkFlow::getMachineType, 2));
if (!thisDayMWLWorks.isEmpty() && oldMgWorkFlows.isEmpty()) {
allFlows.addAll(thisDayMWLWorks);
}
}
} else {
// 先装载机再平地机
if (!thisDayMWLWorks.isEmpty()) {
allFlows.addAll(thisDayMWLWorks);
} else {
List<WorkFlow> oldMwlWorkFlows = workFlowService.list(new LambdaQueryWrapper<WorkFlow>()
.eq(WorkFlow::getMachineType, 1));
if (!thisDayMGWorks.isEmpty() && oldMwlWorkFlows.isEmpty()) {
allFlows.addAll(thisDayMGWorks);
if (!nextDayMGWorks.isEmpty()) {
// 添加第二天的平地机工作进汇总
allFlows.addAll(nextDayMGWorks);
}
}
} else {
System.out.println("查询MG为空");
}
}
if (!allFlows.isEmpty()) {
// 处理这些工作流