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 ee7da4b7b..089cb074a 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 @@ -28,6 +28,7 @@ import org.springblade.common.constant.Inventory.InventorySigningStatusConstant; import org.springblade.common.constant.common.IsOrNoConstant; import org.springblade.common.constant.delivery.DeliveryLoadingStatusConstant; import org.springblade.common.constant.delivery.DeliveryStatusConstant; +import org.springblade.common.constant.loading.LoadingStatusConstant; import org.springblade.common.constant.order.OrderReservationStatusConstant; import org.springblade.common.constant.order.OrderStatusConstant; import org.springblade.common.constant.order.OrderStockupStatusConstant; @@ -36,6 +37,7 @@ import org.springblade.common.constant.orderpackage.OrderPackageReservationStatu 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; import org.springblade.common.constant.stockup.StockupStatusConstant; import org.springblade.common.exception.CustomerException; import org.springblade.core.tool.utils.Func; @@ -61,6 +63,7 @@ import java.util.stream.Collectors; public class DistributionAsyncServiceImpl implements IDistributionAsyncService { private final DistributionLoadscanMapper distributionLoadscanMapper; + private final DistributionLoadscaninvnMapper distributionLoadscaninvnMapper; private final IDistributionStockArticleService distributionStockArticleService; private final DistributionStockMapper distributionStockService; private final DistributionStockListMapper distributionStockListMapper; @@ -457,103 +460,138 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService { .ne(DisStockListDetailEntity::getStockPackageStatus, InventoryPackageStatusConstant.quxiao.getValue())); boolean inventoryLoadingFlag = list.stream().allMatch(l -> l.getStockLockingStatus().equals(InventoryLoadingStatusConstant.yizhuangche.getValue())); boolean inventorySigningFlag = list.stream().allMatch(l -> l.getStockSignfoStatus().equals(InventorySigningStatusConstant.yiqianshou.getValue())); - List reservationStockarticleEntityList = distributionReservationStocklistMapper.selectList(Wrappers.query().lambda() + List reservationStocklistEntityList = 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) { + if (reservationStocklistEntityList.size() == 1) { //修改状态 - DistributionReservationStocklistEntity reservationStockarticleEntity = reservationStockarticleEntityList.get(0); + DistributionReservationStocklistEntity reservationStocklistEntity = reservationStocklistEntityList.get(0); if (inventoryLoadingFlag) { //查询出库存品进行全部状态的变更 - reservationStockarticleEntity.setLoadingStatus(ReservationInventoryLoadingStatusConstant.yizhuangche.getValue()); + reservationStocklistEntity.setLoadingStatus(ReservationInventoryLoadingStatusConstant.yizhuangche.getValue()); } else { inventoryLoadingFlag = list.stream().allMatch(l -> l.getStockLockingStatus().equals(InventoryLoadingStatusConstant.weizhuangche.getValue())); if (inventoryLoadingFlag) { - reservationStockarticleEntity.setLoadingStatus(ReservationInventoryLoadingStatusConstant.weizhuangche.getValue()); + reservationStocklistEntity.setLoadingStatus(ReservationInventoryLoadingStatusConstant.weizhuangche.getValue()); } else { - reservationStockarticleEntity.setLoadingStatus(ReservationInventoryLoadingStatusConstant.bufenzhuangche.getValue()); + reservationStocklistEntity.setLoadingStatus(ReservationInventoryLoadingStatusConstant.bufenzhuangche.getValue()); } } if (inventorySigningFlag) { //查询出库存品进行全部状态的变更 - reservationStockarticleEntity.setSigningStatus(ReservationInventorySigningStatusConstant.yiqianshou.getValue()); + reservationStocklistEntity.setSigningStatus(ReservationInventorySigningStatusConstant.yiqianshou.getValue()); } else { inventorySigningFlag = list.stream().allMatch(l -> l.getStockLockingStatus().equals(InventoryLoadingStatusConstant.weizhuangche.getValue())); if (inventorySigningFlag) { - reservationStockarticleEntity.setSigningStatus(ReservationInventorySigningStatusConstant.weiqianshou.getValue()); + reservationStocklistEntity.setSigningStatus(ReservationInventorySigningStatusConstant.weiqianshou.getValue()); } else { - reservationStockarticleEntity.setSigningStatus(ReservationInventorySigningStatusConstant.bufenqianshou.getValue()); + reservationStocklistEntity.setSigningStatus(ReservationInventorySigningStatusConstant.bufenqianshou.getValue()); } } - distributionReservationStocklistMapper.updateById(reservationStockarticleEntity); + distributionReservationStocklistMapper.updateById(reservationStocklistEntity); } else { - log.error("####库存品记录错误+{" + reservationStockarticleEntityList + "}"); + log.error("####库存品记录错误+{" + reservationStocklistEntityList + "}"); 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) { + int reservationTotal = r.getReservationNum() + r.getReservationStockListNum(); + //查询此预约的包件装车数和库存品装车数 + Integer loadingNum = 0; + Integer signNum = 0; + List loadscanEntityList = distributionLoadscanMapper.selectList(Wrappers.query().lambda() + .eq(DistributionLoadscanEntity::getReservationId, r.getId()) + .ne(DistributionLoadscanEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue()) + ); + if (Func.isNotEmpty(loadscanEntityList)){ + loadingNum += loadscanEntityList.stream().mapToInt(DistributionLoadscanEntity::getLoadedNub).sum(); + signNum += loadscanEntityList.stream().filter(l->l.getSignforState().equals(SignforStatusConstant.yiqianshou.getValue())).mapToInt(DistributionLoadscanEntity::getReceivedQuantity).sum(); + + } + List loadscaninvnEntityList = distributionLoadscaninvnMapper.selectList(Wrappers.query().lambda() + .eq(DistributionLoadscaninvnEntity::getReservationId, r.getId()) + .ne(DistributionLoadscaninvnEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue()) + ); + if (Func.isNotEmpty(loadscanEntityList)){ + loadingNum += loadscaninvnEntityList.stream().mapToInt(DistributionLoadscaninvnEntity::getLoadedNub).sum(); + signNum += loadscaninvnEntityList.stream().filter(l->l.getSignforState().equals(SignforStatusConstant.yiqianshou.getValue())).mapToInt(DistributionLoadscaninvnEntity::getReceivedQuantity).sum(); + } + + if (loadingNum == reservationTotal){ r.setLoadingStatus(ReservationLoadingStatusConstant.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()); - } else { - r.setLoadingStatus(ReservationLoadingStatusConstant.bufenzhuangche.getValue()); - } + }else { + r.setLoadingStatus(ReservationLoadingStatusConstant.bufenzhuangche.getValue()); } - boolean inventorySigningFlag = distributionReservationStocklistEntities.stream().allMatch(i -> i.getSigningStatus().equals(ReservationInventorySigningStatusConstant.yiqianshou.getValue())); - boolean reservationSigningFlag = parcelListEntities.stream().allMatch(p -> p.getOrderPackageStatus().equals(OrderPackageStatusConstant.yiqianshou.getValue())); - if (inventorySigningFlag && reservationSigningFlag) { - r.setSigningStatus(ReservationSigningStatusConstant.yiqianshou.getValue()); - } else { - inventorySigningFlag = distributionReservationStocklistEntities.stream().allMatch(i -> !i.getSigningStatus().equals(ReservationInventorySigningStatusConstant.yiqianshou.getValue())); - reservationSigningFlag = parcelListEntities.stream().allMatch(p -> !p.getOrderPackageStatus().equals(OrderPackageStatusConstant.yiqianshou.getValue())); - if (inventorySigningFlag && reservationSigningFlag) { - r.setSigningStatus(ReservationSigningStatusConstant.daiqianshou.getValue()); - } else { - r.setSigningStatus(ReservationSigningStatusConstant.bufenqianshou.getValue()); - } + if (signNum == reservationTotal){ + r.setSigningStatus(ReservationSigningStatusConstant.yiqianshou.getValue()); + }else { + r.setSigningStatus(ReservationSigningStatusConstant.bufenqianshou.getValue()); } +// //查询预约下的所有包件信息 +// 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()); +// } 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()); +// } else { +// r.setLoadingStatus(ReservationLoadingStatusConstant.bufenzhuangche.getValue()); +// } +// } +// boolean inventorySigningFlag = distributionReservationStocklistEntities.stream().allMatch(i -> i.getSigningStatus().equals(ReservationInventorySigningStatusConstant.yiqianshou.getValue())); +// boolean reservationSigningFlag = parcelListEntities.stream().allMatch(p -> p.getOrderPackageStatus().equals(OrderPackageStatusConstant.yiqianshou.getValue())); +// if (inventorySigningFlag && reservationSigningFlag) { +// r.setSigningStatus(ReservationSigningStatusConstant.yiqianshou.getValue()); +// } else { +// inventorySigningFlag = distributionReservationStocklistEntities.stream().allMatch(i -> !i.getSigningStatus().equals(ReservationInventorySigningStatusConstant.yiqianshou.getValue())); +// reservationSigningFlag = parcelListEntities.stream().allMatch(p -> !p.getOrderPackageStatus().equals(OrderPackageStatusConstant.yiqianshou.getValue())); +// if (inventorySigningFlag && reservationSigningFlag) { +// r.setSigningStatus(ReservationSigningStatusConstant.daiqianshou.getValue()); +// +// } else { +// r.setSigningStatus(ReservationSigningStatusConstant.bufenqianshou.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()); - } 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()); - } + Integer delivertTotal = deliveryListEntity.getDeliveryNumber(); + Integer deliverySigningNum = 0 ; + List loadscanEntityList = distributionLoadscanMapper.selectList(Wrappers.query().lambda() + .eq(DistributionLoadscanEntity::getDeliveryId, deliveryListEntity.getId()) + .ne(DistributionLoadscanEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue()) + ); + if (Func.isNotEmpty(loadscanEntityList)){ + deliverySigningNum += loadscanEntityList.stream().filter(l->l.getSignforState().equals(SignforStatusConstant.yiqianshou.getValue())).mapToInt(DistributionLoadscanEntity::getReceivedQuantity).sum(); + } - boolean deliveryPackageSigningFlag = deliveryParcelListEntityList.stream().allMatch(p -> p.getOrderPackageLoadingStatus().equals(OrderPackageLoadingStatusConstant.yizhuangche.getValue())); - boolean deliveryInventorySigningFlag = detailEntities.stream().allMatch(i -> i.getStockLockingStatus().equals(ReservationInventoryLoadingStatusConstant.yizhuangche.getValue())); - if (deliveryPackageSigningFlag && deliveryInventorySigningFlag) { + List loadscaninvnEntityList = distributionLoadscaninvnMapper.selectList(Wrappers.query().lambda() + .eq(DistributionLoadscaninvnEntity::getDeliveryId, deliveryListEntity.getId()) + .ne(DistributionLoadscaninvnEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue()) + ); + if (Func.isNotEmpty(loadscanEntityList)){ + deliverySigningNum += loadscaninvnEntityList.stream().filter(l->l.getSignforState().equals(SignforStatusConstant.yiqianshou.getValue())).mapToInt(DistributionLoadscaninvnEntity::getReceivedQuantity).sum(); + } + + if (deliverySigningNum == delivertTotal){ deliveryListEntity.setDeliveryStatus(DeliveryStatusConstant.yiwancheng.getValue()); - } else { + }else { deliveryListEntity.setDeliveryStatus(DeliveryStatusConstant.peisongzhong.getValue()); } + distributionDeliveryListMapper.updateById(deliveryListEntity); } 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 6883a0e3c..9a1f7f58c 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 @@ -1171,7 +1171,7 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl