luxiaotao1123
2024-03-29 7087c609488ee87e24c25ab61a7ada46352af116
Merge branch 'Four-Way-Rack' of http://47.97.1.152:5880/r/zy-asrs-master into Four-Way-Rack
12个文件已修改
400 ■■■■■ 已修改文件
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/action/LiftAction.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/action/ShuttleAction.java 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/command/LiftCommandService.java 35 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/command/ShuttleCommandService.java 172 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/model/enums/ShuttleCommandModeType.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/ShuttleDispatcher.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/model/protocol/LiftProtocol.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/model/protocol/ShuttleProtocol.java 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/LiftThread.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/ShuttleThread.java 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/SurayLiftThread.java 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/SurayShuttleThread.java 85 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/action/LiftAction.java
@@ -68,11 +68,8 @@
            return false;
        }
        //提升机处于自动、就绪、空闲
        if (!(liftProtocol.getModel()
                && liftProtocol.getReady()
                && !liftProtocol.getRun())
        ) {
        //判断提升机是否空闲
        if (!liftThread.isIdle()) {
            return false;
        }
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/action/ShuttleAction.java
@@ -85,10 +85,8 @@
            return false;
        }
        //四向穿梭车空闲、有任务、标记为true、存在任务指令,需要执行任务的下一条指令
        if (!shuttleProtocol.getIdle()
                || shuttleProtocol.getTaskNo() == 0
                || !shuttleProtocol.getPakMk()) {
        //判断设备是否空闲
        if (!shuttleThread.isIdle()) {
            return false;
        }
@@ -136,8 +134,8 @@
                if (!shuttleProtocol.getHasLift()) {
                    command.setComplete(true);
                }
            } else if (command.getMode() == ShuttleCommandModeType.CHARGE.id) {
                // 充电开关
            } else if (command.getMode() == ShuttleCommandModeType.CHARGE_OPEN.id) {
                // 充电开
                //判断小车充电状态
                if (shuttleProtocol.getHasCharge()) {
                    command.setComplete(true);
@@ -211,7 +209,8 @@
        } else if (command.getMode() == ShuttleCommandModeType.PALLET_LIFT.id
                || command.getMode() == ShuttleCommandModeType.PALLET_DOWN.id) {//顶升
            result = shuttleThread.lift(command);
        } else if (command.getMode() == ShuttleCommandModeType.CHARGE.id) {//充电
        } else if (command.getMode() == ShuttleCommandModeType.CHARGE_OPEN.id
                || command.getMode() == ShuttleCommandModeType.CHARGE_CLOSE.id) {//充电
            result = shuttleThread.charge(command);
        } else if (command.getMode() == ShuttleCommandModeType.RESET.id) {//复位
            result = shuttleThread.reset(command);
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/command/LiftCommandService.java
@@ -48,11 +48,8 @@
            return false;
        }
        //自动、就绪、空闲
        if (!(liftProtocol.getModel()
                && liftProtocol.getReady()
                && !liftProtocol.getRun())
        ) {
        //判断提升机是否自动
        if (!liftThread.isIdle()) {
            return false;
        }
@@ -218,11 +215,8 @@
        switch (Objects.requireNonNull(MotionCtgType.get(motion.getMotionCtgEl()))){
            case LIFT_MOVE:
                // 判断提升机是否自动、空闲、准备就绪、链条没有转动、没有未就绪报错
                if (!liftProtocol.getModel()
                        || liftProtocol.getRun()
                        || !liftProtocol.getReady()
                ) {
                // 判断提升机是否空闲
                if (!liftThread.isIdle()) {
                    return false;
                }
@@ -231,11 +225,8 @@
                }
                break;
            case LIFT_WITH_GOODS:
                // 判断提升机是否自动、空闲、准备就绪、链条没有转动、没有未就绪报错
                if (!liftProtocol.getModel()
                        || liftProtocol.getRun()
                        || !liftProtocol.getReady()
                ) {
                // 判断提升机是否空闲
                if (!liftThread.isIdle()) {
                    return false;
                }
@@ -249,11 +240,8 @@
                break;
            case LIFT_WITH_SHUTTLE:
                // 判断提升机是否自动、空闲、准备就绪、链条没有转动、没有未就绪报错
                if (!liftProtocol.getModel()
                        || liftProtocol.getRun()
                        || !liftProtocol.getReady()
                ) {
                // 判断提升机是否空闲
                if (!liftThread.isIdle()) {
                    return false;
                }
@@ -267,11 +255,8 @@
                }
                break;
            case LIFT_WITH_GOODS_AND_SHUTTLE:
                // 判断提升机是否自动、空闲、准备就绪、链条没有转动、没有未就绪报错
                if (!liftProtocol.getModel()
                        || liftProtocol.getRun()
                        || !liftProtocol.getReady()
                ) {
                // 判断提升机是否空闲
                if (!liftThread.isIdle()) {
                    return false;
                }
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/command/ShuttleCommandService.java
@@ -3,6 +3,7 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.zy.asrs.framework.common.Cools;
import com.zy.asrs.framework.exception.CoolException;
import com.zy.asrs.wcs.core.action.LiftAction;
import com.zy.asrs.wcs.core.action.ShuttleAction;
import com.zy.asrs.wcs.core.entity.Loc;
import com.zy.asrs.wcs.core.model.NavigateNode;
@@ -18,8 +19,10 @@
import com.zy.asrs.wcs.core.entity.Motion;
import com.zy.asrs.wcs.rcs.model.enums.ShuttleProtocolStatusType;
import com.zy.asrs.wcs.rcs.model.enums.SlaveType;
import com.zy.asrs.wcs.rcs.model.protocol.LiftProtocol;
import com.zy.asrs.wcs.rcs.model.protocol.ShuttleProtocol;
import com.zy.asrs.wcs.core.service.MotionService;
import com.zy.asrs.wcs.rcs.thread.LiftThread;
import com.zy.asrs.wcs.rcs.thread.ShuttleThread;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@@ -53,6 +56,8 @@
    private NavigateMapUtils navigateMapUtils;
    @Autowired
    private ShuttleAction shuttleAction;
    @Autowired
    private LiftAction liftAction;
    // 计算
    public Boolean accept(Motion motion) {
@@ -84,8 +89,8 @@
        List<ShuttleCommand> shuttleCommands = new ArrayList<>();
        ShuttleTaskModeType shuttleTaskModeType = null;
//        SiemensLiftThread liftThread = null;
//        LiftProtocol liftProtocol = null;
        LiftThread liftThread = null;
        LiftProtocol liftProtocol = null;
        //判断小车状态
        if (shuttleProtocol.getIdle()
@@ -106,38 +111,80 @@
                shuttleCommands = this.shuttleAssignCommand(motion.getOrigin(), motion.getTarget(), NavigationMapType.NORMAL.id, assignCommand, shuttleThread);
                shuttleTaskModeType = ShuttleTaskModeType.SHUTTLE_MOVE_LOC_NO;
                break;
//            case SHUTTLE_MOVE_LIFT_PALLET://穿梭车顶升并移动
//                shuttleCommands = this.shuttleAssignCommand(motion.getOrigin(), motion.getTarget(), NavigationMapType.DFX.id, assignCommand, shuttleThread);
//                shuttleTaskModeType = ShuttleTaskModeType.PAK_IN;
//                shuttleCommands.add(0, shuttleThread.getPalletCommand((short) 1));
//                break;
//            case SHUTTLE_MOVE_DOWN_PALLET://穿梭车移动并托盘下降
//                shuttleCommands = this.shuttleAssignCommand(motion.getOrigin(), motion.getTarget(), NavigationMapType.DFX.id, assignCommand, shuttleThread);
//                shuttleTaskModeType = ShuttleTaskModeType.PAK_IN;
//                shuttleCommands.add(shuttleCommands.size(), shuttleThread.getPalletCommand((short) 2));
//                break;
//            case SHUTTLE_MOVE_FROM_LIFT://出提升机
//                // 判断提升机状态
//                liftThread = (SiemensLiftThread) SlaveConnection.get(SlaveType.Lift, Integer.parseInt(motion.getTemp()));
//                if (liftThread == null) {
//                    return false;
//                }
//                liftProtocol = liftThread.getLiftProtocol();
//                // 判断提升机是否自动、空闲、准备就绪、链条没有转动、没有未就绪报错
//                if (!liftProtocol.getMode()
//                        || liftProtocol.getRunning()
//                        || !liftProtocol.getReady()
//                        || liftProtocol.getForwardRotationFeedback()
//                        || liftProtocol.getReverseFeedback()
//                        || liftProtocol.getNotReady().intValue() != 0
//                ) {
//                    return false;
//                }
            case SHUTTLE_MOVE_LIFT_PALLET://穿梭车顶升并移动
                shuttleCommands = this.shuttleAssignCommand(motion.getOrigin(), motion.getTarget(), NavigationMapType.DFX.id, assignCommand, shuttleThread);
                shuttleTaskModeType = ShuttleTaskModeType.PAK_IN;
                shuttleCommands.add(0, shuttleThread.getLiftCommand(motion.getWrkNo(), true));
                break;
            case SHUTTLE_MOVE_DOWN_PALLET://穿梭车移动并托盘下降
                shuttleCommands = this.shuttleAssignCommand(motion.getOrigin(), motion.getTarget(), NavigationMapType.DFX.id, assignCommand, shuttleThread);
                shuttleTaskModeType = ShuttleTaskModeType.PAK_IN;
                shuttleCommands.add(shuttleCommands.size(), shuttleThread.getLiftCommand(motion.getWrkNo(), false));
                break;
            case SHUTTLE_MOVE_FROM_LIFT://出提升机
                // 判断提升机状态
                liftThread = (LiftThread) SlaveConnection.get(SlaveType.Lift, Integer.parseInt(motion.getTemp()));
                if (liftThread == null) {
                    return false;
                }
                liftProtocol = liftThread.getStatus();
                if (liftProtocol == null) {
                    return false;
                }
                // 判断提升机是否空闲
                if (!liftThread.isIdle()) {
                    return false;
                }
                if (liftProtocol.getLev() != Utils.getLev(motion.getTarget())) {//判断提升机是否达到目标层
                    return false;
                }
//                //判断提升机是否被锁定
//                if (!liftProtocol.getLock()) {
//                    //锁定提升机
//                    LiftCommand lockCommand = liftThread.getLockCommand(motion.getWrkNo(), true);//获取提升机锁定命令
//
//                if (liftProtocol.getLev().intValue() != Utils.getLev(motion.getTarget())) {//判断提升机是否达到目标层
//                    return false;
//                }
//                    LiftAssignCommand liftAssignCommand = new LiftAssignCommand();
//                    liftAssignCommand.setLiftNo(liftThread.getStatus().getLiftNo());
//                    liftAssignCommand.setTaskNo(motion.getWrkNo());
//                    ArrayList<LiftCommand> list = new ArrayList<>();
//                    list.add(lockCommand);
//                    liftAssignCommand.setCommands(list);
//
//                    liftAction.assignWork(liftThread.getDevice(), liftAssignCommand);
//                    return false;//等待下一次轮询
//                }
                //判断提升机工作号是否和当前任务相同
                if (liftProtocol.getTaskNo().intValue() != motion.getWrkNo()) {
                    return false;
                }
                shuttleCommands = this.shuttleAssignCommand(motion.getOrigin(), motion.getTarget(), NavigationMapType.NORMAL.id, assignCommand, shuttleThread);
                shuttleTaskModeType = ShuttleTaskModeType.SHUTTLE_MOVE_LOC_NO;
                break;
            case SHUTTLE_MOVE_TO_LIFT://进提升机
                // 判断提升机状态
                liftThread = (LiftThread) SlaveConnection.get(SlaveType.Lift, Integer.parseInt(motion.getTemp()));
                if (liftThread == null) {
                    return false;
                }
                liftProtocol = liftThread.getStatus();
                if (liftProtocol == null) {
                    return false;
                }
                // 判断提升机是否空闲
                if (!liftThread.isIdle()) {
                    return false;
                }
                if (liftProtocol.getLev() != Utils.getLev(motion.getTarget())) {//判断提升机是否达到目标层
                    return false;
                }
//                //判断提升机是否被锁定
//                if (!liftProtocol.getLiftLock()) {
//                    //锁定提升机
@@ -147,55 +194,15 @@
//                    liftThread.assignWork(lockCommand);
//                    return false;//等待下一次轮询
//                }
//
//                //判断提升机工作号是否和当前任务相同
//                if (liftProtocol.getTaskNo().intValue() != motion.getWrkNo()) {
//                    return false;
//                }
//
//                shuttleCommands = this.shuttleAssignCommand(motion.getOrigin(), motion.getTarget(), NavigationMapType.NORMAL.id, assignCommand, shuttleThread);
//                shuttleTaskModeType = ShuttleTaskModeType.SHUTTLE_MOVE_LOC_NO;
//                break;
//            case SHUTTLE_MOVE_TO_LIFT://进提升机
//                // 判断提升机状态
//                liftThread = (SiemensLiftThread) SlaveConnection.get(SlaveType.Lift, Integer.parseInt(motion.getTemp()));
//                if (liftThread == null) {
//                    return false;
//                }
//                liftProtocol = liftThread.getLiftProtocol();
//                // 判断提升机是否自动、空闲、准备就绪、链条没有转动、没有未就绪报错
//                if (!liftProtocol.getMode()
//                        || liftProtocol.getRunning()
//                        || !liftProtocol.getReady()
//                        || liftProtocol.getForwardRotationFeedback()
//                        || liftProtocol.getReverseFeedback()
//                        || liftProtocol.getNotReady().intValue() != 0
//                ) {
//                    return false;
//                }
//
//                if (liftProtocol.getLev().intValue() != Utils.getLev(motion.getTarget())) {//判断提升机是否达到目标层
//                    return false;
//                }
//
//                //判断提升机是否被锁定
//                if (!liftProtocol.getLiftLock()) {
//                    //锁定提升机
//                    LiftCommand lockCommand = liftThread.getLockCommand(true);//获取提升机锁定命令
//                    lockCommand.setLiftNo(liftProtocol.getLiftNo());
//                    lockCommand.setTaskNo(motion.getWrkNo().shortValue());//获取任务号
//                    liftThread.assignWork(lockCommand);
//                    return false;//等待下一次轮询
//                }
//
//                //判断提升机工作号是否和当前任务相同
//                if (liftProtocol.getTaskNo().intValue() != motion.getWrkNo()) {
//                    return false;
//                }
//
//                shuttleCommands = this.shuttleAssignCommand(motion.getOrigin(), motion.getTarget(), NavigationMapType.NORMAL.id, assignCommand, shuttleThread);
//                shuttleTaskModeType = ShuttleTaskModeType.SHUTTLE_MOVE_LOC_NO;
//                break;
                //判断提升机工作号是否和当前任务相同
                if (liftProtocol.getTaskNo().intValue() != motion.getWrkNo()) {
                    return false;
                }
                shuttleCommands = this.shuttleAssignCommand(motion.getOrigin(), motion.getTarget(), NavigationMapType.NORMAL.id, assignCommand, shuttleThread);
                shuttleTaskModeType = ShuttleTaskModeType.SHUTTLE_MOVE_LOC_NO;
                break;
//            case SHUTTLE_MOVE_FROM_CONVEYOR:
//                shuttleCommands = this.shuttleAssignCommand(motion.getOrigin(), motion.getTarget(), NavigationMapType.NORMAL.id, assignCommand, shuttleThread);
//                shuttleTaskModeType = ShuttleTaskModeType.SHUTTLE_MOVE_LOC_NO;
@@ -405,7 +412,8 @@
            return false;
        }
        if (!shuttleProtocol.getIdle()) {
        //判断设备是否空闲
        if (!shuttleThread.isIdle()) {
            return false;
        }
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/model/enums/ShuttleCommandModeType.java
@@ -9,9 +9,10 @@
    MOVE(1, "移动"),
    IN_LIFT(2, "进提升机"),
    OUT_LIFT(3, "出提升机"),
    CHARGE(4, "充电"),
    PALLET_LIFT(5, "托盘顶升"),
    PALLET_DOWN(6, "托盘下降"),
    CHARGE_OPEN(4, "充电开"),
    CHARGE_CLOSE(5, "充电关"),
    PALLET_LIFT(6, "托盘顶升"),
    PALLET_DOWN(7, "托盘下降"),
    RESET(8, "复位"),
    ;
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/ShuttleDispatcher.java
@@ -78,7 +78,7 @@
                continue;
            }
            if (!shuttleProtocol.isIdle()) {
            if (!shuttleThread.isIdle()) {
                continue;
            }
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/model/protocol/LiftProtocol.java
@@ -135,6 +135,11 @@
    private Device device;
    /**
     * 扩展字段
     */
    private Object extend;
    /**
     * 设置提升机状态
     */
    public void setProtocolStatus(Integer status) {
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/model/protocol/ShuttleProtocol.java
@@ -168,6 +168,11 @@
    private Device device;
    /**
     * 扩展字段
     */
    private Object extend;
    /**
     * 设置小车状态
     */
    public void setProtocolStatus(Integer status) {
@@ -263,25 +268,6 @@
        }
        return currentLoc.getLocNo();
    }
    // 是否处于空闲待命状态
    public Boolean isIdle() {
        if (this.deviceStatus == null
                || this.pakMk == null
                || this.errorCode == null
                || this.protocolStatus == null
        ) {
            return false;
        }
        boolean res = this.deviceStatus.equals(ShuttleDeviceStatusType.IDLE)
                && this.pakMk
                && !this.errorCode.equals("0")
                && this.getTaskNo() == 0
                && this.protocolStatus.intValue() == ShuttleProtocolStatusType.IDLE.id
                ;
        return res;
    }
}
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/LiftThread.java
@@ -20,6 +20,8 @@
    boolean reset(LiftCommand command);//复位
    boolean isIdle();//是否空闲
    //***************获取命令*****************
    LiftCommand getEmptyMoveCommand(Integer taskNo, Integer targetLev);//空载移动
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/ShuttleThread.java
@@ -23,7 +23,14 @@
    boolean reset(ShuttleCommand command);//复位开关
    boolean isIdle();//是否空闲
    //***************获取命令*****************
    ShuttleCommand getMoveCommand(Integer taskNo, String startCodeNum, String distCodeNum, Integer allDistance, Integer runDirection, Integer runSpeed);
    ShuttleCommand getMoveCommand(Integer taskNo, String startCodeNum, String distCodeNum, Integer allDistance, Integer runDirection, Integer runSpeed);//获取移动命令
    ShuttleCommand getLiftCommand(Integer taskNo, Boolean lift);//顶升命令 true=>顶升 false=>下降
    ShuttleCommand getChargeCommand(Integer taskNo, Boolean charge);//充电开关命令 true=>开 false=>关
}
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/SurayLiftThread.java
@@ -20,6 +20,7 @@
import com.zy.asrs.wcs.rcs.thread.LiftThread;
import com.zy.asrs.wcs.core.utils.RedisUtil;
import com.zy.asrs.wcs.rcs.entity.Device;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import java.text.MessageFormat;
@@ -87,6 +88,10 @@
                    liftProtocol.setLiftNo(Integer.valueOf(device.getDeviceNo()));
                    liftProtocol.setProtocolStatus(LiftProtocolStatusType.IDLE);
                    liftProtocol.setDevice(device);
                    InnerLiftExtend innerLiftExtend = new InnerLiftExtend();
                    innerLiftExtend.setLock(false);//默认未锁定
                    liftProtocol.setExtend(innerLiftExtend);
                }
                //----------读取提升机状态-----------
@@ -104,6 +109,13 @@
                liftProtocol.setErrorCode("");
                //层
                liftProtocol.setLev(data.getInteger("curFloor"));
                //************补充扩展字段*************
                InnerLiftExtend liftExtend = JSON.parseObject(JSON.toJSONString(liftProtocol.getExtend()), InnerLiftExtend.class);
                liftExtend.setLock(data.getInteger("lockStatus") == 1 ? true : false);
                liftProtocol.setExtend(liftExtend);
//                //前超限
//                liftProtocol.setFrontOverrun(status1[4]);
//                //后超限
@@ -280,6 +292,20 @@
        return false;
    }
    @Override
    public boolean isIdle() {
        InnerLiftExtend extend = (InnerLiftExtend) liftProtocol.getExtend();//获取扩展字段
        // 判断提升机是否自动、就绪、空闲、未锁定
        if (liftProtocol.getModel()
                && !liftProtocol.getRun()
                && liftProtocol.getReady()
                && !extend.getLock()
        ) {
            return true;
        }
        return false;
    }
    //***************设备层通讯-不同厂商设备通讯方案不一致***************
    //请求登录
@@ -444,4 +470,17 @@
        return command;
    }
    /**
     * 扩展字段
     */
    @Data
    private class InnerLiftExtend {
        /**
         * 提升机锁定
         */
        private Boolean lock = false;
    }
}
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/SurayShuttleThread.java
@@ -21,6 +21,7 @@
import com.zy.asrs.wcs.rcs.thread.ShuttleThread;
import com.zy.asrs.wcs.core.utils.RedisUtil;
import com.zy.asrs.wcs.rcs.entity.Device;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import java.text.MessageFormat;
@@ -87,6 +88,9 @@
                    shuttleProtocol.setShuttleNo(Integer.valueOf(device.getDeviceNo()));
                    shuttleProtocol.setProtocolStatus(ShuttleProtocolStatusType.IDLE);
                    shuttleProtocol.setDevice(device);
                    InnerSuhttleExtend extend = new InnerSuhttleExtend();
                    shuttleProtocol.setExtend(extend);
                }
                //----------读取四向穿梭车状态-----------
@@ -108,13 +112,19 @@
                //是否为充电状态
                shuttleProtocol.setHasCharge((deviceStatus == 5 || deviceStatus == 13) ? true : false);
                //*********读取扩展字段**********
                InnerSuhttleExtend extend = JSON.parseObject(JSON.toJSONString(shuttleProtocol.getExtend()), InnerSuhttleExtend.class);
                extend.setMapVersion(data.getString("version"));//地图版本
                extend.setStatusDescription(data.getString("statusDescription"));//状态描述
                shuttleProtocol.setExtend(extend);//扩展字段
                ///读取四向穿梭车状态-end
//                //小车处于忙碌状态,将标记置为true
//                if (shuttleProtocol.getDeviceStatusType() == ShuttleDeviceStatusType.BUSY) {
//                    shuttleProtocol.setPakMk(true);
//                }
//
                //小车处于忙碌状态,将标记置为true
                if (!shuttleProtocol.getIdle()) {
                    shuttleProtocol.setPakMk(true);
                }
//                if (shuttleProtocol.getProtocolStatusType() == null && shuttleProtocol.getDeviceStatus().intValue() == ShuttleDeviceStatusType.IDLE.id) {
//                    //小车空闲状态、小车任务状态为未知,认定曾离线过,需要复位成空闲
//                    shuttleProtocol.setProtocolStatusType(ShuttleProtocolStatusType.IDLE);
@@ -325,6 +335,24 @@
    }
    @Override
    public boolean isIdle() {
        if (this.shuttleProtocol.getIdle() == null
                || this.shuttleProtocol.getPakMk() == null
                || this.shuttleProtocol.getErrorCode() == null
                || this.shuttleProtocol.getProtocolStatus() == null
        ) {
            return false;
        }
        boolean res = this.shuttleProtocol.getIdle()
                && this.shuttleProtocol.getPakMk()
                && this.shuttleProtocol.getErrorCode().equals("0")
                && this.shuttleProtocol.getProtocolStatus() == ShuttleProtocolStatusType.IDLE.id
                ;
        return res;
    }
    @Override
    public ShuttleCommand getMoveCommand(Integer taskNo, String startCodeNum, String distCodeNum, Integer allDistance, Integer runDirection, Integer runSpeed) {
        HashMap<String, Object> body = new HashMap<>();
        body.put("messageName", "runOrder");
@@ -351,6 +379,37 @@
        return command;
    }
    @Override
    public ShuttleCommand getLiftCommand(Integer taskNo, Boolean lift) {
        HashMap<String, Object> body = new HashMap<>();
        body.put("messageName", "actionOrder");
        body.put("msgTime", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
        body.put("deviceNo", Integer.parseInt(this.device.getDeviceNo()));
        body.put("taskId", taskNo);
        body.put("action", lift ? 1 : 2);
        ShuttleCommand command = new ShuttleCommand();
        command.setShuttleNo(Integer.parseInt(this.device.getDeviceNo()));
        command.setBody(JSON.toJSONString(body));
        command.setMode(lift ? ShuttleCommandModeType.PALLET_LIFT.id : ShuttleCommandModeType.PALLET_DOWN.id);
        return command;
    }
    @Override
    public ShuttleCommand getChargeCommand(Integer taskNo, Boolean charge) {
        HashMap<String, Object> body = new HashMap<>();
        body.put("messageName", "runOrder");
        body.put("msgTime", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
        body.put("deviceNo", Integer.parseInt(this.device.getDeviceNo()));
        body.put("taskId", taskNo);
        body.put("action", charge ? 3 : 4);
        ShuttleCommand command = new ShuttleCommand();
        command.setShuttleNo(Integer.parseInt(this.device.getDeviceNo()));
        command.setBody(JSON.toJSONString(body));
        command.setMode(charge ? ShuttleCommandModeType.CHARGE_OPEN.id : ShuttleCommandModeType.CHARGE_CLOSE.id);
        return command;
    }
    //***************设备层通讯-不同厂商设备通讯方案不一致***************
@@ -410,4 +469,20 @@
        }
        return null;
    }
    @Data
    private class InnerSuhttleExtend {
        /**
         * 地图版本
         */
        private String mapVersion;
        /**
         * 状态描述
         */
        private String statusDescription;
    }
}