shanji 3 years ago
parent
commit
7a76417f4f
  1. 2
      BBWY.Client/BBWY.Client.csproj
  2. 47
      BBWY.Client/ViewModels/BillCorrection/BillCorrectionViewModel.cs
  3. 4
      BBWY.Client/Views/BillCorrection/BillCorrectionView.xaml
  4. 2
      BBWY.Client/Views/MainWindow.xaml

2
BBWY.Client/BBWY.Client.csproj

@ -1,7 +1,7 @@
 <Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<UseWPF>true</UseWPF>
<ApplicationIcon>Resources\Images\bbwylogo.ico</ApplicationIcon>

47
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<KVModel> LocalFilterOperationList { get; set; }
public IList<KVModel> 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<KVModel>();
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<string>(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();
}

4
BBWY.Client/Views/BillCorrection/BillCorrectionView.xaml

@ -160,9 +160,9 @@
Height="25" VerticalContentAlignment="Center"/>
<TextBlock Text="发货类型" VerticalAlignment="Center" Margin="5,0,0,0"/>
<ComboBox Margin="5,0,0,0"
ItemsSource="{Binding Source={StaticResource storageTypeProvider}}"
ItemsSource="{Binding LocalStorageTypeList}"
SelectedItem="{Binding SelectedStorageType,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
Height="25" VerticalContentAlignment="Center"/>
Height="25" VerticalContentAlignment="Center" DisplayMemberPath="Key"/>
<TextBlock Text="订单号" VerticalAlignment="Center" Margin="5,0,0,0"/>
<c:BTextBox Width="150" Height="25" Margin="5,0,0,0"
Text="{Binding SearchLocalOrderId,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>

2
BBWY.Client/Views/MainWindow.xaml

@ -26,7 +26,7 @@
<!--<TextBlock Text="{Binding GlobalContext.User.TeamName}" Margin="5,0,0,0"/>
<TextBlock Text="{Binding GlobalContext.User.Shop.Platform}" Margin="5,0,0,0"/>-->
<TextBlock Text="{Binding GlobalContext.User.Shop.ShopName}" Margin="5,0,0,0"/>
<TextBlock Text="v10062" Margin="5,0,0,0"/>
<TextBlock Text="v10063" Margin="5,0,0,0"/>
</StackPanel>
</Border>
<Grid Grid.Row="1">

Loading…
Cancel
Save