| | |
| | | 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; |
| | | |
| | | /** |
| | |
| | | //执行完成后是否释放穿梭车,默认不释放 1: 释放 0: 不释放 |
| | | private Integer releaseShuttle; |
| | | |
| | | private Device shuttleDevice; |
| | | |
| | | public static MotionDto build(BuildSupport<MotionDto> support) { |
| | | MotionDto dto = new MotionDto(); |
| | | |
| | |
| | | @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) { |
| | |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setShuttleDevice(shuttleDevice); |
| | | dto.setLocNo(standbyLocNoTo); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE |
| | |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setShuttleDevice(shuttleDevice); |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLocNo(destLoc); |
| | | // dto.setReleaseLift(2);//执行中释放提升机 |
| | |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setShuttleDevice(shuttleDevice); |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLocNo(standbyLocNoTo); |
| | | })), |
| | |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setShuttleDevice(shuttleDevice); |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLocNo(liftLocNoTo); |
| | | })), |
| | |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setShuttleDevice(shuttleDevice); |
| | | dto.setLocNo(standbyLocNoFrom); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE_FROM_LIFT |
| | |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setShuttleDevice(shuttleDevice); |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLocNo(destLoc); |
| | | })), |
| | |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setShuttleDevice(shuttleDevice); |
| | | dto.setLocNo(originLoc); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE |
| | |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setShuttleDevice(shuttleDevice); |
| | | dto.setLocNo(lastPathStartLoc); |
| | | })), |
| | | MotionCtgType.SHUTTLE_TRANSPORT |
| | |
| | | })), |
| | | 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())));//输送站 |
| | |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setShuttleDevice(shuttleDevice); |
| | | dto.setLocNo(standbyLocs); |
| | | dto.setSync(0);//异步执行 |
| | | dto.setReleaseShuttle(1);//执行完成后释放小车 |
| | |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setShuttleDevice(shuttleDevice); |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLocNo(standbyLocNoTo); |
| | | })), |
| | |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setShuttleDevice(shuttleDevice); |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLocNo(liftLocNoTo); |
| | | })), |
| | |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setShuttleDevice(shuttleDevice); |
| | | dto.setLocNo(standbyLocNoFrom); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE_FROM_LIFT |
| | |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setShuttleDevice(shuttleDevice); |
| | | dto.setLocNo(originLoc); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE |
| | |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setShuttleDevice(shuttleDevice); |
| | | dto.setLocNo(lastPathStartLoc); |
| | | })), |
| | | MotionCtgType.SHUTTLE_TRANSPORT |
| | |
| | | })), |
| | | 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())));//输送站 |
| | |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setShuttleDevice(shuttleDevice); |
| | | dto.setLocNo(standbyLocs); |
| | | dto.setSync(0);//异步执行 |
| | | dto.setReleaseShuttle(1);//执行完成后释放小车 |
| | |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setShuttleDevice(shuttleDevice); |
| | | dto.setLocNo(chargeLocNo); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE |
| | |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setShuttleDevice(shuttleDevice); |
| | | dto.setLocNo(standbyLocNoTo); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE |
| | |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setShuttleDevice(shuttleDevice); |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLocNo(liftLocNoTo); |
| | | })), |
| | |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setShuttleDevice(shuttleDevice); |
| | | dto.setLocNo(standbyLocNoFrom); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE_FROM_LIFT |
| | |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setShuttleDevice(shuttleDevice); |
| | | dto.setLocNo(chargeLocNo); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE |
| | |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setShuttleDevice(shuttleDevice); |
| | | dto.setLocNo(locNo); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE |
| | |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setShuttleDevice(shuttleDevice); |
| | | dto.setLocNo(locNo); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE |
| | |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setShuttleDevice(shuttleDevice); |
| | | dto.setLiftNo(liftDevice.getId().intValue()); |
| | | dto.setLocNo(standbyLocNoTo); |
| | | })), |
| | |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setShuttleDevice(shuttleDevice); |
| | | dto.setLiftNo(liftDevice.getId().intValue()); |
| | | dto.setLocNo(liftLocNoTo); |
| | | })), |
| | |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setShuttleDevice(shuttleDevice); |
| | | dto.setLocNo(standbyLocNoFrom); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE_FROM_LIFT |
| | |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setShuttleDevice(shuttleDevice); |
| | | dto.setLocNo(locNo); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE |
| | |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(device.getId().intValue()); |
| | | dto.setShuttleDevice(device); |
| | | dto.setLocNo(targetLoc); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE |
| | |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(device.getId().intValue()); |
| | | dto.setShuttleDevice(device); |
| | | dto.setLocNo(sourceLoc); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE |
| | |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(device.getId().intValue()); |
| | | dto.setShuttleDevice(device); |
| | | dto.setLocNo(targetLoc); |
| | | })), |
| | | MotionCtgType.SHUTTLE_TRANSPORT |
| | |
| | | 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; |
| | | |
| | |
| | | private MotionService motionService; |
| | | @Autowired |
| | | private LiftDispatcher liftDispatcher; |
| | | @Autowired |
| | | private NavigateUtils navigateUtils; |
| | | @Autowired |
| | | private DeviceService deviceService; |
| | | |
| | | // agv ----------------------------------------------------------------------------- |
| | | @Deprecated |
| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | private ShuttleDispatcher shuttleDispatcher; |
| | | @Autowired |
| | | private NavigateUtils navigateUtils; |
| | | @Autowired |
| | | private DictService dictService; |
| | | |
| | | // 计算 |
| | | public Boolean accept(Motion motion) { |
| | |
| | | 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()); |
| | |
| | | |
| | | 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: |
| | |
| | | } |
| | | 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://穿梭车载货行走 |
| | | // 如果已经在当前条码则过滤 |
| | |
| | | } |
| | | 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); |
| | |
| | | } |
| | | 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://出提升机 |
| | |
| | | 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()); |
New file |
| | |
| | | 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; |
| | | |
| | | } |
| | |
| | | NONE(-1, "无过滤"), |
| | | DFX(1, "过滤库位状态DFX"), // 带货走行 |
| | | NORMAL(2, "过滤库位状态X"), // 无货走行 |
| | | NONE_LOCK(3, "过滤库位状态X,且无路径锁"), |
| | | ; |
| | | |
| | | public Integer id; |
| | |
| | | private LocService locService; |
| | | @Autowired |
| | | private DictService dictService; |
| | | @Autowired |
| | | private NavigateMapData navigateMapData; |
| | | |
| | | private Integer lev;//地图楼层 |
| | | |
| | |
| | | * 尝试从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); |
| | | } |
| | | |
| | | /** |
| | |
| | | ) { |
| | | 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);//禁用节点 |
| | |
| | | |
| | | 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; |
| | |
| | | |
| | | @Value("${pythonCalcPath}") |
| | | private String pythonCalcPath; |
| | | |
| | | @Value("${pythonCalcSimilarity}") |
| | | private String pythonCalcSimilarity; |
| | | |
| | | public List<NavigateNode> calc(String startPoint, String endPoint, Integer mapType, List<int[]> shuttlePoints) { |
| | | //通过开始编号和结束编号获取对应的xy轴坐标 |
| | |
| | | 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); |
| | |
| | | // System.out.println(currentPathAllDistance); |
| | | // System.out.println(list); |
| | | // } |
| | | // |
| | | // } |
| | | |
| | | System.loadLibrary("example"); |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | config: |
| | | token-key: KUHSMcYQ4lePt3r6bckz0P13cBJyoonYqInThvQlUnbsFCIcCcZZAbWZ6UNFztYNYPhGdy6eyb8WdIz8FU2Cz396TyTJk3NI2rtXMHBOehRb4WWJ4MdYVVg2oWPyqRQ2 |
| | | |
| | | pythonCalcPath: D:\\path\\cpu.py |
| | | pythonCalcPath: D:\\path\\cpu.py |
| | | pythonCalcSimilarity: D:\\path\\similarity.py |