diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationMapper.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationMapper.java index 2093c1cc8..400ea280d 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationMapper.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationMapper.java @@ -153,6 +153,14 @@ public interface DistributionReservationMapper extends BaseMapper selectStockArticleByReservationId(@Param("reservationId") Long id); + + /** + * 批量查询预约的订单中间表 + * @param reservationIds + * @return + */ + List selectStockArticleByReservationIds(@Param("reservationIds") List reservationIds); + /** * 查询预约单下的订单信息 * @param id @@ -395,4 +403,6 @@ public interface DistributionReservationMapper extends BaseMapper selectPackageListByReservationIds(@Param("reservationIds") List reservationIds); + + List selectPackageByReservations(@Param("reservationIds") List reservationIds, @Param("warehouseId")Long warehouseId); } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationMapper.xml b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationMapper.xml index f94e66227..2266ffb12 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationMapper.xml +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationMapper.xml @@ -1848,4 +1848,106 @@ + + diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java index 4959282d5..5c7feb756 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java @@ -2499,11 +2499,34 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl customList = distributionDeliveryInfoMapper.selectAppcustomListPage(distributionDeliveryList.getId()); + + + + + // 查询所有的预约单ID + List idList = customList.stream() + .map(DistributionAppReservationVO::getId) + .collect(Collectors.toList()); + List reservationStockarticleEntityLists =distributionReservationMapper.selectStockArticleByReservationIds(idList); + + + + for (DistributionAppReservationVO distributionAppReservationVO : customList) { - List reservationStockarticleEntityList = distributionReservationMapper.selectStockArticleByReservationId(distributionAppReservationVO.getId()); + List reservationStockarticleEntityList = localFindReservationStockarticleEntityLists(reservationStockarticleEntityLists,distributionAppReservationVO.getId()); + List distributionStockEntities = new ArrayList<>(); List loadscanEntityList = new ArrayList<>(); List trayList = new ArrayList<>(); + + + List reaveIds=reservationStockarticleEntityList.stream() + .map(DistributionReservationStockarticleEntity::getReservationId) + .collect(Collectors.toList()); + + + + List allParcelListEntities =distributionReservationMapper.selectPackageByReservations(reaveIds, myCurrentWarehouse.getId()); for (DistributionReservationStockarticleEntity reservationStockarticleEntity : reservationStockarticleEntityList) { if (reservationStockarticleEntity.getIsZero().equals(IsOrNoConstant.no.getValue())) { //查询订制品备货数量 @@ -2513,7 +2536,11 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl parcelListEntities = distributionReservationMapper.selectPackageByReservationAndStockArticle(reservationStockarticleEntity.getReservationId(), reservationStockarticleEntity.getStockArticleId(), myCurrentWarehouse.getId()); +// List parcelListEntities = distributionReservationMapper.selectPackageByReservationAndStockArticle(reservationStockarticleEntity.getReservationId(), reservationStockarticleEntity.getStockArticleId(), myCurrentWarehouse.getId()); + + List parcelListEntities =localFindAllParcelListEntities(allParcelListEntities,reservationStockarticleEntity.getStockArticleId()); + + parcelListEntities.forEach(p -> { WarehouseTrayGoodsEntity warehouseTrayGoodsEntity = new WarehouseTrayGoodsEntity(); warehouseTrayGoodsEntity.setAssociationId(p.getId()); @@ -2586,6 +2613,38 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl localFindAllParcelListEntities(List allParcelListEntities, Long stockArticleId) { + List temp = new ArrayList<>(); + + allParcelListEntities.forEach(t->{ + + if(t.getStockArticleId().equals(stockArticleId)){ + temp.add(t); + } + + }); + + log.info(">>>>>>>>> localFindAllParcelListEntities 寻找的包件集合{}",temp); + return temp; + } + + /** + * 找寻预约单ID 相同的数据进行返回 + * @param reservationStockarticleEntityLists + * @param id + * @return List + */ + private List localFindReservationStockarticleEntityLists(List reservationStockarticleEntityLists, Long id) { + List temp = new ArrayList<>(); + reservationStockarticleEntityLists.forEach(t->{ + if(t.getReservationId().equals(id)){ + temp.add(t); + } + }); + log.info(">>>>> localFindReservationStockarticleEntityLists 寻找匹配的预约订单集合:{} ",temp); + return temp; + } + @Override public List selectDistributionAppDeliverywrapIn(DistributionAppDeliveryListDTO distributionAppDeliveryListDTO) { List detailEntities = baseMapper.selectInventoryListByDeliveryListId(distributionAppDeliveryListDTO.getId());