示例#1
0
        /// <summary>
        /// 设置商品库存(可用 、Online)
        /// </summary>
        /// <param name="soList"></param>
        protected void SetInventoryQuantity(SOInfo soInfo)
        {
            List <Int32> productSysNoList = new List <int>();

            foreach (var item in soInfo.Items)
            {
                productSysNoList.Add(item.ProductSysNo.Value);
            }
            List <ProductInventoryInfo> pInventoryInfoList = ExternalDomainBroker.GetProductTotalInventoryInfoByProductList(productSysNoList);

            if (pInventoryInfoList != null && pInventoryInfoList.Count > 0)
            {
                foreach (var item in soInfo.Items)
                {
                    //延保重新设置
                    if (item.ProductType == SOProductType.ExtendWarranty)
                    {
                        continue;
                    }

                    foreach (var itemInventory in pInventoryInfoList)
                    {
                        if (item.ProductSysNo == itemInventory.ProductSysNo)
                        {
                            item.AvailableQty = itemInventory.AvailableQty;
                            item.OnlineQty    = (itemInventory.AvailableQty + itemInventory.ConsignQty + itemInventory.VirtualQty);
                            break;
                        }
                    }
                }
            }
        }