#
Junjie
2024-10-15 f43b508dda7334487a1640b0bbd908d7b3aa3cb6
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/action/ShuttleAction.java
@@ -133,12 +133,14 @@
        int commandStep = redisCommand.getCommandStep();
        // 完结上一条命令
        boolean updateCommand = false;
        if (commandStep != 0) {
            ShuttleCommand command = commands.get(commandStep - 1);
            if (command.getMode() == ShuttleCommandModeType.MOVE.id) {
                // 正常移动
                if (command.getTargetLocNo().equals(shuttleProtocol.getCurrentLocNo())) {
                    command.setComplete(true);
                    updateCommand = true;
                    //解锁锁定路径,上一条路径
                    List<NavigateNode> nodes = null;
                    try {
@@ -166,6 +168,7 @@
                //判断是否顶升到位
                if (shuttleProtocol.getHasLift()) {
                    command.setComplete(true);
                    updateCommand = true;
//                    //判断是否有物
//                    if (shuttleProtocol.getHasPallet()) {
//                        command.setComplete(true);
@@ -176,19 +179,24 @@
                // 判断是否下降到位
                if (!shuttleProtocol.getHasLift()) {
                    command.setComplete(true);
                    updateCommand = true;
                }
            } else if (command.getMode() == ShuttleCommandModeType.CHARGE_OPEN.id) {
                // 充电开
                //判断小车充电状态
                if (shuttleProtocol.getHasCharge()) {
                    command.setComplete(true);
                    updateCommand = true;
                }
            }else {
                command.setComplete(true);//其他命令默认认为完成
                updateCommand = true;
            }
            // 更新redis数据
            redisUtil.set(DeviceRedisConstant.SHUTTLE_WORK_FLAG + redisCommand.getTaskNo(), JSON.toJSONString(redisCommand, SerializerFeature.DisableCircularReferenceDetect));
            if(updateCommand) {
                // 更新redis数据
                redisUtil.set(DeviceRedisConstant.SHUTTLE_WORK_FLAG + redisCommand.getTaskNo(), JSON.toJSONString(redisCommand, SerializerFeature.DisableCircularReferenceDetect));
            }
            if (!command.getComplete()) {
                return false;
@@ -323,8 +331,10 @@
                    shuttleDispatcher.generateMoveTask(device, start.getLocNo());
                }else {
                    //在起点位置,调度去目标位置
                    shuttleDispatcher.generateMoveTask(device, target.getLocNo());
                    shuttleProtocol.setYCurrent(shuttleProtocol.getYCurrent() + 1);//切换y轴
                    Task task = shuttleDispatcher.generateMoveTask(device, target.getLocNo());
                    if (task != null) {
                        shuttleProtocol.setYCurrent(shuttleProtocol.getYCurrent() + 1);//切换y轴
                    }
                    if(shuttleProtocol.getYCurrent() > shuttleProtocol.getYTarget()) {
                        //y轴也跑完了,结束跑库
@@ -362,8 +372,10 @@
                    shuttleDispatcher.generateMoveTask(device, start.getLocNo());
                }else {
                    //在起点位置,调度去目标位置
                    shuttleDispatcher.generateMoveTask(device, target.getLocNo());
                    shuttleProtocol.setXCurrent(shuttleProtocol.getXCurrent() + 1);//切换x轴
                    Task task = shuttleDispatcher.generateMoveTask(device, target.getLocNo());
                    if (task != null) {
                        shuttleProtocol.setXCurrent(shuttleProtocol.getXCurrent() + 1);//切换x轴
                    }
                    if(shuttleProtocol.getXCurrent() > shuttleProtocol.getXTarget()) {
                        //y轴也跑完了,结束跑库
@@ -486,6 +498,7 @@
                            return;
                        }
                    }
                    return;
                }
                //调度去库位
@@ -641,7 +654,11 @@
            result = shuttleThread.charge(command);
        } else if (command.getMode() == ShuttleCommandModeType.RESET.id) {//复位
            result = shuttleThread.reset(command);
        } else if (command.getMode() == ShuttleCommandModeType.UPDATE_LOCATION.id) {//更新坐标
            result = shuttleThread.updateLocation(command);
        }
        News.info("四向穿梭车命令下发,穿梭车号={},任务数据={}", device.getDeviceNo(), JSON.toJSON(command));
        return result;
    }