From 7ddb7bd2090ac82faf48340229e180a10619dd00 Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期一, 02 三月 2026 15:38:19 +0800
Subject: [PATCH] 1.设备管理(app上传对应文件)

---
 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