#
luxiaotao1123
2022-09-15 c5736834f88a5fd43abadaec50dd2b1e6dceb4ba
#
3个文件已修改
107 ■■■■■ 已修改文件
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/utils/Utils.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/enums/SteTaskModeType.java 68 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -483,7 +483,7 @@
                if (steNo != null) {
                    // 小车行走到堆垛机待搬移点
                    if (wrkMast.getWrkSts() == 2L && wrkMast.getSteNo() == null) {
                        this.letCarBeReady(wrkMast, steNo);
                        this.letCarBeReady(wrkMast, steNo, wrkMast.getLocNo());
                    }
                    // 小车搬走
                    if (wrkMast.getWrkSts() == 3L) {
@@ -539,7 +539,7 @@
                if (steNo != null) {
                    // 小车行走到堆垛机待搬移点
                    if (wrkMast.getWrkSts() == 2L && wrkMast.getSteNo() == null) {
                        this.letCarBeReady(wrkMast, steNo);
                        this.letCarBeReady(wrkMast, steNo, wrkMast.getLocNo());
                    }
                    // 堆垛机将货放至小车上 3.小车待搬(小车不用搬运,已经在当前组库位) / 6.小车待入  ===>> 7.吊车入库中
                    if (wrkMast.getWrkSts() == 3L || wrkMast.getWrkSts() == 6L) {
@@ -587,7 +587,7 @@
                        SteThread steThread = queryIdleCar(wrkMast);
                        if (steThread != null) {
                            // 让小车等待搬运待续
                            this.letCarBeReady(wrkMast, steThread.getSlave().getId());
                            this.letCarBeReady(wrkMast, steThread.getSlave().getId(), wrkMast.getLocNo());
                        }
                    }
                    // 堆垛机搬运小车
@@ -681,7 +681,7 @@
                // 不是最外层库位,需要使用穿梭车搬运后,再堆垛机出库
                } else {
                    // 当前组库位是否有穿梭车
                    Integer steNo = this.hasCarOfIdle(wrkMast.getLocNo());
                    Integer steNo = this.hasCarOfIdle(wrkMast.getSourceLocNo());
                    // 有小车
                    if (steNo != null) {
                        if (wrkMast.getWrkSts() == 11L && wrkMast.getSteNo() == null) {
@@ -696,12 +696,8 @@
                                SteCommand steCommand = new SteCommand();
                                steCommand.setSteNo(steNo); // 穿梭车编号
                                steCommand.setTaskNo(wrkMast.getWrkNo()); // 工作号
                                steCommand.setTaskMode(SteTaskModeType.TO_B); // 任务模式:  去近点 等待堆垛机叉取
                                steCommand.setTaskMode(SteTaskModeType.findOutByLoc(wrkMast.getSourceLocNo())); // 任务模式:  去近点 等待堆垛机叉取
                                SteABType ab = Utils.selectAB(steProtocol.getRow().intValue());
                                // todo:luxiaotao
                                if (!MessageQueue.offer(SlaveType.Ste, steNo, new Task(2, steCommand))) {
                                    log.error("穿梭车命令下发失败,穿梭车号={},任务数据={}", steNo, JSON.toJSON(steCommand));
                                } else {
@@ -757,7 +753,7 @@
                            SteThread steThread = queryIdleCar(wrkMast);
                            if (steThread != null) {
                                // 让小车等待搬运待续
                                this.letCarBeReady(wrkMast, steThread.getSlave().getId());
                                this.letCarBeReady(wrkMast, steThread.getSlave().getId(), wrkMast.getSourceLocNo());
                            }
                        }
                        // 堆垛机搬运小车
@@ -811,7 +807,7 @@
     * 让小车从 远点 ====>> 移动到近点
     *  等待堆垛机搬运
     */
    public void letCarBeReady(WrkMast wrkMast, Integer steNo) {
    public void letCarBeReady(WrkMast wrkMast, Integer steNo, String locNo) {
        // 获取穿梭车信息
        SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, steNo);
        SteProtocol steProtocol = steThread.getSteProtocol();
@@ -822,7 +818,7 @@
            SteCommand steCommand = new SteCommand();
            steCommand.setSteNo(steNo); // 穿梭车编号
            steCommand.setTaskNo(wrkMast.getWrkNo()); // 工作号
            steCommand.setTaskMode(SteTaskModeType.TO_B); // 任务模式:  去近点 等待堆垛机叉取
            steCommand.setTaskMode(SteTaskModeType.findOriginByLoc(locNo)); // 任务模式:  去近点 等待堆垛机叉取
            steCommand.setRow(Utils.getGroupRow(steProtocol.getRow().intValue()).shortValue());
            steCommand.setBay(steProtocol.getBay());
@@ -1014,8 +1010,7 @@
                            SteCommand steCommand = new SteCommand();
                            steCommand.setSteNo(steNo); // 穿梭车编号
                            steCommand.setTaskNo(wrkMast.getWrkNo()); // 工作号
                            steCommand.setTaskMode(SteTaskModeType.TO_B); // 任务模式:  去近点 等待堆垛机叉取
                            // todo:luxiaotao
                            steCommand.setTaskMode(SteTaskModeType.findInByLoc(wrkMast.getLocNo())); // 任务模式: 搬入库
                            if (!MessageQueue.offer(SlaveType.Ste, steNo, new Task(2, steCommand))) {
                                log.error("穿梭车命令下发失败,穿梭车号={},任务数据={}", steNo, JSON.toJSON(steCommand));
                            } else {
@@ -1087,8 +1082,7 @@
                        SteCommand steCommand = new SteCommand();
                        steCommand.setSteNo(steNo); // 穿梭车编号
                        steCommand.setTaskNo(wrkMast.getWrkNo()); // 工作号
                        steCommand.setTaskMode(SteTaskModeType.TO_B); // 任务模式:  去近点 等待堆垛机叉取
                        // todo:luxiaotao
                        steCommand.setTaskMode(SteTaskModeType.findOutByLoc(wrkMast.getSourceLocNo())); // 任务模式:  搬出库
                        if (!MessageQueue.offer(SlaveType.Ste, steNo, new Task(2, steCommand))) {
                            log.error("穿梭车命令下发失败,穿梭车号={},任务数据={}", steNo, JSON.toJSON(steCommand));
                        } else {
src/main/java/com/zy/asrs/utils/Utils.java
@@ -37,6 +37,11 @@
        }
    }
    public static Integer getGroupRow(String locNo){
        int row = getRow(locNo);
        return getGroupRow(row);
    }
    public static Integer getGroupRow(Integer row) {
        switch (row) {
            case 1:
@@ -70,14 +75,6 @@
                throw new RuntimeException("库位解析异常");
        }
    }
    public static Integer getGroupRow(String locNo){
        int row = getRow(locNo);
        return getGroupRow(row);
    }
    public static SteABType selectAB(Integer row) {
        switch (row) {
src/main/java/com/zy/core/enums/SteTaskModeType.java
@@ -1,5 +1,8 @@
package com.zy.core.enums;
import com.core.exception.CoolException;
import com.zy.asrs.utils.Utils;
public enum SteTaskModeType {
    INIT(0, "初始"),    // 初始
@@ -7,17 +10,17 @@
    OUT_RIGHT(2, "右出库"),    // 右出库
    IN_LEFT(3, "左入库"),    // 左入库
    IN_RIGHT(4, "右入库"),    // 右入库
    MOVE_LEFT(5, "左移库"),    // 左移库
    MOVE_RIGHT(6, "右移库"),    // 右移库
    GO_ORIGIN(7, "回原点"),    // 回原点
    BACK_ORIGIN(8, "回反原点"),      // 回反原点
    TO_A(9, "A点"),        // A点
    TO_B(10, "B点"),       // B点
    FIT_LEFT(11, "左搬移"),   // 左搬移
    FIT_RIGHT(12, "右搬移"),      // 右搬移
//    MOVE_LEFT(5, "左移库"),    // 左移库
//    MOVE_RIGHT(6, "右移库"),    // 右移库
    GO_ORIGIN(7, "去右端"),    // 回原点
    BACK_ORIGIN(8, "去左端"),      // 回反原点
//    TO_A(9, "A点"),        // A点
//    TO_B(10, "B点"),       // B点
//    FIT_LEFT(11, "左搬移"),   // 左搬移
//    FIT_RIGHT(12, "右搬移"),      // 右搬移
    CHARGE(13, "充电"),         // 充电
    CHECK_LEFT(14, "左盘点"),     // 左盘点
    CHECK_RIGHT(15, "右盘点"),    // 右盘点
//    CHECK_LEFT(14, "左盘点"),     // 左盘点
//    CHECK_RIGHT(15, "右盘点"),    // 右盘点
    ;
    public Integer id;
@@ -51,4 +54,49 @@
        return null;
    }
    public static SteTaskModeType findOriginByLoc(String locNo) {
        switch (Utils.getGroupRow(locNo)) {
            case 3:
            case 11:
            case 18:
                return SteTaskModeType.GO_ORIGIN;   // 右
            case 4:
            case 12:
            case 19:
                return SteTaskModeType.BACK_ORIGIN; // 左
            default:
                throw new CoolException("解析穿梭车原点定位失败");
        }
    }
    public static SteTaskModeType findInByLoc(String locNo) {
        switch (Utils.getGroupRow(locNo)) {
            case 3:
            case 11:
            case 18:
                return SteTaskModeType.IN_RIGHT;   // 右
            case 4:
            case 12:
            case 19:
                return SteTaskModeType.IN_LEFT;    // 左
            default:
                throw new CoolException("解析穿梭车原点定位失败");
        }
    }
    public static SteTaskModeType findOutByLoc(String locNo) {
        switch (Utils.getGroupRow(locNo)) {
            case 3:
            case 11:
            case 18:
                return SteTaskModeType.OUT_RIGHT;   // 右
            case 4:
            case 12:
            case 19:
                return SteTaskModeType.OUT_LEFT;    // 左
            default:
                throw new CoolException("解析穿梭车原点定位失败");
        }
    }
}