自动化立体仓库 - WMS系统
#
LSH
2022-12-05 97673b8cf60ee8514758b3ba764a860f14c49fa1
src/main/java/com/zy/asrs/controller/LocDetlController.java
@@ -161,12 +161,50 @@
    @ManagerAuth(memo = "合同号(批号)修改")
    public R updateBatch(LocDetl locDetl){
        if (Cools.isEmpty(locDetl) || null==locDetl.getMatnr()){
            return R.error();
            return R.error("参数异常");
        }else if (locDetl.getBatch().equals(locDetl.getSku())){
            return R.error("前后合同号一致,无需修改!!!");
        }
        locDetl.setModiUser(getUserId());
        locDetl.setModiTime(new Date());
        locDetlService.updateById(locDetl);
        return R.ok();
        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")