From 753b4a109b76a21b2117b837b7a239330eeee1aa Mon Sep 17 00:00:00 2001 From: PigBaoBei <2739175034@qq.com> Date: Thu, 16 Nov 2023 21:38:25 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A2=84=E7=BA=A6=E5=BA=93=E5=AD=98=E5=93=81?= =?UTF-8?q?=E6=95=B0=E9=87=8F=E9=99=90=E5=88=B6=EF=BC=9B=E9=A2=84=E7=BA=A6?= =?UTF-8?q?=E8=A3=85=E8=BD=A6=E3=80=81=E7=AD=BE=E6=94=B6=EF=BC=9B=E9=85=8D?= =?UTF-8?q?=E9=80=81=E4=BB=BB=E5=8A=A1=E8=A3=85=E8=BD=A6=E3=80=81=E7=AD=BE?= =?UTF-8?q?=E6=94=B6=E7=8A=B6=E6=80=81=E7=BB=B4=E6=8A=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/bootstrap.yml | 2 +- .../DistributionDeliveryAppController.java | 2 +- .../dto/DistributionLoadingNumDTO.java | 13 + .../DistributionDeliveryListMapper.java | 10 + .../mapper/DistributionDeliveryListMapper.xml | 24 ++ .../mapper/DistributionLoadscanMapper.java | 4 + .../mapper/DistributionLoadscanMapper.xml | 6 + .../mapper/DistributionReservationMapper.java | 10 + .../mapper/DistributionReservationMapper.xml | 24 ++ .../service/IDistributionAsyncService.java | 12 +- .../impl/DistributionAsyncServiceImpl.java | 274 +++++++++++------- .../DistributionDeliveryListServiceImpl.java | 21 +- .../DistributionReservationServiceImpl.java | 36 ++- .../impl/DistributionSignforServiceImpl.java | 21 +- 14 files changed, 340 insertions(+), 119 deletions(-) create mode 100644 blade-service/logpm-distribution/src/main/java/com/logpm/distribution/dto/DistributionLoadingNumDTO.java diff --git a/blade-gateway/src/main/resources/bootstrap.yml b/blade-gateway/src/main/resources/bootstrap.yml index c9fadc7b6..90dc6404a 100644 --- a/blade-gateway/src/main/resources/bootstrap.yml +++ b/blade-gateway/src/main/resources/bootstrap.yml @@ -1,5 +1,5 @@ server: - port: 8888 + port: 13000 spring: cloud: gateway: diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/appcontroller/DistributionDeliveryAppController.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/appcontroller/DistributionDeliveryAppController.java index f73a8aecf..ca464dc8b 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/appcontroller/DistributionDeliveryAppController.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/appcontroller/DistributionDeliveryAppController.java @@ -138,7 +138,7 @@ public class DistributionDeliveryAppController { @ApiOperationSupport(order = 6) @ApiOperation(value = "装车扫描", notes = "传入DistrilbutionloadingscanDTO") public R loadingscan(@Valid @RequestBody DistrilbutionloadingscanDTO distrilbutionloadingscanDTO) { - R msg = distributionDeliveryListService.loadingscan(distrilbutionloadingscanDTO); + R msg = distributionDeliveryListService.loadingscan(distrilbutionloadingscanDTO); return msg; } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/dto/DistributionLoadingNumDTO.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/dto/DistributionLoadingNumDTO.java new file mode 100644 index 000000000..1e0da9f70 --- /dev/null +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/dto/DistributionLoadingNumDTO.java @@ -0,0 +1,13 @@ +package com.logpm.distribution.dto; + + +import lombok.Data; + +@Data +public class DistributionLoadingNumDTO { + + private Integer packageLoadingQuantity; + private Integer inventoryLoadingQuantity; + private Integer packageSigningQuantity; + private Integer inventorySigningQuantity; +} diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryListMapper.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryListMapper.java index e2de4c10c..d95429c03 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryListMapper.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryListMapper.java @@ -21,6 +21,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.logpm.distribution.dto.DistributionDeliveryListDTO; +import com.logpm.distribution.dto.DistributionLoadingNumDTO; import com.logpm.distribution.dto.app.DistributionAppDeliveryListDTO; import com.logpm.distribution.entity.*; import com.logpm.distribution.excel.DistributionDeliveryListExcel; @@ -428,4 +429,13 @@ public interface DistributionDeliveryListMapper extends BaseMapper selectRetentionZeroPackage(@Param("deliveryId")Long deliveryId, @Param("orderCode")String barcode); + + /** + * 查询配送任务装车数 + * @param id + * @return + */ + DistributionLoadingNumDTO selectDeliveryLoadingNum(@Param("deliveryId") Long id); + + DistributionLoadingNumDTO selectDeliverySigningNum(@Param("deliveryId") Long id); } 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 eb2330012..c26e38c1a 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 @@ -1683,5 +1683,29 @@ AND ldrs.stock_article_status in ('1','3') AND ldrzp.zero_package_status IN ('1','3') + + diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionLoadscanMapper.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionLoadscanMapper.java index d69d8cc8c..cf76982e0 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionLoadscanMapper.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionLoadscanMapper.java @@ -97,4 +97,8 @@ public interface DistributionLoadscanMapper extends BaseMapper SELECT COUNT(ldl.loaded_nub) FROM logpm_distribution_loadscan AS ldl Where ldl.delivery_id = #{deliveryListId} and ldl.is_abnormal_loading = 2 + + 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 69647f53a..ba0ff3d84 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 @@ -19,6 +19,7 @@ package com.logpm.distribution.mapper; import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.logpm.distribution.dto.DistributionLoadingNumDTO; import com.logpm.distribution.dto.DistributionParcelNumberDTO; import com.logpm.distribution.dto.DistributionReservationDTO; import com.logpm.distribution.entity.*; @@ -247,4 +248,13 @@ public interface DistributionReservationMapper extends BaseMapper selectAppZeroPackageListByReservationId(@Param("reservationId")Long reservationId); + + /** + * 查询客户包件、库存品装车数 + * @param id + * @return + */ + DistributionLoadingNumDTO selectReservationLoadingNum(@Param("reservationId")Long id); + + DistributionLoadingNumDTO selectReservationSigningNum(@Param("reservationId") Long id); } 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 19dea99e5..ded7a5c94 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 @@ -1077,5 +1077,29 @@ INNER JOIN logpm_distribution_parcel_list As ldpl ON ldrzp.parcel_list_id = ldpl.id WHERE ldrs.reservation_id =#{reservationId} + + diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionAsyncService.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionAsyncService.java index c786d0944..253c60d28 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionAsyncService.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionAsyncService.java @@ -147,7 +147,7 @@ public interface IDistributionAsyncService { * @param barcode * @param deliveryId */ - void changeMarketDeliveryListStatus(String barcode, Long deliveryId); + void changeMarketDeliveryListStatus(String barcode, Long deliveryId,Long reservationId); /** * 自提签收判断是否完成 @@ -226,5 +226,13 @@ public interface IDistributionAsyncService { * 维护零担订单装车状态 * @param parcelNumberEntity */ - void checkZeroStockArticleLoadingStatus(DistributionParcelNumberEntity parcelNumberEntity); + void checkZeroStockArticleLoadingStatus(DistributionParcelNumberEntity parcelNumberEntity,Long deliveryId,Long reservationId); + + /** + * 签收状态维护 + * @param packageId + * @param reservationId + * @param deliveryId + */ + void checkSignStatus(Long packageId, Long reservationId, Long deliveryId); } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAsyncServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAsyncServiceImpl.java index cc40dac8e..b3d294903 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAsyncServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAsyncServiceImpl.java @@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.logpm.basicdata.entity.BasicdataWarehouseEntity; import com.logpm.basicdata.feign.IBasicdataWarehouseClient; +import com.logpm.distribution.dto.DistributionLoadingNumDTO; import com.logpm.distribution.dto.DistributionStockArticleDTO; import com.logpm.distribution.dto.app.DistrilbutionloadingscanDTO; import com.logpm.distribution.dto.app.StockupDTO; @@ -358,112 +359,47 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService { @Async @Override @Transactional(isolation = Isolation.READ_UNCOMMITTED, rollbackFor = Exception.class) - public void changeMarketDeliveryListStatus(String barcode, Long deliveryId) { - //修改包件状态 - //这里需要查询出该包件 - DistributionParcelListEntity parcelListEntity = distributionDeliveryListMapper.getLoadingPackageDetails(barcode, deliveryId); - if (Func.isNotEmpty(parcelListEntity)) { - parcelListEntity.setOrderPackageLoadingStatus(OrderPackageLoadingStatusConstant.yizhuangche.getValue()); - parcelListEntity.setOrderPackageStatus(OrderPackageStatusConstant.yichuku.getValue()); - //修改包件状态 - distributionParcelListService.updateById(parcelListEntity); - List parcelListEntityList = distributionParcelListService.getBaseMapper().selectList(Wrappers.query().lambda().eq(DistributionParcelListEntity::getStockArticleId, parcelListEntity.getStockArticleId())); - boolean flag = parcelListEntityList.stream().allMatch(p -> p.getOrderPackageLoadingStatus().equals(OrderPackageLoadingStatusConstant.yizhuangche.getValue())); - DistributionStockArticleEntity stockArticleEntity = distributionStockArticleService.getById(parcelListEntity.getStockArticleId()); - //维护包件、订单扫描装车状态 - if (flag) { - stockArticleEntity.setOrderStatus(OrderStatusConstant.chuku.getValue()); - } else { - flag = parcelListEntityList.stream().allMatch(p -> p.getOrderPackageLoadingStatus().equals(OrderPackageLoadingStatusConstant.weizhuancghe.getValue())); - if (flag) { - stockArticleEntity.setOrderStatus(OrderStatusConstant.ruku.getValue()); - } else { - stockArticleEntity.setOrderStatus(OrderStatusConstant.bufenchuku.getValue()); - } - } - distributionStockArticleService.updateById(stockArticleEntity); - } else { - //查询库存品 - DisStockListDetailEntity loadingInventoryDetail = distributionDeliveryListMapper.getLoadingInventoryDetail(barcode, deliveryId); - loadingInventoryDetail.setStockLockingStatus(InventoryLoadingStatusConstant.yizhuangche.getValue()); - disStockListDetailService.updateById(loadingInventoryDetail); + public void changeMarketDeliveryListStatus(String barcode, Long deliveryId,Long reservationId) { + + //查询库存品 + DisStockListDetailEntity loadingInventoryDetail = distributionDeliveryListMapper.getLoadingInventoryDetail(barcode, deliveryId); + loadingInventoryDetail.setStockLockingStatus(InventoryLoadingStatusConstant.yizhuangche.getValue()); + disStockListDetailService.updateById(loadingInventoryDetail); // DistributionStockListEntity stockListEntity = distributionStockListMapper.selectOne(Wrappers.query().lambda().eq(DistributionStockListEntity::getId, loadingInventoryDetail.getStockListId())); // stockListEntity.setQuantityStock(stockListEntity.getQuantityStock() - loadingInventoryDetail.getNum()); // stockListEntity.setQuantityOccupied(stockListEntity.getQuantityOccupied() - loadingInventoryDetail.getNum()); // stockListEntity.setOutboundQuantity(stockListEntity.getOutboundQuantity() + loadingInventoryDetail.getNum()); // distributionStockListMapper.updateById(stockListEntity); - //查询出这个库存品的所有需要装车的包件维度库存品 - List list = disStockListDetailService.list(Wrappers.query().lambda() - .eq(DisStockListDetailEntity::getReservationId, loadingInventoryDetail.getReservationId()) - .eq(DisStockListDetailEntity::getStockListId, loadingInventoryDetail.getStockListId()) - .ne(DisStockListDetailEntity::getStockPackageStatus, InventoryPackageStatusConstant.quxiao.getValue())); - boolean inventoryFlag = list.stream().allMatch(l -> l.getStockLockingStatus().equals(InventoryLoadingStatusConstant.yizhuangche.getValue())); - List reservationStockarticleEntityList = distributionReservationStocklistMapper.selectList(Wrappers.query().lambda() - .eq(DistributionReservationStocklistEntity::getReservationId, loadingInventoryDetail.getReservationId()) - .eq(DistributionReservationStocklistEntity::getStocklistId, loadingInventoryDetail.getStockListId()) - .ne(DistributionReservationStocklistEntity::getStockListStatus, ReservationInventoryStatusConstant.quxiao.getValue())); - if (reservationStockarticleEntityList.size() == 1) { - //修改状态 - DistributionReservationStocklistEntity reservationStockarticleEntity = reservationStockarticleEntityList.get(0); - if (inventoryFlag) { - //查询出库存品进行全部状态的变更 - reservationStockarticleEntity.setLoadingStatus(ReservationInventoryLoadingStatusConstant.yizhuangche.getValue()); - } else { - inventoryFlag = list.stream().allMatch(l -> l.getStockLockingStatus().equals(InventoryLoadingStatusConstant.weizhuangche.getValue())); - if (inventoryFlag) { - reservationStockarticleEntity.setLoadingStatus(ReservationInventoryLoadingStatusConstant.weizhuangche.getValue()); - } else { - reservationStockarticleEntity.setLoadingStatus(ReservationInventoryLoadingStatusConstant.bufenzhuangche.getValue()); - } - } - distributionReservationStocklistMapper.updateById(reservationStockarticleEntity); - } else { - log.error("####库存品记录错误+{" + reservationStockarticleEntityList + "}"); - return; - } - } - - //查询出这个预约下的包件信息和库存品信息分别进行判断是否都完成装车 - List reservationEntityList = distributionDeliveryListMapper.selectReservationByDeliveryListId(deliveryId); - reservationEntityList.forEach(r -> { - //查询预约下的所有包件信息 - List parcelListEntities = distributionReservationMapper.selectPackageListByReservationId(r.getId()); - boolean reservationLoadingFlag = parcelListEntities.stream().allMatch(p -> p.getOrderPackageLoadingStatus().equals(InventoryLoadingStatusConstant.yizhuangche.getValue())); - List distributionReservationStocklistEntities = distributionReservationStocklistMapper.selectList(Wrappers.query().lambda() - .eq(DistributionReservationStocklistEntity::getReservationId, r.getId()) - .ne(DistributionReservationStocklistEntity::getStockListStatus, ReservationInventoryStatusConstant.quxiao.getValue())); - boolean inventoryLoadingFlag = distributionReservationStocklistEntities.stream().allMatch(i -> i.getLoadingStatus().equals(ReservationInventoryLoadingStatusConstant.yizhuangche.getValue())); - if (reservationLoadingFlag && inventoryLoadingFlag) { - r.setLoadingStatus(ReservationLoadingStatusConstant.yizhuangche.getValue()); + //查询出这个库存品的所有需要装车的包件维度库存品 + List list = disStockListDetailService.list(Wrappers.query().lambda() + .eq(DisStockListDetailEntity::getReservationId, loadingInventoryDetail.getReservationId()) + .eq(DisStockListDetailEntity::getStockListId, loadingInventoryDetail.getStockListId()) + .ne(DisStockListDetailEntity::getStockPackageStatus, InventoryPackageStatusConstant.quxiao.getValue())); + boolean inventoryFlag = list.stream().allMatch(l -> l.getStockLockingStatus().equals(InventoryLoadingStatusConstant.yizhuangche.getValue())); + List reservationStockarticleEntityList = distributionReservationStocklistMapper.selectList(Wrappers.query().lambda() + .eq(DistributionReservationStocklistEntity::getReservationId, loadingInventoryDetail.getReservationId()) + .eq(DistributionReservationStocklistEntity::getStocklistId, loadingInventoryDetail.getStockListId()) + .ne(DistributionReservationStocklistEntity::getStockListStatus, ReservationInventoryStatusConstant.quxiao.getValue())); + if (reservationStockarticleEntityList.size() == 1) { + //修改状态 + DistributionReservationStocklistEntity reservationStockarticleEntity = reservationStockarticleEntityList.get(0); + if (inventoryFlag) { + //查询出库存品进行全部状态的变更 + reservationStockarticleEntity.setLoadingStatus(ReservationInventoryLoadingStatusConstant.yizhuangche.getValue()); } else { - reservationLoadingFlag = parcelListEntities.stream().allMatch(p -> p.getOrderPackageLoadingStatus().equals(OrderPackageLoadingStatusConstant.weizhuancghe.getValue())); - inventoryLoadingFlag = distributionReservationStocklistEntities.stream().allMatch(i -> i.getLoadingStatus().equals(ReservationInventoryLoadingStatusConstant.weizhuangche.getValue())); - if (reservationLoadingFlag && inventoryLoadingFlag) { - r.setLoadingStatus(ReservationLoadingStatusConstant.daizhuangche.getValue()); + inventoryFlag = list.stream().allMatch(l -> l.getStockLockingStatus().equals(InventoryLoadingStatusConstant.weizhuangche.getValue())); + if (inventoryFlag) { + reservationStockarticleEntity.setLoadingStatus(ReservationInventoryLoadingStatusConstant.weizhuangche.getValue()); } else { - r.setLoadingStatus(ReservationLoadingStatusConstant.bufenzhuangche.getValue()); + reservationStockarticleEntity.setLoadingStatus(ReservationInventoryLoadingStatusConstant.bufenzhuangche.getValue()); } } - distributionReservationMapper.updateById(r); - }); - - List deliveryParcelListEntityList = distributionDeliveryListMapper.selectPackageListByDeliveryListId(deliveryId); - List detailEntities = distributionDeliveryListMapper.selectInventoryListByDeliveryListId(deliveryId); - boolean deliveryLoadingFlag = deliveryParcelListEntityList.stream().allMatch(p -> p.getOrderPackageLoadingStatus().equals(OrderPackageLoadingStatusConstant.yizhuangche.getValue())); - boolean deliveryInventoryLoadingFlag = detailEntities.stream().allMatch(i -> i.getStockLockingStatus().equals(ReservationInventoryLoadingStatusConstant.yizhuangche.getValue())); - DistributionDeliveryListEntity deliveryListEntity = distributionDeliveryListMapper.selectOne(Wrappers.query().lambda().eq(DistributionDeliveryListEntity::getId, deliveryId)); - if (deliveryLoadingFlag && deliveryInventoryLoadingFlag) { - deliveryListEntity.setDeliveryListLoadingStatus(DeliveryLoadingStatusConstant.yizhuangche.getValue()); + distributionReservationStocklistMapper.updateById(reservationStockarticleEntity); } else { - deliveryLoadingFlag = deliveryParcelListEntityList.stream().allMatch(p -> p.getOrderPackageLoadingStatus().equals(OrderPackageLoadingStatusConstant.weizhuancghe.getValue())); - deliveryInventoryLoadingFlag = detailEntities.stream().allMatch(i -> i.getStockLockingStatus().equals(ReservationInventoryLoadingStatusConstant.weizhuangche.getValue())); - if (deliveryLoadingFlag && deliveryInventoryLoadingFlag) { - deliveryListEntity.setDeliveryListLoadingStatus(DeliveryLoadingStatusConstant.weizhuangche.getValue()); - } else { - deliveryListEntity.setDeliveryListLoadingStatus(DeliveryLoadingStatusConstant.bunfenzhuangche.getValue()); - } + log.error("####库存品记录错误+{" + reservationStockarticleEntityList + "}"); + return; } - distributionDeliveryListMapper.updateById(deliveryListEntity); + checkReservationAndDeliveryLoadingStatus(deliveryId,reservationId); } @Async @@ -730,14 +666,71 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService { throw new RuntimeException("包件信息异常"); } //维护包件所属订单是否均已完成装车,如果均已完成装车则订单进行装车状态的修改 - switch (parcelListEntity.getConditions()){ - case 1: - break; + if (parcelListEntity.getConditions() != 2){ + DistributionStockArticleEntity stockArticleEntity = distributionStockArticleService.getById(parcelListEntity.getStockArticleId()); + //查询出该订单的装车件数 + Integer orderLoadingNum = distributionLoadscanMapper.selectOrderLoadingNum(stockArticleEntity.getId()); + if (Func.isNotEmpty(orderLoadingNum) && orderLoadingNum > 0){ + //存在装车数量,需要对装车数量进行判定 + if (orderLoadingNum == stockArticleEntity.getTotalNumber()){ + stockArticleEntity.setOrderStatus(OrderStatusConstant.chuku.getValue()); + }else { + stockArticleEntity.setOrderStatus(OrderStatusConstant.bufenchuku.getValue()); + } + distributionStockArticleService.updateById(stockArticleEntity); + } + } - case 3: - break; + checkReservationAndDeliveryLoadingStatus(deliveryId, reservationId); + } + + @Transactional(rollbackFor = Exception.class) + private void checkReservationAndDeliveryLoadingStatus(Long deliveryId, Long reservationId) { + //判断客户是否完成装车 + DistributionReservationEntity distributionReservationEntity = distributionReservationMapper.selectById(reservationId); + int reservationPackageTotal = distributionReservationEntity.getReservationNum() + distributionReservationEntity.getReservationStockListNum(); + if (reservationPackageTotal!=0){ + DistributionLoadingNumDTO reservationLoadingNum = distributionReservationMapper.selectReservationLoadingNum(distributionReservationEntity.getId()); + if (Func.isNotEmpty(reservationLoadingNum)){ + int reservationLoadingQuantity = reservationLoadingNum.getPackageLoadingQuantity()+reservationLoadingNum.getInventoryLoadingQuantity(); + if (reservationLoadingQuantity == reservationPackageTotal){ + distributionReservationEntity.setLoadingStatus(ReservationLoadingStatusConstant.yizhuangche.getValue()); + }else { + distributionReservationEntity.setLoadingStatus(ReservationLoadingStatusConstant.bufenzhuangche.getValue()); + } + distributionReservationMapper.updateById(distributionReservationEntity); + } + }else { + log.error("##########查询客户配送数量为0"); } - DistributionStockArticleEntity stockArticleEntity = distributionStockArticleService.getById(parcelListEntity.getStockArticleId()); + DistributionDeliveryListEntity distributionDeliveryListEntity = distributionDeliveryListMapper.selectById(deliveryId); + int deliveryPackageTotal = distributionDeliveryListEntity.getDeliveryNumber(); + if (deliveryPackageTotal!=0){ + DistributionLoadingNumDTO deliveryLoadingNum = distributionDeliveryListMapper.selectDeliveryLoadingNum(distributionDeliveryListEntity.getId()); + if (Func.isNotEmpty(deliveryLoadingNum)){ + int deliveryLoadingQuantity = deliveryLoadingNum.getPackageLoadingQuantity()+deliveryLoadingNum.getInventoryLoadingQuantity(); + if (deliveryPackageTotal == deliveryLoadingQuantity){ + distributionReservationEntity.setLoadingStatus(DeliveryLoadingStatusConstant.yizhuangche.getValue()); + }else { + distributionReservationEntity.setLoadingStatus(DeliveryLoadingStatusConstant.bunfenzhuangche.getValue()); + } + distributionDeliveryListMapper.updateById(distributionDeliveryListEntity); + } + }else { + log.error("##########查询客户配送数量为0"); + } + } + + +// switch (parcelListEntity.getConditions()){ +// case 1: +// +// break; +// case 3: +// +// break; +// } +// DistributionStockArticleEntity stockArticleEntity = distributionStockArticleService.getById(parcelListEntity.getStockArticleId()); // //首先能够进入这个检测方法那么此包件就是进行装车了,这里对包件装车状态再次进行维护 @@ -806,7 +799,7 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService { - } +// } @Override @@ -1056,12 +1049,11 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService { } } distributionStockArticleService.updateById(stockArticleEntity); - } @Override @Transactional - public void checkZeroStockArticleLoadingStatus(DistributionParcelNumberEntity parcelNumberEntity) { + public void checkZeroStockArticleLoadingStatus(DistributionParcelNumberEntity parcelNumberEntity,Long deliveryId,Long reservationId) { if (Func.isEmpty(parcelNumberEntity)){ log.error("#################parcelNumberEntity参数错误:{}",parcelNumberEntity); return; @@ -1102,6 +1094,80 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService { stockArticleEntity.setDeliveryQuantity(stockArticleEntity.getDeliveryQuantity() + outboundQuantity); } distributionStockArticleService.updateById(stockArticleEntity); + //维护预约客户和配送任务装车状态 + checkReservationAndDeliveryLoadingStatus(deliveryId,reservationId); + } + + @Override + public void checkSignStatus(Long packageId, Long reservationId, Long deliveryId) { + if (Func.isNotEmpty(packageId)){ + DistributionParcelListEntity parcelListEntity = distributionParcelListService.getById(packageId); + //维护包件所属订单签收状态 + DistributionStockArticleEntity stockArticleEntity = distributionStockArticleService.getById(parcelListEntity.getStockArticleId()); + //维护该订单的签收状态 + if (Func.isNotEmpty(stockArticleEntity)){ + Integer totalNumber = stockArticleEntity.getTotalNumber(); + Integer orderSignNum = distributionLoadscanMapper.selectOrderSignNum(stockArticleEntity.getId()); + Integer orderLoadingNum = distributionLoadscanMapper.selectOrderLoadingNum(stockArticleEntity.getId()); + + if (Func.isNotEmpty(orderSignNum) && orderSignNum>0){ + if (totalNumber ==orderSignNum){ + stockArticleEntity.setOrderStatus(OrderStatusConstant.qianshou.getValue()); + }else { + stockArticleEntity.setOrderStatus(OrderStatusConstant.bufenqianshou.getValue()); + } + } + distributionStockArticleService.updateById(stockArticleEntity); + } + } + + + checkReservationAndDeliveryLoadingStatus(deliveryId,reservationId); + checkReservationAndDeliverySigningStatus(reservationId, deliveryId); + + //注意:这里对于异常装车的包件也需要进行统计 + + } + + @Transactional + private void checkReservationAndDeliverySigningStatus(Long reservationId, Long deliveryId) { + //维护客户签收状态 + DistributionReservationEntity distributionReservationEntity = distributionReservationMapper.selectById(reservationId); + if (Func.isNotEmpty(distributionReservationEntity)){ + int reservationTotal = distributionReservationEntity.getReservationNum() + distributionReservationEntity.getReservationStockListNum(); + //查询该客户的签收数量 + DistributionLoadingNumDTO reservationSigningNum= distributionReservationMapper.selectReservationSigningNum(distributionReservationEntity.getId()); + if (Func.isNotEmpty(reservationSigningNum)){ + int reservationSigningQuantity = reservationSigningNum.getPackageSigningQuantity() + reservationSigningNum.getInventorySigningQuantity(); + if (reservationSigningQuantity>0){ + if (reservationTotal ==reservationSigningQuantity){ + distributionReservationEntity.setSigningStatus(ReservationSigningStatusConstant.yiqianshou.getValue()); + }else { + distributionReservationEntity.setSigningStatus(ReservationSigningStatusConstant.bufenqianshou.getValue()); + } + distributionReservationMapper.updateById(distributionReservationEntity); + } + } + } + + + //维护配送任务签收状态 + DistributionDeliveryListEntity distributionDeliveryListEntity = distributionDeliveryListMapper.selectById(deliveryId); + if (Func.isNotEmpty(distributionDeliveryListEntity)){ + Integer deliverySigningTotal = distributionDeliveryListEntity.getDeliveryNumber(); + DistributionLoadingNumDTO deliverySigningNum= distributionDeliveryListMapper.selectDeliverySigningNum(distributionReservationEntity.getId()); + if (Func.isNotEmpty(deliverySigningNum)){ + int deliverySigningQuantity = deliverySigningNum.getPackageSigningQuantity() + deliverySigningNum.getInventorySigningQuantity(); + if (deliverySigningQuantity>0){ + if (deliverySigningTotal ==deliverySigningQuantity){ + distributionDeliveryListEntity.setDeliveryStatus(DeliveryStatusConstant.yiwancheng.getValue()); + }else { + distributionDeliveryListEntity.setDeliveryStatus(DeliveryStatusConstant.peisongzhong.getValue()); + } + distributionReservationMapper.updateById(distributionReservationEntity); + } + } + } } 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 fb1bf828f..95e46a1d4 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 @@ -573,7 +573,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImplquery().lambda() @@ -612,7 +612,6 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImplquery().lambda().eq(DistributionStockListEntity::getId, distributionLoadscaninvnEntity.getInventoryId())); BigDecimal quantityStock = new BigDecimal(distributionStockListEntity.getQuantityStock()); @@ -2877,6 +2876,8 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl warehouseName = new HashSet<>(); //经销商名称 HashSet mallName = new HashSet<>(); + + ArrayList mallId = new ArrayList<>(); //门店名称 HashSet storeName = new HashSet<>(); //包件总数量 @@ -2918,6 +2919,9 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl warehouseNames = new HashSet<>(); HashSet mallName = new HashSet<>(); + List mallId = new ArrayList<>(); HashSet storeName = new HashSet<>(); HashSet receivingUnit = new HashSet<>(); newStockArticle.forEach((k, v) -> { @@ -1302,7 +1303,6 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl parcelNumberVOS = distributionStockArticleDTO.getParcelNumberVOS(); @@ -1386,6 +1385,7 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl warehouseName = new HashSet<>(); //经销商名称 HashSet mallName = new HashSet<>(); + + List mallId = new ArrayList<>(); //门店名称 HashSet storeName = new HashSet<>(); @@ -1862,6 +1868,9 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl mallName = new HashSet<>(); + List mallId = new ArrayList<>(); + HashSet receivingUnit = new HashSet<>(); HashSet waybillNo = new HashSet<>(); @@ -2806,6 +2820,9 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl keyongshuliang){ + throw new RuntimeException("库存品库内数量不足!!!"); + } if (Func.isNotBlank(i.getServiceNumber())) { serviceNumber.add(i.getServiceNumber()); } @@ -3017,6 +3042,9 @@ public class DistributionReservationServiceImpl extends BaseServiceImplquery().lambda().eq(DistributionSignforEntity::getDeliveryId, distributionLoadscanEntity.getDeliveryId()).eq(DistributionSignforEntity::getReservationId, distributionLoadscanEntity.getReservationId())); @@ -1747,6 +1753,8 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl