#
Junjie
2024-08-16 fc8767d2b01d295aaa9e1a8dd2da55e4c0484130
zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/controller/SuggestLocRuleController.java
@@ -5,6 +5,7 @@
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;
@@ -57,20 +58,29 @@
    @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("添加成功");
    }