| | |
| | | @Override |
| | | public IPage<ShippingInfoDto> listPage(Page page, ShippingInfo req) { |
| | | IPage<ShippingInfoDto> listPage = shippingInfoMapper.listPage(page, req); |
| | | listPage.getRecords().forEach(item ->{ |
| | | listPage.getRecords().forEach(item -> { |
| | | item.setStorageBlobVOs(fileUtil.getStorageBlobVOsByApplicationAndRecordTypeAndRecordId(ApplicationTypeEnum.IMAGE, RecordTypeEnum.SHIPPING_INFO, item.getId())); |
| | | }); |
| | | return listPage; |
| | |
| | | throw new RuntimeException("发货信息不存在"); |
| | | } |
| | | //扣减库存 |
| | | if(!"已发货".equals(byId.getStatus())){ |
| | | if (!"已发货".equals(byId.getStatus())) { |
| | | List<ShippingProductDetail> shippingProductDetails = shippingProductDetailMapper.selectList(new LambdaQueryWrapper<ShippingProductDetail>().eq(ShippingProductDetail::getShippingInfoId, req.getId())); |
| | | if (CollectionUtils.isEmpty(shippingProductDetails)) { |
| | | throw new RuntimeException("发货信息不存在"); |
| | |
| | | boolean update = this.updateById(byId); |
| | | // 保存文件 |
| | | fileUtil.saveStorageAttachment(ApplicationTypeEnum.IMAGE, RecordTypeEnum.SHIPPING_INFO, req.getId(), req.getStorageBlobDTOs()); |
| | | return update ; |
| | | return update; |
| | | } |
| | | |
| | | @Override |
| | | public boolean delete(List<Long> ids) { |
| | | List<ShippingInfo> shippingInfos = shippingInfoMapper.selectList(new LambdaQueryWrapper<ShippingInfo>() |
| | | .in(ShippingInfo::getId, ids)); |
| | | if(CollectionUtils.isEmpty(shippingInfos)) return false; |
| | | if (CollectionUtils.isEmpty(shippingInfos)) return false; |
| | | // 删除附件 |
| | | commonFileService.deleteByBusinessIds(ids, FileNameType.SHIP.getValue()); |
| | | // 扣已发货库存 |
| | | for (ShippingInfo shippingInfo : shippingInfos) { |
| | | if("已发货".equals(shippingInfo.getStatus())) { |
| | | if ("已发货".equals(shippingInfo.getStatus())) { |
| | | stockUtils.deleteStockOutRecord(shippingInfo.getId(), StockOutQualifiedRecordTypeEnum.SALE_SHIP_STOCK_OUT.getCode()); |
| | | } |
| | | } |
| | | // 删除发货审批 |
| | | if(CollectionUtils.isNotEmpty(shippingInfos)){ |
| | | for (ShippingInfo shippingInfo : shippingInfos){ |
| | | if (CollectionUtils.isNotEmpty(shippingInfos)) { |
| | | for (ShippingInfo shippingInfo : shippingInfos) { |
| | | List<ApproveProcess> one = approveProcessService.list(new LambdaQueryWrapper<ApproveProcess>() |
| | | .like(ApproveProcess::getApproveReason, shippingInfo.getShippingNo())); |
| | | if(one != null){ |
| | | if (one != null) { |
| | | List<Long> list = one.stream().map(ApproveProcess::getId).toList(); |
| | | approveProcessService.delByIds(list); |
| | | } |
| | |
| | | |
| | | @Override |
| | | public List<SalesLedgerProductDto> getReturnManagementDtoById(Long shippingId) { |
| | | return shippingInfoMapper.getReturnManagementDtoById(shippingId ); |
| | | return shippingInfoMapper.getReturnManagementDtoById(shippingId); |
| | | |
| | | } |
| | | |
| | |
| | | |
| | | @Override |
| | | public boolean add(ShippingInfoDto req) { |
| | | this.save( req); |
| | | this.save(req); |
| | | req.getBatchNoDetailList().forEach(item -> item.setShippingInfoId(req.getId())); |
| | | shippingProductDetailMapper.insert(req.getBatchNoDetailList()); |
| | | for (ShippingProductDetail shippingProductDetail : req.getBatchNoDetailList()) { |
| | | stockUtils.substractStock(shippingProductDetail.getProductModelId(), shippingProductDetail.getQuantity(), StockOutQualifiedRecordTypeEnum.SALE_SHIP_STOCK_OUT.getCode(), req.getId(), shippingProductDetail.getBatchNo()); |
| | | } |
| | | // 保存文件 |
| | | fileUtil.saveStorageAttachment(ApplicationTypeEnum.IMAGE, RecordTypeEnum.SHIPPING_INFO, req.getId(), req.getStorageBlobDTOs()); |
| | | return true; |
| | | } |
| | | |
| | |
| | | ShippingApproveDto shippingApproveDto = new ShippingApproveDto(); |
| | | ShippingInfo shippingInfo = new ShippingInfo(); |
| | | shippingInfo.setShippingNo(shippingNo); |
| | | shippingApproveDto.setShippingInfo(shippingInfoMapper.listPage(new Page(1, -1),shippingInfo).getRecords().get(0)); |
| | | shippingApproveDto.setShippingInfo(shippingInfoMapper.listPage(new Page(1, -1), shippingInfo).getRecords().get(0)); |
| | | List<ShippingProductDetailDto> dateilByShippingNo = shippingProductDetailMapper.getDateilByShippingNo(shippingNo); |
| | | shippingApproveDto.setShippingProductDetailDtoList(dateilByShippingNo); |
| | | return shippingApproveDto; |