From 9685b7d45b27e0c2a5c40b68ffd5e66c3b4d9fc5 Mon Sep 17 00:00:00 2001 From: kilo Date: Wed, 16 Aug 2023 13:30:59 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=B8=82=E9=85=8D=E9=A2=84=E7=BA=A6?= =?UTF-8?q?=E8=AE=A1=E5=88=92=E7=BC=96=E8=BE=91=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ReservationInventoryStatusConstant.java | 47 ++ .../entity/DistributionParcelListEntity.java | 2 +- ...istributionReservationStocklistEntity.java | 2 +- .../DistributionStockArticleController.java | 29 ++ .../mapper/DistributionDeliveryInfoMapper.xml | 6 +- .../mapper/DistributionParcelListMapper.java | 2 +- .../DistributionReservationPackageMapper.java | 2 +- .../DistributionReservationPackageMapper.xml | 4 +- ...istributionReservationStocklistMapper.java | 8 + ...DistributionReservationStocklistMapper.xml | 15 +- .../IDistributionStockArticleService.java | 8 + .../DistributionDeliveryListServiceImpl.java | 13 +- .../DistributionReservationServiceImpl.java | 430 ++++++++---------- .../DistributionStockArticleServiceImpl.java | 18 +- .../DistributionParcelListWrapper.java | 1 + .../wrapper/DistributionStockListWrapper.java | 34 ++ 16 files changed, 351 insertions(+), 270 deletions(-) create mode 100644 blade-biz-common/src/main/java/org/springblade/common/constant/reservation/ReservationInventoryStatusConstant.java create mode 100644 blade-service/logpm-distribution/src/main/java/com/logpm/distribution/wrapper/DistributionStockListWrapper.java diff --git a/blade-biz-common/src/main/java/org/springblade/common/constant/reservation/ReservationInventoryStatusConstant.java b/blade-biz-common/src/main/java/org/springblade/common/constant/reservation/ReservationInventoryStatusConstant.java new file mode 100644 index 000000000..669d791f1 --- /dev/null +++ b/blade-biz-common/src/main/java/org/springblade/common/constant/reservation/ReservationInventoryStatusConstant.java @@ -0,0 +1,47 @@ +package org.springblade.common.constant.reservation; + +/** + * 预约单状态枚举 + * 对应码表 + * resvervation_status + * @author pref + */ +public enum ReservationInventoryStatusConstant { + + zhengchang("正常","1"), + quxiao("取消","2"), + zengjia("增加","3"); + + + /** + * 状态 + */ + private String name; + + /** + * 值 + */ + private String value; + + + private ReservationInventoryStatusConstant(String name, String value) { + this.name = name; + this.value = value; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } +} diff --git a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionParcelListEntity.java b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionParcelListEntity.java index 79ed88020..bc43ca62a 100644 --- a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionParcelListEntity.java +++ b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionParcelListEntity.java @@ -85,7 +85,7 @@ public class DistributionParcelListEntity extends TenantEntity { * 包条码 */ @ApiModelProperty(value = "包条码") - @TableField("order_package_code") +// @TableField("order_package_code") private String orderPackageCode; @ApiModelProperty(value = "货区信息") diff --git a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionReservationStocklistEntity.java b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionReservationStocklistEntity.java index ddaafacec..acc2bd579 100644 --- a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionReservationStocklistEntity.java +++ b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionReservationStocklistEntity.java @@ -68,7 +68,7 @@ public class DistributionReservationStocklistEntity extends TenantEntity { * 库存品状态 ;1-正常、2-取消 */ @ApiModelProperty(value = "库存品状态 ;1-正常、2-取消") - private Integer stockListStatus; + private String stockListStatus; /** * 预留1 */ diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionStockArticleController.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionStockArticleController.java index 88fb1539b..dbbddcff0 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionStockArticleController.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionStockArticleController.java @@ -111,6 +111,35 @@ public class DistributionStockArticleController extends BladeController { IPage pages = distributionStockArticleService.page(Condition.getPage(query), queryWrapper); return R.data(DistributionStockArticleWrapper.build().pageVO(pages)); + } /** + * 配送在库订单 分页 + */ + @GetMapping("/selectStockArticleInfoList") + @ApiOperationSupport(order = 2) + @ApiOperation(value = "分页", notes = "传入distributionStockArticle") + public R> selectStockArticleInfoList(@ApiIgnore @RequestParam Map distributionStockArticle, Query query) { + Object o = distributionStockArticle.get("orderSelfNumbering"); + distributionStockArticle.remove("orderSelfNumbering"); + Object o2 = distributionStockArticle.get("startDate"); + Object o1 = distributionStockArticle.get("entDate"); + Object d = distributionStockArticle.get("id"); + distributionStockArticle.remove("id"); + distributionStockArticle.remove("startDate"); + distributionStockArticle.remove("entDate"); + QueryWrapper queryWrapper = Condition.getQueryWrapper(distributionStockArticle, DistributionStockArticleEntity.class); + if(Func.isNotEmpty(o)){ + queryWrapper.in("order_self_numbering",String.valueOf(o).split(",")); + } + if(ObjectUtil.isNotEmpty(d)){ + queryWrapper.in("id",String.valueOf(d).split(",")); + } + if(ObjectUtil.isNotEmpty(o2)){ + queryWrapper.between("warehouse_entry_time",o2,o1); + } + IPage pages = distributionStockArticleService.page(Condition.getPage(query), queryWrapper); + IPage distributionStockArticleVOIPage = distributionStockArticleService.handlePackage(DistributionStockArticleWrapper.build().pageVO(pages)); + return R.data(distributionStockArticleVOIPage); + } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryInfoMapper.xml b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryInfoMapper.xml index 22466859f..3ab4357da 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryInfoMapper.xml +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryInfoMapper.xml @@ -91,7 +91,7 @@ logpm_distribution_signfor lds JOIN logpm_distribution_reservation ldr ON ldr.id = lds.reservation_id - lds.is_deleted = 0 and lds.delivery_id = #{id} + lds.is_deleted = 0 and lds.delivery_id = #{id} and ldr.reservation_status != 40 SELECT distinct ldsa.order_code orderCode, + ldsa.consignee_unit, + ldsa.consignee_person, + ldsa.consignee_address, + ldsa.consignee_mobile, ldsa.description_goods descriptionGoods, ( 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 03901aaf2..83b2b5718 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 @@ -70,7 +70,7 @@ public interface DistributionParcelListMapper extends BaseMapper getPageVOList(Page objectPage, Long id); + List getPageVOList( Long id); List getStockDataBase(@Param("param") DistributionParcelListEntity parcelListEntity); } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationPackageMapper.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationPackageMapper.java index 11d168c99..527bca645 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationPackageMapper.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationPackageMapper.java @@ -101,7 +101,7 @@ public interface DistributionReservationPackageMapper extends BaseMapper selectPackageVOList(Page objectPage,@Param("reservationId") Long id,@Param("stockArticleId") Long id1); + List selectPackageVOList(@Param("reservationId") Long id,@Param("stockArticleId") Long id1); /** * diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationPackageMapper.xml b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationPackageMapper.xml index 6bb0b1ada..fb18fee19 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationPackageMapper.xml +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationPackageMapper.xml @@ -198,10 +198,9 @@ WHERE logpm_distribution_reservation_package AS ldrp INNER JOIN logpm_distribution_parcel_list AS ldpl ON ldrp.parce_list_id = ldpl.id - ldpl.packet_bar_status != 2 + ldrp.packet_bar_status != 2 and ldrp.reservation_id =#{reservationId} - and ldrp.stock_article_id =#{stockArticleId} @@ -232,6 +231,7 @@ WHERE packet_bar_status FROM logpm_distribution_reservation_package + packet_bar_status != 2 and reservation_id =#{reservationId} diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationStocklistMapper.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationStocklistMapper.java index 943b2b0f2..6d5857bb2 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationStocklistMapper.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationStocklistMapper.java @@ -18,6 +18,7 @@ package com.logpm.distribution.mapper; import com.logpm.distribution.entity.DistributionParcelListEntity; import com.logpm.distribution.entity.DistributionReservationStocklistEntity; +import com.logpm.distribution.entity.DistributionStockListEntity; import com.logpm.distribution.vo.DistributionReservationStocklistVO; import com.logpm.distribution.excel.DistributionReservationStocklistExcel; import com.baomidou.mybatisplus.core.mapper.BaseMapper; @@ -71,4 +72,11 @@ public interface DistributionReservationStocklistMapper extends BaseMapper selectReservationPackageNum(@Param("reservationId")Long id,@Param("stockArticleId") Long stockArticleId); + + /** + * 查询预约下的有效库存品 + * @param id + * @return + */ + List selectInventory(@Param("reservationId") Long id); } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationStocklistMapper.xml b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationStocklistMapper.xml index 76c830c7d..d941ad0ff 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationStocklistMapper.xml +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationStocklistMapper.xml @@ -102,5 +102,18 @@ - + diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionStockArticleService.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionStockArticleService.java index 459bc8829..18056221b 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionStockArticleService.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionStockArticleService.java @@ -17,6 +17,7 @@ package com.logpm.distribution.service; import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.logpm.distribution.dto.DistributionStockArticleDTO; import com.logpm.distribution.entity.DistributionStockArticleEntity; import com.logpm.distribution.vo.DistributionStockArticleVO; @@ -105,4 +106,11 @@ public interface IDistributionStockArticleService extends BaseService params) throws Exception; + + /** + * 处理订单包件信息 + * @param pageVO + * @return + */ + IPage handlePackage( IPage pageVO); } 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 7ad549989..7bf70b561 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 @@ -1186,17 +1186,12 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl parcelListEntities = distributionReservationPackageMapper.getDeliveryReservationPackage(deliveryListEntity.getId(), s.getId()); + List distributionParcelListVOS = DistributionParcelListWrapper.build().listVO(parcelListEntities); //查询出订单的所有包件信息 List parcelListEntityList = distributionParcelListService.getBaseMapper().selectList(Wrappers.query().lambda().eq(DistributionParcelListEntity::getStockArticleId, s.getId())); - ArrayList packageList = new ArrayList<>(); - ArrayList parcelListVOS = new ArrayList<>(); - parcelListEntities.forEach(p->{ - packageList.add(DistributionParcelListWrapper.build().entityVO(p)); - }); - parcelListEntityList.forEach(a->{ - parcelListVOS.add(DistributionParcelListWrapper.build().entityVO(a)); - }); - s.setPackageList(packageList); + List parcelListVOS = DistributionParcelListWrapper.build().listVO(parcelListEntityList); + + s.setPackageList(distributionParcelListVOS); s.setParcelListVOS(parcelListVOS); }); deliveryListVO.setStockArticleList(stockArticleVOS); 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 c677b4ca6..bb5a866fb 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 @@ -30,11 +30,14 @@ import com.logpm.distribution.mapper.*; import com.logpm.distribution.service.*; import com.logpm.distribution.vo.*; import com.logpm.distribution.wrapper.DistributionParcelListWrapper; +import com.logpm.distribution.wrapper.DistributionStockArticleWrapper; +import com.logpm.distribution.wrapper.DistributionStockListWrapper; import org.springblade.common.constant.DistributionTypeConstant; import org.springblade.common.constant.delivery.DeliveryStatusConstant; import org.springblade.common.constant.order.OrderReservationStatusConstant; import org.springblade.common.constant.orderpackage.OrderPackageFreezeStatusConstant; import org.springblade.common.constant.orderpackage.OrderPackageReservationStatusConstant; +import org.springblade.common.constant.orderpackage.OrderPackageStatusConstant; import org.springblade.common.constant.orderpackage.OrderPackageStockupStatusConstant; import org.springblade.common.constant.reservation.*; import org.springblade.common.constant.signing.SignforStatusConstant; @@ -508,23 +511,23 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl reservationEntityList = baseMapper.selectList(Wrappers.query().lambda().in(DistributionReservationEntity::getId, ids)); boolean flag = reservationEntityList.stream().anyMatch(s -> s.getStockupStatus().equals(ReservationStockupStatusConstant.weibeihuo.getValue())); - if (flag){ - if (Func.isNotEmpty(stockup.getLoaderName())){ + if (flag) { + if (Func.isNotEmpty(stockup.getLoaderName())) { distributionStockupEntity.setLoaderName(stockup.getLoaderName()); distributionStockupEntity.setLoaderId(stockup.getLoaderId()); } - if (Func.isNotEmpty(stockup.getGoodsAreaName())){ + if (Func.isNotEmpty(stockup.getGoodsAreaName())) { distributionStockupEntity.setStockupArea(stockup.getGoodsAreaName()); distributionStockupEntity.setGoodsAreaId(stockup.getGoodsAreaId()); } - if (Func.isNotEmpty(stockup.getGoodsAreaName())){ + if (Func.isNotEmpty(stockup.getGoodsAreaName())) { distributionStockupEntity.setStockupArea(stockup.getGoodsAreaName()); distributionStockupEntity.setGoodsAreaId(stockup.getGoodsAreaId()); } - if (Func.isNotEmpty(stockup.getLoadAndUnload())){ + if (Func.isNotEmpty(stockup.getLoadAndUnload())) { distributionStockupEntity.setTeamResponsibility(stockup.getLoadAndUnload()); } - if (Func.isNotEmpty(stockup.getOutboundDate())){ + if (Func.isNotEmpty(stockup.getOutboundDate())) { distributionStockupEntity.setOutboundDate(stockup.getOutboundDate()); } BladeUser user = AuthUtil.getUser(); @@ -535,7 +538,7 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl distrinbutionStockArticleVOS = distributionStockArticleMapper.getStockArticleByReservationId(reservationEntity.getId()); distrinbutionStockArticleVOS.forEach(s -> { //这里查询两个东西,一个是该订单在预约中所被选取的包件信息,以及该订单下所有的包件列表 - Page pageVOList = distributionParcelListMapper.getPageVOList(new Page<>(), s.getId()); - s.setParcelListVOS(DistributionParcelListWrapper.build().pageVO(pageVOList).getRecords()); + List pageVOList = distributionParcelListMapper.getPageVOList(s.getId()); + s.setParcelListVOS(DistributionParcelListWrapper.build().listVO(pageVOList)); //这里查询出该订单下已经被选取的包件信息 - Page packageVOList = distributionReservationPackageMapper.selectPackageVOList(new Page<>(), reservationEntity.getId(), s.getId()); - s.setPackageList(DistributionParcelListWrapper.build().pageVO(packageVOList).getRecords()); + List packageVOList = distributionReservationPackageMapper.selectPackageVOList(reservationEntity.getId(), s.getId()); + s.setPackageList(DistributionParcelListWrapper.build().listVO(packageVOList)); }); reservationVO.setStockArticleList(distrinbutionStockArticleVOS); - if (!Func.isEmpty(reservationStocklistEntityList)) { - List stockArticleEntityList = new ArrayList<>(); - reservationStocklistEntityList.forEach(a2 -> { - DistributionStockListEntity stockListEntity = distributionStockListService.getById(a2.getStocklistId()); - stockListEntity.setReservationNum(a2.getReservationNum()); - stockArticleEntityList.add(stockListEntity); - }); - List stockListVOList = Func.copy(stockArticleEntityList, DistributionStockListVO.class); - //查询出 库存信息 - reservationVO.setInventoryList(stockListVOList); - } + List stockArticleEntityList = distributionReservationStocklistMapper.selectInventory(reservationEntity.getId()); + reservationVO.setInventoryList(DistributionStockListWrapper.build().listVO(stockArticleEntityList)); return R.data(reservationVO); } @@ -732,244 +726,182 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl distributionReservationStockarticleEntities = distributionReservationStockarticleService.getBaseMapper().selectList(Wrappers.query().lambda().eq(DistributionReservationStockarticleEntity::getReservationId, id)); - Map> reservationStockarticleMap = distributionReservationStockarticleEntities.stream().collect(Collectors.groupingBy(DistributionReservationStockarticleEntity::getStockArticleId)); + Map> oldStockArticle = distributionReservationStockarticleEntities.stream().collect(Collectors.groupingBy(DistributionReservationStockarticleEntity::getStockArticleId)); List dtoStockArticleList = distributionReservationDTO.getStockArticleList(); - Map> newStockArticleMap = dtoStockArticleList.stream().collect(Collectors.groupingBy(DistributionStockArticleDTO::getId)); - newStockArticleMap.forEach((k,v)->{ - if (Func.isNotEmpty(reservationStockarticleMap.get(k))){ - List distributionStockArticleDTOS = newStockArticleMap.get(k); - DistributionStockArticleDTO distributionStockArticleDTO = distributionStockArticleDTOS.get(0); - DistributionStockArticleEntity stockArticleEntity = Func.copy(distributionStockArticleDTO, DistributionStockArticleEntity.class); - //查询出预约订单中间表数据,进行包件数量维护 - DistributionReservationStockarticleEntity reservationStockarticleEntity = distributionReservationStockarticleMapper.selectReservationAndStockArticleId(id,k); - Integer reservationNum = reservationStockarticleEntity.getReservationNum(); - List packageList = distributionStockArticleDTO.getPackageListInfo(); - //这里将包件数据和原来预约的包件数据进行比对 - //查询出这个预约的这个订单下的包包件预约情况 -// Page packageVOList = distributionReservationPackageMapper.selectPackageVOList(new Page<>(), id, k); - List parcelListEntities = distributionReservationPackageMapper.selectPackageByReservationAndStockArticleId( id, k); - //查询出原计划的包件选取情况 - Map> oldPackageListMap = parcelListEntities.stream().collect(Collectors.groupingBy(DistributionReservationPackageEntity::getParceListId)); - Map> newPackageListMap = packageList.stream().collect(Collectors.groupingBy(DistributionParcelListEntity::getId)); - //表示原来的这个订单在预约单下已经存在 - //包件数量累加 + Map> newStockArticle = dtoStockArticleList.stream().collect(Collectors.groupingBy(DistributionStockArticleDTO::getId)); + AtomicInteger packTotal = new AtomicInteger(); + AtomicInteger reduceTotal = new AtomicInteger(); + newStockArticle.forEach((k, v) -> { + if (Func.isEmpty(oldStockArticle.get(k))) { + //这里发生了新增订单的操作 + DistributionStockArticleDTO distributionStockArticleDTO = v.get(0); + List packageListInfo = distributionStockArticleDTO.getPackageListInfo(); AtomicInteger packageNum = new AtomicInteger(); - newPackageListMap.forEach((p,i)->{ - if (Func.isNotEmpty(oldPackageListMap.get(p))){ - //原计划中不存在这个包件信息,这里需要将这条包件信息进行添加 - oldPackageListMap.remove(p); - }else { - //从记录中获取不到这个包件信息,这里就需要将这个包件信息和这个预约信息进行关系的绑定 - DistributionParcelListEntity distributionParcelListEntity = i.get(0); - DistributionReservationPackageEntity distributionReservationPackageEntity = new DistributionReservationPackageEntity(); - distributionReservationPackageEntity.setReservationId(id); - distributionReservationPackageEntity.setStockArticleId(k); - distributionReservationPackageEntity.setPacketBarStatus(ReservationPackageStatusConstant.zhengchang.getValue()); - distributionReservationPackageEntity.setParceListId(p); - distributionReservationPackageService.save(distributionReservationPackageEntity); + packageListInfo.forEach(p -> { + DistributionReservationPackageEntity reservationPackageEntity = new DistributionReservationPackageEntity(); + reservationPackageEntity.setStockArticleId(distributionStockArticleDTO.getId()); + reservationPackageEntity.setPacketBarStatus(ReservationPackageStatusConstant.xinzeng.getValue()); + reservationPackageEntity.setPacketBarCode(p.getOrderPackageCode()); + reservationPackageEntity.setParceListId(p.getId()); + reservationPackageEntity.setReservationId(id); + distributionReservationPackageService.save(reservationPackageEntity); + packageNum.getAndAdd(p.getQuantity()); + DistributionParcelListEntity parcelListEntity = distributionParcelListService.getById(p.getId()); + parcelListEntity.setOrderPackageReservationStatus(OrderPackageReservationStatusConstant.yiyueyue.getValue()); + distributionParcelListService.updateById(parcelListEntity); + }); + DistributionReservationStockarticleEntity reservationStockarticleEntity = new DistributionReservationStockarticleEntity(); + reservationStockarticleEntity.setStockArticleStatus(ReservationOrderStatusConstant.zengjia.getValue()); + reservationStockarticleEntity.setStockArticleCode(distributionStockArticleDTO.getStockArticleCode()); + reservationStockarticleEntity.setStockArticleId(distributionStockArticleDTO.getId()); + reservationStockarticleEntity.setReservationId(id); + reservationStockarticleEntity.setReservationNum(packageNum.get()); + distributionReservationStockarticleService.save(reservationStockarticleEntity); + packTotal.getAndAdd(reservationStockarticleEntity.getReservationNum()); + String status = distributionReservationPackageService.judgmentStatus(distributionStockArticleDTO); + DistributionStockArticleEntity stockArticleEntity = distributionStockArticleService.getById(distributionStockArticleDTO.getId()); + stockArticleEntity.setReservationStatus(status); + distributionStockArticleService.updateById(stockArticleEntity); + } else { + //查询出这个订单原来在这个预约中的勾选情况 + DistributionStockArticleDTO distributionStockArticleDTO = v.get(0); + List packageEntityList = distributionReservationPackageMapper.selectPackageByReservationAndStockArticleId(id, k); + Map> oldPackage = packageEntityList.stream().collect(Collectors.groupingBy(DistributionReservationPackageEntity::getParceListId)); + Map> newPackage = distributionStockArticleDTO.getPackageListInfo().stream().collect(Collectors.groupingBy(DistributionParcelListEntity::getId)); + AtomicInteger packageNum = new AtomicInteger(); + AtomicInteger reduceNum = new AtomicInteger(); + newPackage.forEach((m, n) -> { + if (Func.isEmpty(oldPackage.get(m))) { + DistributionParcelListEntity distributionParcelListEntity = n.get(0); + //新增 + DistributionReservationPackageEntity reservationPackageEntity = new DistributionReservationPackageEntity(); + reservationPackageEntity.setStockArticleId(distributionStockArticleDTO.getId()); + reservationPackageEntity.setPacketBarStatus(ReservationPackageStatusConstant.xinzeng.getValue()); + reservationPackageEntity.setPacketBarCode(distributionParcelListEntity.getOrderPackageCode()); + reservationPackageEntity.setParceListId(distributionParcelListEntity.getId()); + reservationPackageEntity.setReservationId(id); + distributionReservationPackageService.save(reservationPackageEntity); packageNum.getAndAdd(distributionParcelListEntity.getQuantity()); + DistributionParcelListEntity parcelListEntity = distributionParcelListService.getById(distributionParcelListEntity.getId()); + parcelListEntity.setOrderPackageReservationStatus(OrderPackageReservationStatusConstant.yiyueyue.getValue()); + distributionParcelListService.updateById(parcelListEntity); + } else { + oldPackage.remove(m); + //移除 } }); - AtomicInteger deleteNum = new AtomicInteger(); - //这里就需要将原来记录剩下的数据进行取消操作, - oldPackageListMap.forEach((o,q)->{ - DistributionReservationPackageEntity distributionReservationPackageEntity = q.get(0); - distributionReservationPackageEntity.setPacketBarCode(ReservationPackageStatusConstant.quxiao.getValue()); - DistributionParcelListEntity parcelListEntity = distributionParcelListService.getById(o); + //移除包件进行取消 + oldPackage.forEach((o, p) -> { + DistributionReservationPackageEntity reservationPackageEntity = p.get(0); + reservationPackageEntity.setPacketBarStatus(ReservationPackageStatusConstant.quxiao.getValue()); + distributionReservationPackageService.updateById(reservationPackageEntity); + //统计减少包件数量 + reduceNum.getAndAdd(distributionParcelListService.getById(reservationPackageEntity.getParceListId()).getQuantity()); + DistributionParcelListEntity parcelListEntity = distributionParcelListService.getById(reservationPackageEntity.getParceListId()); parcelListEntity.setOrderPackageReservationStatus(OrderPackageReservationStatusConstant.daiyuyue.getValue()); - //将预约订单中间表的数据进行减少 - deleteNum.getAndAdd(parcelListEntity.getQuantity()); + distributionParcelListService.updateById(parcelListEntity); }); - reservationStockarticleEntity.setReservationNum(reservationNum + packageNum.get() - deleteNum.get()); + //对存在订单进行维护 + DistributionReservationStockarticleEntity reservationStockarticleEntity = oldStockArticle.get(k).get(0); + Integer reservationNum = reservationStockarticleEntity.getReservationNum(); + reservationStockarticleEntity.setReservationNum(reservationNum + packageNum.get() - reduceNum.get()); distributionReservationStockarticleService.updateById(reservationStockarticleEntity); - reservationStockarticleMap.remove(k); - }else { - //这里表示这个订单是新增的 - DistributionStockArticleDTO distributionStockArticleDTO = v.get(0); - DistributionStockArticleEntity stockArticleEntity = Func.copy(distributionStockArticleDTO, DistributionStockArticleEntity.class); - List packageList = distributionStockArticleDTO.getPackageListInfo(); - //包件数量累加 - AtomicInteger packageCount = new AtomicInteger(); - packageList.forEach(p->{ - DistributionReservationPackageEntity distributionReservationPackageEntity = new DistributionReservationPackageEntity(); - distributionReservationPackageEntity.setReservationId(id); - distributionReservationPackageEntity.setParceListId(p.getId()); - distributionReservationPackageEntity.setStockArticleId(stockArticleEntity.getId()); - distributionReservationPackageEntity.setPacketBarStatus(ReservationPackageStatusConstant.zhengchang.getValue()); - distributionReservationPackageService.save(distributionReservationPackageEntity); - packageCount.getAndAdd(p.getQuantity()); - }); - DistributionReservationStockarticleEntity reservationStockarticleEntity = new DistributionReservationStockarticleEntity(); - reservationStockarticleEntity.setReservationNum(packageCount.get()); - reservationStockarticleEntity.setReservationId(id); - reservationStockarticleEntity.setStockArticleId(k); - reservationStockarticleEntity.setStockArticleCode(ReservationOrderStatusConstant.zhengchang.getValue()); - distributionReservationStockarticleService.save(reservationStockarticleEntity); - //查询订单下的包件数量,对包件状态进行变更 - List parcelListEntityList = distributionParcelListMapper.selectList(Wrappers.query().lambda().eq(DistributionParcelListEntity::getStockArticleId, k)); - if (parcelListEntityList.size()==packageList.size()){ - stockArticleEntity.setReservationStatus(OrderReservationStatusConstant.yiyueyue.getValue()); - }else if (parcelListEntityList.size()>packageList.size()){ - stockArticleEntity.setReservationStatus(OrderReservationStatusConstant.daiyuyue.getValue()); - }else { - log.error("订单包件数量有误"); + packTotal.getAndAdd(reservationStockarticleEntity.getReservationNum()); + oldStockArticle.remove(k); + String status = distributionReservationPackageService.judgmentStatus(distributionStockArticleDTO); + DistributionStockArticleEntity stockArticleEntity = distributionStockArticleService.getById(distributionStockArticleDTO.getId()); + stockArticleEntity.setReservationStatus(status); + distributionStockArticleService.updateById(stockArticleEntity); + } + }); + oldStockArticle.forEach((i, j) -> { + //这里就是需要进行取消的订单信息 + DistributionReservationStockarticleEntity reservationStockarticleEntity = j.get(0); + reservationStockarticleEntity.setStockArticleStatus(ReservationOrderStatusConstant.quxiao.getValue()); + List packageEntityList = distributionReservationPackageMapper.selectPackageByReservationAndStockArticleId(id, reservationStockarticleEntity.getStockArticleId()); + packageEntityList.forEach(p -> { + p.setPacketBarStatus(ReservationPackageStatusConstant.quxiao.getValue()); + distributionReservationPackageService.updateById(p); + reduceTotal.getAndAdd(distributionParcelListService.getById(p.getParceListId()).getQuantity()); + DistributionParcelListEntity parcelListEntity = distributionParcelListService.getById(p.getParceListId()); + parcelListEntity.setOrderPackageReservationStatus(OrderPackageReservationStatusConstant.daiyuyue.getValue()); + distributionParcelListService.updateById(parcelListEntity); + }); + DistributionStockArticleEntity stockArticleEntity = distributionStockArticleService.getById(i); + DistributionStockArticleDTO stockArticleDTO = Func.copy(stockArticleEntity, DistributionStockArticleDTO.class); + String status = distributionReservationPackageService.judgmentStatus(stockArticleDTO); + stockArticleEntity.setReservationStatus(status); + reservationStockarticleEntity.setStockArticleStatus(ReservationOrderStatusConstant.quxiao.getValue()); + distributionReservationStockarticleService.updateById(reservationStockarticleEntity); + }); + //库存品修改 + //查询出原来的库存品信息 + List reservationStocklistEntities = distributionReservationStocklistService.getBaseMapper().selectList(Wrappers.query().lambda().eq(DistributionReservationStocklistEntity::getReservationId, id)); + Map> oleInventoryList = reservationStocklistEntities.stream().collect(Collectors.groupingBy(DistributionReservationStocklistEntity::getStocklistId)); + List inventoryList = distributionReservationDTO.getInventoryList(); + Map> newInventoryList = inventoryList.stream().collect(Collectors.groupingBy(DistributionStockListDTO::getId)); + AtomicInteger inventorTotal = new AtomicInteger(); + + newInventoryList.forEach((c, d) -> { + DistributionReservationStocklistEntity reservationStocklistEntity = new DistributionReservationStocklistEntity(); + DistributionStockListDTO distributionStockListDTO = d.get(0); + if (Func.isEmpty(oleInventoryList.get(c))) { + //新增库存品 + reservationStocklistEntity.setStocklistId(distributionStockListDTO.getId()); + reservationStocklistEntity.setReservationId(id); + reservationStocklistEntity.setReservationNum(distributionStockListDTO.getReservationNum()); + reservationStocklistEntity.setUnit(distributionStockListDTO.getCargoUnit()); +// reservationStocklistEntity.setIsUnpackProduct(distributionStockListDTO.getUnpack()); + reservationStocklistEntity.setStockListStatus(ReservationInventoryStatusConstant.zengjia.getValue()); + distributionReservationStocklistService.save(reservationStocklistEntity); + //TODO 这里新增还需要对库存品的数量进行修改 + DistributionStockListEntity stockListEntity = Func.copy(distributionStockListDTO, DistributionStockListEntity.class); + Integer quantityOccupied = stockListEntity.getQuantityOccupied(); + stockListEntity.setQuantityOccupied(quantityOccupied + reservationStocklistEntity.getReservationNum()); + distributionStockListService.updateById(stockListEntity); + } else { + DistributionReservationStocklistEntity distributionReservationStocklistEntity = oleInventoryList.get(c).get(0); +// DistributionStockListDTO distributionStockListDTO = newInventoryList.get(c).get(0); + //比对原来的库存品数量和现在的数量是否一致 + if (!Func.equals(distributionStockListDTO.getReservationNum(), distributionReservationStocklistEntity.getReservationNum())) { + Integer reservationNum = distributionReservationStocklistEntity.getReservationNum(); + DistributionStockListEntity stockListEntity = distributionStockListService.getById(distributionReservationStocklistEntity.getStocklistId()); + Integer quantityOccupied = stockListEntity.getQuantityOccupied(); + Integer total = quantityOccupied - reservationNum; + distributionReservationStocklistEntity.setReservationNum(distributionStockListDTO.getReservationNum()); + distributionReservationStocklistService.updateById(distributionReservationStocklistEntity); + stockListEntity.setQuantityOccupied(total + distributionReservationStocklistEntity.getReservationNum()); + distributionStockListService.updateById(stockListEntity); + //TODO 对库存品数量修改 } + oleInventoryList.remove(c); + //比较库存品之间的数据 } + inventorTotal.getAndAdd(distributionStockListDTO.getReservationNum()); + }); + //对移除的库存品进行取消操作 + oleInventoryList.forEach((k, v) -> { + DistributionReservationStocklistEntity distributionReservationStocklistEntity = v.get(0); + distributionReservationStocklistEntity.setStockListStatus(ReservationInventoryStatusConstant.quxiao.getValue()); + distributionReservationStocklistService.updateById(distributionReservationStocklistEntity); + //TODO 库存品数量变更 }); - - - - - //删除原有 -// DistributionReservationEntity distributionReservationEntity = this.getById(distributionReservationDTO.getId()); -// Func.copy(distributionReservationDTO, distributionReservationEntity); -// QueryWrapper q = Condition.getQueryWrapper(new HashMap(), DistributionReservationStockarticleEntity.class); -// q.lambda().eq(DistributionReservationStockarticleEntity::getReservationId, distributionReservationEntity.getId()); -// QueryWrapper w = Condition.getQueryWrapper(new HashMap(), DistributionReservationStocklistEntity.class); -// w.lambda().eq(DistributionReservationStocklistEntity::getReservationId, distributionReservationEntity.getId()); -// QueryWrapper o = Condition.getQueryWrapper(new HashMap(), DistributionReservationPackageEntity.class); -// o.lambda().eq(DistributionReservationPackageEntity::getReservationId, distributionReservationEntity.getId()); -// //查询已有的中间表信息 -// List reservationStockarticleEntityList = distributionReservationStockarticleService.getBaseMapper().selectList(q); -// List reservationStocklistEntityList = distributionReservationStocklistService.getBaseMapper().selectList(w); -// List reservationPackageEntityList = distributionReservationPackageMapper.selectList(o); -// if (!Func.isEmpty(reservationStockarticleEntityList)) { -// //对已有预约信息的订单包件数量进行清理 -// reservationStockarticleEntityList.forEach(s1 -> { -// //删除前需要对订单的可用数进行操作 -// DistributionStockArticleEntity stockArticleEntity = distributionStockArticleService.getById(s1.getStockArticleId()); -// stockArticleEntity.setAvailableQuantity(s1.getReservationNum() + stockArticleEntity.getAvailableQuantity()); -// stockArticleEntity.setReservationStatus(OrderReservationStatusConstant.daiyuyue.getValue()); -// distributionStockArticleService.updateById(stockArticleEntity); -// //这里对原表进行物理删除 -// distributionReservationStockarticleMapper.deleteReservationStockarticle(distributionReservationDTO.getId(),s1.getId()); -// }); -// } -// if (!Func.isEmpty(reservationStocklistEntityList)) { -// //对已有预约信息的库存品数据进行维护 -// reservationStocklistEntityList.forEach(r1 -> { -// Long stocklistId = r1.getStocklistId(); -// DistributionStockListEntity stockListEntity = distributionStockListService.getById(stocklistId); -// int num = stockListEntity.getQuantityOccupied() - r1.getReservationNum(); -// stockListEntity.setQuantityOccupied(num); -//// stockListEntity.setQuantityOccupied(stockListEntity.getQuantityOccupied() + r1.getReservationNum()); -// //这里对原表进行物理删除 -// distributionStockListService.updateById(stockListEntity); -// distributionReservationStocklistMapper.deleteReservationStocklist(distributionReservationDTO.getId()); -// }); -// } -// if (!Func.isEmpty(reservationPackageEntityList)) { -// //对已有预约信息的订单包件数量进行清理 -// reservationPackageEntityList.forEach(p1 -> { -// DistributionParcelListEntity parcelListEntity = distributionParcelListService.getById(p1.getParceListId()); -// parcelListEntity.setOrderPackageStockupStatus(OrderPackageStockupStatusConstant.daibeihuo.getValue()); -// parcelListEntity.setOrderPackageReservationStatus(OrderPackageReservationStatusConstant.daiyuyue.getValue()); -// //todo 这里需要将包件状态设置成未预约;备货信息设置为未备货 -//// parcelListEntity.setOrderPackageReservationStatus(); -// //这里对原表进行物理删除 -// distributionReservationPackageMapper.deleteReservationPackage(distributionReservationDTO.getId()); -// }); -// } -// //包件数量累加 -// AtomicInteger packageCount = new AtomicInteger(); -// //计算总费用 -// AtomicReference initTotal = new AtomicReference<>(BigDecimal.ZERO); -// //订单自编号拼接 -// HashSet hashSet = new HashSet<>(); -// List stockArticleList = distributionReservationDTO.getStockArticleList(); -// if (!Func.isEmpty(stockArticleList)) { -// //这里判断修改内容是否存在订单信息,如果存在则进行中间表数据的重新插入 -// stockArticleList.forEach(s -> { -// List packageList = s.getPackageList(); -// QueryWrapper parcelListEntityQueryWrapper = new QueryWrapper<>(); -// LambdaQueryWrapper queryWrapper = parcelListEntityQueryWrapper.lambda().eq(DistributionParcelListEntity::getStockArticleId, s.getId()); -// List parcelListEntityList = distributionParcelListService.getBaseMapper().selectList(queryWrapper); -// if (packageList.size() != parcelListEntityList.size()) { -// s.setReservationStatus(OrderReservationStatusConstant.bufenyuyue.getValue()); -// } else { -// s.setReservationStatus(OrderReservationStatusConstant.yiyueyue.getValue()); -// } -// AtomicInteger packageNum = new AtomicInteger(); -// if (Func.isEmpty(packageList)) { -// Map map = new HashMap<>(); -// map.put("stockArticleId", s.getId()); -// QueryWrapper qw = Condition.getQueryWrapper(map, DistributionParcelListEntity.class); -// //添加订单下的所有在库订单 -// List distributionParcelListEntities = distributionParcelListService.getBaseMapper().selectList(qw); -// distributionParcelListEntities.forEach(p -> { -// packageNum.getAndIncrement(); -// DistributionReservationPackageEntity distributionReservationPackageEntity = new DistributionReservationPackageEntity(); -// distributionReservationPackageEntity.setReservationId(distributionReservationDTO.getId()); -// distributionReservationPackageEntity.setPacketBarCode(p.getOrderPackageCode()); -// distributionReservationPackageEntity.setParceListId(p.getId()); -// distributionReservationPackageEntity.setStockArticleId(s.getId()); -// //维护订单下包件信息 -// distributionReservationPackageService.save(distributionReservationPackageEntity); -// p.setOrderPackageReservationStatus(OrderPackageReservationStatusConstant.yiyueyue.getValue()); -// distributionParcelListService.updateById(p); -// }); -// //设置订单可用数为0 -// s.setAvailableQuantity(0); -// } else { -// //维护选中的包件信息 -// packageList.forEach(p -> { -// packageNum.getAndIncrement(); -// DistributionReservationPackageEntity distributionReservationPackageEntity = new DistributionReservationPackageEntity(); -// distributionReservationPackageEntity.setReservationId(distributionReservationDTO.getId()); -// distributionReservationPackageEntity.setParceListId(p.getId()); -// distributionReservationPackageEntity.setStockArticleId(s.getId()); -// distributionReservationPackageEntity.setPacketBarCode(p.getOrderPackageCode()); -// distributionReservationPackageService.save(distributionReservationPackageEntity); -// p.setOrderPackageReservationStatus(OrderPackageReservationStatusConstant.yiyueyue.getValue()); -// distributionParcelListService.updateById(p); -// }); -// s.setAvailableQuantity(s.getAvailableQuantity() - s.getReservationNum()); -// -// } -// DistributionReservationStockarticleEntity distributionReservationStockarticleEntity = new DistributionReservationStockarticleEntity(); -// //构建预约订单中间表信息 -// distributionReservationStockarticleEntity.setReservationNum(packageNum.get()); -// distributionReservationStockarticleEntity.setStockArticleId(s.getId()); -// distributionReservationStockarticleEntity.setIsHaveData(s.getIsHaveData()); -// distributionReservationStockarticleEntity.setReservationId(distributionReservationEntity.getId()); -// distributionReservationStockarticleService.save(distributionReservationStockarticleEntity); -// packageCount.getAndAdd(distributionReservationStockarticleEntity.getReservationNum()); -// //统计订单包件数量 -// //订单到付费用 -//// initTotal.getAndAccumulate(new BigDecimal(s.getCollectFee().toString()), BigDecimal::add); -//// //订单仓储费 -//// initTotal.getAndAccumulate(new BigDecimal(s.getStorageFee().toString()), BigDecimal::add); -//// //协商费用 -//// initTotal.getAndAccumulate(new BigDecimal(s.getRate().toString()), BigDecimal::add); -// hashSet.add(s.getOrderCode()); -// }); -// } -// List inventoryList = distributionReservationDTO.getInventoryList(); -// AtomicInteger stockListNum = new AtomicInteger(); -// if (!Func.isEmpty(inventoryList)) { -// //重新构建预约和库存之间的关系 -// inventoryList.forEach(i -> { -// DistributionStockListEntity stockListEntity = distributionStockListService.getById(i.getId()); -// int count = stockListEntity.getQuantityOccupied() + i.getReservationNum(); -// stockListEntity.setQuantityOccupied(count); -// distributionStockListService.updateById(stockListEntity); -// DistributionReservationStocklistEntity distributionReservationStocklistEntity = new DistributionReservationStocklistEntity(); -// distributionReservationStocklistEntity.setReservationId(distributionReservationEntity.getId()); -// distributionReservationStocklistEntity.setReservationNum(i.getReservationNum()); -// distributionReservationStocklistEntity.setStocklistId(i.getId()); -// distributionReservationStocklistService.save(distributionReservationStocklistEntity); -// hashSet.add(i.getOrderCode()); -// stockListNum.getAndAdd(distributionReservationStocklistEntity.getReservationNum()); -// }); -// } -// String orderId = String.join(",", hashSet); -// distributionReservationEntity.setFee(initTotal.get()); -// distributionReservationEntity.setServeType(DistributionTypeConstant.shipie.getValue()); -// distributionReservationEntity.setReservationNum(packageCount.get()); -// distributionReservationEntity.setStockArticleId(orderId); -// distributionReservationEntity.setReservationStockListNum(stockListNum.get()); -// distributionReservationMapper.updateById(distributionReservationEntity); + DistributionReservationEntity reservationEntity = this.getById(id); + Integer reservationNum = reservationEntity.getReservationNum(); + reservationEntity.setOtherFee(distributionReservationDTO.getOtherFee()); + reservationEntity.setDeliveryType(distributionReservationDTO.getDeliveryType()); + reservationEntity.setDeliveryWay(distributionReservationDTO.getDeliveryWay()); + reservationEntity.setServeType(distributionReservationDTO.getServeType()); + reservationEntity.setReservationNum(packTotal.get()); + reservationEntity.setReservationStockListNum(inventorTotal.get()); + reservationEntity.setReservationDate(distributionReservationDTO.getReservationDate()); + reservationEntity.setPeriodOfTime(distributionReservationDTO.getPeriodOfTime()); + reservationEntity.setReplaceFee(distributionReservationDTO.getReplaceFee()); +// reservationEntity.setCollectFee(distributionReservationDTO.getCollectFee()); + reservationEntity.setRemarks(distributionReservationDTO.getRemarks()); + reservationEntity.setIsUrgent(distributionReservationDTO.getIsUrgent()); + this.updateById(reservationEntity); return true; } @@ -1066,7 +998,7 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl initTotal = new AtomicReference<>(BigDecimal.ZERO); //统计包件数量 - AtomicInteger packageTotal= new AtomicInteger(); + AtomicInteger packageTotal = new AtomicInteger(); v.forEach(a -> { orderTotal.getAndIncrement(); DistributionStockArticleEntity stockArticleEntity = Func.copy(a, DistributionStockArticleEntity.class); diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockArticleServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockArticleServiceImpl.java index d175a0711..05fe74042 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockArticleServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockArticleServiceImpl.java @@ -57,6 +57,7 @@ import org.springblade.core.tool.utils.BeanUtil; import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.ObjectUtil; import org.springblade.system.cache.DictBizCache; +import org.springframework.boot.actuate.autoconfigure.metrics.MetricsProperties; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import sun.misc.BASE64Encoder; @@ -355,11 +356,11 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl { DistributionStockArticleEntity distributionStockArticleEntity = this.baseMapper.selectById(id); -// DistributionStockArticleVO distributionStockArticleVO = Func.copy(distributionStockArticleEntity, DistributionStockArticleVO.class); - distributionStockArticleEntityList.add(DistributionStockArticleWrapper.build().entityVO(distributionStockArticleEntity)); + DistributionStockArticleVO distributionStockArticleVO = DistributionStockArticleWrapper.build().entityVO(distributionStockArticleEntity); + List parcelListEntityList = distributionParcelListService.getBaseMapper().selectList(Wrappers.query().lambda().eq(DistributionParcelListEntity::getStockArticleId, distributionStockArticleEntity.getId())); + distributionStockArticleVO.setParcelListVOS(DistributionParcelListWrapper.build().listVO(parcelListEntityList)); + distributionStockArticleEntityList.add(distributionStockArticleVO); }); - - return R.data(distributionStockArticleEntityList); } @@ -551,4 +552,13 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl handlePackage(IPage pageVO) { + pageVO.getRecords().forEach(s->{ + List parcelListEntityList = distributionParcelListService.getBaseMapper().selectList(Wrappers.query().lambda().eq(DistributionParcelListEntity::getStockArticleId, s.getId())); + s.setParcelListVOS(DistributionParcelListWrapper.build().listVO(parcelListEntityList)); + }); + return pageVO; + } } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/wrapper/DistributionParcelListWrapper.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/wrapper/DistributionParcelListWrapper.java index 0f1683320..5ff8bd2b9 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/wrapper/DistributionParcelListWrapper.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/wrapper/DistributionParcelListWrapper.java @@ -7,6 +7,7 @@ import org.springblade.core.mp.support.BaseEntityWrapper; import org.springblade.core.tool.utils.BeanUtil; import org.springblade.system.cache.DictBizCache; +import java.util.List; import java.util.Objects; /** diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/wrapper/DistributionStockListWrapper.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/wrapper/DistributionStockListWrapper.java new file mode 100644 index 000000000..a5231b54f --- /dev/null +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/wrapper/DistributionStockListWrapper.java @@ -0,0 +1,34 @@ +package com.logpm.distribution.wrapper; + +import com.logpm.distribution.entity.DistributionStockArticleEntity; +import com.logpm.distribution.entity.DistributionStockListEntity; +import com.logpm.distribution.vo.DistributionStockArticleVO; +import com.logpm.distribution.vo.DistributionStockListVO; +import org.springblade.common.constant.DictBizConstant; +import org.springblade.core.mp.support.BaseEntityWrapper; +import org.springblade.core.tool.utils.BeanUtil; +import org.springblade.core.tool.utils.SpringUtil; +import org.springblade.system.cache.DictBizCache; +import org.springblade.system.feign.IUserClient; + +import java.util.Date; +import java.util.Objects; + +/** + * 在库订单实体VO 转换 + */ +public class DistributionStockListWrapper extends BaseEntityWrapper { + + + public static DistributionStockListWrapper build() { + return new DistributionStockListWrapper(); + } + + + @Override + public DistributionStockListVO entityVO(DistributionStockListEntity entity) { + DistributionStockListVO distributionStockListVO = Objects.requireNonNull(BeanUtil.copy(entity, DistributionStockListVO.class)); + return distributionStockListVO; + } +} From 34d482f66f4d374ea1c05cf3161789c3c76145be Mon Sep 17 00:00:00 2001 From: caoyizhong <1270296080@qq.com> Date: Wed, 16 Aug 2023 14:46:36 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=AD=BE=E6=94=B6?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E6=95=B0=E6=8D=AE=E4=B8=8D=E6=AD=A3=E7=A1=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../vo/app/DistributionAppDeliveryListVO.java | 15 ++ .../vo/app/DistributionAppStockArticleVO.java | 6 + .../mapper/DistributionDeliveryListMapper.xml | 10 +- .../DistributionReservationPackageMapper.java | 2 + .../DistributionReservationPackageMapper.xml | 10 + .../mapper/DistributionSignforMapper.xml | 228 +++++++++--------- ...DistributionReservationPackageService.java | 3 + ...ributionReservationPackageServiceImpl.java | 12 + .../impl/DistributionSignforServiceImpl.java | 19 ++ 9 files changed, 195 insertions(+), 110 deletions(-) diff --git a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/app/DistributionAppDeliveryListVO.java b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/app/DistributionAppDeliveryListVO.java index bce985be5..2d5eed827 100644 --- a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/app/DistributionAppDeliveryListVO.java +++ b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/app/DistributionAppDeliveryListVO.java @@ -92,6 +92,21 @@ public class DistributionAppDeliveryListVO extends DistributionDeliveryListEntit */ @ApiModelProperty(value = "是否备货(1-没有,2-备货)") private String isstock; + /** + * 电话 + */ + @ApiModelProperty(value = "电话") + private String deliveryPhone; + /** + * 名称 + */ + @ApiModelProperty(value = "名称") + private String consignee; + /** + * 地址 + */ + @ApiModelProperty(value = "地址") + private String deliveryAddress; diff --git a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/app/DistributionAppStockArticleVO.java b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/app/DistributionAppStockArticleVO.java index c54b45636..4da860597 100644 --- a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/app/DistributionAppStockArticleVO.java +++ b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/app/DistributionAppStockArticleVO.java @@ -40,6 +40,12 @@ public class DistributionAppStockArticleVO extends DistributionStockArticleEntit */ @ApiModelProperty(value = "扫描数") private Integer loadingNub; + + /** + * 订单ID + */ + @ApiModelProperty(value = "订单ID") + private Long stockArticleId; /** * 签收数 */ diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryListMapper.xml b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryListMapper.xml index d8e7136ab..dd2d42403 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryListMapper.xml +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryListMapper.xml @@ -628,7 +628,15 @@ join logpm_distribution_reservation ldr on lds.reservation_id =ldr.id WHERE lds.delivery_id = lddl.id) inventoryNub, (SELECT COALESCE(sum(lds.loaded_number+lds.loadedin_number), 0) FROM logpm_distribution_signfor lds WHERE - lddl.id = lds.delivery_id) scannedNumber + lddl.id = lds.delivery_id) scannedNumber, + ( + select GROUP_CONCAT(ldr.consignee) + from logpm_distribution_reservation ldr + where ldr.id in + (select lds.reservation_id + from logpm_distribution_signfor lds + where lds.delivery_id = lddl.id ) + ) consignee FROM logpm_distribution_delivery_list lddl left join logpm_distribution_delivery_self ldds on lddl.id =ldds.delivery_id diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationPackageMapper.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationPackageMapper.java index 11d168c99..5b48dc31d 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationPackageMapper.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationPackageMapper.java @@ -125,4 +125,6 @@ public interface DistributionReservationPackageMapper extends BaseMapper getPackDetail(@Param("param") DistributionReservationPackageDTO packageDTO); } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationPackageMapper.xml b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationPackageMapper.xml index 6bb0b1ada..7ed2fcc45 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationPackageMapper.xml +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationPackageMapper.xml @@ -249,5 +249,15 @@ WHERE + diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionSignforMapper.xml b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionSignforMapper.xml index 7f47e0ea6..7becd5259 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionSignforMapper.xml +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionSignforMapper.xml @@ -510,6 +510,8 @@ lds.driver_signing driverSigning, lds.Signing_status SigningStatus, lds.loaded_number loadingNub, + ldr.delivery_phone deliveryPhone, + ldr.delivery_address deliveryAddress, (SELECT COALESCE(COUNT(*), 0) from logpm_distribution_reservation_stockarticle ldrs WHERE ldrs.reservation_id =ldr.id ) ordNub, COALESCE(lds.received_quantity + lds.receivedin_quantity, 0) signNub FROM @@ -520,11 +522,12 @@ AND lds.delivery_id = #{id} - - - + + +