<UserControl x:Class="SlnMesnac.WPF.Page.ProdStatisticsPage"
             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:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:lvc="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf"
             xmlns:local="clr-namespace:SlnMesnac.WPF.Page"
              xmlns:cvt="clr-namespace:SlnMesnac.WPF.ConvertTo"
             mc:Ignorable="d" 
             d:DesignHeight="750" d:DesignWidth="1920" Background="Transparent">
    <UserControl.Resources>
        <cvt:MultiBindingConverter x:Key="QueryConvert"></cvt:MultiBindingConverter>
        <!-- 定义样式 -->
        <Style x:Key="CustomDatePicker" TargetType="DatePicker">

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


        </Style>


        <!-- 定义日历的样式 -->
        <Style x:Key="CustomCalendarStyle" TargetType="Calendar">
            <!-- 设置背景颜色 -->
            <Setter Property="Background" Value="White"></Setter>
            <!-- 设置边框颜色 -->
            <Setter Property="BorderBrush" Value="Blue"></Setter>

            <Setter Property="Width" Value="350"></Setter>
            <Setter Property="Height" Value="250"></Setter>
            <!-- 设置字体样式 -->
            <Setter Property="FontSize" Value="16"></Setter>
        </Style>


    </UserControl.Resources>
    
    <Grid Margin="5,5">
       

        <Grid.ColumnDefinitions>
            <ColumnDefinition/>
            <ColumnDefinition/>
        </Grid.ColumnDefinitions>

        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="6*"/>
            <RowDefinition Height="6*"/>
        </Grid.RowDefinitions>

        <Border Grid.Row="0" Grid.Column="0" BorderBrush="#1254AB" BorderThickness="2" CornerRadius="5" Background="Transparent" Margin="1,1,5,5">
            <WrapPanel HorizontalAlignment="Left" VerticalAlignment="Center">
                <TextBlock Text="开始时间"   Margin="10 0" Foreground="White" FontSize="20"  VerticalAlignment="Center"/>

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

                </DatePicker>

                <TextBlock Text="结束时间" Margin="10 0" Foreground="White" FontSize="20"  VerticalAlignment="Center"/>
                <DatePicker  Style="{StaticResource CustomDatePicker}"
            x:Name="EndTime"  Margin="10 0"  
            Width="170"  BorderBrush="White" FontSize="20"
            materialDesign:CalendarAssist.IsHeaderVisible="False"
            CalendarStyle="{StaticResource CustomCalendarStyle}">
                    <!-- 添加这一行 -->
                    <DatePicker.SelectedDate>
                        <Binding
                        Path="EndDate"
                        UpdateSourceTrigger="PropertyChanged">
                            <Binding.ValidationRules>
                            </Binding.ValidationRules>
                        </Binding>
                    </DatePicker.SelectedDate>
                </DatePicker>

                <Button Margin="10 0"
                            Content="时间查询"  Command="{Binding QueryCommand}"
                            Style="{StaticResource BUTTON_AGREE}" Background="LimeGreen">
                    <!--<Button.CommandParameter>
                        <MultiBinding Converter="{StaticResource QueryConvert}">
                            <Binding ElementName="BeginTime" Path="Text"/>
                            <Binding ElementName="EndTime"  Path="Text"/>
                        </MultiBinding>
                    </Button.CommandParameter>-->
                </Button>
            </WrapPanel>
        </Border>
                <Border Grid.Row="1" Grid.Column="0" BorderBrush="#1254AB" BorderThickness="2" CornerRadius="5" Background="Transparent" Margin="1,1,5,5">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="1*"/>
                    <RowDefinition Height="9*"/>

                </Grid.RowDefinitions>
                <Border Grid.Row="0" BorderBrush="CadetBlue" BorderThickness="0,0,0,0" CornerRadius="0" Background="Transparent" Margin="1,6,5,5" >
                    <TextBlock Text="投料记录" FontSize="20" FontWeight="Bold" Foreground="#0288d1" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                </Border>

                <!--计划列表-->
                <Border Grid.Row="1" Grid.Column="0" BorderBrush="Green" BorderThickness="0" CornerRadius="5" Background="Transparent" Margin="1,1,5,5">
                    <DataGrid Grid.Row="0" ItemsSource="{Binding WmsRawOutstockDetailDataGrid}" Background="Transparent" 
          FontSize="15" ColumnHeaderHeight="35" 
          RowHeight="50" AutoGenerateColumns="False" RowHeaderWidth="0" 
          GridLinesVisibility="None" ScrollViewer.HorizontalScrollBarVisibility="Hidden" 
          ScrollViewer.VerticalScrollBarVisibility="Visible" BorderThickness="0" CanUserAddRows="False" HorizontalAlignment="Center"
          Foreground="White" >
                        <DataGrid.Resources>
                            <!-- 定制 ScrollBar 样式 -->
                            <Style TargetType="ScrollBar">
                                <Setter Property="Background" Value="Transparent"/>
                              
                            </Style>
                        </DataGrid.Resources>

                        <!--resourceStyle 399行修改选中字体颜色-->
                        <DataGrid.Columns>
                            <DataGridTextColumn Binding="{Binding RawOutstockDetailId}" Header="序号" Width="1*" IsReadOnly="True"/>
                            <DataGridTextColumn Binding="{Binding LocationCode}" Header="库位编号" Width="2*" IsReadOnly="True"/>
                            <DataGridTextColumn Binding="{Binding MaterialBarcode}" Header="原材料条码" Width="4*" IsReadOnly="True"/>
                            <DataGridTextColumn Binding="{Binding OutstockTime ,StringFormat=\{0:MM月dd日 HH:mm:ss\}}" Header="出库时间" Width="2*" IsReadOnly="True"/>
 
                        </DataGrid.Columns>
                    </DataGrid>
                </Border>
            </Grid>
        </Border>
        <Border Grid.Row="1" Grid.Column="1" BorderBrush="#1254AB" BorderThickness="2" CornerRadius="5" Background="Transparent" Margin="1,1,5,5">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="1*"/>
                    <RowDefinition Height="9*"/>

                </Grid.RowDefinitions>
                <Border Grid.Row="0" BorderBrush="CadetBlue" BorderThickness="0,0,0,0" CornerRadius="0" Background="Transparent" Margin="1,6,5,5" >
                    <TextBlock Text="产出记录" FontSize="20" FontWeight="Bold" Foreground="#0288d1" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                </Border>

                <!--计划列表-->
                <Border Grid.Row="1" Grid.Column="0" BorderBrush="Green" BorderThickness="0" CornerRadius="5" Background="Transparent" Margin="1,1,5,5">
                    <DataGrid Grid.Row="0" ItemsSource="{Binding ProductDataGrid}" Background="Transparent" 
          FontSize="15" ColumnHeaderHeight="35" 
          RowHeight="50" AutoGenerateColumns="False" RowHeaderWidth="0" 
          GridLinesVisibility="None" ScrollViewer.HorizontalScrollBarVisibility="Hidden" 
          ScrollViewer.VerticalScrollBarVisibility="Visible" BorderThickness="0" CanUserAddRows="False" HorizontalAlignment="Center"
          Foreground="White" >
                        <DataGrid.Resources>
                            <!-- 定制 ScrollBar 样式 -->
                            <Style TargetType="ScrollBar">
                                <Setter Property="Background" Value="Transparent"/>

                            </Style>
                        </DataGrid.Resources>

                        <!--resourceStyle 399行修改选中字体颜色-->
                        <DataGrid.Columns>
                            <DataGridTextColumn Binding="{Binding productInstockId}" Header="序号" Width="1*" IsReadOnly="True"/>
                            <DataGridTextColumn Binding="{Binding locationCode}" Header="库位编号" Width="2*" IsReadOnly="True"/>
                            <DataGridTextColumn Binding="{Binding productBatch}" Header="成品条码" Width="4*" IsReadOnly="True"/>
                            <DataGridTextColumn Binding="{Binding updateDate ,StringFormat=\{0:MM月dd日 HH:mm:ss\}}" Header="生产时间" Width="2*" IsReadOnly="True"/>

                        </DataGrid.Columns>
                    </DataGrid>
                </Border>
            </Grid>
        </Border>
        <Border Grid.Row="2" Grid.Column="0" BorderBrush="#1254AB" BorderThickness="2" CornerRadius="5" Background="Transparent" Margin="1,1,5,5">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="1*"/>
                    <RowDefinition Height="9*"/>
                </Grid.RowDefinitions>
                <Border Grid.Row="0" BorderBrush="CadetBlue" BorderThickness="0,0,0,0" CornerRadius="0" Background="Transparent" Margin="1,6,5,5" >
                    <TextBlock Text="日投料统计图" FontSize="20" FontWeight="Bold" Foreground="#0288d1" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                </Border>
                <Border Grid.Row="1" BorderBrush="#0288d1" BorderThickness="0" CornerRadius="5" Background="Transparent" >
                    <lvc:CartesianChart Series="{Binding OutAchievement, UpdateSourceTrigger=PropertyChanged}"   LegendLocation="Top" Foreground="White" DisableAnimations="True">
                        <lvc:CartesianChart.DataTooltip >
                            <lvc:DefaultTooltip SelectionMode="OnlySender"  BulletSize="10" Foreground="Black"></lvc:DefaultTooltip>
                        </lvc:CartesianChart.DataTooltip>
                        <lvc:CartesianChart.AxisX >
                            <lvc:Axis Labels="{Binding OutDayList}" FontSize="18" Foreground="White" LabelsRotation="0"  DisableAnimations="True" Position="LeftBottom" >
                                <lvc:Axis.Separator>
                                    <lvc:Separator Visibility="Hidden" Step="1" StrokeThickness="1.5" StrokeDashArray="0" Stroke="#404F56" >
                                    </lvc:Separator>
                                </lvc:Axis.Separator>
                            </lvc:Axis>
                        </lvc:CartesianChart.AxisX>
                        <lvc:CartesianChart.AxisY>
                            <lvc:Axis FontSize="18" Foreground="White" MinValue="0">
                                <lvc:Axis.Separator>
                                    <lvc:Separator Step="10" Visibility="Hidden" StrokeThickness="1" StrokeDashArray="3"  Stroke="#404F56" >
                                    </lvc:Separator>
                                </lvc:Axis.Separator>
                            </lvc:Axis>
                        </lvc:CartesianChart.AxisY>
                    </lvc:CartesianChart>


                </Border>

            </Grid>
        </Border>
        <Border Grid.Row="2" Grid.Column="1" BorderBrush="#1254AB" BorderThickness="2" CornerRadius="5" Background="Transparent" Margin="1,1,5,5">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="1*"/>
                    <RowDefinition Height="9*"/>
                </Grid.RowDefinitions>
                <Border Grid.Row="0" BorderBrush="CadetBlue" BorderThickness="0,0,0,0" CornerRadius="0" Background="Transparent" Margin="1,6,5,5" >
                    <TextBlock Text="日生产统计图" FontSize="20" FontWeight="Bold" Foreground="#0288d1" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                </Border>
                <Border Grid.Row="1" BorderBrush="#0288d1" BorderThickness="0" CornerRadius="5" Background="Transparent" >
                    <lvc:CartesianChart Series="{Binding ProductAchievement, UpdateSourceTrigger=PropertyChanged}"   LegendLocation="Top" Foreground="White" DisableAnimations="True">
                        <lvc:CartesianChart.DataTooltip >
                            <lvc:DefaultTooltip SelectionMode="OnlySender"  BulletSize="10" Foreground="Black"></lvc:DefaultTooltip>
                        </lvc:CartesianChart.DataTooltip>
                        <lvc:CartesianChart.AxisX >
                            <lvc:Axis Labels="{Binding ProductDayList}" FontSize="18" Foreground="White" LabelsRotation="0"  DisableAnimations="True" Position="LeftBottom" >
                                <lvc:Axis.Separator>
                                    <lvc:Separator Visibility="Hidden" Step="1" StrokeThickness="1.5" StrokeDashArray="0" Stroke="#404F56" >
                                    </lvc:Separator>
                                </lvc:Axis.Separator>
                            </lvc:Axis>
                        </lvc:CartesianChart.AxisX>
                        <lvc:CartesianChart.AxisY>
                            <lvc:Axis FontSize="18" Foreground="White" MinValue="0">
                                <lvc:Axis.Separator>
                                    <lvc:Separator Step="10" Visibility="Hidden" StrokeThickness="1" StrokeDashArray="3"  Stroke="#404F56" >
                                    </lvc:Separator>
                                </lvc:Axis.Separator>
                            </lvc:Axis>
                        </lvc:CartesianChart.AxisY>
                    </lvc:CartesianChart>


                </Border>

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