自动化立体仓库 - WMS系统
#
lsh
2024-05-21 0a05bcf1064431e7f2ba84856d5d0dad0cf48ecc
#
5个文件已修改
315 ■■■■■ 已修改文件
src/main/java/com/zy/asrs/task/BareBoardScheduler.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/task/handler/BareBoardHandler.java 90 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/utils/Utils.java 203 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/common/service/CommonService.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/application.yml 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/task/BareBoardScheduler.java
@@ -102,12 +102,12 @@
    @Scheduled(cron = "0/3 * * * * ? ")
    private void execute2(){//自动调空板出库 煜星一楼
        if (slaveWmsParameterProperties.isAutomaticFillingBoardStaNosBoolean()){
            Config config = configService.selectOne(new EntityWrapper<Config>().eq("code","bareBoard445"));
            Config config = configService.selectOne(new EntityWrapper<Config>().eq("code","bareBoard448"));
            if (!Cools.isEmpty(config) && !Cools.isEmpty(config.getValue()) && config.getValue().equals("Y")){
                int loadIngCount = basDevpService.selectCount(new EntityWrapper<BasDevp>().ge("dev_no", 421).le("dev_no", 465).eq("loading", "Y"));
                int count = 10;
                int loadIngCount = basDevpService.selectCount(new EntityWrapper<BasDevp>().ge("dev_no", 421).le("dev_no", 448).eq("loading", "Y"));
                int count = 25;
                if (loadIngCount<=count){
                    bareBoardHandler.start(445,count);
                    bareBoardHandler.startYx(448,count);
                }
            }
        }
src/main/java/com/zy/asrs/task/handler/BareBoardHandler.java
@@ -177,38 +177,56 @@
                }
                sign = true;
                // 获取库位
                LocMast locMastS = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_sts","D").eq("crn_no",crnNo));
                List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("loc_sts", "D").eq("crn_no", crnNo));
                for (LocMast locMastS : locMasts){
                if (Cools.isEmpty(locMastS)) {
                    if (Cools.isEmpty(locMastS)) {
//                    throw new CoolException("库中无空板!!!");
                    log.error(crnNo+"号堆垛机无空板!");
                    sign=false;
                }
                if (sign && !locMastS.getLocSts().equals("D")){
                        log.error(crnNo+"号堆垛机无空板!");
                        sign=false;
                        break;
                    }
                    if (sign && !locMastS.getLocSts().equals("D")){
//                    throw new CoolException("所选库位存在状态不为D的库位,库位号:"+locMast.getLocNo()+" 、当前状态:"+locMast.getLocSts()+"-"+locMast.getLocSts$());
                    log.error(crnNo+"号堆垛机"+"所选库位存在状态不为D的库位,库位号:"+locMastS.getLocNo()+" 、当前状态:"+locMastS.getLocSts()+"-"+locMastS.getLocSts$());
                    sign=false;
                }
                locNoList.add(locMastS.getLocNo());
                        log.error(crnNo+"号堆垛机"+"所选库位存在状态不为D的库位,库位号:"+locMastS.getLocNo()+" 、当前状态:"+locMastS.getLocSts()+"-"+locMastS.getLocSts$());
                        sign=false;
                    }
                    locNoList.add(locMastS.getLocNo());
                //小料箱伴生出库
                if (Utils.getRow(locMastS.getLocNo())<=8){
                    String locNoOther = staNoOther(locMastS.getLocNo());
                    LocMast locMastOther = locMastService.selectById(locNoOther);
                    if (locMastOther.getLocSts().equals("D")){
                        locNoList.add(locNoOther);
                    //小料箱伴生出库
                    if (Utils.getRow(locMastS.getLocNo())<=8){
                        String locNoOther = staNoOther(locMastS.getLocNo());
                        LocMast locMastOther = locMastService.selectById(locNoOther);
                        if (locMastOther.getLocSts().equals("D") || locMastOther.getLocSts().equals("F") ||  locMastOther.getLocSts().equals("R")){
                            if (locMastOther.getLocSts().equals("D")){
                                locNoList.add(locNoOther);
                            }
                        }else {
                            sign=false;
                        }
                    }else if (Utils.getRow(locMastS.getLocNo())>=21 && Utils.getRow(locMastS.getLocNo())<=27){
                        String locNoOther = staNoOther(locMastS.getLocNo());
                        LocMast locMastOther = locMastService.selectById(locNoOther);
                        if (locMastOther.getLocSts().equals("D") || locMastOther.getLocSts().equals("F") ||  locMastOther.getLocSts().equals("R")){
                            if (locMastOther.getLocSts().equals("D")){
                                locNoList.add(locNoOther);
                            }
                        }else {
                            sign=false;
                        }
                    }
                }
                if (sign) {
                    EmptyPlateOutParam param = new EmptyPlateOutParam();
                    param.setOutSite(staNo);
                    param.setLocNos(locNoList);
                    try{
                        workService.emptyPlateOut(param, 9999L);
                    }catch (Exception e){
                        log.error("二楼小料箱自动补空板失败!!异常原因:"+e);
                    if (sign) {
                        EmptyPlateOutParam param = new EmptyPlateOutParam();
                        param.setOutSite(staNo);
                        param.setLocNos(locNoList);
                        try{
                            workService.emptyPlateOut(param, 9999L);
                        }catch (Exception e){
                            log.error("二楼小料箱自动补空板失败!!异常原因:"+e);
                        }
                        return SUCCESS;
                    }
                    return SUCCESS;
                }
            }
            if (!sign){
@@ -224,10 +242,20 @@
    public String staNoOther(String locNo){
        int row = Utils.getRow(locNo);
        if (row%4==0 || row%4==1){
            return getDeepLoc2(locNo,row);
        if (row<=8){
            if (row%4==0 || row%4==1){
                return getDeepLoc2(locNo,row);
            }else {
                return getDeepLoc(locNo,row);
            }
        }else if (row>=21 && row<=27){
            if (row==21 || row==24 || row==27){
                return getDeepLoc2(locNo,row);
            }else {
                return locNo;
            }
        }else {
            return getDeepLoc(locNo,row);
            return locNo;
        }
    }
@@ -235,9 +263,9 @@
     * 获取 深库位对应的浅库位号
     */
    public static String getDeepLoc2(String shallowLoc,int row) {
        if (row == 1 || row == 5) {
        if (row == 1 || row == 5 || row==21) {
            return Utils.zerofill(String.valueOf(row+1), 2) + shallowLoc.substring(2);
        } else if (row == 4 || row == 8) {
        } else if (row == 4 || row == 8 || row == 24 || row == 27) {
            return Utils.zerofill(String.valueOf(row-1), 2) + shallowLoc.substring(2);
        }else {
            return null;
src/main/java/com/zy/asrs/utils/Utils.java
@@ -94,137 +94,158 @@
    }
    /**
     * 判断是否为浅库位
     * 判断是否为浅库位  并存在深库位
     */
    public static boolean isShallowLoc(SlaveProperties slaveProperties, String locNo) {
        if (slaveProperties.isDoubleDeep()) {
            int row = getRow(locNo);
            return !slaveProperties.getDoubleLocs().contains(row);
        } else {
            return false;
            if (!slaveProperties.getDoubleLocs().contains(row)){
                boolean deepLocLeft = isDeepLocLeft(slaveProperties, row-1);//判断是否为左浅库位
                if (deepLocLeft){
                    return true;
                }
                return isDeepLocRight(slaveProperties, row+1);//判断是否为右浅库位
            }
        }
        return false;
    }
    /**
     * 判断是否为浅库位
     * 判断是否为浅库位  并存在深库位
     */
    public static boolean isShallowLoc(SlaveProperties slaveProperties, Integer row) {
        if (slaveProperties.isDoubleDeep()) {
            return !slaveProperties.getDoubleLocs().contains(row);
        } else {
            return false;
            if (!slaveProperties.getDoubleLocs().contains(row)){
                boolean deepLocLeft = isDeepLocLeft(slaveProperties, row-1);//判断是否为左浅库位
                if (deepLocLeft){
                    return true;
                }
                return isDeepLocRight(slaveProperties, row+1);//判断是否为右浅库位
            }
        }
        return false;
    }
    /**
     * 获取 深库位对应的浅库位号
     */
    public static String getShallowLoc(SlaveProperties slaveProperties, String deepLoc) {
//        int row = getRow(deepLoc);
//        int remainder = (int) Arith.remainder(row, slaveProperties.getGroupCount());
//        int shallowRow = remainder == 1 ? (row + 1) : (row - 1);
//        return zerofill(String.valueOf(shallowRow), 2) + deepLoc.substring(2);
        int row = getRow(deepLoc);
        int remainder = (int) Arith.remainder(row, slaveProperties.getGroupCount());
        int shallowRow = remainder == 1 ? (row + 1) : (row - 1);
        boolean deepLocLeft = isDeepLocLeft(slaveProperties, row);//判断是否为左深库位
        int shallowRow = deepLocLeft? (row + 1) : (row - 1);
        return zerofill(String.valueOf(shallowRow), 2) + deepLoc.substring(2);
    }
    /**
     * 获取 深库位对应的浅库位号   双伸+单双伸  煜星定制
     */
    public static String getShallowLoc5(SlaveProperties slaveProperties, String deepLoc,Integer whsType) {
        if (whsType==9){
            int row = getRow(deepLoc);
            int shallowRow;
            if (row == 21) {
                shallowRow = row + 1;
            } else if (row == 24) {
                shallowRow = row - 1;
            } else if (row == 25) {
                shallowRow = row;
            } else if (row == 27) {
                shallowRow = row - 1;
            } else {
                throw new RuntimeException(row + "不是深库位,系统繁忙");
            }
            return zerofill(String.valueOf(shallowRow), 2) + deepLoc.substring(2);
        }else {
            int row = getRow(deepLoc);
            int remainder = (int) Arith.remainder(row, slaveProperties.getGroupCount());
            int shallowRow = remainder == 1 ? (row + 1) : (row - 1);
            return zerofill(String.valueOf(shallowRow), 2) + deepLoc.substring(2);
        }
    }
//    /**
//     * 获取 深库位对应的浅库位号   双伸+单双伸  煜星定制
//     */
//    public static String getShallowLoc5(SlaveProperties slaveProperties, String deepLoc,Integer whsType) {
//        if (whsType==9){
//            int row = getRow(deepLoc);
//            int shallowRow;
//            if (row == 21) {
//                shallowRow = row + 1;
//            } else if (row == 24) {
//                shallowRow = row - 1;
//            } else if (row == 25) {
//                shallowRow = row;
//            } else if (row == 27) {
//                shallowRow = row - 1;
//            } else {
//                throw new RuntimeException(row + "不是深库位,系统繁忙");
//            }
//            return zerofill(String.valueOf(shallowRow), 2) + deepLoc.substring(2);
//        }else {
//            int row = getRow(deepLoc);
//            int remainder = (int) Arith.remainder(row, slaveProperties.getGroupCount());
//            int shallowRow = remainder == 1 ? (row + 1) : (row - 1);
//            return zerofill(String.valueOf(shallowRow), 2) + deepLoc.substring(2);
//        }
//    }
    /**
     * 获取 深库位排对应的浅库位排
     */
    public static Integer getShallowRow(SlaveProperties slaveProperties, Integer deepRow) {
        int remainder = (int) Arith.remainder(deepRow, slaveProperties.getGroupCount());
        return remainder == 1 ? (deepRow + 1) : (deepRow - 1);
//        int remainder = (int) Arith.remainder(deepRow, slaveProperties.getGroupCount());
        boolean deepLocLeft = isDeepLocLeft(slaveProperties, deepRow);//判断是否为左深库位
        return deepLocLeft ? (deepRow + 1) : (deepRow - 1);
    }
    /**
     * 获取 浅库位对应的深库位号
     */
    public static String getDeepLoc(SlaveProperties slaveProperties, String shallowLoc) {
//        int row = getRow(shallowLoc);
//        int remainder = (int) Arith.remainder(row, slaveProperties.getGroupCount());
//        int targetRow;
//        if (remainder == 2) {
//            targetRow = row - 1;
//        } else if (remainder == 3) {
//            targetRow = row + 1;
//        } else {
//            throw new RuntimeException(shallowLoc + "不是浅库位,系统繁忙");
//        }
//        return zerofill(String.valueOf(targetRow), 2) + shallowLoc.substring(2);
        int row = getRow(shallowLoc);
        int remainder = (int) Arith.remainder(row, slaveProperties.getGroupCount());
        int targetRow;
        if (remainder == 2) {
            targetRow = row - 1;
        } else if (remainder == 3) {
            targetRow = row + 1;
        } else {
            throw new RuntimeException(shallowLoc + "不是浅库位,系统繁忙");
        }
        return zerofill(String.valueOf(targetRow), 2) + shallowLoc.substring(2);
        boolean deepLocLeft = isDeepLocLeft(slaveProperties, row-1);//判断是否为左浅库位
        int shallowRow = deepLocLeft? (row - 1) : (row + 1);
        return zerofill(String.valueOf(shallowRow), 2) + shallowLoc.substring(2);
    }
    /**
     * 获取 浅库位对应的深库位号  双伸+单双伸  煜星定制
     */
    public static String getDeepLoc5(SlaveProperties slaveProperties, String shallowLoc,Integer whsType) {
        if (whsType==9){
            int row = getRow(shallowLoc);
            int targetRow;
            if (row == 22) {
                targetRow = row - 1;
            } else if (row == 23) {
                targetRow = row + 1;
            } else if (row == 25) {
                targetRow = row;
            } else if (row == 26) {
                targetRow = row + 1;
            } else {
                throw new RuntimeException(shallowLoc + "不是浅库位,系统繁忙");
            }
            return zerofill(String.valueOf(targetRow), 2) + shallowLoc.substring(2);
        } else {
            int row = getRow(shallowLoc);
            int remainder = (int) Arith.remainder(row, slaveProperties.getGroupCount());
            int targetRow;
            if (remainder == 2) {
                targetRow = row - 1;
            } else if (remainder == 3) {
                targetRow = row + 1;
            } else {
                throw new RuntimeException(shallowLoc + "不是浅库位,系统繁忙");
            }
            return zerofill(String.valueOf(targetRow), 2) + shallowLoc.substring(2);
        }
    }
//    /**
//     * 获取 浅库位对应的深库位号  双伸+单双伸  煜星定制
//     */
//    public static String getDeepLoc5(SlaveProperties slaveProperties, String shallowLoc,Integer whsType) {
//        if (whsType==9){
//            int row = getRow(shallowLoc);
//            int targetRow;
//            if (row == 22) {
//                targetRow = row - 1;
//            } else if (row == 23) {
//                targetRow = row + 1;
//            } else if (row == 25) {
//                targetRow = row;
//            } else if (row == 26) {
//                targetRow = row + 1;
//            } else {
//                throw new RuntimeException(shallowLoc + "不是浅库位,系统繁忙");
//            }
//            return zerofill(String.valueOf(targetRow), 2) + shallowLoc.substring(2);
//        } else {
//            int row = getRow(shallowLoc);
//            int remainder = (int) Arith.remainder(row, slaveProperties.getGroupCount());
//            int targetRow;
//            if (remainder == 2) {
//                targetRow = row - 1;
//            } else if (remainder == 3) {
//                targetRow = row + 1;
//            } else {
//                throw new RuntimeException(shallowLoc + "不是浅库位,系统繁忙");
//            }
//            return zerofill(String.valueOf(targetRow), 2) + shallowLoc.substring(2);
//        }
//    }
    /**
     * 获取 浅库位排对应的深库位排
     */
    public static Integer getDeepRow(SlaveProperties slaveProperties, Integer shallowRow) {
        int remainder = (int) Arith.remainder(shallowRow, slaveProperties.getGroupCount());
        int targetRow;
        if (remainder == 2) {
            targetRow = shallowRow - 1;
        } else if (remainder == 3) {
            targetRow = shallowRow + 1;
        } else {
            throw new RuntimeException(shallowRow + "不是浅库位排,系统繁忙");
        }
        return targetRow;
//        int remainder = (int) Arith.remainder(shallowRow, slaveProperties.getGroupCount());
//        int targetRow;
//        if (remainder == 2) {
//            targetRow = shallowRow - 1;
//        } else if (remainder == 3) {
//            targetRow = shallowRow + 1;
//        } else {
//            throw new RuntimeException(shallowRow + "不是浅库位排,系统繁忙");
//        }
//        return targetRow;
        boolean deepLocLeft = isDeepLocLeft(slaveProperties, shallowRow-1);//判断是否为左浅库位
        return deepLocLeft? (shallowRow - 1) : (shallowRow + 1);
    }
    /**
src/main/java/com/zy/common/service/CommonService.java
@@ -238,7 +238,7 @@
                if (Utils.isShallowLoc(slaveProperties, locNo)) {
                    continue;
                }
                String shallowLocNo = Utils.getShallowLoc5(slaveProperties, locNo,whsType);
                String shallowLocNo = Utils.getShallowLoc(slaveProperties, locNo);
                // 检测目标库位是否为空库位
                LocMast shallowLoc = locMastService.selectById(shallowLocNo);
                if (shallowLoc != null && shallowLoc.getLocSts().equals("O")) {
@@ -277,7 +277,7 @@
                    if (Utils.isShallowLoc(slaveProperties, loc.getLocNo())) {
                        continue;
                    }
                    String shallowLocNo = Utils.getShallowLoc5(slaveProperties, loc.getLocNo(),whsType);
                    String shallowLocNo = Utils.getShallowLoc(slaveProperties, loc.getLocNo());
                    // 检测目标库位是否为空库位
                    LocMast shallowLoc = locMastService.selectById(shallowLocNo);
                    if (shallowLoc != null && shallowLoc.getLocSts().equals("O")) {
@@ -338,7 +338,7 @@
                    continue;
                }
                if (Utils.BooleanWhsTypeStaIoType(whsType)){
                    String shallowLoc = Utils.getDeepLoc5(slaveProperties, locMast1.getLocNo(),whsType);
                    String shallowLoc = Utils.getDeepLoc(slaveProperties, locMast1.getLocNo());
                    LocMast locMast2 = locMastService.selectOne(new EntityWrapper<LocMast>()
                            .eq("loc_no", shallowLoc).eq("loc_sts", "O"));
                    if (!Cools.isEmpty(locMast2)) {
@@ -359,7 +359,7 @@
                        continue;
                    }
                    if (Utils.BooleanWhsTypeStaIoType(whsType)){
                        String shallowLoc = Utils.getDeepLoc5(slaveProperties, locMast1.getLocNo(),whsType);
                        String shallowLoc = Utils.getDeepLoc(slaveProperties, locMast1.getLocNo());
                        LocMast locMast2 = locMastService.selectOne(new EntityWrapper<LocMast>()
                                .eq("loc_no", shallowLoc).eq("loc_sts", "O"));
                        if (!Cools.isEmpty(locMast2)) {
src/main/resources/application.yml
@@ -54,13 +54,13 @@
  # 双深
  doubleDeep: false
  # 双深库位排号
  doubleLocs: 1,4,5,8,9,12,13,16,17,20,21,24
  doubleLocs: 1,4,5,8,21,24,27
  # 一个堆垛机负责的货架排数
  groupCount: 4
  # 左深库位排号
  doubleLocsLeft : 1,5,9,13,17,21
  doubleLocsLeft : 1,5,21
  # 右深库位排号
  doubleLocsRight : 4,8,12,16,20,24
  doubleLocsRight : 4,8,24,27
# wms参数配置
wms-parameter:
  # 自动补空板功能开关