自动化立体仓库 - WMS系统
skyouc
2 天以前 de8a641769b80abca23a344b521bcdfe0dbca31f
src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
@@ -589,9 +589,12 @@
            throw new CoolException(param.getBarcode() + "数据正在进行入库");
        }
        if (param.getBarcode().length() != 8) {
            throw new CoolException("条码长度不是8位===>>" + param.getBarcode());
        if (Objects.isNull(param.getBarcode())) {
            throw new CoolException("托盘码不能为空!!");
        }
//        if (param.getBarcode().length() != 8) {
//            throw new CoolException("条码长度不是8位===>>" + param.getBarcode());
//        }
        if (Objects.isNull(param.getType())) {
            param.setType("0");
@@ -691,18 +694,19 @@
                }
            });
            Set<String> matnrs = detlDtos.stream().map(DetlDto::getMatnr).collect(Collectors.toSet());
            List<Mat> mats = matService.selectList(new EntityWrapper<Mat>().in("matnr", matnrs));
            Set<Long> tagIds = mats.stream().map(Mat::getTagId).collect(Collectors.toSet());
            if (tagIds.size() > 1) {
                throw new CoolException("组托物料类型不一致,只有相同的物料分类才可以组托!!");
            }
            BasContainer container = basContainerService.selectOne(new EntityWrapper<BasContainer>().eq("barcode", param.getBarcode()));
            if (Objects.isNull(container)) {
                throw new CoolException("数据错误:容器码不存在!!");
            }
            if (container.getMixMax() < detlDtos.size()) {
                throw new CoolException("超出容器最大混装数量,当前容器最大数量为:" + container.getMixMax() + "!!");
            }
            Set<String> matnrs = detlDtos.stream().map(DetlDto::getMatnr).collect(Collectors.toSet());
            List<Mat> mats = matService.selectList(new EntityWrapper<Mat>().in("matnr", matnrs));
            Set<Long> tagIds = mats.stream().map(Mat::getTagId).collect(Collectors.toSet());
            if (tagIds.size() > 1) {
                throw new CoolException("组托物料类型不一致,只有相同的物料分类才可以组托!!");
            }
            //还可以放入多少种物料
            Integer suplus = container.getMixMax();
@@ -711,22 +715,21 @@
                if (Cools.isEmpty(mat)) {
                    throw new CoolException(detlDto.getMatnr() + "商品档案不存在");
                }
                //最多可放数量
                Double singleMax = mat.getUpQty() * suplus;
                if (singleMax.compareTo(detlDto.getAnfme()) < 0) {
                    throw new CoolException("物料:" + detlDto.getMatnr() + "单次组托上限为:" + mat.getUpQty() + ",当前总量超出托盘装载上限!!");
                }
                BigDecimal decimal = new BigDecimal(detlDto.getAnfme() / mat.getUpQty());
                //当前物料需要占用料箱格数
                Integer curr = decimal.setScale(0, RoundingMode.CEILING).intValue();
                suplus = suplus - curr;
                if (suplus < 0) {
                    throw new CoolException("物料:" + detlDto.getMatnr() + ", 超出当前托盘装载上限!!");
                }
//                //最多可放数量
//                Double singleMax = mat.getUpQty() * suplus;
//                if (singleMax.compareTo(detlDto.getAnfme()) < 0) {
//                    throw new CoolException("物料:" + detlDto.getMatnr() + "单次组托上限为:" + mat.getUpQty() + ",当前总量超出托盘装载上限!!");
//                }
//                BigDecimal decimal = new BigDecimal(detlDto.getAnfme() / mat.getUpQty());
//                //当前物料需要占用料箱格数
//                Integer curr = decimal.setScale(0, RoundingMode.CEILING).intValue();
//                suplus = suplus - curr;
//                if (suplus < 0) {
//                    throw new CoolException("物料:" + detlDto.getMatnr() + ", 超出当前托盘装载上限!!");
//                }
                WaitPakin waitPakin = new WaitPakin();
                BeanUtils.copyProperties(mat, waitPakin);
//                waitPakin.sync(mat);
                waitPakin.setOrderNo(detlDto.getOrderNo());   // 单据编号
                waitPakin.setOrderId(detlDto.getOrderId());
                waitPakin.setBatch(detlDto.getBatch());     // 序列码
@@ -1223,16 +1226,13 @@
     */
    @Override
    public R callAgvMove(AgvCallParams params, Long userId) {
        if (Objects.isNull(params.getTarSite())) {
            throw new CoolException("目标参数不能为空!!");
        }
        if (Objects.isNull(params.getOrgSite())) {
            throw new CoolException("源站点不能为空!!");
        }
        LocCache locCache = locCacheService.selectOne(new EntityWrapper<LocCache>()
                .eq("frozen", 0)
                .eq("loc_sts", LocStsType.LOC_STS_TYPE_O.type)
                .eq("loc_no", params.getTarSite())
//                .eq("loc_no", params.getTarSite())
                .orderAsc(Arrays.asList("loc_no"))
                .last("OFFSET 0 ROWS FETCH NEXT 1 ROWS ONLY"));
        if (Objects.isNull(locCache)) {