C00225155-02/C00225155/MegaRobo.C00225155/MegaRobo.C00225155App/MenuViews/FlowConfigView.xaml

150 lines
9.3 KiB
Plaintext
Raw Normal View History

2026-04-13 09:12:49 +00:00
<UserControl x:Class="MegaRobo.C00225155App.MenuViews.FlowConfigView"
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:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
xmlns:local="clr-namespace:MegaRobo.C00225155App.MenuViews"
xmlns:common="clr-namespace:Common;assembly=Common"
xmlns:models="clr-namespace:Common.Models;assembly=Common"
xmlns:converter="clr-namespace:MegaRobo.C00225155App.Converters"
mc:Ignorable="d" DataContext="{Binding FlowConfigVM, Source={StaticResource vmLocator}}"
d:DesignHeight="900" d:DesignWidth="1350">
<UserControl.Resources>
<ContextMenu x:Key="BottleGroupContextMenu">
<MenuItem Header="按照瓶1更新工装配方"
Command="{Binding PlacementTarget.Tag.UpdateSampleBoxPropertyCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}"
CommandParameter="{Binding PlacementTarget.DataContext.BoxId_inDosingStation, RelativeSource={RelativeSource AncestorType=ContextMenu}}"/>
<MenuItem Header="清空工装配方"
Command="{Binding PlacementTarget.Tag.ClearSampleBoxPropertyCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}"
CommandParameter="{Binding PlacementTarget.DataContext.BoxId_inDosingStation, RelativeSource={RelativeSource AncestorType=ContextMenu}}"/>
<Separator/>
<MenuItem Header="全置为空瓶"
Command="{Binding PlacementTarget.Tag.ResetAllSampleBottlesCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}"
CommandParameter="{Binding PlacementTarget.DataContext.BoxId_inDosingStation, RelativeSource={RelativeSource AncestorType=ContextMenu}}"/>
<MenuItem Header="全置为满瓶"
Command="{Binding PlacementTarget.Tag.FillAllSampleBottlesCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}"
CommandParameter="{Binding PlacementTarget.DataContext.BoxId_inDosingStation, RelativeSource={RelativeSource AncestorType=ContextMenu}}"/>
<MenuItem Header="清空"
Command="{Binding PlacementTarget.Tag.ResetSampleBottlesCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}"
CommandParameter="{Binding PlacementTarget.DataContext.BoxId_inDosingStation, RelativeSource={RelativeSource AncestorType=ContextMenu}}"/>
</ContextMenu>
<ContextMenu x:Key="TipHeadGroupContextMenu">
<MenuItem Header="全置为空"
Command="{Binding PlacementTarget.Tag.ResetAllTipHeadCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}"
CommandParameter="{Binding PlacementTarget.DataContext.BoxId_inDosingStation, RelativeSource={RelativeSource AncestorType=ContextMenu}}"/>
<MenuItem Header="全置为满"
Command="{Binding PlacementTarget.Tag.FillAllTipHeadCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}"
CommandParameter="{Binding PlacementTarget.DataContext.BoxId_inDosingStation, RelativeSource={RelativeSource AncestorType=ContextMenu}}"/>
</ContextMenu>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="80"/>
<RowDefinition Height="auto"/>
<RowDefinition Height="200"/>
<RowDefinition Height="auto"/>
<RowDefinition />
</Grid.RowDefinitions>
<Border BorderThickness="0,0,0,2" Grid.Row="0" Margin="0,0,0,5">
<ToolBar Style="{StaticResource toolbarstyle1}" Margin="0">
<Button Style="{DynamicResource btnMenu1}" Content="新建方案" Width="110" Command="{Binding NewProjectCommand}"/>
<Button Style="{DynamicResource btnMenu1}" Content="打开方案" Width="110" Command="{Binding OpenProjectCommand}"/>
<Button Style="{DynamicResource btnMenu1}" Content="另存方案" Width="110" Command="{Binding SaveAsCommand}"/>
<Button Style="{DynamicResource btnMenu1}" Content="保存方案" Width="110" Command="{Binding SaveCommand}"/>
<Separator Margin="10,0,20,0"/>
<Button Style="{DynamicResource btnMenu1}" Content="导入配方Excel" Width="120" Command="{Binding ImportExcelCommand}"/>
<Button Style="{DynamicResource btnMenu1}" Content="导出配方Excel" Width="120" Command="{Binding ExportExcelCommand}"/>
<Separator Margin="20,0,20,0"/>
</ToolBar>
</Border>
<Grid Grid.Row="2">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="0.6*"/>
</Grid.ColumnDefinitions>
<ItemsControl x:Name="TipboxItemsControl" ItemsSource="{Binding ProjectPro.TipHeadArea}" ItemTemplateSelector="{StaticResource BoxTemplateSelector}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid Rows="1" Columns="3"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemContainerStyle>
<Style TargetType="ContentPresenter">
<!-- 关键将ItemsControl的DataContextViewModel存入Tag -->
<Setter Property="Tag" Value="{Binding DataContext, ElementName=TipboxItemsControl}"/>
<Setter Property="ContextMenu" Value="{StaticResource TipHeadGroupContextMenu}"/>
<Setter Property="IsEnabled" Value="True"/>
</Style>
</ItemsControl.ItemContainerStyle>
</ItemsControl>
<GroupBox Foreground="Black" BorderBrush="LightGray" BorderThickness="2" Grid.Row="0" Grid.Column="3" Tag="1"><!--ContextMenu="{StaticResource BottleGroupContextMenu}"-->
<GroupBox.Header>
<StackPanel Orientation="Horizontal">
<TextBlock Text="粉末瓶暂存区" FontWeight="Light" FontSize="13"/>
</StackPanel>
</GroupBox.Header>
<Grid>
<ItemsControl ItemsSource="{Binding ProjectPro.PowderHeaderCacheArea}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid Rows="2" Columns="5" Margin="5" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<local:PowderBottleUserControl PowderBottleModel="{Binding}" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</Grid>
</GroupBox>
</Grid>
<Grid Grid.Row="3" Margin="0,10">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="400"/>
</Grid.RowDefinitions>
<GroupBox Grid.Row="0" Margin="5">
<StackPanel Orientation="Horizontal" Margin="10">
<TextBlock Text="设置工装类型:" FontWeight="Bold" VerticalAlignment="Center" Margin="20,0,0,4"/>
<ComboBox Width="150" Height="25" ItemsSource="{x:Static common:EnumHelper.BoxTypeEnumsSampleSource}" SelectedItem="{Binding SelectedBoxType, Mode=TwoWay}" />
<TextBlock Text="选择工装位置:" FontWeight="Bold" VerticalAlignment="Center"/>
<ComboBox ItemsSource="{Binding BoxIndexList}" SelectedItem="{Binding SelectedBoxIndex,Mode=TwoWay}" Width="80" Height="25"/>
<Button Style="{StaticResource btnMenu }" Content="设置" Command="{Binding LoadBoxCommand}" />
</StackPanel>
</GroupBox>
<!-- 8个工装位置2行4列排列 -->
<ItemsControl x:Name="FixtureItemsControl" Grid.Row="1" ItemsSource="{Binding ProjectPro.FixtureCacheArea}" ItemTemplateSelector="{StaticResource BoxTemplateSelector}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid Rows="2" Columns="4"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemContainerStyle>
<Style TargetType="ContentPresenter">
<!-- 关键将ItemsControl的DataContextViewModel存入Tag -->
<Setter Property="Tag" Value="{Binding DataContext, ElementName=FixtureItemsControl}"/>
<Setter Property="ContextMenu" Value="{StaticResource BottleGroupContextMenu}"/>
<Setter Property="IsEnabled" Value="True"/>
</Style>
</ItemsControl.ItemContainerStyle>
</ItemsControl>
</Grid>
</Grid>
</UserControl>