diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionAsyncService.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionAsyncService.java index 572dbb768..0f4d6c584 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionAsyncService.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionAsyncService.java @@ -41,4 +41,12 @@ public interface IDistributionAsyncService { Boolean getInventoryOrderSelfPickup(Long id); Boolean getBillStock(Long id); + + /** + * 修改库存品数量 + * @param id + * @param num + * @return + */ + Boolean getInventoryNumUpdate(Long id,Integer num,Integer type); } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAsyncServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAsyncServiceImpl.java index 1b6c20352..e64db9bd8 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAsyncServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAsyncServiceImpl.java @@ -7,20 +7,18 @@ import com.logpm.distribution.dto.app.DistrilbutionloadingscanDTO; import com.logpm.distribution.entity.*; import com.logpm.distribution.mapper.DistributionLoadscanMapper; import com.logpm.distribution.mapper.DistributionParcelListMapper; +import com.logpm.distribution.mapper.DistributionStockListMapper; import com.logpm.distribution.mapper.DistributionStockMapper; import com.logpm.distribution.service.*; -import com.logpm.distribution.vo.DistributionStockupVO; import com.logpm.distribution.vo.DistrilbutionBillStockVO; import lombok.AllArgsConstructor; import lombok.extern.log4j.Log4j2; -import org.apache.poi.ss.formula.functions.T; import org.springblade.common.serviceConstant.ServiceConstant; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Isolation; import org.springframework.transaction.annotation.Transactional; -import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; @@ -33,6 +31,7 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService { private final DistributionLoadscanMapper distributionLoadscanMapper; private final IDistributionStockArticleService distributionStockArticleService; private final DistributionStockMapper distributionStockService; + private final DistributionStockListMapper distributionStockListMapper; private final IDistrilbutionBillStockService distrilbutionBillStockService; private final IDistributionDeliveryDetailsService distributionDeliveryDetailsService; @@ -125,4 +124,26 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService { return distrilbutionBillStockService.updateById(distrilbutionBillStock); } + @Async + @Override + public Boolean getInventoryNumUpdate(Long id, Integer num, Integer type) { + //查询 + DistributionStockListEntity distributionStockListEntity1 = distributionStockListMapper.selectById(id); + DistributionStockListEntity distributionStockListEntity = new DistributionStockListEntity(); + switch (type){ + case 1: + //加 + distributionStockListEntity.setQuantityOccupied(distributionStockListEntity1.getQuantityOccupied() + num); + break; + case 2: + //减 + distributionStockListEntity.setQuantityOccupied(distributionStockListEntity1.getQuantityOccupied() - num); + break; + } + //修改库存品占用数量 + distributionStockListEntity.setId(id); + distributionStockListMapper.updateById(distributionStockListEntity); + return true; + } + } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistrilbutionBillLadingServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistrilbutionBillLadingServiceImpl.java index a916e73e2..cd47aa5e2 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistrilbutionBillLadingServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistrilbutionBillLadingServiceImpl.java @@ -162,6 +162,18 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl quantity){ + num = inventoryQuantity - quantity; //多 + //修改库存占用数量 + distributionAsyncService.getInventoryNumUpdate(i.getStockListId(),num,1); + }else if(inventoryQuantity < quantity){ + num = quantity - inventoryQuantity; //少 + //修改库存占用数量 + distributionAsyncService.getInventoryNumUpdate(i.getStockListId(),num,2); + } iterator.remove(); } @@ -169,6 +181,8 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl