From 258b69ac258a3cee13792ef8441977e7dae9b7d8 Mon Sep 17 00:00:00 2001
From: maven <2163098428@qq.com>
Date: 星期一, 02 二月 2026 11:20:20 +0800
Subject: [PATCH] yys  成品入库单价修改,成品库存修改

---
 src/main/java/com/ruoyi/production/service/impl/SalesLedgerWorkServiceImpl.java |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/main/java/com/ruoyi/production/service/impl/SalesLedgerWorkServiceImpl.java b/src/main/java/com/ruoyi/production/service/impl/SalesLedgerWorkServiceImpl.java
index 31add0f..4ab3c14 100644
--- a/src/main/java/com/ruoyi/production/service/impl/SalesLedgerWorkServiceImpl.java
+++ b/src/main/java/com/ruoyi/production/service/impl/SalesLedgerWorkServiceImpl.java
@@ -23,7 +23,9 @@
 import com.ruoyi.project.system.domain.SysUser;
 import com.ruoyi.project.system.mapper.SysUserMapper;
 import com.ruoyi.sales.mapper.LossMapper;
+import com.ruoyi.sales.mapper.SalesLedgerProductMapper;
 import com.ruoyi.sales.pojo.Loss;
+import com.ruoyi.sales.pojo.SalesLedgerProduct;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.BeanUtils;
@@ -92,6 +94,8 @@
 
     private final ProcurementRecordServiceImpl procurementRecordService;
 
+    private final SalesLedgerProductMapper salesLedgerProductMapper;
+
     @Override
     public int productionReport(ProductionReportDto productionReportDto) {
         SalesLedgerWork salesLedgerWork = salesLedgerWorkMapper.selectById(productionReportDto.getId());
@@ -119,6 +123,8 @@
                 .process(salesLedgerWork.getProcess())
                 .schedulingDate(LocalDate.parse(productionReportDto.getSchedulingDate(), DateTimeFormatter.ISO_LOCAL_DATE));
         salesLedgerProductionAccountingMapper.insert(builder.build());
+        // 鏌ヨ閿�鍞骇鍝佸崟浠�
+        SalesLedgerProduct salesLedgerProduct = salesLedgerProductMapper.selectById(salesLedgerWork.getSalesLedgerProductId());
         // 鐢熶骇鎶ュ伐鎴愬姛 -> 鍏ュ簱
         LoginUser loginUser = SecurityUtils.getLoginUser();
         ProcurementAddDto procurementRecordOutAdd = new ProcurementAddDto();
@@ -129,8 +135,8 @@
         Details details1 = new Details();
         details1.setInboundQuantity(productionReportDto.getFinishedNum());
         details1.setId(Integer.parseInt(salesLedgerWork.getSalesLedgerProductId().toString()));
-        details1.setTaxInclusiveUnitPrice(productionReportDto.getUnitPrice());
-        details1.setTotalPrice(productionReportDto.getTotalPrice());
+        details1.setTaxInclusiveUnitPrice(salesLedgerProduct != null ? salesLedgerProduct.getTaxInclusiveUnitPrice() : productionReportDto.getUnitPrice());
+        details1.setTotalPrice(details1.getTaxInclusiveUnitPrice().multiply(details1.getInboundQuantity()));
         details.add(details1);
         procurementRecordOutAdd.setDetails(details);
         procurementRecordService.add(procurementRecordOutAdd);

--
Gitblit v1.9.3