fix:补空任务增加点位任务校验

This commit is contained in:
zhangzq
2025-05-03 19:09:54 +08:00
parent 3b8067e633
commit 1eccd3aa7b
2 changed files with 29 additions and 11 deletions

View File

@@ -1009,9 +1009,7 @@ public class BstIvtPackageinfoivtServiceImpl extends ServiceImpl<BstIvtPackagein
//子卷质检合格品和管制品 //子卷质检合格品和管制品
if (StringUtils.isNotBlank(whereJson.getString("container_name")) && StringUtils.isBlank(whereJson.getString("pointCode"))) { if (StringUtils.isNotBlank(whereJson.getString("container_name")) && StringUtils.isBlank(whereJson.getString("pointCode"))) {
if (whereJson.getString("ivt_status").equals(PackageInfoIvtEnum.IVT_STATUS.code("")) || whereJson.getString("ivt_status").equals(PackageInfoIvtEnum.IVT_STATUS.code("空载具")) || whereJson.getString("ivt_status").equals(PackageInfoIvtEnum.IVT_STATUS.code("有子卷"))) { if (whereJson.getString("ivt_status").equals(PackageInfoIvtEnum.IVT_STATUS.code("")) || whereJson.getString("ivt_status").equals(PackageInfoIvtEnum.IVT_STATUS.code("空载具")) || whereJson.getString("ivt_status").equals(PackageInfoIvtEnum.IVT_STATUS.code("有子卷"))) {
result.put("status", org.springframework.http.HttpStatus.BAD_REQUEST.value()); throw new BadRequestException("质检结果只能为合格品或管制品");
result.put("message", "质检结果只能为合格品或管制品!");
return result;
} }
if (whereJson.getString("ivt_status").equals(PackageInfoIvtEnum.IVT_STATUS.code("管制品"))) { if (whereJson.getString("ivt_status").equals(PackageInfoIvtEnum.IVT_STATUS.code("管制品"))) {
PdmBiSubpackagerelation one = subpackagerelationService.getOne(new QueryWrapper<PdmBiSubpackagerelation>() PdmBiSubpackagerelation one = subpackagerelationService.getOne(new QueryWrapper<PdmBiSubpackagerelation>()
@@ -1029,12 +1027,15 @@ public class BstIvtPackageinfoivtServiceImpl extends ServiceImpl<BstIvtPackagein
result.put("message", "存在多个相同子卷号或点位信息有误,请核对是否存在!"); result.put("message", "存在多个相同子卷号或点位信息有误,请核对是否存在!");
return result; return result;
} }
if (dtoList.get(0).getPoint_code().equals("ZXQ_135") || dtoList.get(0).getPoint_code().equals("ZXQ_136")) { BstIvtPackageinfoivt packageinfoivt = dtoList.get(0);
result.put("status", org.springframework.http.HttpStatus.BAD_REQUEST.value()); String pointCode = packageinfoivt.getPoint_code();
result.put("message", "请选择点位信息!"); if (pointCode.equals("ZXQ_135") || pointCode.equals("ZXQ_136")) {
return result; throw new BadRequestException("管制点设置子卷状态时需要选择点位");
} }
if (whereJson.getString("ivt_status").equals(PackageInfoIvtEnum.IVT_STATUS.code("合格品"))) { if (whereJson.getString("ivt_status").equals(PackageInfoIvtEnum.IVT_STATUS.code("合格品"))) {
if (packageinfoivt.getIvt_status().equals(PackageInfoIvtEnum.IVT_STATUS.code("管制品"))){
throw new BadRequestException("当前子卷已设置为管制品");
}
//获取子卷最新信息 //获取子卷最新信息
jo.put("container_name", whereJson.getString("container_name")); jo.put("container_name", whereJson.getString("container_name"));
lmsToMesService.getInspectionResult(jo); lmsToMesService.getInspectionResult(jo);
@@ -1067,8 +1068,8 @@ public class BstIvtPackageinfoivtServiceImpl extends ServiceImpl<BstIvtPackagein
} }
} }
PdmProductSpecServiceImpl.doRecord(SpecEnum.ZJ,MapOf.of("质检结果",whereJson.getString("ivt_status")),Boolean.TRUE,null,dtoList.get(0).getContainer_name()); PdmProductSpecServiceImpl.doRecord(SpecEnum.ZJ,MapOf.of("质检结果",whereJson.getString("ivt_status")),Boolean.TRUE,null, packageinfoivt.getContainer_name());
updateWrapper.set("container_name", dtoList.get(0).getContainer_name()); updateWrapper.set("container_name", packageinfoivt.getContainer_name());
updateWrapper.set("ivt_status", whereJson.getString("ivt_status")); updateWrapper.set("ivt_status", whereJson.getString("ivt_status"));
} }
//复称 //复称
@@ -1119,7 +1120,15 @@ public class BstIvtPackageinfoivtServiceImpl extends ServiceImpl<BstIvtPackagein
result.put("message", "请输入子卷号或管制点位信息!"); result.put("message", "请输入子卷号或管制点位信息!");
return result; return result;
} }
updateWrapper.eq("point_code", dtoList.get(0).getPoint_code()); String pointCode = dtoList.get(0).getPoint_code();
if (dtoList.get(0).getPoint_status().equals(PackageInfoIvtEnum.POINT_STATUS.code("满轴缓存位"))){
throw new BadRequestException("满轴缓存位无法设置子卷状态");
}
List<SchBaseTask> schBaseTasks = taskService.checkHaveTask(pointCode);
if (!CollectionUtils.isEmpty(schBaseTasks)){
throw new BadRequestException("当前点位"+dtoList.get(0).getPoint_name()+"正在执行搬运任务"+schBaseTasks.stream().map(SchBaseTask::getTask_code).collect(Collectors.joining(",")));
}
updateWrapper.eq("point_code", pointCode);
updateWrapper.set("update_optid", Long.valueOf(SecurityUtils.getCurrentUserId())); updateWrapper.set("update_optid", Long.valueOf(SecurityUtils.getCurrentUserId()));
updateWrapper.set("update_optname", SecurityUtils.getCurrentNickName()); updateWrapper.set("update_optname", SecurityUtils.getCurrentNickName());
updateWrapper.set("update_time", DateUtil.now()); updateWrapper.set("update_time", DateUtil.now());

View File

@@ -7,6 +7,7 @@ import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
@@ -159,6 +160,14 @@ public class DjqToKzjhcwTask extends AbstractAcsTask {
if (StrUtil.isBlank(pointCode2)) { if (StrUtil.isBlank(pointCode2)) {
throw new BadRequestException("下一点不能为空"); throw new BadRequestException("下一点不能为空");
} }
String pointCode3 = form.getString("point_code3");
int count = taskService.count(new QueryWrapper<SchBaseTask>()
.eq("is_delete", "0")
.eq("pointCode3", pointCode3)
.lt("task_status", TaskStatusEnum.FINISHED.getCode()));
if (count>0){
throw new BadRequestException(pointCode3+"当前点位已经存在任务");
}
//是否立即下发 //是否立即下发
boolean isSend = !StrUtil.isNotBlank(form.getString("is_send")) || BooleanUtil.toBoolean(form.getString("is_send")); boolean isSend = !StrUtil.isNotBlank(form.getString("is_send")) || BooleanUtil.toBoolean(form.getString("is_send"));
SchBaseTaskVO schBaseTaskVo = SchBaseTaskVO.builder() SchBaseTaskVO schBaseTaskVo = SchBaseTaskVO.builder()
@@ -167,7 +176,7 @@ public class DjqToKzjhcwTask extends AbstractAcsTask {
.vehicle_code2(form.getString("vehicle_code2")) .vehicle_code2(form.getString("vehicle_code2"))
.point_code1(pointCode1) .point_code1(pointCode1)
.point_code2(pointCode2) .point_code2(pointCode2)
.point_code3(form.getString("point_code3")) .point_code3(pointCode3)
.point_code4(form.getString("point_code4")) .point_code4(form.getString("point_code4"))
.task_group_id(form.getString("task_group_id")) .task_group_id(form.getString("task_group_id"))
.task_id(org.nl.common.utils.IdUtil.getStringId()) .task_id(org.nl.common.utils.IdUtil.getStringId())