|
|
|
@ -734,6 +734,7 @@ public class RecipeManagementServiceImpl extends ServiceImpl<RecipeManagementMap |
|
|
|
if (partInformationEntity == null) { |
|
|
|
throw new RuntimeException("子物料不存在!"); |
|
|
|
} |
|
|
|
validateDrawingNoForNewFormalPart(partInformationEntity, data.getComponentPart()); |
|
|
|
// 检验 weightShare 总和是否大于100 |
|
|
|
List<RecipeComponentVo> componentList = recipeManagementMapper.queryRecipeComponentList(data.getSite(), data.getPartNo(), data.getBomType(), data.getEngChgLevel(), data.getAlternativeNo()); |
|
|
|
BigDecimal sum = componentList.stream().map(RecipeComponentEntity::getWeightShare).reduce(BigDecimal.ZERO, BigDecimal::add); |
|
|
|
@ -1482,4 +1483,18 @@ public class RecipeManagementServiceImpl extends ServiceImpl<RecipeManagementMap |
|
|
|
map.put("detailData", recipeAlternative); |
|
|
|
return map; |
|
|
|
} |
|
|
|
|
|
|
|
private void validateDrawingNoForNewFormalPart(PartInformationEntity partInformationEntity, String componentPart) { |
|
|
|
if (partInformationEntity == null) { |
|
|
|
return; |
|
|
|
} |
|
|
|
if (!"Y".equalsIgnoreCase(StringUtils.trimToEmpty(partInformationEntity.getStatus()))) { |
|
|
|
// 临时物料不校验编码 |
|
|
|
return; |
|
|
|
} |
|
|
|
String drawingNo = StringUtils.trimToEmpty(partInformationEntity.getDrawingNo()); |
|
|
|
if (StringUtils.isBlank(drawingNo) || "NA".equalsIgnoreCase(drawingNo)) { |
|
|
|
throw new RuntimeException("子物料【" + componentPart + "】未维护编码,不能新增!"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |