| | |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.core.common.SpringUtils; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.BasMap; |
| | | import com.zy.asrs.utils.Utils; |
| | | import com.zy.common.model.MapNode; |
| | | import com.zy.common.model.NavigateNode; |
| | | import com.zy.common.model.enums.NavigationMapType; |
| | | import com.zy.core.enums.MapNodeType; |
| | | import com.zy.core.enums.RedisKeyType; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | |
| | | } |
| | | |
| | | //获取小车节点 |
| | | int[] shuttlePoint = Utils.getShuttlePoint(shuttleNo); |
| | | if (shuttlePoint == null) { |
| | | return false; |
| | | } |
| | | |
| | | //获取小车节点-获取除白名单外的指定楼层全部穿梭车xy坐标点 |
| | | List<int[]> shuttlePoints = Utils.getShuttlePoints(shuttleNo, lev); |
| | | |
| | | BasMap basMap = JSON.parseObject(o.toString(), BasMap.class); |
| | | ArrayList arrayList = JSON.parseObject(basMap.getData(), ArrayList.class); |
| | | //带小车地图 |
| | | List<List<MapNode>> listsHasShuttle = navigateMapData.filterMap(NavigationMapType.NONE.id, arrayList, lev, null, shuttlePoints);//获取带小车地图数据 |
| | | List<List<MapNode>> lists = navigateMapData.filterMap(NavigationMapType.NONE.id, arrayList, lev, null, null);//获取全部地图数据 |
| | | |
| | | //获取全部地图数据 |
| | | List<List<MapNode>> lists = navigateMapData.rebuildData(arrayList); |
| | | //载入库位信息 |
| | | lists = navigateMapData.loadLocMast(NavigationMapType.NONE.id, lists, lev, null); |
| | | |
| | | //检测路径是否被锁定 |
| | | if (lock) { |
| | | for (NavigateNode node : nodes) { |
| | | //判断是否为当前小车 |
| | | if(shuttlePoint[0] == node.getX() && shuttlePoint[1] == node.getY()) { |
| | | continue; |
| | | } |
| | | |
| | | List<MapNode> listX = listsHasShuttle.get(node.getX()); |
| | | MapNode mapNode = listX.get(node.getY()); |
| | | if (mapNode.getValue() == -999) { |
| | | if (mapNode.getValue() == MapNodeType.LOCK.id) { |
| | | return false;//路径被锁定过,禁止再次锁定 |
| | | } |
| | | if (mapNode.getValue() == 66) { |
| | | if (mapNode.getValue() == MapNodeType.CAR.id) { |
| | | return false;//路径存在小车,禁止锁定 |
| | | } |
| | | } |
| | | } |
| | | |
| | | //尝试锁定/解锁路径 |
| | | List<List<MapNode>> realMap = navigateMapData.getJsonData(nodes.get(0).getZ(), -1, null, null);//获取完整地图(包括入库出库) |
| | | for (NavigateNode node : nodes) { |
| | | if (node.getZ() != lev) { |
| | | continue; |
| | |
| | | List<MapNode> listX = lists.get(node.getX()); |
| | | MapNode mapNode = listX.get(node.getY()); |
| | | if (lock) { |
| | | mapNode.setValue(-999);//禁用库位 |
| | | mapNode.setValue(MapNodeType.LOCK.id);//禁用库位 |
| | | } else { |
| | | //获取原始节点数据 |
| | | List<MapNode> rows = realMap.get(node.getX()); |
| | | MapNode col = rows.get(node.getY()); |
| | | mapNode.setValue(col.getValue());//恢复库位 |
| | | mapNode.setValue(node.getNodeValue());//恢复原始节点数据 |
| | | } |
| | | |
| | | listX.set(node.getY(), mapNode); |