From c13fe87d70e81d7dcb604f8f1227de8f313cbefc Mon Sep 17 00:00:00 2001 From: zjj <3272660260@qq.com> Date: 星期三, 10 七月 2024 09:26:51 +0800 Subject: [PATCH] # --- zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/ShuttleDispatcher.java | 33 ++++++++++++++++++++++----------- 1 files changed, 22 insertions(+), 11 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 1226aa3..cd0eb58 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 @@ -17,9 +17,11 @@ 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; +import com.zy.asrs.wcs.rcs.thread.LiftThread; import com.zy.asrs.wcs.rcs.thread.ShuttleThread; import com.zy.asrs.wcs.system.entity.Dict; import com.zy.asrs.wcs.system.service.DictService; @@ -126,10 +128,12 @@ continue; } - Device recentTransferLift = Utils.getRecentTransferLift(locNo, Integer.parseInt(device.getDeviceNo())); - if (recentTransferLift == null) { + //鑾峰彇璺濈鐩爣浣嶇疆鏈�杩戠殑绌洪棽鍙崲灞傛彁鍗囨満 + LiftThread liftThread = liftDispatcher.searchIdleLift(locNo, task.getHostId(), true); + if (liftThread == null) { continue; } + Device recentTransferLift = liftThread.getDevice(); //鑾峰彇灏忚溅妤煎眰鎻愬崌鏈哄緟鏈轰綅 ShuttleStandby shuttleStandby = shuttleStandbyService.getOne(new LambdaQueryWrapper<ShuttleStandby>() @@ -158,7 +162,7 @@ } // 鎸傝浇浠诲姟鏉冮噸 - List<Task> tasks = taskService.selectWorkingByShuttle(Integer.valueOf(device.getDeviceNo())); + List<Task> tasks = taskService.selectWorkingByShuttle(Integer.valueOf(device.getDeviceNo()), null); if (!Cools.isEmpty(tasks)) { currDistance += tasks.size() * WEIGHT; } @@ -299,20 +303,24 @@ } int lev = Utils.getLev(locNo);//褰撳墠妤煎眰 - JSONArray standbyLoc = JSON.parseArray(idleLoc); - if (lev > standbyLoc.size()) { + List<String> standbyLoc = JSON.parseArray(idleLoc, String.class); + if (standbyLoc.isEmpty()) { throw new CoolException("閬胯鏁版嵁寮傚父"); } - - Object object = standbyLoc.get(lev - 1); - List<String> locs = JSON.parseArray(object.toString(), String.class); - if (locs.isEmpty()) { - throw new CoolException("閬胯鏁版嵁涓虹┖"); + //鑾峰彇褰撳墠灞傞伩璁╀綅缃� + List<String> currentLevStandByLoc = new ArrayList<>(); + for (String loc : standbyLoc) { + if (Utils.getLev(loc) == lev) { + currentLevStandByLoc.add(loc); + } + } + if (currentLevStandByLoc.isEmpty()) { + throw new CoolException("褰撳墠灞傛棤閬胯浣嶇疆"); } Integer finalDistance = ShuttleDispatcher.INF; String recentLoc = null; - for (String loc : locs) { + for (String loc : currentLevStandByLoc) { //褰撳墠绌挎杞﹀埌閬胯浣嶈绠� List<NavigateNode> currentShuttlePath = NavigateUtils.calc( locNo @@ -365,6 +373,9 @@ if (shuttleProtocol == null) { continue; } + if (shuttleProtocol.getProtocolStatusType() == ShuttleProtocolStatusType.OFFLINE){ + continue; + } if (Utils.getLev(shuttleProtocol.getCurrentLocNo()) == lev) { if (shuttleProtocol.getHasCharge()) { -- Gitblit v1.9.1