From e711c834aec2293c53b07efe53e81e3573c289b6 Mon Sep 17 00:00:00 2001
From: 1 <1@123>
Date: 星期三, 01 四月 2026 11:42:44 +0800
Subject: [PATCH] lsh#

---
 rsf-server/src/main/java/com/vincent/rsf/server/manager/utils/LocManageUtil.java |  113 +++-----------------------------------------------------
 1 files changed, 6 insertions(+), 107 deletions(-)

diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/utils/LocManageUtil.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/utils/LocManageUtil.java
index be0ca00..d999743 100644
--- a/rsf-server/src/main/java/com/vincent/rsf/server/manager/utils/LocManageUtil.java
+++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/utils/LocManageUtil.java
@@ -88,21 +88,6 @@
         return !Objects.isNull(loc) ? loc.getCode() : null;
     }
 
-
-    /**
-     * @param
-     * @return
-     * @author Ryan
-     * @description 鑾峰彇鐩爣绔欑偣
-     * @time 2025/3/31 09:49
-     */
-    public static String getTargetSite() {
-        //TODO 绔欑偣绛栫暐鍚庣画鎺掓湡
-        DeviceSiteService deviceSite = SpringUtils.getBean(DeviceSiteService.class);
-        DeviceSite loc = deviceSite.getOne(new LambdaQueryWrapper<DeviceSite>().eq(DeviceSite::getStatus, 1), false);
-        return !Objects.isNull(loc) ? loc.getSite() : null;
-    }
-
     /**
      * 鍑哄簱绛栫暐锛�--銆堟晥鐜囦紭鍖栥��
      *
@@ -175,9 +160,7 @@
     public static List<OrderOutItemDto> getOutOrderList(List<WaveToLocParams> params, WaveRule waveRule,String stationId,String locCode) {
         LocService locService = SpringUtils.getBean(LocService.class);
         LocItemService locItemService = SpringUtils.getBean(LocItemService.class);
-        DeviceSiteService deviceSiteService = SpringUtils.getBean(DeviceSiteService.class);
         BasStationAreaService basStationAreaService = SpringUtils.getBean(BasStationAreaService.class);
-//        List<BasStationArea> basStationAreas = basStationAreaService.list(new LambdaQueryWrapper<>());//
         List<Loc> locList = new  ArrayList<>();
         List<OrderOutItemDto> list = new ArrayList<>();
         //涓嶈绔欑偣閲嶅浣跨敤闂
@@ -236,7 +219,7 @@
 //                        orderOutItemDto.setLocItem(locItem);
                         orderOutItemDto.setLoc(loc);
                         orderOutItemDto.getLocItemList().add(locItem);
-                        BasContainer containerType = getContainerType(loc.getBarcode());
+                        BasContainer containerType = new WarehouseLocationRetrievalUtil().getContainerByBarcode(loc.getBarcode());
                         if (Cools.isEmpty(containerType)){
                             continue;
                         }
@@ -328,25 +311,11 @@
                             if (Objects.isNull(basStation)) {
                                 throw new CoolException("缁戝畾绔欓粸涓嶅瓨鍦紒锛�");
                             }
-                            List<DeviceSite> deviceSites = deviceSiteService.list(new LambdaQueryWrapper<DeviceSite>()
-                                    .eq(!Objects.isNull(loc.getChannel()), DeviceSite::getChannel, loc.getChannel())
-                                    .eq(!Objects.isNull(loc.getAreaId()), DeviceSite::getAreaIdStart, loc.getAreaId())
-                                    .eq( DeviceSite::getSite, stationId)
-                                    .eq(DeviceSite::getType, issued.doubleValue() >= locItem.getAnfme() && itemList.size() == 1 ? TaskType.TASK_TYPE_OUT.type : TaskType.TASK_TYPE_PICK_AGAIN_OUT.type)
-                            );
-                            if (!deviceSites.isEmpty()) {
-                                List<OrderOutItemDto.staListDto> maps = new ArrayList<>();
-                                for (DeviceSite sta : deviceSites) {
-                                    OrderOutItemDto.staListDto staListDto = new OrderOutItemDto.staListDto();
-                                    staListDto.setStaNo(sta.getSite());
-                                    staListDto.setStaName(sta.getSite());
-                                    maps.add(staListDto);
-                                }
-                                orderOutItemDto.setStaNos(maps);
-                                orderOutItemDto.setSiteNo(basStation.getStationName());
-                            } else {
-                                throw new CoolException("鏈壘鍒扮鍚堟潯浠剁珯鐐硅矾寰勶紒锛侊紒璇锋鏌ヨ矾寰勭鐞嗭紒锛侊紒");
+                            boolean available = new WarehouseLocationRetrievalUtil().queryPathIsItAvailableOutArea(loc.getAreaId().toString(), stationId, loc.getBarcode(),"out");
+                            if (!available) {
+                                throw new CoolException("鏈壘鍒扮鍚堟潯浠惰矾寰勶紒锛侊紒璇锋鏌ヨ矾寰勯厤缃紒锛侊紒");
                             }
+                            orderOutItemDto.setSiteNo(basStation.getStationName());
 
                             orderOutItemDto.setSource(item.getItemId().toString())
                                     .setTargSiteAreaList(new ArrayList<>())
@@ -355,85 +324,15 @@
 
                             locList.add(loc);
                             issued = issued.subtract(new BigDecimal(locItem.getAnfme().toString()));
-
                         } else {
-                            List<DeviceSite> deviceSites = deviceSiteService.list(new LambdaQueryWrapper<DeviceSite>()
-                                    .eq(!Objects.isNull(loc.getChannel()), DeviceSite::getChannel, loc.getChannel())
-                                    .eq(!Objects.isNull(loc.getAreaId()), DeviceSite::getAreaIdStart, loc.getAreaId())
-                                    .eq(DeviceSite::getType, issued.doubleValue() >= locItem.getAnfme() && itemList.size() == 1 ? TaskType.TASK_TYPE_OUT.type : TaskType.TASK_TYPE_PICK_AGAIN_OUT.type)
-                            );
-
-                            if (!deviceSites.isEmpty()) {
-                                List<OrderOutItemDto.staListDto> maps = new ArrayList<>();
-                                for (DeviceSite sta : deviceSites) {
-                                    OrderOutItemDto.staListDto staListDto = new OrderOutItemDto.staListDto();
-                                    staListDto.setStaNo(sta.getSite());
-                                    staListDto.setStaName(sta.getSite());
-                                    maps.add(staListDto);
-                                }
-                                orderOutItemDto.setStaNos(maps);
-                                //鑾峰彇婊¤冻鏉′欢绔欑偣
-                                Set<String> stationSet = deviceSites.stream().map(DeviceSite::getSite).collect(Collectors.toSet());
-                                //宸蹭娇鐢ㄧ珯鐐�
-                                Set<String> stas = stations.stream().map(BasStation::getStationName).collect(Collectors.toSet());
-                                BasStationService basStationService = SpringUtils.getBean(BasStationService.class);
-                                BasStation basStation = basStationService.getOne(new LambdaQueryWrapper<BasStation>()
-                                        .apply("cross_zone_area != '[]'")  // 涓嶆槸绌烘暟缁�
-                                        .apply("container_type != '[]'")
-                                        .apply("JSON_CONTAINS(cross_zone_area, {0}) = 1", loc.getAreaId().toString())//鍙墽琛屽簱鍖哄尯鍖哄煙id
-                                        .apply("JSON_CONTAINS(container_type, {0}) = 1", containerType.getContainerType().toString())//瀹瑰櫒绫诲瀷
-                                        .eq(BasStation::getUseStatus, LocStsType.LOC_STS_TYPE_O.type)
-                                        .in(BasStation::getStationName, stationSet)
-                                        .notIn(!stas.isEmpty(), BasStation::getStationName, stas)
-                                        .last("LIMIT 1"));
-
-                                if (Objects.isNull(basStation)) {
-                                    throw new CoolException("绔欓粸涓嶅瓨鍦紒锛�");
-                                }
-                                if (basStation.getType()!=0){
-                                    stations.add(basStation);
-                                }
-                                orderOutItemDto.setSiteNo(basStation.getStationName());
-                            } else {
-                                throw new CoolException("鏈壘鍒扮鍚堟潯浠剁珯鐐癸紒锛侊紒璇锋鏌ヨ矾寰勭鐞嗭紒锛侊紒");
-                            }
-
-                            orderOutItemDto.setSource(item.getItemId().toString())
-                                    .setTargSiteAreaList(new ArrayList<>())
-                                    .setSourceId(item.getWaveId().toString());
-                            list.add(orderOutItemDto);
-
-                            locList.add(loc);
-                            issued = issued.subtract(new BigDecimal(locItem.getAnfme().toString()));
+                            throw new CoolException("鏈壘鍒扮鍚堟潯浠跺嚭搴撶珯鐐瑰尯鍩燂紒锛侊紒璇锋鏌ュ簱鍖洪厤缃紒锛侊紒");
                         }
-//                         if (true){
-////                            throw new CoolException("鏈壘鍒扮鍚堟潯浠剁珯鐐癸紒锛侊紒璇锋鏌ュ簱鍖洪厤缃紒锛侊紒");
-//                        }
                     }
                 }
             }
         }
 
         return list;
-    }
-
-
-
-
-    //鏍规嵁鏉$爜鑾峰彇瑙勫垯
-    private static BasContainer getContainerType(String barcode) {
-        BasContainerService basContainerService = SpringUtils.getBean(BasContainerService.class);
-        if (Cools.isEmpty(barcode)) {
-            throw new CoolException("瀹瑰櫒鐮佷笉鑳戒负绌�");
-        }
-        List<BasContainer> containers = basContainerService.list(new LambdaQueryWrapper<>());
-        for (BasContainer container : containers) {
-            String codeType = container.getCodeType();  // 鑾峰彇姝e垯琛ㄨ揪寮�
-            if (barcode.matches(codeType)) {  // 鍒ゆ柇鏉$爜鏄惁绗﹀悎杩欎釜姝e垯
-                return container;
-            }
-        }
-        throw new CoolException("瀹瑰櫒鐮�:"+barcode+"寮傚父==>鏈壘鍒板尮閰嶇殑瑙勫垯");
     }
 
 }

--
Gitblit v1.9.1