From 7a76417f4fd4b747dc5e8425c32a6772a9a4c465 Mon Sep 17 00:00:00 2001 From: shanji <18996038927@163.com> Date: Tue, 6 Dec 2022 14:33:10 +0800 Subject: [PATCH] 1 --- BBWY.Client/BBWY.Client.csproj | 2 +- .../BillCorrection/BillCorrectionViewModel.cs | 47 ++++++++++++++----- .../BillCorrection/BillCorrectionView.xaml | 4 +- BBWY.Client/Views/MainWindow.xaml | 2 +- 4 files changed, 40 insertions(+), 15 deletions(-) diff --git a/BBWY.Client/BBWY.Client.csproj b/BBWY.Client/BBWY.Client.csproj index 34fa3294..6af2ea99 100644 --- a/BBWY.Client/BBWY.Client.csproj +++ b/BBWY.Client/BBWY.Client.csproj @@ -1,7 +1,7 @@  - WinExe + Exe netcoreapp3.1 true Resources\Images\bbwylogo.ico diff --git a/BBWY.Client/ViewModels/BillCorrection/BillCorrectionViewModel.cs b/BBWY.Client/ViewModels/BillCorrection/BillCorrectionViewModel.cs index bad1c291..4eb0d754 100644 --- a/BBWY.Client/ViewModels/BillCorrection/BillCorrectionViewModel.cs +++ b/BBWY.Client/ViewModels/BillCorrection/BillCorrectionViewModel.cs @@ -29,9 +29,11 @@ namespace BBWY.Client.ViewModels private bool isLoading; private KVModel selectedLocalFilterOperation; private bool isEnableCanCorrectionOrder; - private StorageType? selectedStorageType; + private KVModel selectedStorageType; private string searchLocalOrderId; private Shop selectedLocalShop; + private Shop allShop; + private KVModel allStorageType; private GlobalContext globalContext; @@ -107,16 +109,19 @@ namespace BBWY.Client.ViewModels public IList LocalFilterOperationList { get; set; } + public IList LocalStorageTypeList { get; set; } + public KVModel SelectedLocalFilterOperation { get => selectedLocalFilterOperation; set { Set(ref selectedLocalFilterOperation, value); } } public bool IsEnableCanCorrectionOrder { get => isEnableCanCorrectionOrder; set { Set(ref isEnableCanCorrectionOrder, value); } } - public StorageType? SelectedStorageType { get => selectedStorageType; set { Set(ref selectedStorageType, value); } } + public KVModel SelectedStorageType { get => selectedStorageType; set { Set(ref selectedStorageType, value); } } public string SearchLocalOrderId { get => searchLocalOrderId; set { Set(ref searchLocalOrderId, value); } } public Shop SelectedLocalShop { get => selectedLocalShop; set { Set(ref selectedLocalShop, value); } } + public BillCorrectionViewModel(GlobalContext globalContext, BillCorrectionService billCorrectionService) { this.billCorrectionService = billCorrectionService; @@ -137,6 +142,17 @@ namespace BBWY.Client.ViewModels new KVModel(){ Key="保留",Value="save" }, new KVModel(){ Key="过滤",Value="filter"} }; + LocalStorageTypeList = new List(); + + var storageTypeArray = Enum.GetValues(typeof(StorageType)); + foreach (var storageType in storageTypeArray) + { + LocalStorageTypeList.Add(new KVModel() + { + Key = storageType.ToString(), + Value = ((int)storageType).ToString() + }); + } ImportSaleFreightBillCommand = new RelayCommand(ImportSaleFreightBill); SearchBillCorrectionOrderCommand = new RelayCommand(SearchBillCorrectionOrder); CorrectCommand = new RelayCommand(Correct); @@ -145,6 +161,14 @@ namespace BBWY.Client.ViewModels ClearLocalConditionCommand = new RelayCommand(ClearLocalCondition); SaveCommand = new RelayCommand(Save); SelectedLocalFilterOperation = LocalFilterOperationList[0]; + allShop = new Shop() { ShopId = 0, ShopName = "全部" }; + allStorageType = new KVModel() { Key = "全部", Value = string.Empty }; + + LocalStorageTypeList.Insert(0, allStorageType); + SelectedStorageType = allStorageType; + + LocalShopList.Insert(0, allShop); + SelectedLocalShop = allShop; } private void OnSearchShopKeyWordChanged(string key) @@ -357,9 +381,10 @@ namespace BBWY.Client.ViewModels return; } IsLoading = true; - foreach (var shop in LocalShopList) + foreach (var shop in selectShops) LocalShopList.Add(shop); - SelectedLocalShop = null; + LocalShopList.Insert(0, allShop); + SelectedLocalShop = LocalShopList[0]; var shopIds = selectShops.Select(s => s.ShopId).ToList(); Task.Factory.StartNew(() => billCorrectionService.GetBillCorrectionOrderList(shopIds, StartDate, EndDate)) .ContinueWith(t => @@ -402,10 +427,10 @@ namespace BBWY.Client.ViewModels { LocalOrderList.Clear(); var where = OrderList.Where(o => true); - if (SelectedLocalShop != null) + if (SelectedLocalShop != null && SelectedLocalShop.ShopId != 0) where = where.Where(o => o.ShopId == SelectedLocalShop.ShopId); - if (SelectedStorageType != null) - where = where.Where(o => o.StorageType == SelectedStorageType); + if (SelectedStorageType != null && !string.IsNullOrEmpty(SelectedStorageType.Value)) + where = where.Where(o => o.StorageType == (StorageType)Convert.ToInt32(SelectedStorageType.Value)); if (!string.IsNullOrEmpty(SearchLocalOrderId)) where = where.Where(o => o.OrderId == SearchLocalOrderId); if (IsEnableCanCorrectionOrder) @@ -465,20 +490,20 @@ namespace BBWY.Client.ViewModels SaleFreightBillList.Clear(); OrderList.Clear(); LocalOrderList.Clear(); - SelectedStorageType = null; + SelectedStorageType = allStorageType; IsEnableCanCorrectionOrder = false; SearchShopKeyWord = string.Empty; SearchLocalOrderId = string.Empty; - SelectedLocalShop = null; + SelectedLocalShop = allShop; SelectedLocalFilterOperation = LocalFilterOperationList[0]; } private void ClearLocalCondition() { - SelectedStorageType = null; + SelectedStorageType = allStorageType; IsEnableCanCorrectionOrder = false; SearchLocalOrderId = string.Empty; - SelectedLocalShop = null; + SelectedLocalShop = allShop; SearchLocalOrderList(); } diff --git a/BBWY.Client/Views/BillCorrection/BillCorrectionView.xaml b/BBWY.Client/Views/BillCorrection/BillCorrectionView.xaml index 743a01ec..e26f51e6 100644 --- a/BBWY.Client/Views/BillCorrection/BillCorrectionView.xaml +++ b/BBWY.Client/Views/BillCorrection/BillCorrectionView.xaml @@ -160,9 +160,9 @@ Height="25" VerticalContentAlignment="Center"/> + Height="25" VerticalContentAlignment="Center" DisplayMemberPath="Key"/> diff --git a/BBWY.Client/Views/MainWindow.xaml b/BBWY.Client/Views/MainWindow.xaml index 9d3a1db3..3274cc95 100644 --- a/BBWY.Client/Views/MainWindow.xaml +++ b/BBWY.Client/Views/MainWindow.xaml @@ -26,7 +26,7 @@ - +