自动化立体仓库 - WMS系统
1
zhang
6 天以前 5dff87c18f48e0a14440d1225924d35f8de7b00e
src/main/java/com/zy/asrs/service/impl/AgvWorkServiceImpl.java
@@ -227,7 +227,9 @@
            updateAgvLocMast(agvLocMastService.selectById(sourceLocNo), locSts);
            //更新目标站点状态
            //locSts = ioType == 101 ? "S" : "Q";
            updateAgvBasDevp(agvBasDevpService.selectById(targetLocNo), "S");
            AgvBasDevp agvBasDevp = agvBasDevpService.selectById(targetLocNo);
            agvBasDevp.setBarcode("");
            updateAgvBasDevp(agvBasDevp, "S");
        });
    }
@@ -493,6 +495,10 @@
        if (Cools.isEmpty(agvBasDevp)) {
            throw new CoolException("暂无" + station + "站点");
        }
        AgvBasDevp agvBasDevp2 = agvBasDevpService.selectOne(new EntityWrapper<AgvBasDevp>().eq("barcode", containerCode).ne("dev_no", agvBasDevp.getDevNo()));
        if (!Cools.isEmpty(agvBasDevp2)) {
            throw new CoolException(station + "站点绑定该货架,无法入库");
        }
        int br = 0;
        if (containerType == 21 && agvBasDevp.getFloor() == 2) {
            containerType = 20;
@@ -643,6 +649,15 @@
        if (Cools.isEmpty(agvBasDevp)) {
            throw new CoolException("暂无" + station + "站点");
        }
        AgvBasDevp agvBasDevp2 = agvBasDevpService.selectOne(new EntityWrapper<AgvBasDevp>().eq("barcode", containerCode).ne("dev_no", agvBasDevp.getDevNo()));
        if (!Cools.isEmpty(agvBasDevp2)) {
            throw new CoolException(station + "站点绑定该货架,无法入库");
        }
        if (Cools.isEmpty(agvBasDevp)) {
            throw new CoolException("暂无" + station + "站点");
        }
        int br = 0;
        if (containerType == 21 && agvBasDevp.getFloor() == 2) {
            containerType = 20;
@@ -750,9 +765,9 @@
            String ctnNo = null;
            // 打标记,若库位不够,入库到别的楼层,那么需要跨层移库
            if (!Cools.isEmpty(code)) {
                if (agvLocMast.getLev1() == 1 && !code.equals(AsrsConstants.SANCHANG)) {
                    ctnNo = "1";
                } else if (agvLocMast.getLev1() == 2 && !code.equals(AsrsConstants.ERCHANG)) {
                if (agvLocMast.getLev1() == 1 && code.equals(AsrsConstants.ERCHANG)) {
                    ctnNo = "2";
                } else if (agvLocMast.getLev1() == 2 && code.equals(AsrsConstants.SANCHANG)) {
                    ctnNo = "1";
                }
            }
@@ -798,6 +813,10 @@
        AgvBasDevp agvBasDevp = agvBasDevpService.selectById(station);
        if (Cools.isEmpty(agvBasDevp)) {
            throw new CoolException("暂无" + station + "站点");
        }
        AgvBasDevp agvBasDevp2 = agvBasDevpService.selectOne(new EntityWrapper<AgvBasDevp>().eq("barcode", containerCode).ne("dev_no", agvBasDevp.getDevNo()));
        if (!Cools.isEmpty(agvBasDevp2)) {
            throw new CoolException(station + "站点绑定该货架,无法入库");
        }
        int br = 0;
        if (containerType == 21 && agvBasDevp.getFloor() == 2) {
@@ -903,7 +922,7 @@
                    }
                }
            }
            if (agvLocMast==null){
            if (agvLocMast == null) {
                throw new CoolException("没有该类型的空库位了");
            }
@@ -959,21 +978,37 @@
        if (!Cools.isEmpty(agvWrkMast)) {
            throw new CoolException("有货架在往站点搬运" + agvBasDevp.getDevNo() + ",无法进行空板出库");
        }
        AgvLocMast agvLocMast = null;
        if (station.startsWith("XI") && station.endsWith("F4") && containerType == 30) {
            agvLocMast = agvLocMastService.select30EmptyZpallet();
        } else {
            //寻找相应类型的空货架
            Integer floor = agvBasDevp.getFloor();
            if (floor == 4) {
                floor = 1;
            }
            agvLocMast = agvLocMastService.selectEmptyZpallet(containerType, floor);
            if (containerType == 0) {
                //空板自动出库,根据站点类型选择
                agvLocMastService.selectEmptyZpalletByLocType1(agvBasDevp.getLocType1());
        //寻找相应类型的空货架
        Integer floor = agvBasDevp.getFloor();
        if (floor == 4) {
            floor = 1;
            }
        }
        AgvLocMast agvLocMast = agvLocMastService.selectEmptyZpallet(containerType, floor);
        if (containerType == 0) {
            //空板自动出库,根据站点类型选择
            agvLocMastService.selectEmptyZpalletByLocType1(agvBasDevp.getLocType1());
        }
        if (Cools.isEmpty(agvLocMast)) {
            throw new CoolException("暂无当前出库站点类型的空货架!");
        }
        if (!Cools.isEmpty(agvBasDevp.getArea())) {
            if (!Cools.isEmpty(agvLocMast.getBarcode())) {
                if (!agvBasDevp.getArea().contains(agvLocMast.getBarcode().substring(0, 2))) {
                    throw new CoolException("1当前出库站点不允许叫该类型的货架:" + agvLocMast.getBarcode());
                }
            }else {
                if (!agvBasDevp.getArea().contains(agvLocMast.getLocType1$().toString())) {
                    throw new CoolException("2当前出库站点不允许叫该类型的货架:" + agvLocMast.getBarcode());
                }
            }
        }
        //生成工作档
        createWrkMast(110, 21L, agvLocMast.getLocNo(), agvBasDevp.getDevNo(), agvLocMast.getBarcode(), now, userId, containerType, agvLocMast.getPltType());
@@ -985,6 +1020,7 @@
        updateAgvBasDevp(agvBasDevp, "S", (short) containerType, agvLocMast.getBarcode());
    }
    @Transactional
    public void adjustLocDetl(LocDetlAdjustParam param, Long userId) {
@@ -1001,7 +1037,7 @@
        List<AgvLocDetl> locDetls = agvLocDetlService.selectList(new EntityWrapper<AgvLocDetl>().eq("loc_no", param.getLocNo()));
        List<LocDetlAdjustParam.LocDetlAdjust> list = param.getList();
        String barcode = null;
        // 修改数量
        Iterator<AgvLocDetl> iterator = locDetls.iterator();
        while (iterator.hasNext()) {
@@ -1088,6 +1124,7 @@
            locDetl.setThreeCode(adjust.getThreeCode());
            locDetl.setDeadTime(adjust.getDeadTime());
            locDetl.setSuppCode(adjust.getSuppCode());
            barcode = adjust.getSuppCode();
            if (!agvLocDetlService.insert(locDetl)) {
                throw new CoolException("添加" + locDetl.getLocNo() + "库位," + locDetl.getMatnr() + "商品," + locDetl.getBatch() + "序列码库存明细失败");
            }
@@ -1120,6 +1157,7 @@
        if (locMast.getLocSts().equals("D") || locMast.getLocSts().equals("O")) {
            if (count > 0) {
                locMast.setLocSts("F");
                locMast.setBarcode(barcode);
            }
        }
        locMast.setModiUser(userId);
@@ -1232,6 +1270,9 @@
                String devNo = wrkMast.getSourceLocNo();
                //目标库位
                String locNo = wrkMast.getLocNo();
                if (!Cools.isEmpty(locNo)) {
                    agvLocDetlService.delete(new EntityWrapper<AgvLocDetl>().eq("loc_no", locNo));
                }
                agvLocMastService.updateLocStsByLocNo(locNo, "O", "", null);
                if (wrkMast.getIoType() == 58) {
                    agvBasDevpService.updateLocStsAndBarcodeByDevNo(devNo, "F", wrkMast.getBarcode(), wrkMast.getWhsType().shortValue());
@@ -1345,6 +1386,9 @@
                if (wrkMast.getIoType() == 112) {
                    throw new CoolException("当前作业不能取消!");
                }
                if (wrkMast.getIoType() == 108 && wrkMast.getWrkSts() >= 204) {
                    throw new CoolException("源库位已经释放,当前作业不能取消!");
                }
                // 源库位
                String locNo = wrkMast.getSourceLocNo();
                // 目标库位
@@ -1374,6 +1418,14 @@
                        orderDetl.setQty(orderDetl.getQty() - agvLocDetl.getAnfme());
                        if (!orderDetlService.update(orderDetl, new EntityWrapper<OrderDetl>().eq("order_no", "DB" + agvLocDetl.getOrderNo()).eq("matnr", agvLocDetl.getMatnr()).eq("three_code", agvLocDetl.getThreeCode()))) {
                            throw new CoolException("修改订单明细失败,请联系管理员" + agvLocDetl.getOrderNo() + agvLocDetl.getMatnr());
                        }
                    } else {
                        orderDetl = orderDetlService.selectOne(new EntityWrapper<OrderDetl>().eq("matnr", agvLocDetl.getMatnr()).eq("three_code", agvLocDetl.getThreeCode()).eq("source", 33).ge("qty", agvLocDetl.getAnfme()));
                        if (orderDetl != null) {
                            orderDetl.setQty(orderDetl.getQty() - agvLocDetl.getAnfme());
                            if (!orderDetlService.update(orderDetl, new EntityWrapper<OrderDetl>().eq("order_no", orderDetl.getOrderNo()).eq("matnr", agvLocDetl.getMatnr()).eq("three_code", agvLocDetl.getThreeCode()))) {
                                //throw new CoolException("修改订单明细失败,请联系管理员" + agvLocDetl.getOrderNo() + agvLocDetl.getMatnr());
                            }
                        }
                    }
//                    FlowLog flowLog = new FlowLog();
@@ -1407,6 +1459,9 @@
                // 回流单取消
            } else if (wrkMast.getIoType() == 114) {
                if (wrkMast.getWrkSts() >= 204) {
                    throw new CoolException("源库位已经释放,当前作业不能取消!");
                }
                //源库位
                String locNo = wrkMast.getSourceLocNo();
                // 目标库位
@@ -1512,9 +1567,13 @@
                throw new CoolException("删除失败,请联系管理员");
            }
            if (type == 2) {
                //调用agv取消任务接口
                agvWrkMastService.callCancelTask(wrkMast.getWrkNo());
            if (type == 2 || type == 5) {
                try {
                    //调用agv取消任务接口
                    agvWrkMastService.callCancelTask(wrkMast.getWrkNo());
                } catch (Exception e) {
                    log.info("调用agv取消任务接口失败");
                }
            }
        }
    }
@@ -1578,7 +1637,10 @@
        }
        OrderDetl orderDetl = orderDetlService.selectItem(orderNo, mat.getMatnr(), batch, csocode);
        if (orderDetl == null) {
            throw new CoolException("订单明细不存在");
            orderDetl = orderDetlService.selectItem(orderNo, mat.getMatnr(), null, csocode);
            if (orderDetl == null) {
                throw new CoolException("订单明细不存在");
            }
        }
        AgvWrkDetl wrkDetl = new AgvWrkDetl();
        wrkDetl.sync(mat);