From b10301c17300b91760295553d973523da51274fd Mon Sep 17 00:00:00 2001 From: zhenghaoyu Date: Tue, 21 May 2024 11:27:57 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BF=AE=E5=A4=8D=E5=B9=B2=E7=BA=BF=E6=B5=8B?= =?UTF-8?q?=E8=AF=95bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feign/IDistributionParcelListClient.java | 7 +++++ .../feign/DistributionParcelListClient.java | 17 +++++++++++ .../mapper/DistributionParcelListMapper.java | 5 ++++ .../mapper/DistributionParcelListMapper.xml | 30 +++++++++++++++++++ .../IDistributionParcelListService.java | 6 ++++ .../DistributionParcelListServiceImpl.java | 15 ++++++++++ .../service/impl/InComingServiceImpl.java | 5 ++-- .../service/impl/OpenOrderServiceImpl.java | 12 ++++++++ 8 files changed, 95 insertions(+), 2 deletions(-) diff --git a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionParcelListClient.java b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionParcelListClient.java index abb1a322f..5d0971e6f 100644 --- a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionParcelListClient.java +++ b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionParcelListClient.java @@ -171,4 +171,11 @@ public interface IDistributionParcelListClient { @GetMapping(API_PREFIX+"/findListByWaybillId") List findListByWaybillId(@RequestParam Long waybillId); + + @PostMapping(API_PREFIX+"/findPackagesByAdvanceIdsAndNoStock") + List findPackagesByAdvanceIdsAndNoStock(@RequestParam List advanceIds, @RequestParam Long warehouseId); + + @PostMapping(API_PREFIX+"/findAllOrderCodesByAdvanceIds") + List findAllOrderCodesAndDeleteByAdvanceIds(@RequestParam List advanceIds, @RequestParam Long warehouseId); + } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionParcelListClient.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionParcelListClient.java index d49107340..158062046 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionParcelListClient.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionParcelListClient.java @@ -34,6 +34,7 @@ import org.springblade.core.mp.support.BladePage; import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Query; import org.springblade.core.tool.api.R; +import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.*; import springfox.documentation.annotations.ApiIgnore; @@ -391,4 +392,20 @@ public class DistributionParcelListClient implements IDistributionParcelListClie return distributionParcelListService.list(queryWrapper); } + + @Override + public List findPackagesByAdvanceIdsAndNoStock(List advanceIds, Long warehouseId) { + return distributionParcelListService.findPackagesByAdvanceIdsAndNoStock(advanceIds,warehouseId); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public List findAllOrderCodesAndDeleteByAdvanceIds(List advanceIds, Long warehouseId) { + List orderCodes = distributionParcelListService.findAllOrderCodesByAdvanceIds(advanceIds, warehouseId); + distributionParcelListService.removePakcageByAdvanceIds(advanceIds,warehouseId); + + distributionStockArticleService.updateOrdersInfo(orderCodes,warehouseId); + + return orderCodes; + } } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionParcelListMapper.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionParcelListMapper.java index a2a04f3d6..9abc6ebe9 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionParcelListMapper.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionParcelListMapper.java @@ -270,4 +270,9 @@ public interface DistributionParcelListMapper extends BaseMapper advanceIds); + List findPackagesByAdvanceIdsAndNoStock(@Param("advanceIds") List advanceIds, @Param("warehouseId") Long warehouseId); + + List findAllOrderCodesByAdvanceIds(@Param("advanceIds") List advanceIds, @Param("warehouseId") Long warehouseId); + + void removePakcageByAdvanceIds(@Param("advanceIds") List advanceIds, @Param("warehouseId") Long warehouseId); } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionParcelListMapper.xml b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionParcelListMapper.xml index ad4753e00..95fcc019d 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionParcelListMapper.xml +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionParcelListMapper.xml @@ -1728,4 +1728,34 @@ + + + + + + delete from logpm_distribution_parcel_list + where advance_id in + + #{item} + + + diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionParcelListService.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionParcelListService.java index 5405bfe7d..4224e98d2 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionParcelListService.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionParcelListService.java @@ -229,4 +229,10 @@ public interface IDistributionParcelListService extends BaseService waybillIds); void clearParceListWaybillByAdvanceIds(List advanceIds); + + List findPackagesByAdvanceIdsAndNoStock(List advanceIds, Long warehouseId); + + List findAllOrderCodesByAdvanceIds(List advanceIds, Long warehouseId); + + void removePakcageByAdvanceIds(List advanceIds, Long warehouseId); } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionParcelListServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionParcelListServiceImpl.java index db9312070..c3e17623c 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionParcelListServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionParcelListServiceImpl.java @@ -1250,4 +1250,19 @@ public class DistributionParcelListServiceImpl extends BaseServiceImpl findPackagesByAdvanceIdsAndNoStock(List advanceIds, Long warehouseId) { + return baseMapper.findPackagesByAdvanceIdsAndNoStock(advanceIds,warehouseId); + } + + @Override + public List findAllOrderCodesByAdvanceIds(List advanceIds, Long warehouseId) { + return baseMapper.findAllOrderCodesByAdvanceIds(advanceIds,warehouseId); + } + + @Override + public void removePakcageByAdvanceIds(List advanceIds, Long warehouseId) { + baseMapper.removePakcageByAdvanceIds(advanceIds,warehouseId); + } + } diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/InComingServiceImpl.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/InComingServiceImpl.java index ce34756e0..24148ed30 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/InComingServiceImpl.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/InComingServiceImpl.java @@ -197,6 +197,7 @@ public class InComingServiceImpl implements IInComingService { // DynamicDataSourceContextHolder.push(tenantId); + Integer total = 0; for (Long advanceId : advanceIds) { QueryWrapper queryWrapper = new QueryWrapper<>(); queryWrapper.eq("advance_id", advanceId) @@ -213,11 +214,11 @@ public class InComingServiceImpl implements IInComingService { //存入日志 packageTrackLogAsyncService.addPackageTrackLog(tenantId, userId, deptId, nickName, orderPackageCodes, warehouseId, warehouseName, WorkNodeEnums.INITIAL_WAREHOUSE_ENTRY.getCode(), "包件" + IncomingTypeEnum.getValue(incomingType)); - + total = total + detailList.size(); } // DynamicDataSourceContextHolder.clear(); - return R.success("入库成功"); + return R.success("入库成功"+total+"件"); } } diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java index 1cf152bef..e7e9f0eb9 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java @@ -889,11 +889,23 @@ public class OpenOrderServiceImpl implements IOpenOrderService { @Override public void deletedAdvance(AdvanceDTO advanceDTO) { List advanceIds = advanceDTO.getAdvanceIds(); + Long warehouseId = advanceDTO.getWarehouseId(); + + //查询包件是否已经不在库 + List parcelListEntities = distributionParcelListClient.findPackagesByAdvanceIdsAndNoStock(advanceIds,warehouseId); + if(!parcelListEntities.isEmpty()){ + log.warn("############deletedAdvance: 已有包件出库,不能删除"); + throw new CustomerException(405,"已有包件出库,不能删除"); + } for (Long advanceId : advanceIds) { advanceDetailService.deleteByAdvanceId(advanceId); } advanceService.deletedAdvance(advanceIds); + + //删除所有在库包件,并更新订单信息 + distributionParcelListClient.findAllOrderCodesAndDeleteByAdvanceIds(advanceIds,warehouseId); + } @Override