From d2038a623e02c2d7bb6b95a908832c0432adf2f0 Mon Sep 17 00:00:00 2001
From: huminmin <mac@MacBook-Pro.local>
Date: 星期四, 21 五月 2026 13:46:21 +0800
Subject: [PATCH] 增加日志

---
 src/main/java/com/ruoyi/sales/controller/SalesLedgerProductController.java |  110 ++++++++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 92 insertions(+), 18 deletions(-)

diff --git a/src/main/java/com/ruoyi/sales/controller/SalesLedgerProductController.java b/src/main/java/com/ruoyi/sales/controller/SalesLedgerProductController.java
index a42f2b4..a227225 100644
--- a/src/main/java/com/ruoyi/sales/controller/SalesLedgerProductController.java
+++ b/src/main/java/com/ruoyi/sales/controller/SalesLedgerProductController.java
@@ -1,29 +1,31 @@
 package com.ruoyi.sales.controller;
 
-import javax.servlet.http.HttpServletResponse;
-
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ruoyi.common.utils.poi.ExcelUtil;
-import com.ruoyi.sales.pojo.SalesLedgerProduct;
-import com.ruoyi.sales.service.ISalesLedgerProductService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
 import com.ruoyi.framework.aspectj.lang.annotation.Log;
 import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
 import com.ruoyi.framework.web.controller.BaseController;
 import com.ruoyi.framework.web.domain.AjaxResult;
-import com.ruoyi.framework.web.page.TableDataInfo;
+import com.ruoyi.framework.web.domain.R;
+import com.ruoyi.procurementrecord.service.ProcurementRecordService;
+import com.ruoyi.procurementrecord.utils.StockUtils;
+import com.ruoyi.sales.dto.SalesLedgerProductDto;
+import com.ruoyi.sales.pojo.SalesLedgerProduct;
+import com.ruoyi.sales.pojo.ShippingInfo;
+import com.ruoyi.sales.service.ISalesLedgerProductService;
+import com.ruoyi.sales.service.ShippingInfoService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
 
+import javax.servlet.http.HttpServletResponse;
+import java.math.BigDecimal;
 import java.util.List;
 
 /**
  * 浜у搧淇℃伅Controller
- * 
+ *
  * @author ruoyi
  * @date 2025-05-08
  */
@@ -33,16 +35,80 @@
 {
     @Autowired
     private ISalesLedgerProductService salesLedgerProductService;
+    @Autowired
+    private ProcurementRecordService procurementRecordService;
+    @Autowired
+    private StockUtils stockUtils;
+    @Autowired
+    private ShippingInfoService shippingInfoService;
+
+
+    /**
+     * 鍥炴鐧昏鍒嗛〉鏌ヨ
+     */
+    @GetMapping("/listPageSalesLedger")
+    @Log(title = "鍥炴鐧昏鍒嗛〉鏌ヨ", businessType = BusinessType.OTHER)
+    public AjaxResult listPage(Page page, SalesLedgerProductDto salesLedgerProduct) {
+        IPage<SalesLedgerProductDto> list = salesLedgerProductService.listPage(page,salesLedgerProduct);
+        return AjaxResult.success(list);
+    }
+
+
+    /**
+     * 浠樻鐧昏鍒嗛〉鏌ヨ
+     */
+    @GetMapping("/listPagePurchaseLedger")
+    @Log(title = "浠樻鐧昏鍒嗛〉鏌ヨ", businessType = BusinessType.OTHER)
+    public AjaxResult listPagePurchaseLedger(Page page, SalesLedgerProductDto salesLedgerProduct) {
+        IPage<SalesLedgerProductDto> list = salesLedgerProductService.listPagePurchaseLedger(page,salesLedgerProduct);
+        return AjaxResult.success(list);
+    }
+
 
     /**
      * 鏌ヨ浜у搧淇℃伅鍒楄〃
      */
     @GetMapping("/list")
-    public TableDataInfo list(SalesLedgerProduct salesLedgerProduct)
-    {
-        startPage();
+    @Log(title = "鏌ヨ浜у搧淇℃伅鍒楄〃", businessType = BusinessType.OTHER)
+    public AjaxResult list(SalesLedgerProduct salesLedgerProduct) {
         List<SalesLedgerProduct> list = salesLedgerProductService.selectSalesLedgerProductList(salesLedgerProduct);
-        return getDataTable(list);
+        list.forEach(item -> {
+            List<ShippingInfo> shippings = shippingInfoService.list(new LambdaQueryWrapper<ShippingInfo>()
+                    .eq(ShippingInfo::getSalesLedgerId, salesLedgerProduct.getSalesLedgerId())
+                    .eq(ShippingInfo::getSalesLedgerProductId, item.getId()));
+            BigDecimal total = shippings.stream().map(ShippingInfo::getShippedQty).reduce(BigDecimal.ZERO, BigDecimal::add);
+            item.setShippedQty(total);
+            if (total.compareTo(BigDecimal.ZERO) == 0) {
+                item.setShippingStatus("寰呭彂璐�");
+            }
+            if (total.compareTo(item.getQuantity()) == 0) {
+                item.setShippingStatus("宸插彂璐�");
+            }
+            if (total.compareTo(item.getQuantity()) < 0) {
+                item.setShippingStatus("鍙戣揣涓�");
+            }
+            if (item.getFutureTickets().compareTo(BigDecimal.ZERO) == 0) {
+                item.setFutureTickets(BigDecimal.ZERO);
+            }
+            if (item.getFutureTicketsAmount().compareTo(BigDecimal.ZERO) == 0) {
+                item.setFutureTicketsAmount(BigDecimal.ZERO);
+            }
+//            ProcurementPageDto procurementDto = new ProcurementPageDto();
+//            procurementDto.setSalesLedgerProductId(item.getId());
+//            procurementDto.setProductCategory(item.getProductCategory());
+//            IPage<ProcurementPageDtoCopy> result = procurementRecordService.listPageCopyByProduction(new Page<>(1,-1), procurementDto);
+//            BigDecimal stockQuantity = stockUtils.getStockQuantity(item.getProductModelId()).get("stockQuantity");
+
+//                ProcurementPageDtoCopy procurementDtoCopy = result.getRecords().get(0);
+            if (item.getApproveStatus() != 2) {
+                if (item.getHasSufficientStock() == 0) {
+                    item.setApproveStatus(0);
+                } else {
+                    item.setApproveStatus(1);
+                }
+            }
+        });
+        return AjaxResult.success(list);
     }
 
     /**
@@ -61,6 +127,7 @@
      * 鑾峰彇浜у搧淇℃伅璇︾粏淇℃伅
      */
     @GetMapping(value = "/{id}")
+    @Log(title = "鏌ヨ浜у搧淇℃伅璇︾粏淇℃伅", businessType = BusinessType.OTHER)
     public AjaxResult getInfo(@PathVariable("id") Long id)
     {
         return success(salesLedgerProductService.selectSalesLedgerProductById(id));
@@ -88,4 +155,11 @@
         }
         return toAjax(salesLedgerProductService.deleteSalesLedgerProductByIds(ids));
     }
+
+    //鏍规嵁浜у搧id鑾峰彇bom鍒ゆ柇搴撳瓨鏄惁鍏呰冻
+    @GetMapping("/judgmentInventory")
+    @Log(title = "鍒ゆ柇搴撳瓨鏄惁鍏呰冻", businessType = BusinessType.OTHER)
+    public R judgmentInventory(SalesLedgerProduct salesLedgerProduct) {
+        return  salesLedgerProductService.judgmentInventory(salesLedgerProduct);
+    }
 }

--
Gitblit v1.9.3