|
|
|
@ -1300,34 +1300,73 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService {
|
|
|
|
|
@Override |
|
|
|
|
public void stockupSelfUpdateState(StockupDTO stockupDTO) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//查询全部订单数据
|
|
|
|
|
List<DistrilbutionBillStockEntity> distrilbutionBillStockEntities = distrilbutionBillStockMapper.selectList(Wrappers.<DistrilbutionBillStockEntity>query().lambda() |
|
|
|
|
.eq(DistrilbutionBillStockEntity::getBillLadingId, stockupDTO.getReservationId()) |
|
|
|
|
.apply("order_status in (1,2)") |
|
|
|
|
); |
|
|
|
|
//查询是否有零担信息
|
|
|
|
|
List<DistributionReservationZeroPackageEntity> listZero = reservationZeroPackageService.list(Wrappers.<DistributionReservationZeroPackageEntity>query().lambda() |
|
|
|
|
.eq(DistributionReservationZeroPackageEntity::getReservationId, stockupDTO.getReservationId()) |
|
|
|
|
.eq(DistributionReservationZeroPackageEntity::getIsDeleted, 0) |
|
|
|
|
.in(DistributionReservationZeroPackageEntity::getZeroPackageStatus, "1", "3") |
|
|
|
|
); |
|
|
|
|
// AtomicReference<Boolean> z = new AtomicReference<>(false);
|
|
|
|
|
// AtomicReference<Integer> zeroNum = new AtomicReference<>(0); //零担已备货的数量
|
|
|
|
|
AtomicReference<Integer> zeroYuNum = new AtomicReference<>(0); //零担预约的数量
|
|
|
|
|
if(!listZero.isEmpty()){ |
|
|
|
|
int sum = listZero.stream().mapToInt(DistributionReservationZeroPackageEntity::getQuantity).sum(); |
|
|
|
|
zeroYuNum.set(sum); |
|
|
|
|
//有
|
|
|
|
|
// listZero.forEach( i ->{
|
|
|
|
|
// List<DistributionStockEntity> stockEntityList = distributionStockService.selectList(Wrappers.<DistributionStockEntity>query().lambda()
|
|
|
|
|
// .eq(DistributionStockEntity::getStockupId, stockupDTO.getStockupId())
|
|
|
|
|
// .eq(DistributionStockEntity::getStockArticle, i.getStockArticleId())
|
|
|
|
|
// .eq(DistributionStockEntity::getConditions, "2")
|
|
|
|
|
// .eq(DistributionStockEntity::getBillLadingId, stockupDTO.getReservationId())
|
|
|
|
|
// );
|
|
|
|
|
// if(!stockEntityList.isEmpty()){
|
|
|
|
|
// //没有备货
|
|
|
|
|
// int sum = stockEntityList.stream().mapToInt(DistributionStockEntity::getStockQuantity).sum();
|
|
|
|
|
// zeroNum.set(zeroNum.get() + sum);
|
|
|
|
|
// }
|
|
|
|
|
// zeroYuNum.set(zeroYuNum.get()+i.getQuantity());
|
|
|
|
|
// });
|
|
|
|
|
// z.set(true);
|
|
|
|
|
} |
|
|
|
|
//查询包件数据
|
|
|
|
|
AtomicReference<Integer> nu = new AtomicReference<>(0); //全部包件数据
|
|
|
|
|
distrilbutionBillStockEntities.forEach(i -> { |
|
|
|
|
List<DistributionParcelListEntity> distributionParcelListEntities = distributionParcelListMapper.selectList(Wrappers.<DistributionParcelListEntity>query().lambda() |
|
|
|
|
.eq(DistributionParcelListEntity::getStockArticleId, i.getStockArticleId()) |
|
|
|
|
); |
|
|
|
|
int size = distributionParcelListEntities.size(); |
|
|
|
|
nu.set(nu.get() + size); |
|
|
|
|
}); |
|
|
|
|
//查询订单的非零担数据
|
|
|
|
|
List<DistributionStockPackageVO> distributionStockPackageVOS = distrilbutionBillStockService.listPackageSelf(stockupDTO.getReservationId()); |
|
|
|
|
//计算全部预约件数
|
|
|
|
|
if(!distributionStockPackageVOS.isEmpty()){ |
|
|
|
|
nu.set(distributionStockPackageVOS.size() + zeroYuNum.get()); |
|
|
|
|
}else{ |
|
|
|
|
nu.set(zeroYuNum.get()); |
|
|
|
|
} |
|
|
|
|
// distrilbutionBillStockEntities.forEach(i -> {
|
|
|
|
|
//
|
|
|
|
|
// distrilbutionBillStockService.listPackageSelf(stockupDTO.getReservationId());
|
|
|
|
|
//
|
|
|
|
|
// List<DistributionParcelListEntity> distributionParcelListEntities = distributionParcelListMapper.selectList(Wrappers.<DistributionParcelListEntity>query().lambda()
|
|
|
|
|
// .eq(DistributionParcelListEntity::getStockArticleId, i.getStockArticleId())
|
|
|
|
|
// );
|
|
|
|
|
// int size = distributionParcelListEntities.size();
|
|
|
|
|
// nu.set(nu.get() + size);
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
//以备数量
|
|
|
|
|
List<DistributionStockEntity> list = distributionStockService.selectList(Wrappers.<DistributionStockEntity>query().lambda() |
|
|
|
|
.eq(DistributionStockEntity::getBillLadingId, stockupDTO.getReservationId()) |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
int sum1 = list.stream().mapToInt(DistributionStockEntity::getStockQuantity).sum(); // 库存品的备货数量
|
|
|
|
|
//查询库存品数据
|
|
|
|
|
List<DistributionDeliveryDetailsEntity> detailsEntities = distributionDeliveryDetailsMapper.selectList(Wrappers.<DistributionDeliveryDetailsEntity>query().lambda() |
|
|
|
|
.eq(DistributionDeliveryDetailsEntity::getBillLadingId, stockupDTO.getReservationId()) |
|
|
|
|
.apply("inventory_status in (1,2)") |
|
|
|
|
); |
|
|
|
|
int sum = detailsEntities.stream().mapToInt(DistributionDeliveryDetailsEntity::getQuantity).sum(); |
|
|
|
|
int i = (sum + nu.get()) - (list.size() + 1); |
|
|
|
|
int sum = detailsEntities.stream().mapToInt(DistributionDeliveryDetailsEntity::getQuantity).sum(); //库存品数据
|
|
|
|
|
int i = (sum + nu.get()) - (sum1 + 1); |
|
|
|
|
/* detailsEntities.forEach( r -> { |
|
|
|
|
if(r.getConditions().equals("1") && Objects.equals(r.getQuantity(), r.getRealityQuantity())){ |
|
|
|
|
//修改当前备货状态已完成
|
|
|
|
|