| | |
| | | procurementRecordMapper.deleteBatchIds(procurementRecordStorageById.stream().map(ProcurementRecordStorage::getId).collect(Collectors.toList())); |
| | | // 删除所有对应的出库记录 |
| | | LambdaQueryWrapper<ProcurementRecordOut> procurementRecordOutLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | procurementRecordOutLambdaQueryWrapper.in(ProcurementRecordOut::getProcurementRecordStorageId, procurementDto.getIds()); |
| | | procurementRecordOutLambdaQueryWrapper.in(ProcurementRecordOut::getProcurementRecordStorageId, procurementDto.getIds()) |
| | | .eq(ProcurementRecordOut::getType,procurementDto.getType()); |
| | | List<ProcurementRecordOut> procurementRecordOuts = procurementRecordOutMapper.selectList(procurementRecordOutLambdaQueryWrapper); |
| | | if(!CollectionUtils.isEmpty(procurementRecordOuts)){ |
| | | procurementRecordOutMapper.deleteBatchIds(procurementRecordOuts.stream().map(ProcurementRecordOut::getId).collect(Collectors.toList())); |
| | |
| | | // 如果没有相关的出库记录,跳过该条数据 |
| | | if(CollectionUtils.isEmpty(collect1)){ |
| | | dto.setInboundNum0(dto.getInboundNum()); |
| | | dto.setTotalInboundNum(BigDecimal.ZERO); |
| | | continue; |
| | | } |
| | | |
| | |
| | | dto.setTotalInboundNum(totalInboundNum); |
| | | // 待出库数量 = 总数量 - 已出库数量 |
| | | dto.setInboundNum0(dto.getInboundNum().subtract(totalInboundNum)); |
| | | // 库存价值 |
| | | if(dto.getUnitPrice() != null){ |
| | | dto.setTotalPrice(dto.getTotalInboundNum().multiply(dto.getUnitPrice())); |
| | | } |
| | | } |
| | | return procurementPageDtoCopyIPage; |
| | | } |
| | | |
| | | @Override |
| | | public IPage<CustomStorage> listPageCopyByCustom(Page page, CustomStorage customStorage) { |
| | | LambdaQueryWrapper<CustomStorage> customStorageLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | customStorageLambdaQueryWrapper.groupBy(CustomStorage::getProductCategory, CustomStorage::getSpecificationModel); |
| | | if(customStorage != null){ |
| | | if(!StringUtils.isEmpty(customStorage.getSupplierName())){ |
| | | customStorageLambdaQueryWrapper.like(CustomStorage::getSupplierName, customStorage.getSupplierName()); |
| | | } |
| | | // 筛选入库时间 |
| | | if(customStorage.getInboundDate() != null){ |
| | | customStorageLambdaQueryWrapper.eq(CustomStorage::getInboundDate, customStorage.getInboundDate()); |
| | | } |
| | | if(!StringUtils.isEmpty(customStorage.getProductCategory())){ |
| | | customStorageLambdaQueryWrapper.like(CustomStorage::getProductCategory, customStorage.getProductCategory()); |
| | | } |
| | | } |
| | | customStorageLambdaQueryWrapper.orderByDesc(CustomStorage::getInboundDate); |
| | | IPage<CustomStorage> pageList = customStorageMapper.selectPage(page, customStorageLambdaQueryWrapper); |
| | | // LambdaQueryWrapper<CustomStorage> customStorageLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | // customStorageLambdaQueryWrapper.groupBy(CustomStorage::getProductCategory, CustomStorage::getSpecificationModel,CustomStorage::getTaxInclusiveUnitPrice); |
| | | // if(customStorage != null){ |
| | | // if(!StringUtils.isEmpty(customStorage.getSupplierName())){ |
| | | // customStorageLambdaQueryWrapper.like(CustomStorage::getSupplierName, customStorage.getSupplierName()); |
| | | // } |
| | | // // 筛选入库时间 |
| | | // if(customStorage.getInboundDate() != null){ |
| | | // customStorageLambdaQueryWrapper.eq(CustomStorage::getInboundDate, customStorage.getInboundDate()); |
| | | // } |
| | | // if(!StringUtils.isEmpty(customStorage.getProductCategory())){ |
| | | // customStorageLambdaQueryWrapper.like(CustomStorage::getProductCategory, customStorage.getProductCategory()); |
| | | // } |
| | | // } |
| | | // customStorageLambdaQueryWrapper.orderByDesc(CustomStorage::getInboundDate); |
| | | IPage<CustomStorage> pageList = customStorageMapper.listPageCopyByCustom(page, customStorage); |
| | | |
| | | List<CustomStorage> procurementPageDtoCopyList = pageList.getRecords(); |
| | | // 计算待入库数量 |
| | | // 查询采购记录已入库数量 |
| | |
| | | // 如果没有相关的出库记录,跳过该条数据 |
| | | if(CollectionUtils.isEmpty(collect1)){ |
| | | dto.setInboundNum0(dto.getInboundNum()); |
| | | dto.setTotalInboundNum(BigDecimal.ZERO); |
| | | continue; |
| | | } |
| | | |
| | |
| | | dto.setTotalInboundNum(totalInboundNum); |
| | | // 待出库数量 = 总数量 - 已出库数量 |
| | | dto.setInboundNum0(dto.getInboundNum().subtract(totalInboundNum)); |
| | | // 库存价值 |
| | | if(dto.getTaxInclusiveUnitPrice() != null){ |
| | | dto.setTaxInclusiveTotalPrice(dto.getInboundNum0().multiply(dto.getTaxInclusiveUnitPrice())); |
| | | } |
| | | } |
| | | pageList.setRecords(procurementPageDtoCopyList); |
| | | return pageList; |
| | |
| | | .inboundNum(detail.getInboundQuantity()) |
| | | .type(procurementDto.getType()) |
| | | .warnNum(detail.getWarnNum()) |
| | | .unitPrice(detail.getUnitPrice()) |
| | | .totalPrice(detail.getInboundQuantity().multiply(detail.getUnitPrice())) |
| | | .createTime(LocalDateTime.now()) |
| | | .createUser(loginUser.getUserId()) |
| | | .updateTime(LocalDateTime.now()) |
| | |
| | | for (ProcurementPageDtoCopy dto : procurementPageDtoCopyList) { |
| | | // 根据采购台账ID筛选对应的出库记录 |
| | | List<ProcurementRecordOut> collect1 = procurementRecords.stream() |
| | | .filter(ProcurementRecordOut -> ProcurementRecordOut.getProcurementRecordStorageId().equals(dto.getId())) |
| | | .filter(ProcurementRecordOut -> ProcurementRecordOut.getProcurementRecordStorageId().equals(dto.getId()) && ProcurementRecordOut.getType().equals(1)) |
| | | .collect(Collectors.toList()); |
| | | |
| | | // 如果没有相关的出库记录,跳过该条数据 |
| | | if(CollectionUtils.isEmpty(collect1)){ |
| | | dto.setInboundNum0(dto.getInboundNum()); |
| | | dto.setTotalInboundNum(BigDecimal.ZERO); |
| | | continue; |
| | | } |
| | | |
| | |
| | | dto.setTotalInboundNum(totalInboundNum); |
| | | // 待出库数量 = 总数量 - 已出库数量 |
| | | dto.setInboundNum0(dto.getInboundNum().subtract(totalInboundNum)); |
| | | // 库存价值 |
| | | if(dto.getUnitPrice() != null){ |
| | | dto.setTotalPrice(dto.getInboundNum0().multiply(dto.getUnitPrice())); |
| | | } |
| | | } |
| | | return procurementPageDtoCopyIPage; |
| | | } |