| | |
| | | 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; |
| | |
| | | |
| | | private final ProcurementRecordServiceImpl procurementRecordService; |
| | | |
| | | private final SalesLedgerProductMapper salesLedgerProductMapper; |
| | | |
| | | @Override |
| | | public int productionReport(ProductionReportDto productionReportDto) { |
| | | SalesLedgerWork salesLedgerWork = salesLedgerWorkMapper.selectById(productionReportDto.getId()); |
| | |
| | | .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(); |
| | |
| | | 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); |