#
Junjie
2024-04-16 25c69020ee46b88cda22f56631c4fdb149d211cd
#
6个文件已修改
53 ■■■■■ 已修改文件
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/action/ShuttleAction.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/command/ShuttleCommandService.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/model/command/ShuttleAssignCommand.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/model/command/ShuttleRedisCommand.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/ShuttleThread.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/SurayShuttleThread.java 30 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/action/ShuttleAction.java
@@ -63,7 +63,7 @@
        ShuttleRedisCommand redisCommand = new ShuttleRedisCommand();
        redisCommand.setShuttleNo(assignCommand.getShuttleNo());//四向穿梭车号
        redisCommand.setWrkNo(assignCommand.getTaskNo());//工作号
        redisCommand.setTaskNo(assignCommand.getTaskNo());//工作号
        redisCommand.setCommandStep(0);//命令执行步序
        redisCommand.setAssignCommand(assignCommand);//命令
        //任务数据保存到redis
@@ -73,7 +73,7 @@
                    || assignCommand.getTaskMode() == ShuttleTaskModeType.MOVE_LOC_NO.id
                    || assignCommand.getTaskMode() == ShuttleTaskModeType.SHUTTLE_MOVE_LOC_NO.id) {
                //下发行驶路径
                boolean result = shuttleThread.movePath(assignCommand.getNodes(), assignCommand.getTaskNo());
                boolean result = shuttleThread.movePath(assignCommand.getNodes(), assignCommand.getDeviceTaskNo());
                if (!result) {
                    return false;
                }
@@ -182,7 +182,7 @@
            }
            // 更新redis数据
            redisUtil.set(DeviceRedisConstant.SHUTTLE_WORK_FLAG + redisCommand.getWrkNo(), JSON.toJSONString(redisCommand));
            redisUtil.set(DeviceRedisConstant.SHUTTLE_WORK_FLAG + redisCommand.getTaskNo(), JSON.toJSONString(redisCommand));
            if (!command.getComplete()) {
                return false;
@@ -215,7 +215,7 @@
                }
                //删除redis
                redisUtil.del(DeviceRedisConstant.SHUTTLE_WORK_FLAG + redisCommand.getWrkNo());
                redisUtil.del(DeviceRedisConstant.SHUTTLE_WORK_FLAG + redisCommand.getTaskNo());
                return false;//禁止再下发命令
            }
        }
@@ -234,7 +234,7 @@
        //更新redis数据
        redisCommand.setCommandStep(commandStep);
        //任务数据保存到redis
        redisUtil.set(DeviceRedisConstant.SHUTTLE_WORK_FLAG + redisCommand.getWrkNo(), JSON.toJSONString(redisCommand));
        redisUtil.set(DeviceRedisConstant.SHUTTLE_WORK_FLAG + redisCommand.getTaskNo(), JSON.toJSONString(redisCommand));
        return true;
    }
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/command/ShuttleCommandService.java
@@ -82,6 +82,7 @@
        ShuttleAssignCommand assignCommand = new ShuttleAssignCommand();
        assignCommand.setShuttleNo(deviceNo);
        assignCommand.setTaskNo(motion.getTaskNo());
        assignCommand.setDeviceTaskNo(shuttleThread.generateDeviceTaskNo(motion.getTaskNo(), MotionCtgType.get(motion.getMotionCtgEl())));
        assignCommand.setSourceLocNo(motion.getOrigin());
        assignCommand.setLocNo(motion.getTarget());
        assignCommand.setDeviceId(Integer.parseInt(motion.getDevice()));
@@ -361,7 +362,7 @@
            //通过xy坐标小车二维码
            String distCodeNum = NavigatePositionConvert.xyToPosition(endPath.getX(), endPath.getY(), endPath.getZ(), hostId);
            //获取移动命令
            ShuttleCommand command = shuttleThread.getMoveCommand(assignCommand.getTaskNo(), startCodeNum, distCodeNum, allDistance, ShuttleRunDirection.get(startPath.getDirection()).id.intValue(), runSpeed);
            ShuttleCommand command = shuttleThread.getMoveCommand(assignCommand.getDeviceTaskNo(), startCodeNum, distCodeNum, allDistance, ShuttleRunDirection.get(startPath.getDirection()).id.intValue(), runSpeed);
            command.setNodes(nodes);//将行走节点添加到每一步命令中
            commands.add(command);
        }
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/model/command/ShuttleAssignCommand.java
@@ -28,6 +28,11 @@
    private Integer taskNo = 0;
    /**
     * 设备工作号
     */
    private Integer deviceTaskNo = 0;
    /**
     * 作业类型
     * 1:  入库
     * 2: 出库
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/model/command/ShuttleRedisCommand.java
@@ -16,7 +16,7 @@
    private Integer shuttleNo;
    //工作号
    private Integer wrkNo;
    private Integer taskNo;
    //命令执行步序
    private Integer commandStep;
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/ShuttleThread.java
@@ -3,6 +3,7 @@
import com.zy.asrs.wcs.common.ExecuteSupport;
import com.zy.asrs.wcs.core.model.NavigateNode;
import com.zy.asrs.wcs.core.model.command.ShuttleCommand;
import com.zy.asrs.wcs.core.model.enums.MotionCtgType;
import com.zy.asrs.wcs.rcs.entity.Device;
import com.zy.asrs.wcs.rcs.model.enums.ShuttleProtocolStatusType;
import com.zy.asrs.wcs.rcs.model.protocol.ShuttleProtocol;
@@ -39,7 +40,7 @@
    List<NavigateNode> getMoveAdvancePath();//获取穿梭车任务路径
    int generateDeviceTaskNo(int taskNo);//生成硬件设备工作号
    int generateDeviceTaskNo(int taskNo, MotionCtgType motionCtgType);//生成硬件设备工作号
    boolean setProtocolStatus(ShuttleProtocolStatusType status);//设置工作状态
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/SurayShuttleThread.java
@@ -15,11 +15,11 @@
import com.zy.asrs.wcs.core.model.NavigateNode;
import com.zy.asrs.wcs.core.model.command.ShuttleCommand;
import com.zy.asrs.wcs.core.model.command.ShuttleRedisCommand;
import com.zy.asrs.wcs.core.model.enums.ShuttleCommandModeType;
import com.zy.asrs.wcs.core.model.enums.ShuttleRunDirection;
import com.zy.asrs.wcs.core.model.enums.*;
import com.zy.asrs.wcs.core.service.BasShuttleService;
import com.zy.asrs.wcs.core.service.LocService;
import com.zy.asrs.wcs.core.utils.NavigateUtils;
import com.zy.asrs.wcs.core.utils.Utils;
import com.zy.asrs.wcs.rcs.News;
import com.zy.asrs.wcs.rcs.cache.OutputQueue;
import com.zy.asrs.wcs.rcs.constant.DeviceRedisConstant;
@@ -274,7 +274,7 @@
            param.put("messageName", "runRoute");
            param.put("msgTime", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
            param.put("deviceNo", device.getDeviceNo());
            param.put("taskId", generateDeviceTaskNo(taskNo));
            param.put("taskId", taskNo);
            param.put("nodeNum", nodes.size());
            param.put("modes", modes);
            String response = new HttpHandler.Builder()
@@ -527,12 +527,24 @@
    }
    @Override
    public int generateDeviceTaskNo(int taskNo) {
        int no = taskNo % 255;
        if (no <= 1) {
            no = 2;
    public int generateDeviceTaskNo(int taskNo, MotionCtgType motionCtgType) {
        int deviceTaskNo = taskNo;
        try {
            deviceTaskNo = Utils.getTaskNo("SURAY_SHUTTLE");
        } catch (Exception e) {
            return taskNo;
        }
        return no;
        switch (Objects.requireNonNull(MotionCtgType.get(String.valueOf(motionCtgType)))){
            case SHUTTLE_MOVE://穿梭车移动
            case SHUTTLE_MOVE_LIFT_PALLET://穿梭车顶升并移动
            case SHUTTLE_MOVE_DOWN_PALLET://穿梭车移动并托盘下降
            case SHUTTLE_MOVE_FROM_LIFT://出提升机
            case SHUTTLE_MOVE_TO_LIFT://进提升机
                return deviceTaskNo;
            default:
                return taskNo;
        }
    }
    @Override
@@ -559,7 +571,7 @@
        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", generateDeviceTaskNo(taskNo));
        body.put("taskId", taskNo);
        LocService locService = SpringUtils.getBean(LocService.class);
        Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>()