Browse Source

fix(service): 修改包件转库存品数量不准确问题

pull/4/head
zhaoqiaobo 10 months ago
parent
commit
cbc5cb5c01
  1. 10
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionParcelListServiceImpl.java

10
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionParcelListServiceImpl.java

@ -899,12 +899,13 @@ public class DistributionParcelListServiceImpl extends BaseServiceImpl<Distribut
distributionStockListEntity.setServiceType(distributionStockArticleEntity.getTypeService());//冻结数量
DistributionStockListEntity stockListEntity = distributionStockListService.getStockListEntity(distributionStockArticleEntity.getMallId(), distributionParcelListEntities.get(0).getMaterialId(), distributionStockArticleEntity.getOrderCode(), distributionStockArticleEntity.getStoreId(), distributionStockArticleEntity.getWarehouseId());
if (ObjectUtils.isNotNull(stockListEntity)) {
distributionStockListEntity.setId(stockListEntity.getId());
//有记录
DistributionStockListEntity listEntity = new DistributionStockListEntity();
listEntity.setId(stockListEntity.getId());//id
Integer quantity = ObjectUtils.isNull(distributionParcelListEntities.get(0).getQuantity()) ? 0 : distributionParcelListEntities.get(0).getQuantity();
// Integer quantity = ObjectUtils.isNull(distributionParcelListEntities.get(0).getQuantity()) ? 0 : distributionParcelListEntities.get(0).getQuantity();
Integer quantityStock = ObjectUtils.isNull(stockListEntity.getQuantityStock()) ? 0 : stockListEntity.getQuantityStock();
listEntity.setQuantityStock(quantity + quantityStock);
listEntity.setQuantityStock(num + quantityStock);
distributionStockListService.updateById(listEntity);
} else {
log.info("###########distributionStockListEntity>>>>>>>>,{}", distributionStockListEntity);
@ -917,7 +918,7 @@ public class DistributionParcelListServiceImpl extends BaseServiceImpl<Distribut
// distributionStockListEntity.setStockArticleId(Optional.ofNullable(distributionStockArticleEntity.getId()).orElse(null)); //订单ID
// distributionStockListEntity.setOrderCode(Optional.ofNullable(distributionParcelListEntities.get(0).getOrderCode()).orElse(null)); //订单自编号
List<DistributionStockListInfoEntity> infoEntities = new ArrayList<>();
for (DistributionParcelListEntity distributionParcelListEntity : distributionParcelListEntities) {
//添加库存品记录
DistributionStockListInfoEntity distributionStockListInfo = new DistributionStockListInfoEntity();
@ -973,8 +974,9 @@ public class DistributionParcelListServiceImpl extends BaseServiceImpl<Distribut
distributionStockListInfo.setOrderCode(distributionStockArticleEntity.getOrderCode());
distributionStockListInfo.setParcelListId(distributionParcelListEntity.getId());
distributionStockListInfo.setPackageCode(distributionParcelListEntity.getOrderPackageCode());
distributionStockListInfoService.save(distributionStockListInfo);
infoEntities.add(distributionStockListInfo);
}
distributionStockListInfoService.saveBatch(infoEntities);
return distributionStockArticleEntity;
}

Loading…
Cancel
Save