| | |
| | | DynamicNode dynamicNode = dynamicMatrix[codeMatrixIdx[0]][codeMatrixIdx[1]]; |
| | | String vehicle = dynamicNode.getVehicle(); |
| | | if (vehicle.equals(DynamicNodeType.ACCESS.val)) { |
| | | mapDataDispatcher.modifyDynamicMatrix(null, Utils.singletonList(code.getData()), agv.getUuid()); |
| | | mapDataDispatcher.modifyDynamicMatrix(null, Utils.singletonList(codeMatrixIdx), agv.getUuid()); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | if (!Cools.isEmpty(pathList)) { |
| | | pathList.remove(0); |
| | | mapDataDispatcher.clearDynamicMatrixByCodeList(null, pathList); |
| | | List<int[]> codeMatrixIdxList = mapDataDispatcher.getCodeMatrixIdxList(null, pathList); |
| | | mapDataDispatcher.clearDynamicMatrixByCodeList(null, codeMatrixIdxList); |
| | | } |
| | | |
| | | throw new RuntimeException("generateAction method caught an exception, rolling back transaction.", e); |
| | |
| | | } |
| | | |
| | | public void lockPath(Integer lev, List<String> pathList, String agvNo) { |
| | | mapDataDispatcher.modifyDynamicMatrix(lev, pathList, agvNo); |
| | | List<int[]> codeMatrixIdxList = mapDataDispatcher.getCodeMatrixIdxList(lev, pathList); |
| | | mapDataDispatcher.modifyDynamicMatrix(lev, codeMatrixIdxList, agvNo); |
| | | } |
| | | |
| | | public synchronized void unlockPath(String agvNo, String codeData) { |
| | |
| | | DynamicNode dynamicNode = dynamicMatrix[codeMatrixIdx[0]][codeMatrixIdx[1]]; |
| | | |
| | | |
| | | Integer serial = dynamicNode.getSerial(); |
| | | int serial = dynamicNode.getSerial(); |
| | | |
| | | List<String> resetCodeList = new ArrayList<>(); |
| | | List<int[]> resetCodeIdxList = new ArrayList<>(); |
| | | |
| | | for (int i = 0; i < dynamicMatrix.length; i++) { |
| | | for (int j = 0; j < dynamicMatrix[i].length; j++) { |
| | |
| | | DynamicNode node = dynamicMatrix[i][j]; |
| | | if (node.getVehicle().equals(agvNo)) { |
| | | if (node.getSerial() < serial) { |
| | | resetCodeList.add(codeMatrix[i][j]); |
| | | resetCodeIdxList.add(new int[] {i, j}); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (!Cools.isEmpty(resetCodeList)) { |
| | | if (!Cools.isEmpty(resetCodeIdxList)) { |
| | | |
| | | mapDataDispatcher.clearDynamicMatrixByCodeList(lev, resetCodeList); |
| | | mapDataDispatcher.clearDynamicMatrixByCodeList(lev, resetCodeIdxList); |
| | | } |
| | | |
| | | stopWatch.stop(); |
| | |
| | | // return codeList.stream().map(SortCodeDto::getCode).collect(Collectors.toList()); |
| | | } |
| | | |
| | | public void modifyDynamicMatrix(Integer lev, List<String> codeDataList, String vehicle) { |
| | | this.modifyDynamicMatrix(lev, codeDataList, vehicle, false); |
| | | public void modifyDynamicMatrix(Integer lev, List<int[]> codeIdxList, String vehicle) { |
| | | this.modifyDynamicMatrix(lev, codeIdxList, vehicle, false); |
| | | } |
| | | |
| | | public synchronized void modifyDynamicMatrix(Integer lev, List<String> codeDataList, String vehicle, boolean reset) { |
| | | public synchronized void modifyDynamicMatrix(Integer lev, List<int[]> codeIdxList, String vehicle, boolean reset) { |
| | | if (Cools.isEmpty(vehicle)) { |
| | | return; |
| | | } |
| | |
| | | if (!reset) { |
| | | // long time = System.currentTimeMillis() / 1000; |
| | | int serial = 1; |
| | | for (String codeData : codeDataList) { |
| | | int[] codeMatrixIdx = getCodeMatrixIdx(lev, codeData); |
| | | for (int[] codeMatrixIdx : codeIdxList) { |
| | | dynamicMatrix[codeMatrixIdx[0]][codeMatrixIdx[1]] = new DynamicNode(vehicle, serial); |
| | | serial++; |
| | | } |
| | |
| | | setDynamicMatrix(lev, dynamicMatrix); |
| | | } |
| | | |
| | | public void clearDynamicMatrixByCodeList(Integer lev, List<String> codeDataList) { |
| | | this.modifyDynamicMatrix(lev, codeDataList, DynamicNodeType.ACCESS.val); |
| | | public void clearDynamicMatrixByCodeList(Integer lev, List<int[]> codeIdxList) { |
| | | this.modifyDynamicMatrix(lev, codeIdxList, DynamicNodeType.ACCESS.val); |
| | | } |
| | | |
| | | public int[][] filterMapData(int[][] mapMatrix, Integer lev, List<String> lockNodes) { |