1. 创建工作流逻辑修改
This commit is contained in:
parent
9d0b5c3132
commit
e49d205deb
|
|
@ -522,13 +522,21 @@ public class WorkServiceImplements implements IWorkService {
|
|||
List<WorkFlow> allFlows = new ArrayList<>();
|
||||
// 获取当天所有的装载机工作
|
||||
List<WorkFlow> thisDayMWLWorks = new ArrayList<>();
|
||||
findWorks("", thisDayMWLWorks, "MWL", currentWorkDate);
|
||||
// 获取到当天所有的平地机工作
|
||||
List<WorkFlow> thisDayMGWorks = new ArrayList<>();
|
||||
// 需要合并第二天的平地机工作
|
||||
List<WorkFlow> nextDayMGWorks = new ArrayList<>();
|
||||
// 获取工作优先级
|
||||
String workPriority = configMap.get(ConfigMapKeyEnum.WORK_PRIORITY.getConfigKey());
|
||||
// 获取目前已经存在的工作流
|
||||
List<WorkFlow> allOldWorkFlows = workFlowService.list();
|
||||
if (!StringUtils.isEmpty(workPriority) && workPriority.equals("1")) {
|
||||
List<WorkFlow> oldMwlWorkFlows = allOldWorkFlows.stream().filter(workFlow -> workFlow.getMachineType() == 1).toList();
|
||||
if (oldMwlWorkFlows.isEmpty()) {
|
||||
// 先平地机再装载机
|
||||
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")) {
|
||||
|
|
@ -537,34 +545,51 @@ public class WorkServiceImplements implements IWorkService {
|
|||
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()) {
|
||||
List<WorkFlow> oldMgWorkFlows = allOldWorkFlows.stream().filter(workFlow -> workFlow.getMachineType() == 2).toList();
|
||||
if (oldMgWorkFlows.isEmpty()) {
|
||||
// 装载机
|
||||
findWorks("", thisDayMWLWorks, "MWL", currentWorkDate);
|
||||
if (!thisDayMWLWorks.isEmpty()) {
|
||||
allFlows.addAll(thisDayMWLWorks);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// 装载机
|
||||
findWorks("", thisDayMWLWorks, "MWL", currentWorkDate);
|
||||
if (!thisDayMWLWorks.isEmpty()) {
|
||||
allFlows.addAll(thisDayMWLWorks);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
List<WorkFlow> oldMgWorkFlows = allOldWorkFlows.stream().filter(workFlow -> workFlow.getMachineType() == 2).toList();
|
||||
if (oldMgWorkFlows.isEmpty()) {
|
||||
// 先装载机再平地机
|
||||
findWorks("", thisDayMWLWorks, "MWL", currentWorkDate);
|
||||
if (!thisDayMWLWorks.isEmpty()) {
|
||||
allFlows.addAll(thisDayMWLWorks);
|
||||
} else {
|
||||
List<WorkFlow> oldMwlWorkFlows = workFlowService.list(new LambdaQueryWrapper<WorkFlow>()
|
||||
.eq(WorkFlow::getMachineType, 1));
|
||||
if (!thisDayMGWorks.isEmpty() && oldMwlWorkFlows.isEmpty()) {
|
||||
List<WorkFlow> oldMwlWorkFlows = allOldWorkFlows.stream().filter(workFlow -> workFlow.getMachineType() == 1).toList();
|
||||
if (oldMwlWorkFlows.isEmpty()) {
|
||||
// 平地机
|
||||
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")) {
|
||||
// 获取下一个工作日
|
||||
LocalDate nextWorkDate = nextWorkDate(currentWorkDate);
|
||||
if (nextWorkDate != null && nextWorkDate.isAfter(currentWorkDate)) {
|
||||
findWorks("", nextDayMGWorks, "NOT_MWL", nextWorkDate);
|
||||
}
|
||||
if (!nextDayMGWorks.isEmpty()) {
|
||||
// 添加第二天的平地机工作进汇总
|
||||
allFlows.addAll(nextDayMGWorks);
|
||||
|
|
@ -572,6 +597,29 @@ public class WorkServiceImplements implements IWorkService {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// 平地机
|
||||
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")) {
|
||||
// 获取下一个工作日
|
||||
LocalDate nextWorkDate = nextWorkDate(currentWorkDate);
|
||||
if (nextWorkDate != null && nextWorkDate.isAfter(currentWorkDate)) {
|
||||
findWorks("", nextDayMGWorks, "NOT_MWL", nextWorkDate);
|
||||
}
|
||||
if (!nextDayMGWorks.isEmpty()) {
|
||||
// 添加第二天的平地机工作进汇总
|
||||
allFlows.addAll(nextDayMGWorks);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (!allFlows.isEmpty()) {
|
||||
// 处理这些工作流
|
||||
List<WorkFlow> oldWorkFlows = workFlowService.list();
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user