自动化立体仓库 - WMS系统
1
zhang
昨天 b2f1ff879839b5cd3fd093527a39ad73cb16a61c
src/main/java/com/zy/asrs/task/handler/GhjtHandler.java
@@ -24,6 +24,7 @@
import javax.annotation.Resource;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/**
@@ -72,6 +73,9 @@
    // 堆垛机对应一楼出库站点
    private static final int[] oneFloorOutSite = new int[]{0,3002,3003,3006,3008,3009,3012};
    // 堆垛机对应一楼入库站点
    private static final int[] oneFloorInSite = new int[]{0,3001,3004,3005,3007,3010,3011};
    public void startCkrwPushGwcs(WrkMast wrkMast) {
        // 获取请求头
@@ -98,6 +102,7 @@
                    .setPath(MesConstant.GWCS_DCKK_URL)
                    .setHeaders(headers)
                    .setJson(body)
                    .setTimeout(30, TimeUnit.SECONDS) // 设置连接 + 读取超时为30秒
                    .build()
                    .doPost();
            if (!Cools.isEmpty(response)) {
@@ -110,6 +115,7 @@
                    wrkMast.setModiTime(new Date());
                } else if(wrkMast.getIoType() == 12) { // 跨巷道转移
                    wrkMast.setWrkSts(1L); // 状态改为1.生成入库id
                    wrkMast.setCrnNo(Arrays.binarySearch(oneFloorInSite,wrkMast.getStaNo()));// 堆垛机转换为入库的堆垛机
                    wrkMast.setModiTime(new Date());
                }
                wrkMastMapper.updateById(wrkMast);
@@ -208,7 +214,7 @@
            String staLocNo = null;
            Integer wrkCount = wrkMastMapper.selectCount(new EntityWrapper<WrkMast>().eq("crn_no", i));
            if(wrkCount > 0) {
                log.warn("{}号堆垛机已存在任务",i);
//                log.warn("{}号堆垛机已存在任务",i);
                continue;
            }
            // 根据堆垛机号查询到对应的深库位和浅库位  深库位4*n-3和4*n 浅库位4*n-2和4*n-1
@@ -237,16 +243,16 @@
            }
            // 没有找到源库位
            if (sourceLocNo == null) {
                log.warn("没有找到源库位,堆垛机:{}",i);
//                log.warn("没有找到源库位,堆垛机:{}",i);
                continue;
            }
            // 寻找一个备货的目标库位,先深后浅
            List<LocMast> locMasts1 = locMastMapper.selectList(new EntityWrapper<LocMast>().eq("loc_sts", "O").eq("crn_no", i).in("row1", s1, s2)
                    .le("bay1", columnNum));
                    .le("bay1", columnNum).orderBy("lev1,bay1,row1"));
            if (locMasts1.isEmpty()) {
                // 深库位为空了,取浅库位
                List<LocMast> locMasts2 = locMastMapper.selectList(new EntityWrapper<LocMast>().eq("loc_sts", "O").eq("crn_no", i).in("row1", q1, q2)
                        .le("bay1", columnNum));
                        .le("bay1", columnNum).orderBy("lev1,bay1,row1"));
                if (!locMasts2.isEmpty()) {
                    staLocNo = locMasts2.get(0).getLocNo();
                }
@@ -386,12 +392,52 @@
        if (config == null) {
            throw new CoolException("理货获取备货区配置错误!!!");
        }
        Config chang = configMapper.selectConfigByCode("auto_tally_goods_chang");
        if (chang == null) {
            throw new CoolException("理货获取备货区长度配置错误!!!");
        }
        Config kuan = configMapper.selectConfigByCode("auto_tally_goods_kuan");
        if (kuan == null) {
            throw new CoolException("理货获取备货区宽度配置错误!!!");
        }
        Config gao = configMapper.selectConfigByCode("auto_tally_goods_gao");
        if (gao == null) {
            throw new CoolException("理货获取备货区高度配置错误!!!");
        }
        // 前几列是备货区
        int columnNum = Integer.parseInt(config.getValue());
        // 寻找一箱一卷的,没有理货的,不在备货区的物料明细
        List<LocDetl> tallyGoosList = locDetlMapper.selectTallyGoosList(columnNum);
        // 过滤掉木箱规格宽度大于600的(大于600一个托盘只能放一箱)
        tallyGoosList = tallyGoosList.stream().filter(locDetl -> {
            String[] split = locDetl.getColor().split("\\*");
            if (split.length == 3) {
                // 高度也要低于614才能理货
                //return Integer.parseInt(split[1]) <= 600 && Integer.parseInt(split[2]) <= 614;
                //新逻辑
                String[] changLimit = chang.getValue().split("-");
                if (changLimit.length == 2){
                    if (Integer.parseInt(split[0]) >= Integer.parseInt(changLimit[0]) && Integer.parseInt(split[0]) <= Integer.parseInt(changLimit[1])){
                        String[] kuanLimit = chang.getValue().split("-");
                        if (kuanLimit.length == 2){
                            if (Integer.parseInt(split[1]) >= Integer.parseInt(kuanLimit[0]) && Integer.parseInt(split[1]) <= Integer.parseInt(kuanLimit[1])){
                                String[] gaoLimit = gao.getValue().split("-");
                                if (gaoLimit.length == 2){
                                    if (Integer.parseInt(split[2]) >= Integer.parseInt(gaoLimit[0]) && Integer.parseInt(split[2]) <= Integer.parseInt(gaoLimit[1])){
                                        return true;
                                    }
                                }
                            }
                        }
                    }
                }
            }
                return false;
        }).collect(Collectors.toList());
        // 寻找满足理货条件的两个木箱
        LocDetl leftLocDetl = null;
        LocDetl rightLocDetl = null;