| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang.time.StopWatch; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.*; |
| | |
| | | @Component("mapService") |
| | | public class MapService { |
| | | |
| | | @Value("${floyd.enable}") |
| | | private Boolean floydEnable; |
| | | @Autowired |
| | | private CodeService codeService; |
| | | @Autowired |
| | |
| | | * 寻址 ===>> Floyd |
| | | */ |
| | | public synchronized List<String> validFeasibility(Code startCode, Code endCode) { |
| | | if (!floydEnable) { |
| | | return Arrays.asList("00000001", "00000002", "00000003", "00000004", "00000005", "00000006"); |
| | | } |
| | | |
| | | int startIdx = floydNavigateService.codeIdx(startCode.getId()); |
| | | int endIdx = floydNavigateService.codeIdx(endCode.getId()); |
| | |
| | | |
| | | |
| | | Integer serial = dynamicNode.getSerial(); |
| | | long time = dynamicNode.getTime(); |
| | | |
| | | List<String> resetCodeList = new ArrayList<>(); |
| | | |
| | | for (int i = 0; i < dynamicMatrix.length; i++) { |
| | | for (int j = 0; j < dynamicMatrix[i].length; j++) { |
| | | |
| | | if (i == codeMatrixIdx[0] && j == codeMatrixIdx[1]) { continue; } |
| | | |
| | | DynamicNode node = dynamicMatrix[i][j]; |
| | | if (node.getVehicle().equals(agvNo) && node.getSerial() < serial) { |
| | | resetCodeList.add(codeMatrix[i][j]); |
| | | if (node.getVehicle().equals(agvNo)) { |
| | | if (node.getSerial() < serial || node.getTime() != time) { |
| | | resetCodeList.add(codeMatrix[i][j]); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | } catch (Exception e) { |
| | | log.error("TrafficService.unlockPath", e); |
| | | log.error("MapService.unlockPath", e); |
| | | } |
| | | |
| | | } |