|
|
|
@ -205,14 +205,20 @@ public class ProdRecipeInfoServiceImpl implements IProdRecipeInfoService {
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
public Boolean saveDetail(RecipeDetailSaveBo bo) {
|
|
|
|
public Long saveDetail(RecipeDetailSaveBo bo) {
|
|
|
|
ProdRecipeInfoBo recipeInfo = bo.getRecipeInfo();
|
|
|
|
ProdRecipeInfoBo recipeInfo = bo.getRecipeInfo();
|
|
|
|
if (recipeInfo == null || recipeInfo.getRecipeId() == null) {
|
|
|
|
if (recipeInfo == null) {
|
|
|
|
throw new IllegalArgumentException("配方ID不能为空");
|
|
|
|
throw new IllegalArgumentException("配方基本信息不能为空");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Long recipeId = recipeInfo.getRecipeId();
|
|
|
|
Long recipeId = recipeInfo.getRecipeId();
|
|
|
|
|
|
|
|
// 新增时 recipeId 为空,先创建配方
|
|
|
|
|
|
|
|
if (recipeId == null) {
|
|
|
|
|
|
|
|
insertByBo(recipeInfo);
|
|
|
|
|
|
|
|
recipeId = recipeInfo.getRecipeId();
|
|
|
|
|
|
|
|
} else {
|
|
|
|
// 1. 更新配方基本信息
|
|
|
|
// 1. 更新配方基本信息
|
|
|
|
updateByBo(recipeInfo);
|
|
|
|
updateByBo(recipeInfo);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 2. 称量信息:有主键则更新,无主键则插入;删除提交列表中已不存在的原记录
|
|
|
|
// 2. 称量信息:有主键则更新,无主键则插入;删除提交列表中已不存在的原记录
|
|
|
|
List<ProdRecipeWeightBo> weightList = bo.getWeightList() != null ? bo.getWeightList() : new ArrayList<>();
|
|
|
|
List<ProdRecipeWeightBo> weightList = bo.getWeightList() != null ? bo.getWeightList() : new ArrayList<>();
|
|
|
|
@ -291,7 +297,7 @@ public class ProdRecipeInfoServiceImpl implements IProdRecipeInfoService {
|
|
|
|
prodRecipeMixingService.insertByBo(m);
|
|
|
|
prodRecipeMixingService.insertByBo(m);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
return recipeId;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
|