Exemplo n.º 1
0
        /// <summary>
        /// 查询库存
        /// </summary>
        /// <param name="queryFilter"></param>
        /// <returns></returns>
        public static QueryResult <InventoryQueryInfo> QueryProductInventory(InventoryQueryFilter queryFilter)
        {
            if (queryFilter == null || string.IsNullOrEmpty(queryFilter.ProductSysNo))
            {
                throw new BusinessException("请输入商品编号");
            }
            if (string.IsNullOrEmpty(queryFilter.MerchantSysNo))
            {
                throw new BusinessException("商家编号不能为空");
            }

            queryFilter.CompanyCode = "8601";
            //查询总库存
            if (string.IsNullOrEmpty(queryFilter.StockSysNo))
            {
                return(InventoryDA.QueryProductInventoryTotal(queryFilter));
            }
            else
            {
                QueryResult <InventoryQueryInfo> result      = InventoryDA.QueryProductInventoryByStock(queryFilter);
                QueryResult <InventoryQueryInfo> resultTotal = InventoryDA.QueryProductInventoryTotal(queryFilter);
                if (resultTotal == null)
                {
                    resultTotal            = new QueryResult <InventoryQueryInfo>();
                    resultTotal.ResultList = new List <InventoryQueryInfo>();
                    resultTotal.PageInfo   = new PageInfo();
                }
                if (result != null && result.ResultList != null && result.ResultList.Count > 0)
                {
                    resultTotal.ResultList.AddRange(result.ResultList);
                    resultTotal.PageInfo.TotalCount += result.PageInfo.TotalCount;
                }
                return(resultTotal);
            }
        }