自动化立体仓库 - WMS系统
#
whycq
2023-09-05 e9f4a368fd3845a38eb54d3d18d77e96e5767b61
src/main/java/com/zy/asrs/controller/MobileController.java
@@ -47,6 +47,85 @@
    private BasDevpService basDevpService;
    @Autowired
    private PackService packService;
    @Autowired
    private WaitPakinService waitPakinService;
    // 拣料检索托盘信息
    @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("/barcode/auth")
    @ManagerAuth
    public R pakinAuth(@RequestParam("barcode") String barcode) {
        WaitPakin waitPakin = waitPakinService.selectOne(new EntityWrapper<WaitPakin>().eq("zpallet", barcode));
        if (!Cools.isEmpty(waitPakin)) {
            return R.error("入库通知档已存在!");
        }
        LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("barcode",barcode));
        if (!Cools.isEmpty(locMast)) {
            return R.error("库存主档中已存在当前条码!");
        }
        LocDetl locdetl = locDetlService.selectOne(new EntityWrapper<LocDetl>().eq("barcode", barcode));
        if (!Cools.isEmpty(locdetl)){
            return R.error("库存明细中已存在当前条码,请检查库存");
        }
        return R.ok();
    }
    // 拣料转全板
    @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 +263,7 @@
                wrkDetl.setOrderNo(orderNo);
                wrkDetl.setIoTime(wrkMast.getIoTime());
                wrkDetl.setWrkNo(wrkNo);
                wrkDetl.setMatType(locDetl.getMatType());
                return R.ok().add(wrkDetl);
            }
        }
@@ -287,6 +367,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 +388,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("补货成功");
    }
}