@ -229,6 +229,14 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
. in ( DisStockListDetailEntity : : getReservationId , reservationIds )
. ne ( DisStockListDetailEntity : : getStockPackageStatus , ReservationPackageStatusConstant . quxiao . getValue ( ) )
) ;
//查询零担计划
List < DistributionReservationZeroPackageEntity > reservationZeroPackageEntities = distributionReservationZeroPackageService . list ( Wrappers . < DistributionReservationZeroPackageEntity > query ( ) . lambda ( )
. in ( DistributionReservationZeroPackageEntity : : getReservationId , reservationIds )
. ne ( DistributionReservationZeroPackageEntity : : getZeroPackageStatus , ReservationPackageStatusConstant . quxiao . getValue ( ) )
) ;
Map < Long , List < DistributionParcelListVO > > packageMap ;
if ( Func . isNotEmpty ( distributionParcelListEntities ) ) {
packageMap = distributionParcelListEntities . stream ( ) . collect ( Collectors . groupingBy ( DistributionParcelListVO : : getReservationId ) ) ;
@ -241,6 +249,12 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
} else {
inventoryMap = null ;
}
Map < Long , List < DistributionReservationZeroPackageEntity > > zeroPackageMap ;
if ( Func . isNotEmpty ( reservationZeroPackageEntities ) ) {
zeroPackageMap = reservationZeroPackageEntities . stream ( ) . collect ( Collectors . groupingBy ( DistributionReservationZeroPackageEntity : : getReservationId ) ) ;
} else {
zeroPackageMap = null ;
}
distributionSignforVOS . forEach ( d - > {
if ( d . getDeliveryType ( ) . equals ( DistributionTypeConstant . shipie . getValue ( ) ) ) {
@ -259,20 +273,57 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
int weiqianshoujianshu = 0 ;
int zhuangchejianshu = 0 ;
int qianshoujianshu = 0 ;
List < DistributionParcelListVO > distributionParcelListVOS = packageMap . get ( d . getReservationId ( ) ) ;
List < DisStockListDetailEntity > listDetailEntityList = inventoryMap . get ( d . getReservationId ( ) ) ;
if ( Func . isNotEmpty ( listDetailEntityList ) ) {
zhuangchejianshu + = listDetailEntityList . stream ( ) . filter ( f - > f . getStockLockingStatus ( ) . equals ( InventoryLoadingStatusConstant . yizhuangche . getValue ( ) ) ) . mapToInt ( DisStockListDetailEntity : : getNum ) . sum ( ) ;
if ( Func . isNotEmpty ( packageMap ) ) {
List < DistributionParcelListVO > distributionParcelListVOS = packageMap . get ( d . getReservationId ( ) ) ;
if ( Func . isNotEmpty ( distributionParcelListVOS ) ) {
weizhuangchejianshu + = distributionParcelListVOS . stream ( ) . filter ( f - > f . getOrderPackageLoadingStatus ( ) . equals ( OrderPackageLoadingStatusConstant . weizhuancghe . getValue ( ) ) ) . mapToInt ( DistributionParcelListEntity : : getQuantity ) . sum ( ) ;
zhuangchejianshu + = distributionParcelListVOS . stream ( ) . filter ( f - > f . getOrderPackageLoadingStatus ( ) . equals ( OrderPackageLoadingStatusConstant . yizhuangche . getValue ( ) ) ) . mapToInt ( DistributionParcelListEntity : : getQuantity ) . sum ( ) ;
weiqianshoujianshu + = distributionParcelListVOS . stream ( ) . filter ( f - > ! f . getOrderPackageStatus ( ) . equals ( OrderPackageStatusConstant . yiqianshou . getValue ( ) ) ) . mapToInt ( DistributionParcelListEntity : : getQuantity ) . sum ( ) ;
qianshoujianshu + = distributionParcelListVOS . stream ( ) . filter ( f - > f . getOrderPackageStatus ( ) . equals ( OrderPackageStatusConstant . yiqianshou . getValue ( ) ) ) . mapToInt ( DistributionParcelListEntity : : getQuantity ) . sum ( ) ;
}
}
if ( Func . isNotEmpty ( zeroPackageMap ) ) {
List < DistributionReservationZeroPackageEntity > zeroPackageEntities = zeroPackageMap . get ( d . getReservationId ( ) ) ;
if ( Func . isNotEmpty ( zeroPackageEntities ) ) {
List < Long > zeroPackageIds = zeroPackageEntities . stream ( ) . map ( DistributionReservationZeroPackageEntity : : getParcelListId ) . collect ( Collectors . toList ( ) ) ;
//查询这些单子的装车信息
List < DistributionLoadscanEntity > loadscanEntityList = distributionLoadscanService . list ( Wrappers . < DistributionLoadscanEntity > query ( ) . lambda ( )
. eq ( DistributionLoadscanEntity : : getReservationId , d . getReservationId ( ) )
. in ( DistributionLoadscanEntity : : getPackageId , zeroPackageIds )
. ne ( DistributionLoadscanEntity : : getScanStatus , LoadingStatusConstant . quxiao . getValue ( ) )
) ;
//此预约单的零担计划总数
int sum = zeroPackageEntities . stream ( ) . mapToInt ( DistributionReservationZeroPackageEntity : : getQuantity ) . sum ( ) ;
if ( loadscanEntityList . isEmpty ( ) ) {
//统计装车
int loadingNum = loadscanEntityList . stream ( ) . mapToInt ( DistributionLoadscanEntity : : getLoadedNub ) . sum ( ) ;
//统计签收
int signforNUm = loadscanEntityList . stream ( ) . filter ( f - > LoadScanSigningStatusConstant . yiqianshou . getValue ( ) . equals ( f . getSignforState ( ) ) ) . mapToInt ( DistributionLoadscanEntity : : getReceivedQuantity ) . sum ( ) ;
//计算未装车
weizhuangchejianshu + = ( sum - loadingNum ) ;
zhuangchejianshu + = loadingNum ;
//计算未签收
weiqianshoujianshu + = ( sum - signforNUm ) ;
qianshoujianshu + = signforNUm ;
}
}
}
if ( Func . isNotEmpty ( inventoryMap ) ) {
List < DisStockListDetailEntity > listDetailEntityList = inventoryMap . get ( d . getReservationId ( ) ) ;
if ( Func . isNotEmpty ( listDetailEntityList ) ) {
zhuangchejianshu + = listDetailEntityList . stream ( ) . filter ( f - > f . getStockLockingStatus ( ) . equals ( InventoryLoadingStatusConstant . yizhuangche . getValue ( ) ) ) . mapToInt ( DisStockListDetailEntity : : getNum ) . sum ( ) ;
// weizhuangchejianshu += list.stream().filter(f -> f.getStockLockingStatus().equals(InventoryLoadingStatusConstant.weizhuangche.getValue())).mapToInt(DisStockListDetailEntity::getNum).sum();
qianshoujianshu + = listDetailEntityList . stream ( ) . filter ( f - > f . getStockSignfoStatus ( ) . equals ( InventorySigningStatusConstant . yiqianshou . getValue ( ) ) ) . mapToInt ( DisStockListDetailEntity : : getNum ) . sum ( ) ;
qianshoujianshu + = listDetailEntityList . stream ( ) . filter ( f - > f . getStockSignfoStatus ( ) . equals ( InventorySigningStatusConstant . yiqianshou . getValue ( ) ) ) . mapToInt ( DisStockListDetailEntity : : getNum ) . sum ( ) ;
// weiqianshoujianshu += list.stream().filter(f -> f.getStockSignfoStatus().equals(InventorySigningStatusConstant.weiqianshou.getValue())).mapToInt(DisStockListDetailEntity::getNum).sum();
}
}
if ( Func . isNotEmpty ( distributionParcelListVOS ) ) {
weizhuangchejianshu + = distributionParcelListVOS . stream ( ) . filter ( f - > f . getOrderPackageLoadingStatus ( ) . equals ( OrderPackageLoadingStatusConstant . weizhuancghe . getValue ( ) ) ) . mapToInt ( DistributionParcelListEntity : : getQuantity ) . sum ( ) ;
zhuangchejianshu + = distributionParcelListVOS . stream ( ) . filter ( f - > f . getOrderPackageLoadingStatus ( ) . equals ( OrderPackageLoadingStatusConstant . yizhuangche . getValue ( ) ) ) . mapToInt ( DistributionParcelListEntity : : getQuantity ) . sum ( ) ;
weiqianshoujianshu + = distributionParcelListVOS . stream ( ) . filter ( f - > ! f . getOrderPackageStatus ( ) . equals ( OrderPackageStatusConstant . yiqianshou . getValue ( ) ) ) . mapToInt ( DistributionParcelListEntity : : getQuantity ) . sum ( ) ;
qianshoujianshu + = distributionParcelListVOS . stream ( ) . filter ( f - > f . getOrderPackageStatus ( ) . equals ( OrderPackageStatusConstant . yiqianshou . getValue ( ) ) ) . mapToInt ( DistributionParcelListEntity : : getQuantity ) . sum ( ) ;
}
//该客户的异常装车件数
Integer abnormalLoading = distributionLoadscanMapper . selectAbnormalLoadingByReservationId ( d . getReservationId ( ) ) ;
//该客户的异常签收件数