From 81188cbe3d51e951ce4c853edb886272a4eb51a3 Mon Sep 17 00:00:00 2001 From: Junjie <540245094@qq.com> Date: 星期三, 11 十二月 2024 15:59:00 +0800 Subject: [PATCH] #path similarity --- zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/LiftDispatcher.java | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 59 insertions(+), 0 deletions(-) diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/LiftDispatcher.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/LiftDispatcher.java index 50f9538..af6aa85 100644 --- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/LiftDispatcher.java +++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/LiftDispatcher.java @@ -41,6 +41,65 @@ * 鏍规嵁鐩爣浣嶇疆鎼滅储绌洪棽鎻愬崌鏈� * transfer: 鏄惁鍙崲灞� */ + public LiftThread searchLift(String locNo, Long hostId, Boolean transfer) { + LiftThread recentLiftThread = null; + Integer finalDistance = Integer.MAX_VALUE; + List<Device> list = deviceService.list(new LambdaQueryWrapper<Device>() + .eq(Device::getDeviceType, DeviceCtgType.LIFT.val()) + .eq(Device::getHostId, hostId) + .eq(Device::getStatus, 1)); + for (Device device : list) { + LiftThread liftThread = (LiftThread) SlaveConnection.get(SlaveType.Lift, device.getId().intValue()); + if (liftThread == null) { + continue; + } + + LiftProtocol liftProtocol = liftThread.getStatus(); + if (liftProtocol == null) { + continue; + } + + if (!liftThread.isIdle()) { + continue; + } + + if (transfer) { + BasLift basLift = basLiftService.getOne(new LambdaQueryWrapper<BasLift>().eq(BasLift::getLiftNo, device.getDeviceNo()).eq(BasLift::getHostId, hostId)); + if (basLift == null) { + continue; + } + if (basLift.getTransfer() != 1) { + continue;//鎻愬崌鏈鸿璁剧疆鎴愪笉鍙崲灞� + } + } + + ShuttleStandby standby = shuttleStandbyService.getOne(new LambdaQueryWrapper<ShuttleStandby>() + .eq(ShuttleStandby::getDeviceId, device.getId()) + .eq(ShuttleStandby::getDeviceLev, Utils.getLev(locNo)) + .eq(ShuttleStandby::getStatus, 1)); + if (standby == null) { + continue; + } + + String liftLocNo = Utils.getLocNo(Utils.getRow(standby.getDeviceStandbyLoc()), Utils.getBay(standby.getDeviceStandbyLoc()), Utils.getLev(locNo)); + List<NavigateNode> nodeList = navigateUtils.calc(locNo, liftLocNo, NavigationMapType.NONE.id, null); + if (nodeList == null) { + continue; + } + Integer originPathAllDistance = navigateUtils.getOriginPathAllDistance(nodeList);//鎬昏窛绂� + if (originPathAllDistance < finalDistance) { + finalDistance = originPathAllDistance; + recentLiftThread = liftThread; + } + } + + return recentLiftThread; + } + + /** + * 鏍规嵁鐩爣浣嶇疆鎼滅储绌洪棽鎻愬崌鏈� + * transfer: 鏄惁鍙崲灞� + */ public LiftThread searchIdleLift(String locNo, Long hostId, Boolean transfer) { LiftThread recentLiftThread = null; Integer finalDistance = Integer.MAX_VALUE; -- Gitblit v1.9.1