From c16a5f590db461391a4441e520f3264526c11905 Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期一, 15 六月 2026 13:13:56 +0800
Subject: [PATCH] feat(sales): 优化发货信息管理功能

---
 src/main/java/com/ruoyi/sales/controller/SalesLedgerController.java |  137 +++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 135 insertions(+), 2 deletions(-)

diff --git a/src/main/java/com/ruoyi/sales/controller/SalesLedgerController.java b/src/main/java/com/ruoyi/sales/controller/SalesLedgerController.java
index 26c14a5..10cc97c 100644
--- a/src/main/java/com/ruoyi/sales/controller/SalesLedgerController.java
+++ b/src/main/java/com/ruoyi/sales/controller/SalesLedgerController.java
@@ -23,9 +23,11 @@
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.util.CollectionUtils;
+import org.springframework.util.StringUtils;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
+import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.FileNotFoundException;
 import java.io.IOException;
@@ -161,6 +163,30 @@
     }
 
     /**
+     * 瀵煎嚭閿�鍞彴璐﹀垪琛紙鍖呭惈浜у搧鏄庣粏锛屼袱涓猻heet椤碉級
+     */
+    @Log(title = "閿�鍞彴璐�", businessType = BusinessType.EXPORT)
+    @PostMapping("/exportWithProducts")
+    @ApiOperation("瀵煎嚭閿�鍞彴璐﹀強浜у搧鏄庣粏锛堜袱涓猻heet椤碉級")
+    public void exportWithProducts(HttpServletResponse response, SalesLedgerDto salesLedgerDto) {
+        salesLedgerService.exportWithProducts(response, salesLedgerDto);
+    }
+
+    /**
+     * 瀵煎嚭鍞悗鍙拌处宸ヨ壓璺嚎
+     */
+    @Log(title = "閿�鍞彴璐﹀伐鑹鸿矾绾�", businessType = BusinessType.EXPORT)
+    @PostMapping("/exportProcessRoute")
+    @ApiOperation("瀵煎嚭鍞悗鍙拌处宸ヨ壓璺嚎")
+    public void exportProcessRoute(HttpServletResponse response,
+                                   HttpServletRequest request,
+                                   @RequestParam(value = "completedTimeStart", required = false) String completedTimeStart,
+                                   @RequestParam(value = "completedTimeEnd", required = false) String completedTimeEnd) {
+        List<Long> salesLedgerIds = parseSalesLedgerIds(request);
+        salesLedgerService.exportProcessRoute(response, salesLedgerIds, completedTimeStart, completedTimeEnd);
+    }
+
+    /**
      * 瀵煎嚭寮�绁ㄧ櫥璁板垪琛�
      */
     @Log(title = "瀵煎嚭寮�绁ㄧ櫥璁板垪琛�", businessType = BusinessType.EXPORT)
@@ -188,8 +214,59 @@
      */
     @PostMapping("/saleProcessBind")
     @ApiOperation("閿�鍞鍗曠粦瀹氬伐鑹鸿矾绾�")
-    public AjaxResult saleProcessBind(@RequestBody SalesLedgerProcessRoute salesLedgerProcessRoute) {
-        salesLedgerService.saleProcessBind(salesLedgerProcessRoute);
+    public AjaxResult saleProcessBind(@RequestBody SalesLedgerProcessRouteDto salesLedgerProcessRouteDto) {
+        salesLedgerService.saleProcessBind(salesLedgerProcessRouteDto);
+        return AjaxResult.success();
+    }
+
+    /**
+     * 鍙嶅鏍告搷浣�
+     */
+    @Log(title = "閿�鍞彴璐﹀弽瀹℃牳", businessType = BusinessType.UPDATE)
+    @PostMapping("/counterReview")
+    @ApiOperation("鍙嶅鏍告搷浣滐細浣滃簾鎴栭噸鏂扮敓鎴�")
+    public AjaxResult counterReview(@RequestBody CounterReviewDto dto) {
+        List<Long> newLedgerIds = salesLedgerService.counterReview(dto);
+        AjaxResult result = AjaxResult.success("鍙嶅鏍告垚鍔�");
+        if (newLedgerIds != null && !newLedgerIds.isEmpty()) {
+            result.put("newLedgerIds", newLedgerIds);
+        }
+        return result;
+    }
+
+    /**
+     * 鏍囪璁㈠崟瀹屾垚
+     */
+    @Log(title = "閿�鍞彴璐︽爣璁板畬鎴�", businessType = BusinessType.UPDATE)
+    @PostMapping("/markOrderCompleted")
+    @ApiOperation("鏍囪璁㈠崟瀹屾垚锛堜笉鍙挙閿�锛�")
+    public AjaxResult markOrderCompleted(@RequestBody Map<String, Object> params) {
+        @SuppressWarnings("unchecked")
+        List<Long> ids = ((List<Object>) params.get("ids")).stream()
+            .map(obj -> Long.valueOf(obj.toString()))
+            .collect(Collectors.toList());
+        if (ids == null || ids.isEmpty()) {
+            return AjaxResult.error("璇烽�夋嫨瑕佹爣璁板畬鎴愮殑璁㈠崟");
+        }
+        salesLedgerService.markOrderCompleted(ids);
+        return AjaxResult.success("鏍囪瀹屾垚鎴愬姛");
+    }
+
+    /**
+     * 閫掑鎵撳嵃娆℃暟
+     */
+    @PostMapping("/incrementPrintCount")
+    @ApiOperation("閫掑鎵撳嵃娆℃暟")
+    public AjaxResult incrementPrintCount(@RequestBody Map<String, Object> params) {
+        Long id = params.get("id") != null ? Long.valueOf(params.get("id").toString()) : null;
+        String printType = (String) params.get("printType");
+        if (id == null) {
+            return AjaxResult.error("閿�鍞彴璐D涓嶈兘涓虹┖");
+        }
+        if (printType == null || (!"label".equals(printType) && !"document".equals(printType))) {
+            return AjaxResult.error("鎵撳嵃绫诲瀷蹇呴』涓� label 鎴� document");
+        }
+        salesLedgerService.incrementPrintCount(id, printType);
         return AjaxResult.success();
     }
 
@@ -342,6 +419,13 @@
         return AjaxResult.success();
     }
 
+    @PostMapping("/scanShipApply")
+    @ApiOperation("閿�鍞鍗曟壂鐮�-鍙戣捣鍙戣揣瀹℃壒锛堝~鍐欒溅鐗�/蹇�掋�佸鎵逛汉銆侀檮浠讹紱閫氳繃鍚庤嚜鍔ㄦ墸搴撳瓨骞舵爣璁板凡鍙戣揣锛�")
+    public AjaxResult scanShipApply(@RequestBody SalesScanShipDto dto) {
+        salesLedgerService.scanShipApply(dto);
+        return AjaxResult.success("鍙戣揣瀹℃壒宸插彂璧�");
+    }
+
     @PostMapping("/scanOutboundUnqualified")
     @ApiOperation("閿�鍞鍗曟壂鐮�-涓嶅悎鏍煎嚭搴�")
     public AjaxResult scanOutboundUnqualified(@RequestBody SalesScanInboundDto dto) {
@@ -377,4 +461,53 @@
         excelUtil.importTemplateExcel(response, "鏈嚭搴撳鍏ユā鏉夸笅杞�");
     }
 
+    private List<Long> parseSalesLedgerIds(HttpServletRequest request) {
+        if (request == null) {
+            return Collections.emptyList();
+        }
+
+        List<Long> ids = new ArrayList<>();
+        Map<String, String[]> parameterMap = request.getParameterMap();
+        if (parameterMap == null || parameterMap.isEmpty()) {
+            return ids;
+        }
+
+        String directValue = request.getParameter("salesLedgerIds");
+        if (StringUtils.hasText(directValue)) {
+            for (String value : directValue.split(",")) {
+                addParsedLong(ids, value);
+            }
+        }
+
+        for (Map.Entry<String, String[]> entry : parameterMap.entrySet()) {
+            String key = entry.getKey();
+            if (!StringUtils.hasText(key)) {
+                continue;
+            }
+            if (!"salesLedgerIds".equals(key) && !key.startsWith("salesLedgerIds[")) {
+                continue;
+            }
+            String[] values = entry.getValue();
+            if (values == null) {
+                continue;
+            }
+            for (String value : values) {
+                addParsedLong(ids, value);
+            }
+        }
+
+        return ids.stream().filter(Objects::nonNull).distinct().collect(Collectors.toList());
+    }
+
+    private void addParsedLong(List<Long> target, String value) {
+        if (target == null || !StringUtils.hasText(value)) {
+            return;
+        }
+        try {
+            target.add(Long.valueOf(value.trim()));
+        } catch (Exception ignored) {
+            // ignore invalid id values
+        }
+    }
+
 }

--
Gitblit v1.9.3