<Page x:Class="WSDDBBrowser.PgMonitorChartConfig"
      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:WSDDBBrowser"
      xmlns:conv="clr-namespace:WSDDBBrowser.Converter"
        xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
      xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
      mc:Ignorable="d" 
       d:DesignWidth="1024"
        d:DesignHeight="768"
      Title="PgMonitorChartConfig">
    <Page.Resources>
        <local:PgMonitorChartConfigViewModel_UnitTest x:Key="viewModel"/>

    </Page.Resources>
    <Grid d:DataContext="viewModel">
        <ScrollViewer HorizontalScrollBarVisibility="Visible">

            <WrapPanel Orientation="Horizontal" TextBlock.Foreground="{DynamicResource TextBrush}" Margin="{StaticResource ControlMargin}">
                <StackPanel >
                            <StackPanel Orientation="Horizontal">
                                <iconPacks:PackIconMaterialLight VerticalAlignment="Center" Kind="FormatFloatLeft" Margin="{StaticResource ControlMargin}"/>
                                <TextBlock Text="基本产品信息" Style="{StaticResource h1}" Margin="{StaticResource ControlMargin}"/>
                            </StackPanel>
                            <StackPanel Orientation="Vertical" Margin="{StaticResource ControlMargin}" DataContext="{Binding Process}">
                        <StackPanel Orientation="Horizontal" Margin="{StaticResource ControlMargin}">
                            <TextBlock Style="{StaticResource TitleStyle}" Text="订单号:" />
                            <TextBlock Style="{StaticResource ValueTextBlockStyle}" Text="{Binding cOrderNo}"/>
                        </StackPanel>
                        <StackPanel Orientation="Horizontal" Margin="{StaticResource ControlMargin}">
                            <TextBlock Style="{StaticResource TitleStyle}" Text="项目号:" />
                            <TextBlock Style="{StaticResource ValueTextBlockStyle}" Text="{Binding cProjectNo}"/>
                        </StackPanel>

                        <StackPanel Orientation="Horizontal" Margin="{StaticResource ControlMargin}">
                            <TextBlock Style="{StaticResource TitleStyle}" Text="工艺号:"/>
                            <TextBlock Style="{StaticResource ValueTextBlockStyle}" Text="{Binding cTechnologyNo}"/>
                        </StackPanel>
                        <StackPanel Orientation="Vertical" Margin="{StaticResource ControlMargin}">
                            <TextBlock Style="{StaticResource TitleStyle}" Text="总生产时间:" />
                            <TextBlock Style="{StaticResource ValueTextBlockStyle}" >
                                    <Run Text="{Binding tBeginTime,StringFormat={}{0:MM-dd HH:mm}}" />
                                    <Run Text="至" FontSize="16"/>
                                    <Run Text="{Binding tEndTime,StringFormat={}{0:MM-dd HH:mm}}" />
                            </TextBlock>
                        </StackPanel>
                        <StackPanel Orientation="Horizontal" Margin="{StaticResource ControlMargin}">
                            <TextBlock Style="{StaticResource TitleStyle}" Text="总记录码数:" />
                            <TextBlock Style="{StaticResource ValueTextBlockStyle}" Text="{Binding nTotalLen,StringFormat={}{0:F2}}"/>
                        </StackPanel>
                        <StackPanel Margin="{StaticResource ControlMargin}">
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Style="{StaticResource TitleStyle}" Text="备注" />
                                <TextBlock Style="{StaticResource ValueTextBlockStyle}" Text="{Binding tRemarksLT}" />
                            </StackPanel>
                            <TextBox Text="{Binding cRemarks}" TextWrapping="Wrap" Height="120" IsEnabled="False"/>
                        </StackPanel>
                    </StackPanel>

                </StackPanel>
                        

                <StackPanel >
                    <StackPanel >
                        <StackPanel Orientation="Horizontal">
                            <iconPacks:PackIconMaterial VerticalAlignment="Center" Kind="FormatListNumbered" Margin="{StaticResource ControlMargin}"/>
                            <TextBlock Text="卷号表" Style="{StaticResource h2}" Margin="{StaticResource ControlMargin}"/>
                        </StackPanel>
                        <DataGrid FontSize="13" Margin="{StaticResource ControlMargin}" AutoGenerateColumns="False" HeadersVisibility="All"
                                      ItemsSource="{Binding Numbers}" RowHeaderWidth="20" SelectionUnit="FullRow" IsReadOnly="True">
                            <DataGrid.Columns>
                                <DataGridTextColumn Binding="{Binding cNumber}" Header="卷号" />
                                <DataGridTextColumn Binding="{Binding tBeginTime,StringFormat={}{0:HH:mm}}" Header="开始时间" />
                                <DataGridTextColumn Binding="{Binding tEndTime,StringFormat={}{0:H:mm}}" Header="结束时间" />
                                <DataGridTextColumn Binding="{Binding nBeginLen,StringFormat={}{0:F1}}" Header="开始位置" />
                                <DataGridTextColumn Binding="{Binding nEndLen,StringFormat={}{0:F1}}" Header="结束位置" />
                            </DataGrid.Columns>
                            <DataGrid.Style>
                                <Style BasedOn="{StaticResource MetroDataGrid}" TargetType="{x:Type DataGrid}">
                                    <Setter Property="AlternatingRowBackground" Value="{DynamicResource GrayBrush10}" />
                                </Style>
                            </DataGrid.Style>
                            <DataGrid.RowValidationRules/>
                        </DataGrid>


                    </StackPanel>
                    <StackPanel >
                        <StackPanel Orientation="Horizontal">
                            <iconPacks:PackIconMaterial VerticalAlignment="Center" Kind="FormatListNumbered" Margin="{StaticResource ControlMargin}"/>
                            <TextBlock Text="操作员表" Style="{StaticResource h2}" Margin="{StaticResource ControlMargin}"/>
                        </StackPanel>
                        <DataGrid FontSize="13" Margin="{StaticResource ControlMargin}" AutoGenerateColumns="False" HeadersVisibility="All"
                                      ItemsSource="{Binding Users}" RowHeaderWidth="20" SelectionUnit="FullRow" IsReadOnly="True">
                            <DataGrid.Columns>
                                <DataGridTextColumn Binding="{Binding cUserName}" Header="用户名" />
                                <DataGridTextColumn Binding="{Binding tBeginTime,StringFormat={}{0:HH:mm}}" Header="开始时间" />
                                <DataGridTextColumn Binding="{Binding tEndTime,StringFormat={}{0:HH:mm}}" Header="结束时间" />
                            </DataGrid.Columns>
                            <DataGrid.Style>
                                <Style BasedOn="{StaticResource MetroDataGrid}" TargetType="{x:Type DataGrid}">
                                    <Setter Property="AlternatingRowBackground" Value="{DynamicResource GrayBrush10}" />
                                </Style>
                            </DataGrid.Style>
                            <DataGrid.RowValidationRules/>
                        </DataGrid>


                    </StackPanel>
                    <StackPanel >
                        <StackPanel Orientation="Horizontal">
                            <iconPacks:PackIconMaterial VerticalAlignment="Center" Kind="Calculator" Margin="{StaticResource ControlMargin}"/>
                            <TextBlock Text="统计" FontSize="24" Margin="{StaticResource ControlMargin}"/>
                        </StackPanel>
                        <DataGrid FontSize="13" Margin="{StaticResource ControlMargin}" AutoGenerateColumns="False" HeadersVisibility="All"
                                      ItemsSource="{Binding RecordCollections}" RowHeaderWidth="20" SelectionUnit="FullRow" IsReadOnly="True">
                            <DataGrid.Columns>
                                <DataGridTextColumn Binding="{Binding DeviceID}" Header="设备ID" />
                                <DataGridTextColumn Binding="{Binding DeviceName}" Header="设备名称" />
                                <DataGridTextColumn Binding="{Binding Target,StringFormat={}{0:F1}}" Header="目标值" />
                                <DataGridTextColumn Binding="{Binding Tolerance,StringFormat={}{0:F1}}" Header="公差" />
                                <DataGridTextColumn Binding="{Binding Average,StringFormat={}{0:F1}}" Header="平均值" />
                                <DataGridTextColumn Binding="{Binding Sigma3,StringFormat={}{0:F1}}" >
                                    <DataGridTextColumn.Header>
                                        <TextBlock Text="3σ" HorizontalAlignment="Center"/>
                                    </DataGridTextColumn.Header>
                                </DataGridTextColumn>
                                <DataGridTextColumn Binding="{Binding IsError}" Header="是否超限" />
                            </DataGrid.Columns>
                            <DataGrid.Style>
                                <Style BasedOn="{StaticResource MetroDataGrid}" TargetType="{x:Type DataGrid}">
                                    <Setter Property="AlternatingRowBackground" Value="{DynamicResource GrayBrush10}" />
                                </Style>
                            </DataGrid.Style>
                            <DataGrid.RowValidationRules/>
                        </DataGrid>


                    </StackPanel>

                </StackPanel>
            </WrapPanel>
        </ScrollViewer>

    </Grid>
</Page>