|
|
|
@ -288,44 +288,50 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void processReservationIds(List<DistributionSignforVO> distributionSignforVOS, List<Long> reservationIds) { |
|
|
|
|
List<DistributionParcelListVO> distributionParcelListEntities = distributionReservationMapper.selectPackageListByReservationIds(reservationIds); |
|
|
|
|
// List<DisStockListDetailEntity> list = disStockListDetailService.list(Wrappers.<DisStockListDetailEntity>query().lambda()
|
|
|
|
|
// List<DistributionParcelListVO> distributionParcelListEntities = distributionReservationMapper.selectPackageListByReservationIds(reservationIds);
|
|
|
|
|
//// List<DisStockListDetailEntity> list = disStockListDetailService.list(Wrappers.<DisStockListDetailEntity>query().lambda()
|
|
|
|
|
//// .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())
|
|
|
|
|
// );
|
|
|
|
|
//
|
|
|
|
|
// List<DisStockListDetailEntity> inventoryList = disStockListDetailService.list(Wrappers.<DisStockListDetailEntity>query().lambda()
|
|
|
|
|
// .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 = distributionParcelListEntities.stream().collect(Collectors.groupingBy(DistributionParcelListVO::getReservationId)); |
|
|
|
|
|
|
|
|
|
// Map<Long, List<DistributionParcelListVO>> packageMap = distributionParcelListEntities.stream().collect(Collectors.groupingBy(DistributionParcelListVO::getReservationId));
|
|
|
|
|
// Map<Long, List<DisStockListDetailEntity>> inventoryMap = list.stream().collect(Collectors.groupingBy(DisStockListDetailEntity::getReservationId));
|
|
|
|
|
Map<Long, List<DistributionReservationZeroPackageEntity>> zeroPackageMap = reservationZeroPackageEntities.stream().collect(Collectors.groupingBy(DistributionReservationZeroPackageEntity::getReservationId)); |
|
|
|
|
// Map<Long, List<DistributionReservationZeroPackageEntity>> zeroPackageMap = reservationZeroPackageEntities.stream().collect(Collectors.groupingBy(DistributionReservationZeroPackageEntity::getReservationId));
|
|
|
|
|
|
|
|
|
|
distributionSignforVOS.forEach(d -> { |
|
|
|
|
d.setDeliveryTypeName(getDeliveryTypeName(d.getDeliveryType())); |
|
|
|
|
|
|
|
|
|
int weizhuangchejianshu = getWeizhuangchejianshu(packageMap, d); |
|
|
|
|
int zhuangchejianshu = getZhuangchejianshu(packageMap, d); |
|
|
|
|
int qianshoujianshu = getQianshoujianshu(packageMap, zeroPackageMap, d); |
|
|
|
|
int weiqianshoujianshu = getWeiqianshoujianshu(packageMap, zeroPackageMap, d); |
|
|
|
|
int weizhuangchejianshu = d.getReservationNum() - d.getLoadedNumber(); |
|
|
|
|
// int zhuangchejianshu = getZhuangchejianshu(packageMap, d);
|
|
|
|
|
// int qianshoujianshu = getQianshoujianshu(packageMap, zeroPackageMap, d);
|
|
|
|
|
int weiqianshoujianshu = d.getReservationNum() - d.getReceivedQuantity(); |
|
|
|
|
|
|
|
|
|
d.setUnloadedNumber(weizhuangchejianshu); |
|
|
|
|
d.setAbnormalLoadedNumber(getAbnormalLoading(d)); |
|
|
|
|
d.setLoadedNumber(zhuangchejianshu); |
|
|
|
|
d.setLoadedNumber(d.getLoadedNumber()); |
|
|
|
|
d.setUnreceivedQuantity(weiqianshoujianshu); |
|
|
|
|
d.setReceivedQuantity(qianshoujianshu); |
|
|
|
|
d.setReceivedQuantity(d.getReceivedQuantity()); |
|
|
|
|
d.setAbnormalReceivedQuantity(getAbnormalSigning(d)); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private int getWeiqianshoujianshu(Map<Long, List<DistributionParcelListVO>> packageMap, Map<Long, List<DistributionReservationZeroPackageEntity>> zeroPackageMap, DistributionSignforVO d) { |
|
|
|
|
|
|
|
|
|
int fromParcelList = packageMap.getOrDefault(d.getReservationId(), Collections.emptyList()).stream().filter(f -> !f.getOrderPackageStatus().equals(OrderPackageStatusConstant.yiqianshou.getValue())).mapToInt(DistributionParcelListVO::getQuantity).sum(); |
|
|
|
|
int fromZeroPackage = calculateWeiqianshouFromZeroPackage(zeroPackageMap, d); |
|
|
|
|
|
|
|
|
|
return fromParcelList + fromZeroPackage; |
|
|
|
|
} |
|
|
|
|
// private int getWeiqianshoujianshu(Map<Long, List<DistributionParcelListVO>> packageMap, Map<Long, List<DistributionReservationZeroPackageEntity>> zeroPackageMap, DistributionSignforVO d) {
|
|
|
|
|
//
|
|
|
|
|
// int fromParcelList = packageMap.getOrDefault(d.getReservationId(), Collections.emptyList()).stream().filter(f -> !f.getOrderPackageStatus().equals(OrderPackageStatusConstant.yiqianshou.getValue())).mapToInt(DistributionParcelListVO::getQuantity).sum();
|
|
|
|
|
// int fromZeroPackage = calculateWeiqianshouFromZeroPackage(zeroPackageMap, d);
|
|
|
|
|
//
|
|
|
|
|
// return fromParcelList + fromZeroPackage;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
private int calculateWeiqianshouFromZeroPackage(Map<Long, List<DistributionReservationZeroPackageEntity>> zeroPackageMap, DistributionSignforVO d) { |
|
|
|
|
if (!zeroPackageMap.containsKey(d.getReservationId())) return 0; |
|
|
|
@ -345,21 +351,21 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private int getWeizhuangchejianshu(Map<Long, List<DistributionParcelListVO>> packageMap, DistributionSignforVO d) { |
|
|
|
|
return packageMap.getOrDefault(d.getReservationId(), Collections.emptyList()).stream().filter(f -> f.getOrderPackageLoadingStatus().equals(OrderPackageLoadingStatusConstant.weizhuancghe.getValue())).mapToInt(DistributionParcelListVO::getQuantity).sum(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private int getZhuangchejianshu(Map<Long, List<DistributionParcelListVO>> packageMap, DistributionSignforVO d) { |
|
|
|
|
return packageMap.getOrDefault(d.getReservationId(), Collections.emptyList()).stream().filter(f -> f.getOrderPackageLoadingStatus().equals(OrderPackageLoadingStatusConstant.yizhuangche.getValue())).mapToInt(DistributionParcelListVO::getQuantity).sum(); |
|
|
|
|
} |
|
|
|
|
// private int getWeizhuangchejianshu(Map<Long, List<DistributionParcelListVO>> packageMap, DistributionSignforVO d) {
|
|
|
|
|
// return packageMap.getOrDefault(d.getReservationId(), Collections.emptyList()).stream().filter(f -> f.getOrderPackageLoadingStatus().equals(OrderPackageLoadingStatusConstant.weizhuancghe.getValue())).mapToInt(DistributionParcelListVO::getQuantity).sum();
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// private int getZhuangchejianshu(Map<Long, List<DistributionParcelListVO>> packageMap, DistributionSignforVO d) {
|
|
|
|
|
// return packageMap.getOrDefault(d.getReservationId(), Collections.emptyList()).stream().filter(f -> f.getOrderPackageLoadingStatus().equals(OrderPackageLoadingStatusConstant.yizhuangche.getValue())).mapToInt(DistributionParcelListVO::getQuantity).sum();
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
private int getQianshoujianshu(Map<Long, List<DistributionParcelListVO>> packageMap, Map<Long, List<DistributionReservationZeroPackageEntity>> zeroPackageMap, DistributionSignforVO d) { |
|
|
|
|
int fromParcelList = packageMap.getOrDefault(d.getReservationId(), Collections.emptyList()).stream().filter(f -> f.getOrderPackageStatus().equals(OrderPackageStatusConstant.yiqianshou.getValue())).mapToInt(DistributionParcelListVO::getQuantity).sum(); |
|
|
|
|
int fromZeroPackage = calculateQianshouFromZeroPackage(zeroPackageMap, d); |
|
|
|
|
|
|
|
|
|
return fromParcelList + fromZeroPackage; |
|
|
|
|
} |
|
|
|
|
// private int getQianshoujianshu(Map<Long, List<DistributionParcelListVO>> packageMap, Map<Long, List<DistributionReservationZeroPackageEntity>> zeroPackageMap, DistributionSignforVO d) {
|
|
|
|
|
// int fromParcelList = packageMap.getOrDefault(d.getReservationId(), Collections.emptyList()).stream().filter(f -> f.getOrderPackageStatus().equals(OrderPackageStatusConstant.yiqianshou.getValue())).mapToInt(DistributionParcelListVO::getQuantity).sum();
|
|
|
|
|
// int fromZeroPackage = calculateQianshouFromZeroPackage(zeroPackageMap, d);
|
|
|
|
|
//
|
|
|
|
|
// return fromParcelList + fromZeroPackage;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
private int calculateQianshouFromZeroPackage(Map<Long, List<DistributionReservationZeroPackageEntity>> zeroPackageMap, DistributionSignforVO d) { |
|
|
|
|
if (!zeroPackageMap.containsKey(d.getReservationId())) return 0; |
|
|
|
|