@ -723,70 +723,89 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService {
}
@Override
public void checkLoadingByPackage ( DistributionParcelListEntity parcelListEntity , Long deliveryId ) {
//首先能够进入这个检测方法那么此包件就是进行装车了,这里对包件装车状态再次进行维护
if ( parcelListEntity . getOrderPackageLoadingStatus ( ) . equals ( OrderPackageLoadingStatusConstant . weizhuancghe . getValue ( ) ) ) {
parcelListEntity . setOrderPackageStatus ( OrderPackageStatusConstant . yichuku . getValue ( ) ) ;
parcelListEntity . setOrderPackageLoadingStatus ( OrderPackageLoadingStatusConstant . yizhuangche . getValue ( ) ) ;
distributionParcelListService . updateById ( parcelListEntity ) ;
@Transactional
public void checkLoadingByPackage ( DistributionParcelListEntity parcelListEntity , Long deliveryId , Long reservationId ) {
if ( Func . isEmpty ( parcelListEntity ) ) {
log . error ( "############包件信息异常:{}" , parcelListEntity ) ;
throw new RuntimeException ( "包件信息异常" ) ;
}
//维护包件所属订单是否均已完成装车,如果均已完成装车则订单进行装车状态的修改
switch ( parcelListEntity . getConditions ( ) ) {
case 1 :
break ;
//维护此包件对应的订单装车状态
DistributionStockArticleEntity stockArticleEntity = distributionStockArticleService . getById ( parcelListEntity . getStockArticleId ( ) ) ;
if ( Func . isNotEmpty ( stockArticleEntity ) ) {
//查询订单的所有包件
List < DistributionParcelListEntity > parcelListEntities = distributionParcelListService . list ( Wrappers . < DistributionParcelListEntity > query ( ) . lambda ( ) . eq ( DistributionParcelListEntity : : getStockArticleId , stockArticleEntity . getId ( ) ) ) ;
boolean orderLoadingFlag = parcelListEntities . stream ( ) . allMatch ( p - > p . getOrderPackageLoadingStatus ( ) . equals ( OrderPackageLoadingStatusConstant . yizhuangche . getValue ( ) ) ) ;
if ( orderLoadingFlag ) {
stockArticleEntity . setOrderStatus ( OrderStatusConstant . chuku . getValue ( ) ) ;
} else {
orderLoadingFlag = parcelListEntities . stream ( ) . allMatch ( p - > p . getOrderPackageLoadingStatus ( ) . equals ( OrderPackageLoadingStatusConstant . weizhuancghe . getValue ( ) ) ) ;
if ( ! orderLoadingFlag ) {
stockArticleEntity . setOrderStatus ( OrderStatusConstant . bufenchuku . getValue ( ) ) ;
}
}
distributionStockArticleService . updateById ( stockArticleEntity ) ;
}
//维护预约计划
List < DistributionReservationEntity > reservationEntityList = distributionDeliveryListMapper . selectReservationByDeliveryListId ( deliveryId ) ;
if ( Func . isNotEmpty ( reservationEntityList ) & & reservationEntityList . size ( ) > 0 ) {
for ( DistributionReservationEntity reservationEntity : reservationEntityList ) {
List < DistributionParcelListEntity > reservationParcelListEntities = distributionReservationMapper . selectPackageListByReservationId ( reservationEntity . getId ( ) ) ;
if ( Func . isNotEmpty ( reservationParcelListEntities ) & & reservationParcelListEntities . size ( ) > 0 ) {
boolean reservationLoadingFlag = reservationParcelListEntities . stream ( ) . allMatch ( p - > p . getOrderPackageLoadingStatus ( ) . equals ( OrderPackageLoadingStatusConstant . yizhuangche . getValue ( ) ) ) ;
if ( reservationLoadingFlag ) {
reservationEntity . setLoadingStatus ( ReservationLoadingStatusConstant . yizhuangche . getValue ( ) ) ;
} else {
reservationLoadingFlag = reservationParcelListEntities . stream ( ) . allMatch ( p - > p . getOrderPackageLoadingStatus ( ) . equals ( OrderPackageLoadingStatusConstant . weizhuancghe . getValue ( ) ) ) ;
if ( reservationLoadingFlag ) {
reservationEntity . setLoadingStatus ( ReservationLoadingStatusConstant . daizhuangche . getValue ( ) ) ;
} else {
reservationEntity . setLoadingStatus ( ReservationLoadingStatusConstant . bufenzhuangche . getValue ( ) ) ;
}
}
distributionReservationMapper . updateById ( reservationEntity ) ;
}
}
}
//维护配送计划
DistributionDeliveryListEntity deliveryListEntity = distributionDeliveryListMapper . selectById ( deliveryId ) ;
if ( Func . isNotEmpty ( deliveryListEntity ) ) {
List < DistributionParcelListEntity > deliveryParcelListEntities = distributionDeliveryListMapper . selectPackageListByDeliveryListId ( deliveryId ) ;
if ( Func . isNotEmpty ( deliveryParcelListEntities ) & & deliveryParcelListEntities . size ( ) > 0 ) {
boolean deliveryLoadingFlag = deliveryParcelListEntities . stream ( ) . allMatch ( p - > p . getOrderPackageLoadingStatus ( ) . equals ( OrderPackageLoadingStatusConstant . yizhuangche . getValue ( ) ) ) ;
if ( deliveryLoadingFlag ) {
deliveryListEntity . setDeliveryListLoadingStatus ( DeliveryLoadingStatusConstant . yizhuangche . getValue ( ) ) ;
} else {
deliveryLoadingFlag = deliveryParcelListEntities . stream ( ) . allMatch ( p - > p . getOrderPackageLoadingStatus ( ) . equals ( OrderPackageLoadingStatusConstant . weizhuancghe . getValue ( ) ) ) ;
if ( deliveryLoadingFlag ) {
deliveryListEntity . setDeliveryListLoadingStatus ( DeliveryLoadingStatusConstant . weizhuangche . getValue ( ) ) ;
} else {
deliveryListEntity . setDeliveryListLoadingStatus ( DeliveryLoadingStatusConstant . bunfenzhuangche . getValue ( ) ) ;
}
}
distributionDeliveryListMapper . updateById ( deliveryListEntity ) ;
}
case 3 :
break ;
}
DistributionStockArticleEntity stockArticleEntity = distributionStockArticleService . getById ( parcelListEntity . getStockArticleId ( ) ) ;
// //首先能够进入这个检测方法那么此包件就是进行装车了,这里对包件装车状态再次进行维护
// if (parcelListEntity.getOrderPackageLoadingStatus().equals(OrderPackageLoadingStatusConstant.weizhuancghe.getValue())){
// parcelListEntity.setOrderPackageStatus(OrderPackageStatusConstant.yichuku.getValue());
// parcelListEntity.setOrderPackageLoadingStatus(OrderPackageLoadingStatusConstant.yizhuangche.getValue());
// distributionParcelListService.updateById(parcelListEntity);
// }
//
// //维护此包件对应的订单装车状态
// DistributionStockArticleEntity stockArticleEntity = distributionStockArticleService.getById(parcelListEntity.getStockArticleId());
// if (Func.isNotEmpty(stockArticleEntity)){
// //查询订单的所有包件
// List<DistributionParcelListEntity> parcelListEntities = distributionParcelListService.list(Wrappers.<DistributionParcelListEntity>query().lambda().eq(DistributionParcelListEntity::getStockArticleId, stockArticleEntity.getId()));
// boolean orderLoadingFlag = parcelListEntities.stream().allMatch(p -> p.getOrderPackageLoadingStatus().equals(OrderPackageLoadingStatusConstant.yizhuangche.getValue()));
// if (orderLoadingFlag){
// stockArticleEntity.setOrderStatus(OrderStatusConstant.chuku.getValue());
// }else {
// orderLoadingFlag = parcelListEntities.stream().allMatch(p -> p.getOrderPackageLoadingStatus().equals(OrderPackageLoadingStatusConstant.weizhuancghe.getValue()));
// if (!orderLoadingFlag){
// stockArticleEntity.setOrderStatus(OrderStatusConstant.bufenchuku.getValue());
// }
// }
// distributionStockArticleService.updateById(stockArticleEntity);
// }
// //维护预约计划
// List<DistributionReservationEntity> reservationEntityList = distributionDeliveryListMapper.selectReservationByDeliveryListId(deliveryId);
// if (Func.isNotEmpty(reservationEntityList) && reservationEntityList.size()>0){
// for (DistributionReservationEntity reservationEntity : reservationEntityList) {
// List<DistributionParcelListEntity> reservationParcelListEntities = distributionReservationMapper.selectPackageListByReservationId(reservationEntity.getId());
// if (Func.isNotEmpty(reservationParcelListEntities)&& reservationParcelListEntities.size()>0){
// boolean reservationLoadingFlag = reservationParcelListEntities.stream().allMatch(p -> p.getOrderPackageLoadingStatus().equals(OrderPackageLoadingStatusConstant.yizhuangche.getValue()));
// if (reservationLoadingFlag){
// reservationEntity.setLoadingStatus(ReservationLoadingStatusConstant.yizhuangche.getValue());
// }else {
// reservationLoadingFlag = reservationParcelListEntities.stream().allMatch(p -> p.getOrderPackageLoadingStatus().equals(OrderPackageLoadingStatusConstant.weizhuancghe.getValue()));
// if (reservationLoadingFlag){
// reservationEntity.setLoadingStatus(ReservationLoadingStatusConstant.daizhuangche.getValue());
// }else {
// reservationEntity.setLoadingStatus(ReservationLoadingStatusConstant.bufenzhuangche.getValue());
// }
// }
// distributionReservationMapper.updateById(reservationEntity);
// }
// }
// }
// //维护配送计划
// DistributionDeliveryListEntity deliveryListEntity = distributionDeliveryListMapper.selectById(deliveryId);
// if (Func.isNotEmpty(deliveryListEntity)){
// List<DistributionParcelListEntity> deliveryParcelListEntities = distributionDeliveryListMapper.selectPackageListByDeliveryListId(deliveryId);
// if (Func.isNotEmpty(deliveryParcelListEntities) && deliveryParcelListEntities.size()>0){
// boolean deliveryLoadingFlag = deliveryParcelListEntities.stream().allMatch(p -> p.getOrderPackageLoadingStatus().equals(OrderPackageLoadingStatusConstant.yizhuangche.getValue()));
// if (deliveryLoadingFlag){
// deliveryListEntity.setDeliveryListLoadingStatus(DeliveryLoadingStatusConstant.yizhuangche.getValue());
// }else {
// deliveryLoadingFlag = deliveryParcelListEntities.stream().allMatch(p -> p.getOrderPackageLoadingStatus().equals(OrderPackageLoadingStatusConstant.weizhuancghe.getValue()));
// if (deliveryLoadingFlag){
// deliveryListEntity.setDeliveryListLoadingStatus(DeliveryLoadingStatusConstant.weizhuangche.getValue());
// }else {
// deliveryListEntity.setDeliveryListLoadingStatus(DeliveryLoadingStatusConstant.bunfenzhuangche.getValue());
// }
// }
// distributionDeliveryListMapper.updateById(deliveryListEntity);
// }
// }
}