自动化立体仓库 - WMS系统
skyouc
昨天 3cb931b3799846e1b8ef708da6c447bb9a9e0a0e
并板出库功能优化
3个文件已修改
64 ■■■■■ 已修改文件
src/main/java/com/zy/asrs/entity/BasContainer.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/BasContainerServiceImpl.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java 51 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/entity/BasContainer.java
@@ -42,16 +42,19 @@
    private Integer flagMix;
    @ApiModelProperty("最大混放种类")
    private Integer mixMax;
    @TableField("mix_max")
    private Double mixMax;
    @ApiModelProperty("创建时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField("create_time")
    private Date createTime;
    @ApiModelProperty("修改时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField("update_time")
    private Date updateTime;
    public BasContainer() {}
src/main/java/com/zy/asrs/service/impl/BasContainerServiceImpl.java
@@ -47,16 +47,16 @@
            String prefix = "", ruleCode = "";
            if (container.getType().equals(ContainerType.CONTAINER_TYPE_BOX.type)) {
                prefix = "LX2";
                basContainer.setMixMax(3);
                basContainer.setMixMax(3.0);
            } else if (container.getType().equals(ContainerType.CONTAINER_TYPE_CAGE.type)) {
                prefix = "LK3";
                basContainer.setMixMax(2);
                basContainer.setMixMax(2.0);
            } else if (container.getType().equals(ContainerType.CONTAINER_TYPE_SALVER.type)) {
                prefix = "TP4";
                basContainer.setMixMax(2);
                basContainer.setMixMax(2.0);
            } else if (container.getType().equals(ContainerType.CONTAINER_TYPE_CAR.type)) {
                prefix = "TC5";
                basContainer.setMixMax(1);
                basContainer.setMixMax(1.0);
            }
            ruleCode = prefix + StringUtils.leftPad(i + "", length, "0");
            basContainer.setType(container.getType())
src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
@@ -6,8 +6,6 @@
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.core.common.*;
import com.core.exception.CoolException;
import com.zy.api.enums.MatLocType;
import com.zy.api.enums.MatType;
import com.zy.asrs.entity.*;
import com.zy.asrs.entity.param.*;
import com.zy.asrs.entity.result.FindLocNoAttributeVo;
@@ -29,7 +27,6 @@
import com.zy.common.model.LocTypeDto;
import com.zy.common.model.MesCombParam;
import com.zy.common.model.StartupDto;
import com.zy.common.model.enums.IoWorkType;
import com.zy.common.model.enums.WorkNoType;
import com.zy.common.service.CommonService;
import com.zy.common.utils.HttpHandler;
@@ -1655,7 +1652,7 @@
            throw new CoolException("组托物料类型不一致,只有相同的物料分类才可以组托!!");
        }
        // 还可以放入多少种物料
        Integer suplus = container.getMixMax();
        Double suplus = container.getMixMax();
        Date now = new Date();
        for (DetlDto detlDto : detlDtos) {
            Mat mat = matService.selectByMatnr(detlDto.getMatnr());
@@ -1723,6 +1720,19 @@
            if (v1.compareTo(stationDetl.getAnfme()) >= 0) {
                if (!basStationDetlService.deleteById(stationDetl)) {
                    throw new CoolException("原始数据移除失败!");
                }
            }
            List<BasStationDetl> stas = basStationDetlService.selectList(new EntityWrapper<BasStationDetl>()
                    .eq("dev_no", stationDetl.getDevNo()));
            if (Objects.isNull(stas) || stas.isEmpty()) {
                BasStation station = basStationService.selectOne(new EntityWrapper<BasStation>().eq("dev_no", stationDetl.getDevNo()));
                if (Objects.isNull(station)) {
                    throw new CoolException("数据错误,站点不存在!!");
                }
                station.setLocSts(LocStsType.LOC_STS_TYPE_O.type);
                if (!basStationService.updateById(station)) {
                    throw new CoolException("站点状态更新失败!!");
                }
            }
        }
@@ -2065,13 +2075,14 @@
        BasDevp basDevp = devps.stream().findFirst().get();
        List<LocMast> locMasts = new ArrayList<>();
        Map<String, List<LocDetl>> listMap = locDetls.stream().collect(Collectors.groupingBy(LocDetl::getMatnr));
        AtomicReference<Double> totalOut = new AtomicReference<>(
                locDetls.stream().mapToDouble(LocDetl::getAnfme).sum());
        //获取查库存总数量
        AtomicReference<Double> totalOut = new AtomicReference<>(0.0);
        listMap.forEach((matnr, detls) -> {
            // 根据supId(供应商)分类,得到出库总数
            Map<String, List<LocDetl>> supIds = detls.stream().collect(Collectors.groupingBy(LocDetl::getStandby1));
            supIds.forEach((supId, sups) -> {
                // 根据supId(供应商)分类,得到需要存放的总空库存数量
                Double sum = sups.stream().mapToDouble(LocDetl::getAnfme).sum();
                AtomicReference<Double> itemed = new AtomicReference<>(0.0);
                // 获取当前供应商+ 物料在库
                List<LocDetl> detlList = locDetlService.selectList(new EntityWrapper<LocDetl>()
                        .eq("matnr", matnr)
@@ -2094,17 +2105,20 @@
                        Set<String> sets = adetls.stream().map(LocDetl::getMatnr).collect(Collectors.toSet());
                        // 判断容器是否还可混放,及当前物料可放多少
                        if (container.getMixMax() > sets.size()) {
                            int suplus = container.getMixMax() - sets.size();
                            //余下可混放种类
                            long suplus = Math.round((container.getMixMax() - sets.size()) * 10000) / 10000;
                            Mat mats = matService.selectOne(new EntityWrapper<Mat>().eq("matnr", matnr));
                            if (Objects.isNull(mats)) {
                                throw new CoolException("物料不存在!!");
                            }
                            Double v = mats.getUpQty() * suplus;
                            // 小于零
                            if (sum.compareTo(v) <= 0) {
                            //余下最大可放数量
                            Double v = Math.round((mats.getUpQty() * suplus) * 10000) / 10000.0;
                            // 入库数量小于零且入库数量减去已出数量大于零()
                            if (sum.compareTo(v) <= 0 && sum.compareTo(itemed.get()) > 0) {
                                itemed.set(Math.round((itemed.get() + v) * 10000) / 10000.0);
                                // 可放下
                                locMasts.add(locMast);
                                totalOut.set(Math.round((totalOut.get() - sum) * 10000) / 10000.0);
                                totalOut.set(Math.round((totalOut.get() + itemed.get()) * 10000) / 10000.0);
                            }
                        }
                    });
@@ -2114,10 +2128,9 @@
        // 判断根据分拣出库后,还需要出多少托盘或料箱;如果余料大于0, 出新托盘或料箱
        if (totalOut.get().compareTo(0.0) > 0) {
            // Set<String> matnrs =
            // locDetls.stream().map(LocDetl::getMatnr).collect(Collectors.toSet());
            // List<Mat> mats = matService.selectList(new EntityWrapper<Mat>().in("matnr",
            // matnrs));
            generateTask(locMasts, TaskIOType.MERGE_OUT.type, basDevp, userId);
            //TODO 细化区分,当前出库托盘是滞满足拣货数量
        } else {
            LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>()
                    // todo 根据物料种类,区分库区类型
                    .eq("loc_sts", LocStsType.LOC_STS_TYPE_D.type)
@@ -2126,12 +2139,6 @@
            locMasts.add(locMast);
            // 空板出库
            generateTask(locMasts, TaskIOType.EMPTY_OUT.type, basDevp, userId);
        } else {
            // 生成堆垛机出库任务
            generateTask(locMasts, TaskIOType.MERGE_OUT.type, basDevp, userId);
            // if (!locMasts.isEmpty()) {
            //
            // }
        }
    }