update 配方新增跳转维护页面

master
yinq 3 days ago
parent 1586a6e853
commit aed2afd549

@ -131,11 +131,11 @@ public class ProdRecipeInfoController extends BaseController {
/**
* ++
*/
@SaCheckPermission("mes:recipeInfo:edit")
@SaCheckPermission({"mes:recipeInfo:add", "mes:recipeInfo:edit"})
@Log(title = "配方明细", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@PostMapping("/saveDetail")
public R<Void> saveDetail(@Validated @RequestBody RecipeDetailSaveBo bo) {
return toAjax(prodRecipeInfoService.saveDetail(bo));
public R<Long> saveDetail(@Validated @RequestBody RecipeDetailSaveBo bo) {
return R.ok(prodRecipeInfoService.saveDetail(bo));
}
}

@ -73,9 +73,9 @@ public interface IProdRecipeInfoService {
* ++
*
* @param bo
* @return
* @return IDIDID
*/
Boolean saveDetail(RecipeDetailSaveBo bo);
Long saveDetail(RecipeDetailSaveBo bo);
/**
* ID

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

Loading…
Cancel
Save