From 1a3f5db043fd381b60a0a5f40687136274a2cbd1 Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期五, 27 二月 2026 09:57:41 +0800
Subject: [PATCH] Merge branch 'refs/heads/dev_New' into dev_New_kthg

---
 src/main/java/com/ruoyi/sales/service/impl/ReceiptPaymentServiceImpl.java |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

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 7f9b4cd..b667be2 100644
--- a/src/main/java/com/ruoyi/sales/service/impl/ReceiptPaymentServiceImpl.java
+++ b/src/main/java/com/ruoyi/sales/service/impl/ReceiptPaymentServiceImpl.java
@@ -69,8 +69,8 @@
             // 宸插洖娆鹃噾棰�
             SalesLedgerProduct salesLedgerProduct = salesLedgerProductMapper.selectById(receiptPayment.getSalesLedgerProductId());
             if(null==salesLedgerProduct) throw new RuntimeException("鏈壘鍒伴攢鍞崟浜у搧");
-            if (salesLedgerProduct.getPendingInvoiceTotal().compareTo(receiptPayment.getReceiptPaymentAmount())<0){
-                throw new RuntimeException("鏈鍥炴閲戦涓嶈兘澶т簬寰呭洖娆鹃噾棰�");
+            if (salesLedgerProduct.getPendingInvoiceTotal().add(receiptPayment.getReceiptPaymentAmount()).compareTo(byId.getReceiptPaymentAmount())<0){
+                throw new RuntimeException("鏈鍥炴閲戦涓嶈兘澶т簬寰呭洖娆鹃噾棰�+鍥炴閲戦");
             }
             if(null==receiptPayment.getId()){
                 salesLedgerProduct.setInvoiceTotal(salesLedgerProduct.getInvoiceTotal().add(receiptPayment.getReceiptPaymentAmount()));
@@ -79,9 +79,9 @@
                 // 澧炲姞璐㈠姟鏀跺叆璁板綍
                 AccountIncome accountIncome = new AccountIncome();
                 accountIncome.setIncomeDate(salesLedger.getEntryDate());
-                accountIncome.setIncomeType("0");
+                accountIncome.setIncomeType("3");
                 accountIncome.setCustomerName(salesLedger.getCustomerName());
-                accountIncome.setIncomeMoney(salesLedger.getContractAmount());
+                accountIncome.setIncomeMoney(receiptPayment.getReceiptPaymentAmount());
                 accountIncome.setIncomeMethod("0");
                 accountIncome.setInputTime(new Date());
                 accountIncome.setInputUser(salesLedger.getEntryPerson());
@@ -90,7 +90,7 @@
                 accountIncome.setBusinessType(1);
                 accountIncomeService.save(accountIncome);
             }else {
-                BigDecimal subtract = receiptPayment.getReceiptPaymentAmount().subtract(byId.getReceiptPaymentAmount());
+                BigDecimal subtract = byId.getReceiptPaymentAmount().subtract(receiptPayment.getReceiptPaymentAmount());
                 salesLedgerProduct.setInvoiceTotal(salesLedgerProduct.getInvoiceTotal().add(subtract));
                 salesLedgerProduct.setPendingInvoiceTotal(salesLedgerProduct.getTaxInclusiveTotalPrice().subtract(salesLedgerProduct.getInvoiceTotal()));
                 receiptPayment.setReceiptPaymentAmount(byId.getReceiptPaymentAmount());

--
Gitblit v1.9.3