Пример #1
0
        /// <summary>
        /// 获取所有可用活动的赠送商品
        /// </summary>
        /// <returns></returns>
        public async Task <IList <CampaignBuyGiveProductModel> > GetAllCampaigns(string name, int terminalId = 0, int channelId = 0, int wareHouseId = 0, int pagenumber = 0, int pageSize = 50, bool force = false, CancellationToken calToken = default)
        {
            try
            {
                int storeId = Settings.StoreId;
                int userId  = Settings.UserId;

                var api = RefitServiceBuilder.Build <ICampaignApi>(URL);

                var results = await _makeRequest.Start(api.GetAllCampaigns(storeId,
                                                                           name,        //360
                                                                           terminalId,  //185528
                                                                           channelId,
                                                                           wareHouseId, //259
                                                                           pagenumber,
                                                                           pageSize,
                                                                           calToken));

                if (results != null && results?.Code >= 0)
                {
                    return(results?.Data.ToList());
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                e.HandleException();
                return(null);
            }
        }
Пример #2
0
        /// <summary>
        /// 获取品牌
        /// </summary>
        /// <param name="args"></param>
        /// <returns></returns>
        public async Task <IList <BrandModel> > GetBrandsAsync(string name = "", int pagenumber = 0, int pageSize = 50, bool force = false, CancellationToken calToken = default)
        {
            try
            {
                int storeId = Settings.StoreId;
                int userId  = Settings.UserId;
                var api     = RefitServiceBuilder.Build <IProductApi>(URL);

                var cacheKey = RefitServiceBuilder.Cacher("GetBrandsAsync", storeId, name, pagenumber, pageSize);
                var results  = await _makeRequest.StartUseCache(api.GetBrandsAsync(storeId, name, pagenumber, pageSize, calToken), cacheKey, force, calToken);

                if (results != null && results?.Code >= 0)
                {
                    return(results?.Data.ToList());
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                e.HandleException();
                return(null);
            }
        }
Пример #3
0
        /// <summary>
        /// 获取调拨商品
        /// </summary>
        /// <param name="type"></param>
        /// <param name="categoryIds"></param>
        /// <param name="wareHouseId"></param>
        /// <param name="cts"></param>
        /// <returns></returns>
        public async Task <IList <ProductModel> > GetAllocationProductsAsync(int?type, int[] categoryIds, int wareHouseId = 0, bool force = false, CancellationToken calToken = default)
        {
            try
            {
                int storeId = Settings.StoreId;
                int userId  = Settings.UserId;
                var api     = RefitServiceBuilder.Build <IProductApi>(URL);

                var cacheKey = RefitServiceBuilder.Cacher("GetAllocationProductsAsync", storeId, type, categoryIds, wareHouseId);
                var results  = await _makeRequest.StartUseCache(api.GetAllocationProductsAsync(storeId, type, categoryIds, wareHouseId, calToken), cacheKey, force, calToken);

                if (results != null && results?.Code >= 0)
                {
                    return(results?.Data.ToList());
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                e.HandleException();
                return(null);
            }
        }
Пример #4
0
        /// <summary>
        /// 获取公司配置
        /// </summary>
        /// <returns></returns>
        public void GetCompanySettingAsync(CancellationToken calToken = default)
        {
            var model = new CompanySettingModel();

            try
            {
                int storeId = Settings.StoreId;
                int userId  = Settings.UserId;

                var api      = RefitServiceBuilder.Build <ISettingApi>(URL);
                var cacheKey = RefitServiceBuilder.Cacher("GetCompanySettingAsync", storeId, userId);
                _makeRequest.StartUseCache_Rx(api.GetCompanySettingAsync(storeId, calToken), cacheKey, calToken)?.Subscribe((results) =>
                {
                    if (results != null && results?.Code >= 0)
                    {
                        model = results?.Data;
                        if (model != null)
                        {
                            Settings.CompanySetting = JsonConvert.SerializeObject(model);
                            if (string.IsNullOrEmpty(Settings.DefaultPricePlan) || Settings.DefaultPricePlan == "0_0")
                            {
                                Settings.DefaultPricePlan = model.DefaultPricePlan;
                            }
                        }
                    }
                });
            }
            catch (Exception e)
            {
                e.HandleException();
            }
        }
Пример #5
0
        public async Task <IList <PurchaseItemModel> > AsyncPurchaseItemByProductIdForAsync(int?productId, bool?beforeTax, bool force = false, CancellationToken calToken = default)
        {
            try
            {
                int storeId = Settings.StoreId;
                int userId  = Settings.UserId;

                var api = RefitServiceBuilder.Build <IPurchaseBillApi>(URL);

                var cacheKey = RefitServiceBuilder.Cacher("AsyncPurchaseItemByProductIdForAsync", storeId, productId, beforeTax);
                var results  = await _makeRequest.StartUseCache(api.AsyncPurchaseItemByProductIdForAsync(storeId, productId, beforeTax, calToken), cacheKey, force, calToken);

                if (results != null && results.Code >= 0)
                {
                    return(results?.Data.ToList());
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                e.HandleException();
                return(null);
            }
        }
Пример #6
0
        public async Task <IList <SaleReportItem> > GetHotSaleReportItemAsync(int?productId = null, int?businessUserId = null, DateTime?startTime = null, DateTime?endTime = null, bool force = false, int pagenumber = 0, CancellationToken calToken = default)
        {
            try
            {
                int storeId = Settings.StoreId;
                int userId  = Settings.UserId;

                var api = RefitServiceBuilder.Build <IReportingApi>(URL);

                var results = await api.GetHotSaleReportItemAsync(storeId,
                                                                  productId : productId,
                                                                  businessUserId : businessUserId,
                                                                  startTime : startTime,
                                                                  endTime : endTime,
                                                                  pagenumber : pagenumber,
                                                                  calToken : calToken);

                if (results != null && results?.Code >= 0)
                {
                    return(results?.Data);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                e.HandleException();
                return(null);
            }
        }
Пример #7
0
        /// <summary>
        /// 获取客户排行榜
        /// </summary>
        /// <param name="args"></param>
        /// <returns></returns>
        public async Task <IList <CustomerRanking> > GetCustomerRankingAsync(int?terminalId = null, int?districtId = null, int?businessUserId = null, DateTime?startTime = null, DateTime?endTime = null, bool force = false, CancellationToken calToken = default)
        {
            try
            {
                int storeId = Settings.StoreId;
                int userId  = Settings.UserId;

                var api = RefitServiceBuilder.Build <IReportingApi>(URL);

                var cacheKey = RefitServiceBuilder.Cacher("GetCustomerRankingAsync", storeId, terminalId, districtId, businessUserId, startTime, endTime);
                var results  = await _makeRequest.StartUseCache(api.GetCustomerRankingAsync(storeId, terminalId, districtId, businessUserId, startTime, endTime, calToken), cacheKey, force, calToken);

                if (results != null && results?.Code >= 0)
                {
                    return(results?.Data);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                e.HandleException();
                return(null);
            }
        }
Пример #8
0
        /// <summary>
        /// 获取业务员轨迹跟踪
        /// </summary>
        /// <param name="args"></param>
        /// <returns></returns>
        public async Task <IList <TrackingModel> > GetUserTrackingAsync(int?businessUserId = 0, DateTime?start = null, DateTime?end = null, bool force = false, CancellationToken calToken = default)
        {
            try
            {
                int storeId = Settings.StoreId;
                int userId  = Settings.UserId;
                var api     = RefitServiceBuilder.Build <ITerminalApi>(URL);

                var cacheKey = RefitServiceBuilder.Cacher("GetUserTrackingAsync", storeId, businessUserId, start, end);
                var results  = await _makeRequest.StartUseCache(api.GetUserTrackingAsync(storeId, businessUserId, start, end, calToken), cacheKey, force, calToken);

                if (results != null && results?.Code >= 0)
                {
                    return(results?.Data.ToList());
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                e.HandleException();
                return(null);
            }
        }
Пример #9
0
        /// <summary>
        /// 获取经销商账户余额
        /// </summary>
        /// <param name="terminalId"></param>
        /// <returns></returns>
        public async Task <TerminalBalance> GetTerminalBalance(int terminalId = 0, CancellationToken calToken = default)
        {
            try
            {
                int storeId = Settings.StoreId;
                int userId  = Settings.UserId;
                var api     = RefitServiceBuilder.Build <ITerminalApi>(URL);
                var results = await _makeRequest.Start(api.GetTerminalBalance(storeId, terminalId, calToken), calToken);

                if (results == null)
                {
                    return(new TerminalBalance());
                }

                if (results?.Data != null && results?.Code >= 0)
                {
                    return(results?.Data);
                }
                else
                {
                    return(new TerminalBalance());
                }
            }
            catch (Exception e)
            {
                e.HandleException();
                return(new TerminalBalance());
            }
        }
Пример #10
0
        /// <summary>
        /// 拜访签退
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public async Task <APIResult <VisitStore> > SignOutVisitStoreAsync(VisitStore data, CancellationToken calToken = default)
        {
            try
            {
                int storeId = Settings.StoreId;
                int userId  = Settings.UserId;
                var api     = RefitServiceBuilder.Build <ITerminalApi>(URL);

                var results = await _makeRequest.Start(api.SignOutVisitStoreAsync(data, storeId, userId, calToken), calToken);

                if (results == null)
                {
                    return(null);
                }

                if (results?.Data != null && results?.Code >= 0)
                {
                    return(results);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                e.HandleException();
                return(null);
            }
        }
Пример #11
0
        /// <summary>
        /// 获取用户拜访记录
        /// </summary>
        /// <param name="args"></param>
        /// <returns></returns>
        public async Task <IList <BusinessVisitList> > GetAllUserVisitedListAsync(DateTime?date, bool force = false, CancellationToken calToken = default)
        {
            try
            {
                int storeId  = Settings.StoreId;
                int userId   = Settings.UserId;
                var api      = RefitServiceBuilder.Build <ITerminalApi>(URL);
                var cacheKey = RefitServiceBuilder.Cacher("GetAllUserVisitedListAsync", storeId, date, userId);
                var results  = await _makeRequest.StartUseCache(api.GetAllUserVisitedListAsync(storeId, date, calToken), cacheKey, force, calToken);

                if (results != null && results?.Code >= 0)
                {
                    return(results?.Data.ToList());
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                e.HandleException();
                return(null);
            }
        }
Пример #12
0
        public async Task <TerminalModel> GetTerminalAsync(int?terminalId, bool force = false, CancellationToken calToken = default)
        {
            try
            {
                int storeId  = Settings.StoreId;
                var api      = RefitServiceBuilder.Build <ITerminalApi>(URL);
                var cacheKey = RefitServiceBuilder.Cacher("GetTerminalAsync", storeId, terminalId);
                var results  = await _makeRequest.StartUseCache(api.GetTerminalAsync(storeId, terminalId, calToken), cacheKey, force, calToken);

                if (results == null)
                {
                    return(new TerminalModel());
                }

                if (results?.Data != null && results?.Code >= 0)
                {
                    return(results?.Data);
                }
                else
                {
                    return(new TerminalModel());
                }
            }
            catch (Exception e)
            {
                e.HandleException();
                return(new TerminalModel());
            }
        }
Пример #13
0
        /// <summary>
        /// 获取库存上报表
        /// </summary>
        /// <param name="forceRefresh"></param>
        /// <param name="makeuserId"></param>
        /// <param name="businessUserId"></param>
        /// <param name="terminalId"></param>
        /// <param name="channelId"></param>
        /// <param name="rankId"></param>
        /// <param name="districtId"></param>
        /// <param name="productId"></param>
        /// <param name="startTime"></param>
        /// <param name="endTime"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        public async Task <IList <InventoryReportSummaryModel> > GetInventoryReportAsync(int?makeuserId, int?businessUserId, int?terminalId, int?channelId, int?rankId, int?districtId, int?productId, DateTime?startTime = null, DateTime?endTime = null, int pageIndex = 0, int pageSize = 20, bool force = false, CancellationToken calToken = default)
        {
            try
            {
                int storeId = Settings.StoreId;
                int userId  = Settings.UserId;

                var api = RefitServiceBuilder.Build <IWareHousesApi>(URL);

                var cacheKey = RefitServiceBuilder.Cacher("GetInventoryReportAsync", storeId, makeuserId, businessUserId, terminalId, channelId, rankId, districtId, productId, startTime, endTime, pageIndex, pageSize);
                var results  = await _makeRequest.StartUseCache(api.GetInventoryReportAsync(storeId, makeuserId, businessUserId, terminalId, channelId, rankId, districtId, productId, startTime, endTime, pageIndex, pageSize, calToken), cacheKey, force, calToken);

                if (results != null && results?.Code >= 0)
                {
                    return(results?.Data?.ToList());
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                e.HandleException();
                return(null);
            }
        }
Пример #14
0
        /// <summary>
        /// 获取经销商业务员
        /// </summary>
        /// <returns></returns>
        public async Task <IList <BusinessUserModel> > GetBusinessUsersAsync(int[] ids, string roleName, bool force = false, CancellationToken calToken = default)
        {
            try
            {
                int storeId = Settings.StoreId;
                int userId  = Settings.UserId;
                var api     = RefitServiceBuilder.Build <IUserApi>(URL);

                var cacheKey = RefitServiceBuilder.Cacher("GetBusinessUsersAsync", storeId, ids, roleName);

                var results = await _makeRequest.StartUseCache(api.GetBusinessUsersAsync(storeId, ids, roleName, calToken), cacheKey, true, calToken);

                if (results == null)
                {
                    return(null);
                }

                if (results != null && results?.Code >= 0)
                {
                    return(results?.Data.ToList());
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                e.HandleException();
                return(null);
            }
        }
Пример #15
0
        /// <summary>
        /// 获取欠款单据
        /// </summary>
        /// <returns></returns>
        public async Task <IList <BillSummaryModel> > GetOwecashBillsAsync(int userId, int?terminalId, int?billTypeId, string billNumber = "", string remark = "", DateTime?startTime = null, DateTime?endTime = null, int pageIndex = 0, int pageSize = 20, bool force = false, CancellationToken calToken = default)
        {
            try
            {
                int storeId = Settings.StoreId;
                var api     = RefitServiceBuilder.Build <IReceiptCashApi>(URL);

                var results = await _makeRequest.Start(api.GetOwecashBillsAsync(storeId,
                                                                                userId,
                                                                                terminalId,
                                                                                billTypeId,
                                                                                billNumber,
                                                                                remark,
                                                                                startTime,
                                                                                endTime,
                                                                                pageIndex,
                                                                                pageSize,
                                                                                calToken), calToken);

                if (results != null && results?.Code >= 0)
                {
                    return(results?.Data.ToList());
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                e.HandleException();
                return(null);
            }
        }
Пример #16
0
        public async Task <bool> UpdateterminalAsync(int?terminalId, double location_lat, double location_lng, CancellationToken calToken = default)
        {
            try
            {
                int storeId = Settings.StoreId;
                int userId  = Settings.UserId;

                var api     = RefitServiceBuilder.Build <ITerminalApi>(URL);
                var results = await _makeRequest.Start(api.UpdateterminalAsync(storeId, terminalId, location_lat, location_lng, calToken), calToken);

                if (results == null)
                {
                    return(false);
                }

                if (results?.Data != null && results?.Code >= 0)
                {
                    return(results.Data);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception e)
            {
                e.HandleException();
                return(false);
            }
        }
Пример #17
0
        /// <summary>
        /// 获取表单创建初始绑定
        /// </summary>
        /// <returns></returns>
        public async Task <CashReceiptBillModel> GetInitDataAsync(bool force = false, CancellationToken calToken = default)
        {
            try
            {
                int storeId = Settings.StoreId;
                int userId  = Settings.UserId;
                var api     = RefitServiceBuilder.Build <IReceiptCashApi>(URL);

                var cacheKey = RefitServiceBuilder.Cacher("ReceiptCashService.GetInitDataAsync", storeId, userId);
                var results  = await _makeRequest.StartUseCache(api.GetInitDataAsync(storeId, userId, calToken), cacheKey, force, calToken);

                if (results != null && results?.Code >= 0)
                {
                    return(results?.Data);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                e.HandleException();
                return(null);
            }
        }
Пример #18
0
        public async Task <bool> CheckTerminalAsync(string name, CancellationToken calToken = default)
        {
            try
            {
                int storeId = Settings.StoreId;
                int userId  = Settings.UserId;

                var api     = RefitServiceBuilder.Build <ITerminalApi>(URL);
                var results = await _makeRequest.Start(api.CheckTerminalAsync(storeId, name, calToken), calToken);

                if (results != null)
                {
                    return((bool)results.Data);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception e)
            {
                e.HandleException();
                return(false);
            }
        }
Пример #19
0
        /// <summary>
        /// 获取销量走势图
        /// </summary>
        /// <param name="args"></param>
        /// <returns></returns>
        public async Task <IList <SaleTrending> > GetSaleTrendingAsync(string dateType, bool force = false, CancellationToken calToken = default)
        {
            try
            {
                int storeId = Settings.StoreId;
                int userId  = Settings.UserId;

                var api = RefitServiceBuilder.Build <IReportingApi>(URL);

                var cacheKey = RefitServiceBuilder.Cacher("GetSaleTrendingAsync", storeId, dateType);
                var results  = await _makeRequest.StartUseCache(api.GetSaleTrendingAsync(storeId, dateType, calToken), cacheKey, force, calToken);

                if (results != null && results?.Code >= 0)
                {
                    return(results?.Data);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                e.HandleException();
                return(null);
            }
        }
Пример #20
0
        /// <summary>
        /// 获取用户信息
        /// </summary>
        /// <returns></returns>
        public async Task <UserModel> CheckStatusAsync(CancellationToken calToken = default)
        {
            try
            {
                int storeId = Settings.StoreId;
                int userId  = Settings.UserId;

                var api    = RefitServiceBuilder.Build <IAuthenticationApi>(URL);
                var result = await _makeRequest.Start(api.CheckStatusAsync(storeId, userId, calToken), calToken);

                if (result.Data != null && result.Data.Id > 0)
                {
                    return(result.Data);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                e.HandleException();
                return(null);
            }
        }
Пример #21
0
        /// <summary>
        /// 新增订单分析
        /// </summary>
        /// <param name="args"></param>
        /// <returns></returns>
        public async Task <NewOrderAnalysis> GetNewOrderAnalysisAsync(int?businessUserId = null, bool force = false, CancellationToken calToken = default)
        {
            try
            {
                int storeId = Settings.StoreId;
                int userId  = Settings.UserId;

                var api = RefitServiceBuilder.Build <IReportingApi>(URL);

                var cacheKey = RefitServiceBuilder.Cacher("GetNewOrderAnalysisAsync", storeId, businessUserId);
                var results  = await _makeRequest.StartUseCache(api.GetNewOrderAnalysisAsync(storeId, businessUserId, calToken), cacheKey, force, calToken);

                if (results != null && results?.Code >= 0)
                {
                    return(results?.Data);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                e.HandleException();
                return(null);
            }
        }
Пример #22
0
        public async Task <UserAuthenticationModel> RefreshTokenAsync(CancellationToken calToken = default)
        {
            try
            {
                var api    = RefitServiceBuilder.Build <IAuthenticationApi>(URL, false);
                var result = await _makeRequest.Start(api.RefreshTokenAsync(Settings.AccessToken, calToken), calToken);

                if (result.Data != null && result.Data.Id > 0)
                {
                    return(result.Data);
                }
                else
                {
                    return(null);
                }
            }
            catch (System.Net.Sockets.SocketException)
            {
                return(null);
            }
            catch (Refit.ApiException)
            {
                return(null);
            }
            catch (Exception)
            {
                return(null);
            }
        }
Пример #23
0
        /// <summary>
        /// 完成盘点
        /// </summary>
        /// <param name="billId"></param>
        /// <returns></returns>
        public async Task <bool> SetInventoryCompletedAsync(int billId = 0, CancellationToken calToken = default)
        {
            try
            {
                int storeId = Settings.StoreId;
                int userId  = Settings.UserId;

                var api     = RefitServiceBuilder.Build <IInventoryApi>(URL);
                var results = await _makeRequest.Start(api.SetInventoryCompletedAsync(storeId, userId, billId, calToken), calToken);

                if (results?.Data != null && results?.Code >= 0)
                {
                    return((bool)(results?.Success));
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception e)
            {
                e.HandleException();
                return(false);
            }
        }
Пример #24
0
        /// <summary>
        /// 获取指定单据类型的初始默认收付款方式
        /// </summary>
        /// <param name="billTypeId"></param>
        /// <returns></returns>
        public async Task <Tuple <AccountingOption, List <AccountingOption>, List <AccountingOption>, Dictionary <int, string> > > GetDefaultAccountingAsync(int billTypeId = 0, bool force = false, CancellationToken calToken = default)
        {
            var model = new Tuple <AccountingOption, List <AccountingOption>, List <AccountingOption>, Dictionary <int, string> >(null, null, null, null);

            try
            {
                int storeId = Settings.StoreId;
                int userId  = Settings.UserId;

                var api      = RefitServiceBuilder.Build <IAccountingApi>(URL);
                var cacheKey = RefitServiceBuilder.Cacher("GetDefaultAccountingAsync", storeId, billTypeId);
                var results  = await _makeRequest.StartUseCache(api.GetDefaultAccountingAsync(storeId, billTypeId, calToken), cacheKey, force, calToken);

                if (results != null && results?.Code >= 0)
                {
                    model = results?.Data;
                }
                return(model);
            }
            catch (Exception e)
            {
                e.HandleException();
                return(null);
            }
        }
Пример #25
0
        public async Task <UpdateInfo> GetCurrentVersionAsync(CancellationToken calToken = default)
        {
            try
            {
                if (!Settings.IsAuthenticated)
                {
                    return(null);
                }

                var api    = RefitServiceBuilder.Build <IUpdateApi>(URL, false);
                var result = await _makeRequest.Start(api.GetCurrentVersionAsync(calToken), calToken);

                if (result != null)
                {
                    return(result);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                e.HandleException();
                return(null);
            }
        }
Пример #26
0
        /// <summary>
        /// 审核
        /// </summary>
        /// <param name="billId"></param>
        /// <returns></returns>
        public async Task <ResultData> AuditingAsync(int billId = 0, CancellationToken calToken = default)
        {
            try
            {
                int storeId = Settings.StoreId;
                int userId  = Settings.UserId;
                var api     = RefitServiceBuilder.Build <ICostExpenditureApi>(URL);

                var results = await _makeRequest.Start(api.AuditingAsync(storeId, userId, billId, calToken), calToken);

                return(new ResultData
                {
                    Success = (bool)(results?.Success),
                    Message = results?.Message
                });
            }
            catch (Exception e)
            {
                return(new ResultData
                {
                    Success = false,
                    Message = e.Message
                });
            }
        }
Пример #27
0
        /// <summary>
        /// 获取单据
        /// </summary>
        /// <param name="billId"></param>
        /// <returns></returns>
        public async Task <ReturnBillModel> GetBillAsync(int billId, bool force = false, CancellationToken calToken = default)
        {
            var model = new ReturnBillModel();

            try
            {
                int storeId = Settings.StoreId;
                int userId  = Settings.UserId;
                var api     = RefitServiceBuilder.Build <IReturnBillApi>(URL);

                var cacheKey = RefitServiceBuilder.Cacher("ReturnBillService.GetBillAsync", storeId, userId, billId);
                var results  = await _makeRequest.StartUseCache(api.GetBillAsync(storeId, userId, billId, calToken), cacheKey, force, calToken);

                if (results != null && results?.Code >= 0)
                {
                    model = results?.Data;
                }
                return(model);
            }
            catch (Exception e)
            {
                e.HandleException();
                return(null);
            }
        }
Пример #28
0
        /// <summary>
        /// 获取推荐咨询活动
        /// </summary>
        /// <returns></returns>
        public async Task <IList <NewsInfoModel> > GetTopNewsAsync(bool force = false, CancellationToken calToken = default)
        {
            try
            {
                int storeId = Settings.StoreId;
                int userId  = Settings.UserId;

                var api = RefitServiceBuilder.Build <INewsApi>(URL);

                var cacheKey = RefitServiceBuilder.Cacher("GetTopNewsAsync", storeId, userId);
                var results  = await _makeRequest.StartUseCache(api.GetTopNewsAsync(storeId, calToken), cacheKey, force, calToken);

                if (results != null && results?.Code >= 0)
                {
                    return(results?.Data.ToList());
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                e.HandleException();
                return(null);
            }
        }
Пример #29
0
        /// <summary>
        /// 获取采购单列表
        /// </summary>
        /// <param name="makeuserId"></param>
        /// <param name="businessUserId"></param>
        /// <param name="manufacturerId"></param>
        /// <param name="wareHouseId"></param>
        /// <param name="billNumber"></param>
        /// <param name="remark"></param>
        /// <param name="printStatus"></param>
        /// <param name="startTime"></param>
        /// <param name="endTime"></param>
        /// <param name="auditedStatus"></param>
        /// <param name="sortByAuditedTime"></param>
        /// <param name="showReverse"></param>
        /// <param name="pagenumber"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        public async Task <IList <PurchaseBillModel> > GetPurchaseBillsAsync(int?makeuserId, int?businessUserId, int?manufacturerId, int?wareHouseId, string billNumber, string remark, bool?printStatus = null, DateTime?startTime = null, DateTime?endTime = null, bool?auditedStatus = null, bool?sortByAuditedTime = null, bool?showReverse = null, int pagenumber = 0, int pageSize = 20, bool force = false, CancellationToken calToken = default)
        {
            try
            {
                int storeId = Settings.StoreId;
                int userId  = Settings.UserId;

                var api = RefitServiceBuilder.Build <IPurchaseBillApi>(URL);

                var cacheKey = RefitServiceBuilder.Cacher("GetPurchaseBillsAsync", storeId,
                                                          makeuserId,
                                                          businessUserId,
                                                          manufacturerId,
                                                          wareHouseId,
                                                          billNumber,
                                                          remark,
                                                          printStatus,
                                                          startTime,
                                                          endTime,
                                                          auditedStatus,
                                                          sortByAuditedTime,
                                                          showReverse,
                                                          pagenumber,
                                                          pageSize);

                var results = await _makeRequest.StartUseCache(api.GetPurchaseBillsAsync(storeId,
                                                                                         makeuserId,
                                                                                         businessUserId,
                                                                                         manufacturerId,
                                                                                         wareHouseId,
                                                                                         billNumber,
                                                                                         remark,
                                                                                         printStatus,
                                                                                         startTime,
                                                                                         endTime,
                                                                                         auditedStatus,
                                                                                         sortByAuditedTime,
                                                                                         showReverse,
                                                                                         pagenumber,
                                                                                         pageSize, calToken),
                                                               cacheKey, force, calToken);

                if (results != null && results.Code >= 0)
                {
                    return(results?.Data.ToList());
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                e.HandleException();
                return(null);
            }
        }
Пример #30
0
        /// <summary>
        /// 获取费用支出单据
        /// </summary>
        public async Task <IList <CostExpenditureBillModel> > GetCostExpendituresAsync(int?makeuserId, int?customerId, string customerName, int?employeeId, string billNumber, bool?auditedStatus = null, DateTime?startTime = null, DateTime?endTime = null, bool?showReverse = null, bool sortByAuditedTime = false, int?sign = null, int pagenumber = 0, int pageSize = 20, bool force = false, CancellationToken calToken = default)
        {
            try
            {
                int storeId = Settings.StoreId;
                int userId  = Settings.UserId;

                var api = RefitServiceBuilder.Build <ICostExpenditureApi>(URL);

                var cacheKey = RefitServiceBuilder.Cacher("GetCostExpendituresAsync", storeId,
                                                          makeuserId,
                                                          customerId,
                                                          customerName,
                                                          employeeId,
                                                          billNumber,
                                                          auditedStatus,
                                                          startTime,
                                                          endTime,
                                                          showReverse,
                                                          sortByAuditedTime,
                                                          sign,
                                                          pagenumber,
                                                          pageSize);

                var results = await _makeRequest.StartUseCache(api.GetCostExpendituresAsync(storeId,
                                                                                            makeuserId,
                                                                                            customerId,
                                                                                            customerName,
                                                                                            employeeId,
                                                                                            billNumber,
                                                                                            auditedStatus,
                                                                                            startTime,
                                                                                            endTime,
                                                                                            showReverse,
                                                                                            sortByAuditedTime,
                                                                                            sign,
                                                                                            pagenumber,
                                                                                            pageSize, calToken),
                                                               cacheKey, force, calToken);

                if (results != null && results?.Code >= 0)
                {
                    return(results?.Data.ToList());
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                e.HandleException();
                return(null);
            }
        }