From 9b9de7f44d91d9a5cfe78d07a20e504a921921ff Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期五, 13 二月 2026 15:44:39 +0800
Subject: [PATCH] fix: 投入需要乘以单位产出需要数量

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