From c31b9a093c36435c7b8d2f85af980f29fbb9873c Mon Sep 17 00:00:00 2001 From: kilo Date: Fri, 13 Oct 2023 10:46:06 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A2=84=E7=BA=A6=E8=AF=A6=E6=83=85=E6=9F=A5?= =?UTF-8?q?=E7=9C=8B=E9=9B=B6=E6=8B=85=E8=AE=A2=E5=8D=95=E3=80=81=E9=A2=84?= =?UTF-8?q?=E7=BA=A6=E8=AF=A6=E6=83=85=E9=9B=B6=E6=8B=85=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E5=8C=85=E4=BB=B6=E5=91=88=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DistributionReservationServiceImpl.java | 92 +++++++++++++++---- 1 file changed, 74 insertions(+), 18 deletions(-) diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionReservationServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionReservationServiceImpl.java index cbd17a84c..f4ec9002e 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionReservationServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionReservationServiceImpl.java @@ -241,22 +241,76 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl reservationStockarticleEntityList = distributionReservationStockarticleService.list(Wrappers.query().lambda() + .eq(DistributionReservationStockarticleEntity::getReservationId, reservationEntity.getId()) + .ne(DistributionReservationStockarticleEntity::getStockArticleStatus, ReservationOrderStatusConstant.quxiao.getValue())); + ArrayList distributionStockArticleVOS = new ArrayList<>(); + if (Func.isNotEmpty(reservationStockarticleEntityList)) { + reservationStockarticleEntityList.forEach(rs -> { + DistributionStockArticleEntity stockArticleEntity = distributionStockArticleService.getById(rs.getStockArticleId()); + DistributionStockArticleVO distributionStockArticleVO = DistributionStockArticleWrapper.build().entityVO(stockArticleEntity); + if (rs.getIsZero().equals(IsOrNoConstant.no.getValue())) { + List reservationPackageEntityList = distributionReservationPackageService.list(Wrappers.query().lambda() + .eq(DistributionReservationPackageEntity::getReservationId, reservationEntity.getId()) + .eq(DistributionReservationPackageEntity::getStockArticleId, rs.getStockArticleId()) + .ne(DistributionReservationPackageEntity::getPacketBarStatus, ReservationPackageStatusConstant.quxiao.getValue())); + if (Func.isNotEmpty(reservationPackageEntityList)) { + ArrayList distributionParcelListVOS = new ArrayList<>(); + reservationPackageEntityList.forEach(rp -> { + DistributionParcelListEntity parcelListEntity = distributionParcelListService.getById(rp.getParceListId()); + DistributionParcelListVO parcelListVOS = DistributionParcelListWrapper.build().entityVO(parcelListEntity); + parcelListVOS.setQuantity(parcelListEntity.getQuantity()); + distributionParcelListVOS.add(parcelListVOS); + }); + distributionStockArticleVO.setPackageList(distributionParcelListVOS); + }else { + log.error("预约下订单包件信息缺失,订单ID为:{}",rs.getStockArticleId()); + } + } else if (rs.getIsZero().equals(IsOrNoConstant.yes.getValue())) { + List reservationZeroPackageEntityList = distributionReservationZeroPackageService.list(Wrappers.query().lambda() + .eq(DistributionReservationZeroPackageEntity::getReservationId, reservationEntity.getId()) + .eq(DistributionReservationZeroPackageEntity::getStockArticleId, rs.getStockArticleId()) + .ne(DistributionReservationZeroPackageEntity::getZeroPackageStatus, ReservationPackageStatusConstant.quxiao.getValue())); + if (Func.isNotEmpty(reservationZeroPackageEntityList)) { + ArrayList distributionParcelListVOS = new ArrayList<>(); + reservationZeroPackageEntityList.forEach(rzp -> { + DistributionParcelListEntity parcelListEntity = distributionParcelListService.getById(rzp.getParcelListId()); + DistributionParcelListVO parcelListVOS = DistributionParcelListWrapper.build().entityVO(parcelListEntity); + parcelListVOS.setQuantity(rzp.getQuantity()); + distributionParcelListVOS.add(parcelListVOS); + }); + distributionStockArticleVO.setPackageList(distributionParcelListVOS); + } else { + log.error("#######################预约下订单包件信息缺失,订单ID为:{}",rs.getStockArticleId()); + } + }else { + log.error("####################预约订单中间表isZero字段缺失,reservation_stockArticle的ID为:{}",rs.getId()); + } + distributionStockArticleVOS.add(distributionStockArticleVO); - - //1、查询预约单下的订单列表信息 - List stockArticleEntityList = distributionReservationMapper.getStockArticleList(reservationId); - List stockArticleVOS = DistributionStockArticleWrapper.build().listVO(stockArticleEntityList); - stockArticleVOS.forEach(s -> { - //查询出这个订单在这个预约计划的选择情况 - List packageEntityList = distributionReservationMapper.selectPackageByReservationAndStockArticle(reservationId, s.getId()); -// List packageList = distributionReservationPackageService.getStockArticlePackageList(packageEntityList); - List parcelListVOS = DistributionParcelListWrapper.build().listVO(packageEntityList); - s.setPackageList(parcelListVOS); - }); - reservationVO.setStockArticleList(stockArticleVOS); + }); + }else { + log.error("######################预约订单信息缺失,reservationID为:{}",reservationEntity.getId()); + } + reservationVO.setStockArticleList(distributionStockArticleVOS); return R.data(reservationVO); + } +// //1、查询预约单下的订单列表信息 +// List stockArticleEntityList = distributionReservationMapper.getStockArticleList(reservationId); +// List stockArticleVOS = DistributionStockArticleWrapper.build().listVO(stockArticleEntityList); +// stockArticleVOS.forEach(s -> { +// //查询出这个订单在这个预约计划的选择情况 +// List packageEntityList = distributionReservationMapper.selectPackageByReservationAndStockArticle(reservationId, s.getId()); +//// List packageList = distributionReservationPackageService.getStockArticlePackageList(packageEntityList); +// List parcelListVOS = DistributionParcelListWrapper.build().listVO(packageEntityList); +// s.setPackageList(parcelListVOS); +// }); +// reservationVO.setStockArticleList(stockArticleVOS); +// return R.data(reservationVO); +// } + @Override @Transactional public R insertReservation(DistributionReservationDTO distributionReservationDTO) { @@ -2312,7 +2366,7 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl getReservationPackageList(Long reservationId) { - if (Func.isNotEmpty(reservationId)) { + if (Func.isEmpty(reservationId)) { log.error("参数异常reservationId+{" + reservationId + "}"); return R.fail("服务器正忙!!"); } @@ -2330,7 +2384,9 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl{ DistributionParcelListEntity parcelListEntity = distributionParcelListService.getById(rp.getParceListId()); - distributionParcelListVOS.add(DistributionParcelListWrapper.build().entityVO(parcelListEntity)); + DistributionParcelListVO distributionParcelListVO = DistributionParcelListWrapper.build().entityVO(parcelListEntity); + distributionParcelListVO.setReservationNum(parcelListEntity.getQuantity()); + distributionParcelListVOS.add(distributionParcelListVO); }); }else { log.error("####################此预约下订单查询包件信息错误,订单ID为:{}",rs.getStockArticleId()); @@ -2342,11 +2398,11 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl{ - - + DistributionParcelListEntity parcelListEntity = distributionParcelListService.getById(rp.getParcelListId()); + DistributionParcelListVO distributionParcelListVO = DistributionParcelListWrapper.build().entityVO(parcelListEntity); + distributionParcelListVO.setReservationNum(rp.getQuantity()); + distributionParcelListVOS.add(distributionParcelListVO); }); - - }else { log.error("####################此预约下零担订单查询品类信息错误,订单ID为:{}",rs.getStockArticleId()); }