<UserControl x:Class="SlnMesnac.WPF.Page.ProdMgmtPage"
             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:lvc="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf"
             xmlns:local="clr-namespace:SlnMesnac.WPF.Page"
             xmlns:local1="clr-namespace:SlnMesnac.WPF.Converter.ProdMgmt"
             mc:Ignorable="d" 
             d:DesignHeight="1080" d:DesignWidth="1920" Background="Transparent">

    
        <Control.Resources>
        <local1:PlanStatusConverter x:Key="PlanStatusConverter" />
        <local1:PlanAmountConverter x:Key="PlanAmountConverter" />


      
    </Control.Resources>
    <Grid Margin="5,5">
        <Grid.ColumnDefinitions>
            <ColumnDefinition/>
            <ColumnDefinition/>
        </Grid.ColumnDefinitions>

        <Grid.RowDefinitions>
            <RowDefinition/>
            <RowDefinition/>
        </Grid.RowDefinitions>

        <Border Grid.Row="0" Grid.Column="0" BorderBrush="#1254AB" BorderThickness="2" CornerRadius="5" Background="Transparent" Margin="1,1,5,5">
            <Border.Effect>
                <DropShadowEffect Color="#1254AB" Direction="270" BlurRadius="10" ShadowDepth="5" Opacity="0.5"/>
            </Border.Effect>
            <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="Green" BorderThickness="0" CornerRadius="5" Background="Transparent" Margin="1,1,5,5">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="7*"/>
                            <ColumnDefinition Width="5*"/>
                            <ColumnDefinition Width="1*"/>
                        </Grid.ColumnDefinitions>
                        <Border Grid.Column="0" BorderBrush="Red" BorderThickness="0" Background="Transparent" CornerRadius="5" >
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition/>
                                    <RowDefinition/>
                                    <RowDefinition/>
                                    <RowDefinition/>
                                    <RowDefinition/>
                                    <RowDefinition/>
                                </Grid.RowDefinitions>
                                <StackPanel Grid.Row="0" Grid.Column="0" Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center" >
                                    <TextBlock Text="工位名称" FontSize="15" Foreground="#FFFFFF"/>
                                    <TextBox FontSize="15" Text="{Binding StationName}" Foreground="#FFFFFF" Width="200" IsReadOnly="True" Margin="30,0,0,0"/>
                                </StackPanel>

                                <StackPanel Grid.Row="1" Grid.Column="0" Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center" >
                                    <TextBlock Text="订单编号" FontSize="15" Foreground="#FFFFFF"/>
                                    <TextBox FontSize="15" Text="{Binding OrderCode}" Foreground="#FFFFFF" Width="200" IsReadOnly="True" Margin="30,0,0,0"/>
                                </StackPanel>

                                <StackPanel Grid.Row="2" Grid.Column="0" Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center" >
                                    <TextBlock Text="计划编号" FontSize="15" Foreground="#FFFFFF"/>
                                    <TextBox FontSize="15" Text="{Binding PlanCode}" Foreground="#FFFFFF" Width="200" IsReadOnly="True" Margin="30,0,0,0"/>
                                </StackPanel>

                                <StackPanel Grid.Row="3" Grid.Column="0" Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center" >
                                    <TextBlock Text="产品型号" FontSize="15" Foreground="#FFFFFF"/>
                                    <TextBox FontSize="15" Text="{Binding ProductModel}" Foreground="#FFFFFF" Width="200" IsReadOnly="True" Margin="30,0,0,0"/>
                                </StackPanel>

                                <StackPanel Grid.Row="4" Grid.Column="0" Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center" >
                                    <TextBlock Text="开始时间" FontSize="15" Foreground="#FFFFFF"/>
                                    <TextBox FontSize="15" Text="{Binding BeginTime}" Foreground="#FFFFFF" Width="200" IsReadOnly="True" Margin="30,0,0,0"/>
                                </StackPanel>
                            </Grid>
                        </Border>

                        <Border Grid.Column="1" BorderBrush="Red" BorderThickness="0" Background="Transparent" CornerRadius="5" Margin="0,10,0,0">
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="4*"/>
                                    <RowDefinition Height="4*"/>
                                    <RowDefinition Height="2*"/>
                                </Grid.RowDefinitions>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition/>
                                    <ColumnDefinition/>
                                </Grid.ColumnDefinitions>
                                <Border Grid.Row="0" Grid.Column="0" BorderBrush="CadetBlue" BorderThickness="0" CornerRadius="5" Margin="0,0,5,5">
                                    <Grid>
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="2*"/>
                                            <RowDefinition Height="7*"/>
                                        </Grid.RowDefinitions>
                                        <Border Grid.Row="0" BorderBrush="CadetBlue" BorderThickness="0" CornerRadius="0" Background="Transparent" Margin="1,1,5,5" >
                                            <TextBlock Text="计划数量" FontSize="15" FontWeight="Bold" Foreground="#0288d1" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                                        </Border>
                                        <Border Grid.Row="1" BorderBrush="CadetBlue" BorderThickness="0" CornerRadius="0" Background="Transparent" Margin="1,1,5,5" >
                                            <lvc:Gauge Margin="5" Uses360Mode="True" From="0" To="100" Value="{Binding PlanAmount}" Foreground="#0288d1"/>
                                        </Border>
                                    </Grid>
                                </Border>

                                <Border Grid.Row="0" Grid.Column="1" BorderBrush="CadetBlue" BorderThickness="0" CornerRadius="5" Margin="5,0,0,5">
                                    <Grid>
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="2*"/>
                                            <RowDefinition Height="7*"/>
                                        </Grid.RowDefinitions>
                                        <Border Grid.Row="0" BorderBrush="CadetBlue" BorderThickness="0" CornerRadius="0" Background="Transparent" Margin="1,1,5,5" >
                                            <TextBlock Text="实际数量" FontSize="15" FontWeight="Bold" Foreground="#0288d1" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                                        </Border>
                                        <Border Grid.Row="1" BorderBrush="CadetBlue" BorderThickness="0" CornerRadius="0" Background="Transparent" Margin="1,1,5,5" >
                                            <lvc:Gauge Margin="5" Uses360Mode="True" From="0" To="100" Value="{Binding ComplateAmout}" Foreground="#0288d1"/>
                                        </Border>
                                    </Grid>
                                </Border>

                                <Border Grid.Row="1" Grid.Column="0" BorderBrush="CadetBlue" BorderThickness="0" CornerRadius="5" Margin="0,5,5,0">
                                    <Grid>
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="2*"/>
                                            <RowDefinition Height="7*"/>
                                        </Grid.RowDefinitions>
                                        <Border Grid.Row="0" BorderBrush="CadetBlue" BorderThickness="0" CornerRadius="0" Background="Transparent" Margin="1,1,5,5" >
                                            <TextBlock Text="差异数量" FontSize="15" FontWeight="Bold" Foreground="#0288d1" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                                        </Border>
                                        <Border Grid.Row="1" BorderBrush="CadetBlue" BorderThickness="0" CornerRadius="0" Background="Transparent" Margin="1,1,5,5" >
                                            <lvc:Gauge Margin="5" Uses360Mode="True" From="0" To="100" Value="{Binding DiffAmount}" Foreground="#0288d1"/>
                                        </Border>
                                    </Grid>
                                </Border>

                                <Border Grid.Row="1" Grid.Column="1" BorderBrush="CadetBlue" BorderThickness="0" CornerRadius="5" Margin="5,5,0,0">
                                    <Grid>
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="2*"/>
                                            <RowDefinition Height="7*"/>
                                        </Grid.RowDefinitions>
                                        <Border Grid.Row="0" BorderBrush="CadetBlue" BorderThickness="0" CornerRadius="0" Background="Transparent" Margin="1,1,5,5" >
                                            <TextBlock Text="完成率" FontSize="15" FontWeight="Bold" Foreground="#0288d1" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                                        </Border>
                                        <Border Grid.Row="1" BorderBrush="CadetBlue" BorderThickness="0" CornerRadius="0" Background="Transparent" Margin="1,1,5,5" >
                                            <lvc:Gauge Margin="5" Uses360Mode="True" From="0" To="100" Value="{Binding CompleRoution}" Foreground="#0288d1"/>
                                        </Border>
                                    </Grid>
                                </Border>
                            </Grid>
                        </Border>
                    </Grid>
                </Border>
            </Grid>
        </Border>

        <Border Grid.Row="0" Grid.Column="1" BorderBrush="#1254AB" BorderThickness="2" CornerRadius="5" Background="Transparent" Margin="1,1,5,5">
            <Border.Effect>
                <DropShadowEffect Color="#1254AB" Direction="270" BlurRadius="10" ShadowDepth="5" Opacity="0.5"/>
            </Border.Effect>
            <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="Green" BorderThickness="0" CornerRadius="5" Background="Transparent" Margin="1,1,5,5">
                    <Border Grid.Row="1" BorderBrush="#0288d1" BorderThickness="0" CornerRadius="5" Background="Transparent" >
                        <lvc:CartesianChart Series="{Binding Achievement, 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 ProductionHourList}" 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>

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

        <Border Grid.Row="1" Grid.Column="0" BorderBrush="#1254AB" BorderThickness="2" CornerRadius="5" Background="Transparent" Margin="1,1,5,5">
            <Border.Effect>
                <DropShadowEffect Color="#1254AB" Direction="270" BlurRadius="10" ShadowDepth="5" Opacity="0.5"/>
            </Border.Effect>
            <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 PlanInfoDataGrid}" Background="Transparent" 
                      FontSize="15" ColumnHeaderHeight="35" 
                      RowHeight="31" AutoGenerateColumns="False" RowHeaderWidth="0" 
                      GridLinesVisibility="None" ScrollViewer.HorizontalScrollBarVisibility="Hidden" 
                      ScrollViewer.VerticalScrollBarVisibility="Hidden" BorderThickness="0" CanUserAddRows="False" HorizontalAlignment="Center"
                      Foreground="#FFFFFF" >
                        <!--resourceStyle 399行修改选中字体颜色-->
                        <DataGrid.Columns>
                            <DataGridTextColumn Binding="{Binding PlanCode}" Header="计划编号" Width="2*" IsReadOnly="True"/>
                            <DataGridTextColumn Binding="{Binding MaterialName}" Header="物料型号" Width="1.5*" IsReadOnly="True"/>
                            <DataGridTextColumn Binding="{Binding PlanAmount,Converter={StaticResource PlanAmountConverter}}" Header="计划数量" Width="1*" IsReadOnly="True"/>
                            <DataGridTextColumn Binding="{Binding CompleteAmount,Converter={StaticResource PlanAmountConverter}}" Header="完成数量" Width="1*" IsReadOnly="True"/>
                            <DataGridTextColumn Binding="{Binding PlanStatus,Converter={StaticResource PlanStatusConverter}}" Header="计划状态" Width="1*" IsReadOnly="True"/>
                            <DataGridTextColumn Binding="{Binding PlanBeginTime ,StringFormat=\{0:MM月dd日 HH:mm\}}" Header="开始时间" Width="1.5*" IsReadOnly="True"/>
                            <!--<DataGridTextColumn Binding="{Binding RealEndTime ,StringFormat=\{0:MM月dd日 HH:mm\}}" Header="完成时间" Width="1*" IsReadOnly="True"/>-->
                            <DataGridTemplateColumn Header="操作" Width="2*">
                                <DataGridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <StackPanel Orientation="Horizontal">
                                            <Button Content="开始" CommandParameter="{Binding PlanCode}" IsEnabled="{Binding StartEnable}"  Background="LimeGreen" Foreground="Gray" Margin="10,0,0,0" Height="25" BorderBrush="DeepSkyBlue" BorderThickness="0" Width="45" Command="{Binding DataContext.StartProdPlanCommand, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=DataGrid  }}"/>
                                            <Button Content="暂停" CommandParameter="{Binding PlanCode}" IsEnabled="{Binding StopEnable}" Background="Red" Foreground="Gray" Margin="10,0,0,0" Height="25" BorderBrush="DeepSkyBlue" BorderThickness="0" Width="45" Command="{Binding DataContext.StopProdPlanCommand, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=DataGrid  }}" />
                                        </StackPanel>
                                    </DataTemplate>
                                </DataGridTemplateColumn.CellTemplate>

                            </DataGridTemplateColumn>
                        </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">
            <Border.Effect>
                <DropShadowEffect Color="#1254AB" Direction="270" BlurRadius="10" ShadowDepth="5" Opacity="0.5"/>
            </Border.Effect>
            <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,1,5,5" >
                    <TextBlock Text="系统监控" FontSize="20" FontWeight="Bold" Foreground="#0288d1" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                </Border>

                <!--型号统计-->
                <Border Grid.Row="1" BorderBrush="Green" BorderThickness="0" CornerRadius="5" Background="Transparent" Margin="1,6,5,5">
                    <ListBox x:Name="listBox" ItemsSource="{Binding LogInfoListBox}" FontSize="15" Foreground="#FFFFFF" Background="Transparent" BorderBrush="Transparent" ScrollViewer.HorizontalScrollBarVisibility="Hidden" ScrollViewer.VerticalScrollBarVisibility="Hidden"/>
                </Border>
            </Grid>
        </Border>
    </Grid>
</UserControl>
