<pi:UserControlBase  
        xmlns:pi="https://github.com/ping9719/wpfex"
        x:Class="智慧物流软件系统.MatInventoryDetailView"
        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="8*"></RowDefinition>
            </Grid.RowDefinitions>

            <Border Grid.Row="0" Margin="3" Background="AliceBlue" CornerRadius="3" Padding="0">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*"></ColumnDefinition>
                        <ColumnDefinition Width="*"></ColumnDefinition>
                        <ColumnDefinition Width="*"></ColumnDefinition>
                        <ColumnDefinition Width="*"></ColumnDefinition>
                        <ColumnDefinition Width="*"></ColumnDefinition>
                        <ColumnDefinition Width="*"></ColumnDefinition>
                        <ColumnDefinition Width="*"></ColumnDefinition>
                        <ColumnDefinition Width="*"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition></RowDefinition>
                        <RowDefinition></RowDefinition>
                        <RowDefinition></RowDefinition>
                    </Grid.RowDefinitions>
                    <TextBlock Grid.Row="0" Grid.Column="0" Margin="5"
                        VerticalAlignment="Center" HorizontalAlignment="Right" 
                        Text="货架类型：" FontSize="18" ></TextBlock>
                    <ComboBox Grid.Row="0" Grid.Column="1" IsEditable="False"
                              DisplayMemberPath="ShelfTypeName"
                              ItemsSource="{Binding ShelfTypeItems}"
                              SelectedItem="{Binding SelectedShelfTypeItem}"
                              FontSize="18" />

                    <TextBlock  Grid.Row="0" Grid.Column="2" Margin="5"
                             VerticalAlignment="Center" HorizontalAlignment="Right" 
                             Text="货架编码：" FontSize="18" ></TextBlock>
                    <TextBox  Grid.Row="0" Grid.Column="3" Text="{Binding ShelfCode}"
                             VerticalAlignment="Center" HorizontalAlignment="Left" 
                             FontSize="18" MinWidth="120" ></TextBox>

                    <TextBlock Grid.Row="1" Grid.Column="0" Margin="5"
                        VerticalAlignment="Center" HorizontalAlignment="Right" 
                        Text="物料编码：" FontSize="18" ></TextBlock>
                    <hc:AutoCompleteTextBox  Grid.Row="1" Grid.Column="1"  MinWidth="120" FontSize="18" IsEditable="True" 
                            IsTextSearchEnabled="True" 
                            Name="cbxMatCode" Margin="1"
                                          ItemsSource="{Binding Items}" 
                                          Text="{Binding MatCode}" 
                                          DisplayMemberPath="MatCode"/>

                    <TextBlock  Grid.Row="1" Grid.Column="2" Margin="5"
                             VerticalAlignment="Center" HorizontalAlignment="Right" 
                             Text="物料名称：" FontSize="18" ></TextBlock>
                    <TextBox  Grid.Row="1" Grid.Column="3" Text="{Binding MatName}"
                             VerticalAlignment="Center" HorizontalAlignment="Left" 
                             FontSize="18" MinWidth="120" ></TextBox>

                    <TextBlock  Grid.Row="1" Grid.Column="4" Margin="5"
                             VerticalAlignment="Center" HorizontalAlignment="Right" 
                             Text="物料批次：" FontSize="18" ></TextBlock>
                    <TextBox  Grid.Row="1" Grid.Column="5" Text="{Binding MatBatch}"
                             VerticalAlignment="Center" HorizontalAlignment="Left" 
                             FontSize="18" MinWidth="120" ></TextBox>

                    <TextBlock Grid.Row="2" Grid.Column="2"  Margin="5"
                             VerticalAlignment="Center" HorizontalAlignment="Right" 
                             Text="物料条码：" FontSize="18" ></TextBlock>
                    <TextBox  Grid.Row="2" Grid.Column="3"  Text="{Binding MatSN}"
                             VerticalAlignment="Center" HorizontalAlignment="Left" 
                             FontSize="18" MinWidth="120" ></TextBox>

                    <TextBlock Grid.Row="2" Grid.Column="0"   Margin="5"
                             VerticalAlignment="Center" HorizontalAlignment="Right" 
                             Text="  库    位  ：" FontSize="18" ></TextBlock>
                    <TextBox  Grid.Row="2"  Grid.Column="1" Text="{Binding StoreCode}"
                             VerticalAlignment="Center" HorizontalAlignment="Left" 
                             FontSize="18" MinWidth="120" ></TextBox>

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

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

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

                    <StackPanel Grid.Row="0" Orientation="Horizontal">
                        <Button MinHeight="40" FontSize="18" Margin="5" Command="{Binding BtnExportCommand}"
                                Content="&#xe866; 导  出" FontFamily="{StaticResource IconFont}"
                                Style="{StaticResource ButtonWarning}" Background="DarkOrange">
                        </Button>

                        <Button MinHeight="40" FontSize="18" Margin="5" Command="{Binding BtnGenerateOutstoreCommand}"
                              Content="&#xe67d; 搜索结果出库" FontFamily="{StaticResource IconFont}"
                              Style="{StaticResource ButtonWarning}" Background="IndianRed">
                        </Button>

                        <Button MinHeight="40" FontSize="18" Margin="5" Command="{Binding BtnGenerateStocktakingCommand}"
                              Content="&#xe65f; 搜索结果盘点" FontFamily="{StaticResource IconFont}"
                              Style="{StaticResource ButtonWarning}" Background="IndianRed">
                        </Button>
                    </StackPanel>




                    <DataGrid Grid.Row="1" 
                              SelectedCellsChanged="DataGrid_SelectedCellsChanged"
                              ItemsSource="{Binding DataGridItemSource}" 
                              RowHeight="39" 
                              AutoGenerateColumns="False"  FontSize="13">
                        <DataGrid.Columns>
                            <DataGridTextColumn IsReadOnly="True" Header="序号" Binding="{Binding RowNumber}"></DataGridTextColumn>
                            <DataGridTextColumn  MaxWidth="150" Header="物料编码" Binding="{Binding MatCode}"></DataGridTextColumn>
                            <DataGridTextColumn  MaxWidth="150" Header="物料名称" Binding="{Binding MatName}"></DataGridTextColumn>
                            <DataGridTextColumn  MaxWidth="150" Header="规格" Binding="{Binding MatSpec}"></DataGridTextColumn>
                            <DataGridTextColumn  MaxWidth="100" Header="批次" Binding="{Binding MatBatch}"></DataGridTextColumn>
                            <DataGridTextColumn IsReadOnly="True" Header="数量" Binding="{Binding MatQty}"></DataGridTextColumn>
                            <DataGridTextColumn  Header="库位" Binding="{Binding StoreCode}"></DataGridTextColumn>
                            <DataGridTextColumn IsReadOnly="True" Header="已锁定" Binding="{Binding IsLockedStr}"></DataGridTextColumn>
                            <DataGridTextColumn IsReadOnly="True" Header="入库时间" Binding="{Binding InstoreTime,StringFormat='yyyy-MM-dd HH:mm:ss'}"></DataGridTextColumn>
                            <DataGridTextColumn  Header="物料SN" Binding="{Binding MatSN}"></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>

                                <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Grid.Column="2">
                                    <TextBlock FontSize="14" VerticalAlignment="Center" Text="{Binding TotalQtyStr}"></TextBlock>
                                </StackPanel>
                            </Grid>
                        </Border>
                    </Grid>
                </Grid>
            </Border>

        </Grid>
    </Border>

</pi:UserControlBase>
