12 changed files with 325 additions and 225 deletions
@ -0,0 +1,85 @@ |
|||||
|
using BBWY.Client.Models; |
||||
|
using BBWY.Common.Models; |
||||
|
using GalaSoft.MvvmLight.Command; |
||||
|
using System; |
||||
|
using System.Threading.Tasks; |
||||
|
using System.Windows.Input; |
||||
|
|
||||
|
namespace BBWY.Client.ViewModels |
||||
|
{ |
||||
|
public class BatchPurchaseOrderListViewModel : BaseVM, IDenpendency |
||||
|
{ |
||||
|
private GlobalContext globalContext; |
||||
|
private DateTime startDate; |
||||
|
private DateTime endDate; |
||||
|
private string searchPurchaseOrderId; |
||||
|
private string searchPurchaseName; |
||||
|
private string searchProductId; |
||||
|
private string searchSkuId; |
||||
|
private PurchaseOrderState? purchaseOrderState; |
||||
|
private int pageIndex; |
||||
|
private int pageSize; |
||||
|
|
||||
|
public ICommand SearchPurchaseOrderCommand { get; set; } |
||||
|
public ICommand OpenCreateNewPurchaseOrderDialogCommand { get; set; } |
||||
|
|
||||
|
public ICommand SetSearchDateCommand { get; set; } |
||||
|
|
||||
|
public ICommand SetPurchaseOrderStateCommand { get; set; } |
||||
|
|
||||
|
|
||||
|
public DateTime StartDate { get => startDate; set { Set(ref startDate, value); } } |
||||
|
public DateTime EndDate { get => endDate; set { Set(ref endDate, value); } } |
||||
|
public string SearchPurchaseOrderId { get => searchPurchaseOrderId; set { Set(ref searchPurchaseOrderId, value); } } |
||||
|
public string SearchPurchaseName { get => searchPurchaseName; set { Set(ref searchPurchaseName, value); } } |
||||
|
public string SearchProductId { get => searchProductId; set { Set(ref searchProductId, value); } } |
||||
|
public string SearchSkuId { get => searchSkuId; set { Set(ref searchSkuId, value); } } |
||||
|
public PurchaseOrderState? PurchaseOrderState { get => purchaseOrderState; set { Set(ref purchaseOrderState, value); } } |
||||
|
public int PageIndex { get => pageIndex; set { Set(ref pageIndex, value); } } |
||||
|
|
||||
|
public int PageSize { get => pageSize; set { Set(ref pageSize, value); } } |
||||
|
|
||||
|
public BatchPurchaseOrderListViewModel(GlobalContext globalContext) |
||||
|
{ |
||||
|
SetSearchDateCommand = new RelayCommand<int>(SetSearchDate); |
||||
|
SetPurchaseOrderStateCommand = new RelayCommand<PurchaseOrderState?>(SetPurchaseOrderState); |
||||
|
SearchPurchaseOrderCommand = new RelayCommand(InitQueryPurchaseOrder); |
||||
|
OpenCreateNewPurchaseOrderDialogCommand = new RelayCommand(OpenCreateNewPurchaseOrderDialog); |
||||
|
PageSize = 10; |
||||
|
this.globalContext = globalContext; |
||||
|
EndDate = DateTime.Now.Date; |
||||
|
StartDate = DateTime.Now.Date.AddDays(-15); |
||||
|
InitQueryPurchaseOrder(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
private void InitQueryPurchaseOrder() |
||||
|
{ |
||||
|
PageIndex = 1; |
||||
|
Task.Factory.StartNew(() => QueryPurchaseOrder(PageIndex)); |
||||
|
} |
||||
|
|
||||
|
private void SetPurchaseOrderState(PurchaseOrderState? purchaseOrderState) |
||||
|
{ |
||||
|
this.PurchaseOrderState = purchaseOrderState; |
||||
|
InitQueryPurchaseOrder(); |
||||
|
} |
||||
|
|
||||
|
private void SetSearchDate(int d) |
||||
|
{ |
||||
|
EndDate = d == 1 ? DateTime.Now.Date.AddDays(-1) : DateTime.Now; |
||||
|
StartDate = DateTime.Now.Date.AddDays(d * -1); |
||||
|
InitQueryPurchaseOrder(); |
||||
|
} |
||||
|
|
||||
|
private void QueryPurchaseOrder(int pageIndex) |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
|
||||
|
private void OpenCreateNewPurchaseOrderDialog() |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,151 @@ |
|||||
|
<Page x:Class="BBWY.Client.Views.BatchPurchase.BatchPurchaseOrderList" |
||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
||||
|
xmlns:c="clr-namespace:BBWY.Controls;assembly=BBWY.Controls" |
||||
|
xmlns:b="http://schemas.microsoft.com/xaml/behaviors" |
||||
|
xmlns:local="clr-namespace:BBWY.Client.Views.BatchPurchase" |
||||
|
mc:Ignorable="d" |
||||
|
xmlns:cmodel="clr-namespace:BBWY.Client.Models" |
||||
|
xmlns:sys="clr-namespace:System;assembly=mscorlib" |
||||
|
d:DesignHeight="1080" d:DesignWidth="1920" |
||||
|
Title="BatchPurchaseOrderList" |
||||
|
DataContext="{Binding BatchPurchaseOrderListVM,Source={StaticResource Locator}}"> |
||||
|
<Page.Resources> |
||||
|
<sys:Int32 x:Key="d0">0</sys:Int32> |
||||
|
<sys:Int32 x:Key="d1">1</sys:Int32> |
||||
|
<sys:Int32 x:Key="d3">2</sys:Int32> |
||||
|
<sys:Int32 x:Key="d7">6</sys:Int32> |
||||
|
<sys:Int32 x:Key="d15">14</sys:Int32> |
||||
|
<sys:Int32 x:Key="d30">29</sys:Int32> |
||||
|
</Page.Resources> |
||||
|
<Grid> |
||||
|
<c:RoundWaitProgress Play="{Binding IsLoading}" Panel.ZIndex="999"/> |
||||
|
|
||||
|
<Grid Margin="5,0"> |
||||
|
<Grid.RowDefinitions> |
||||
|
<RowDefinition Height="auto"/> |
||||
|
<RowDefinition Height="5"/> |
||||
|
<RowDefinition Height="30"/> |
||||
|
<RowDefinition Height="5"/> |
||||
|
<RowDefinition Height="30"/> |
||||
|
<RowDefinition Height="5"/> |
||||
|
<RowDefinition Height="30"/> |
||||
|
<RowDefinition/> |
||||
|
<RowDefinition Height="30"/> |
||||
|
</Grid.RowDefinitions> |
||||
|
|
||||
|
<Grid Background="{StaticResource Border.Background}" HorizontalAlignment="Left" Height="75" Panel.ZIndex="999"> |
||||
|
<Grid.ColumnDefinitions> |
||||
|
<ColumnDefinition/> |
||||
|
<ColumnDefinition Width="auto"/> |
||||
|
</Grid.ColumnDefinitions> |
||||
|
<Grid.RowDefinitions> |
||||
|
<RowDefinition Height="0.5*"/> |
||||
|
<RowDefinition Height="5"/> |
||||
|
<RowDefinition Height="0.5*"/> |
||||
|
</Grid.RowDefinitions> |
||||
|
<StackPanel Orientation="Horizontal" Margin="0,5,0,0" Height="30"> |
||||
|
<StackPanel.Resources> |
||||
|
<Style TargetType="DatePickerTextBox"> |
||||
|
<Setter Property="IsReadOnly" Value="True"/> |
||||
|
</Style> |
||||
|
</StackPanel.Resources> |
||||
|
<TextBlock Text="下单时间" VerticalAlignment="Center" Margin="5,0,0,0"/> |
||||
|
<DatePicker SelectedDate="{Binding StartDate}" Width="133.5" Height="30" VerticalContentAlignment="Center" FocusVisualStyle="{x:Null}" Margin="5,0,0,0"/> |
||||
|
<DatePicker SelectedDate="{Binding EndDate}" Width="133.5" Height="30" VerticalContentAlignment="Center" FocusVisualStyle="{x:Null}" Margin="5,0,0,0"/> |
||||
|
<TextBlock Text="采购单" VerticalAlignment="Center" Margin="5,0,0,0"/> |
||||
|
<c:BTextBox Width="150" Margin="5,0,0,0" Text="{Binding SearchPurchaseOrderId}" WaterRemark="精确匹配"/> |
||||
|
<TextBlock Text="SPU" VerticalAlignment="Center" Margin="5,0,0,0"/> |
||||
|
<c:BTextBox Width="150" Margin="5,0,0,0" WaterRemark="精确匹配" Text="{Binding SearchProductId}"/> |
||||
|
</StackPanel> |
||||
|
<StackPanel Orientation="Horizontal" Grid.Row="2" Margin="0,0,0,5" Height="30"> |
||||
|
<c:BButton Content="今天" Width="50" Height="25" Margin="5,0,0,0" |
||||
|
Command="{Binding SetSearchDateCommand}" |
||||
|
CommandParameter="{StaticResource d0}"/> |
||||
|
<c:BButton Content="昨天" Width="50" Height="25" Margin="5,0,0,0" |
||||
|
Command="{Binding SetSearchDateCommand}" |
||||
|
CommandParameter="{StaticResource d1}"/> |
||||
|
<c:BButton Content="近3天" Width="50" Height="25" Margin="5,0,0,0" |
||||
|
Command="{Binding SetSearchDateCommand}" |
||||
|
CommandParameter="{StaticResource d3}"/> |
||||
|
<c:BButton Content="近7天" Width="50" Height="24" Margin="5,0,0,0" |
||||
|
Command="{Binding SetSearchDateCommand}" |
||||
|
CommandParameter="{StaticResource d7}"/> |
||||
|
<c:BButton Content="近15天" Width="50" Height="25" Margin="5,0,0,0" |
||||
|
Command="{Binding SetSearchDateCommand}" |
||||
|
CommandParameter="{StaticResource d15}"/> |
||||
|
<c:BButton Content="近30天" Width="50" Height="25" Margin="5,0,0,0" |
||||
|
Command="{Binding SetSearchDateCommand}" |
||||
|
CommandParameter="{StaticResource d30}"/> |
||||
|
<TextBlock VerticalAlignment="Center" Margin="5,0,0,0" Text="采购商"/> |
||||
|
<c:BTextBox Width="150" Margin="5,0,0,0" Text="{Binding SearchPurchaseName}" WaterRemark="精确匹配"/> |
||||
|
<TextBlock Text="SKU" VerticalAlignment="Center" Margin="5,0,0,0"/> |
||||
|
<c:BTextBox Width="150" Margin="5,0,0,0" Text="{Binding SearchSkuId}" WaterRemark="精确匹配"/> |
||||
|
|
||||
|
<c:BButton Content="同步" Width="50" Margin="5,0,0,0" Command="{Binding SyncOrderCommand}" ToolTipService.InitialShowDelay="0" ToolTipService.ShowDuration="10000" |
||||
|
Visibility="Collapsed"> |
||||
|
<c:BButton.ToolTip> |
||||
|
<StackPanel> |
||||
|
<TextBlock Text="1.使用筛选条件中的开始时间和结束时间进行同步"/> |
||||
|
<TextBlock Text="2.从开始时间起每次同步3小时时长的订单直到到达结束时间"/> |
||||
|
<TextBlock Text="3.已存在未结束的同步任务将不会重复执行"/> |
||||
|
</StackPanel> |
||||
|
</c:BButton.ToolTip> |
||||
|
</c:BButton> |
||||
|
</StackPanel> |
||||
|
|
||||
|
<Grid Grid.Column="1" Grid.RowSpan="3"> |
||||
|
<Grid.ColumnDefinitions> |
||||
|
<ColumnDefinition/> |
||||
|
<ColumnDefinition/> |
||||
|
</Grid.ColumnDefinitions> |
||||
|
<Button Content="搜索" Width="50" VerticalAlignment="Stretch" Margin="5,0,0,0" Command="{Binding SearchPurchaseOrderCommand}" |
||||
|
Grid.RowSpan="2" Background="{StaticResource Button.Selected.Background}" BorderThickness="0" Foreground="White"/> |
||||
|
<Button Content="导出" Command="{Binding ExportCommand}" Width="50" Grid.Column="1" |
||||
|
Visibility="{Binding Visibility,ElementName=listbox_order}" Background="#1CC2A2" BorderThickness="0" Foreground="White"/> |
||||
|
<!--<Button Content="同步" Command="{Binding SyncOrderCommand}" Width="50" Grid.Column="1" Grid.Row="1" |
||||
|
Visibility="{Binding Visibility,ElementName=listbox_order}" Background="#02A7F0" BorderThickness="0" Foreground="White"/>--> |
||||
|
</Grid> |
||||
|
</Grid> |
||||
|
|
||||
|
<StackPanel Grid.Row="2" HorizontalAlignment="Left" Orientation="Horizontal"> |
||||
|
<c:BButton Content="新建采购单" Padding="10,0" Margin="0,0,10,0" Background="#2879FF" |
||||
|
Command="{Binding OpenCreateNewPurchaseOrderDialogCommand}"/> |
||||
|
<c:BButton Content="全部" Width="100" Margin="5,0,0,0" |
||||
|
Background="{Binding PurchaseOrderState,Converter={StaticResource objConverter},ConverterParameter=#null:#8080FF:#F2F2F2}" |
||||
|
Foreground="{Binding PurchaseOrderState,Converter={StaticResource objConverter},ConverterParameter=#null:White:#4A4A4A}" |
||||
|
Command="{Binding SetPurchaseOrderStateCommand}" CommandParameter="{x:Null}"/> |
||||
|
<c:BButton Content="待付款" Width="100" |
||||
|
Background="{Binding PurchaseOrderState,Converter={StaticResource objConverter},ConverterParameter=待付款:#8080FF:#F2F2F2}" |
||||
|
Foreground="{Binding PurchaseOrderState,Converter={StaticResource objConverter},ConverterParameter=待付款:White:#4A4A4A}" |
||||
|
Command="{Binding SetPurchaseOrderStateCommand}" CommandParameter="{x:Static cmodel:PurchaseOrderState.待付款}"/> |
||||
|
<c:BButton Content="待发货" Width="100" |
||||
|
Background="{Binding PurchaseOrderState,Converter={StaticResource objConverter},ConverterParameter=待发货:#8080FF:#F2F2F2}" |
||||
|
Foreground="{Binding PurchaseOrderState,Converter={StaticResource objConverter},ConverterParameter=待发货:White:#4A4A4A}" |
||||
|
Command="{Binding SetPurchaseOrderStateCommand}" CommandParameter="{x:Static cmodel:PurchaseOrderState.待发货}"/> |
||||
|
<c:BButton Content="待收货" Width="100" |
||||
|
Background="{Binding PurchaseOrderState,Converter={StaticResource objConverter},ConverterParameter=待收货:#8080FF:#F2F2F2}" |
||||
|
Foreground="{Binding PurchaseOrderState,Converter={StaticResource objConverter},ConverterParameter=待收货:White:#4A4A4A}" |
||||
|
Command="{Binding SetPurchaseOrderStateCommand}" CommandParameter="{x:Static cmodel:PurchaseOrderState.待收货}"/> |
||||
|
<c:BButton Content="待质检" Width="100" |
||||
|
Background="{Binding PurchaseOrderState,Converter={StaticResource objConverter},ConverterParameter=待质检:#8080FF:#F2F2F2}" |
||||
|
Foreground="{Binding PurchaseOrderState,Converter={StaticResource objConverter},ConverterParameter=待质检:White:#4A4A4A}" |
||||
|
Command="{Binding SetPurchaseOrderStateCommand}" CommandParameter="{x:Static cmodel:PurchaseOrderState.待质检}"/> |
||||
|
<c:BButton Content="待打包" Width="100" |
||||
|
Background="{Binding PurchaseOrderState,Converter={StaticResource objConverter},ConverterParameter=待打包:#8080FF:#F2F2F2}" |
||||
|
Foreground="{Binding PurchaseOrderState,Converter={StaticResource objConverter},ConverterParameter=待打包:White:#4A4A4A}" |
||||
|
Command="{Binding SetPurchaseOrderStateCommand}" CommandParameter="{x:Static cmodel:PurchaseOrderState.待打包}"/> |
||||
|
<c:BButton Content="待结算" Width="100" |
||||
|
Background="{Binding PurchaseOrderState,Converter={StaticResource objConverter},ConverterParameter=待结算:#8080FF:#F2F2F2}" |
||||
|
Foreground="{Binding PurchaseOrderState,Converter={StaticResource objConverter},ConverterParameter=待结算:White:#4A4A4A}" |
||||
|
Command="{Binding SetPurchaseOrderStateCommand}" CommandParameter="{x:Static cmodel:PurchaseOrderState.待结算}"/> |
||||
|
<c:BButton Content="已完成" Width="100" |
||||
|
Background="{Binding PurchaseOrderState,Converter={StaticResource objConverter},ConverterParameter=已完成:#8080FF:#F2F2F2}" |
||||
|
Foreground="{Binding PurchaseOrderState,Converter={StaticResource objConverter},ConverterParameter=已完成:White:#4A4A4A}" |
||||
|
Command="{Binding SetPurchaseOrderStateCommand}" CommandParameter="{x:Static cmodel:PurchaseOrderState.已完成}"/> |
||||
|
</StackPanel> |
||||
|
</Grid> |
||||
|
</Grid> |
||||
|
</Page> |
@ -0,0 +1,26 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Text; |
||||
|
using System.Windows; |
||||
|
using System.Windows.Controls; |
||||
|
using System.Windows.Data; |
||||
|
using System.Windows.Documents; |
||||
|
using System.Windows.Input; |
||||
|
using System.Windows.Media; |
||||
|
using System.Windows.Media.Imaging; |
||||
|
using System.Windows.Navigation; |
||||
|
using System.Windows.Shapes; |
||||
|
|
||||
|
namespace BBWY.Client.Views.BatchPurchase |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// BatchPurchaseOrderList.xaml 的交互逻辑
|
||||
|
/// </summary>
|
||||
|
public partial class BatchPurchaseOrderList : Page |
||||
|
{ |
||||
|
public BatchPurchaseOrderList() |
||||
|
{ |
||||
|
InitializeComponent(); |
||||
|
} |
||||
|
} |
||||
|
} |
Loading…
Reference in new issue