From 98d88ac8caf7f0991d741079474c262f1e252927 Mon Sep 17 00:00:00 2001
From: chen.lin <1442464845@qq.com>
Date: 星期五, 06 三月 2026 08:14:54 +0800
Subject: [PATCH] 拣货过程中的出库库存匹配

---
 rsf-server/src/main/java/com/vincent/rsf/server/api/controller/WcsController.java |   64 ++++++++++++++++++++++++++++++-
 1 files changed, 61 insertions(+), 3 deletions(-)

diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/api/controller/WcsController.java b/rsf-server/src/main/java/com/vincent/rsf/server/api/controller/WcsController.java
index f8be5e6..68408c0 100644
--- a/rsf-server/src/main/java/com/vincent/rsf/server/api/controller/WcsController.java
+++ b/rsf-server/src/main/java/com/vincent/rsf/server/api/controller/WcsController.java
@@ -7,12 +7,22 @@
 import com.vincent.rsf.server.api.entity.params.ExMsgParams;
 import com.vincent.rsf.server.api.entity.params.WcsTaskParams;
 import com.vincent.rsf.server.common.annotation.OperationLog;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.vincent.rsf.server.common.domain.BaseParam;
+import com.vincent.rsf.server.common.domain.PageParam;
+import com.vincent.rsf.server.manager.controller.params.LocToTaskParams;
+import com.vincent.rsf.server.manager.entity.Loc;
+import com.vincent.rsf.server.manager.enums.LocStsType;
 import com.vincent.rsf.server.manager.enums.TaskType;
+import com.vincent.rsf.server.manager.service.LocItemService;
+import com.vincent.rsf.server.manager.service.LocService;
 import com.vincent.rsf.server.api.service.WcsService;
+import com.vincent.rsf.server.common.constant.Constants;
 import com.vincent.rsf.server.system.controller.BaseController;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -27,7 +37,23 @@
 
     @Autowired
     private WcsService wcsService;
+    @Autowired
+    private LocItemService locItemService;
+    @Autowired
+    private LocService locService;
 
+
+    @ApiOperation("绌烘澘搴撲綅鍒楄〃锛堝垎椤碉級锛屼粎杩斿洖 useStatus=D 鐨勫簱浣嶏紝鐢ㄤ簬绌烘澘鍑哄簱椤靛嬀閫�")
+    @PreAuthorize("hasAuthority('manager:emptyOutbound:list')")
+    @PostMapping("/empty/locs/page")
+    public R emptyLocsPage(@RequestBody Map<String, Object> map) {
+        BaseParam baseParam = buildParam(map, BaseParam.class);
+        PageParam<Loc, BaseParam> pageParam = new PageParam<>(baseParam, Loc.class);
+        LambdaQueryWrapper<Loc> qw = new LambdaQueryWrapper<Loc>()
+                .eq(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_D.type)
+                .orderByAsc(Loc::getId);
+        return R.ok().add(locService.page(pageParam, qw));
+    }
 
     @ApiOperation(value = "wcs鐢熸垚鍏ュ簱浠诲姟鎺ュ彛")
     @PostMapping("/create/in/task")
@@ -138,7 +164,14 @@
         String barcode = (String) params.get("barcode");
         String staNo = (String) params.get("staNo");
         Integer type = params.get("type") != null ? Integer.valueOf(params.get("type").toString()) : null;
-        
+        Boolean full = null;
+        if (params.get("full") != null) {
+            if (params.get("full") instanceof Boolean) {
+                full = (Boolean) params.get("full");
+            } else {
+                full = Boolean.parseBoolean(params.get("full").toString());
+            }
+        }
         if (Cools.isEmpty(barcode)) {
             return R.error("鏂欑鐮佷笉鑳戒负绌猴紒锛�");
         }
@@ -148,8 +181,33 @@
         if (type == null) {
             return R.error("鍏ュ簱绫诲瀷涓嶈兘涓虹┖锛侊紒");
         }
-        
-        return wcsService.allocateLocation(barcode, staNo, type);
+        return wcsService.allocateLocation(barcode, staNo, type, full);
+    }
+
+    @ApiOperation("绌烘澘鍑哄簱锛氫粠鎸囧畾绌烘澘搴撲綅鐢熸垚鍑哄簱浠诲姟鑷崇洰鏍囩珯鐐�")
+    @PreAuthorize("hasAuthority('manager:emptyOutbound:list')")
+    @PostMapping("/empty/outbound")
+    public R emptyOutbound(@RequestBody Map<String, Object> params) {
+        if (Cools.isEmpty(params)) {
+            return R.error("鍙傛暟涓嶈兘涓虹┖锛侊紒");
+        }
+        String staNo = (String) params.get("staNo");
+        String orgLoc = (String) params.get("orgLoc");
+        if (Cools.isEmpty(staNo)) {
+            return R.error("鐩爣绔欑偣 staNo 涓嶈兘涓虹┖锛侊紒");
+        }
+        if (Cools.isEmpty(orgLoc)) {
+            return R.error("婧愬簱浣� orgLoc 涓嶈兘涓虹┖锛侊紒");
+        }
+        LocToTaskParams map = new LocToTaskParams();
+        map.setSiteNo(staNo);
+        map.setOrgLoc(orgLoc);
+        map.setType(Constants.TASK_TYPE_OUT_STOCK_EMPTY);
+        Long userId = getLoginUserId();
+        if (userId == null) {
+            userId = 1L;
+        }
+        return R.ok("绌烘澘鍑哄簱浠诲姟鍒涘缓鎴愬姛").add(locItemService.generateTaskEmpty(map, userId));
     }
 
 

--
Gitblit v1.9.1