| | |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.other.mapper.TempFileMapper; |
| | | import com.ruoyi.other.pojo.TempFile; |
| | | import com.ruoyi.production.mapper.SalesLedgerSchedulingMapper; |
| | | import com.ruoyi.production.pojo.SalesLedgerScheduling; |
| | | import com.ruoyi.project.system.domain.SysDept; |
| | | import com.ruoyi.project.system.mapper.SysDeptMapper; |
| | | import com.ruoyi.sales.dto.MonthlyAmountDto; |
| | |
| | | private final ReceiptPaymentMapper receiptPaymentMapper; |
| | | |
| | | private final InvoiceLedgerMapper invoiceLedgerMapper; |
| | | |
| | | private final SalesLedgerSchedulingMapper salesLedgerSchedulingMapper; |
| | | |
| | | @Autowired |
| | | private SysDeptMapper sysDeptMapper; |
| | |
| | | List<Long> idList = Arrays.stream(ids) |
| | | .filter(Objects::nonNull) |
| | | .collect(Collectors.toList()); |
| | | |
| | | if (CollectionUtils.isEmpty(idList)) { |
| | | return 0; |
| | | } |
| | | // 生产订单有待排产数据,台账不可删除 |
| | | LambdaQueryWrapper<SalesLedgerScheduling> salesLedgerSchedulingLambdaQueryWrapper = new LambdaQueryWrapper<SalesLedgerScheduling>() |
| | | .in(SalesLedgerScheduling::getSalesLedgerId, idList); |
| | | if (salesLedgerSchedulingMapper.selectCount(salesLedgerSchedulingLambdaQueryWrapper) > 0) { |
| | | throw new BaseException("有排产数据,不可删除"); |
| | | } |
| | | // 1. 先删除子表数据 |
| | | LambdaQueryWrapper<SalesLedgerProduct> productWrapper = new LambdaQueryWrapper<>(); |
| | | productWrapper.in(SalesLedgerProduct::getSalesLedgerId, idList); |
| | | salesLedgerProductMapper.delete(productWrapper); |
| | | |
| | | // 删除生产订单数据 |
| | | LambdaQueryWrapper<SalesLedgerScheduling> in = new LambdaQueryWrapper<SalesLedgerScheduling>() |
| | | .in(SalesLedgerScheduling::getSalesLedgerId, idList); |
| | | salesLedgerSchedulingMapper.delete(in); |
| | | // 2. 再删除主表数据 |
| | | return salesLedgerMapper.deleteBatchIds(idList); |
| | | } |