自动化立体仓库 - WMS系统
tzsk
4 天以前 6fd6fd0b4e90a816989632506934bdfdb431f47f
src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java
@@ -131,7 +131,7 @@
        // 生成工作档明细
        List<DetlDto> detlDtos = new ArrayList<>();
        param.getList().forEach(elem -> {
            DetlDto detlDto = new DetlDto(elem.getMatnr(), elem.getBatch(), elem.getAnfme(), elem.getCsocode(), elem.getIsoseq(),elem.getContainerCode());
            DetlDto detlDto = new DetlDto(elem.getMatnr(), elem.getBatch(), elem.getAnfme(), elem.getCsocode(), elem.getIsoseq(),elem.getContainerCode(),elem.getProddate(),elem.getDeadline());
            if (DetlDto.has(detlDtos, detlDto)) {
                DetlDto detlDto1 = DetlDto.find(detlDtos, detlDto.getMatnr(), detlDto.getBatch(),detlDto.getCsocode(),detlDto.getIsoseq(),detlDto.getContainerCode());
                assert detlDto1 != null;
@@ -151,6 +151,7 @@
        // 更新目标库位状态
        LocMast locMast = locMastService.selectById(dto.getLocNo());
        if (locMast.getLocSts().equals("O")){
            log.warn("Flag - 1,{}库位状态变更,{} => {}", locMast.getLocNo(), locMast.getLocSts(), "S");
            locMast.setLocSts("S"); // S.入库预约
            locMast.setModiUser(userId);
            locMast.setModiTime(now);
@@ -448,6 +449,7 @@
            // 修改库位状态:   F.在库 ====>>> R.出库预约/P.拣料/盘点/并板出库中
            locMast = locMastService.selectById(dto.getLocNo());
            if (locMast.getLocSts().equals("F")) {
                log.warn("Flag - 2,{}库位状态变更,{} => {}", locMast.getLocNo(), locMast.getLocSts(), ioType==101?"R":"P");
                locMast.setLocSts(ioType==101?"R":"P");
                locMast.setModiUser(userId);
                locMast.setModiTime(now);
@@ -534,6 +536,11 @@
            }
            Mat mat = matService.selectByMatnr(locDto.getMatnr());
            assert mat != null;
            if (locDto.getStock() < locDto.getAnfme()) {
                //总库存小于作业数量,异常数据
                throw new CoolException("库存不足,请稍后重试");
            }
            if (!BaseController.isJSON(locDto.getOrderNo())) {
                WrkDetl wrkDetl = new WrkDetl();
@@ -629,6 +636,7 @@
        // 修改库位状态:   F.在库 ====>>> R.出库预约/P.拣料/盘点/并板出库中
        locMast = locMastService.selectById(taskDto.getLocNo());
        if (locMast.getLocSts().equals("F")) {
            log.warn("Flag - 3,{}库位状态变更,{} => {}", locMast.getLocNo(), locMast.getLocSts(), ioType==101?"R":"P");
            locMast.setLocSts(ioType==101?"R":"P");
            locMast.setModiUser(userId);
            locMast.setModiTime(now);
@@ -687,6 +695,7 @@
        // 更新目标库位状态
        LocMast locMast = locMastService.selectById(dto.getLocNo());
        if (locMast.getLocSts().equals("O")){
            log.warn("Flag - 4,{}库位状态变更,{} => {}", locMast.getLocNo(), locMast.getLocSts(), "S");
            locMast.setLocSts("S"); // S.入库预约
            locMast.setModiUser(userId);
            locMast.setModiTime(new Date());
@@ -790,6 +799,7 @@
            }
            // 更新库位状态 D.空板 -> R.出库预约
            if (locMast.getLocSts().equals("D")){
                log.warn("Flag - 5,{}库位状态变更,{} => {}", locMast.getLocNo(), locMast.getLocSts(), "R");
                locMast.setLocSts("R");
                locMast.setModiUser(userId);
                locMast.setModiTime(new Date());
@@ -881,6 +891,7 @@
        }
        // 修改源库位状态
        if (sourceLoc.getLocSts().equals("D") || sourceLoc.getLocSts().equals("F")) {
            log.warn("Flag - 6,{}库位状态变更,{} => {}", sourceLoc.getLocNo(), sourceLoc.getLocSts(), "R");
            sourceLoc.setLocSts("R"); // R.出库预约
            sourceLoc.setModiUser(userId);
            sourceLoc.setModiTime(now);
@@ -892,6 +903,7 @@
        }
        // 修改目标库位状态
        if (loc.getLocSts().equals("O")) {
            log.warn("Flag - 7,{}库位状态变更,{} => {}", loc.getLocNo(), loc.getLocSts(), "S");
            loc.setLocSts("S"); // S.入库预约
            loc.setModiTime(now);
            loc.setModiUser(userId);
@@ -1031,6 +1043,7 @@
            locDetl.setAppeTime(now);
            locDetl.setThreeCode(adjust.getThreeCode());
            locDetl.setDeadTime(adjust.getDeadTime());
            locDetl.setZpallet(adjust.getZpallet());
            if (!locDetlService.insert(locDetl)) {
                throw new CoolException("添加" + locDetl.getLocNo() + "库位," + locDetl.getMatnr() + "商品," + locDetl.getBatch() + "序列码库存明细失败");
            }
@@ -1055,11 +1068,13 @@
        int count = locDetlService.selectCount(new EntityWrapper<LocDetl>().eq("loc_no", locMast.getLocNo()));
        if (locMast.getLocSts().equals("F")) {
            if (count == 0) {
                log.warn("Flag - 8,{}库位状态变更,{} => {}", locMast.getLocNo(), locMast.getLocSts(), "D");
                locMast.setLocSts("D");
            }
        }
        if (locMast.getLocSts().equals("D") || locMast.getLocSts().equals("O")) {
            if (count > 0) {
                log.warn("Flag - 9,{}库位状态变更,{} => {}", locMast.getLocNo(), locMast.getLocSts(), "F");
                locMast.setLocSts("F");
            }
        }
@@ -1097,30 +1112,32 @@
                // 库位转移:源库位
                LocMast locMast = locMastService.selectById(wrkMast.getSourceLocNo());
                if (Cools.isEmpty(locMast)) {
                    throw new CoolException("取消库位转移失败,源库位不存在:"+ wrkMast.getSourceLocNo());
                    throw new CoolException("取消库位转移失败,源库位不存在:" + wrkMast.getSourceLocNo());
                }
                log.warn("Flag - 9,{}库位状态变更,{} => {}", locMast.getLocNo(), locMast.getLocSts(), "F");
                locMast.setLocSts("F");
                locMast.setModiTime(new Date());
                locMast.setModiUser(userId);
                locMastService.updateById(locMast);
            }
        // 出库取消(修改源库位)
            // 出库取消(修改源库位)
        } else if (wrkMast.getWrkSts() > 20) {
            locNo = wrkMast.getSourceLocNo();
            // 出库 ===>> F.在库
            if (wrkMast.getIoType() > 100 && wrkMast.getIoType() != 110) {
                locSts = "F";
            // 空板出库 ===>> D.空桶/空栈板
                // 空板出库 ===>> D.空桶/空栈板
            } else if (wrkMast.getIoType() == 110) {
                locSts = "D";
            // 库位转移 ===>> D.空桶/空栈板
                // 库位转移 ===>> D.空桶/空栈板
            } else if (wrkMast.getIoType() == 11) {
                locSts = wrkMast.getFullPlt().equalsIgnoreCase("N")?"D":"F";
                locSts = wrkMast.getFullPlt().equalsIgnoreCase("N") ? "D" : "F";
                // 库位转移:目标库位
                LocMast locMast = locMastService.selectById(wrkMast.getLocNo());
                if (Cools.isEmpty(locMast)) {
                    throw new CoolException("取消库位转移失败,目标库位不存在:"+ wrkMast.getSourceLocNo());
                    throw new CoolException("取消库位转移失败,目标库位不存在:" + wrkMast.getSourceLocNo());
                }
                log.warn("Flag - 10,{}库位状态变更,{} => {}", locMast.getLocNo(), locMast.getLocSts(), "O");
                locMast.setLocSts("O");
                locMast.setModiTime(new Date());
                locMast.setModiUser(userId);
@@ -1190,6 +1207,7 @@
        if (Cools.isEmpty(locMast)) {
            throw new CoolException("取消工作档失败,库位不存在:"+ locNo);
        }
        log.warn("Flag - 11,{}库位状态变更,{} => {}", locMast.getLocNo(), locMast.getLocSts(), locSts);
        locMast.setLocSts(locSts);
        locMast.setModiTime(new Date());
        locMast.setModiUser(userId);
@@ -1247,6 +1265,7 @@
        }
        // 修改库位状态 Q.拣料/盘点/并板再入库
        LocMast locMast = locMastService.selectById(wrkMast.getLocNo());
        log.warn("Flag - 12,{}库位状态变更,{} => {}", locMast.getLocNo(), locMast.getLocSts(), "Q");
        locMast.setLocSts("Q");
        locMast.setModiTime(new Date());
        locMast.setModiUser(userId);