/// <summary> /// 模型数据改变 /// </summary> /// <param name="obj"></param> private void dataChanged(MatWareHouseLocationInfoModel MatWareHouseLocationInfoChange) { getPageData(pageRepuestParams.PageIndex, pageRepuestParams.PageSize); var tmpModel = MatWareHouseLocationInfoList.FirstOrDefault(a => a.Id == MatWareHouseLocationInfoChange.Id); this.MatWareHouseLocationInfo = MatWareHouseLocationInfoList.FirstOrDefault(); }
void OnPropertyChangedCommand(object sender, System.ComponentModel.PropertyChangedEventArgs e) { if (e.PropertyName.Equals("IsChecked")) { var selectedObj = sender as MatWareHouseLocationInfoModel; if (selectedObj == null) { return; } if (selectedObj.IsChecked) { //空托盘入库 if (MaterialInStorageInfo.InStorageType == InStorageTypeEnumModel.InStorageType.PalletInStorageType) { MatWareHouseLocationInfoDataSource.Clear(); var tmplist = MatWareHouseLocationInfoList.Where(a => a.IsChecked == true && a.Id != selectedObj.Id).ToList(); for (int i = 0; i < tmplist?.Count(); i++) { tmplist[i].IsChecked = false; } } MatWareHouseLocationInfoDataSource.Add(selectedObj); } else if (!selectedObj.IsChecked) { MatWareHouseLocationInfoDataSource.Remove(selectedObj); } } }
/// <summary> /// 取得分页数据 /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// /// <summary> /// 获取库位列表 /// </summary> private void getPageDataWareHouseLocation(int pageIndex, int pageSize) { #if DEBUG System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch(); stopwatch.Start(); #endif pageRepuestParams.SortField = "LastUpdatedTime"; pageRepuestParams.SortOrder = "desc"; pageRepuestParams.PageIndex = pageIndex; pageRepuestParams.PageSize = pageSize; //_httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token); //Console.WriteLine(await (await _httpClient.GetAsync("/api/service/WareHouseInfo/Get?id='1'")).Content.ReadAsStringAsync()); // var result = Utility.Http.HttpClientHelper.PostResponse <OperationResult <PageResult <MatWareHouseLocationInfoModel> > > (GlobalData.ServerRootUri + "MatWareHouseLocationInfo/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); var MatWareHouseLocationInfoListResult = new ObservableCollection <MatWareHouseLocationInfoModel>(result.Data.Data); foreach (MatWareHouseLocationInfoModel matwarehouselocationInfo in MatWareHouseLocationInfoListResult) { if (matwarehouselocationInfo.PalletCode != null && (matwarehouselocationInfo.StorageQuantity == null || matwarehouselocationInfo.StorageQuantity == 0)) { MatWareHouseLocationInfoList.Add(matwarehouselocationInfo); } } // TotalCounts = result.Data.Total; } else { MatWareHouseLocationInfoList?.Clear(); TotalCounts = 0; Application.Current.Resources["UiMessage"] = "未找到数据"; } } else { //操作失败,显示错误信息 MatWareHouseLocationInfoList = new ObservableCollection <MatWareHouseLocationInfoModel>(); Application.Current.Resources["UiMessage"] = result?.Message ?? "查询仓库库位失败,请联系管理员!"; } }
/// <summary> /// 库位选择项改变命令函数 /// </summary> private void OnExecuteWareHouseLocationSelectionChangedCommand() { MatWareHouseLocationInfoModel matwarehouselocationInfo = MatWareHouseLocationInfoList.FirstOrDefault(m => m.Id == MaterialOutStorageInfo.WareHouseLocationID); // if (matwarehouselocationInfo != null) { MaterialOutStorageInfo.PalletID = matwarehouselocationInfo.PalletID; } else { MaterialOutStorageInfo.PalletID = null; } }
/// <summary> /// 取得分页数据 /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> private void getPageDataMatWareHouseLocation(int pageIndex, int pageSize, int iType) { #if DEBUG System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch(); stopwatch.Start(); #endif //pageRepuestParams.SortField = "LastUpdatedTime"; pageRepuestParams.SortOrder = "desc"; pageRepuestParams.PageIndex = pageIndex; pageRepuestParams.PageSize = pageSize; //_httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token); //Console.WriteLine(await (await _httpClient.GetAsync("/api/service/EnterpriseInfo/Get?id='1'")).Content.ReadAsStringAsync()); // string sType = ""; //原料手动入库 if (iType == 1) { sType = "MatWareHouseLocationInfo/PageDataPallet1"; } //空托盘入库 else if (iType == 2) { sType = "MatWareHouseLocationInfo/PageDataPallet2"; } // //var result = Utility.Http.HttpClientHelper.PostResponse<OperationResult<PageResult<MatWareHouseLocationInfoModel>>>(GlobalData.ServerRootUri + "MatWareHouseLocationInfo/PageData", Utility.JsonHelper.ToJson(pageRepuestParams)); var result = Utility.Http.HttpClientHelper.PostResponse <OperationResult <PageResult <MatWareHouseLocationInfoModel> > >(GlobalData.ServerRootUri + sType, 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()) { //RoleInfoList = new ObservableCollection<RoleModel>(result.Data.Data); MatWareHouseLocationInfoList = new ObservableCollection <MatWareHouseLocationInfoModel>(); foreach (var data in result.Data.Data) { MatWareHouseLocationInfoModel matwarehouselocationinfo = new MatWareHouseLocationInfoModel(); matwarehouselocationinfo = data; // //原料手动入库 if (iType == 1) { //原料库位 if ((matwarehouselocationinfo.StorageQuantity == null || matwarehouselocationinfo.StorageQuantity <= 0) && matwarehouselocationinfo.WareHouseLocationType == WareHouseLocationTypeEnumModel.WareHouseLocationType.MaterialWareHouseLocationType) { matwarehouselocationinfo.PropertyChanged += OnPropertyChangedCommand; MatWareHouseLocationInfoList.Add(matwarehouselocationinfo); } } //空托盘入库 else if (iType == 2) { //原料库位 if (matwarehouselocationinfo.IsUse && matwarehouselocationinfo.WareHouseLocationType == WareHouseLocationTypeEnumModel.WareHouseLocationType.MaterialWareHouseLocationType) { matwarehouselocationinfo.PropertyChanged += OnPropertyChangedCommand; MatWareHouseLocationInfoList.Add(matwarehouselocationinfo); } } // } int TotalCounts = result.Data.Total; } else { MatWareHouseLocationInfoList?.Clear(); Application.Current.Resources["UiMessage"] = "未找到数据"; } } else { //操作失败,显示错误信息 MatWareHouseLocationInfoList = new ObservableCollection <MatWareHouseLocationInfoModel>(); Application.Current.Resources["UiMessage"] = result?.Message ?? "查询库位信息失败,请联系管理员!"; } }