src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java
@@ -23,6 +23,9 @@
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.other.mapper.TempFileMapper;
import com.ruoyi.other.pojo.TempFile;
import com.ruoyi.procurementrecord.mapper.ReturnManagementMapper;
import com.ruoyi.procurementrecord.pojo.ReturnManagement;
import com.ruoyi.procurementrecord.service.ReturnManagementService;
import com.ruoyi.production.mapper.*;
import com.ruoyi.production.pojo.*;
import com.ruoyi.production.service.ProductionProductMainService;
@@ -98,6 +101,10 @@
    private final CommonFileServiceImpl commonFileService;
    private final ShippingInfoMapper shippingInfoMapper;
    private final ReturnManagementMapper returnManagementMapper;
    private final ReturnManagementService returnManagementService;
    private final InvoiceLedgerMapper invoiceLedgerMapper;
@@ -558,8 +565,17 @@
        List<ShippingInfo> shippingInfos = shippingInfoMapper.selectList(new LambdaQueryWrapper<ShippingInfo>()
                .in(ShippingInfo::getSalesLedgerId, idList));
        if (CollectionUtils.isNotEmpty(shippingInfos)) {
            shippingInfoServiceImpl.delete(shippingInfos.stream().map(ShippingInfo::getId).collect(Collectors.toList()));
            List<Long> shippingIds = shippingInfos.stream().map(ShippingInfo::getId).collect(Collectors.toList());
            shippingInfoServiceImpl.delete(shippingIds);
            // 删除退货台账记录
            List<ReturnManagement> returnManagements = returnManagementMapper.selectList(new LambdaQueryWrapper<ReturnManagement>()
                    .in(ReturnManagement::getShippingId, shippingIds));
            if (CollectionUtils.isNotEmpty(returnManagements)) {
                List<Long> returnIds = returnManagements.stream().map(ReturnManagement::getId).collect(Collectors.toList());
                returnManagementService.delete(returnIds);
            }
        }
        // 删除附件表
        commonFileService.deleteByBusinessIds(idList, FileNameType.SALE.getValue());