自动化立体仓库 - WMS系统
#
luxiaotao1123
2022-08-31 5f3506ea2c1627f168604576634638833ab209d0
src/main/java/com/zy/common/service/CommonService.java
@@ -10,6 +10,7 @@
import com.zy.asrs.utils.Utils;
import com.zy.asrs.utils.VersionUtils;
import com.zy.common.model.LocTypeDto;
import com.zy.common.model.Shelves;
import com.zy.common.model.StartupDto;
import com.zy.common.properties.SlaveProperties;
import lombok.extern.slf4j.Slf4j;
@@ -110,16 +111,18 @@
     */
    public StartupDto getLocNo(Integer whsType, Integer staDescId, Integer sourceStaNo, List<String> matNos, LocTypeDto locTypeDto, LocTypeDto oldLocType, int times) {
        StartupDto startupDto = new StartupDto();
        int start;
        int end;
        switch (sourceStaNo) {
            case 103:
                whsType = 1;
                start = 1;
                end = 14;
                break;
            case 111:
            case 211:
            case 203:
                whsType = 2;
                break;
            case 208:
                whsType = 3;
                start = 8;
                end = 21;
                break;
            default:
                throw new CoolException("检索库位失败,请联系管理员");
@@ -142,7 +145,7 @@
        // 靠近摆放规则 --- 同天同规格物料
        if (!Cools.isEmpty(matNos)) {
            List<String> locNos = locDetlService.getSameDetl(matNos.get(0), sRow, eRow);
            List<String> locNos = locDetlService.getSameDetl(matNos.get(0), start, end);
            for (String locNo : locNos) {
                List<String> groupLoc = Utils.getGroupLoc(locNo);
                locMast = locMastService.findOutMost(groupLoc);
@@ -161,7 +164,8 @@
        // 靠近摆放规则 --- 空托
        if (staDescId == 10) {
            List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("loc_sts", "D").ge("row1", sRow).le("row1", eRow));
            List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>()
                    .eq("loc_sts", "D").ge("row1", start).le("row1", end));
            if (locMasts.size() > 0) {
                for (LocMast loc : locMasts) {
                    List<String> groupLoc = Utils.getGroupLoc(loc.getLocNo());
@@ -181,40 +185,60 @@
        }
        // 如果没有相近物料,则按规则轮询货架
        int currentRow = 1;
        if (null == locMast) {
            switch (whsType) {
                case 1:
                    if (curRow == 1) {
                        curRow = 7;
                    } else if (curRow == 7) {
                        curRow = 1;
                    }
                    crnNo = 1;
                    break;
                case 2:
                    if (curRow == 8) {
                        curRow = 14;
                    } else if (curRow == 14) {
                        curRow = 8;
                    }
                    crnNo = 2;
                    break;
                case 3:
                    if (curRow == 15) {
                        curRow = 21;
                    } else if (curRow == 21) {
                        curRow = 15;
                    }
                    crnNo = 3;
                    break;
                default:
            Shelves shelves = new Shelves(rowCount, crn_qty);
            for (int i = 0; i < shelves.group; i ++) {
                curRow = shelves.start(curRow);
                if (curRow < 0) {
                    throw new CoolException("检索库位失败,请联系管理员");
                }
                currentRow = curRow;
                int crnNo1 = shelves.get(curRow);
                if (whsType == 1) {
                    switch (curRow) {
                        case 1:
                            curRow = 1;
                            break;
                        case 2:
                            curRow = 7;
                            break;
                        case 3:
                            curRow = 8;
                            break;
                        case 4:
                            curRow = 14;
                            break;
                        default:
                            throw new CoolException("检索库位失败,请联系管理员");
                    }
                } else {
                    switch (curRow) {
                        case 1:
                            curRow = 8;
                            break;
                        case 2:
                            curRow = 14;
                            break;
                        case 3:
                            curRow = 15;
                            break;
                        case 4:
                            curRow = 21;
                            break;
                        default:
                            throw new CoolException("检索库位失败,请联系管理员");
                    }
                    crnNo1 = crnNo1 + 1;
                }
                if (basCrnpService.checkSiteError(crnNo1, true)) {
                    crnNo = crnNo1;
                    break;
                }
            }
        }
        if (!basCrnpService.checkSiteError(crnNo, true)) {
            throw new CoolException("没有可用的堆垛机");
        }
        if (crnNo == 0) {
            throw new CoolException("没有可用的堆垛机");
        }
@@ -236,7 +260,7 @@
        }
        // 更新库位排号
        rowLastno.setCurrentRow(curRow);
        rowLastno.setCurrentRow(currentRow);
        rowLastnoService.updateById(rowLastno);
        // 开始查找库位 ==============================>>