/// <summary> /// 取得分页数据 /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> private void getPageData(int pageIndex, int pageSize) { #if DEBUG System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch(); stopwatch.Start(); #endif pageRepuestParams.SortField = GlobalData.SortField; pageRepuestParams.SortOrder = GlobalData.SortOrder; pageRepuestParams.PageIndex = pageIndex; pageRepuestParams.PageSize = pageSize; //_httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token); //Console.WriteLine(await (await _httpClient.GetAsync("/api/service/AgvInfo/Get?id='1'")).Content.ReadAsStringAsync()); Utility.Http.HttpClientHelper.SetAccessTokenToHttpClient(GlobalData.AccessTocken); var result = Utility.Http.HttpClientHelper.PostResponse <OperationResult <PageResult <AgvInfoModel> > >(GlobalData.ServerRootUri + "AgvInfo/PageData", Utility.JsonHelper.ToJson(pageRepuestParams)); #if DEBUG stopwatch.Stop(); Utility.LogHelper.Info("获取agv小车信息用时(毫秒):" + stopwatch.ElapsedMilliseconds); Utility.LogHelper.Info("agv小车信息内容:" + Utility.JsonHelper.ToJson(result)); #endif if (!Equals(result, null) && result.Successed) { //Application.Current.Resources["UiMessage"] = result?.Message; //LogHelper.Info(Application.Current.Resources["UiMessage"].ToString()); UiMessage = result?.Message; LogHelper.Info(UiMessage); if (result.Data.Data.Any()) { //TotalCounts = result.Data.Total; //Messenger.Default.Send(LoginUser, MessengerToken.LoginSuccess); AgvInfoList = new ObservableCollection <AgvInfoModel>(result.Data.Data); TotalCounts = result.Data.Total; } else { AgvInfoList?.Clear(); TotalCounts = 0; //Application.Current.Resources["UiMessage"] = "未找到数据"; UiMessage = "未找到数据"; } } else { //操作失败,显示错误信息 AgvInfoList = new ObservableCollection <AgvInfoModel>(); //Application.Current.Resources["UiMessage"] = result?.Message ?? "查询Agv信息失败,请联系管理员!"; UiMessage = result?.Message ?? "查询Agv信息失败,请联系管理员!"; } }
/// <summary> /// 取得Agv分页数据 /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> private void getAgvInfoPageData(int pageIndex, int pageSize) { #if DEBUG System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch(); stopwatch.Start(); #endif pageRepuestParams.SortField = GlobalData.SortField; pageRepuestParams.SortOrder = GlobalData.SortOrder; pageRepuestParams.PageIndex = pageIndex; pageRepuestParams.PageSize = pageSize; Utility.Http.HttpClientHelper.SetAccessTokenToHttpClient(GlobalData.AccessTocken); var result = Utility.Http.HttpClientHelper.PostResponse <OperationResult <PageResult <AgvInfoModel> > >(GlobalData.ServerRootUri + "AgvInfo/PageData", Utility.JsonHelper.ToJson(pageRepuestParams)); #if DEBUG stopwatch.Stop(); Utility.LogHelper.Info("获取地标信息用时(毫秒):" + stopwatch.ElapsedMilliseconds); Utility.LogHelper.Info("地标信息内容:" + Utility.JsonHelper.ToJson(result)); #endif if (!Equals(result, null) && result.Successed) { Application.Current.Resources["UiMessage"] = result?.Message; LogHelper.Info(Application.Current.Resources["UiMessage"].ToString()); if (result.Data.Data.Any()) { //TotalCounts = result.Data.Total; //Messenger.Default.Send(LoginUser, MessengerToken.LoginSuccess); AgvInfoList = new ObservableCollection <AgvInfoModel>(result.Data.Data); //TotalCounts = result.Data.Total; } else { AgvInfoList?.Clear(); //TotalCounts = 0; Application.Current.Resources["UiMessage"] = "未找到数据"; } } else { //操作失败,显示错误信息 AgvInfoList = new ObservableCollection <AgvInfoModel>(); Application.Current.Resources["UiMessage"] = result?.Message ?? "查询地标信息失败,请联系管理员!"; } }