| | |
| | | import com.zy.asrs.framework.common.Cools; |
| | | import com.zy.asrs.framework.common.R; |
| | | import com.zy.asrs.framework.exception.CoolException; |
| | | import com.zy.asrs.wms.asrs.entity.enums.LocRuleType; |
| | | import com.zy.asrs.wms.asrs.entity.param.CreateSuggestLocRuleParam; |
| | | import com.zy.asrs.wms.common.annotation.OperationLog; |
| | | import com.zy.asrs.wms.common.domain.BaseParam; |
| | |
| | | @PostMapping("/suggestLocRule/save") |
| | | @Transactional |
| | | public R save(@RequestBody CreateSuggestLocRuleParam param) { |
| | | List<Long> matIdList = param.getMatIdList(); |
| | | if (matIdList.isEmpty()) { |
| | | return R.error("请选择商品信息"); |
| | | } |
| | | |
| | | for (Long mat : matIdList) { |
| | | if (param.getLocType().equals(LocRuleType.D.id)) { |
| | | //空托盘 |
| | | SuggestLocRule suggestLocRule = new SuggestLocRule(); |
| | | suggestLocRule.sync(param); |
| | | suggestLocRule.setMatId(mat); |
| | | if (!suggestLocRuleService.save(suggestLocRule)) { |
| | | throw new CoolException("添加推荐区域失败"); |
| | | } |
| | | } |
| | | }else { |
| | | //满托盘 |
| | | List<Long> matIdList = param.getMatIdList(); |
| | | if (matIdList.isEmpty()) { |
| | | return R.error("请选择商品信息"); |
| | | } |
| | | |
| | | for (Long mat : matIdList) { |
| | | SuggestLocRule suggestLocRule = new SuggestLocRule(); |
| | | suggestLocRule.sync(param); |
| | | suggestLocRule.setMatId(mat); |
| | | if (!suggestLocRuleService.save(suggestLocRule)) { |
| | | throw new CoolException("添加推荐区域失败"); |
| | | } |
| | | } |
| | | } |
| | | return R.ok("添加成功"); |
| | | } |
| | | |