From 8ef2bb5e46d84594e6ed632c07ea0b47a1bf6c4d Mon Sep 17 00:00:00 2001 From: Junjie <540245094@qq.com> Date: 星期三, 11 十二月 2024 16:15:17 +0800 Subject: [PATCH] #path similarity --- zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/LiftDispatcher.java | 68 +++++++++++++++++++++++++++++++++- 1 files changed, 66 insertions(+), 2 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 cc41792..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 @@ -34,6 +34,67 @@ private BasLiftService basLiftService; @Autowired private ShuttleStandbyService shuttleStandbyService; + @Autowired + private NavigateUtils navigateUtils; + + /** + * 鏍规嵁鐩爣浣嶇疆鎼滅储绌洪棽鎻愬崌鏈� + * 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; + } /** * 鏍规嵁鐩爣浣嶇疆鎼滅储绌洪棽鎻愬崌鏈� @@ -80,8 +141,11 @@ } 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); - Integer originPathAllDistance = NavigateUtils.getOriginPathAllDistance(nodeList);//鎬昏窛绂� + 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; -- Gitblit v1.9.1