<pi:UserControlBase  
        xmlns:pi="https://github.com/ping9719/wpfex"
        x:Class="智能仓储WCS管理系统.StoreInfoView"
        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" LoadedVisibleFirst="LoadedVisible">
    <Border Margin="0" Background="AliceBlue" CornerRadius="3" Padding="0">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="1.4*"></RowDefinition>
                <RowDefinition Height="10*"></RowDefinition>
            </Grid.RowDefinitions>
            <Border Grid.Row="0" Margin="5" Background="AliceBlue" CornerRadius="5" Padding="0">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="2*"></ColumnDefinition>
                        <ColumnDefinition Width="3*"></ColumnDefinition>
                        <ColumnDefinition Width="2*"></ColumnDefinition>
                        <ColumnDefinition Width="3*"></ColumnDefinition>
                        <ColumnDefinition Width="2*"></ColumnDefinition>
                        <ColumnDefinition Width="3*"></ColumnDefinition>
                        <ColumnDefinition Width="*"></ColumnDefinition>
                        <ColumnDefinition Width="*"></ColumnDefinition>
                        <ColumnDefinition Width="2.5*"></ColumnDefinition>
                        <ColumnDefinition Width="2.5*"></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" 
                               VerticalAlignment="Center" HorizontalAlignment="Stretch" 
                               FontSize="18" MinWidth="90" Text="{Binding ShelfCode}"></TextBox>
                    <TextBlock Grid.Column="2" 
                               VerticalAlignment="Center" HorizontalAlignment="Right" 
                               Text="模组编码：" FontSize="18" ></TextBlock>
                    <TextBox Grid.Column="3" 
                               VerticalAlignment="Center" HorizontalAlignment="Stretch" 
                               FontSize="18" MinWidth="90" Text="{Binding ModuleCode}"></TextBox>
                    <TextBlock Grid.Column="4" 
                               VerticalAlignment="Center" HorizontalAlignment="Right" 
                               Text="库位编码：" FontSize="18" ></TextBlock>
                    <TextBox Grid.Column="5" 
                               VerticalAlignment="Center" HorizontalAlignment="Stretch" 
                               FontSize="18" MinWidth="90" Text="{Binding StoreCode}"></TextBox>

                    <TextBlock Grid.Column="0"  Grid.Row="1"
                               VerticalAlignment="Center" HorizontalAlignment="Right" 
                               Text="当前物料：" FontSize="18" ></TextBlock>
                    <TextBox   Grid.Column="1"  Grid.Row="1"
                               VerticalAlignment="Center" HorizontalAlignment="Stretch" 
                               FontSize="18" MinWidth="90" Text="{Binding CurrentMatSN}"></TextBox>

                    <Button Style="{StaticResource ButtonSuccess}"  hc:BorderElement.CornerRadius="12" 
                            Grid.Column="8" MinHeight="40" FontSize="18" Content="&#xe8b9; 搜索" FontFamily="{StaticResource IconFont}"
                            Command="{Binding BtnSearchCommand}">
                    </Button>

                    <Button Style="{StaticResource ButtonWarning}"  hc:BorderElement.CornerRadius="12" 
                            Grid.Column="9" MinHeight="40" FontSize="18" Content="&#xe652; 重置" FontFamily="{StaticResource IconFont}"
                            Command="{Binding BtnResetCommand}">
                    </Button>
                </Grid>
            </Border>

            <Border Grid.Row="1" Margin="5" Background="AliceBlue" CornerRadius="5" Padding="0">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="0.8*"></RowDefinition>
                        <RowDefinition Height="9*"></RowDefinition>
                        <RowDefinition Height="0.8*"></RowDefinition>
                    </Grid.RowDefinitions>

                    <DataGrid Grid.Row="1" 
                              SelectedItem="{Binding SelectedataGridItem}"
                              Name="dataGrid"
                    ItemsSource="{Binding DataGridItemSource}" 
                    SelectionChanged="dataGrid_SelectionChanged"
                    RowHeight="39" 
                    AutoGenerateColumns="False"  FontSize="13">
                        <DataGrid.Columns>
                            <DataGridTextColumn IsReadOnly="True" Header="序号" Binding="{Binding RowNumber}"></DataGridTextColumn>
                            <DataGridTextColumn IsReadOnly="True" Header="货架编码" Binding="{Binding ShelfCode}"></DataGridTextColumn>
                            <DataGridTextColumn IsReadOnly="True" Header="模组编码" Binding="{Binding ModuleCode}"></DataGridTextColumn>
                            <DataGridTextColumn IsReadOnly="True" Header="库位编码" Binding="{Binding StoreCode}"></DataGridTextColumn>
                            
                            <DataGridTextColumn IsReadOnly="True" Header="PCB板ID" Binding="{Binding BoardId}"></DataGridTextColumn>
                            <DataGridTextColumn IsReadOnly="True" Header="储位号" Binding="{Binding LightNumber}"></DataGridTextColumn>

                            <DataGridTextColumn IsReadOnly="True" Header="电压标准值" Binding="{Binding StandardVoltage}"></DataGridTextColumn>
                            <DataGridTextColumn IsReadOnly="True" Header="电压偏移值" Binding="{Binding OffsetVoltage}"></DataGridTextColumn>
                            <DataGridTextColumn IsReadOnly="True" Header="当前电压" Binding="{Binding CurrentVoltage}"></DataGridTextColumn>
                            <DataGridTextColumn IsReadOnly="True" Header="当前物料" Binding="{Binding CurrentMatSn}"></DataGridTextColumn>
                            <DataGridTemplateColumn CanUserResize="False" Width="auto">
                                <DataGridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <StackPanel Orientation="Horizontal" IsEnabled="{Binding IsAdmin,Converter={StaticResource Boolean2BooleanReConverter}}">
                                            <Button Style="{StaticResource ButtonWarning}" Margin="0,0,5,0" IsEnabled="True" Content="禁用" Width="60" Command="{Binding DataContext.DisableCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}}" CommandParameter="{Binding }" />
                                            <Button Style="{StaticResource ButtonDanger}" Margin="0,0,0,0" IsEnabled="True" Content="启用" Width="60" Command="{Binding DataContext.EnableCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}}" CommandParameter="{Binding }"/>
                                        </StackPanel>
                                    </DataTemplate>
                                </DataGridTemplateColumn.CellTemplate>
                            </DataGridTemplateColumn>
                        </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>
