Ejemplo n.º 1
0
 void OnPropertyChangedCommand(object sender, System.ComponentModel.PropertyChangedEventArgs e)
 {
     if (e.PropertyName.Equals("IsChecked"))
     {
         var selectedObj = sender as MaterialBatchInfoModel;
         if (selectedObj == null)
         {
             return;
         }
         if (selectedObj.IsChecked)
         {
             MaterialBatchInfoDataSource.Add(selectedObj);
         }
         else if (!selectedObj.IsChecked)
         {
             MaterialBatchInfoDataSource.Remove(selectedObj);
         }
     }
 }
Ejemplo n.º 2
0
        /// <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 ?? "查询库位批次信息失败,请联系管理员!";
            }
        }