<pi:UserControlBase  
        xmlns:pi="https://github.com/ping9719/wpfex"
        x:Class="智慧物流软件系统.OutVentoryView"
        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"
        xmlns:智慧物流软件系统="clr-namespace:智慧物流软件系统"
    mc:Ignorable="d"
        d:DesignHeight="737" d:DesignWidth="1192">
    <Border Margin="0" Background="LightGray" CornerRadius="3" Padding="0">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="0.9*"></RowDefinition>
                <RowDefinition Height="0.9*"></RowDefinition>
                <RowDefinition Height="9*"></RowDefinition>
            </Grid.RowDefinitions>
            <Border Grid.Row="0" Margin="0" Background="AliceBlue"  Padding="0">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition></ColumnDefinition>
                        <ColumnDefinition></ColumnDefinition>
                        <ColumnDefinition></ColumnDefinition>
                        <ColumnDefinition></ColumnDefinition>
                        <ColumnDefinition></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button Style="{StaticResource ButtonSuccess}"  hc:BorderElement.CornerRadius="15" 
                            Grid.Column="3" MinHeight="45" FontSize="28" Content="&#xec61;开始发料" FontFamily="{StaticResource IconFont}"
                            Command="{Binding BtnStartCommand}">
                    </Button>
                    <Button Style="{StaticResource ButtonWarning}"  hc:BorderElement.CornerRadius="15" 
                            Grid.Column="4" MinHeight="45" FontSize="28" Content="&#xe61b;暂停发料" FontFamily="{StaticResource IconFont}"
                            Command="{Binding BtnPauseCommand}">
                    </Button>
                </Grid>
            </Border>
            <Border Grid.Row="1" Margin="0" Background="LightGray"  Padding="0">
                <Border Margin="0" CornerRadius="3"  Background="AliceBlue"  Padding="0">
                    <Grid >
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="0.5*"></ColumnDefinition>
                            <ColumnDefinition Width="1*"></ColumnDefinition>
                            <ColumnDefinition Width="2*"></ColumnDefinition>
                            <ColumnDefinition Width="1*"></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition></RowDefinition>
                        </Grid.RowDefinitions>
                        <StackPanel Grid.Column="2" VerticalAlignment="Center" Orientation="Horizontal">
                            <TextBlock FontSize="26" Text="发料单号：">
                            </TextBlock>
                            <TextBlock FontSize="26" Text="{Binding SelectedOutOrderNumber}">
                            </TextBlock>
                        </StackPanel>
                    </Grid>
                </Border>
            </Border>
            <Border Grid.Row="2" Margin="0" Background="AliceBlue" Padding="0">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="8*"></RowDefinition>
                        <RowDefinition Height="0.8*"></RowDefinition>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="2*"></ColumnDefinition>
                        <ColumnDefinition Width="6*"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="1*"></RowDefinition>
                            <RowDefinition Height="12*"></RowDefinition>
                        </Grid.RowDefinitions>
                        <TextBlock Text="发料单列表" MouseDown="TextBlock_MouseDown" FontWeight="DemiBold" FontSize="24" HorizontalAlignment="Center" VerticalAlignment="Center"  TextAlignment="Center"></TextBlock>
                        <Border CornerRadius="3" Margin="1" Grid.Row="1" Background="AliceBlue" BorderBrush="CadetBlue" BorderThickness="1.5">
                            <ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Visible">
                                <ListView FontSize="18" ItemsSource="{Binding OutOrderList}"  SelectedItem="{Binding SelectedOutOrder,Mode=TwoWay}" PreviewMouseWheel="ListView_PreviewMouseWheel">
                                    <ListView.View>

                                        <GridView AllowsColumnReorder="False">
                                            <GridView.ColumnHeaderContainerStyle>
                                                <Style TargetType="{x:Type GridViewColumnHeader}">
                                                    <Setter Property="Visibility" Value="Collapsed"/>
                                                </Style>
                                            </GridView.ColumnHeaderContainerStyle>
                                            <GridViewColumn  DisplayMemberBinding="{Binding OrderNumber}"/>
                                        </GridView>
                                    </ListView.View>
                                </ListView>
                            </ScrollViewer>
                        </Border>
                    </Grid>
                    <Border CornerRadius="3"  Margin="1" Grid.Row="0" Grid.Column="1" Background="AliceBlue" BorderBrush="CadetBlue" BorderThickness="1.5">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="12*"></RowDefinition>
                            </Grid.RowDefinitions>
                            <DataGrid  Grid.Row="0"
                              SelectedCellsChanged="DataGrid_SelectedCellsChanged"
                              ItemsSource="{Binding DataGridItemSource}" 
                              RowHeight="40" 
                              AutoGenerateColumns="False"  FontSize="15">
                                <DataGrid.Columns>
                                    <DataGridTemplateColumn Header="" CanUserResize="False" Width="50">
                                        <DataGridTemplateColumn.CellTemplate>
                                            <DataTemplate>
                                                <StackPanel>
                                                    <Ellipse Width="20" Height="20" Fill="Green" Visibility="{Binding IsSended,Converter={StaticResource Boolean2VisibilityConverter}}"></Ellipse>
                                                    <Ellipse Width="20" Height="20" Fill="Gray" Visibility="{Binding IsSended,Converter={StaticResource Boolean2VisibilityReConverter}}"></Ellipse>
                                                </StackPanel>
                                            </DataTemplate>
                                        </DataGridTemplateColumn.CellTemplate>
                                    </DataGridTemplateColumn>
                                    <DataGridTextColumn  IsReadOnly="True" Header="已取料" Binding="{Binding IsSended,Converter={StaticResource Boolean2StringConverter},ConverterParameter=否;是}"></DataGridTextColumn>
                                    <DataGridTextColumn  MaxWidth="100" IsReadOnly="True" Header="序号" Binding="{Binding RowNumber}"></DataGridTextColumn>
                                    <DataGridTextColumn  Header="库位" Binding="{Binding StoreCode}"></DataGridTextColumn>
                                    <DataGridTextColumn  MaxWidth="150" Header="物料编码" Binding="{Binding MatCode}"></DataGridTextColumn>
                                    <DataGridTextColumn  MaxWidth="150" Header="物料名称" Binding="{Binding MatName}"></DataGridTextColumn>
                                    <DataGridTextColumn  MaxWidth="150" Header="数量" Binding="{Binding MatQty}"></DataGridTextColumn>
                                    <DataGridTextColumn  MaxWidth="150" Header="规格" Binding="{Binding MatSpec}"></DataGridTextColumn>
                                    <DataGridTextColumn  MaxWidth="150" Header="批次" Binding="{Binding MatBatch}"></DataGridTextColumn>
                                    <DataGridTextColumn IsReadOnly="False" Header="物料SN" Binding="{Binding MatSN}"></DataGridTextColumn>
                                </DataGrid.Columns>
                            </DataGrid>
                        </Grid>
                    </Border>
                    <Grid  Grid.Row="2" Grid.ColumnSpan="2">
                        <Border CornerRadius="3" Background="Transparent" VerticalAlignment="Center" >
                            <Grid HorizontalAlignment="Stretch"  Margin="5 0 1 0" VerticalAlignment="Top" Width="Auto" Height="40">
                                <Grid.RowDefinitions>
                                    <RowDefinition/>
                                </Grid.RowDefinitions>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="5*"></ColumnDefinition>
                                    <ColumnDefinition Width="5*"></ColumnDefinition>
                                    <ColumnDefinition Width="5*"></ColumnDefinition>
                                </Grid.ColumnDefinitions>
                                <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Column="1">
                                    <TextBlock Text="当前状态：" FontSize="22">
                                    </TextBlock>
                                    <TextBlock Text="{Binding OrderStatus,FallbackValue=未知}" Foreground="Red"  FontSize="22"></TextBlock>
                                </StackPanel>
                                <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Column="2">
                                    <TextBlock Text="总盘数：" VerticalAlignment="Bottom" FontSize="22">
                                    </TextBlock>
                                    <TextBlock Text="{Binding TotalPan}" VerticalAlignment="Bottom" FontSize="22">
                                    </TextBlock>
                                    <TextBlock Text="  取料进度：" VerticalAlignment="Bottom" FontSize="22">
                                    </TextBlock>
                                    <TextBlock Text="{Binding SendedPan}" VerticalAlignment="Bottom" FontSize="22">
                                    </TextBlock>
                                    <TextBlock Text="/" VerticalAlignment="Bottom" FontSize="22">
                                    </TextBlock>
                                    <TextBlock Text="{Binding TotalPan}" VerticalAlignment="Bottom" FontSize="22">
                                    </TextBlock>
                                </StackPanel>
                            </Grid>
                        </Border>
                    </Grid>
                </Grid>
            </Border>
        </Grid>
    </Border>
</pi:UserControlBase>
