From 450320f28d8db37264d7fc448c01fb32f64610b2 Mon Sep 17 00:00:00 2001
From: skyouc
Date: 星期四, 13 十一月 2025 16:53:06 +0800
Subject: [PATCH] 波次出库修改

---
 rsf-server/src/main/java/com/vincent/rsf/server/manager/utils/LocManageUtil.java |   58 ++++++++++++++++++++++++++++++----------------------------
 1 files changed, 30 insertions(+), 28 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 cc667d6..f16250a 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
@@ -13,7 +13,7 @@
 import com.vincent.rsf.server.manager.enums.WaveRuleType;
 import com.vincent.rsf.server.manager.service.*;
 import com.vincent.rsf.server.manager.enums.LocStsType;
-import io.swagger.models.auth.In;
+
 import org.apache.commons.lang3.StringUtils;
 
 import javax.swing.*;
@@ -158,7 +158,8 @@
         List<OrderOutItemDto> list = new ArrayList<>();
         //涓嶈绔欑偣閲嶅浣跨敤闂
         List<BasStation> stations = new ArrayList<>();
-        Set<ExistDto> existDtos = new HashSet<>();
+        List<ExistDto> existDtos = new ArrayList<>();
+        Set<Loc> locs = new HashSet<>();
         for (WaveToLocParams item : params) {
             BigDecimal issued = new BigDecimal(item.getAnfme().toString())
                     .subtract(new BigDecimal(item.getWorkQty().toString()));
@@ -189,41 +190,42 @@
                                 .setSource(item.getItemId());//娉㈡鏄庣粏ID
                         OrderOutItemDto orderOutItemDto = new OrderOutItemDto();
                         orderOutItemDto.setLocItem(locItem);
-
+                        orderOutItemDto.setSource(item.getItemId())
+                                .setSourceId(item.getWaveId());
                         List<DeviceSite> deviceSites = deviceSiteService.list(new LambdaQueryWrapper<DeviceSite>()
                                 .eq(!Objects.isNull(loc.getChannel()), DeviceSite::getChannel, loc.getChannel())
                                 .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>()
-                                    .eq(BasStation::getUseStatus, LocStsType.LOC_STS_TYPE_O.type)
-                                    .in(BasStation::getStationName, stationSet)
-                                    .notIn(!stas.isEmpty(), BasStation::getStationName, stas)
-                                    .last("LIMIT 1"));
-                            stations.add(basStation);
+                        if (locs.add(loc)) {
+                            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>()
+                                        .eq(BasStation::getUseStatus, LocStsType.LOC_STS_TYPE_O.type)
+                                        .in(BasStation::getStationName, stationSet)
+                                        .notIn(!stas.isEmpty(), BasStation::getStationName, stas)
+                                        .last("LIMIT 1"));
+                                stations.add(basStation);
 
-                            if (Objects.isNull(basStation)) {
-                                throw new CoolException("绔欓粸涓嶅瓨鍦紒锛�");
+                                if (Objects.isNull(basStation)) {
+                                    throw new CoolException("绔欓粸涓嶅瓨鍦紒锛�");
+                                }
+                                orderOutItemDto.setSitesNo(basStation.getStationName());
                             }
-                            orderOutItemDto.setSitesNo(basStation.getStationName());
                         }
 
-                        orderOutItemDto.setSource(item.getItemId())
-                                .setSourceId(item.getWaveId());
 
                         list.add(orderOutItemDto);
 

--
Gitblit v1.9.1