From e877563a0916d1bec2472bbbed04ab17f0921ec4 Mon Sep 17 00:00:00 2001
From: chen.lin <1442464845@qq.com>
Date: 星期一, 09 三月 2026 16:57:56 +0800
Subject: [PATCH] 删除调试代码

---
 rsf-server/src/main/java/com/vincent/rsf/server/manager/utils/LocManageUtil.java |  155 ++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 103 insertions(+), 52 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 cd7487f..c96cda2 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
@@ -243,82 +243,133 @@
                                 .apply("JSON_CONTAINS(container_type, {0}) = 1", containerType.getContainerType().toString())//瀹瑰櫒绫诲瀷
                                 .eq(BasStationArea::getDeleted, 0));
 //                                .apply("JSON_CONTAINS(station_alias, '\"{0}\"') = 1", null)//鍖哄煙鍖呭惈绔欑偣闆�
-                        if (basStationAreas.isEmpty()){
-                            throw new CoolException("鏈壘鍒扮鍚堟潯浠剁珯鐐癸紒锛侊紒璇锋鏌ュ簱鍖洪厤缃紒锛侊紒");
-                        }
-                        List<String> targSiteAreaList = new ArrayList<>();
-                        for (BasStationArea basStationArea : basStationAreas) {
-                            if (basStationArea.getStationAliasStaNo().isEmpty()){
-                                continue;
+                        if (!basStationAreas.isEmpty()){
+                            List<String> targSiteAreaList = new ArrayList<>();
+                            for (BasStationArea basStationArea : basStationAreas) {
+                                if (basStationArea.getStationAliasStaNo().isEmpty()){
+                                    continue;
+                                }
+                                targSiteAreaList.add(basStationArea.getId().toString());
                             }
-                            targSiteAreaList.add(basStationArea.getId().toString());
-                        }
-                        if (targSiteAreaList.isEmpty()){
-                            throw new CoolException("鏈壘鍒扮鍚堟潯浠剁珯鐐癸紒锛侊紒璇锋鏌ュ簱鍖洪厤缃紒锛侊紒");
-                        }
-                        int count = 0;
-                        for (BasStationArea basStationArea : basStationAreas) {
-                            count++;
-                            if (!basStationArea.getStationAliasStaNo().isEmpty()) {
+                            if (targSiteAreaList.isEmpty()){
+                                throw new CoolException("鏈壘鍒扮鍚堟潯浠剁珯鐐癸紒锛侊紒璇锋鏌ュ簱鍖洪厤缃紒锛侊紒");
+                            }
+                            int count = 0;
+                            for (BasStationArea basStationArea : basStationAreas) {
+                                count++;
+                                if (!basStationArea.getStationAliasStaNo().isEmpty()) {
+                                    List<OrderOutItemDto.staListDto> maps = new ArrayList<>();
+                                    for (String site : basStationArea.getStationAliasStaNo()) {
+                                        OrderOutItemDto.staListDto staListDto = new OrderOutItemDto.staListDto();
+                                        staListDto.setStaNo(site);
+                                        staListDto.setStaName(site);
+                                        maps.add(staListDto);
+                                    }
+                                    orderOutItemDto.setStaNos(maps);
+                                    //鑾峰彇婊¤冻鏉′欢绔欑偣
+                                    Set<String> stationSet = new HashSet<>(basStationArea.getStationAliasStaNo());
+//                                Set<String> stationSet = basStationArea.getStationAlias().stream().collect(Collectors.toSet());
+//                                Set<String> stationSet = deviceSites.stream().map(DeviceSite::getSite).collect(Collectors.toSet());
+                                    //宸蹭娇鐢ㄧ珯鐐�
+                                    Set<String> stas = stations.stream().map(BasStation::getStationName).collect(Collectors.toSet());
+                                    if (stas.size() == maps.size()) {
+                                        stations = new ArrayList<>();
+                                        stas = stations.stream().map(BasStation::getStationName).collect(Collectors.toSet());
+                                    }
+                                    BasStationService basStationService = SpringUtils.getBean(BasStationService.class);
+                                    BasStation basStation = basStationService.getOne(new LambdaQueryWrapper<BasStation>()
+                                            .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)) {
+                                        stations.add(basStation);
+                                    }
+
+                                    if (count == basStationAreas.size()) {
+                                        if (!Objects.isNull(basStation)) {
+                                            orderOutItemDto.setTargSiteAreaNow(basStationArea.getStationAreaId());
+                                            orderOutItemDto.setSiteNo(basStation.getStationName());
+//                                        throw new CoolException("绔欓粸涓嶅瓨鍦紒锛�");
+                                        } else if (!stas.isEmpty()) {
+                                            orderOutItemDto.setTargSiteAreaNow(basStationArea.getStationAreaId());
+                                            orderOutItemDto.setSiteNo(basStationArea.getStationAliasStaNo().get(0));
+                                        } else {
+                                            throw new CoolException("鏈壘鍒扮鍚堟潯浠剁珯鐐癸紒锛侊紒璇锋鏌ュ簱鍖烘垨鑰呰矾寰勯厤缃紒锛侊紒");
+                                        }
+                                    } else {
+                                        if (Objects.isNull(basStation)) {
+                                            continue;
+//                                        throw new CoolException("绔欓粸涓嶅瓨鍦紒锛�");
+                                        }
+                                        orderOutItemDto.setTargSiteAreaNow(basStationArea.getStationAreaId());
+                                        orderOutItemDto.setSiteNo(basStation.getStationName());
+                                    }
+
+                                }
+
+                                orderOutItemDto.setSource(item.getItemId().toString())
+                                        .setTargSiteAreaList(targSiteAreaList)
+                                        .setSourceId(item.getWaveId().toString());
+                                list.add(orderOutItemDto);
+                                locList.add(loc);
+
+                                issued = issued.subtract(new BigDecimal(locItem.getAnfme().toString()));
+                                break;
+                            }
+                        } 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 (String site : basStationArea.getStationAliasStaNo()) {
+                                for (DeviceSite sta : deviceSites) {
                                     OrderOutItemDto.staListDto staListDto = new OrderOutItemDto.staListDto();
-                                    staListDto.setStaNo(site);
-                                    staListDto.setStaName(site);
+                                    staListDto.setStaNo(sta.getSite());
+                                    staListDto.setStaName(sta.getSite());
                                     maps.add(staListDto);
                                 }
                                 orderOutItemDto.setStaNos(maps);
                                 //鑾峰彇婊¤冻鏉′欢绔欑偣
-                                Set<String> stationSet = new HashSet<>(basStationArea.getStationAliasStaNo());
-//                                Set<String> stationSet = basStationArea.getStationAlias().stream().collect(Collectors.toSet());
-//                                Set<String> stationSet = deviceSites.stream().map(DeviceSite::getSite).collect(Collectors.toSet());
+                                Set<String> stationSet = deviceSites.stream().map(DeviceSite::getSite).collect(Collectors.toSet());
                                 //宸蹭娇鐢ㄧ珯鐐�
                                 Set<String> stas = stations.stream().map(BasStation::getStationName).collect(Collectors.toSet());
-                                if (stas.size() == maps.size()) {
-                                    stations = new ArrayList<>();
-                                    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)) {
+
+                                if (Objects.isNull(basStation)) {
+                                    throw new CoolException("绔欓粸涓嶅瓨鍦紒锛�");
+                                }
+                                if (basStation.getType()!=0){
                                     stations.add(basStation);
                                 }
-
-                                if (count == basStationAreas.size()) {
-                                    if (!Objects.isNull(basStation)) {
-                                        orderOutItemDto.setTargSiteAreaNow(basStationArea.getStationAreaId());
-                                        orderOutItemDto.setSiteNo(basStation.getStationName());
-//                                        throw new CoolException("绔欓粸涓嶅瓨鍦紒锛�");
-                                    } else if (!stas.isEmpty()) {
-                                        orderOutItemDto.setTargSiteAreaNow(basStationArea.getStationAreaId());
-                                        orderOutItemDto.setSiteNo(basStationArea.getStationAliasStaNo().get(0));
-                                    } else {
-                                        throw new CoolException("鏈壘鍒扮鍚堟潯浠剁珯鐐癸紒锛侊紒璇锋鏌ュ簱鍖烘垨鑰呰矾寰勯厤缃紒锛侊紒");
-                                    }
-                                } else {
-                                    if (Objects.isNull(basStation)) {
-                                        continue;
-//                                        throw new CoolException("绔欓粸涓嶅瓨鍦紒锛�");
-                                    }
-                                    orderOutItemDto.setTargSiteAreaNow(basStationArea.getStationAreaId());
-                                    orderOutItemDto.setSiteNo(basStation.getStationName());
-                                }
-
+                                orderOutItemDto.setSiteNo(basStation.getStationName());
+                            } else {
+                                throw new CoolException("鏈壘鍒扮鍚堟潯浠剁珯鐐癸紒锛侊紒璇锋鏌ヨ矾寰勭鐞嗭紒锛侊紒");
                             }
 
                             orderOutItemDto.setSource(item.getItemId().toString())
-                                    .setTargSiteAreaList(targSiteAreaList)
+                                    .setTargSiteAreaList(new ArrayList<>())
                                     .setSourceId(item.getWaveId().toString());
                             list.add(orderOutItemDto);
-                            locList.add(loc);
 
+                            locList.add(loc);
                             issued = issued.subtract(new BigDecimal(locItem.getAnfme().toString()));
-                            break;
                         }
+//                         if (true){
+////                            throw new CoolException("鏈壘鍒扮鍚堟潯浠剁珯鐐癸紒锛侊紒璇锋鏌ュ簱鍖洪厤缃紒锛侊紒");
+//                        }
                     }
                 }
             }
@@ -343,7 +394,7 @@
                 return container;
             }
         }
-        return null;
+        throw new CoolException("瀹瑰櫒鐮�:"+barcode+"寮傚父==>鏈壘鍒板尮閰嶇殑瑙勫垯");
     }
 
 }

--
Gitblit v1.9.1