From 4d1bd63eada739fdef9a05839c90a7b564fa2dab Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期三, 08 四月 2026 11:03:25 +0800
Subject: [PATCH] feat:发货和销售数量查询
---
src/main/java/com/ruoyi/sales/mapper/ReceiptPaymentMapper.java | 16 +++++--
src/main/java/com/ruoyi/sales/dto/InvoiceLedgerDto.java | 7 ++-
src/main/resources/mapper/sales/InvoiceLedgerMapper.xml | 15 ++++---
src/main/resources/mapper/sales/ReceiptPaymentMapper.xml | 22 +++++++++++
src/main/java/com/ruoyi/sales/service/impl/ReceiptPaymentServiceImpl.java | 6 --
5 files changed, 47 insertions(+), 19 deletions(-)
diff --git a/src/main/java/com/ruoyi/sales/dto/InvoiceLedgerDto.java b/src/main/java/com/ruoyi/sales/dto/InvoiceLedgerDto.java
index 126355e..08a1454 100644
--- a/src/main/java/com/ruoyi/sales/dto/InvoiceLedgerDto.java
+++ b/src/main/java/com/ruoyi/sales/dto/InvoiceLedgerDto.java
@@ -61,8 +61,11 @@
private String specificationModel;
@ApiModelProperty(value = "宸插彂璐�")
- private String shippedQuantity;
+ private BigDecimal shippedQuantity;
@ApiModelProperty(value = "鏈彂璐�")
- private String unshippedQuantity;
+ private BigDecimal unshippedQuantity;
+
+ @ApiModelProperty(value = "鎬绘暟閲�")
+ private BigDecimal totalQuantity;
}
diff --git a/src/main/java/com/ruoyi/sales/mapper/ReceiptPaymentMapper.java b/src/main/java/com/ruoyi/sales/mapper/ReceiptPaymentMapper.java
index 060ee0b..fcfcd34 100644
--- a/src/main/java/com/ruoyi/sales/mapper/ReceiptPaymentMapper.java
+++ b/src/main/java/com/ruoyi/sales/mapper/ReceiptPaymentMapper.java
@@ -21,6 +21,7 @@
/**
* 鏌ヨ宸茬粡缁戝畾鍙戠エ鐨勫紑绁ㄥ彴璐�
+ *
* @param page
* @param receiptPaymentDto
* @return
@@ -29,6 +30,7 @@
/**
* 寮�绁ㄥ彴璐﹁鎯�
+ *
* @param id
* @return
*/
@@ -36,6 +38,7 @@
/**
* 璁$畻鍓嶅灏戞潯鏁版嵁鍥炴閲戦缁煎悎
+ *
* @param customerId
* @param total
* @return
@@ -50,17 +53,19 @@
/**
* 鏌ヨ鍥炴璁板綍鍒嗛〉
*/
- IPage<ReceiptPaymentDto> receiptPaymentHistoryListPage(Page page,@Param("params") ReceiptPaymentDto receiptPaymentDto);
+ IPage<ReceiptPaymentDto> receiptPaymentHistoryListPage(Page page, @Param("params") ReceiptPaymentDto receiptPaymentDto);
/**
* 瀹㈡埛寰�鏉ヨ褰曟煡璇�
+ *
* @param receiptPaymentDto
* @return
*/
- List<CustomerInteractionDto> customerInteractions (ReceiptPaymentDto receiptPaymentDto);
+ List<CustomerInteractionDto> customerInteractions(ReceiptPaymentDto receiptPaymentDto);
/**
* 瀹㈡埛鍥炴璁板綍鏌ヨ
+ *
* @param invoiceLedgerDto
* @return
*/
@@ -69,10 +74,11 @@
/**
* 鏌ヨ鍥炴璁板綍涓嶅垎椤�
*/
- List<ReceiptPaymentDto> receiptPaymentHistoryListNoPage( @Param("params") ReceiptPaymentDto receiptPaymentDto);
+ List<ReceiptPaymentDto> receiptPaymentHistoryListNoPage(@Param("params") ReceiptPaymentDto receiptPaymentDto);
/**
* 閫氳繃寮�绁ㄧ櫥璁颁骇鍝乮d鏌ヨ鏄惁宸茬粡鏈夊洖娆捐褰�
+ *
* @param invoiceRegistrationProductId
* @return
*/
@@ -80,8 +86,8 @@
List<ReceiptPaymentDto> bindInvoiceNoRegListAll();
- List<ReceiptPaymentExeclDto> bindInvoiceNoRegListByIds(List<Long> ids,Long tenantId);
+ List<ReceiptPaymentExeclDto> bindInvoiceNoRegListByIds(List<Long> ids, Long tenantId);
- List<InvoiceLedgerDto> customerSalesInteractions(InvoiceLedgerDto receiptPaymentDto);
+ List<InvoiceLedgerDto> customerSalesInteractions(@Param("ew") InvoiceLedgerDto receiptPaymentDto);
}
diff --git a/src/main/java/com/ruoyi/sales/service/impl/ReceiptPaymentServiceImpl.java b/src/main/java/com/ruoyi/sales/service/impl/ReceiptPaymentServiceImpl.java
index 7b0d4db..35ae4c5 100644
--- a/src/main/java/com/ruoyi/sales/service/impl/ReceiptPaymentServiceImpl.java
+++ b/src/main/java/com/ruoyi/sales/service/impl/ReceiptPaymentServiceImpl.java
@@ -11,10 +11,7 @@
import com.ruoyi.sales.dto.InvoiceLedgerDto;
import com.ruoyi.sales.dto.ReceiptPaymentDto;
import com.ruoyi.sales.dto.ReceiptPaymentExeclDto;
-import com.ruoyi.sales.mapper.InvoiceLedgerMapper;
-import com.ruoyi.sales.mapper.ReceiptPaymentMapper;
-import com.ruoyi.sales.mapper.SalesLedgerMapper;
-import com.ruoyi.sales.mapper.SalesLedgerProductMapper;
+import com.ruoyi.sales.mapper.*;
import com.ruoyi.sales.pojo.ReceiptPayment;
import com.ruoyi.sales.pojo.SalesLedger;
import com.ruoyi.sales.pojo.SalesLedgerProduct;
@@ -357,7 +354,6 @@
@Override
public List<InvoiceLedgerDto> customerSalesInteractions(InvoiceLedgerDto receiptPaymentDto) {
- receiptPaymentDto.getCustomerId();
return receiptPaymentMapper.customerSalesInteractions(receiptPaymentDto);
}
}
diff --git a/src/main/resources/mapper/sales/InvoiceLedgerMapper.xml b/src/main/resources/mapper/sales/InvoiceLedgerMapper.xml
index 1e96ba0..150f817 100644
--- a/src/main/resources/mapper/sales/InvoiceLedgerMapper.xml
+++ b/src/main/resources/mapper/sales/InvoiceLedgerMapper.xml
@@ -111,19 +111,20 @@
<select id="invoiceLedgerSalesAccount" resultType="com.ruoyi.sales.dto.InvoiceLedgerDto">
SELECT
- T1.customer_id AS id,
- T1.customer_name,
- SUM(contract_amount) AS invoice_total,
+ c.id AS id,
+ c.customer_name,
+ IFNULL(SUM(T1.contract_amount), 0) AS invoice_total,
IFNULL(SUM(T2.receipt_payment_amount), 0) AS receipt_payment_amount,
- IFNULL(SUM(contract_amount), 0) - IFNULL(SUM(T2.receipt_payment_amount), 0) AS unReceipt_payment_amount
- FROM sales_ledger T1
+ IFNULL(SUM(T1.contract_amount), 0) - IFNULL(SUM(T2.receipt_payment_amount), 0) AS unReceipt_payment_amount
+ FROM customer c
+ LEFT JOIN sales_ledger T1 ON c.id = T1.customer_id
LEFT JOIN receipt_payment T2 ON T1.id = T2.sales_ledger_id
<where>
<if test="invoiceLedgerDto.searchText != null and invoiceLedgerDto.searchText != '' ">
- T1.customer_name LIKE CONCAT ('%',#{invoiceLedgerDto.searchText},'%')
+ c.customer_name LIKE CONCAT ('%',#{invoiceLedgerDto.searchText},'%')
</if>
</where>
- GROUP BY T1.customer_id, T1.customer_name
+ GROUP BY c.id, c.customer_name
</select>
<select id="invoiceLedgerProductInfo" resultType="com.ruoyi.sales.dto.InvoiceRegistrationProductDto">
diff --git a/src/main/resources/mapper/sales/ReceiptPaymentMapper.xml b/src/main/resources/mapper/sales/ReceiptPaymentMapper.xml
index 975d120..3e3ae6c 100644
--- a/src/main/resources/mapper/sales/ReceiptPaymentMapper.xml
+++ b/src/main/resources/mapper/sales/ReceiptPaymentMapper.xml
@@ -451,4 +451,26 @@
GROUP BY T1.id, T1.sales_contract_no, T1.contract_amount, T2.receipt_payment_date
</select>
+ <select id="customerSalesInteractions" resultType="com.ruoyi.sales.dto.InvoiceLedgerDto">
+ SELECT
+ wr.receive_unit,
+ wr.goods_name,
+ wr.specification,
+ wr.shippedQuantity,
+ SUM(slp.quantity) AS totalQuantity,
+ SUM(IFNULL(slp.quantity, 0)) - wr.shippedQuantity AS unshippedQuantity
+ FROM
+ (SELECT receive_unit, goods_name, specification, SUM(net_weight) AS shippedQuantity FROM weighing_record GROUP BY receive_unit, goods_name, specification) wr
+ LEFT JOIN sales_ledger sl ON sl.customer_name = wr.receive_unit
+ LEFT JOIN sales_ledger_product slp ON slp.sales_ledger_id = sl.id
+ AND slp.product_category = wr.goods_name
+ AND slp.specification_model = wr.specification
+ WHERE
+ sl.customer_id = #{ew.customerId}
+ GROUP BY
+ wr.receive_unit,
+ wr.goods_name,
+ wr.specification,
+ wr.shippedQuantity
+ </select>
</mapper>
\ No newline at end of file
--
Gitblit v1.9.3