maven
17 小时以前 c58c05fa307754061c9264758eff668105f89625
src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java
@@ -83,6 +83,10 @@
    private final SalesLedgerSchedulingMapper salesLedgerSchedulingMapper;
    private final InvoiceRegistrationProductMapper invoiceRegistrationProductMapper;
    private final InvoiceRegistrationMapper invoiceRegistrationMapper;
    @Autowired
    private SysDeptMapper sysDeptMapper;
@@ -348,6 +352,13 @@
        if (CollectionUtils.isEmpty(idList)) {
            return 0;
        }
        // 判断是否有开票记录
        LambdaQueryWrapper<InvoiceRegistrationProduct> invoiceLedgerQuery = new LambdaQueryWrapper<>();
        invoiceLedgerQuery.in(InvoiceRegistrationProduct::getSalesLedgerId, idList);
        List<InvoiceRegistrationProduct> invoiceRegistrationProducts = invoiceRegistrationProductMapper.selectList(invoiceLedgerQuery);
        if (CollectionUtils.isNotEmpty(invoiceRegistrationProducts)) {
            throw new BaseException("有开票记录,不可删除");
        }
        // 生产订单有待排产数据,台账不可删除
        LambdaQueryWrapper<SalesLedgerScheduling> salesLedgerSchedulingLambdaQueryWrapper = new LambdaQueryWrapper<SalesLedgerScheduling>()
                .in(SalesLedgerScheduling::getSalesLedgerId, idList);
@@ -356,7 +367,8 @@
        }
        // 1. 先删除子表数据
        LambdaQueryWrapper<SalesLedgerProduct> productWrapper = new LambdaQueryWrapper<>();
        productWrapper.in(SalesLedgerProduct::getSalesLedgerId, idList);
        productWrapper.in(SalesLedgerProduct::getSalesLedgerId, idList)
                .eq(SalesLedgerProduct::getType,1);
        salesLedgerProductMapper.delete(productWrapper);
        // 删除生产订单数据
        LambdaQueryWrapper<SalesLedgerScheduling> in = new LambdaQueryWrapper<SalesLedgerScheduling>()