<pi:UserControlBase  
        xmlns:pi="https://github.com/ping9719/wpfex"
        x:Class="智慧物流软件系统.StocktakingDocumentView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:hc="https://handyorg.github.io/handycontrol"
        mc:Ignorable="d"
        d:DesignHeight="737" d:DesignWidth="1192">
    <Border Margin="0" Background="LightGray" CornerRadius="3" Padding="0">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="*"></RowDefinition>
                <RowDefinition Height="7*"></RowDefinition>
            </Grid.RowDefinitions>
            <Border Grid.Row="0" Margin="2 2 2 0" Background="AliceBlue" CornerRadius="5" Padding="0">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*"></ColumnDefinition>
                        <ColumnDefinition Width="1.5*"></ColumnDefinition>
                        <ColumnDefinition Width="*"></ColumnDefinition>
                        <ColumnDefinition Width="1.5*"></ColumnDefinition>
                        <ColumnDefinition Width="*"></ColumnDefinition>
                        <ColumnDefinition Width="0.2*"></ColumnDefinition>
                        <ColumnDefinition Width="*"></ColumnDefinition>
                        <ColumnDefinition Width="*"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition></RowDefinition>
                        <RowDefinition></RowDefinition>
                    </Grid.RowDefinitions>
                    <TextBlock Grid.Column="0" 
                               VerticalAlignment="Center" HorizontalAlignment="Right" 
                               Text="盘点单据编号：" FontSize="18" ></TextBlock>
                    <TextBox Grid.Column="1" Text="{Binding OrderNumber}"
                               VerticalAlignment="Center" HorizontalAlignment="Left" 
                               FontSize="18" MinWidth="120" ></TextBox>

                    <TextBlock Grid.Column="2" 
                               VerticalAlignment="Center" HorizontalAlignment="Right" 
                               Text="盘点单据类型：" FontSize="18" ></TextBlock>
                    <TextBox Grid.Column="3" Text="{Binding OrderType}"
                               VerticalAlignment="Center" HorizontalAlignment="Left" 
                               FontSize="18" MinWidth="120" ></TextBox>


                    <TextBlock Grid.Row="1" Grid.Column="0" 
                               VerticalAlignment="Center" HorizontalAlignment="Right" 
                               Text="盘点单据来源：" FontSize="18" ></TextBlock>
                    <TextBox Grid.Row="1"  Grid.Column="1" Text="{Binding OrderSource}"
                               VerticalAlignment="Center" HorizontalAlignment="Left" 
                               FontSize="18" MinWidth="120" ></TextBox>


                    <!--<TextBlock Grid.Row="2" Grid.Column="2" 
                               VerticalAlignment="Center" HorizontalAlignment="Right" 
                               Text="单据状态：" FontSize="18" ></TextBlock>
                    <TextBox Grid.Row="1"  Grid.Column="3" Text="{Binding OrderNumber}"
                               VerticalAlignment="Center" HorizontalAlignment="Left" 
                               FontSize="18" MinWidth="120" ></TextBox>-->

                    <Button Style="{StaticResource ButtonSuccess}"
                            Command="{Binding BtnSearchCommand}"
                            hc:BorderElement.CornerRadius="15" 
                            Grid.Column="6" MinHeight="40" FontSize="18" Content="&#xe8b9; 搜索" FontFamily="{StaticResource IconFont}" Margin="0,0,0,-10" >
                    </Button>
                    <Button Style="{StaticResource ButtonWarning}"  
                            Command="{Binding BtnResetCommand}"
                            hc:BorderElement.CornerRadius="15" 
                            Grid.Column="7" MinHeight="40" FontSize="18" Content="&#xe652; 重置" FontFamily="{StaticResource IconFont}" Margin="0,0,0,-10" >
                    </Button>
                </Grid>
            </Border>

            <Border Grid.Row="1" Margin="2" Background="AliceBlue" CornerRadius="5" Padding="0">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="0.8*"></RowDefinition>
                        <RowDefinition Height="8*"></RowDefinition>
                        <RowDefinition Height="0.8*"></RowDefinition>
                    </Grid.RowDefinitions>
                    <StackPanel Grid.Row="0" Orientation="Horizontal">
                        <Button MinHeight="40" FontSize="18" Margin="5" Command="{Binding BtnOrderDetailCommand}"
                                Content="&#xe6e2;单据明细" FontFamily="{StaticResource IconFont}" Background="#bccbb0" Foreground="White">
                        </Button>

                        <Button MinHeight="40" FontSize="18" Margin="5" Command="{Binding BtnStartCommand}"
                                Content="&#xec61;开始盘点" FontFamily="{StaticResource IconFont}" Background="CadetBlue" Foreground="White">
                        </Button>
                        <Button MinHeight="40" FontSize="18" Margin="5" Command="{Binding BtnPauseCommand}"
                                Content="&#xe67e;结束盘点" FontFamily="{StaticResource IconFont}"  Background="CadetBlue" Foreground="White">
                        </Button>

                        <Button MinHeight="40" FontSize="18" Margin="5" Command="{Binding BtnCommitCommand}"
                                Content="&#xe600;提交盘点" FontFamily="{StaticResource IconFont}"  Background="SaddleBrown" Foreground="White">
                        </Button>
                    </StackPanel>
                    <DataGrid Grid.Row="1" SelectedCellsChanged="DataGrid_SelectedCellsChanged"
                              SelectedItem="{Binding SelectedataGridItem}"
                              ItemsSource="{Binding DataGridItemSource}" 
                              Name="dg"
                              RowHeight="39" 
                              AutoGenerateColumns="False"  FontSize="13">
                        <DataGrid.Columns>
                            <DataGridTemplateColumn CanUserResize="False">
                                <DataGridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <CheckBox Width="30" Height="30"  IsHitTestVisible="False"   IsChecked="{Binding IsSelected , UpdateSourceTrigger=PropertyChanged}"/>
                                    </DataTemplate>
                                </DataGridTemplateColumn.CellTemplate>
                            </DataGridTemplateColumn>
                            <DataGridTextColumn IsReadOnly="True"  Header="序号" Binding="{Binding RowNumber}"></DataGridTextColumn>
                            <DataGridTextColumn IsReadOnly="True" Header="盘点单据编号" Binding="{Binding StocktakingOrderNumber}"></DataGridTextColumn>
                            <DataGridTextColumn IsReadOnly="True" Header="盘点单据来源" Binding="{Binding StocktakingOrderSource}"></DataGridTextColumn>
                            <DataGridTextColumn IsReadOnly="True" Header="盘点单据状态" Binding="{Binding StocktakingOrderStatus}"></DataGridTextColumn>
                            <DataGridTextColumn IsReadOnly="True" Header="创建时间" Binding="{Binding CreateTime,StringFormat='yyyy-MM-dd HH:mm:ss'}"></DataGridTextColumn>
                            <DataGridTextColumn IsReadOnly="True" Header="创建人" Binding="{Binding CreateUser}"></DataGridTextColumn>
                        </DataGrid.Columns>
                    </DataGrid>

                    <Grid Grid.Row="2">
                        <Border CornerRadius="3" Background="Transparent" VerticalAlignment="Center" >
                            <Grid HorizontalAlignment="Stretch"  Margin="0" VerticalAlignment="Top" Width="Auto" MinHeight="26">
                                <Grid.RowDefinitions>
                                    <RowDefinition/>
                                </Grid.RowDefinitions>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="5*"></ColumnDefinition>
                                    <ColumnDefinition Width="5*"></ColumnDefinition>
                                    <ColumnDefinition Width="5*"></ColumnDefinition>
                                </Grid.ColumnDefinitions>

                                <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="5">
                                    <TextBlock FontSize="14" VerticalAlignment="Center" Text="共"></TextBlock>
                                    <TextBlock FontSize="14" VerticalAlignment="Center" Text="{Binding TotalCount ,FallbackValue=0}"></TextBlock>
                                    <TextBlock FontSize="14" VerticalAlignment="Center" Text="条记录  "></TextBlock>



                                    <TextBlock FontSize="14" VerticalAlignment="Center" Text="第"></TextBlock>
                                    <TextBlock FontSize="14" VerticalAlignment="Center" Text="{Binding CurrentPage,FallbackValue=0}"></TextBlock>
                                    <TextBlock FontSize="14" VerticalAlignment="Center" Text="/"></TextBlock>
                                    <TextBlock FontSize="14" VerticalAlignment="Center" Text="{Binding MaxPage,FallbackValue=0}"></TextBlock>
                                    <TextBlock FontSize="14" VerticalAlignment="Center" Text="页 "></TextBlock>

                                    <ComboBox FontSize="14" VerticalAlignment="Center" SelectedValue="{Binding PageSize}" SelectedValuePath="Tag">
                                        <ComboBoxItem Tag="10" IsSelected="True">10条/页</ComboBoxItem>
                                        <ComboBoxItem Tag="20">20条/页</ComboBoxItem>
                                        <ComboBoxItem Tag="50">50条/页</ComboBoxItem>
                                        <ComboBoxItem Tag="100">100条/页</ComboBoxItem>
                                        <ComboBoxItem Tag="500">500条/页</ComboBoxItem>
                                    </ComboBox>
                                </StackPanel>


                                <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Grid.Column="1">
                                    <Grid>
                                        <Grid.RowDefinitions >
                                            <RowDefinition Height="30"></RowDefinition>
                                        </Grid.RowDefinitions>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="auto"/>
                                            <ColumnDefinition Width="auto"/>
                                            <ColumnDefinition Width="auto"/>
                                            <ColumnDefinition Width="auto"/>
                                            <ColumnDefinition Width="auto"/>
                                        </Grid.ColumnDefinitions>

                                        <Button BorderBrush="Transparent"  Background="Transparent" Grid.Column="0" Name="btnFirst" Content="首页" Foreground="Black" FontSize="14" 
                Command="{Binding BtnFirstPageCommand}"/>
                                        <Button BorderBrush="Transparent"  Background="Transparent" Grid.Column="1" Name="btnPrev" Content="上一页" FontSize="14" 
                Command="{Binding BtnPrePageCommand}"/>
                                        <TextBox BorderBrush="Transparent" Grid.Column="2" FontSize="14" MinWidth="50"   HorizontalAlignment="Center" VerticalAlignment="Center"  Cursor="IBeam" IsEnabled="False"
                 Text ="{Binding CurrentPage}" TextAlignment="Center"/>
                                        <Button BorderBrush="Transparent"  Background="Transparent" Grid.Column="3" Name="btnNext" Content="下一页" FontSize="14" 
                Command="{Binding BtnNextPageCommand}"/>
                                        <Button BorderBrush="Transparent"  Background="Transparent" Grid.Column="4" Name="btnLast" Content="末页" FontSize="14" 
                Command="{Binding BtnLastPageCommand}"/>
                                    </Grid>
                                </StackPanel>

                            </Grid>
                        </Border>
                    </Grid>
                </Grid>
            </Border>

        </Grid>
    </Border>
</pi:UserControlBase>
