|
- <UserControl
- x:Class="BPASmartClient.DosingSystem.View.RecipeControlView"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:con="clr-namespace:BPASmartClient.DosingSystem.Converter"
- xmlns:control="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource"
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:local="clr-namespace:BPASmartClient.DosingSystem.View"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource"
- xmlns:vm="clr-namespace:BPASmartClient.DosingSystem.ViewModel"
- d:DesignHeight="450"
- d:DesignWidth="800"
- mc:Ignorable="d">
-
- <UserControl.DataContext>
- <vm:RecipeControlViewModel x:Name="bingSource" />
- </UserControl.DataContext>
-
- <UserControl.Resources>
-
- <con:RunStatusConvert x:Key="RunStatusConvert" />
- <con:EnbleConvert x:Key="EnbleConvert"/>
- <con:IntToSourceConvert x:Key="IntToSourceConvert"/>
-
- <Style x:Key="UserItemContainerStyle" TargetType="ListBoxItem">
- <Style.Resources>
- <!-- SelectedItem with focus -->
- <SolidColorBrush
- x:Key="{x:Static SystemColors.HighlightBrushKey}"
- Opacity=".4"
- Color="White" />
- <!-- SelectedItem without focus -->
- <SolidColorBrush
- x:Key="{x:Static SystemColors.ControlBrushKey}"
- Opacity=".4"
- Color="White" />
- </Style.Resources>
- <!-- 设置触发器 -->
- <Style.Triggers>
- <Trigger Property="IsMouseOver" Value="true">
- <Setter Property="Background" Value="White" />
- <Setter Property="Foreground" Value="White" />
- </Trigger>
- <Trigger Property="IsFocused" Value="true">
- <Setter Property="Background" Value="White" />
- <Setter Property="Foreground" Value="White" />
- </Trigger>
- </Style.Triggers>
- </Style>
-
- <Style x:Key="RadioState" TargetType="RadioButton">
- <Setter Property="Margin" Value="1"/>
- <Setter Property="Background" Value="#002060" />
- <Setter Property="Foreground" Value="White" />
- <Setter Property="VerticalContentAlignment" Value="Bottom"/>
- <Setter Property="Margin" Value="2,5"/>
- <Setter Property="FontSize" Value="16" />
- <Setter Property="FontFamily" Value="Consolas" />
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="RadioButton">
- <Border CornerRadius="5" Background="{TemplateBinding Background}" Name="radiobutton" >
- <Grid>
- <Border x:Name="back_border" BorderThickness="0" BorderBrush="Black" CornerRadius="1">
- <Border.Effect>
- <BlurEffect Radius="2" KernelType="Gaussian"/>
- </Border.Effect>
- </Border>
- <Border x:Name="fore_border" BorderThickness="0" BorderBrush="White" Margin="2" Opacity="0.7" CornerRadius="{Binding ElementName=button, Path=CornerRadius}">
- <Border.Effect>
- <BlurEffect Radius="2" KernelType="Gaussian"/>
- </Border.Effect>
- </Border>
- <ContentPresenter TextBlock.FontSize="{TemplateBinding FontSize}" TextBlock.FontFamily="{TemplateBinding FontFamily}" TextBlock.Foreground="{TemplateBinding Foreground}" VerticalAlignment="Center" HorizontalAlignment="Center" Content="{TemplateBinding Content}"></ContentPresenter>
- </Grid>
- </Border>
-
- <ControlTemplate.Triggers>
- <Trigger Property="IsChecked" Value="True">
- <Setter TargetName="back_border" Property="BorderThickness" Value="1,0,1,1"/>
- <Setter TargetName="back_border" Property="CornerRadius" Value="5"/>
- <Setter TargetName="fore_border" Property="BorderThickness" Value="0,2,0,0"/>
- <Setter Property="Background" Value=" #4169E1"/>
-
- </Trigger>
- <Trigger Property="IsMouseOver" Value="True">
- <Setter Property="BorderBrush" TargetName="back_border" Value="white"/>
- <Setter TargetName="back_border" Property="BorderThickness" Value="1,1,1,1"/>
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
-
- </Setter.Value>
-
- </Setter>
-
- </Style>
- <Style TargetType="Button" x:Key="materialMakingButton">
- <Setter Property="Background" Value="Transparent"/>
- <Setter Property="FontSize" Value="16"/>
- <Setter Property="Foreground" Value="#CD5555"/>
- <Setter Property="BorderThickness" Value="0"/>
- <Setter Property="HorizontalAlignment" Value="Left"/>
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate>
- <Border x:Name="brState" BorderBrush="White" BorderThickness="0" Padding="2">
- <TextBlock x:Name="txState" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="1"
- Text="{Binding RecipeStatus, Converter={StaticResource RunStatusConvert} }" />
- </Border>
- <ControlTemplate.Triggers>
- <Trigger Property="IsEnabled" Value="True">
- <Setter TargetName="brState" Property="BorderThickness" Value="0" />
- <Setter TargetName="brState" Property="CornerRadius" Value="5" />
- <Setter TargetName="brState" Property="Background" Value="#F0FFFF"/>
- <Setter TargetName="txState" Property="Foreground" Value="#CD5555"/>
- </Trigger>
- <DataTrigger Binding="{Binding RecipeStatus}" Value="3">
- <Setter TargetName="brState" Property="Background" Value="#F0FFFF"/>
- <Setter TargetName="txState" Property="Foreground" Value="#3CB371"/>
- </DataTrigger>
- <DataTrigger Binding="{Binding RecipeStatus}" Value="2">
- <Setter TargetName="txState" Property="Foreground" Value="Aqua"/>
- </DataTrigger>
- <MultiTrigger>
- <MultiTrigger.Conditions>
- <Condition Property="IsMouseOver" Value="True"/>
- <Condition Property="IsEnabled" Value="True"/>
- </MultiTrigger.Conditions>
- <Setter Property="FontSize" TargetName="txState" Value="17 "/>
- </MultiTrigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
-
- </Setter.Value>
- </Setter>
- <Style.Triggers>
-
- </Style.Triggers>
-
- </Style>
-
- <DataTemplate x:Key="TreeItemTemplate" DataType="TreeViewItem">
- <Grid Margin="50,0,0,0" Height="28">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="*"></ColumnDefinition>
- <ColumnDefinition Width="*"></ColumnDefinition>
- </Grid.ColumnDefinitions>
- <TextBlock Text="原料:" Foreground="Aqua" FontSize="15" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10,0"/>
- <TextBlock Grid.Column="1" Text="{Binding RawMaterialName}" Foreground="Aqua" FontSize="15" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10,0"/>
- </Grid>
- </DataTemplate>
-
- <Style TargetType="TreeViewItem" x:Key="recipeTreeItem">
- <Setter Property="Background" Value="Transparent" />
- <Setter Property="IsExpanded" Value="True"></Setter>
- <Setter Property="HeaderTemplate">
- <Setter.Value>
- <HierarchicalDataTemplate ItemsSource="{Binding RawMaterials,Mode=TwoWay}" ItemTemplate="{StaticResource TreeItemTemplate}">
- <StackPanel Orientation="Horizontal" Height="28" VerticalAlignment="Center" HorizontalAlignment="Left">
- <TextBlock Text="配方:" Margin="5,0,0,0" FontSize="15" VerticalAlignment="Center" Foreground="White"/>
- <TextBlock Text="{Binding RecipeName}" Margin="5,0,0,0" FontSize="15" VerticalAlignment="Center" Foreground="White"/>
- </StackPanel>
- </HierarchicalDataTemplate>
- </Setter.Value>
- </Setter>
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type TreeViewItem}">
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto" />
- <ColumnDefinition Width="*" />
- </Grid.ColumnDefinitions>
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto" />
- <RowDefinition />
- </Grid.RowDefinitions>
- <VisualStateManager.VisualStateGroups>
- <VisualStateGroup x:Name="SelectionStates">
- <VisualState x:Name="Selected">
- <Storyboard>
- <ColorAnimationUsingKeyFrames Storyboard.TargetName="Bd" Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)" >
- <EasingColorKeyFrame KeyTime="0" Value="Transparent" />
- </ColorAnimationUsingKeyFrames>
- </Storyboard>
- </VisualState>
-
- <VisualState x:Name="Unselected" />
- <VisualState x:Name="SelectedInactive">
- <Storyboard>
- <ColorAnimationUsingKeyFrames Storyboard.TargetName="Bd" Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)">
- <EasingColorKeyFrame KeyTime="0" Value="Transparent" />
- </ColorAnimationUsingKeyFrames>
- </Storyboard>
- </VisualState>
- </VisualStateGroup>
- <VisualStateGroup x:Name="ExpansionStates">
- <VisualState x:Name="Expanded">
- <Storyboard>
- <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="ItemsHost">
- <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}" />
- </ObjectAnimationUsingKeyFrames>
- </Storyboard>
- </VisualState>
- <VisualState x:Name="Collapsed" />
- </VisualStateGroup>
- </VisualStateManager.VisualStateGroups>
- <Border x:Name="Bd" Grid.Column="0" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}">
- <ContentPresenter x:Name="PART_Header" ContentSource="Header" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"/>
- </Border>
- <ItemsPresenter x:Name="ItemsHost" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Visibility="Collapsed" />
- </Grid>
- <ControlTemplate.Triggers>
- <MultiTrigger>
- <MultiTrigger.Conditions>
- <Condition Property="HasHeader" Value="false" />
- <Condition Property="Width" Value="Auto" />
- </MultiTrigger.Conditions>
- <Setter TargetName="PART_Header" Property="MinWidth" Value="75" />
- </MultiTrigger>
- <MultiTrigger>
- <MultiTrigger.Conditions>
- <Condition Property="HasHeader" Value="false" />
- <Condition Property="Height" Value="Auto" />
- </MultiTrigger.Conditions>
- <Setter TargetName="PART_Header" Property="MinHeight" Value="19" />
- </MultiTrigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
-
-
-
-
-
- </UserControl.Resources>
-
- <Grid Margin="20">
-
- <Grid.ColumnDefinitions>
- <ColumnDefinition />
- <ColumnDefinition Width="0.2*" />
- </Grid.ColumnDefinitions>
-
- <ScrollViewer Grid.Column="0" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden">
-
- <ListView
- Margin="5"
- VerticalAlignment="Top"
- Background="Transparent"
- BorderThickness="0"
- ItemsSource="{Binding Recipes}"
- ScrollViewer.HorizontalScrollBarVisibility="Disabled">
- <ListView.ItemsPanel>
- <ItemsPanelTemplate>
- <UniformGrid
- HorizontalAlignment="Left"
- VerticalAlignment="Top"
- Columns="6" />
- </ItemsPanelTemplate>
- </ListView.ItemsPanel>
-
- <ListView.ItemTemplate>
- <DataTemplate>
- <Border Margin="5" Background="LightSkyBlue" Width="210">
- <Grid>
- <Grid.RowDefinitions>
- <RowDefinition />
- <RowDefinition Height="0.25*" />
- <RowDefinition Height="0.2*" />
- </Grid.RowDefinitions>
-
- <Image Source="/BPASmartClient.CustomResource;component/Image/AGV/炒锅.png" />
-
- <TextBlock
- Grid.Row="1"
- Margin="2,0,0,0"
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- Foreground="#dd000000"
- Text="{Binding RecipeName}" />
-
- <Grid
- Name="gr"
- Grid.Row="2"
- Height="30"
- Background="#00BEFA">
-
- <pry:IcoButton
- Width="{Binding ElementName=gr, Path=ActualWidth}"
- Height="{Binding ElementName=gr, Path=ActualHeight}"
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- BorderThickness="0"
- Command="{Binding DataContext.StartCommand, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}"
- CommandParameter="{Binding RecipeName}"
- Content="订单下发"
- EnterBackground="Red"
- FontStyle="Normal"
- Foreground="#dd000000"
- IcoText=""
- IsEnabled="{Binding IsEnable}"
- Style="{StaticResource IcoButtonStyle}" />
-
-
- </Grid>
-
- </Grid>
- </Border>
- </DataTemplate>
- </ListView.ItemTemplate>
- </ListView>
-
-
-
- <!--<ItemsControl ItemsSource="{Binding Recipes}">
- <ItemsControl.ItemTemplate>
- <DataTemplate>
- <Grid
- Height="150"
- Margin="0,0,0,50"
- VerticalAlignment="Top">
- <Border
- Name="ShadowElement"
- Height="150"
- VerticalAlignment="Top"
- BorderBrush="#00BEFA"
- BorderThickness="2"
- ClipToBounds="True"
- CornerRadius="8">
- <Border.Effect>
- <DropShadowEffect
- BlurRadius="18"
- ShadowDepth="0"
- Color="#00BEFA" />
- </Border.Effect>
- </Border>
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="200" />
- <ColumnDefinition />
- <ColumnDefinition Width="100" />
- </Grid.ColumnDefinitions>
-
- <Grid Margin="20,0,0,0">
- <Grid.RowDefinitions>
- <RowDefinition />
- <RowDefinition />
- </Grid.RowDefinitions>
- <TextBlock
- FontSize="40"
- Foreground="White"
- Text="{Binding RecipeName}" />
- <Button
- Grid.Row="1"
- Width="80"
- Height="30"
- HorizontalAlignment="Left"
- Background="#00BEFA"
- Command="{Binding DataContext.StartCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}"
- CommandParameter="{Binding RecipeName}"
- Content="配方下发"
- IsEnabled="{Binding IsEnable}" />
- </Grid>
-
- <ListView
- Grid.Column="1"
- Margin="10"
- Background="Transparent"
- BorderBrush="#00BEFA"
- BorderThickness="2,0,2,0"
- ItemsSource="{Binding RawMaterials}"
- ScrollViewer.HorizontalScrollBarVisibility="Disabled">
- <ListView.ItemsPanel>
- <ItemsPanelTemplate>
- <UniformGrid
- HorizontalAlignment="Left"
- VerticalAlignment="Top"
- Columns="4" />
- </ItemsPanelTemplate>
- </ListView.ItemsPanel>
-
- <ListView.ItemTemplate>
- <DataTemplate>
- <StackPanel
- Grid.Column="1"
- Height="20"
- Margin="20,0,0,0"
- VerticalAlignment="Top"
- Orientation="Horizontal">
- <Ellipse
- Width="{Binding ElementName=n, Path=ActualHeight}"
- Margin="0,0,5,0"
- Fill="{Binding RecipeStatus, Converter={StaticResource StatusConverter}}" />
- <TextBlock
- Name="n"
- FontSize="16"
- Foreground="White"
- Text="{Binding RawMaterialName}" />
-
- </StackPanel>
- </DataTemplate>
- </ListView.ItemTemplate>
- </ListView>
-
- <StackPanel
- Grid.Column="2"
- Margin="5,0"
- VerticalAlignment="Center">
- <StackPanel Margin="0,0,0,5" Orientation="Horizontal">
- <Ellipse
- Width="{Binding ElementName=tb, Path=ActualHeight}"
- Margin="0,0,5,0"
- Fill="Green" />
- <TextBlock
- Name="tb"
- Foreground="#ddd"
- Text="准备就绪" />
- </StackPanel>
- <StackPanel Margin="0,0,0,5" Orientation="Horizontal">
- <Ellipse
- Width="{Binding ElementName=tb, Path=ActualHeight}"
- Margin="0,0,5,0"
- Fill="Yellow" />
- <TextBlock
- Name="tb1"
- Foreground="#ddd"
- Text="等待接料" />
- </StackPanel>
- <StackPanel Margin="0,0,0,5" Orientation="Horizontal">
- <Ellipse
- Width="{Binding ElementName=tb, Path=ActualHeight}"
- Margin="0,0,5,0"
- Fill="Aqua" />
- <TextBlock
- Name="tb2"
- Foreground="#ddd"
- Text="接料完成" />
- </StackPanel>
- <StackPanel Margin="0,0,0,5" Orientation="Horizontal">
- <Ellipse
- Width="{Binding ElementName=tb, Path=ActualHeight}"
- Margin="0,0,5,0"
- Fill="Red" />
- <TextBlock
- Name="tb3"
- Foreground="#ddd"
- Text="设备异常" />
- </StackPanel>
- </StackPanel>
- </Grid>
- </Grid>
- </DataTemplate>
- </ItemsControl.ItemTemplate>
- </ItemsControl>-->
- </ScrollViewer>
-
- <Grid Grid.Column="1">
- <Grid.RowDefinitions>
- <RowDefinition Height="40" />
- <RowDefinition />
- </Grid.RowDefinitions>
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition/>
- <ColumnDefinition/>
- <ColumnDefinition/>
- </Grid.ColumnDefinitions>
- <RadioButton Content="等待中"
- Style="{DynamicResource RadioState}"
- GroupName="state"
- IsChecked="True"
- Command="{Binding ChangeRecipeStateCommand}"
- Click="RadioButtonWait_Click"/>
- <RadioButton Grid.Column="1"
- Content="执行中"
- Style="{DynamicResource RadioState}"
- GroupName="state"
- Click="RadioButtonMaking_Click"/>
- <RadioButton Grid.Column="2"
- Content="已完成"
- Style="{DynamicResource RadioState}"
- GroupName="state"
- Click="RadioButtonCompelete_Click"/>
-
- </Grid>
- <ScrollViewer Grid.Row="1" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden" >
- <Border Background="Transparent" BorderThickness="1" BorderBrush="White">
- <Grid Grid.Row="1">
- <Grid x:Name="repiceListMaking" Margin="5">
- <Grid.RowDefinitions>
- <RowDefinition Height="30"/>
- <RowDefinition/>
- </Grid.RowDefinitions>
- <TextBlock Text="{Binding CurrentRecipeName}" Foreground="White" FontSize="18" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10,0"/>
- <ItemsControl Grid.Row="1" ItemsSource="{Binding recipeProcesses}" Margin="50,0" Background="Transparent" BorderThickness="0">
- <ItemsControl.ItemTemplate>
- <DataTemplate>
- <Grid Margin="5">
- <Grid.ColumnDefinitions>
- <ColumnDefinition/>
- <ColumnDefinition Width="16"/>
- <ColumnDefinition/>
- </Grid.ColumnDefinitions>
- <TextBlock Text="{Binding RawMaterialName}"
- Foreground="Aqua"
- FontSize="15"
- VerticalAlignment="Center"
- HorizontalAlignment="Left"
- Margin="10,0,5,0"
- ToolTip="{Binding RawMaterialSource,Converter={StaticResource IntToSourceConvert}}" />
- <TextBlock Grid.Column="1" Text=":" Foreground="Aqua" FontSize="15" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="0,0,5,0"/>
- <Button Grid.Column="2" HorizontalAlignment="Center" VerticalAlignment="Center"
- Content="{Binding RecipeStatus, Converter={StaticResource RunStatusConvert}}"
- IsEnabled="{Binding RawMaterialSource, Converter={StaticResource EnbleConvert}}"
- Style="{StaticResource materialMakingButton}"
- Command="{Binding DataContext.ChangeRecipeStateCommand,RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}"
- CommandParameter="{Binding RawMaterialId}"/>
- </Grid>
- </DataTemplate>
- </ItemsControl.ItemTemplate>
-
- </ItemsControl>
-
- </Grid>
- <!--<TreeView x:Name="repiceListMaking" ItemsSource="{Binding RecipeProcesse}"
- ScrollViewer.VerticalScrollBarVisibility="Disabled" HorizontalAlignment="Stretch" Background="Wheat" ItemContainerStyle="{StaticResource recipeTreeItem}">
- </TreeView>-->
-
- <!--等待和已完成-->
- <TreeView x:Name="repiceList" ItemsSource="{Binding UserTreeWait}"
- ScrollViewer.VerticalScrollBarVisibility="Disabled" HorizontalAlignment="Stretch" Background="Transparent" ItemContainerStyle="{StaticResource recipeTreeItem}">
- </TreeView>
-
-
- </Grid>
- </Border>
- </ScrollViewer>
- </Grid>
-
- </Grid>
- </UserControl>
|