From fe64e0bbc83ab7e89cbe0d6a9f779a4ac3919608 Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期一, 21 九月 2026 11:13:58 +0800
Subject: [PATCH] fix: 销售订单未下发/发货则可以进行编辑

---
 src/main/java/com/ruoyi/sales/mapper/SalesLedgerMapper.java |   27 +++++++++++++++++++++++++--
 1 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/src/main/java/com/ruoyi/sales/mapper/SalesLedgerMapper.java b/src/main/java/com/ruoyi/sales/mapper/SalesLedgerMapper.java
index 6e4aee6..625d615 100644
--- a/src/main/java/com/ruoyi/sales/mapper/SalesLedgerMapper.java
+++ b/src/main/java/com/ruoyi/sales/mapper/SalesLedgerMapper.java
@@ -5,10 +5,14 @@
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.home.dto.IncomeExpenseAnalysisDto;
+import com.ruoyi.purchase.vo.PurchaseReportVo;
 import com.ruoyi.sales.dto.SalesLedgerDto;
+import com.ruoyi.sales.dto.SalesLedgerEditFlagDto;
 import com.ruoyi.sales.dto.SalesTrendDto;
 import com.ruoyi.sales.dto.StatisticsTableDto;
 import com.ruoyi.sales.pojo.SalesLedger;
+import com.ruoyi.sales.vo.SalesLedgerVo;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 
@@ -23,6 +27,10 @@
  * @date 2025-05-08
  */
 public interface SalesLedgerMapper extends BaseMapper<SalesLedger> {
+
+    List<IncomeExpenseAnalysisDto> selectIncomeStats(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("dateFormat") String dateFormat);
+
+    List<com.ruoyi.dto.MapDto> selectCustomerSalesComposition();
     /**
      * 鏌ヨ鎸囧畾鏃ユ湡鐨勬墍鏈夊悎鍚屽簭鍒楀彿
      * @param datePart 鏃ユ湡閮ㄥ垎锛堟牸寮忥細yyyyMMdd锛�
@@ -47,7 +55,7 @@
      * @param salesLedgerDto
      * @return
      */
-    IPage<SalesLedger> selectSalesLedgerListPage(Page page, @Param("salesLedgerDto") SalesLedgerDto salesLedgerDto);
+    IPage<SalesLedgerVo> selectSalesLedgerListPage(Page page, @Param("salesLedgerDto") SalesLedgerDto salesLedgerDto);
 
     /**
      * 鎸夋湀浠界粺璁¤鍗曟暟銆侀攢鍞锛堟敮鎸佷骇鍝佸ぇ绫汇�佸鎴峰悕绉扮瓫閫夛級
@@ -59,12 +67,14 @@
             "DATE_FORMAT(sl.entry_date, '%Y-%m') AS month, " +
             "COUNT(DISTINCT sl.id) AS order_count, " +  // 鎬昏鍗曟暟
             "SUM(slp.tax_inclusive_total_price) AS sales_amount, " +  // 閿�鍞
+            "SUM(IFNULL(slp.quantity, 0)) AS product_quantity, " +  // 浜у搧閿�鍞暟閲�
             // 鍙戣揣鐜� = 鍙戣揣璁㈠崟鏁� * 100 / 鎬昏鍗曟暟锛堜繚鐣�2浣嶅皬鏁帮紝閬垮厤闄�0鎶ラ敊锛�
             "ROUND(IF(COUNT(DISTINCT sl.id) = 0, 0, " +
             "SUM(CASE WHEN slp.approve_status = 2 THEN 1 ELSE 0 END) / COUNT(DISTINCT sl.id) * 100), 2) AS ship_rate " +
             "FROM sales_ledger sl " +
             "LEFT JOIN sales_ledger_product slp ON sl.id = slp.sales_ledger_id " +
-            "WHERE sl.entry_date BETWEEN #{statisticsTableDto.entryDateStart} AND #{statisticsTableDto.entryDateEnd} " +
+            "WHERE sl.entry_date &gt;= DATE_FORMAT(#{statisticsTableDto.entryDateStart}, '%Y-%m-01') " +
+            "AND sl.entry_date &lt;= LAST_DAY(#{statisticsTableDto.entryDateEnd}) " +
             // 浜у搧澶х被绛涢��
             "<if test='statisticsTableDto.productCategory != null and statisticsTableDto.productCategory != \"\"'>" +
             "AND slp.product_category = #{statisticsTableDto.productCategory} " +
@@ -77,4 +87,17 @@
             "ORDER BY month" +
             "</script>")
     List<SalesTrendDto> statisticsTable(@Param("statisticsTableDto")StatisticsTableDto statisticsTableDto);
+
+    IPage<SalesLedgerDto> listSalesLedgerAndShipped(Page page, @Param("ew") SalesLedgerDto salesLedgerDto);
+
+    IPage<PurchaseReportVo> selectPurchaseReportVoPage(Page page, @Param("customerName") String customerName);
+
+    /**
+     * 鎵归噺鏌ヨ閿�鍞彴璐︾殑缂栬緫闄愬埗鏍囪
+     *
+     * @param ids 閿�鍞彴璐d闆嗗悎
+     * @return 姣忎釜鍙拌处鐨勯渶瑕佺敓浜�/鐢熶骇璁″垝宸蹭笅鍙�/宸插彂璐ф爣璁�
+     */
+    List<SalesLedgerEditFlagDto> selectEditFlags(@Param("ids") List<Long> ids);
+
 }

--
Gitblit v1.9.3