| | |
| | | package com.zy.asrs.wcs.core.kernel.command; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.zy.asrs.wcs.core.entity.Motion; |
| | | import com.zy.asrs.wcs.core.model.MapNode; |
| | | import com.zy.asrs.wcs.core.model.NavigateNode; |
| | | import com.zy.asrs.wcs.core.model.enums.MapNodeType; |
| | | import com.zy.asrs.wcs.core.model.enums.MotionCtgType; |
| | | import com.zy.asrs.wcs.core.model.enums.NavigationMapType; |
| | | import com.zy.asrs.wcs.core.utils.*; |
| | |
| | | return false; |
| | | } |
| | | |
| | | NavigateNode navigateNode = NavigatePositionConvert.locNoToNode(motion.getTarget()); |
| | | List<NavigateNode> nodes = new ArrayList<>(); |
| | | nodes.add(navigateNode); |
| | | |
| | | String target = motion.getTarget(); |
| | | List<String> lockPath = JSON.parseArray(target, String.class); |
| | | Integer lev = null; |
| | | for (String loc : lockPath) { |
| | | NavigateNode navigateNode = NavigatePositionConvert.locNoToNode(loc); |
| | | nodes.add(navigateNode); |
| | | |
| | | lev = Utils.getLev(loc); |
| | | } |
| | | |
| | | //所使用的路径进行锁定/解锁 |
| | | boolean lockResult = navigateMapUtils.writeNavigateNodeToRedisMap(Utils.getLev(motion.getTarget()), shuttleProtocol.getShuttleNo(), nodes, lock);//所使用的路径进行锁定/解锁 |
| | | boolean lockResult = navigateMapUtils.writeNavigateNodeToRedisMap(lev, shuttleProtocol.getShuttleNo(), nodes, lock);//所使用的路径进行锁定/解锁 |
| | | if (!lockResult) { |
| | | return false;//锁定/解锁失败 |
| | | } |
| | |
| | | } |
| | | |
| | | private boolean checkLockPath(Motion motion, boolean lock) { |
| | | NavigateNode navigateNode = NavigatePositionConvert.locNoToNode(motion.getTarget()); |
| | | List<NavigateNode> nodes = new ArrayList<>(); |
| | | nodes.add(navigateNode); |
| | | |
| | | int lev = Utils.getLev(motion.getTarget()); |
| | | String target = motion.getTarget(); |
| | | List<String> lockPath = JSON.parseArray(target, String.class); |
| | | Integer lev = null; |
| | | for (String loc : lockPath) { |
| | | NavigateNode navigateNode = NavigatePositionConvert.locNoToNode(loc); |
| | | nodes.add(navigateNode); |
| | | |
| | | lev = Utils.getLev(loc); |
| | | } |
| | | |
| | | Object o = redisUtil.get(DeviceRedisConstant.MAP + lev); |
| | | if (o == null) { |
| | |
| | | |
| | | //获取小车节点 |
| | | List<int[]> shuttlePoints = Utils.getShuttlePoints(shuttleProtocol.getShuttleNo(), lev); |
| | | navigateMapData.setLev(lev); |
| | | List<List<MapNode>> map = navigateMapData.getJsonData(NavigationMapType.DFX.id, null, shuttlePoints); |
| | | |
| | | for (NavigateNode node : nodes) { |
| | | List<MapNode> listX = map.get(node.getX()); |
| | | MapNode mapNode = listX.get(node.getY()); |
| | | if (mapNode.getLockDeviceNo() != null && !mapNode.getLockDeviceNo().equals(shuttleProtocol.getShuttleNo())) { |
| | | return false;//路径所属权不是当前设备 |
| | | } |
| | | |
| | | if (lock) {//检测是否锁定 |
| | | if (mapNode.getValue() != -999) { |
| | | if (!mapNode.getValue().equals(MapNodeType.LOCK.id)) { |
| | | return false;//路径未锁定 |
| | | } |
| | | }else {//检测是否未锁定 |
| | | if(mapNode.getValue() == -999) { |
| | | if(mapNode.getValue().equals(MapNodeType.LOCK.id)) { |
| | | return false;//路径已锁定 |
| | | } |
| | | } |