| | |
| | | import com.ruoyi.sales.pojo.SalesLedgerProduct; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.util.StringUtils; |
| | |
| | | |
| | | @Override |
| | | public IPage<CustomStorage> listPageCopyByCustom(Page page, CustomStorage customStorage) { |
| | | // 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(); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public ProcurementRecordStorage detail(ProcurementUpdateDto procurementDto) { |
| | | if(procurementDto == null) return null; |
| | | return procurementRecordMapper.selectById(procurementDto.getId()); |
| | | public ProcurementPageDto detail(ProcurementUpdateDto procurementDto) { |
| | | ProcurementPageDto procurementPageDto = new ProcurementPageDto(); |
| | | if(procurementDto == null) return procurementPageDto; |
| | | ProcurementRecordStorage procurementRecordStorage = procurementRecordMapper.selectById(procurementDto.getId()); |
| | | if(procurementRecordStorage == null) return procurementPageDto; |
| | | BeanUtils.copyProperties(procurementRecordStorage, procurementPageDto); |
| | | SalesLedgerProduct salesLedgerProduct = salesLedgerProductMapper.selectById(procurementRecordStorage.getSalesLedgerProductId()); |
| | | if(salesLedgerProduct != null){ |
| | | procurementPageDto.setProductCategory(salesLedgerProduct.getProductCategory()); |
| | | procurementPageDto.setSpecificationModel(salesLedgerProduct.getSpecificationModel()); |
| | | procurementPageDto.setUnit(salesLedgerProduct.getUnit()); |
| | | procurementPageDto.setTaxInclusiveUnitPrice(salesLedgerProduct.getTaxInclusiveUnitPrice()); |
| | | } |
| | | return procurementPageDto; |
| | | } |
| | | |
| | | @Override |
| | |
| | | .createTime(LocalDateTime.now()) |
| | | .createUser(loginUser.getUserId()) |
| | | .updateTime(LocalDateTime.now()) |
| | | .boxNum(detail.getBoxNum()) |
| | | .cartonSpecifications(detail.getCartonSpecifications()) |
| | | .dollarPrice(detail.getDollarPrice()) |
| | | .updateUser(loginUser.getUserId()) |
| | | .createBy(procurementDto.getNickName()); |
| | | this.save(procurementRecordBuilder.build()); |
| | | // 入库成功减掉采购数量 |
| | | // LambdaQueryWrapper<SalesLedgerProduct> salesLedgerProductLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | // salesLedgerProductLambdaQueryWrapper.eq(SalesLedgerProduct::getId, detail.getId()); |
| | | // SalesLedgerProduct salesLedgerProduct = salesLedgerProductMapper.selectOne(salesLedgerProductLambdaQueryWrapper); |
| | | // if(salesLedgerProduct == null){ |
| | | // throw new RuntimeException("未找到该商品"); |
| | | // } |
| | | // salesLedgerProduct.setQuantity(salesLedgerProduct.getQuantity().subtract(detail.getInboundQuantity())); |
| | | // salesLedgerProductMapper.updateById(salesLedgerProduct); |
| | | } |
| | | return 1; |
| | | } |