自动化立体仓库 - WMS系统
#
lsh
2024-02-16 7c077bec6a5912b39262e5aa65c1eba174e10e7a
#
3个文件已修改
323 ■■■■■ 已修改文件
src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java 98 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/utils/Utils.java 70 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/common/service/CommonService.java 155 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java
@@ -699,65 +699,65 @@
        //判断param参数
        if (Cools.isEmpty(param.getBarcode())){
            throw new CoolException("参数:托盘码 barcode为空");
        }else if (Cools.isEmpty(param.getPalletizingNo())){
            throw new CoolException("参数:码垛位编号 palletizingNo为空");
        }else if (Cools.isEmpty(param.getBoxType())){
            throw new CoolException("参数:木箱类型 boxType为空");
//        }else if (Cools.isEmpty(param.getPalletizingNo())){
//            throw new CoolException("参数:码垛位编号 palletizingNo为空");
//        }else if (Cools.isEmpty(param.getBoxType())){
//            throw new CoolException("参数:木箱类型 boxType为空");
        }else if (Cools.isEmpty(param.getMatList()) || param.getMatList().size()==0){
            throw new CoolException("参数:物料明细 matLists为空");
            throw new CoolException("参数:物料明细 matList为空");
        }
        String matnrOne = "";//木箱相同位置 规格 matnr校验  1、左
        String matnrTwo = "";//木箱相同位置 规格 matnr校验  2、右
        ArrayList<String> boxNos = new ArrayList<>();   //木箱唯一编码查重  (batch)
//        String matnrOne = "";//木箱相同位置 规格 matnr校验  1、左
//        String matnrTwo = "";//木箱相同位置 规格 matnr校验  2、右
//        ArrayList<String> boxNos = new ArrayList<>();   //木箱唯一编码查重  (batch)
        //判断matLists参数
        for (PalletizingCompleteTwoFloorParam.MatList matList:param.getMatList()){
            if (Cools.isEmpty(matList.getMatnr())){
                throw new CoolException("参数:规格 matnr为空");
            }else if (Cools.isEmpty(matList.getPosition())){
                throw new CoolException("规格:"+matList.getMatnr()+"、参数:码垛位置 position为空");
            }else if (Cools.isEmpty(matList.getBatch())){
                throw new CoolException("规格:"+matList.getMatnr()+"、参数:木箱编号 batch为空");
            }else if (Cools.isEmpty(matList.getModel())){
                throw new CoolException("规格:"+matList.getMatnr()+"、参数:卷号 model为空");
            }else if (Cools.isEmpty(matList.getBatch())){
                throw new CoolException("规格:"+matList.getMatnr()+"、参数:木箱编号 boxNo为空");
            }else if (Cools.isEmpty(matList.getWeight()) || matList.getWeight().equals(0D)){
                throw new CoolException("规格:"+matList.getMatnr()+"、参数:净重 weight为空");
            }else if (Cools.isEmpty(matList.getRoughWeight()) || matList.getRoughWeight().equals(0D)){
                throw new CoolException("规格:"+matList.getMatnr()+"、参数:毛重 roughWeight");
            }else if (Cools.isEmpty(matList.getRollExtent()) || matList.getRollExtent().equals(0D)){
                throw new CoolException("规格:"+matList.getMatnr()+"、参数:卷长度 rollExtent");
            }
//            }else if (Cools.isEmpty(matList.getPosition())){
//                throw new CoolException("规格:"+matList.getMatnr()+"、参数:码垛位置 position为空");
//            }else if (Cools.isEmpty(matList.getBatch())){
//                throw new CoolException("规格:"+matList.getMatnr()+"、参数:木箱编号 batch为空");
//            }else if (Cools.isEmpty(matList.getModel())){
//                throw new CoolException("规格:"+matList.getMatnr()+"、参数:卷号 model为空");
//            }else if (Cools.isEmpty(matList.getBatch())){
//                throw new CoolException("规格:"+matList.getMatnr()+"、参数:木箱编号 boxNo为空");
//            }else if (Cools.isEmpty(matList.getWeight()) || matList.getWeight().equals(0D)){
//                throw new CoolException("规格:"+matList.getMatnr()+"、参数:净重 weight为空");
//            }else if (Cools.isEmpty(matList.getRoughWeight()) || matList.getRoughWeight().equals(0D)){
//                throw new CoolException("规格:"+matList.getMatnr()+"、参数:毛重 roughWeight");
//            }else if (Cools.isEmpty(matList.getRollExtent()) || matList.getRollExtent().equals(0D)){
//                throw new CoolException("规格:"+matList.getMatnr()+"、参数:卷长度 rollExtent");
//            }
//            else if (Cools.isEmpty(matList.getJoint()) || matList.getJoint()==0){
//                throw new CoolException("规格:"+matList.getMatnr()+"、参数:接头数 joint");
            }
//            if (matList.getPosition().equals("1")){//1、左  2、右
//                if (!matnrOne.equals("")){
//                    if (!matnrOne.equals(matList.getMatnr())){
//                        throw new CoolException("木箱位置:"+matList.getPosition()+"存在不同规格卷信息");
//                    }
//                }else {
//                    matnrOne=matList.getMatnr();
//                }
//            }else if (matList.getPosition().equals("2")){
//                if (!matnrTwo.equals("")){
//                    if (!matnrTwo.equals(matList.getMatnr())){
//                        throw new CoolException("木箱位置:"+matList.getPosition()+"存在不同规格卷信息");
//                    }
//                }else {
//                    matnrTwo=matList.getMatnr();
//                }
//            }else {
//                throw new CoolException("参数:木箱编号 boxNo:"+matList.getBatch()+",木箱位置错误:"+matList.getPosition());
//            }
            if (matList.getPosition().equals("1")){//1、左  2、右
                if (!matnrOne.equals("")){
                    if (!matnrOne.equals(matList.getMatnr())){
                        throw new CoolException("木箱位置:"+matList.getPosition()+"存在不同规格卷信息");
                    }
                }else {
                    matnrOne=matList.getMatnr();
                }
            }else if (matList.getPosition().equals("2")){
                if (!matnrTwo.equals("")){
                    if (!matnrTwo.equals(matList.getMatnr())){
                        throw new CoolException("木箱位置:"+matList.getPosition()+"存在不同规格卷信息");
                    }
                }else {
                    matnrTwo=matList.getMatnr();
                }
            }else {
                throw new CoolException("参数:木箱编号 boxNo:"+matList.getBatch()+",木箱位置错误:"+matList.getPosition());
            }
            if (!boxNos.contains(matList.getBatch())){
                boxNos.add(matList.getBatch());
            }else {
                throw new CoolException("参数:木箱编号 boxNo:"+matList.getBatch()+",木箱编码存在重复");
            }
//
//            if (!boxNos.contains(matList.getBatch())){
//                boxNos.add(matList.getBatch());
//            }else {
//                throw new CoolException("参数:木箱编号 boxNo:"+matList.getBatch()+",木箱编码存在重复");
//            }
        }
//        BasDevp basDevp = basDevpService.selectById(Integer.parseInt(param.getDevNo$()));
src/main/java/com/zy/asrs/utils/Utils.java
@@ -218,15 +218,36 @@
//        System.out.println(deepRow);
//    }
    public static boolean BooleanWhsTypeSta(Integer whsType) {
    public static Integer GetWhsType(Integer sourceStaNo) {
        switch (sourceStaNo){
            case 104:
            case 173:
            case 174:
            case 175:
            case 130:
            case 125:
                return 5;
            default:
                return 0;
        }
    }
    public static boolean BooleanWhsTypeStaIoType(Integer whsType) {
        if (whsType == 1) {
            return true;
        }
        return false;
    }
    public static boolean BooleanWhsTypeSta(Integer whsType) {
        if (whsType == 1 || whsType == 5) {
            return true;
        }
        return false;
    }
    public static boolean BooleanWhsTypeSta(Integer whsType, Integer staDescId) {
        if (whsType == 1 && staDescId != 11 && staDescId != 111) {
        if ((whsType == 1 || whsType == 5) && staDescId != 11 && staDescId != 111) {
            return true;
        }
        return false;
@@ -252,7 +273,15 @@
    public static int[] LocNecessaryParameters(Integer whsType, Integer curRow, Integer crnNumber) {
        switch (whsType){
            case 1://经典双伸库位
                return LocNecessaryParametersDoubleExtension(whsType, curRow, crnNumber);
                return LocNecessaryParametersDoubleExtension(whsType, curRow, crnNumber); //已完善
//            case 2://经典单伸库位
//                return LocNecessaryParametersDoubleExtension1(whsType, curRow, crnNumber); //未完善
//            case 3://经典单双伸库位  左单右双
//                return LocNecessaryParametersDoubleExtension2(whsType, curRow, crnNumber); //未完善
//            case 4://经典单双伸库位  左双右单
//                return LocNecessaryParametersDoubleExtension3(whsType, curRow, crnNumber); //未完善
            case 5://双工位单伸库位
                return LocNecessaryParametersDoubleExtension5(whsType, curRow, crnNumber); //未完善
            default:
                return LocNecessaryParametersMove(whsType, curRow, crnNumber);//moveCrnNo
        }
@@ -309,6 +338,41 @@
        return necessaryParameters;
    }
    //双工位单伸库位
    public static int[] LocNecessaryParametersDoubleExtension5(Integer whsType, Integer curRow, Integer crnNumber) {
        int[] necessaryParameters = new int[]{0, 0, 0, 0};
        if (BooleanWhsTypeSta(whsType)) {
            necessaryParameters[0] = crnNumber; // 轮询次数
            //满板正常入库
            if (curRow.equals(crnNumber * 4)) {
                necessaryParameters[1] = 1;    //curRow   最深库位排
                necessaryParameters[2] = 1;     //crnNo     堆垛机号
                necessaryParameters[3] = 2;    //nearRow  最浅库位排
            } else if (curRow.equals(crnNumber * 4 - 3)) {
                necessaryParameters[1] = 4;    //curRow   最深库位排
                necessaryParameters[2] = 1;     //crnNo     堆垛机号
                necessaryParameters[3] = 3;    //nearRow  最浅库位排
            } else {
                curRow = curRow + 4;
                if (curRow < 1 || curRow > (crnNumber * 4)) {
                    throw new CoolException("库位排号异常:排号:" + curRow);
                }
                if ((curRow - 1) % 4 == 0) {
                    necessaryParameters[1] = curRow;    //curRow   最深库位排
                    necessaryParameters[2] = (curRow + 3) / 4;     //crnNo     堆垛机号
                    necessaryParameters[3] = curRow + 1;    //nearRow  最浅库位排
                } else if (curRow % 4 == 0) {
                    necessaryParameters[1] = curRow;    //curRow   最深库位排
                    necessaryParameters[2] = curRow / 4;     //crnNo     堆垛机号
                    necessaryParameters[3] = curRow - 1;    //nearRow  最浅库位排
                } else {
                    throw new CoolException("库位排号异常:排号:" + curRow);
                }
            }
        }
        return necessaryParameters;
    }
    public static void main(String[] args) {
        List<LocMast> locS = new ArrayList<LocMast>();
src/main/java/com/zy/common/service/CommonService.java
@@ -119,6 +119,7 @@
     */
    @Transactional
    public StartupDto getLocNo(Integer whsType, Integer staDescId, Integer sourceStaNo, String matnr, String batch, String grade, LocTypeDto locTypeDto) {
        whsType = Utils.GetWhsType(sourceStaNo);
        return getLocNoRun(whsType,staDescId,sourceStaNo,matnr,batch,grade,0,locTypeDto,0);
    }
@@ -172,7 +173,7 @@
        }
        //此程序用于优化堆垛机异常时的运行时间
        for (int i = times; i < crnNumber; i++) {
        for (int i = times; i < crnNumber*2; i++) {
            int[] locNecessaryParameters = Utils.LocNecessaryParameters(whsType, curRow, crnNumber);
            curRow = locNecessaryParameters[1];
            crnNo = locNecessaryParameters[2];
@@ -198,58 +199,60 @@
        boolean signRule2 = false;
        // 靠近摆放规则 --- 同天同规格物料 //分离版
//        if (!Cools.isEmpty(matnr) &&  (staDescId == 1)){
//            signRule1 = true;
//        }
//        // 靠近摆放规则 --- 同天同规格物料 //互通版
//        if (!Cools.isEmpty(matnr) && staDescId == 1) {
//            signRule2 = true;
//        }
//
//        if (!Cools.isEmpty(matnr) &&  (staDescId == 11 || staDescId == 111)) {
//            signRule1 = true;
//        }
//
//        if (signRule1){
//            List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("row1", nearRow).eq("loc_sts", "O"));
//            for (LocMast locMast1:locMasts){
//                if (VersionUtils.locMoveCheckLocTypeComplete(locMast1, locTypeDto)) {
//                    continue;
//                }
//                String shallowLoc = Utils.getDeepLoc(slaveProperties,locMast1.getLocNo());
//                LocMast locMast2 = locMastService.selectById(shallowLoc);
//                if (!Cools.isEmpty(locMast2) && locMast2.getLocSts().equals("F")){
//                    LocDetl locDetl = locDetlService.selectOne(new EntityWrapper<LocDetl>().eq("loc_no", locMast2.getLocNo()));
//                    if (!Cools.isEmpty(locDetl) && matnr.equals(locDetl.getMatnr())) {
//                        locMast = locMast1;
//                        break;
//                    }
//                }
//            }
//        }else if (signRule2){
//            List<String> locNos = locDetlService.getSameDetlToday(matnr, sRow, eRow);
//            for (String locNo : locNos) {
//                if (Utils.isShallowLoc(slaveProperties, locNo)) {
//                    continue;
//                }
//                String shallowLocNo = Utils.getShallowLoc(slaveProperties, locNo);
//                // 检测目标库位是否为空库位
//                LocMast shallowLoc = locMastService.selectById(shallowLocNo);
//                if (shallowLoc != null && shallowLoc.getLocSts().equals("O")) {
//                    if (VersionUtils.locMoveCheckLocTypeComplete(shallowLoc, locTypeDto)) {
//                        if (basCrnpService.checkSiteError(shallowLoc.getCrnNo(), true)) {
//                            locMast = shallowLoc;
//                            crnNo = locMast.getCrnNo();
//                            break;
//                        }
//                    }
//                }
//            }
//        }
        if (Utils.BooleanWhsTypeStaIoType(whsType)){
            // 靠近摆放规则 --- 同天同规格物料 //分离版
            if (!Cools.isEmpty(matnr) &&  (staDescId == 1)){
                signRule1 = true;
            }
            // 靠近摆放规则 --- 同天同规格物料 //互通版
            if (!Cools.isEmpty(matnr) && staDescId == 1) {
                signRule2 = true;
            }
            if (!Cools.isEmpty(matnr) &&  (staDescId == 11 || staDescId == 111)) {
                signRule1 = true;
            }
        }
        if (signRule1){
            List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("row1", nearRow).eq("loc_sts", "O"));
            for (LocMast locMast1:locMasts){
                if (VersionUtils.locMoveCheckLocTypeComplete(locMast1, locTypeDto)) {
                    continue;
                }
                String shallowLoc = Utils.getDeepLoc(slaveProperties,locMast1.getLocNo());
                LocMast locMast2 = locMastService.selectById(shallowLoc);
                if (!Cools.isEmpty(locMast2) && locMast2.getLocSts().equals("F")){
                    LocDetl locDetl = locDetlService.selectOne(new EntityWrapper<LocDetl>().eq("loc_no", locMast2.getLocNo()));
                    if (!Cools.isEmpty(locDetl) && matnr.equals(locDetl.getMatnr())) {
                        locMast = locMast1;
                        break;
                    }
                }
            }
        }else if (signRule2){
            List<String> locNos = locDetlService.getSameDetlToday(matnr, sRow, eRow);
            for (String locNo : locNos) {
                if (Utils.isShallowLoc(slaveProperties, locNo)) {
                    continue;
                }
                String shallowLocNo = Utils.getShallowLoc(slaveProperties, locNo);
                // 检测目标库位是否为空库位
                LocMast shallowLoc = locMastService.selectById(shallowLocNo);
                if (shallowLoc != null && shallowLoc.getLocSts().equals("O")) {
                    if (VersionUtils.locMoveCheckLocTypeComplete(shallowLoc, locTypeDto)) {
                        if (basCrnpService.checkSiteError(shallowLoc.getCrnNo(), true)) {
                            locMast = shallowLoc;
                            crnNo = locMast.getCrnNo();
                            break;
                        }
                    }
                }
            }
        }
//        // 靠近摆放规则 --- 空托  //分离版
//        if (staDescId == 10) {
//        if (staDescId == 10 && Utils.BooleanWhsTypeStaIoType(whsType)) {
//            List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("row1", nearRow).eq("loc_sts", "O"));
//            for (LocMast locMast1:locMasts){
//                if (VersionUtils.locMoveCheckLocTypeComplete(locMast1, locTypeDto)) {
@@ -264,29 +267,29 @@
//            }
//        }
//        // 靠近摆放规则 --- 空托 //互通版
//        if (staDescId == 10) {
//            List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("loc_sts", "D").ge("row1", sRow).le("row1", eRow));
//            if (locMasts.size() > 0) {
//                for (LocMast loc : locMasts) {
//                    if (Utils.isShallowLoc(slaveProperties, loc.getLocNo())) {
//                        continue;
//                    }
//                    String shallowLocNo = Utils.getShallowLoc(slaveProperties, loc.getLocNo());
//                    // 检测目标库位是否为空库位
//                    LocMast shallowLoc = locMastService.selectById(shallowLocNo);
//                    if (shallowLoc != null && shallowLoc.getLocSts().equals("O")) {
//                        if (VersionUtils.locMoveCheckLocTypeComplete(shallowLoc, locTypeDto)) {
//                            if (basCrnpService.checkSiteError(shallowLoc.getCrnNo(), true)) {
//                                locMast = shallowLoc;
//                                crnNo = locMast.getCrnNo();
//                                break;
//                            }
//                        }
//                    }
//                }
//            }
//        }
        // 靠近摆放规则 --- 空托 //互通版
        if (staDescId == 10  && Utils.BooleanWhsTypeStaIoType(whsType)) {
            List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("loc_sts", "D").ge("row1", sRow).le("row1", eRow));
            if (locMasts.size() > 0) {
                for (LocMast loc : locMasts) {
                    if (Utils.isShallowLoc(slaveProperties, loc.getLocNo())) {
                        continue;
                    }
                    String shallowLocNo = Utils.getShallowLoc(slaveProperties, loc.getLocNo());
                    // 检测目标库位是否为空库位
                    LocMast shallowLoc = locMastService.selectById(shallowLocNo);
                    if (shallowLoc != null && shallowLoc.getLocSts().equals("O")) {
                        if (VersionUtils.locMoveCheckLocTypeComplete(shallowLoc, locTypeDto)) {
                            if (basCrnpService.checkSiteError(shallowLoc.getCrnNo(), true)) {
                                locMast = shallowLoc;
                                crnNo = locMast.getCrnNo();
                                break;
                            }
                        }
                    }
                }
            }
        }
        Wrapper<StaDesc> wrapper = null;
        StaDesc staDesc = null;
@@ -344,9 +347,9 @@
        // 递归查询
        if (Cools.isEmpty(locMast) || !locMast.getLocSts().equals("O")) {
            // 当前巷道无空库位时,递归调整至下一巷道,检索全部巷道无果后,跳出递归
            if (times < rowCount) {
            if (times < rowCount*2) {
                times = times + 1;
                return getLocNoRun(1, staDescId, sourceStaNo, matnr, batch, grade,moveCrnNo, locTypeDto, times);
                return getLocNoRun(whsType, staDescId, sourceStaNo, matnr, batch, grade,moveCrnNo, locTypeDto, times);
            }
//            // 2.库位当前所属尺寸无空库位时,调整尺寸参数,向上兼容检索库位
//            if (locTypeDto.getLocType1() < 2) {