#
Junjie
2025-08-13 629959675a97b4d41c1c36eaa60ee1671c224e93
#
4个文件已修改
87 ■■■■■ 已修改文件
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/common/utils/ShuttleOperaUtils.java 23 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/thread/ShuttleThread.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/thread/impl/NyShuttleThread.java 60 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -1653,7 +1653,7 @@
            assignCommand.setAuto(true);//自动模式
            //获取小车到提升机行走命令
            List<ShuttleCommand> commands = shuttleOperaUtils.getStartToTargetCommands(shuttleProtocol.getCurrentLocNo(), liftThread.getCurrentLocNo(), NavigationMapType.getNormalWithDevice(), assignCommand, shuttleThread);
            List<ShuttleCommand> commands = shuttleOperaUtils.getStartToTargetCommands(shuttleProtocol.getCurrentLocNo(), liftThread.getCurrentLocNo(), NavigationMapType.getNormalWithDevice(), assignCommand, shuttleThread, "inLift");
            if (commands == null) {
                News.taskInfo(wrkMast.getWrkNo(), "{}任务,{}小车,路径计算失败", wrkMast.getWrkNo(), shuttleProtocol.getShuttleNo());
                return false;//路径解锁失败
src/main/java/com/zy/common/utils/ShuttleOperaUtils.java
@@ -51,10 +51,14 @@
    private DeviceConfigService deviceConfigService;
    public synchronized List<ShuttleCommand> getStartToTargetCommands(String startLocNo, String endLocNo, List<NavigationMapType> mapTypes, ShuttleAssignCommand assignCommand, ShuttleThread shuttleThread) {
        return getStartToTargetCommands(startLocNo, endLocNo, mapTypes, null, assignCommand, shuttleThread);
        return getStartToTargetCommands(startLocNo, endLocNo, mapTypes, null, assignCommand, shuttleThread, "move");
    }
    public synchronized List<ShuttleCommand> getStartToTargetCommands(String startLocNo, String endLocNo, List<NavigationMapType> mapTypes, List<int[]> whites, ShuttleAssignCommand assignCommand, ShuttleThread shuttleThread) {
    public synchronized List<ShuttleCommand> getStartToTargetCommands(String startLocNo, String endLocNo, List<NavigationMapType> mapTypes, ShuttleAssignCommand assignCommand, ShuttleThread shuttleThread, String moveType) {
        return getStartToTargetCommands(startLocNo, endLocNo, mapTypes, null, assignCommand, shuttleThread, moveType);
    }
    public synchronized List<ShuttleCommand> getStartToTargetCommands(String startLocNo, String endLocNo, List<NavigationMapType> mapTypes, List<int[]> whites, ShuttleAssignCommand assignCommand, ShuttleThread shuttleThread, String moveType) {
        ShuttleProtocol shuttleProtocol = shuttleThread.getStatus();
        if (shuttleProtocol == null) {
            return null;
@@ -77,7 +81,7 @@
            if (whites != null) {
                boolean flag = false;
                for (int[] white : whites) {
                    if(white[0] == node.getX() && white[1] == node.getY()) {
                    if (white[0] == node.getX() && white[1] == node.getY()) {
                        flag = true;
                        break;
                    }
@@ -97,7 +101,9 @@
        long endTime = System.currentTimeMillis();
        News.info("getSection path time:{}", (endTime - startTime));
        //将每一段路径分成command指令
        for (List<NavigateNode> nodes : data) {
        for (int i = 0; i < data.size(); i++) {
            List<NavigateNode> nodes = data.get(i);
            //开始路径
            NavigateNode startPath = nodes.get(0);
@@ -110,6 +116,15 @@
            String distCodeNum = NavigatePositionConvert.xyToPosition(endPath.getX(), endPath.getY(), endPath.getZ());
            //获取移动命令
            ShuttleCommand command = shuttleThread.getMoveCommand(assignCommand.getDeviceTaskNo(), startCodeNum, distCodeNum, allDistance, ShuttleRunDirection.get(startPath.getDirection()).id.intValue(), runSpeed, nodes);
            if (i + 1 == data.size()) {
                if (moveType.equals("inLift")) {
                    command = shuttleThread.getMoveLiftCommand(assignCommand.getDeviceTaskNo(), startCodeNum, distCodeNum, allDistance, ShuttleRunDirection.get(startPath.getDirection()).id.intValue(), runSpeed, nodes, true);
                }else if (moveType.equals("outLift")) {
                    command = shuttleThread.getMoveLiftCommand(assignCommand.getDeviceTaskNo(), startCodeNum, distCodeNum, allDistance, ShuttleRunDirection.get(startPath.getDirection()).id.intValue(), runSpeed, nodes, false);
                }
            }
            command.setNodes(nodes);//将行走节点添加到每一步命令中
            commands.add(command);
        }
src/main/java/com/zy/core/thread/ShuttleThread.java
@@ -82,6 +82,8 @@
    ShuttleCommand getMoveCommand(Integer taskNo, String startCodeNum, String distCodeNum, Integer allDistance, Integer runDirection, Integer runSpeed, List<NavigateNode> nodes);//获取移动命令
    ShuttleCommand getMoveLiftCommand(Integer taskNo, String startCodeNum, String distCodeNum, Integer allDistance, Integer runDirection, Integer runSpeed, List<NavigateNode> nodes, Boolean moveIn);//获取移动命令
    ShuttleCommand getLiftCommand(Integer taskNo, Boolean lift);//顶升命令 true=>顶升 false=>下降
    ShuttleCommand getChargeCommand(Integer taskNo, Boolean charge);//充电开关命令 true=>开 false=>关
src/main/java/com/zy/core/thread/impl/NyShuttleThread.java
@@ -977,8 +977,64 @@
        HashMap<String, Object> body = new HashMap<>();
        body.put("requestType", "move");//移动命令
        body.put("taskId", taskId);//TaskID需要随机
//        body.put("start", navigateNodeToNyPointNode(NavigatePositionConvert.codeToNode(startCodeNum, device.getHostId())));//起点
//        body.put("target", navigateNodeToNyPointNode(NavigatePositionConvert.codeToNode(distCodeNum, device.getHostId())));//终点
        body.put("path", path);
        request.setBody(body);
        NavigateNode startNode = nodes.get(0);
        for (NavigateNode node : nodes) {
            HashMap<String, Object> data = new HashMap<>();
            String codeNum = NavigatePositionConvert.xyToPosition(node.getX(), node.getY(), node.getZ());
            Map<String, Object> nyNode = navigateNodeToNyPointNode(NavigatePositionConvert.codeToNode(codeNum));
            int xp = Integer.parseInt(String.valueOf(nyNode.get("y")));
            int yp = Integer.parseInt(String.valueOf(nyNode.get("x")));
            int z = Integer.parseInt(String.valueOf(nyNode.get("z")));
            List<List<MapNode>> mapData = navigateMapData.getJsonData(startNode.getZ(), NavigationMapType.getMapTypes(NavigationMapType.NONE), null, null);
            List<MapNode> mapNodes = mapData.get(node.getX());
            MapNode mapNode = mapNodes.get(node.getY());
            data.put("xp", xp);
            data.put("yp", yp);
            data.put("z", z);
            data.put("x", mapNode.getXBase());
            data.put("y", mapNode.getYBase());
            path.add(data);
        }
        httpStandard.setRequest(request);
        LocMastService locMastService = SpringUtils.getBean(LocMastService.class);
        LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>()
                .eq("qr_code_value", distCodeNum));
        if (locMast == null) {
            throw new CoolException("库位信息不存在");
        }
        ShuttleCommand command = new ShuttleCommand();
        command.setShuttleNo(deviceConfig.getDeviceNo());
        command.setBody(JSON.toJSONString(httpStandard));
        command.setMode(ShuttleCommandModeType.MOVE.id);
        command.setTargetLocNo(locMast.getLocNo());
        command.setTaskNo(taskId);
        return command;
    }
    @Override
    public ShuttleCommand getMoveLiftCommand(Integer taskNo, String startCodeNum, String distCodeNum, Integer allDistance, Integer runDirection, Integer runSpeed, List<NavigateNode> nodes, Boolean moveIn) {
        NavigateMapData navigateMapData = SpringUtils.getBean(NavigateMapData.class);
        NyShuttleHttpCommand httpStandard = getHttpStandard(deviceConfig.getDeviceNo(), taskNo);
        NyShuttleHttpCommand.NyRequest request = httpStandard.getRequest();
        ArrayList<HashMap<String, Object>> path = new ArrayList<>();
        Integer taskId = getTaskId();
        HashMap<String, Object> body = new HashMap<>();
        if (moveIn) {
            body.put("requestType", "intoLift");//进提升机
        }else {
            body.put("requestType", "outLift");//出提升机
        }
        body.put("taskId", taskId);//TaskID需要随机
        body.put("path", path);
        request.setBody(body);