From 29de5e9bf0fcd2771836f3135214e9de9e7f5204 Mon Sep 17 00:00:00 2001
From: 1 <1@123>
Date: 星期三, 14 一月 2026 16:46:55 +0800
Subject: [PATCH] lsh#

---
 rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/PdaOutStockServiceImpl.java |   76 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 76 insertions(+), 0 deletions(-)

diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/PdaOutStockServiceImpl.java b/rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/PdaOutStockServiceImpl.java
index e9cee6b..893c0c6 100644
--- a/rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/PdaOutStockServiceImpl.java
+++ b/rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/PdaOutStockServiceImpl.java
@@ -1,16 +1,21 @@
 package com.vincent.rsf.server.api.service.impl;
 
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.generator.config.IFileCreate;
 import com.vincent.rsf.framework.common.Cools;
 import com.vincent.rsf.framework.common.R;
 import com.vincent.rsf.framework.exception.CoolException;
 import com.vincent.rsf.server.api.entity.dto.ContainerWaveDto;
+import com.vincent.rsf.server.api.entity.params.CallForEmptyContainersParam;
 import com.vincent.rsf.server.api.entity.params.ContainerWaveParam;
 import com.vincent.rsf.server.api.service.PdaOutStockService;
 import com.vincent.rsf.server.manager.entity.*;
 import com.vincent.rsf.server.manager.enums.AsnExceStatus;
+import com.vincent.rsf.server.manager.enums.StationTypeEnum;
 import com.vincent.rsf.server.manager.enums.TaskStsType;
 import com.vincent.rsf.server.manager.service.*;
+import com.vincent.rsf.server.manager.service.impl.BasContainerServiceImpl;
 import lombok.Synchronized;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -37,6 +42,12 @@
     private AsnOrderItemService asnOrderItemService;
     @Autowired
     private WaveOrderRelaService waveOrderRelaService;
+    @Autowired
+    private BasStationService basStationService;
+    @Autowired
+    private LocService locService;
+    @Autowired
+    private BasContainerServiceImpl basContainerService;
 
     @Override
     public R getOutStockTaskItem(String barcode) {
@@ -215,6 +226,71 @@
         return R.ok();
     }
 
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    @Synchronized
+    public R callForEmptyContainers(CallForEmptyContainersParam containerWaveParam, Long loginUserId) {
+        // 鍙傛暟鏍¢獙
+        if (Objects.isNull(containerWaveParam) || StringUtils.isEmpty(containerWaveParam.getStaNo())) {
+            throw new CoolException("鍙傛暟閿欒锛岀珯鐐瑰彿涓嶈兘涓虹┖");
+        }
+        // 1. 绔欑偣淇℃伅鍒ゆ柇 - 缁堢偣
+        BasStation basStation = basStationService.getOne(new LambdaQueryWrapper<BasStation>()
+                .eq(BasStation::getStationName, containerWaveParam.getStaNo())
+                .orderByDesc(BasStation::getId)
+                .last("LIMIT 1"), false);
+
+        if (Objects.isNull(basStation)) {
+            throw new CoolException(containerWaveParam.getStaNo() + "绔欑偣涓嶅瓨鍦紒锛�");
+        }
+        if (!basStation.getUseStatus().equals("O")) {
+            throw new CoolException("绔欑偣鐘舵�佷笉涓虹┖闂�");
+        }
+
+        List<Long> areaList = JSONObject.parseArray(basStation.getCrossZoneArea(), Long.class);
+        if (Cools.isEmpty(areaList)){
+            throw new CoolException("褰撳墠绔欑偣搴撳尯鏈厤缃�");
+        }
+
+        BasContainer basContainer = basContainerService.getOne(new LambdaQueryWrapper<BasContainer>()
+                        .in(BasContainer::getContainerType, containerWaveParam.getType(), false));
+        if (Cools.isEmpty(basContainer)){
+            throw new CoolException("鏈煡璇㈠埌鐩稿叧瀹瑰櫒瑙勫垯");
+        }
+        String barcodeType = "barcode REGEXP "+basContainer.getCodeType();
+        //瀹瑰櫒绫诲瀷鏌ヨ  璧风偣
+        Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>()
+                        .apply(barcodeType)
+                        .eq(Loc::getDeleted, 0)
+                        .eq(Loc::getStatus, 1)
+                        .in(Loc::getAreaId, areaList)
+                        .eq(Loc::getUseStatus, "O")
+                        .orderByDesc(Loc::getId)
+                        .last("LIMIT 1"),
+                false);
+
+        if (Cools.isEmpty(loc)){
+            throw new CoolException("鏈煡璇㈠埌绗﹀悎鏉′欢鐨勬墭鐩�");
+        }
+//        if (basStation.getType().equals(StationTypeEnum.STATION_TYPE_MUTI.type)) {
+//            //鍏夌數绔欑偣锛�
+//            Long area = basStation.getArea();
+//            //鏄惁闇�瑕佽浆闈炲厜鐢电珯鐐�
+//            //绔嬪簱鍑哄簱==銆嬬粨鏉�
+//            //AGV==銆嬬珛搴�==銆嬬粨鏉�
+//        } else {
+//            //闈炲厜鐢电珯鐐�
+//            //鏄惁闇�瑕佽浆鍏夌數绔欑偣
+//            //AGV==銆嬬粨鏉�
+//            //绔嬪簱鍑哄簱==銆婣GV==銆嬬粨鏉�
+//
+//        }
+
+        return R.ok().add(loc);
+    }
+
+
+
 
     private Boolean checkWaveComplete(TaskItem taskItem) {
         Wave wave = waveService.getById(taskItem.getSourceId());

--
Gitblit v1.9.1