Пример #1
0
        /// <summary>
        /// 获取默认显示的库存信息
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        private async Task <ResponseBase> GetStatisticsStockDefault(GetStatisticsStockRequest request)
        {
            List <DbStatisticsStockView> statisticsStockView = null;
            var limitShops = string.Empty;
            var arealevel  = string.Empty;

            switch (_appTicket.DataLimitType)
            {
            case (int)DataLimitTypeEnum.All:
                var province = await _areaBll.GetProvince();

                statisticsStockView = await _reportBll.GetStatisticsStock(string.Join(',', province.Select(p => p.AreaId)), AreaLevelEnum.Province);

                arealevel = AreaLevelEnum.Province;
                break;

            case (int)DataLimitTypeEnum.Area:
                if (!string.IsNullOrEmpty(_appTicket.DataLimitArea))
                {
                    var areaInfo = await ComLib.GetGetAreaStatisticsAreaId(_areaBll, _appTicket.DataLimitArea);

                    statisticsStockView = await _reportBll.GetStatisticsStock(areaInfo.Item1, areaInfo.Item2);

                    arealevel = areaInfo.Item2;
                }
                break;

            case (int)DataLimitTypeEnum.Shop:
                limitShops = _appTicket.DataLimitShop;
                if (!string.IsNullOrEmpty(_appTicket.DataLimitShop))
                {
                    statisticsStockView = await _reportBll.GetStatisticsStockByShop(_appTicket.DataLimitShop);

                    arealevel = AreaLevelEnum.Street;
                }
                break;
            }
            var result = await GetStatisticsStockView(statisticsStockView, request.Type, limitShops, arealevel);

            return(ResponseBase.Success(result));
        }