From 0f5a5a759221bde50ace126eae797326837f5f72 Mon Sep 17 00:00:00 2001 From: Junjie <xjj@123> Date: 星期三, 16 十月 2024 16:15:12 +0800 Subject: [PATCH] # --- zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/ShuttleDispatcher.java | 63 ++++++++++++++++++++----------- 1 files changed, 41 insertions(+), 22 deletions(-) diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/ShuttleDispatcher.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/ShuttleDispatcher.java index 32bfa74..820c458 100644 --- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/ShuttleDispatcher.java +++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/ShuttleDispatcher.java @@ -14,6 +14,7 @@ import com.zy.asrs.wcs.rcs.News; import com.zy.asrs.wcs.rcs.cache.SlaveConnection; import com.zy.asrs.wcs.rcs.entity.Device; +import com.zy.asrs.wcs.rcs.model.enums.ShuttleProtocolStatusType; import com.zy.asrs.wcs.rcs.model.enums.SlaveType; import com.zy.asrs.wcs.rcs.model.protocol.ShuttleProtocol; import com.zy.asrs.wcs.rcs.service.DeviceService; @@ -283,9 +284,9 @@ } /** - * 鎼滅储閬胯搴撲綅锛岄�氳繃灏忚溅鍙峰拰鐩爣搴撲綅 + * 鎼滅储鍙敤搴撲綅锛岄�氳繃灏忚溅鍙峰拰鐩爣搴撲綅 */ - public String searchStandByLocNo(Integer shuttleNo, Long hostId, String locNo) { + public String searchAvailableLocNo(Integer shuttleNo, Long hostId, String currentLocNo, List<String> locNos) { BasShuttle basShuttle = basShuttleService.getOne(new LambdaQueryWrapper<BasShuttle>() .eq(BasShuttle::getShuttleNo, shuttleNo) .eq(BasShuttle::getHostId, hostId)); @@ -293,33 +294,18 @@ throw new CoolException("灏忚溅鍩虹鏁版嵁涓嶅瓨鍦�"); } - String idleLoc = basShuttle.getIdleLoc(); - if (Cools.isEmpty(idleLoc)) { - throw new CoolException("灏忚溅閬胯鏁版嵁涓嶅瓨鍦�"); - } - - int lev = Utils.getLev(locNo);//褰撳墠妤煎眰 - List<String> standbyLoc = JSON.parseArray(idleLoc, String.class); - if (standbyLoc.isEmpty()) { - throw new CoolException("閬胯鏁版嵁寮傚父"); - } - //鑾峰彇褰撳墠灞傞伩璁╀綅缃� - List<String> currentLevStandByLoc = new ArrayList<>(); - for (String loc : standbyLoc) { - if (Utils.getLev(loc) == lev) { - currentLevStandByLoc.add(loc); - } - } - if (currentLevStandByLoc.isEmpty()) { + if (locNos.isEmpty()) { throw new CoolException("褰撳墠灞傛棤閬胯浣嶇疆"); } + int lev = Utils.getLev(currentLocNo); + Integer finalDistance = ShuttleDispatcher.INF; String recentLoc = null; - for (String loc : currentLevStandByLoc) { + for (String loc : locNos) { //褰撳墠绌挎杞﹀埌閬胯浣嶈绠� List<NavigateNode> currentShuttlePath = NavigateUtils.calc( - locNo + currentLocNo , loc , NavigationMapType.NORMAL.id , Utils.getShuttlePoints(shuttleNo, lev) @@ -367,6 +353,18 @@ ShuttleProtocol shuttleProtocol = shuttleThread.getStatus(); if (shuttleProtocol == null) { + continue; + } + + if (shuttleProtocol.getProtocolStatusType().equals(ShuttleProtocolStatusType.OFFLINE)) { + continue; + } + + if(!shuttleThread.isDeviceIdle()) { + continue; + } + + if(shuttleProtocol.getCurrentLocNo() == null) { continue; } @@ -441,5 +439,26 @@ return levCount < Integer.parseInt(dict.getValue()); } + //鍒嗘瀽鍑哄簱璺緞寰呮満搴撲綅 + public String analyzeOutPathWaitLoc(String startLoc, String targetLoc, Device shuttleDevice) { + //璁$畻璺緞骞跺垎瑙f垚涓ゆ鍔ㄤ綔 + List<NavigateNode> nodeList = NavigateUtils.calc(startLoc, targetLoc, NavigationMapType.DFX.id, Utils.getShuttlePoints(Integer.parseInt(shuttleDevice.getDeviceNo()), Utils.getLev(startLoc))); + if (nodeList == null) { + News.error("{} dash {} can't find navigate path!", startLoc, targetLoc); + return null; + } + //鑾峰彇鍒嗘璺緞 + ArrayList<ArrayList<NavigateNode>> data = NavigateUtils.getSectionPath(nodeList); + if (data.size() <= 1) { + return null;//涓ょ偣涔嬮棿鍙湁涓�娈佃矾寰� + } + + //鍙栧嚭鍊掓暟绗簩娈佃矾寰� + ArrayList<NavigateNode> navigateNodes = data.get(data.size() - 2); + NavigateNode startNode = navigateNodes.get(0); + String lastPathStartLoc = Utils.getLocNo(startNode.getX(), startNode.getY(), startNode.getZ()); + return lastPathStartLoc; + } + } -- Gitblit v1.9.1