src/main/java/com/ruoyi/approve/service/impl/ApproveNodeServiceImpl.java
@@ -241,7 +241,7 @@ if(status.equals(2)){ shippingInfo.setStatus("审核通过"); }else if(status.equals(3)){ shippingInfo.setType("审核拒绝"); shippingInfo.setStatus("审核拒绝"); }else if(status.equals(1)){ shippingInfo.setStatus("审核中"); } src/main/java/com/ruoyi/purchase/service/impl/PurchaseLedgerServiceImpl.java
@@ -55,6 +55,7 @@ import lombok.extern.slf4j.Slf4j; import org.apache.commons.io.FilenameUtils; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.stereotype.Service; @@ -84,52 +85,71 @@ * @date 2025-05-09 */ @Service @RequiredArgsConstructor @Slf4j public class PurchaseLedgerServiceImpl extends ServiceImpl<PurchaseLedgerMapper, PurchaseLedger> implements IPurchaseLedgerService { private final AccountExpenseService accountExpenseService; private final PurchaseLedgerMapper purchaseLedgerMapper; @Autowired private AccountExpenseService accountExpenseService; @Autowired private PurchaseLedgerMapper purchaseLedgerMapper; private final SalesLedgerMapper salesLedgerMapper; private final SalesLedgerProductMapper salesLedgerProductMapper; @Autowired private SalesLedgerMapper salesLedgerMapper; @Autowired private SalesLedgerProductMapper salesLedgerProductMapper; private final SysUserMapper userMapper; @Autowired private SysUserMapper userMapper; private final TempFileMapper tempFileMapper; @Autowired private TempFileMapper tempFileMapper; private final CommonFileMapper commonFileMapper; @Autowired private CommonFileMapper commonFileMapper; private final SupplierManageMapper supplierManageMapper; @Autowired private SupplierManageMapper supplierManageMapper; private final ProductMapper productMapper; @Autowired private ProductMapper productMapper; private final ProductModelMapper productModelMapper; @Autowired private ProductModelMapper productModelMapper; private final SysUserMapper sysUserMapper; @Autowired private SysUserMapper sysUserMapper; private final TicketRegistrationMapper ticketRegistrationMapper; @Autowired private TicketRegistrationMapper ticketRegistrationMapper; private final ProductRecordMapper productRecordMapper; @Autowired private ProductRecordMapper productRecordMapper; private final PaymentRegistrationMapper paymentRegistrationMapper; private final InvoiceRegistrationProductMapper invoiceRegistrationProductMapper; private final StringRedisTemplate redisTemplate; private final QualityInspectMapper qualityInspectMapper; private final CommonFileServiceImpl commonFileService; private final QualityTestStandardBindingMapper qualityTestStandardBindingMapper; private final QualityTestStandardParamMapper qualityTestStandardParamMapper; private final QualityTestStandardMapper qualityTestStandardMapper; private final QualityInspectParamMapper qualityInspectParamMapper; private final ApproveProcessServiceImpl approveProcessService; private final ProcurementRecordMapper procurementRecordStorageMapper; private final PurchaseLedgerTemplateMapper purchaseLedgerTemplateMapper; private final SalesLedgerProductTemplateMapper salesLedgerProductTemplateMapper; @Autowired private PaymentRegistrationMapper paymentRegistrationMapper; @Autowired private InvoiceRegistrationProductMapper invoiceRegistrationProductMapper; @Autowired private StringRedisTemplate redisTemplate; @Autowired private QualityInspectMapper qualityInspectMapper; @Autowired private CommonFileServiceImpl commonFileService; @Autowired private QualityTestStandardBindingMapper qualityTestStandardBindingMapper; @Autowired private QualityTestStandardParamMapper qualityTestStandardParamMapper; @Autowired private QualityTestStandardMapper qualityTestStandardMapper; @Autowired private QualityInspectParamMapper qualityInspectParamMapper; @Autowired private ApproveProcessServiceImpl approveProcessService; @Autowired private ProcurementRecordMapper procurementRecordStorageMapper; @Autowired private PurchaseLedgerTemplateMapper purchaseLedgerTemplateMapper; @Autowired private SalesLedgerProductTemplateMapper salesLedgerProductTemplateMapper; @Value("${file.upload-dir}") private String uploadDir; src/main/java/com/ruoyi/sales/controller/ShippingInfoController.java
@@ -64,7 +64,7 @@ @GetMapping("/listPage") @ApiOperation("发货信息列表") public AjaxResult listPage(Page page, ShippingInfo req) { IPage<ShippingInfo> listPage = shippingInfoService.listPage(page,req); IPage<ShippingInfoDto> listPage = shippingInfoService.listPage(page,req); return AjaxResult.success(listPage); } @@ -96,8 +96,6 @@ @Transactional(rollbackFor = Exception.class) @Log(title = "发货信息管理", businessType = BusinessType.UPDATE) public AjaxResult deductStock(@RequestBody ShippingInfoDto req) throws IOException { return shippingInfoService.deductStock( req) ? AjaxResult.success() : AjaxResult.error(); } src/main/java/com/ruoyi/sales/mapper/ShippingInfoMapper.java
@@ -3,6 +3,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ruoyi.sales.dto.ShippingInfoDto; import com.ruoyi.sales.pojo.ShippingInfo; import org.apache.ibatis.annotations.Param; @@ -13,7 +14,7 @@ * @date : 2025/10/22 9:32 */ public interface ShippingInfoMapper extends BaseMapper<ShippingInfo> { IPage<ShippingInfo> listPage(Page page,@Param("req") ShippingInfo req); IPage<ShippingInfoDto> listPage(Page page, @Param("req") ShippingInfo req); List<ShippingInfo> listAll(); } src/main/java/com/ruoyi/sales/service/ShippingInfoService.java
@@ -14,7 +14,7 @@ * @date : 2025/10/22 9:33 */ public interface ShippingInfoService extends IService<ShippingInfo>{ IPage<ShippingInfo> listPage(Page page, ShippingInfo req); IPage<ShippingInfoDto> listPage(Page page, ShippingInfo req); boolean deductStock(ShippingInfoDto req) throws IOException; src/main/java/com/ruoyi/sales/service/impl/CommonFileServiceImpl.java
@@ -40,6 +40,11 @@ @Value("${file.upload-dir}") private String uploadDir; public List<CommonFile> getFileListByBusinessId(Long businessId,Integer type) { return commonFileMapper.selectList(new LambdaQueryWrapper<CommonFile>().eq(CommonFile::getCommonId, businessId) .eq(CommonFile::getType, type)); } public void deleteByBusinessId(Long businessId,Integer type) { commonFileMapper.delete(new LambdaQueryWrapper<CommonFile>().eq(CommonFile::getCommonId, businessId) .eq(CommonFile::getType, type)); src/main/java/com/ruoyi/sales/service/impl/InvoiceLedgerServiceImpl.java
@@ -326,6 +326,14 @@ if(ObjectUtils.isEmpty(invoiceRegistrationProductDto)){ throw new RuntimeException("产品开票台账查找失败"); } List<InvoiceRegistrationProduct> invoiceRegistrationProducts = invoiceRegistrationProductMapper.selectList(new LambdaQueryWrapper<InvoiceRegistrationProduct>() .eq(InvoiceRegistrationProduct::getSalesLedgerProductId, invoiceRegistrationProductDto.getSalesLedgerProductId())); if(CollectionUtils.isNotEmpty(invoiceRegistrationProducts)){ invoiceRegistrationProductDto.setNoInvoiceNum(invoiceRegistrationProductDto.getQuantity() .subtract(invoiceRegistrationProducts.stream().map(InvoiceRegistrationProduct::getInvoiceNum).reduce(BigDecimal.ZERO, BigDecimal::add))); invoiceRegistrationProductDto.setNoInvoiceAmount(invoiceRegistrationProductDto.getTaxInclusiveTotalPrice() .subtract(invoiceRegistrationProducts.stream().map(InvoiceRegistrationProduct::getInvoiceAmount).reduce(BigDecimal.ZERO, BigDecimal::add))); } // 查询附件 QueryWrapper<InvoiceLedgerFile> queryWrapper = new QueryWrapper<>(); queryWrapper.eq("invoice_ledger_id", invoiceRegistrationProductDto.getInvoiceLedgerId()); src/main/java/com/ruoyi/sales/service/impl/ShippingInfoServiceImpl.java
@@ -49,9 +49,11 @@ private ApproveProcessServiceImpl approveProcessService; @Override public IPage<ShippingInfo> listPage(Page page, ShippingInfo req) { IPage<ShippingInfo> listPage = shippingInfoMapper.listPage(page, req); public IPage<ShippingInfoDto> listPage(Page page, ShippingInfo req) { IPage<ShippingInfoDto> listPage = shippingInfoMapper.listPage(page, req); listPage.getRecords().forEach(item ->{ item.setCommonFileList(commonFileService.getFileListByBusinessId(item.getId(), FileNameType.SHIP.getValue())); }); return listPage; } @@ -61,14 +63,16 @@ if (byId == null) { throw new RuntimeException("发货信息不存在"); } //扣减库存 if(!"已发货".equals(byId.getStatus())){ SalesLedgerProduct salesLedgerProduct = salesLedgerProductMapper.selectById(byId.getSalesLedgerProductId()); stockUtils.substractStock(salesLedgerProduct.getProductModelId(), salesLedgerProduct.getQuantity(), StockQualifiedRecordTypeEnum.SALE_SHIP_STOCK_OUT.getCode(), req.getId()); } byId.setExpressNumber(req.getExpressNumber()); byId.setExpressCompany(req.getExpressCompany()); byId.setStatus("已发货"); byId.setShippingCarNumber(req.getShippingCarNumber()); boolean update = this.updateById(req); //扣减库存 SalesLedgerProduct salesLedgerProduct = salesLedgerProductMapper.selectById(req.getSalesLedgerProductId()); stockUtils.substractStock(salesLedgerProduct.getProductModelId(), salesLedgerProduct.getQuantity(), StockQualifiedRecordTypeEnum.SALE_SHIP_STOCK_OUT.getCode(), req.getId()); // 迁移文件 if(CollectionUtils.isNotEmpty(req.getTempFileIds())){ tempFileService.migrateTempFilesToFormal(req.getId(), req.getTempFileIds(), FileNameType.SHIP.getValue()); src/main/resources/mapper/sales/ShippingInfoMapper.xml
@@ -2,7 +2,7 @@ "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.ruoyi.sales.mapper.ShippingInfoMapper"> <select id="listPage" resultType="com.ruoyi.sales.pojo.ShippingInfo"> <select id="listPage" resultType="com.ruoyi.sales.dto.ShippingInfoDto"> SELECT s.id, s.sales_ledger_id,