feat(wms): 添加钢卷数据校验逻辑

- 实现钢卷存在性校验,确保钢卷未被删除
- 添加钢卷类型校验,只允许现存钢卷(dataType=1)参与加工
- 阻止历史钢卷被用于退火操作
- 提供详细的错误提示信息
This commit is contained in:
2026-06-14 11:31:10 +08:00
parent 0968dcaded
commit 857daa24af

View File

@@ -264,6 +264,20 @@ public class WmsFurnacePlanServiceImpl implements IWmsFurnacePlanService {
throw new ServiceException("计划进行中,无法再领料");
}
// 校验钢卷必须为现存钢卷dataType=1历史钢卷不能被加工
List<WmsMaterialCoil> coils = materialCoilMapper.selectBatchIds(coilIds);
Set<Long> existingIds = coils.stream().map(WmsMaterialCoil::getCoilId).collect(Collectors.toSet());
for (Long coilId : coilIds) {
if (!existingIds.contains(coilId)) {
throw new ServiceException("钢卷被删除无法执行退火");
}
}
for (WmsMaterialCoil coil : coils) {
if (coil.getDataType() == null || coil.getDataType() != 1) {
throw new ServiceException("钢卷" + coil.getEnterCoilNo() + "为历史钢卷,不能被加工");
}
}
for (Long coilId : coilIds) {
if (planCoilMapper.selectCount(Wrappers.<WmsFurnacePlanCoil>lambdaQuery()
.eq(WmsFurnacePlanCoil::getPlanId, bo.getPlanId())