/// <summary> /// 模型数据改变 /// </summary> /// <param name="obj"></param> private void dataChanged(MaterialBatchInfoModel MaterialBatchInfoChange) { getPageData(pageRepuestParams.PageIndex, pageRepuestParams.PageSize); var tmpModel = MaterialBatchInfoList.FirstOrDefault(a => a.Id == MaterialBatchInfoChange.Id); this.MaterialBatchInfo = MaterialBatchInfoList.FirstOrDefault(); }
private void getPageDataMaterialBatch(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; var result = Utility.Http.HttpClientHelper.PostResponse <OperationResult <PageResult <MaterialBatchInfoModel> > >(GlobalData.ServerRootUri + "MaterialBatchInfo/PageDataBatchCode", 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()) { MaterialBatchInfoList = new ObservableCollection <MaterialBatchInfoModel>(result.Data.Data); // int i = 0; foreach (string temp in MaterialBatchInfoList1) { MaterialBatchInfoModel materialbatchInfo = MaterialBatchInfoList.Where(m => m.Id.ToString().Contains(temp)).FirstOrDefault(); if (materialbatchInfo != null && materialbatchInfo.Id != MatInventoryItemInfo.MaterialBatch_Id) { MaterialBatchInfoList.Remove(materialbatchInfo); i++; } } // TotalCounts = result.Data.Total - i; } else { MaterialBatchInfoList?.Clear(); TotalCounts = 0; Application.Current.Resources["UiMessage"] = "未找到数据"; } } else { //操作失败,显示错误信息 MaterialBatchInfoList = new ObservableCollection <MaterialBatchInfoModel>(); Application.Current.Resources["UiMessage"] = result?.Message ?? "查询批次信息失败,请联系管理员!"; } }
/// <summary> /// 选中产品执行命令 /// </summary> private void OnExecutematerialbatchSelectionChangedCommand() { MaterialBatchInfoModel materialbatchInfo = MaterialBatchInfoList.FirstOrDefault(m => m.Id == MatInventoryItemInfo.MaterialBatch_Id); // if (materialbatchInfo != null) { //MatStorageModifyInfo.WareHouseLocationName = materialbatchInfo.WareHouseLocationName; //MatStorageModifyInfo.MaterialCode = materialbatchInfo.MaterialCode; //MatStorageModifyInfo.MaterialName = materialbatchInfo.MaterialName; MatInventoryItemInfo.AccuntAmount = materialbatchInfo.Quantity; MatInventoryItemInfo.FullPalletQuantity = materialbatchInfo.FullPalletQuantity; } else { //MatStorageModifyInfo.WareHouseLocationName = null; //MatStorageModifyInfo.MaterialCode = null; //MatStorageModifyInfo.MaterialName = null; MatInventoryItemInfo.AccuntAmount = null; MatInventoryItemInfo.FullPalletQuantity = null; } }
/// <summary> /// 取得分页数据 /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> private void getPageDataMaterialBatch(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 = "MaterialBatchInfo/PageDataMaterialBatchInfo1"; } //空托盘出库 else if (iType == 2) { sType = "MaterialBatchInfo/PageDataMaterialBatchInfo2"; } // var result = Utility.Http.HttpClientHelper.PostResponse <OperationResult <PageResult <MaterialBatchInfoModel> > >(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); MaterialBatchInfoList = new ObservableCollection <MaterialBatchInfoModel>(); foreach (var data in result.Data.Data) { MaterialBatchInfoModel materialbatchinfo = new MaterialBatchInfoModel(); materialbatchinfo = data; // //成品手动出库 if (iType == 1) { //为测试需要 调整为成品库位,应为原料库位 // if (materialbatchinfo.MaterialCode == MaterialOutStorageInfo.MaterialCode && materialbatchinfo.PalletCode != null && materialbatchinfo.WareHouseLocationType == WareHouseLocationTypeEnumModel.WareHouseLocationType.原料库位) { materialbatchinfo.PropertyChanged += OnPropertyChangedCommand; MaterialBatchInfoList.Add(materialbatchinfo); } } //空托盘出库 else if (iType == 2) { //为测试需要 调整为成品库位,应为原料库位 // if (materialbatchinfo.PalletCode == MaterialOutStorageInfo.PalletCode && (materialbatchinfo.Quantity == null || materialbatchinfo.Quantity <= 0) && (materialbatchinfo.WareHouseLocationType == WareHouseLocationTypeEnumModel.WareHouseLocationType.原料库位)) { materialbatchinfo.IsChecked = true; // materialbatchinfo.PropertyChanged += OnPropertyChangedCommand; MaterialBatchInfoList.Add(materialbatchinfo); // MaterialBatchInfoDataSource.Add(materialbatchinfo); } } } int TotalCounts = result.Data.Total; } else { MaterialBatchInfoList?.Clear(); Application.Current.Resources["UiMessage"] = "未找到数据"; } } else { //操作失败,显示错误信息 MaterialBatchInfoList = new ObservableCollection <MaterialBatchInfoModel>(); Application.Current.Resources["UiMessage"] = result?.Message ?? "查询库位批次信息失败,请联系管理员!"; } }