maven
2026-02-02 559baa115845697113095cc7cdbad2e5d5fe2657
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);