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/ShippingInfoController.java |   23 ++++++++++++++---------
 1 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/src/main/java/com/ruoyi/sales/controller/ShippingInfoController.java b/src/main/java/com/ruoyi/sales/controller/ShippingInfoController.java
index 4f00394..b92c9b0 100644
--- a/src/main/java/com/ruoyi/sales/controller/ShippingInfoController.java
+++ b/src/main/java/com/ruoyi/sales/controller/ShippingInfoController.java
@@ -28,7 +28,6 @@
 import com.ruoyi.sales.pojo.SalesLedgerProduct;
 // import com.ruoyi.sales.pojo.ShipmentApproval;
 import com.ruoyi.sales.pojo.ShippingInfo;
-import com.ruoyi.sales.service.ISalesLedgerProductService;
 import com.ruoyi.sales.service.ISalesLedgerService;
 import com.ruoyi.sales.service.ShippingInfoService;
 // import com.ruoyi.sales.service.impl.CommonFileServiceImpl;
@@ -67,9 +66,6 @@
     // private StockUtils stockUtils;
 
     @Autowired
-    private ISalesLedgerProductService salesLedgerProductService;
-
-    @Autowired
     private ISalesLedgerService salesLedgerService;
 
     @Autowired
@@ -99,6 +95,15 @@
             return AjaxResult.error("鍏宠仈璁㈠崟涓嶅瓨鍦�");
         }
 
+        // 鍙戣揣鍓嶅繀椤讳繚璇佽璁㈠崟鎵�鏈変骇鍝佸凡鍏ュ簱
+        List<SalesLedgerProduct> notStocked = salesLedgerProductMapper.selectList(new LambdaQueryWrapper<SalesLedgerProduct>()
+                .eq(SalesLedgerProduct::getSalesLedgerId, salesLedger.getId())
+                .eq(SalesLedgerProduct::getType, 1)
+                .ne(SalesLedgerProduct::getProductStockStatus, 2));
+        if (CollectionUtils.isNotEmpty(notStocked)) {
+            return AjaxResult.error("鍙戣揣澶辫触,璇ラ攢鍞鍗曞瓨鍦ㄦ湭鍏ュ簱浜у搧,璇峰厛瀹屾垚鍏ㄩ儴鍏ュ簱鍚庡啀鍙戣揣");
+        }
+
         // 妫�鏌ユ槸鍚﹀凡缁忓湪瀹℃壒涓垨宸插彂璐�
         if (salesLedger.getDeliveryStatus() != null && salesLedger.getDeliveryStatus() >= 2 && !salesLedger.getDeliveryStatus().equals(3)) {
              return AjaxResult.error("璇ヨ鍗曞凡鍦ㄥ鎵逛腑鎴栧凡鍙戣揣锛屾棤娉曢噸澶嶅彂璧�");
@@ -124,7 +129,7 @@
         //  涓鸿鍗曚笅鐨勬瘡涓�涓骇鍝佺敓鎴愬彂璐у彴璐﹁褰� (鏄剧ず鍗曚釜浜у搧)
         List<SalesLedgerProduct> products = salesLedgerProductMapper.selectList(new LambdaQueryWrapper<SalesLedgerProduct>()
                 .eq(SalesLedgerProduct::getSalesLedgerId, salesLedger.getId()));
-        
+
         if (CollectionUtils.isNotEmpty(products)) {
             for (SalesLedgerProduct product : products) {
                 ShippingInfo si = new ShippingInfo();
@@ -132,7 +137,7 @@
                 si.setSalesLedgerProductId(product.getId());
                 si.setShippingNo(shNo);
                 si.setStatus("寰呭鏍�");
-                si.setType(req.getType()); // 鏉ユ簮/绫诲瀷
+                si.setType(req.getType());
                 shippingInfoService.save(si);
             }
         }
@@ -178,9 +183,9 @@
      */
     @PostMapping("/export")
     @ApiOperation("瀵煎嚭鍙戣揣淇℃伅")
-    public void export(HttpServletResponse response) {
-        List<ShippingInfo> list = shippingInfoMapper.listAll();
-        ExcelUtil<ShippingInfo> util = new ExcelUtil<ShippingInfo>(ShippingInfo.class);
+    public void export(ShippingInfo req, HttpServletResponse response) {
+        List<ShippingInfoDto> list = shippingInfoMapper.exportList(req);
+        ExcelUtil<ShippingInfoDto> util = new ExcelUtil<ShippingInfoDto>(ShippingInfoDto.class);
         util.exportExcel(response, list, "鍙戣揣淇℃伅");
     }
 

--
Gitblit v1.9.3