From 99cc2c135bb97943ef25f31d4d85c24b683b725b Mon Sep 17 00:00:00 2001
From: maven <2163098428@qq.com>
Date: 星期三, 24 十二月 2025 11:31:50 +0800
Subject: [PATCH] yys  成品入库修改入库时间

---
 src/main/resources/mapper/purchase/InvoicePurchaseMapper.xml |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/main/resources/mapper/purchase/InvoicePurchaseMapper.xml b/src/main/resources/mapper/purchase/InvoicePurchaseMapper.xml
index 413f293..79310e8 100644
--- a/src/main/resources/mapper/purchase/InvoicePurchaseMapper.xml
+++ b/src/main/resources/mapper/purchase/InvoicePurchaseMapper.xml
@@ -11,7 +11,7 @@
         FORMAT(A.sales_tax_amount - A.purchase_tax_amount, 2) AS balance_amount
         FROM (
         SELECT
-        sl.customer_contract_no,
+        sl.sales_contract_no as customerContractNo,
         sl.id,
         pl.id AS pl_id,
         sl.customer_name,
@@ -41,9 +41,9 @@
         LEFT JOIN
         sales_ledger_product slp1 ON slp1.sales_ledger_id = pl.id AND slp1.type = 2
         GROUP BY
-        sl.customer_contract_no, sl.customer_name, sl.project_name, sl.id, pl.id
+        pl.id
         HAVING
-        sl.customer_contract_no IS NOT NULL
+        customerContractNo IS NOT NULL
         ) A
         <where>
             <if test="c.customerName != null and c.customerName != ''">
@@ -66,6 +66,7 @@
                                 LEFT JOIN invoice_registration_product pr ON pr.id = il.invoice_registration_product_id
                        WHERE il.invoice_no IS NOT NULL
                          AND invoice_type = '澧炰笓绁�'
+                         AND DATE_FORMAT(il.invoice_date, '%Y-%m') IS NOT NULL  -- 鏂板锛氳繃婊onth涓篘ULL鐨勬儏
                        GROUP BY DATE_FORMAT(il.invoice_date, '%Y-%m')
                    ) a1
                        LEFT JOIN (
@@ -124,12 +125,14 @@
                            LEFT JOIN invoice_registration_product pr ON pr.id = il.invoice_registration_product_id
                   WHERE il.invoice_no IS NOT NULL
                     AND invoice_type = '澧炰笓绁�'
+                    AND DATE_FORMAT(il.invoice_date, '%Y-%m') IS NOT NULL  -- 鏂板锛氳繃婊onth涓篘ULL鐨勬儏
                   GROUP BY DATE_FORMAT(il.invoice_date, '%Y-%m')
               ) a1 ON a1.month = a2.month
               WHERE a1.month IS NULL
               ORDER BY month
              )as a
         <where>
+            a.month is not null
             <if test="month != null">
                 and a.month = #{month}
             </if>

--
Gitblit v1.9.3