自动化立体仓库 - WMS系统
Junjie
2023-06-03 1ccbafd4845918b45cea28a834fd889e3ba4e0b6
src/main/java/com/zy/asrs/controller/MobileController.java
@@ -48,6 +48,64 @@
    @Autowired
    private PackService packService;
    // 拣料检索托盘信息
    @RequestMapping("/piking/auth")
    @ManagerAuth
    public R pikingAuth(String barcode) {
        WrkMast wrkMast = wrkMastService.selectByBarcode(barcode);
        if (Cools.isEmpty(wrkMast)) {
            throw new CoolException(barcode + "暂无工作档");
        }
        if (wrkMast.getIoType() != 103 && wrkMast.getIoType() != 107){
            throw new CoolException(barcode + "不为拣料/盘点出库");
        }
        List<WrkDetl> wrkDetls = wrkDetlService.selectByWrkNo(wrkMast.getWrkNo());
        return R.ok().add(wrkDetls);
    }
    // 拣料转全板
    @RequestMapping("/piking/to/full")
    @ManagerAuth
    @Transactional
    public R pikingToFull(String barcode) {
        WrkMast wrkMast = wrkMastService.selectByBarcode(barcode);
        if(Cools.isEmpty(wrkMast)){
            throw new CoolException("工作档不能为空");
        }
        if (wrkMast.getIoType() != 103 && wrkMast.getIoType() != 107){
            throw new CoolException(barcode + "不为拣料/盘点出库");
        }
        Date now = new Date();
        List<LocDetl> locDetls = locDetlService.selectByLocNo(wrkMast.getSourceLocNo());
        wrkMast.setIoType(101);
//        wrkMast.setSourceStaNo(wrkMast.getStaNo());
//        wrkMast.setStaNo(200);
        wrkMastService.updateById(wrkMast);
        wrkDetlService.deleteByWrkNo(wrkMast.getWrkNo());
        for(LocDetl locDetl : locDetls){
            WrkDetl wrkDetl = new WrkDetl();
            wrkDetl.setWrkNo(wrkMast.getWrkNo());
            wrkDetl.setModiTime(now);
            wrkDetl.setMatType(locDetl.getMatType());
            wrkDetl.sync(locDetl);
            wrkDetlService.insert(wrkDetl);
        }
        LocMast locMast = locMastService.selectById(wrkMast.getSourceLocNo());
        if (locMast.getLocSts().equals("P")) {
            locMast.setLocSts("R");
            locMast.setModiTime(now);
            if (!locMastService.updateById(locMast)) {
                throw new CoolException("改变库位状态失败");
            }
        }
        locMastService.updateById(locMast);
        return R.ok("转换成功");
    }
    // 组托 ----------------------------------------------------------------------------------------------------
    /**
@@ -184,6 +242,7 @@
                wrkDetl.setOrderNo(orderNo);
                wrkDetl.setIoTime(wrkMast.getIoTime());
                wrkDetl.setWrkNo(wrkNo);
                wrkDetl.setMatType(locDetl.getMatType());
                return R.ok().add(wrkDetl);
            }
        }
@@ -287,6 +346,20 @@
        return R.ok();
    }
    @RequestMapping("/checkDetl/auth2")
    @ManagerAuth
    public R getCheckDetl2(String barcode) {
        WrkMast wrkMast = wrkMastService.selectByBarcode(barcode);
        if(Cools.isEmpty(wrkMast)){
            throw new CoolException("此托盘码没有盘点任务");
        }
        if (wrkMast.getIoType() != 107){
            throw new CoolException("此托盘码不为盘点出库");
        }
        List<WrkDetl> wrkDetls = wrkDetlService.selectByWrkNo(wrkMast.getWrkNo());
        return R.ok().add(wrkDetls);
    }
    @RequestMapping("/adjust/auth")
    @ManagerAuth(memo = "盘点")
    public R adjust(@RequestBody MobileAdjustParam combParam){
@@ -294,5 +367,17 @@
        return R.ok("盘点成功");
    }
    @RequestMapping("/adjustNew/auth")
    @ManagerAuth(memo = "盘点")
    public synchronized R adjustNew(@RequestBody MobileAdjustParam combParam){
        mobileService.adjustNew(combParam, Boolean.FALSE, getUserId());
        return R.ok("盘点成功");
    }
    @RequestMapping("/adjustNew/v2/auth")
    @ManagerAuth(memo = "补货")
    public synchronized R adjustNewV2(@RequestBody MobileAdjustParam combParam){
        mobileService.adjustNew(combParam, Boolean.TRUE, getUserId());
        return R.ok("补货成功");
    }
}