| | |
| | | |
| | | private final SalesLedgerSchedulingMapper salesLedgerSchedulingMapper; |
| | | |
| | | private final InvoiceRegistrationProductMapper invoiceRegistrationProductMapper; |
| | | |
| | | private final InvoiceRegistrationMapper invoiceRegistrationMapper; |
| | | |
| | | @Autowired |
| | | private SysDeptMapper sysDeptMapper; |
| | | |
| | |
| | | |
| | | // 3.查询上传文件 |
| | | LambdaQueryWrapper<CommonFile> salesLedgerFileWrapper = new LambdaQueryWrapper<>(); |
| | | salesLedgerFileWrapper.eq(CommonFile::getCommonId, salesLedger.getId()); |
| | | salesLedgerFileWrapper.eq(CommonFile::getCommonId, salesLedger.getId()) |
| | | .eq(CommonFile::getType, FileNameType.SALE.getValue()); |
| | | List<CommonFile> salesLedgerFiles = commonFileMapper.selectList(salesLedgerFileWrapper); |
| | | |
| | | // 4. 转换 DTO |
| | |
| | | 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); |
| | |
| | | } |
| | | // 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>() |