コード例 #1
0
        /// <summary>
        /// 获取默认显示的库存信息
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        private async Task <ResponsePagingBase> GetStatisticsStockShopDefault(GetStatisticsStockShopPageRequest request)
        {
            Tuple <IEnumerable <DbStatisticsStockViewShop>, int> statisticsStockShopView = null;

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

                statisticsStockShopView = await _reportBll.GetStatisticsStockShop(request, string.Join(',', province.Select(p => p.AreaId)), AreaLevelEnum.Province);

                break;

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

                    statisticsStockShopView = await _reportBll.GetStatisticsStockShop(request, areaInfo.Item1, areaInfo.Item2);
                }
                break;

            case (int)DataLimitTypeEnum.Shop:
                if (!string.IsNullOrEmpty(_appTicket.DataLimitShop))
                {
                    statisticsStockShopView = await _reportBll.GetStatisticsStockShopByShop(request, _appTicket.DataLimitShop);
                }
                break;
            }
            var result = await GetStatisticsStockShopView(statisticsStockShopView, request.Type);

            var recordCount = statisticsStockShopView == null ? 0 : statisticsStockShopView.Item2;

            return(ResponsePagingBase.Success(result, recordCount));
        }
コード例 #2
0
        /// <summary>
        /// 分页获取商品信息
        /// </summary>
        /// <param name="httpContext"></param>
        /// <param name="request"></param>
        /// <returns></returns>
        public async Task <ResponsePagingBase> ProcessAction(HttpContext httpContext, GetPurchaseBackPagingRequest request)
        {
            if (!HandleRequest(httpContext, request))
            {
                return(ResponsePagingBase.Success(new List <OpBackReceiptDetail>(), 0));
            }
            var result = await _openDataBll.GetBackReceiptDetail(request);

            if (result == null || result.Item2 == 0)
            {
                return(ResponsePagingBase.Success(new List <OpBackReceiptDetail>(), 0));
            }
            var inReceipt        = result.Item1.ToList();
            var goodsCategoryIds = new List <long>();
            var areaIds          = new List <long>();
            var unitIds          = new List <long>();
            var brandIds         = new List <long>();
            var supplierIds      = new List <long>();

            foreach (var g in inReceipt)
            {
                areaIds.Add(g.Province);
                areaIds.Add(g.City);
                areaIds.Add(g.District);
                areaIds.Add(g.Street);
                unitIds.Add(g.UnitId);
                goodsCategoryIds.Add(g.GoodsCategoryId);
                brandIds.Add(g.BrandId);
                supplierIds.Add(g.BackOfferId);
            }
            var areas = await _areaBll.GetArea(areaIds.Distinct().ToList());

            var goodsCategorys = await _goodsBll.GetGoodsCategory(goodsCategoryIds.Distinct().ToList());

            var units = await _goodsBll.GetUnits(unitIds.Distinct().ToList());

            var brands = await _goodsBll.GetGoodsBrands(brandIds.Distinct().ToList());

            var suppliers = await _baseSupplierBll.GetBaseSupplier(supplierIds.Distinct().ToList());

            var opReceiptDetail = inReceipt.Select(p => new OpBackReceiptDetail()
            {
                Province          = ComLib.GetAreaName(p.Province, areas),
                City              = ComLib.GetAreaName(p.City, areas),
                District          = ComLib.GetAreaName(p.District, areas),
                Street            = ComLib.GetAreaName(p.Street, areas),
                GoodsCategoryName = ComLib.GetCategoryName(p.GoodsCategoryId, goodsCategorys),
                GoodsName         = p.GoodsName,
                GoodsSpec         = p.GoodsSpec,
                ShopName          = p.ShopName,
                GoodsBrand        = ComLib.GetBrand(p.BrandId, brands),
                BackCode          = p.BackCode,
                BackDate          = p.BackDate.ToDateTimeFromTimeStamp(),
                Qty          = p.Qty,
                SupplierName = ComLib.GetSupplierName(p.BackOfferId, suppliers),
                UnitName     = ComLib.GetUnitNmae(p.UnitId, units)
            });

            return(ResponsePagingBase.Success(opReceiptDetail, result.Item2));
        }
コード例 #3
0
        /// <summary>
        /// 分页获取商品销售记录信息
        /// </summary>
        /// <param name="httpContext"></param>
        /// <param name="request"></param>
        /// <returns></returns>
        public async Task <ResponsePagingBase> ProcessAction(HttpContext httpContext, GetSaleGoodsLogPageRequest request)
        {
            if (!HandleRequest(httpContext, request))
            {
                return(ResponsePagingBase.Success(new List <SaleGoodsLogView>(), 0));
            }
            var result = await _goodsBll.GetSaleGoodsLogPage(request);

            result.Item1.ToList().ForEach(p => p.CreateTime = p.BillDate.ToDateTimeFromTimeStamp());
            return(ResponsePagingBase.Success(result.Item1, result.Item2));
        }
コード例 #4
0
        /// <summary>
        /// 分页获取销售商品信息
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public async Task <ResponsePagingBase> ProcessAction(GetSaleGoodsPageRequest request)
        {
            var shop = await _shopBll.GetShop(request.ShopId);

            if (shop == null)
            {
                return(new ResponsePagingBase().GetResponseError(StatusCode.Shop50001, "门店不存在"));
            }
            request.OrgId   = shop.OrgId;
            request.StockId = shop.StockId;
            var result = await _goodsBll.GetSaleGoodsPage(request);

            return(ResponsePagingBase.Success(await HandleQty(result.Item1.ToList(), shop.StockId), result.Item2));
        }
コード例 #5
0
ファイル: GetUserPageAction.cs プロジェクト: chenjian8541/gmp
        /// <summary>
        /// 通过ID获取用户信息
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public async Task <ResponsePagingBase> ProcessAction(GetUserPageRequest request)
        {
            var users = await _sysUserBll.GetUserPage(request);

            var userViews = users.Item1.Select(p => new UserPageView()
            {
                UserId        = p.UserId,
                Account       = p.Account,
                LastLoginTime = p.LastLoginTime,
                NickName      = p.NickName,
                StatusFlag    = p.StatusFlag,
                UserRoleId    = p.UserRoleId,
                RoleName      = _sysUserRoleBll.GetSysUserRole(p.UserRoleId).Result?.Name
            });

            return(ResponsePagingBase.Success(userViews, users.Item2));
        }
コード例 #6
0
        /// <summary>
        /// 获取选择的地区下一级数据
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        private async Task <ResponsePagingBase> GetStatisticsRetailShopLevel(GetStatisticsRetailShopPageRequest request)
        {
            if (_appTicket.DataLimitType == (int)DataLimitTypeEnum.Area && _appTicket.DataLimitArea.IndexOf(request.AreaId.ToString()) < 0)
            {
                return(new ResponsePagingBase().GetResponseError(StatusCode.DataForbidden, "数据无权访问"));
            }
            var         statisticsTime = ComLib.GetAreaStatisticsTime(request.StartTime, request.EndTime);
            var         newLevel       = string.Empty;
            List <Area> areas          = null;

            switch (request.Level)
            {
            case AreaLevelEnum.Province:
                //获取市
                newLevel = AreaLevelEnum.City;
                areas    = await _areaBll.GetCity(request.AreaId);

                break;

            case AreaLevelEnum.City:
                //获取县、区
                newLevel = AreaLevelEnum.District;
                areas    = await _areaBll.GetDistrict(request.AreaId);

                break;

            case AreaLevelEnum.District:
                //获取乡镇
                newLevel = AreaLevelEnum.Street;
                areas    = await _areaBll.GetStreet(request.AreaId);

                break;
            }
            if (areas == null || !areas.Any())
            {
                return(ResponsePagingBase.Success(GetEmptyData(statisticsTime.Item1, statisticsTime.Item2), 0));
            }
            var statisticsRetailShop = await _reportBll.GetStatisticsRetailShop(request, string.Join(',', areas.Select(p => p.AreaId)),
                                                                                statisticsTime.Item1, statisticsTime.Item2, newLevel);

            var result = await GetStatisticsRetailViewShop(statisticsTime.Item1, statisticsTime.Item2, statisticsRetailShop, request.Type, newLevel);

            var recordCount = statisticsRetailShop == null ? 0 : statisticsRetailShop.Item2;

            return(ResponsePagingBase.Success(result, recordCount));
        }
コード例 #7
0
        /// <summary>
        /// 获取默认数据
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        private async Task <ResponsePagingBase> GetStatisticsRetailShopDefault(GetStatisticsRetailShopPageRequest request)
        {
            Tuple <IEnumerable <DbStatisticsRetailViewShop>, int> statisticsRetailShop = null;
            var statisticsTime = ComLib.GetAreaStatisticsTime(request.StartTime, request.EndTime);
            var arealevel      = string.Empty;

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

                statisticsRetailShop = await _reportBll.GetStatisticsRetailShop(request, string.Join(',', province.Select(p => p.AreaId)),
                                                                                statisticsTime.Item1, statisticsTime.Item2, AreaLevelEnum.Province);

                arealevel = AreaLevelEnum.Province;
                break;

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

                    statisticsRetailShop = await _reportBll.GetStatisticsRetailShop(request, areaInfo.Item1, statisticsTime.Item1,
                                                                                    statisticsTime.Item2, areaInfo.Item2);

                    arealevel = areaInfo.Item2;
                }
                break;

            case (int)DataLimitTypeEnum.Shop:
                if (!string.IsNullOrEmpty(_appTicket.DataLimitShop))
                {
                    statisticsRetailShop = await _reportBll.GetStatisticsRetailShopByShop(request, _appTicket.DataLimitShop,
                                                                                          statisticsTime.Item1, statisticsTime.Item2);

                    arealevel = AreaLevelEnum.Street;
                }
                break;
            }
            var result = await GetStatisticsRetailViewShop(statisticsTime.Item1, statisticsTime.Item2, statisticsRetailShop, request.Type, arealevel);

            var recordCount = statisticsRetailShop == null ? 0 : statisticsRetailShop.Item2;

            return(ResponsePagingBase.Success(result, recordCount));
        }
コード例 #8
0
        /// <summary>
        /// 通过地区获取店面信息
        /// </summary>
        /// <param name="httpContext"></param>
        /// <param name="request"></param>
        /// <returns></returns>
        public async Task <ResponsePagingBase> ProcessAction(HttpContext httpContext, GetShopPagingReqest request)
        {
            var shopRequest = new GetShopPageRequest()
            {
                LoginUserId = request.LoginUserId,
                PageCurrent = request.PageCurrent,
                PageSize    = request.PageSize,
            };

            if (!ComLib.HandleRequest(httpContext, shopRequest))
            {
                return(ResponsePagingBase.Success(new List <OpShopView>(), 0));
            }
            var shops = await _shopBll.GetShopPage(shopRequest);

            if (shops == null || shops.Item2 == 0)
            {
                return(ResponsePagingBase.Success(new List <OpShopView>(), 0));
            }
            var areaIds = new List <long>();

            foreach (var g in shops.Item1)
            {
                areaIds.Add(g.Province.Value);
                areaIds.Add(g.City.Value);
                areaIds.Add(g.District.Value);
                areaIds.Add(g.Street.Value);
            }
            var areas = await _areaBll.GetArea(areaIds.Distinct().ToList());

            return(ResponsePagingBase.Success(shops.Item1.Select(p => new OpShopView()
            {
                ShopName = p.ShopName,
                ShopTelphone = p.ShopTelphone,
                ShopAddress = p.ShopAddress,
                ShopLinkMan = p.ShopLinkMan,
                Province = GetAreaName(p.Province.Value, areas),
                City = GetAreaName(p.City.Value, areas),
                District = GetAreaName(p.District.Value, areas),
                Stree = GetAreaName(p.Street.Value, areas)
            }), shops.Item2));
        }
コード例 #9
0
        /// <summary>
        /// 通过地区获取店面信息
        /// </summary>
        /// <param name="httpContext"></param>
        /// <param name="request"></param>
        /// <returns></returns>
        public async Task <ResponsePagingBase> ProcessAction(HttpContext httpContext, GetShopPageRequest request)
        {
            if (request.SceneType != (int)GetShopPageSceneTypeEnum.DataLimitSetting && !ComLib.HandleRequest(httpContext, request))
            {
                return(ResponsePagingBase.Success(new List <GetShopPageView>(), 0));
            }
            var shops = await _shopBll.GetShopPage(request);

            var leaderNames = GetLeaderNames(shops.Item1.ToList(), request.SceneType);

            return(ResponsePagingBase.Success(shops.Item1.Select(p => new GetShopPageView()
            {
                ShopId = p.ShopId,
                ShopName = p.ShopName,
                ShopTelphone = p.ShopTelphone,
                ProvinceName = GetAreaName(p.Province),
                CityName = GetAreaName(p.City),
                DistrictName = GetAreaName(p.District),
                LicenseNum = string.Empty,
                ShopAddress = p.ShopAddress,
                LeaderName = GetLeaderName(p.OrgId, request.SceneType, leaderNames)
            }), shops.Item2));
        }
コード例 #10
0
        /// <summary>
        /// 分页获取商品信息
        /// </summary>
        /// <param name="httpContext"></param>
        /// <param name="request"></param>
        /// <returns></returns>
        public async Task <ResponsePagingBase> ProcessAction(HttpContext httpContext, GetGoodsPagingRequest request)
        {
            if (!HandleRequest(httpContext, request))
            {
                return(ResponsePagingBase.Success(new List <OpGoodsView>(), 0));
            }
            var result = await _openDataBll.GetGoodsPaging(request);

            if (result == null || result.Item2 == 0)
            {
                return(ResponsePagingBase.Success(new List <OpGoodsView>(), 0));
            }
            var goods            = result.Item1.ToList();
            var goodsIds         = new List <long>();
            var goodsCategoryIds = new List <long>();
            var stockIds         = new List <long>();
            var areaIds          = new List <long>();
            var unitIds          = new List <long>();
            var brandIds         = new List <long>();

            foreach (var g in goods)
            {
                goodsIds.Add(g.GoodsId);
                stockIds.Add(g.StockId);
                areaIds.Add(g.Province);
                areaIds.Add(g.City);
                areaIds.Add(g.District);
                areaIds.Add(g.Street);
                unitIds.Add(g.BaseUnitId);
                goodsCategoryIds.Add(g.GoodsCategoryId);
                brandIds.Add(g.BrandId);
            }
            var areas = await _areaBll.GetArea(areaIds.Distinct().ToList());

            var goodsCategorys = await _goodsBll.GetGoodsCategory(goodsCategoryIds.Distinct().ToList());

            var units = await _goodsBll.GetUnits(unitIds.Distinct().ToList());

            var stockQtys = await _goodsBll.GetStStockQtyView(goodsIds, stockIds);

            var brands = await _goodsBll.GetGoodsBrands(brandIds.Distinct().ToList());

            var opGoodsView = goods.Select(p => new OpGoodsView()
            {
                Province           = ComLib.GetAreaName(p.Province, areas),
                City               = ComLib.GetAreaName(p.City, areas),
                District           = ComLib.GetAreaName(p.District, areas),
                Street             = ComLib.GetAreaName(p.Street, areas),
                Comment            = p.Comment,
                Contents           = p.Contents,
                DosageForms        = p.DosageForms,
                GoodsCategoryName  = ComLib.GetCategoryName(p.GoodsCategoryId, goodsCategorys),
                GoodsCode          = p.GoodsCode,
                GoodsIngredient    = p.GoodsIngredient,
                GoodsName          = p.GoodsName,
                GoodsOrigin        = p.GoodsOrigin,
                GoodsProduct       = p.GoodsProduct,
                GoodsRestrictive   = p.GoodsRestrictive,
                GoodsShortName     = p.GoodsShortName,
                GoodsSpec          = p.GoodsSpec,
                RegistrationHolder = p.RegistrationHolder,
                RegistrationNumber = p.RegistrationNumber,
                ShopName           = p.ShopName,
                RepertoryUnit      = ComLib.GetUnitNmae(p.BaseUnitId, units),
                RepertoryQty       = ComLib.GetRepertoryQty(p.GoodsId, p.StockId, stockQtys),
                GoodsBrand         = ComLib.GetBrand(p.BrandId, brands)
            });

            return(ResponsePagingBase.Success(opGoodsView, result.Item2));
        }
コード例 #11
0
        /// <summary>
        /// 分页获取商品信息
        /// </summary>
        /// <param name="httpContext"></param>
        /// <param name="request"></param>
        /// <returns></returns>
        public async Task <ResponsePagingBase> ProcessAction(HttpContext httpContext, GetSaleGoodsBackPagingRequest request)
        {
            if (!HandleRequest(httpContext, request))
            {
                return(ResponsePagingBase.Success(new List <OpRetailDetail>(), 0));
            }
            var result = await _openDataBll.GetRetailBackDetail(request);

            if (result == null || result.Item2 == 0)
            {
                return(ResponsePagingBase.Success(new List <OpRetailDetail>(), 0));
            }
            var retailBack       = result.Item1.ToList();
            var goodsCategoryIds = new List <long>();
            var areaIds          = new List <long>();
            var unitIds          = new List <long>();
            var brandIds         = new List <long>();
            var retailId         = new List <long>();

            foreach (var g in retailBack)
            {
                areaIds.Add(g.Province);
                areaIds.Add(g.City);
                areaIds.Add(g.District);
                areaIds.Add(g.Street);
                unitIds.Add(g.UnitId);
                goodsCategoryIds.Add(g.GoodsCategoryId);
                brandIds.Add(g.BrandId);
                retailId.Add(g.RetailBackId);
            }
            var areas = await _areaBll.GetArea(areaIds.Distinct().ToList());

            var goodsCategorys = await _goodsBll.GetGoodsCategory(goodsCategoryIds.Distinct().ToList());

            var units = await _goodsBll.GetUnits(unitIds.Distinct().ToList());

            var brands = await _goodsBll.GetGoodsBrands(brandIds.Distinct().ToList());

            var customers = await _retailCustomerBll.GetRetailCustomer(retailId.Distinct().ToList());

            var opRetailDetail = retailBack.Select(p =>
            {
                var customer = customers.FirstOrDefault(g => g.RetailId == p.RetailBackId);
                return(new OpRetailBackDetail()
                {
                    Province = ComLib.GetAreaName(p.Province, areas),
                    City = ComLib.GetAreaName(p.City, areas),
                    District = ComLib.GetAreaName(p.District, areas),
                    Street = ComLib.GetAreaName(p.Street, areas),
                    GoodsCategoryName = ComLib.GetCategoryName(p.GoodsCategoryId, goodsCategorys),
                    GoodsName = p.GoodsName,
                    GoodsSpec = p.GoodsSpec,
                    ShopName = p.ShopName,
                    GoodsBrand = ComLib.GetBrand(p.BrandId, brands),
                    BackBillCode = p.BillCode,
                    BackBillDate = p.BillDate.ToDateTimeFromTimeStamp(),
                    Qty = p.Qty,
                    UnitName = ComLib.GetUnitNmae(p.UnitId, units),
                    ReturnerIdentification = customer?.Identification,
                    ReturnerName = customer?.RetailCustomerName,
                    ReturnerTel = customer?.RetailCustomerTel
                });
            });

            return(ResponsePagingBase.Success(opRetailDetail, result.Item2));
        }