<UserControl x:Class="SlnMesnac.WPF.Page.IndexPage.ChangeType"
             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:local="clr-namespace:SlnMesnac.WPF.Page.IndexPage"
             xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
             mc:Ignorable="d" 
             d:DesignHeight="900" d:DesignWidth="1620" Background="Transparent">
    <UserControl.Resources>

        <!--<converters:IsCheckedConverter x:Key="IsCheckedConverter"/>-->
        <Style x:Key="CustomDatePicker" TargetType="DatePicker">

            <!-- 设置背景颜色 -->
            <Setter Property="Background" Value="LightBlue"></Setter>
            <!-- 设置边框颜色 -->
            <Setter Property="BorderBrush" Value="DarkBlue"></Setter>
            <!-- 设置字体样式 -->
            <Setter Property="FontSize" Value="14"></Setter>
            <!-- 设置前景色（文本颜色） -->
            <Setter Property="Foreground" Value="Black"></Setter>


        </Style>

        <Style x:Key="DataGridTextColumnCenterSytle" TargetType="{x:Type TextBlock}">
            <Setter Property="VerticalAlignment" Value="Center" />
            <Setter Property="FontSize" Value="18"/>
        </Style>
        <Style TargetType="DataGrid">
            <!--网格线颜色-->
            <Setter Property="CanUserResizeColumns" Value="false"/>
            <Setter Property="Background" Value="#1152AC" />
            <Setter Property="BorderBrush" Value="#4285DE" />
            <Setter Property="Foreground" Value="White"/>
            <Setter Property="HorizontalGridLinesBrush">
                <Setter.Value>
                    <SolidColorBrush Color="#4285DE"/>
                </Setter.Value>
            </Setter>
            <Setter Property="VerticalGridLinesBrush">
                <Setter.Value>
                    <SolidColorBrush Color="#1152AC"/>
                </Setter.Value>
            </Setter>
        </Style>
        <!--列头标题栏样式-->
        <Style TargetType="DataGridColumnHeader">

            <Setter Property="HorizontalContentAlignment" Value="Center" />
            <Setter Property="BorderBrush" Value="#dddddd" />
            <Setter Property="Height" Value="40"/>
            <Setter Property="FontSize" Value="18"/>
            <Setter Property="Background" Value="#4285DE"/>
            <Setter Property="Foreground" Value="White"/>
        </Style>

        <!--单元格样式-->
        <Style TargetType="DataGridCell">
            <Setter Property="FocusVisualStyle" Value="{x:Null}" />
            <Setter Property="BorderThickness" Value="0" />
            <Setter Property="BorderBrush" Value="#4285DE" />
            <Setter Property="Height" Value="40"/>
            <Setter Property="FontSize" Value="12"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type DataGridCell}">
                        <Grid Background="{TemplateBinding Background}" >
                            <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
            <Style.Triggers>
                <Trigger Property="IsSelected" Value="True">
                    <Setter Property="Background" Value="#4285DE"/>
                    <Setter Property="Foreground" Value="#dddddd"/>
                </Trigger>
            </Style.Triggers>

        </Style>
    </UserControl.Resources>


    <Border Grid.Row="1" Grid.Column="1" BorderBrush="#0288d1" BorderThickness="2" CornerRadius="5" Background="Transparent" Margin="5">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="50"/>
                <RowDefinition Height="9*"/>
            </Grid.RowDefinitions>

            <Border Grid.Row="0" BorderBrush="#0288d1" BorderThickness="0,0,0,1" CornerRadius="0" Background="#1157b9" Margin="1,1,5,5" >
                <TextBlock Text="生产订单获取" FontSize="25" FontWeight="Bold" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/>
            </Border>
            <Border Grid.Row="1" BorderBrush="Green" BorderThickness="0" CornerRadius="5" Background="Transparent" Margin="1,1,5,5">
                <Grid Margin="10,5">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="70"/>
                        <RowDefinition Height="4*"/>
                    </Grid.RowDefinitions>
                    <DockPanel VerticalAlignment="Center" Margin="0,0,0,0" LastChildFill="False">
                        <!--<Label Content="产线编号:"  FontSize="20" Foreground="Black"/>
                        <TextBox IsReadOnly="False" IsEnabled="True"  Text="{Binding MesOrderNo,Mode=TwoWay}" Width="250" FontSize="20" Foreground="Black" Margin="0 0 30 0" />-->
                        <!--<Label Content="RFID数量:"  FontSize="20" Foreground="Black"/>
                        <ComboBox ItemsSource="{Binding Items}" Width="200" >
                            
                        </ComboBox>-->
                        <Label Content="产线名称:"  FontSize="20" Foreground="Black"/>
                        <ComboBox ItemsSource="{Binding Items}" Width="200" Height="30" FontSize="20" SelectedItem="{Binding QueryIsCheck,Mode=TwoWay}" Margin="10,0,30,0" Foreground="Black">
                            <!--<ComboBoxItem Content="2#硫化线" Background="White" Foreground="#4285DE"/>
                            <ComboBoxItem Content="3#硫化线"  Foreground="#4285DE"/>
                            <ComboBoxItem Content="6#硫化线上"  Foreground="#4285DE"/>
                            <ComboBoxItem Content="6#硫化线下"  Foreground="#4285DE"/>
                            <ComboBoxItem Content="7#硫化线"  Foreground="#4285DE"/>
                            <ComboBoxItem Content=""  Foreground="#4285DE"/>-->
                        </ComboBox>
                        <TextBlock Text="开始时间"   Margin="10 0" Foreground="Black" FontSize="20"  VerticalAlignment="Center"/>

                        <DatePicker  Style="{StaticResource CustomDatePicker}"
     x:Name="BeginTime" FontSize="20"  
     Width="170" Height="30"  Margin="10 0"  BorderBrush="Black">
                            <!--materialDesign:CalendarAssist.IsHeaderVisible="False">-->
                            <DatePicker.SelectedDate >
                                <Binding
                 Path="BeginDate"
                 UpdateSourceTrigger="PropertyChanged">
                                    <Binding.ValidationRules>
                                    </Binding.ValidationRules>
                                </Binding>
                            </DatePicker.SelectedDate>

                        </DatePicker>
                        <Button
                            Content="从MES获取订单信息" Width="200" Height="50" FontSize="20" Command="{Binding GetOrderInfoCommand}" CommandParameter="{Binding Name, ElementName=Search}"
                             Background="#009999" Style="{StaticResource  BUTTON_AGREE}"/>
                        <Button
                            Content="暂停盘点" Width="200" Height="50" FontSize="20" Margin="10,0,0,0" Command="{Binding StopReadCommand}" CommandParameter="{Binding Name, ElementName=Search}"
                             Background="#009999" Style="{StaticResource  BUTTON_AGREE}"/>
                        <Button DockPanel.Dock="Right"
                            Content="清除订单记录" Width="200" Height="50" FontSize="20" Margin="10,0,0,0" Command="{Binding ClearData}" CommandParameter="{Binding Name, ElementName=Search}"
                             Background="#009999" Style="{StaticResource  BUTTON_AGREE}"/>
                    </DockPanel>
                    <UniformGrid Grid.Row="1">
                        <DataGrid x:Name="listDataGrid"  Grid.Row="0" ItemsSource="{Binding ChangeTypePanel}" Background="#00000000" 
                       ColumnHeaderHeight="35"   Height="{Binding Path=ActualHeight, ElementName=ScanPanel}" 
                      RowHeight="50" AutoGenerateColumns="False" RowHeaderWidth="0"  FontSize="20"
                      GridLinesVisibility="None" ScrollViewer.HorizontalScrollBarVisibility="Auto" 
                      ScrollViewer.VerticalScrollBarVisibility="Auto"  BorderThickness="0" CanUserAddRows="False" SelectionMode="Single" IsReadOnly="True"
                      Foreground="Black"  >
                            <DataGrid.Columns>
                                <DataGridTextColumn Binding="{Binding OrderNo}" Header="订单编号" Width="0.5*" ElementStyle="{StaticResource  DataGridTextColumnCenterSytle}"/>
                                <DataGridTextColumn Binding="{Binding ProductCode}" Header="物料编号" Width="1.5*" ElementStyle="{StaticResource  DataGridTextColumnCenterSytle}" />
                                <!--<DataGridTextColumn Binding="{Binding ProductName}" Header="物料名称" Width="1.5*" ElementStyle="{StaticResource  DataGridTextColumnCenterSytle}" />-->
                                <DataGridTextColumn Binding="{Binding ProductType}" Header="物料类型" Width="1.5*" ElementStyle="{StaticResource  DataGridTextColumnCenterSytle}" />
                                <DataGridTextColumn Binding="{Binding PlanQty}" Header="计划数量" Width="1*" ElementStyle="{StaticResource  DataGridTextColumnCenterSytle}" />
                                <DataGridTextColumn Binding="{Binding NextProductNo}" Header="带号" Width="1*" ElementStyle="{StaticResource  DataGridTextColumnCenterSytle}" />
                                <DataGridTextColumn Binding="{Binding InsertDate}" Header="获取时间" Width="1*" ElementStyle="{StaticResource  DataGridTextColumnCenterSytle}" />
                                <DataGridTextColumn Binding="{Binding PlanStateName}" Header="计划状态" Width="0.5*" ElementStyle="{StaticResource  DataGridTextColumnCenterSytle}" />
                                <DataGridTemplateColumn Header="操作" Width="1*">
                                    <DataGridTemplateColumn.CellTemplate>
                                        <DataTemplate>
                                            <Button Content="开始生产" Height="40" Width="100"  Command="{Binding DataContext.UpdateCommand, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"
                    CommandParameter="{Binding}"/>
                                        </DataTemplate>
                                    </DataGridTemplateColumn.CellTemplate>
                                </DataGridTemplateColumn>
                            </DataGrid.Columns>
                        </DataGrid>


                    </UniformGrid>

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


</UserControl>
