自动化立体仓库 - WMS系统
#
LSH
2022-12-05 97673b8cf60ee8514758b3ba764a860f14c49fa1
src/main/java/com/zy/asrs/controller/LocDetlController.java
@@ -86,7 +86,7 @@
        return R.ok(locDetlService.getStockOut(toPage(curr, limit, param, LocDetl.class)));
    }
    @RequestMapping(value = "/error/locDetl/list/auth")// /locDetl/list/auth 接口问题
    @RequestMapping(value = "/locDetl/list/auth")// /locDetl/list/auth 接口问题
    @ManagerAuth
    public R list(@RequestParam(defaultValue = "1")Integer curr,
                  @RequestParam(defaultValue = "10")Integer limit,
@@ -157,6 +157,55 @@
        locDetlService.updateById(locDetl);
        return R.ok();
    }
    @RequestMapping(value = "/locDetl/updateBatch/auth")
    @ManagerAuth(memo = "合同号(批号)修改")
    public R updateBatch(LocDetl locDetl){
        if (Cools.isEmpty(locDetl) || null==locDetl.getMatnr()){
            return R.error("参数异常");
        }else if (locDetl.getBatch().equals(locDetl.getSku())){
            return R.error("前后合同号一致,无需修改!!!");
        }
        try{
            LocDetl locDetlSource = locDetlService.selectItem(locDetl.getLocNo(), locDetl.getMatnr(), locDetl.getBatch());
            if (Cools.isEmpty(locDetlSource) || (locDetl.getBatch()==null &&  locDetlSource.getBatch()!=null)){
                locDetlSource = locDetlService.selectOne(new EntityWrapper<LocDetl>()
                        .eq("loc_no",locDetl.getLocNo()).eq("matnr",locDetl.getMatnr()).eq("batch",locDetl.getBatch()));
                if (Cools.isEmpty(locDetlSource)){
                    return R.error("异常");
                }
            }
            LocDetl locDetlEnd = locDetlService.selectItem(locDetl.getLocNo(), locDetl.getMatnr(), locDetl.getSku());
            if (!Cools.isEmpty(locDetlEnd) && locDetl.getSku()==null && locDetlEnd.getBatch()!=null){
                locDetlEnd = locDetlService.selectOne(new EntityWrapper<LocDetl>()
                        .eq("loc_no",locDetl.getLocNo()).eq("matnr",locDetl.getMatnr()).eq("batch",locDetl.getSku()));
            }
            if (locDetlSource.getAnfme()-locDetl.getAnfme()==0){
                if (Cools.isEmpty(locDetlEnd)){
                    locDetlSource.setBatch(locDetl.getSku());
                    locDetlService.update(locDetlSource,new EntityWrapper<LocDetl>()
                            .eq("loc_no",locDetlSource.getLocNo()).eq("matnr",locDetlSource.getMatnr()).eq("batch",locDetl.getBatch()));
                }else {
                    locDetlService.updateAnfme(locDetlEnd.getAnfme()+locDetl.getAnfme(),locDetlEnd.getLocNo(),locDetlEnd.getMatnr(),locDetlEnd.getBatch());
                    locDetlService.delete(new EntityWrapper<LocDetl>()
                            .eq("loc_no",locDetl.getLocNo()).eq("matnr",locDetl.getMatnr()).eq("batch",locDetl.getBatch()));
                }
            }else if (locDetlSource.getAnfme()>locDetl.getAnfme()){
                locDetlService.updateAnfme(locDetlSource.getAnfme()-locDetl.getAnfme(),locDetlSource.getLocNo(),locDetlSource.getMatnr(),locDetlSource.getBatch());
                if (Cools.isEmpty(locDetlEnd)){
                    locDetlSource.setAnfme(locDetl.getAnfme());
                    locDetlSource.setBatch(locDetl.getSku());
                    locDetlService.insert(locDetlSource);
                }else {
                    locDetlService.updateAnfme(locDetlEnd.getAnfme()+locDetl.getAnfme(),locDetlEnd.getLocNo(),locDetlEnd.getMatnr(),locDetlEnd.getBatch());
                }
            }else {
                return R.error("输入数量有误,请规范操作!!!");
            }
        }catch (Exception e){
            return R.error("异常");
        }
        return new R(201,"合同号修改成功,请刷新页面!!!");
    }
    @RequestMapping(value = "/locDetl/delete/auth")
    @ManagerAuth(memo = "库位明细删除")