Junjie
2024-12-10 0dab5a05ed6e734a83c43f8e6e5ef1b07115f48d
#path similarity
9个文件已修改
1个文件已添加
238 ■■■■■ 已修改文件
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/domain/dto/MotionDto.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/entity/Motion.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/AnalyzeService.java 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/KernelService.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/command/ShuttleCommandService.java 75 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/model/PythonSimilarityResult.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/model/enums/NavigationMapType.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/NavigateMapData.java 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/NavigateUtils.java 59 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/src/main/resources/application.yml 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/domain/dto/MotionDto.java
@@ -1,6 +1,7 @@
package com.zy.asrs.wcs.core.domain.dto;
import com.zy.asrs.wcs.core.BuildSupport;
import com.zy.asrs.wcs.rcs.entity.Device;
import lombok.Data;
/**
@@ -38,6 +39,8 @@
    //执行完成后是否释放穿梭车,默认不释放  1: 释放  0: 不释放
    private Integer releaseShuttle;
    private Device shuttleDevice;
    public static MotionDto build(BuildSupport<MotionDto> support) {
        MotionDto dto = new MotionDto();
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/entity/Motion.java
@@ -237,6 +237,12 @@
    @ApiModelProperty(value= "所属机构")
    private Long hostId;
    /**
     * 移动路径
     */
    @ApiModelProperty(value= "移动路径")
    private String movePath;
    public Motion() {}
    public Motion(String uuid,Integer taskNo,String serialNo,String title,Integer priority,Integer sync,Long motionCtg,Long motionSts,Long deviceCtg,String device,String origin,Integer oriDrt,String target,Integer tarDrt,String dockNo,Date ioTime,Date startTime,Date endTime,Date errTime,Long errCode,String errDesc,String temp,Integer status,Long createBy,Date createTime,Long updateBy,Date updateTime,String memo,Integer deleted,Long hostId) {
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/AnalyzeService.java
@@ -182,6 +182,7 @@
                        })),
                        MotionDto.build((dto -> {
                            dto.setShuttleNo(shuttleDevice.getId().intValue());
                            dto.setShuttleDevice(shuttleDevice);
                            dto.setLocNo(standbyLocNoTo);
                        })),
                        MotionCtgType.SHUTTLE_MOVE
@@ -204,6 +205,7 @@
                        })),
                        MotionDto.build((dto -> {
                            dto.setShuttleNo(shuttleDevice.getId().intValue());
                            dto.setShuttleDevice(shuttleDevice);
                            dto.setLiftNo(transferLiftDevice.getId().intValue());
                            dto.setLocNo(destLoc);
//                            dto.setReleaseLift(2);//执行中释放提升机
@@ -249,6 +251,7 @@
                        })),
                        MotionDto.build((dto -> {
                            dto.setShuttleNo(shuttleDevice.getId().intValue());
                            dto.setShuttleDevice(shuttleDevice);
                            dto.setLiftNo(transferLiftDevice.getId().intValue());
                            dto.setLocNo(standbyLocNoTo);
                        })),
@@ -289,6 +292,7 @@
                        })),
                        MotionDto.build((dto -> {
                            dto.setShuttleNo(shuttleDevice.getId().intValue());
                            dto.setShuttleDevice(shuttleDevice);
                            dto.setLiftNo(transferLiftDevice.getId().intValue());
                            dto.setLocNo(liftLocNoTo);
                        })),
@@ -341,6 +345,7 @@
                        })),
                        MotionDto.build((dto -> {
                            dto.setShuttleNo(shuttleDevice.getId().intValue());
                            dto.setShuttleDevice(shuttleDevice);
                            dto.setLocNo(standbyLocNoFrom);
                        })),
                        MotionCtgType.SHUTTLE_MOVE_FROM_LIFT
@@ -381,6 +386,7 @@
                        })),
                        MotionDto.build((dto -> {
                            dto.setShuttleNo(shuttleDevice.getId().intValue());
                            dto.setShuttleDevice(shuttleDevice);
                            dto.setLiftNo(transferLiftDevice.getId().intValue());
                            dto.setLocNo(destLoc);
                        })),
@@ -521,6 +527,7 @@
                            })),
                            MotionDto.build((dto -> {
                                dto.setShuttleNo(shuttleDevice.getId().intValue());
                                dto.setShuttleDevice(shuttleDevice);
                                dto.setLocNo(originLoc);
                            })),
                            MotionCtgType.SHUTTLE_MOVE
@@ -545,6 +552,7 @@
                            })),
                            MotionDto.build((dto -> {
                                dto.setShuttleNo(shuttleDevice.getId().intValue());
                                dto.setShuttleDevice(shuttleDevice);
                                dto.setLocNo(lastPathStartLoc);
                            })),
                            MotionCtgType.SHUTTLE_TRANSPORT
@@ -559,6 +567,7 @@
                        })),
                        MotionDto.build((dto -> {
                            dto.setShuttleNo(shuttleDevice.getId().intValue());
                            dto.setShuttleDevice(shuttleDevice);
                            dto.setLiftNo(transferLiftDevice.getId().intValue());
                            dto.setLocNo(standbyLocNoTo);
                            dto.setStaNo(getStaByLev(Utils.getLev(task.getOriginLoc())));//输送站
@@ -583,6 +592,7 @@
                        })),
                        MotionDto.build((dto -> {
                            dto.setShuttleNo(shuttleDevice.getId().intValue());
                            dto.setShuttleDevice(shuttleDevice);
                            dto.setLocNo(standbyLocs);
                            dto.setSync(0);//异步执行
                            dto.setReleaseShuttle(1);//执行完成后释放小车
@@ -632,6 +642,7 @@
                        })),
                        MotionDto.build((dto -> {
                            dto.setShuttleNo(shuttleDevice.getId().intValue());
                            dto.setShuttleDevice(shuttleDevice);
                            dto.setLiftNo(transferLiftDevice.getId().intValue());
                            dto.setLocNo(standbyLocNoTo);
                        })),
@@ -672,6 +683,7 @@
                        })),
                        MotionDto.build((dto -> {
                            dto.setShuttleNo(shuttleDevice.getId().intValue());
                            dto.setShuttleDevice(shuttleDevice);
                            dto.setLiftNo(transferLiftDevice.getId().intValue());
                            dto.setLocNo(liftLocNoTo);
                        })),
@@ -724,6 +736,7 @@
                        })),
                        MotionDto.build((dto -> {
                            dto.setShuttleNo(shuttleDevice.getId().intValue());
                            dto.setShuttleDevice(shuttleDevice);
                            dto.setLocNo(standbyLocNoFrom);
                        })),
                        MotionCtgType.SHUTTLE_MOVE_FROM_LIFT
@@ -756,6 +769,7 @@
                        })),
                        MotionDto.build((dto -> {
                            dto.setShuttleNo(shuttleDevice.getId().intValue());
                            dto.setShuttleDevice(shuttleDevice);
                            dto.setLocNo(originLoc);
                        })),
                        MotionCtgType.SHUTTLE_MOVE
@@ -779,6 +793,7 @@
                            })),
                            MotionDto.build((dto -> {
                                dto.setShuttleNo(shuttleDevice.getId().intValue());
                                dto.setShuttleDevice(shuttleDevice);
                                dto.setLocNo(lastPathStartLoc);
                            })),
                            MotionCtgType.SHUTTLE_TRANSPORT
@@ -793,6 +808,7 @@
                        })),
                        MotionDto.build((dto -> {
                            dto.setShuttleNo(shuttleDevice.getId().intValue());
                            dto.setShuttleDevice(shuttleDevice);
                            dto.setLiftNo(transferLiftDevice.getId().intValue());
                            dto.setLocNo(standbyLocNoFrom);
                            dto.setStaNo(getStaByLev(Utils.getLev(task.getOriginLoc())));//输送站
@@ -817,6 +833,7 @@
                        })),
                        MotionDto.build((dto -> {
                            dto.setShuttleNo(shuttleDevice.getId().intValue());
                            dto.setShuttleDevice(shuttleDevice);
                            dto.setLocNo(standbyLocs);
                            dto.setSync(0);//异步执行
                            dto.setReleaseShuttle(1);//执行完成后释放小车
@@ -950,6 +967,7 @@
                    })),
                    MotionDto.build((dto -> {
                        dto.setShuttleNo(shuttleDevice.getId().intValue());
                        dto.setShuttleDevice(shuttleDevice);
                        dto.setLocNo(chargeLocNo);
                    })),
                    MotionCtgType.SHUTTLE_MOVE
@@ -965,6 +983,7 @@
                    })),
                    MotionDto.build((dto -> {
                        dto.setShuttleNo(shuttleDevice.getId().intValue());
                        dto.setShuttleDevice(shuttleDevice);
                        dto.setLocNo(standbyLocNoTo);
                    })),
                    MotionCtgType.SHUTTLE_MOVE
@@ -995,6 +1014,7 @@
                    })),
                    MotionDto.build((dto -> {
                        dto.setShuttleNo(shuttleDevice.getId().intValue());
                        dto.setShuttleDevice(shuttleDevice);
                        dto.setLiftNo(transferLiftDevice.getId().intValue());
                        dto.setLocNo(liftLocNoTo);
                    })),
@@ -1047,6 +1067,7 @@
                    })),
                    MotionDto.build((dto -> {
                        dto.setShuttleNo(shuttleDevice.getId().intValue());
                        dto.setShuttleDevice(shuttleDevice);
                        dto.setLocNo(standbyLocNoFrom);
                    })),
                    MotionCtgType.SHUTTLE_MOVE_FROM_LIFT
@@ -1068,6 +1089,7 @@
                    })),
                    MotionDto.build((dto -> {
                        dto.setShuttleNo(shuttleDevice.getId().intValue());
                        dto.setShuttleDevice(shuttleDevice);
                        dto.setLocNo(chargeLocNo);
                    })),
                    MotionCtgType.SHUTTLE_MOVE
@@ -1136,6 +1158,7 @@
                    })),
                    MotionDto.build((dto -> {
                        dto.setShuttleNo(shuttleDevice.getId().intValue());
                        dto.setShuttleDevice(shuttleDevice);
                        dto.setLocNo(locNo);
                    })),
                    MotionCtgType.SHUTTLE_MOVE
@@ -1190,6 +1213,7 @@
                        })),
                        MotionDto.build((dto -> {
                            dto.setShuttleNo(shuttleDevice.getId().intValue());
                            dto.setShuttleDevice(shuttleDevice);
                            dto.setLocNo(locNo);
                        })),
                        MotionCtgType.SHUTTLE_MOVE
@@ -1230,6 +1254,7 @@
                    })),
                    MotionDto.build((dto -> {
                        dto.setShuttleNo(shuttleDevice.getId().intValue());
                        dto.setShuttleDevice(shuttleDevice);
                        dto.setLiftNo(liftDevice.getId().intValue());
                        dto.setLocNo(standbyLocNoTo);
                    })),
@@ -1270,6 +1295,7 @@
                    })),
                    MotionDto.build((dto -> {
                        dto.setShuttleNo(shuttleDevice.getId().intValue());
                        dto.setShuttleDevice(shuttleDevice);
                        dto.setLiftNo(liftDevice.getId().intValue());
                        dto.setLocNo(liftLocNoTo);
                    })),
@@ -1322,6 +1348,7 @@
                    })),
                    MotionDto.build((dto -> {
                        dto.setShuttleNo(shuttleDevice.getId().intValue());
                        dto.setShuttleDevice(shuttleDevice);
                        dto.setLocNo(standbyLocNoFrom);
                    })),
                    MotionCtgType.SHUTTLE_MOVE_FROM_LIFT
@@ -1353,6 +1380,7 @@
                    })),
                    MotionDto.build((dto -> {
                        dto.setShuttleNo(shuttleDevice.getId().intValue());
                        dto.setShuttleDevice(shuttleDevice);
                        dto.setLocNo(locNo);
                    })),
                    MotionCtgType.SHUTTLE_MOVE
@@ -1408,6 +1436,7 @@
                        })),
                        MotionDto.build((dto -> {
                            dto.setShuttleNo(device.getId().intValue());
                            dto.setShuttleDevice(device);
                            dto.setLocNo(targetLoc);
                        })),
                        MotionCtgType.SHUTTLE_MOVE
@@ -1460,6 +1489,7 @@
                            })),
                            MotionDto.build((dto -> {
                                dto.setShuttleNo(device.getId().intValue());
                                dto.setShuttleDevice(device);
                                dto.setLocNo(sourceLoc);
                            })),
                            MotionCtgType.SHUTTLE_MOVE
@@ -1481,6 +1511,7 @@
                        })),
                        MotionDto.build((dto -> {
                            dto.setShuttleNo(device.getId().intValue());
                            dto.setShuttleDevice(device);
                            dto.setLocNo(targetLoc);
                        })),
                        MotionCtgType.SHUTTLE_TRANSPORT
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/KernelService.java
@@ -1,11 +1,21 @@
package com.zy.asrs.wcs.core.kernel;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.zy.asrs.framework.exception.CoolException;
import com.zy.asrs.wcs.core.domain.dto.MotionDto;
import com.zy.asrs.wcs.core.model.NavigateNode;
import com.zy.asrs.wcs.core.model.enums.DeviceCtgType;
import com.zy.asrs.wcs.core.model.enums.MotionCtgType;
import com.zy.asrs.wcs.core.entity.Motion;
import com.zy.asrs.wcs.core.model.enums.NavigationMapType;
import com.zy.asrs.wcs.core.service.MotionService;
import com.zy.asrs.wcs.core.utils.LiftDispatcher;
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.entity.Device;
import com.zy.asrs.wcs.rcs.service.DeviceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -22,6 +32,10 @@
    private MotionService motionService;
    @Autowired
    private LiftDispatcher liftDispatcher;
    @Autowired
    private NavigateUtils navigateUtils;
    @Autowired
    private DeviceService deviceService;
    // agv -----------------------------------------------------------------------------
    @Deprecated
@@ -321,6 +335,12 @@
                motion.setReleaseLift(target.getReleaseLift());
            }
            List<NavigateNode> nodeList = navigateUtils.calc(motion.getOrigin(), motion.getTarget(), NavigationMapType.NONE_LOCK.id, Utils.getShuttlePoints(Integer.parseInt(target.getShuttleDevice().getDeviceNo()), Utils.getLev(motion.getTarget())));
            if (nodeList == null) {
                throw new CoolException(motion.getOrigin() + " dash " + motion.getTarget() + " can't find navigate path!");
            }
            motion.setMovePath(JSON.toJSONString(nodeList));
        }));
        return motionList;
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/command/ShuttleCommandService.java
@@ -3,6 +3,7 @@
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.zy.asrs.framework.common.Cools;
import com.zy.asrs.framework.common.SpringUtils;
import com.zy.asrs.framework.exception.CoolException;
import com.zy.asrs.wcs.common.ExecuteSupport;
import com.zy.asrs.wcs.core.action.LiftAction;
@@ -24,6 +25,8 @@
import com.zy.asrs.wcs.rcs.thread.DevpThread;
import com.zy.asrs.wcs.rcs.thread.LiftThread;
import com.zy.asrs.wcs.rcs.thread.ShuttleThread;
import com.zy.asrs.wcs.system.entity.Dict;
import com.zy.asrs.wcs.system.service.DictService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -65,6 +68,8 @@
    private ShuttleDispatcher shuttleDispatcher;
    @Autowired
    private NavigateUtils navigateUtils;
    @Autowired
    private DictService dictService;
    // 计算
    public Boolean accept(Motion motion) {
@@ -104,6 +109,14 @@
            return false;
        }
        Double similarityRef = 0.9D;
        Dict similarityRefDict = dictService.getOne(new LambdaQueryWrapper<Dict>()
                .eq(Dict::getFlag, "similarityRef")
                .eq(Dict::getStatus, 1));
        if (similarityRefDict != null) {
            similarityRef = Double.parseDouble(similarityRefDict.getValue());
        }
        ShuttleAssignCommand assignCommand = new ShuttleAssignCommand();
        assignCommand.setShuttleNo(deviceNo);
        assignCommand.setTaskNo(motion.getTaskNo());
@@ -117,6 +130,10 @@
        LiftThread liftThread = null;
        LiftProtocol liftProtocol = null;
        String movePath = null;
        List<NavigateNode> originPath = null;
        List<NavigateNode> finalPath = null;
        Double similarity = null;
        switch (Objects.requireNonNull(MotionCtgType.get(motion.getMotionCtgEl()))){
            case SHUTTLE_MOVE:
@@ -128,6 +145,16 @@
                }
                shuttleCommands = this.shuttleAssignCommand(motion.getOrigin(), motion.getTarget(), NavigationMapType.NORMAL.id, assignCommand, shuttleThread);
                shuttleTaskModeType = ShuttleTaskModeType.SHUTTLE_MOVE;
                movePath = motion.getMovePath();
                originPath = JSON.parseArray(movePath, NavigateNode.class);
                finalPath = assignCommand.getNodes();
                similarity = navigateUtils.similarityPath(originPath, finalPath);
                if(similarity <= similarityRef) {
                    News.error("{} dash {} path similarity mismatch!", motion.getOrigin(), motion.getTarget());
                    return false;
                }
                break;
            case SHUTTLE_TRANSPORT://穿梭车载货行走
                // 如果已经在当前条码则过滤
@@ -138,6 +165,15 @@
                }
                shuttleCommands = this.shuttleAssignCommand(motion.getOrigin(), motion.getTarget(), NavigationMapType.DFX.id, assignCommand, shuttleThread);
                shuttleTaskModeType = ShuttleTaskModeType.TRANSPORT;
                movePath = motion.getMovePath();
                originPath = JSON.parseArray(movePath, NavigateNode.class);
                finalPath = assignCommand.getNodes();
                similarity = navigateUtils.similarityPath(originPath, finalPath);
                if(similarity <= similarityRef) {
                    News.error("{} dash {} path similarity mismatch!", motion.getOrigin(), motion.getTarget());
                    return false;
                }
                if (motion.getReleaseLift() == 2) {//执行中释放提升机
                    task.setLiftNo(0);
@@ -179,15 +215,45 @@
                }
                shuttleCommands = this.shuttleAssignCommand(motion.getOrigin(), motion.getTarget(), NavigationMapType.DFX.id, assignCommand, shuttleThread);
                shuttleTaskModeType = ShuttleTaskModeType.TRANSPORT_TO_CONVEYOR;
                movePath = motion.getMovePath();
                originPath = JSON.parseArray(movePath, NavigateNode.class);
                finalPath = assignCommand.getNodes();
                similarity = navigateUtils.similarityPath(originPath, finalPath);
                if(similarity <= similarityRef) {
                    News.error("{} dash {} path similarity mismatch!", motion.getOrigin(), motion.getTarget());
                    return false;
                }
                break;
            case SHUTTLE_MOVE_LIFT_PALLET://穿梭车顶升并移动
                shuttleCommands = this.shuttleAssignCommand(motion.getOrigin(), motion.getTarget(), NavigationMapType.DFX.id, assignCommand, shuttleThread);
                shuttleTaskModeType = ShuttleTaskModeType.MOVE_PALLET_LIFT;
                movePath = motion.getMovePath();
                originPath = JSON.parseArray(movePath, NavigateNode.class);
                finalPath = assignCommand.getNodes();
                similarity = navigateUtils.similarityPath(originPath, finalPath);
                if(similarity <= similarityRef) {
                    News.error("{} dash {} path similarity mismatch!", motion.getOrigin(), motion.getTarget());
                    return false;
                }
                shuttleCommands.add(0, shuttleThread.getLiftCommand(motion.getTaskNo(), true));
                break;
            case SHUTTLE_MOVE_DOWN_PALLET://穿梭车移动并托盘下降
                shuttleCommands = this.shuttleAssignCommand(motion.getOrigin(), motion.getTarget(), NavigationMapType.DFX.id, assignCommand, shuttleThread);
                shuttleTaskModeType = ShuttleTaskModeType.MOVE_PALLET_DOWN;
                movePath = motion.getMovePath();
                originPath = JSON.parseArray(movePath, NavigateNode.class);
                finalPath = assignCommand.getNodes();
                similarity = navigateUtils.similarityPath(originPath, finalPath);
                if(similarity <= similarityRef) {
                    News.error("{} dash {} path similarity mismatch!", motion.getOrigin(), motion.getTarget());
                    return false;
                }
                shuttleCommands.add(shuttleCommands.size(), shuttleThread.getLiftCommand(motion.getTaskNo(), false));
                break;
            case SHUTTLE_MOVE_FROM_LIFT://出提升机
@@ -297,6 +363,15 @@
                String shuttleFromLiftStandbyLoc = shuttleDispatcher.searchAvailableLocNo(Integer.valueOf(shuttleDevice.getDeviceNo()), shuttleDevice.getHostId(), shuttleThread.getStatus().getCurrentLocNo(), standbyLocs);
                shuttleCommands = this.shuttleAssignCommand(motion.getOrigin(), shuttleFromLiftStandbyLoc, NavigationMapType.NORMAL.id, assignCommand, shuttleThread);
                movePath = motion.getMovePath();
                originPath = JSON.parseArray(movePath, NavigateNode.class);
                finalPath = assignCommand.getNodes();
                similarity = navigateUtils.similarityPath(originPath, finalPath);
                if(similarity <= similarityRef) {
                    News.error("{} dash {} path similarity mismatch!", motion.getOrigin(), motion.getTarget());
                    return false;
                }
                //更新动作可用待机位
                motion.setTarget(shuttleFromLiftStandbyLoc);
                motion.setUpdateTime(new Date());
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/model/PythonSimilarityResult.java
New file
@@ -0,0 +1,16 @@
package com.zy.asrs.wcs.core.model;
import lombok.Data;
@Data
public class PythonSimilarityResult {
    private String firstPath;
    private String secondPath;
    private Double similarity;
    private Integer calcResult;
}
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/model/enums/NavigationMapType.java
@@ -5,6 +5,7 @@
    NONE(-1, "无过滤"),
    DFX(1, "过滤库位状态DFX"),    // 带货走行
    NORMAL(2, "过滤库位状态X"),   // 无货走行
    NONE_LOCK(3, "过滤库位状态X,且无路径锁"),
    ;
    public Integer id;
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/NavigateMapData.java
@@ -31,6 +31,8 @@
    private LocService locService;
    @Autowired
    private DictService dictService;
    @Autowired
    private NavigateMapData navigateMapData;
    private Integer lev;//地图楼层
@@ -54,14 +56,22 @@
     * 尝试从redis获取数据
     */
    public int[][] getDataFromRedis(Integer mapType, List<int[]> whitePoints, List<int[]> shuttlePoints) {
        RedisUtil redisUtil = SpringUtils.getBean(RedisUtil.class);
        Object o = redisUtil.get(DeviceRedisConstant.MAP + lev);
        if (o == null) {
            return null;
        String mapData = null;
        if(mapType == NavigationMapType.NONE_LOCK.id){
            List<List<MapNode>> realMap = navigateMapData.getJsonDataFromDict(-1, null, null);//获取完整地图
            mapData = JSON.toJSONString(realMap);
        }else {
            RedisUtil redisUtil = SpringUtils.getBean(RedisUtil.class);
            Object o = redisUtil.get(DeviceRedisConstant.MAP + lev);
            if (o == null) {
                return null;
            }
            BasMapDto basMap = JSON.parseObject(o.toString(), BasMapDto.class);
            mapData = basMap.getData();
        }
        BasMapDto basMap = JSON.parseObject(o.toString(), BasMapDto.class);
        return this.getDataFormString(basMap.getData(), mapType, whitePoints, shuttlePoints);
        return this.getDataFormString(mapData, mapType, whitePoints, shuttlePoints);
    }
    /**
@@ -319,7 +329,7 @@
                ) {
                    mapNode.setValue(MapNodeType.DISABLE.id);//禁用节点
                }
            } else if (mapType == NavigationMapType.NORMAL.id) {
            } else if (mapType == NavigationMapType.NORMAL.id || mapType == NavigationMapType.NONE_LOCK.id) {
                //过滤库位状态X
                if (loc.getLocStsFlag().equals("X")) {
                    mapNode.setValue(MapNodeType.DISABLE.id);//禁用节点
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/NavigateUtils.java
@@ -2,15 +2,23 @@
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.zy.asrs.framework.common.SpringUtils;
import com.zy.asrs.wcs.core.model.MapNode;
import com.zy.asrs.wcs.core.model.NavigateNode;
import com.zy.asrs.wcs.core.model.PythonResult;
import com.zy.asrs.wcs.core.model.PythonSimilarityResult;
import com.zy.asrs.wcs.core.model.enums.MapNodeType;
import com.zy.asrs.wcs.core.model.enums.NavigationMapType;
import com.zy.asrs.wcs.rcs.News;
import com.zy.asrs.wcs.system.entity.Dict;
import com.zy.asrs.wcs.system.service.DictService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
@@ -24,6 +32,9 @@
    @Value("${pythonCalcPath}")
    private String pythonCalcPath;
    @Value("${pythonCalcSimilarity}")
    private String pythonCalcSimilarity;
    public List<NavigateNode> calc(String startPoint, String endPoint, Integer mapType, List<int[]> shuttlePoints) {
        //通过开始编号和结束编号获取对应的xy轴坐标
@@ -289,7 +300,47 @@
        return node;
    }
//    public static void main(String[] args) {
    public Double similarityPath(List<NavigateNode> firstPath, List<NavigateNode> secondPath) {
        try {
            ProcessBuilder processBuilder = new ProcessBuilder("python", pythonCalcSimilarity, JSON.toJSONString(firstPath), JSON.toJSONString(secondPath));
            processBuilder.redirectErrorStream(true);
            Process process = processBuilder.start();
            // 读取Python脚本的输出
            BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
            String line;
            StringBuilder builder = new StringBuilder();
            while ((line = reader.readLine()) != null) {
                builder.append(line);
            }
            // 等待Python脚本执行完成
            int exitCode = process.waitFor();
            if (exitCode != 0) {
                System.out.println("Python script exited with error code: " + exitCode);
                return null;
            }
            reader.close();
            if (builder.length() <= 0) {
                return null;
            }
            PythonSimilarityResult result = JSON.parseObject(builder.toString(), PythonSimilarityResult.class);
            if (result.getCalcResult() != 200) {
                return 0D;
            }
            Double similarity = result.getSimilarity();
            return similarity;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return 0D;
    }
    public static void main(String[] args) {
//        //计算路径
//        List<NavigateNode> calc = calc("1000901", "1800201", NavigationMapType.NONE.id, null);
//        System.out.println(calc);
@@ -302,7 +353,9 @@
//            System.out.println(currentPathAllDistance);
//            System.out.println(list);
//        }
//
//    }
        System.loadLibrary("example");
    }
}
zy-asrs-wcs/src/main/resources/application.yml
@@ -63,4 +63,5 @@
config:
  token-key: KUHSMcYQ4lePt3r6bckz0P13cBJyoonYqInThvQlUnbsFCIcCcZZAbWZ6UNFztYNYPhGdy6eyb8WdIz8FU2Cz396TyTJk3NI2rtXMHBOehRb4WWJ4MdYVVg2oWPyqRQ2
pythonCalcPath: D:\\path\\cpu.py
pythonCalcPath: D:\\path\\cpu.py
pythonCalcSimilarity: D:\\path\\similarity.py