Commit 98d5f474 authored by gdlcf88's avatar gdlcf88

Fix CheckInventoriesSufficientAsync

parent 7efe0ae3
......@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using EasyAbp.EShop.Orders.Orders.Dtos;
using EasyAbp.EShop.Products.Products;
using EasyAbp.EShop.Products.Products.Dtos;
using Volo.Abp.DependencyInjection;
......@@ -36,10 +37,11 @@ namespace EasyAbp.EShop.Orders.Orders
{
foreach (var orderLine in input.OrderLines)
{
var inventory = productDict[orderLine.ProductId].ProductSkus
var product = productDict[orderLine.ProductId];
var inventory = product.ProductSkus
.Single(sku => sku.Id == orderLine.ProductSkuId).Inventory;
if (inventory < orderLine.Quantity)
if (product.InventoryStrategy != InventoryStrategy.NoNeed && inventory < orderLine.Quantity)
{
throw new NotPurchasableException(orderLine.ProductId, orderLine.ProductSkuId,
"Insufficient inventory");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment