|
@@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.pms.job.mainworkorder;
|
|
import cn.hutool.core.collection.CollUtil;
|
|
import cn.hutool.core.collection.CollUtil;
|
|
import cn.hutool.core.util.ObjUtil;
|
|
import cn.hutool.core.util.ObjUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
+import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
|
import cn.iocoder.yudao.framework.common.util.date.DateUtils;
|
|
import cn.iocoder.yudao.framework.common.util.date.DateUtils;
|
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler;
|
|
import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler;
|
|
@@ -79,16 +80,30 @@ public class CreateMainWorkOrderJob implements JobHandler {
|
|
public String execute(String param) throws Exception {
|
|
public String execute(String param) throws Exception {
|
|
// 查询所有 保养计划明细
|
|
// 查询所有 保养计划明细
|
|
IotMaintenanceBomPageReqVO reqVO = new IotMaintenanceBomPageReqVO();
|
|
IotMaintenanceBomPageReqVO reqVO = new IotMaintenanceBomPageReqVO();
|
|
- List<IotMaintenanceBomDO> mainBomList = iotMaintenanceBomService.getIotMainPlanBomList(reqVO);
|
|
|
|
|
|
+ List<IotMaintenanceBomDO> originMainBomList = iotMaintenanceBomService.getIotMainPlanBomList(reqVO);
|
|
// 查询所有保养计划 保养工单会复制保养计划的部分信息
|
|
// 查询所有保养计划 保养工单会复制保养计划的部分信息
|
|
IotMaintenancePlanPageReqVO planReqVO = new IotMaintenancePlanPageReqVO();
|
|
IotMaintenancePlanPageReqVO planReqVO = new IotMaintenancePlanPageReqVO();
|
|
|
|
+ // 只查询开启状态的保养计划
|
|
|
|
+ planReqVO.setStatus(CommonStatusEnum.ENABLE.getStatus());
|
|
List<IotMaintenancePlanDO> plans = iotMaintenancePlanService.maintenancePlans(planReqVO);
|
|
List<IotMaintenancePlanDO> plans = iotMaintenancePlanService.maintenancePlans(planReqVO);
|
|
if (CollUtil.isEmpty(plans)) {
|
|
if (CollUtil.isEmpty(plans)) {
|
|
return "没有待保养项";
|
|
return "没有待保养项";
|
|
}
|
|
}
|
|
- if (CollUtil.isEmpty(mainBomList)) {
|
|
|
|
|
|
+ if (CollUtil.isEmpty(originMainBomList)) {
|
|
return "没有待保养项";
|
|
return "没有待保养项";
|
|
}
|
|
}
|
|
|
|
+ // 过滤掉停用的保养计划
|
|
|
|
+ List<IotMaintenanceBomDO> mainBomList = new ArrayList<>();
|
|
|
|
+ Set<Long> enabledPlanIds = new HashSet<>();
|
|
|
|
+ plans.forEach(plan -> {
|
|
|
|
+ enabledPlanIds.add(plan.getId());
|
|
|
|
+ });
|
|
|
|
+ originMainBomList.forEach(bom -> {
|
|
|
|
+ if (enabledPlanIds.contains(bom.getPlanId())) {
|
|
|
|
+ mainBomList.add(bom);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+
|
|
List<Long> deviceIds = new ArrayList<>();
|
|
List<Long> deviceIds = new ArrayList<>();
|
|
// 运行记录模板中 多种 累计时长 公里数 属性名称集合
|
|
// 运行记录模板中 多种 累计时长 公里数 属性名称集合
|
|
Set<String> boundedMultiAttrNames = new HashSet<>();
|
|
Set<String> boundedMultiAttrNames = new HashSet<>();
|
|
@@ -261,6 +276,7 @@ public class CreateMainWorkOrderJob implements JobHandler {
|
|
workOrderBom.setBomNodeId(bom.getBomNodeId());
|
|
workOrderBom.setBomNodeId(bom.getBomNodeId());
|
|
workOrderBom.setName(bom.getName());
|
|
workOrderBom.setName(bom.getName());
|
|
workOrderBom.setCode(bom.getCode());
|
|
workOrderBom.setCode(bom.getCode());
|
|
|
|
+ workOrderBom.setType(bom.getType());
|
|
workOrderBOMs.add(workOrderBom);
|
|
workOrderBOMs.add(workOrderBom);
|
|
}
|
|
}
|
|
});
|
|
});
|