Browse Source

取消自提零担订单维护

dist.1.3.0
汤建军 9 months ago
parent
commit
ffd8722972
  1. 48
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAsyncServiceImpl.java

48
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAsyncServiceImpl.java

@ -2944,20 +2944,52 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService {
@Override
public void maintenanceCancelBillLading(List<Long> ids) {
List<Long> orderIds = new ArrayList<>();
List<Long> packageIds = new ArrayList<>();
for (Long id : ids) {
List<DistrilbutionBillPackageEntity> list = billPackageService.list(Wrappers.<DistrilbutionBillPackageEntity>query().lambda()
.eq(DistrilbutionBillPackageEntity::getBillLadingId, id)
.eq(DistrilbutionBillPackageEntity::getPacketBarStatus, ReservationPackageStatusConstant.quxiao.getValue())
);
if (!list.isEmpty()) {
List<Long> packageIds = list.stream().map(DistrilbutionBillPackageEntity::getParceListId).collect(Collectors.toList());
distributionParcelListService.update(Wrappers.<DistributionParcelListEntity>update().lambda()
.in(DistributionParcelListEntity::getId, packageIds)
.set(DistributionParcelListEntity::getOrderPackageReservationStatus, OrderPackageReservationStatusConstant.daiyuyue.getValue())
);
List<Long> orderIds = list.stream().map(DistrilbutionBillPackageEntity::getStockArticleId).distinct().collect(Collectors.toList());
distributionStockArticleService.maintenanceOrderInfoByIds(orderIds);
List<Long> packageIds1 = list.stream().map(DistrilbutionBillPackageEntity::getParceListId).collect(Collectors.toList());
packageIds.addAll(packageIds1);
List<Long> orderId1 = list.stream().map(DistrilbutionBillPackageEntity::getStockArticleId).distinct().collect(Collectors.toList());
orderIds.addAll(orderId1);
}
List<DistributionReservationZeroPackageEntity> reservationZeroPackageEntities = zeroPackageService.list(Wrappers.<DistributionReservationZeroPackageEntity>query().lambda()
.eq(DistributionReservationZeroPackageEntity::getReservationId, id)
.eq(DistributionReservationZeroPackageEntity::getZeroPackageStatus, ReservationPackageStatusConstant.quxiao.getValue())
.eq(DistributionReservationZeroPackageEntity::getType, "3")
);
if (!reservationZeroPackageEntities.isEmpty()) {
//进行数据回退
List<Long> packageIds2 = reservationZeroPackageEntities.stream().map(DistributionReservationZeroPackageEntity::getParcelListId).distinct().collect(Collectors.toList());
packageIds.addAll(packageIds2);
for (DistributionReservationZeroPackageEntity reservationZeroPackageEntity : reservationZeroPackageEntities) {
reservationZeroPackageEntity.setZeroPackageStatus(ReservationPackageStatusConstant.quxiao.getValue());
Integer quantity = reservationZeroPackageEntity.getQuantity();
distributionParcelNumberService.update(Wrappers.<DistributionParcelNumberEntity>update().lambda()
.eq(DistributionParcelNumberEntity::getParcelListId,reservationZeroPackageEntity.getParcelListId())
.eq(DistributionParcelNumberEntity::getStockArticleId,reservationZeroPackageEntity.getStockArticleId())
.setSql("delivery_quantity -", quantity)
);
//状态回退包件一定处于可预约
orderIds.add(reservationZeroPackageEntity.getStockArticleId());
}
if (!packageIds.isEmpty()) {
distributionParcelListService.update(Wrappers.<DistributionParcelListEntity>update().lambda()
.in(DistributionParcelListEntity::getId, packageIds)
.set(DistributionParcelListEntity::getOrderPackageReservationStatus, OrderPackageReservationStatusConstant.daiyuyue.getValue())
);
}
if (!orderIds.isEmpty()) {
List<Long> newOrderIds = orderIds.stream().distinct().collect(Collectors.toList());
distributionStockArticleService.maintenanceOrderInfoByIds(newOrderIds);
}
}
}
}

Loading…
Cancel
Save