@@ -0,0 +1,24 @@ | |||
<Project Sdk="Microsoft.NET.Sdk"> | |||
<PropertyGroup> | |||
<TargetFramework>net6.0-windows</TargetFramework> | |||
<Nullable>enable</Nullable> | |||
<UseWPF>true</UseWPF> | |||
</PropertyGroup> | |||
<ItemGroup> | |||
<None Remove="Image\方形背景2.png" /> | |||
<None Remove="Image\方形背景3.png" /> | |||
<None Remove="Image\背景边框\方形背景3.png" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Resource Include="Image\方形背景2.png" /> | |||
<Resource Include="Image\方形背景3.png" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Folder Include="Image\背景边框\" /> | |||
</ItemGroup> | |||
</Project> |
@@ -0,0 +1,176 @@ | |||
<UserControl x:Class="BPASmart.RecipeManagement.MainControl" | |||
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:BPASmart.RecipeManagement" | |||
xmlns:view="clr-namespace:BPASmart.RecipeManagement.View" | |||
xmlns:vm="clr-namespace:BPASmart.RecipeManagement.ViewModel" | |||
mc:Ignorable="d" | |||
d:DesignHeight="800" d:DesignWidth="1400"> | |||
<UserControl.DataContext> | |||
<vm:MainControl/> | |||
</UserControl.DataContext> | |||
<UserControl.Resources> | |||
<Style x:Key="RadioNavigation" TargetType="RadioButton"> | |||
<Setter Property="Margin" Value="-4,0"/> | |||
<Setter Property="Background" Value="Transparent"/> | |||
<Setter Property="GroupName" Value="Navigation"/> | |||
<Setter Property="VerticalAlignment" Value="Center"/> | |||
<Setter Property="HorizontalAlignment" Value="Center"/> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="RadioButton"> | |||
<Border x:Name="_borderOver" Background="Transparent" Width="200" BorderBrush="Transparent" BorderThickness="0,1"> | |||
<Grid Background="{TemplateBinding Background}" Margin="{TemplateBinding Margin}"> | |||
<TextBlock Foreground="White" Text="{TemplateBinding Content}" FontSize="24" Background="Transparent" | |||
VerticalAlignment="Center" HorizontalAlignment="Center"/> | |||
</Grid> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="True"> | |||
<Setter Property="BorderBrush" TargetName="_borderOver" Value="#1971B6"/> | |||
<Setter Property="Background" TargetName="_borderOver"> | |||
<Setter.Value> | |||
<LinearGradientBrush StartPoint="0,1" EndPoint="1,1"> | |||
<GradientStop Color="#104E8B" Offset="0"/> | |||
<GradientStop Color="#1874CD" Offset="0.4"/> | |||
<GradientStop Color="#1874CD" Offset="0.6"/> | |||
<GradientStop Color="#27408B" Offset="1"/> | |||
</LinearGradientBrush> | |||
</Setter.Value> | |||
</Setter> | |||
</Trigger> | |||
<Trigger Property="IsChecked" Value="True"> | |||
<Setter Property="Background" TargetName="_borderOver" > | |||
<Setter.Value> | |||
<ImageBrush ImageSource="../Image/leftImage.png"/> | |||
</Setter.Value> | |||
</Setter> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<ControlTemplate x:Key="butonTempalte" TargetType="RadioButton"> | |||
<Border x:Name="_borderOver" Background="Transparent" Width="200" Height="60" BorderBrush="Transparent" BorderThickness="0,1"> | |||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" /> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="True"> | |||
<Setter Property="BorderBrush" TargetName="_borderOver" Value="#1971B6"/> | |||
<Setter Property="Background" TargetName="_borderOver"> | |||
<Setter.Value> | |||
<LinearGradientBrush StartPoint="0,1" EndPoint="1,1"> | |||
<GradientStop Color="#104E8B" Offset="0"/> | |||
<GradientStop Color="#1874CD" Offset="0.4"/> | |||
<GradientStop Color="#1874CD" Offset="0.6"/> | |||
<GradientStop Color="#27408B" Offset="1"/> | |||
</LinearGradientBrush> | |||
</Setter.Value> | |||
</Setter> | |||
</Trigger> | |||
<Trigger Property="IsChecked" Value="True"> | |||
<Setter Property="Background" TargetName="_borderOver" > | |||
<Setter.Value> | |||
<ImageBrush ImageSource="../Image/leftImage.png"/> | |||
</Setter.Value> | |||
</Setter> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
<Style x:Key="fonticon" TargetType="{x:Type TextBlock}"> | |||
<Setter Property="FontFamily" Value="pack://application:,,,/Font/#iconfont"/> | |||
<Setter Property="FontSize" Value="24"/> | |||
<Setter Property="Foreground" Value="White"/> | |||
<Setter Property="HorizontalAlignment" Value="Center"/> | |||
<Setter Property="VerticalAlignment" Value="Center"/> | |||
<Setter Property="Margin" Value="0,0,20,0"/> | |||
</Style> | |||
</UserControl.Resources> | |||
<Grid> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="*"/> | |||
<ColumnDefinition Width="6*"/> | |||
</Grid.ColumnDefinitions> | |||
<Border Grid.Row="1" Grid.RowSpan="2" BorderBrush="#1E90FF" BorderThickness="0,0,2,0"> | |||
<Border.Background> | |||
<LinearGradientBrush StartPoint="0,1" EndPoint="1,1"> | |||
<GradientStop Color="#01003B" Offset="0.2"/> | |||
<GradientStop Color="#010050" Offset="1"/> | |||
</LinearGradientBrush> | |||
</Border.Background> | |||
</Border> | |||
<StackPanel x:Name="mylistview" Background="Transparent" Grid.RowSpan="1" Grid.Row="1" | |||
ScrollViewer.VerticalScrollBarVisibility="Hidden" ScrollViewer.HorizontalScrollBarVisibility="Hidden" | |||
MouseLeftButtonDown="mylistview_MouseDown" > | |||
<RadioButton Style="{DynamicResource RadioNavigation}" IsChecked="True" Template="{DynamicResource butonTempalte }" | |||
Click="NavButton_Click" Tag="OrderManager"> | |||
<Grid Background="Transparent" > | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="auto"/> | |||
<ColumnDefinition Width="*"/> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock Text="" Style="{DynamicResource fonticon}"/> | |||
<TextBlock Grid.Column="1" Foreground="White" Text="订单管理" FontSize="24" Background="Transparent" | |||
VerticalAlignment="Center" HorizontalAlignment="Center" FontFamily="楷体"/> | |||
</Grid> | |||
</RadioButton> | |||
<RadioButton Style="{DynamicResource RadioNavigation}" Template="{DynamicResource butonTempalte }" | |||
Click="NavButton_Click" Tag="RecipeManager"> | |||
<Grid Background="Transparent" > | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="auto"/> | |||
<ColumnDefinition Width="*"/> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock Text="" Style="{DynamicResource fonticon}"/> | |||
<TextBlock Grid.Column="1" Foreground="White" Text="配方管理" FontSize="24" Background="Transparent" | |||
VerticalAlignment="Center" HorizontalAlignment="Center" FontFamily="楷体"/> | |||
</Grid> | |||
</RadioButton> | |||
<RadioButton Style="{DynamicResource RadioNavigation}" Template="{DynamicResource butonTempalte }" | |||
Click="NavButton_Click" Tag="MaterialManager"> | |||
<Grid Background="Transparent" > | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="auto"/> | |||
<ColumnDefinition Width="*"/> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock Text="" Style="{DynamicResource fonticon}"/> | |||
<TextBlock Grid.Column="1" Foreground="White" Text="原料管理" FontSize="24" Background="Transparent" | |||
VerticalAlignment="Center" HorizontalAlignment="Center" FontFamily="楷体"/> | |||
</Grid> | |||
</RadioButton> | |||
<RadioButton Style="{DynamicResource RadioNavigation}" Template="{DynamicResource butonTempalte }" | |||
Click="NavButton_Click" Tag="PowerManager"> | |||
<Grid Background="Transparent" > | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="auto"/> | |||
<ColumnDefinition Width="*"/> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock Text="" Style="{DynamicResource fonticon}"/> | |||
<TextBlock Grid.Column="1" Foreground="White" Text="权限分配" FontSize="24" Background="Transparent" | |||
VerticalAlignment="Center" HorizontalAlignment="Center" FontFamily="楷体"/> | |||
</Grid> | |||
</RadioButton> | |||
</StackPanel> | |||
<ContentControl x:Name="contentRegion" Grid.Column="1" Grid.Row="1" Background="#01003B" BorderBrush="Transparent"> | |||
<view:OrderManager/> | |||
</ContentControl> | |||
</Grid> | |||
</UserControl> |
@@ -0,0 +1,51 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Reflection; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.Windows; | |||
using System.Windows.Controls; | |||
using System.Windows.Data; | |||
using System.Windows.Documents; | |||
using System.Windows.Input; | |||
using System.Windows.Media; | |||
using System.Windows.Media.Imaging; | |||
using System.Windows.Navigation; | |||
using System.Windows.Shapes; | |||
namespace BPASmart.RecipeManagement | |||
{ | |||
/// <summary> | |||
/// MainControl.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class MainControl : UserControl | |||
{ | |||
public MainControl() | |||
{ | |||
InitializeComponent(); | |||
} | |||
private void mylistview_MouseDown(object sender, MouseButtonEventArgs e) | |||
{ | |||
} | |||
private void NavButton_Click(object sender, RoutedEventArgs e) | |||
{ | |||
try | |||
{ | |||
if (sender is RadioButton bt) | |||
{ | |||
Type type = Type.GetType($"BPASmart.RecipeManagement.View.{bt.Tag?.ToString()}"); | |||
ConstructorInfo cti = type.GetConstructor(System.Type.EmptyTypes); | |||
contentRegion.Content = (FrameworkElement)cti.Invoke(null); | |||
} | |||
} | |||
catch (Exception ex) | |||
{ | |||
} | |||
} | |||
} | |||
} |
@@ -12,88 +12,9 @@ | |||
<vm:MainWindowViewModel/> | |||
</Window.DataContext> | |||
<Window.Resources> | |||
<Style x:Key="fonticon" TargetType="{x:Type TextBlock}"> | |||
<Setter Property="FontFamily" Value="pack://application:,,,/Font/#iconfont"/> | |||
<Setter Property="FontSize" Value="24"/> | |||
<Setter Property="Foreground" Value="White"/> | |||
<Setter Property="HorizontalAlignment" Value="Center"/> | |||
<Setter Property="VerticalAlignment" Value="Center"/> | |||
<Setter Property="Margin" Value="0,0,20,0"/> | |||
</Style> | |||
<Style x:Key="RadioNavigation" TargetType="RadioButton"> | |||
<Setter Property="Margin" Value="-4,0"/> | |||
<Setter Property="Background" Value="Transparent"/> | |||
<Setter Property="GroupName" Value="Navigation"/> | |||
<Setter Property="VerticalAlignment" Value="Center"/> | |||
<Setter Property="HorizontalAlignment" Value="Center"/> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="RadioButton"> | |||
<Border x:Name="_borderOver" Background="Transparent" Width="200" BorderBrush="Transparent" BorderThickness="0,1"> | |||
<Grid Background="{TemplateBinding Background}" Margin="{TemplateBinding Margin}"> | |||
<TextBlock Foreground="White" Text="{TemplateBinding Content}" FontSize="24" Background="Transparent" | |||
VerticalAlignment="Center" HorizontalAlignment="Center"/> | |||
</Grid> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="True"> | |||
<Setter Property="BorderBrush" TargetName="_borderOver" Value="#1971B6"/> | |||
<Setter Property="Background" TargetName="_borderOver"> | |||
<Setter.Value> | |||
<LinearGradientBrush StartPoint="0,1" EndPoint="1,1"> | |||
<GradientStop Color="#104E8B" Offset="0"/> | |||
<GradientStop Color="#1874CD" Offset="0.4"/> | |||
<GradientStop Color="#1874CD" Offset="0.6"/> | |||
<GradientStop Color="#27408B" Offset="1"/> | |||
</LinearGradientBrush> | |||
</Setter.Value> | |||
</Setter> | |||
</Trigger> | |||
<Trigger Property="IsChecked" Value="True"> | |||
<Setter Property="Background" TargetName="_borderOver" > | |||
<Setter.Value> | |||
<ImageBrush ImageSource="../Image/leftImage.png"/> | |||
</Setter.Value> | |||
</Setter> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<ControlTemplate x:Key="butonTempalte" TargetType="RadioButton"> | |||
<Border x:Name="_borderOver" Background="Transparent" Width="200" Height="60" BorderBrush="Transparent" BorderThickness="0,1"> | |||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" /> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="True"> | |||
<Setter Property="BorderBrush" TargetName="_borderOver" Value="#1971B6"/> | |||
<Setter Property="Background" TargetName="_borderOver"> | |||
<Setter.Value> | |||
<LinearGradientBrush StartPoint="0,1" EndPoint="1,1"> | |||
<GradientStop Color="#104E8B" Offset="0"/> | |||
<GradientStop Color="#1874CD" Offset="0.4"/> | |||
<GradientStop Color="#1874CD" Offset="0.6"/> | |||
<GradientStop Color="#27408B" Offset="1"/> | |||
</LinearGradientBrush> | |||
</Setter.Value> | |||
</Setter> | |||
</Trigger> | |||
<Trigger Property="IsChecked" Value="True"> | |||
<Setter Property="Background" TargetName="_borderOver" > | |||
<Setter.Value> | |||
<ImageBrush ImageSource="../Image/leftImage.png"/> | |||
</Setter.Value> | |||
</Setter> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Window.Resources> | |||
<Grid > | |||
<Grid.ColumnDefinitions> | |||
@@ -150,91 +71,10 @@ | |||
</Style> | |||
</Button.Style> | |||
</Button> | |||
<Grid Grid.Row="1" Grid.ColumnSpan="2"> | |||
<local:MainControl/> | |||
</Grid> | |||
<Border Grid.Row="1" Grid.RowSpan="2" BorderBrush="#1E90FF" BorderThickness="0,0,2,0"> | |||
<Border.Background> | |||
<LinearGradientBrush StartPoint="0,1" EndPoint="1,1"> | |||
<GradientStop Color="#01003B" Offset="0.2"/> | |||
<GradientStop Color="#010050" Offset="1"/> | |||
</LinearGradientBrush> | |||
</Border.Background> | |||
</Border> | |||
<StackPanel x:Name="mylistview" Background="Transparent" Grid.RowSpan="1" Grid.Row="1" | |||
ScrollViewer.VerticalScrollBarVisibility="Hidden" ScrollViewer.HorizontalScrollBarVisibility="Hidden" | |||
MouseLeftButtonDown="mylistview_MouseDown" > | |||
<RadioButton Style="{DynamicResource RadioNavigation}" IsChecked="True" Template="{DynamicResource butonTempalte }" | |||
Click="NavButton_Click" Tag="OrderManager"> | |||
<Grid Background="Transparent" > | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="auto"/> | |||
<ColumnDefinition Width="*"/> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock Text="" Style="{DynamicResource fonticon}"/> | |||
<TextBlock Grid.Column="1" Foreground="White" Text="订单管理" FontSize="24" Background="Transparent" | |||
VerticalAlignment="Center" HorizontalAlignment="Center" FontFamily="楷体"/> | |||
</Grid> | |||
</RadioButton> | |||
<RadioButton Style="{DynamicResource RadioNavigation}" Template="{DynamicResource butonTempalte }" | |||
Click="NavButton_Click" Tag="RecipeManager"> | |||
<Grid Background="Transparent" > | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="auto"/> | |||
<ColumnDefinition Width="*"/> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock Text="" Style="{DynamicResource fonticon}"/> | |||
<TextBlock Grid.Column="1" Foreground="White" Text="配方管理" FontSize="24" Background="Transparent" | |||
VerticalAlignment="Center" HorizontalAlignment="Center" FontFamily="楷体"/> | |||
</Grid> | |||
</RadioButton> | |||
<RadioButton Style="{DynamicResource RadioNavigation}" Template="{DynamicResource butonTempalte }" | |||
Click="NavButton_Click" Tag="MaterialManager"> | |||
<Grid Background="Transparent" > | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="auto"/> | |||
<ColumnDefinition Width="*"/> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock Text="" Style="{DynamicResource fonticon}"/> | |||
<TextBlock Grid.Column="1" Foreground="White" Text="原料管理" FontSize="24" Background="Transparent" | |||
VerticalAlignment="Center" HorizontalAlignment="Center" FontFamily="楷体"/> | |||
</Grid> | |||
</RadioButton> | |||
<!--<RadioButton Style="{DynamicResource RadioNavigation}" Template="{DynamicResource butonTempalte }" | |||
Click="NavButton_Click" Tag="TechnologySetting"> | |||
<Grid Background="Transparent" > | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="auto"/> | |||
<ColumnDefinition Width="*"/> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock Text="" Style="{DynamicResource fonticon}"/> | |||
<TextBlock Grid.Column="1" Foreground="White" Text="工艺参数" FontSize="24" Background="Transparent" | |||
VerticalAlignment="Center" HorizontalAlignment="Center" FontFamily="楷体"/> | |||
</Grid> | |||
</RadioButton>--> | |||
<RadioButton Style="{DynamicResource RadioNavigation}" Template="{DynamicResource butonTempalte }" | |||
Click="NavButton_Click" Tag="PowerManager"> | |||
<Grid Background="Transparent" > | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="auto"/> | |||
<ColumnDefinition Width="*"/> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock Text="" Style="{DynamicResource fonticon}"/> | |||
<TextBlock Grid.Column="1" Foreground="White" Text="权限分配" FontSize="24" Background="Transparent" | |||
VerticalAlignment="Center" HorizontalAlignment="Center" FontFamily="楷体"/> | |||
</Grid> | |||
</RadioButton> | |||
</StackPanel> | |||
<ContentControl x:Name="contentRegion" Grid.Column="1" Grid.Row="1" Background="#01003B" BorderBrush="Transparent"> | |||
<view:OrderManager/> | |||
</ContentControl> | |||
</Grid> | |||
</Window> |
@@ -38,10 +38,6 @@ namespace BPASmart.RecipeManagement | |||
} | |||
private void mylistview_MouseDown(object sender, MouseButtonEventArgs e) | |||
{ | |||
this.DragMove(); | |||
} | |||
private void Button_Click(object sender, RoutedEventArgs e) | |||
{ | |||
@@ -49,22 +45,7 @@ namespace BPASmart.RecipeManagement | |||
} | |||
private void NavButton_Click(object sender, RoutedEventArgs e) | |||
{ | |||
try | |||
{ | |||
if (sender is RadioButton bt) | |||
{ | |||
Type type = Type.GetType($"BPASmart.RecipeManagement.View.{bt.Tag?.ToString()}"); | |||
ConstructorInfo cti = type.GetConstructor(System.Type.EmptyTypes); | |||
contentRegion.Content = (FrameworkElement)cti.Invoke(null); | |||
} | |||
} | |||
catch (Exception ex) | |||
{ | |||
} | |||
} | |||
private void Border_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) | |||
{ | |||
@@ -117,9 +117,12 @@ | |||
</Grid> | |||
</ScrollViewer> | |||
<Button Grid.Row="4" Content="配方工艺" Style="{DynamicResource ButtonStyle}" | |||
Height="20" Width="80" HorizontalAlignment="Right" VerticalAlignment="Top" | |||
<Button Grid.Row="4" Content="配方下发" Style="{DynamicResource GreenButton}" BorderBrush="Green" BorderThickness="1" | |||
Height="20" Width="70" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,0,5,0" | |||
Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl,Mode=FindAncestor},Path=DataContext.PecipeStartCommand}" | |||
CommandParameter="{Binding ID}"/> | |||
<Button Grid.Row="4" Content="配方工艺" Style="{DynamicResource ButtonStyle}" | |||
Height="20" Width="70" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="5,0,0,0" | |||
Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl,Mode=FindAncestor},Path=DataContext.PecipeSettingCommand}" | |||
CommandParameter="{Binding ID}"/> | |||
</Grid> | |||
@@ -76,9 +76,11 @@ | |||
Width="200" | |||
FontFamily="楷体" | |||
FontSize="20" | |||
IsEditable="False" | |||
IsEditable="False" | |||
SelectedValuePath="Key" DisplayMemberPath="Value" | |||
ItemsSource="{Binding DataContext.materialsName, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}" | |||
SelectedItem="{Binding Name}" | |||
SelectedValue="{Binding ID}" | |||
/> | |||
<StackPanel | |||
Grid.Column="1" | |||
@@ -0,0 +1,20 @@ | |||
using BPASmart.Model; | |||
using BPASmartClient.Helper; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmart.RecipeManagement.ViewModel | |||
{ | |||
public class MainControl:ObservableObject | |||
{ | |||
public MainControl() | |||
{ | |||
Json<LocalMaterails>.Read(); | |||
Json<LocalRecipes>.Read(); | |||
} | |||
} | |||
} |
@@ -14,8 +14,7 @@ namespace BPASmart.RecipeManagement.ViewModel | |||
public MainWindowViewModel() | |||
{ | |||
Json<LocalMaterails>.Read(); | |||
Json<LocalRecipes>.Read(); | |||
} | |||
} | |||
@@ -16,12 +16,22 @@ namespace BPASmart.RecipeManagement.ViewModel | |||
public class RecipeManagerViewModel : ObservableObject | |||
{ | |||
public ObservableCollection<Recipes> RecipeList { get; set; } = Json<LocalRecipes>.Data.locaRecipes; | |||
/// <summary> | |||
/// 创建配方 | |||
/// </summary> | |||
public RelayCommand CreateRecipeCommand { get; set; } | |||
public RelayCommand<object> EditRecipeCommand { get; set; } | |||
public RelayCommand<object> DeleteRecipeCommand { get; set; } | |||
/// <summary> | |||
/// 配方工艺 | |||
/// </summary> | |||
public RelayCommand<object> PecipeSettingCommand { get; set; } | |||
/// <summary> | |||
/// 配方下发 | |||
/// </summary> | |||
public RelayCommand<object> PecipeStartCommand { get; set; } | |||
private void EditRecipe(object o) | |||
{ | |||
@@ -62,6 +72,20 @@ namespace BPASmart.RecipeManagement.ViewModel | |||
} | |||
} | |||
private void PecipeStart(object o) | |||
{ | |||
if (o == null) return; | |||
if (o is string id) | |||
{ | |||
var res = Json<LocalRecipes>.Data.locaRecipes.FirstOrDefault(p => p.ID == id); | |||
if (res != null) | |||
{ | |||
//下发配方 | |||
} | |||
} | |||
} | |||
public RecipeManagerViewModel() | |||
{ | |||
CreateRecipeCommand = new RelayCommand(() => | |||
@@ -77,6 +101,8 @@ namespace BPASmart.RecipeManagement.ViewModel | |||
PecipeSettingCommand = new RelayCommand<object>(PecipeSetting); | |||
PecipeStartCommand = new RelayCommand<object>(PecipeStart); | |||
} | |||
} | |||
} |
@@ -18,8 +18,8 @@ namespace BPASmart.RecipeManagement.ViewModel | |||
/// <summary> | |||
/// 原料名称集合 | |||
/// </summary> | |||
public ObservableCollection<string> materialsName { get; set; } = new ObservableCollection<string>(); | |||
public Dictionary<string, string> materialsName { get; set; } = new Dictionary<string, string>(); | |||
/// <summary> | |||
/// 配方名称 | |||
/// </summary> | |||
@@ -50,13 +50,11 @@ namespace BPASmart.RecipeManagement.ViewModel | |||
public RecipesConfigureViewModel() | |||
{ | |||
AddMaterailsCommand = new RelayCommand(() => | |||
{ | |||
recipeMaterials.Add(new RecipeMaterials() | |||
{ | |||
ID = Guid.NewGuid().ToString() | |||
//ID = Guid.NewGuid().ToString() | |||
}); | |||
}); | |||
@@ -70,6 +68,11 @@ namespace BPASmart.RecipeManagement.ViewModel | |||
return; | |||
} | |||
recipeMaterials?.ToList().ForEach(p => { | |||
if (materialsName.ContainsKey(p.ID)) p.Name = materialsName[p.ID]; | |||
}); | |||
if (Globle.GlobleData.ChangeRecipes != null) | |||
{ | |||
var res = Json<LocalRecipes>.Data.locaRecipes.FirstOrDefault(p => p.ID == Globle.GlobleData.ChangeRecipes.ID); | |||
@@ -101,7 +104,7 @@ namespace BPASmart.RecipeManagement.ViewModel | |||
{ | |||
foreach (var materail in Json<LocalMaterails>.Data.locaMaterails) | |||
{ | |||
materialsName.Add(materail.Name); | |||
materialsName.Add(materail.ID,materail.Name); | |||
} | |||
} | |||
if (Globle.GlobleData.ChangeRecipes != null) | |||
@@ -122,11 +122,6 @@ namespace BPASmart.Server | |||
private void DeviceControl(PublishInfo publishInfo) | |||
{ | |||
//if (msg.TryDequeue(out string s)) | |||
//{ | |||
// var res = JsonConvert.DeserializeObject<PublishInfo>(s); | |||
// if (res != null) | |||
// { | |||
publishInfo.PublishModels.ForEach(item => | |||
{ | |||
if (CommunicationDevices.ContainsKey(item.DeviceName)) | |||
@@ -171,8 +166,7 @@ namespace BPASmart.Server | |||
} | |||
}); | |||
//} | |||
//} | |||
} | |||
private void SetValue(Array arrays, string DeviceName, ReadDataModel readDataModel, EDataType eDataType) | |||
@@ -6,17 +6,23 @@ | |||
<Application.Resources> | |||
<SolidColorBrush x:Key="commanTextblock" Color="#FF2AB2E7"/> | |||
<SolidColorBrush x:Key="selectedColor" Color=" #4169E1"/> | |||
<SolidColorBrush x:Key="ScrollBarDisabledBackground" Color="#F4F4F4"/> | |||
<!--#region ScrollViewer--> | |||
<Style x:Key="ScrollBarThumb" TargetType="{x:Type Thumb}"> | |||
<Setter Property="SnapsToDevicePixels" Value="True" /> | |||
<Setter Property="OverridesDefaultStyle" Value="true" /> | |||
<Setter Property="IsTabStop" Value="false" /> | |||
<Setter Property="Focusable" Value="false" /> | |||
<Setter Property="OverridesDefaultStyle" Value="true"/> | |||
<Setter Property="IsTabStop" Value="false"/> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type Thumb}"> | |||
<Border CornerRadius="2" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1" /> | |||
<!--滚动条颜色和圆角设置--> | |||
<Rectangle Name="thumbRect" Fill="#03ffea" RadiusX="3" RadiusY="3"/> | |||
<!--鼠标拉动滚动条时的颜色--> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="True"> | |||
<Setter Property="Fill" Value="CornflowerBlue" TargetName="thumbRect" /> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
@@ -69,7 +75,40 @@ | |||
<ScrollBar x:Name="PART_HorizontalScrollBar" AutomationProperties.AutomationId="HorizontalScrollBar" Cursor="Arrow" Grid.Column="0" Maximum="{TemplateBinding ScrollableWidth}" Minimum="0" Orientation="Horizontal" Grid.Row="1" Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" Value="{Binding HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportWidth}"/> | |||
</Grid> | |||
</ControlTemplate> | |||
<ControlTemplate x:Key="MyScrollViewer" TargetType="{x:Type ScrollViewer}"> | |||
<!--View区域背景色--> | |||
<Grid x:Name="Grid" Background="{TemplateBinding Background}"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="*"/> | |||
<ColumnDefinition Width="Auto"/> | |||
</Grid.ColumnDefinitions> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="*"/> | |||
<RowDefinition Height="Auto"/> | |||
</Grid.RowDefinitions> | |||
<Rectangle x:Name="Corner" Grid.Column="1" Fill="White" Grid.Row="1"/> | |||
<ScrollContentPresenter x:Name="PART_ScrollContentPresenter" CanContentScroll="{TemplateBinding CanContentScroll}" CanHorizontallyScroll="False" CanVerticallyScroll="False" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Grid.Column="0" Margin="{TemplateBinding Padding}" Grid.Row="0"/> | |||
<ScrollBar x:Name="PART_VerticalScrollBar" AutomationProperties.AutomationId="VerticalScrollBar" Cursor="Arrow" Grid.Column="1" Maximum="{TemplateBinding ScrollableHeight}" Minimum="0" Grid.Row="0" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportHeight}" Style="{DynamicResource MyScrollBarStyle}"/> | |||
<ScrollBar x:Name="PART_HorizontalScrollBar" AutomationProperties.AutomationId="HorizontalScrollBar" Cursor="Arrow" Grid.Column="0" Maximum="{TemplateBinding ScrollableWidth}" Minimum="0" Orientation="Horizontal" Grid.Row="1" Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" Value="{Binding HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportWidth}" Style="{DynamicResource MyScrollBarStyle}"/> | |||
</Grid> | |||
</ControlTemplate> | |||
<Style x:Key="VerticalScrollBarPageButton" TargetType="{x:Type RepeatButton}"> | |||
<Setter Property="OverridesDefaultStyle" Value="true"/> | |||
<Setter Property="Background" Value="Transparent"/> | |||
<Setter Property="Focusable" Value="false"/> | |||
<Setter Property="IsTabStop" Value="false"/> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type RepeatButton}"> | |||
<Rectangle Fill="{TemplateBinding Background}" Height="{TemplateBinding Height}" Width="{TemplateBinding Width}"/> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<!--#endregion--> | |||
<!--#region右键菜单--> | |||
<Style TargetType="{x:Type ContextMenu}"> | |||
<Setter Property="Template"> | |||
@@ -201,6 +240,28 @@ | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<Style x:Key="ButtontextStyle" TargetType="Button"> | |||
<Setter Property="Background" Value="Transparent"/> | |||
<Setter Property="Foreground" Value="#FF2AB2E7"/> | |||
<Setter Property="BorderBrush" Value="Transparent"/> | |||
<Setter Property="BorderThickness" Value="0"/> | |||
<Setter Property="FontSize" Value="14"/> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type Button}"> | |||
<Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}"> | |||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="True"> | |||
<Setter TargetName="border" Property="Background" Value="Transparent"/> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<!--#endregion--> | |||
<!--#region 用户输入框样式--> | |||
@@ -281,7 +342,8 @@ | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<!--#endregion--> | |||
<!--#region 密码输入框样式--> | |||
<Style x:Key="PasswordBoxStyle" TargetType="{x:Type PasswordBox}"> | |||
<Setter Property="Background" Value="Transparent" /> | |||
@@ -372,6 +434,300 @@ | |||
</Style> | |||
<!--#endregion--> | |||
<!--#region Combox--> | |||
<ControlTemplate x:Key="ComboBoxToggleButton" TargetType="{x:Type ToggleButton}"> | |||
<Grid Height="25" HorizontalAlignment="Stretch" Background="Transparent"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="*" /> | |||
<ColumnDefinition Width="30" /> | |||
</Grid.ColumnDefinitions> | |||
<Border | |||
Grid.ColumnSpan="2" | |||
Background="White" | |||
Opacity="0" /> | |||
<Path | |||
x:Name="Arrow" | |||
Grid.Column="1" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Data="M 0 0 6 6 12 0 Z" | |||
Fill="#FF2AB2E7" | |||
Stretch="None"> | |||
<Path.Effect> | |||
<DropShadowEffect | |||
BlurRadius="10" | |||
Direction="90" | |||
Opacity="1" | |||
RenderingBias="Quality" | |||
ShadowDepth="0" | |||
Color="Transparent" /> | |||
</Path.Effect> | |||
</Path> | |||
</Grid> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsChecked" Value="true"> | |||
<Setter TargetName="Arrow" Property="RenderTransform"> | |||
<Setter.Value> | |||
<RotateTransform Angle="180" CenterX="6" CenterY="3" /> | |||
</Setter.Value> | |||
</Setter> | |||
<Setter TargetName="Arrow" Property="Margin" Value="0,0,0,2" /> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
<Style x:Key="CommonCombox" TargetType="{x:Type ComboBox}"> | |||
<Setter Property="BorderThickness" Value="1" /> | |||
<Setter Property="Background" Value=" #041039"/> | |||
<Setter Property="BorderBrush" Value="#FF2AB2E7"/> | |||
<Setter Property="BorderThickness" Value="1"/> | |||
<Setter Property="ItemContainerStyle"> | |||
<Setter.Value> | |||
<Style TargetType="ComboBoxItem"> | |||
<Setter Property="Height" Value="25" /> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type ComboBoxItem}"> | |||
<Grid Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" > | |||
<Border x:Name="_borderbg" Background=" #041039" BorderBrush="#FF2AB2E7" BorderThickness="0"/> | |||
<TextBlock | |||
x:Name="_txt" | |||
Margin="5,0,3,0" | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Center" | |||
Foreground="#FF2AB2E7" | |||
Text="{Binding Content, RelativeSource={RelativeSource TemplatedParent}}" /> | |||
<Border | |||
x:Name="_border" | |||
Background="Transparent" | |||
Opacity="0" /> | |||
</Grid> | |||
<ControlTemplate.Triggers> | |||
<MultiTrigger> | |||
<MultiTrigger.Conditions> | |||
<Condition Property="IsSelected" Value="false" /> | |||
<Condition Property="IsMouseOver" Value="true" /> | |||
</MultiTrigger.Conditions> | |||
<Setter TargetName="_borderbg" Property="Background" Value="#37405E" /> | |||
<Setter TargetName="_borderbg" Property="BorderBrush" Value="white" /> | |||
<Setter TargetName="_borderbg" Property="BorderThickness" Value="1" /> | |||
<Setter TargetName="_txt" Property="Foreground" Value="white" /> | |||
</MultiTrigger> | |||
<MultiTrigger> | |||
<MultiTrigger.Conditions> | |||
<Condition Property="IsSelected" Value="true" /> | |||
</MultiTrigger.Conditions> | |||
<Setter TargetName="_borderbg" Property="Background" Value="#022352" /> | |||
<Setter TargetName="_borderbg" Property="BorderBrush" Value=" #00BFFF" /> | |||
<Setter TargetName="_borderbg" Property="BorderThickness" Value="1" /> | |||
<Setter TargetName="_txt" Property="Foreground" Value="white" /> | |||
</MultiTrigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
</Setter.Value> | |||
</Setter> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type ComboBox}"> | |||
<Grid> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="0.7*" /> | |||
<ColumnDefinition Width="0.3*" MaxWidth="30" /> | |||
</Grid.ColumnDefinitions> | |||
<Border | |||
x:Name="_prybr" | |||
Grid.Column="0" | |||
Grid.ColumnSpan="2" | |||
BorderBrush="{TemplateBinding BorderBrush}" | |||
BorderThickness="{TemplateBinding BorderThickness}" | |||
CornerRadius="0" /> | |||
<ContentPresenter | |||
x:Name="ContentSite" | |||
Margin="3,3,0,3" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Content="{TemplateBinding SelectionBoxItem}" | |||
ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}" | |||
ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}" | |||
IsHitTestVisible="False" /> | |||
<!-- ToggleButton 已数据绑定到 ComboBox 本身以切换 IsDropDownOpen --> | |||
<ToggleButton | |||
Background="Transparent" | |||
x:Name="ToggleButton" | |||
Grid.Column="0" | |||
Grid.ColumnSpan="2" | |||
ClickMode="Press" | |||
Focusable="false" | |||
IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" | |||
Template="{StaticResource ComboBoxToggleButton}" /> | |||
<!-- 必须将 TextBox 命名为 PART_EditableTextBox,否则 ComboBox 将无法识别它 --> | |||
<TextBox | |||
x:Name="PART_EditableTextBox" | |||
Margin="2,0,0,0" | |||
VerticalAlignment="Center" | |||
Background="Transparent" | |||
BorderThickness="0" | |||
CaretBrush="{TemplateBinding Foreground}" | |||
Focusable="True" | |||
Foreground="{TemplateBinding Foreground}" | |||
IsReadOnly="{TemplateBinding IsReadOnly}" | |||
Visibility="Hidden" /> | |||
<!-- Popup 可显示 ComboBox 中的项列表。IsOpen 已数据绑定到通过 ComboBoxToggleButton 来切换的 IsDropDownOpen --> | |||
<Popup | |||
x:Name="Popup" | |||
AllowsTransparency="True" | |||
Focusable="False" | |||
IsOpen="{TemplateBinding IsDropDownOpen}" | |||
Placement="Bottom" | |||
PopupAnimation="Slide"> | |||
<Grid | |||
x:Name="DropDown" | |||
MinWidth="{TemplateBinding ActualWidth}" | |||
MaxHeight="150" | |||
SnapsToDevicePixels="True"> | |||
<Border | |||
x:Name="DropDownBorder" | |||
BorderBrush="Black" | |||
BorderThickness="0" /> | |||
<ScrollViewer | |||
Margin="1" | |||
CanContentScroll="True" | |||
HorizontalScrollBarVisibility="Hidden" | |||
SnapsToDevicePixels="True" | |||
VerticalScrollBarVisibility="Auto" | |||
Template="{DynamicResource MyScrollViewer }"> | |||
<!-- StackPanel 用于显示子级,方法是将 IsItemsHost 设置为 True --> | |||
<!-- 一下可以设置列表背景色 --> | |||
<StackPanel | |||
Background="{TemplateBinding Background}" | |||
IsItemsHost="True" | |||
KeyboardNavigation.DirectionalNavigation="Contained"/> | |||
</ScrollViewer> | |||
</Grid> | |||
</Popup> | |||
</Grid> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsEditable" Value="true"> | |||
<Setter TargetName="PART_EditableTextBox" Property="Visibility" Value="Visible" /> | |||
</Trigger> | |||
<Trigger Property="IsMouseOver" Value="True"> | |||
<Setter TargetName="_prybr" Property="BorderBrush" Value="#aa3ba7f2" /> | |||
</Trigger> | |||
<Trigger Property="IsEnabled" Value="False"> | |||
<Setter TargetName="ContentSite" Property="Opacity" Value="0.6" /> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<!--滚动条颜色、圆角等设置--> | |||
<Style x:Key="HorizontalScrollBarPageButton" TargetType="{x:Type RepeatButton}"> | |||
<Setter Property="OverridesDefaultStyle" Value="true"/> | |||
<Setter Property="Background" Value="Transparent"/> | |||
<Setter Property="Focusable" Value="false"/> | |||
<Setter Property="IsTabStop" Value="false"/> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type RepeatButton}"> | |||
<Rectangle Fill="{TemplateBinding Background}" Height="{TemplateBinding Height}" Width="{TemplateBinding Width}"/> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<Style x:Key="MyScrollBarStyle" TargetType="{x:Type ScrollBar}"> | |||
<Setter Property="Background" Value="AliceBlue"/> | |||
<Setter Property="Stylus.IsPressAndHoldEnabled" Value="false"/> | |||
<Setter Property="Stylus.IsFlicksEnabled" Value="false"/> | |||
<!--滚动条宽度--> | |||
<Setter Property="Width" Value="8"/> | |||
<Setter Property="MinWidth" Value="6"/> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type ScrollBar}"> | |||
<!--滚动条背景色--> | |||
<Grid x:Name="Bg" Background="#001f55" SnapsToDevicePixels="true" Width="8"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<Track x:Name="PART_Track" IsDirectionReversed="true" IsEnabled="{TemplateBinding IsMouseOver}"> | |||
<Track.DecreaseRepeatButton> | |||
<RepeatButton Command="{x:Static ScrollBar.PageUpCommand}" Style="{StaticResource VerticalScrollBarPageButton}"/> | |||
</Track.DecreaseRepeatButton> | |||
<Track.IncreaseRepeatButton> | |||
<RepeatButton Command="{x:Static ScrollBar.PageDownCommand}" Style="{StaticResource VerticalScrollBarPageButton}"/> | |||
</Track.IncreaseRepeatButton> | |||
<Track.Thumb> | |||
<Thumb Style="{StaticResource ScrollBarThumb}"/> | |||
</Track.Thumb> | |||
</Track> | |||
</Grid> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsEnabled" Value="false"> | |||
<Setter Property="Background" TargetName="Bg" Value="{StaticResource ScrollBarDisabledBackground}"/> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
<Style.Triggers> | |||
<Trigger Property="Orientation" Value="Horizontal"> | |||
<Setter Property="Width" Value="Auto"/> | |||
<Setter Property="MinWidth" Value="0"/> | |||
<Setter Property="Height" Value="6"/> | |||
<Setter Property="MinHeight" Value="6"/> | |||
<Setter Property="Background" Value="AliceBlue"/> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type ScrollBar}"> | |||
<Grid x:Name="Bg" Background="Red" SnapsToDevicePixels="true"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<Track x:Name="PART_Track" IsEnabled="{TemplateBinding IsMouseOver}"> | |||
<Track.DecreaseRepeatButton> | |||
<RepeatButton Command="{x:Static ScrollBar.PageLeftCommand}" Style="{StaticResource HorizontalScrollBarPageButton}"/> | |||
</Track.DecreaseRepeatButton> | |||
<Track.IncreaseRepeatButton> | |||
<RepeatButton Command="{x:Static ScrollBar.PageRightCommand}" Style="{StaticResource HorizontalScrollBarPageButton}"/> | |||
</Track.IncreaseRepeatButton> | |||
<Track.Thumb> | |||
<Thumb Style="{StaticResource ScrollBarThumb}" /> | |||
</Track.Thumb> | |||
</Track> | |||
</Grid> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsEnabled" Value="false"> | |||
<Setter Property="Background" TargetName="Bg" Value="{StaticResource ScrollBarDisabledBackground}"/> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Trigger> | |||
</Style.Triggers> | |||
</Style> | |||
<!--#endregion--> | |||
<Style x:Key="CommonTextBox" TargetType="{x:Type TextBox}"> | |||
<Setter Property="Foreground" Value="Orange"/> | |||
<Setter Property="Background" Value="Transparent"/> | |||
@@ -17,12 +17,18 @@ | |||
<None Remove="Image\信息边框.png" /> | |||
<None Remove="Image\图层1.png" /> | |||
<None Remove="Image\图层2.png" /> | |||
<None Remove="Image\圆形按钮背景.png" /> | |||
<None Remove="Image\圆形按钮背景1.png" /> | |||
<None Remove="Image\圆形按钮背景2.png" /> | |||
<None Remove="Image\容器边框.png" /> | |||
<None Remove="Image\尺条框.png" /> | |||
<None Remove="Image\成功提示.png" /> | |||
<None Remove="Image\按钮背景.png" /> | |||
<None Remove="Image\文字背景1.png" /> | |||
<None Remove="Image\文字背景2.png" /> | |||
<None Remove="Image\方形.png" /> | |||
<None Remove="Image\方形背景.png" /> | |||
<None Remove="Image\方形背景3.png" /> | |||
<None Remove="Image\权限背景.png" /> | |||
<None Remove="Image\用户名边框.png" /> | |||
<None Remove="Image\用户名边框1.png" /> | |||
@@ -41,12 +47,18 @@ | |||
<Resource Include="Image\信息边框.png" /> | |||
<Resource Include="Image\图层1.png" /> | |||
<Resource Include="Image\图层2.png" /> | |||
<Resource Include="Image\圆形按钮背景.png" /> | |||
<Resource Include="Image\圆形按钮背景1.png" /> | |||
<Resource Include="Image\圆形按钮背景2.png" /> | |||
<Resource Include="Image\容器边框.png" /> | |||
<Resource Include="Image\尺条框.png" /> | |||
<Resource Include="Image\成功提示.png" /> | |||
<Resource Include="Image\按钮背景.png" /> | |||
<Resource Include="Image\文字背景1.png" /> | |||
<Resource Include="Image\文字背景2.png" /> | |||
<Resource Include="Image\方形.png" /> | |||
<Resource Include="Image\方形背景.png" /> | |||
<Resource Include="Image\方形背景3.png" /> | |||
<Resource Include="Image\权限背景.png" /> | |||
<Resource Include="Image\用户名边框.png" /> | |||
<Resource Include="Image\用户名边框1.png" /> | |||
@@ -61,6 +73,7 @@ | |||
</ItemGroup> | |||
<ItemGroup> | |||
<ProjectReference Include="..\BPASmart.CustomResource\BPASmart.CustomResource.csproj" /> | |||
<ProjectReference Include="..\BPASmart.Model\BPASmart.Model.csproj" /> | |||
<ProjectReference Include="..\BPASmartClient.Helper\BPASmartClient.Helper.csproj" /> | |||
</ItemGroup> | |||
@@ -1,4 +1,5 @@ | |||
using System; | |||
using BPASmart.Model; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
@@ -9,5 +10,7 @@ namespace BPASmart.UserManagement.Globle | |||
public static class GlobleData | |||
{ | |||
public static UserManager ChangeUser = new UserManager(); | |||
public static UserManager EditUser = new UserManager(); | |||
} | |||
} |
@@ -0,0 +1,50 @@ | |||
<UserControl x:Class="BPASmart.UserManagement.MainControl" | |||
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:BPASmart.UserManagement" | |||
xmlns:view="clr-namespace:BPASmart.UserManagement.View" | |||
mc:Ignorable="d" | |||
d:DesignHeight="600" d:DesignWidth="1000"> | |||
<Grid > | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="200"/> | |||
<ColumnDefinition Width="81*"/> | |||
<ColumnDefinition Width="319*"/> | |||
</Grid.ColumnDefinitions> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="40"/> | |||
<RowDefinition Height="*"/> | |||
</Grid.RowDefinitions> | |||
<Border Grid.RowSpan="2" Background="Transparent" BorderBrush="#1E90FF" BorderThickness="0,0,1,0"> | |||
<view:UserList/> | |||
</Border> | |||
<Border Grid.RowSpan="2" Grid.Column="1" Grid.ColumnSpan="2"> | |||
<Border.Background> | |||
<ImageBrush ImageSource="../Image/背景4.png"/> | |||
</Border.Background> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="40"/> | |||
<RowDefinition Height="*"/> | |||
</Grid.RowDefinitions> | |||
<StackPanel Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0"> | |||
<Image Source="../Image/图层2.png" Width="100" Height="40"/> | |||
<Button HorizontalAlignment="Right" VerticalAlignment="Center" Margin="10,0" Padding="10,3" FontSize="18" | |||
Content="注册新用户" Style="{DynamicResource ButtonStyle}" Click="NewUser_Click" /> | |||
<Image Source="../Image/图层2.png" Width="100"/> | |||
</StackPanel> | |||
<ContentControl Grid.Row="1" x:Name="mainContent" Background="Transparent" > | |||
</ContentControl> | |||
</Grid> | |||
</Border> | |||
</Grid> | |||
</UserControl> |
@@ -0,0 +1,54 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Reflection; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.Windows; | |||
using System.Windows.Controls; | |||
using System.Windows.Data; | |||
using System.Windows.Documents; | |||
using System.Windows.Input; | |||
using System.Windows.Media; | |||
using System.Windows.Media.Imaging; | |||
using System.Windows.Navigation; | |||
using System.Windows.Shapes; | |||
namespace BPASmart.UserManagement | |||
{ | |||
/// <summary> | |||
/// MainControl.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class MainControl : UserControl | |||
{ | |||
public MainControl() | |||
{ | |||
InitializeComponent(); | |||
ActionManage.GetInstance.Register(new Action<object>((o) => { | |||
if (o == null) | |||
{ | |||
return; | |||
} | |||
if (o == string.Empty) | |||
{ | |||
mainContent.Content = null; | |||
return; | |||
} | |||
if (o is string pageName) | |||
{ | |||
Type type = Type.GetType($"BPASmart.UserManagement.View.{pageName}"); | |||
if (type == null) { return; } | |||
ConstructorInfo cti = type.GetConstructor(System.Type.EmptyTypes); | |||
mainContent.Content = (FrameworkElement)cti.Invoke(null); | |||
} | |||
}), "ChangeMianContent"); | |||
} | |||
private void NewUser_Click(object sender, RoutedEventArgs e) | |||
{ | |||
ActionManage.GetInstance.Send("ChangeMianContent", "AddNewUser"); | |||
} | |||
} | |||
} |
@@ -66,47 +66,11 @@ | |||
</Grid> | |||
</Border> | |||
<Grid Grid.Row="1"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="200"/> | |||
<ColumnDefinition Width="81*"/> | |||
<ColumnDefinition Width="319*"/> | |||
</Grid.ColumnDefinitions> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="40"/> | |||
<RowDefinition Height="*"/> | |||
</Grid.RowDefinitions> | |||
<Border Grid.RowSpan="2" Background="Transparent" BorderBrush="#1E90FF" BorderThickness="0,0,1,0"> | |||
<view:UserList/> | |||
</Border> | |||
<local:MainControl/> | |||
<Border Grid.RowSpan="2" Grid.Column="1" Grid.ColumnSpan="2"> | |||
<Border.Background> | |||
<ImageBrush ImageSource="../Image/背景4.png"/> | |||
</Border.Background> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="40"/> | |||
<RowDefinition Height="*"/> | |||
</Grid.RowDefinitions> | |||
<StackPanel Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0"> | |||
<Image Source="../Image/图层2.png" Width="100" Height="40"/> | |||
<Button HorizontalAlignment="Right" VerticalAlignment="Center" Margin="10,0" Padding="10,3" FontSize="18" | |||
Content="注册新用户" Style="{DynamicResource ButtonStyle}" Click="NewUser_Click" /> | |||
<Image Source="../Image/图层2.png" Width="100"/> | |||
</StackPanel> | |||
<ContentControl Grid.Row="1" x:Name="mainContent" Background="Transparent" > | |||
</ContentControl> | |||
</Grid> | |||
</Border> | |||
</Grid> | |||
</Grid> | |||
</Grid> | |||
</Border> | |||
@@ -36,26 +36,6 @@ namespace BPASmart.UserManagement | |||
} | |||
}; | |||
ActionManage.GetInstance.Register(new Action<object>((o) => { | |||
if (o == null) | |||
{ | |||
return; | |||
} | |||
if(o == string.Empty) | |||
{ | |||
mainContent.Content = null; | |||
return; | |||
} | |||
if(o is string pageName) | |||
{ | |||
Type type = Type.GetType($"BPASmart.UserManagement.View.{pageName}"); | |||
if (type == null) { return; } | |||
ConstructorInfo cti = type.GetConstructor(System.Type.EmptyTypes); | |||
mainContent.Content = (FrameworkElement)cti.Invoke(null); | |||
} | |||
}), "ChangeMianContent"); | |||
} | |||
private void Border_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) | |||
@@ -70,9 +50,6 @@ namespace BPASmart.UserManagement | |||
private void NewUser_Click(object sender, RoutedEventArgs e) | |||
{ | |||
ActionManage.GetInstance.Send("ChangeMianContent", "AddNewUser"); | |||
} | |||
} | |||
} |
@@ -4,15 +4,278 @@ | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:local="clr-namespace:BPASmart.UserManagement.View" | |||
xmlns:vm="clr-namespace:BPASmart.UserManagement.ViewModel" | |||
mc:Ignorable="d" | |||
d:DesignHeight="450" d:DesignWidth="800" FontFamily="楷体"> | |||
<Border> | |||
<UserControl.DataContext> | |||
<vm:EditPowerViewModel/> | |||
</UserControl.DataContext> | |||
<UserControl.Resources> | |||
<Style x:Key="ItemContainer" TargetType="{x:Type ListBoxItem}"> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type ListBoxItem}"> | |||
<Border x:Name="IconBorder" Background="Transparent" CornerRadius="4" BorderThickness="0"> | |||
<ContentPresenter /> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsSelected" Value="true"> | |||
<Setter TargetName="IconBorder" Property="BitmapEffect"> | |||
<Setter.Value> | |||
<OuterGlowBitmapEffect GlowColor="Transparent" GlowSize="5" /> | |||
</Setter.Value> | |||
</Setter> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
</UserControl.Resources> | |||
<Border Margin="10,20"> | |||
<Border.Background> | |||
<ImageBrush ImageSource="../image/方形背景.png"/> | |||
<ImageBrush ImageSource="pack://application:,,,/BPASmart.CustomResource;component/Image/方形背景2.png"/> | |||
</Border.Background> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="18*"/> | |||
<RowDefinition Height="391*"/> | |||
</Grid.RowDefinitions> | |||
<TextBlock Text="权限编辑" | |||
FontSize="18" Foreground="#F0FFF0" | |||
HorizontalAlignment="Center" VerticalAlignment="Center" Width="72"/> | |||
<Grid Grid.Row="1"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="3*"/> | |||
<RowDefinition Height="40*"/> | |||
<RowDefinition Height="328*"/> | |||
</Grid.RowDefinitions> | |||
<StackPanel Grid.Row="1" Orientation="Horizontal" Margin="0,0,0,2" | |||
HorizontalAlignment="Center" VerticalAlignment="Center"> | |||
<TextBlock Text="用户名:" Foreground="{DynamicResource commanTextblock}" FontSize="18" | |||
HorizontalAlignment="Center" VerticalAlignment="Center"/> | |||
<ComboBox Width="120" Margin="20,0" ItemsSource="{Binding UserNames}" SelectedItem="{Binding CurrentUserName}" FontSize="16" Foreground="{DynamicResource commanTextblock}" | |||
Style="{DynamicResource CommonCombox}"/> | |||
<Button Content="保存" Style="{DynamicResource CommonButton}" Width="100" FontSize="18" Command="{Binding SaveUserPowerCommand}" Margin="10,0"/> | |||
<Button Content="取消" Style="{DynamicResource CommonButton}" Width="100" FontSize="18" Command="{Binding CancelCommand}" Margin="10,0"/> | |||
</StackPanel> | |||
<Grid Grid.Row="2" Margin="5"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="0.15*"/> | |||
<ColumnDefinition Width="*"/> | |||
<ColumnDefinition Width="0.35*"/> | |||
<ColumnDefinition Width="*"/> | |||
<ColumnDefinition Width="0.15*"/> | |||
</Grid.ColumnDefinitions> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="14*"/> | |||
<RowDefinition Height="1*"/> | |||
</Grid.RowDefinitions> | |||
<!--#region 界面列表--> | |||
<Border Grid.Column="1" Margin="20,0,20,0"> | |||
<Border.Background> | |||
<ImageBrush ImageSource="../Image/方形背景3.png"/> | |||
</Border.Background> | |||
<ScrollViewer CanContentScroll="True" Template="{DynamicResource ScrollViewerControlTemplate1}" | |||
Width="auto" Margin="10" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto"> | |||
<ListBox Background="Transparent" ItemContainerStyle="{StaticResource ItemContainer}" FocusVisualStyle="{x:Null}" | |||
ItemsSource="{Binding pageList}" > | |||
<ListBox.Template> | |||
<ControlTemplate> | |||
<StackPanel Background="Transparent" IsItemsHost="True"></StackPanel> | |||
</ControlTemplate> | |||
</ListBox.Template> | |||
<ListBox.ItemTemplate> | |||
<DataTemplate> | |||
<Button Background="Transparent" BorderBrush="Transparent" BorderThickness="0" Style="{DynamicResource ButtontextStyle}" | |||
Command="{Binding DataContext.AddPageCommand, RelativeSource={RelativeSource AncestorType=UserControl,Mode=FindAncestor}}" | |||
CommandParameter="{Binding Name}"> | |||
<Border x:Name="leftborder" Width="130" HorizontalAlignment="Center" Margin="5"> | |||
<Border.Background> | |||
<ImageBrush ImageSource="../Image/文字背景2.png"/> | |||
</Border.Background> | |||
<TextBlock Text="{Binding Name}" Margin="8" | |||
FontSize="18" Foreground="white" HorizontalAlignment="Center" VerticalAlignment="Center"/> | |||
</Border> | |||
</Button> | |||
<DataTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="true"> | |||
<Setter Property="Width" Value="160" TargetName="leftborder"/> | |||
</Trigger> | |||
</DataTemplate.Triggers> | |||
</DataTemplate> | |||
</ListBox.ItemTemplate> | |||
</ListBox> | |||
</ScrollViewer> | |||
</Border> | |||
<!--#endregion--> | |||
<Grid Grid.Column="2"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<Button Width="80" Height="80" Command="{Binding AddAllPageCommand}"> | |||
<Button.Template> | |||
<ControlTemplate TargetType="{x:Type Button}"> | |||
<Border > | |||
<Grid> | |||
<StackPanel Orientation="Vertical" Margin="5" HorizontalAlignment="Center" VerticalAlignment="Center" > | |||
<TextBlock Text="全部" FontSize="20" Foreground="{DynamicResource commanTextblock}"/> | |||
<TextBlock Text="添加" FontSize="20" Foreground="{DynamicResource commanTextblock}"/> | |||
</StackPanel> | |||
<Border> | |||
<Border.Background> | |||
<ImageBrush x:Name="image" ImageSource="../Image/圆形按钮背景2.png"> | |||
</ImageBrush> | |||
</Border.Background> | |||
<Border.Style> | |||
<Style TargetType="Border"> | |||
<Setter Property="RenderTransformOrigin" Value="0.5,0.5"/> | |||
<Setter Property="RenderTransform"> | |||
<Setter.Value> | |||
<TransformGroup> | |||
<RotateTransform/> | |||
</TransformGroup> | |||
</Setter.Value> | |||
</Setter> | |||
<Style.Triggers> | |||
<EventTrigger RoutedEvent="Loaded" > | |||
<EventTrigger.Actions> | |||
<BeginStoryboard x:Name="run1"> | |||
<Storyboard RepeatBehavior="Forever" Storyboard.TargetProperty="RenderTransform.Children[0].Angle"> | |||
<DoubleAnimation From="0" To="360" Duration="0:0:6"/> | |||
</Storyboard> | |||
</BeginStoryboard> | |||
<PauseStoryboard BeginStoryboardName="run1"/> | |||
</EventTrigger.Actions> | |||
</EventTrigger> | |||
<Trigger Property="IsMouseOver" Value="True"> | |||
<Trigger.EnterActions> | |||
<ResumeStoryboard BeginStoryboardName="run1"/> | |||
</Trigger.EnterActions> | |||
</Trigger> | |||
<Trigger Property="IsMouseOver" Value="False"> | |||
<Trigger.EnterActions> | |||
<PauseStoryboard BeginStoryboardName="run1"/> | |||
</Trigger.EnterActions> | |||
</Trigger> | |||
</Style.Triggers> | |||
</Style> | |||
</Border.Style> | |||
</Border> | |||
</Grid> | |||
</Border> | |||
</ControlTemplate> | |||
</Button.Template> | |||
</Button> | |||
<Button Grid.Row="1" Width="80" Height="80" Command="{Binding DeleteAllPageCommand}"> | |||
<Button.Template> | |||
<ControlTemplate TargetType="{x:Type Button}"> | |||
<Border > | |||
<Grid> | |||
<StackPanel Orientation="Vertical" Margin="5" HorizontalAlignment="Center" VerticalAlignment="Center" > | |||
<TextBlock Text="全部" FontSize="20" Foreground="{DynamicResource commanTextblock}"/> | |||
<TextBlock Text="移除" FontSize="20" Foreground="{DynamicResource commanTextblock}"/> | |||
</StackPanel> | |||
<Border x:Name="myborder"> | |||
<Border.Background> | |||
<ImageBrush x:Name="image" ImageSource="../Image/圆形按钮背景1.png"> | |||
</ImageBrush> | |||
</Border.Background> | |||
<Border.Style> | |||
<Style TargetType="Border"> | |||
<Setter Property="RenderTransformOrigin" Value="0.5,0.5"/> | |||
<Setter Property="RenderTransform"> | |||
<Setter.Value> | |||
<TransformGroup> | |||
<RotateTransform/> | |||
</TransformGroup> | |||
</Setter.Value> | |||
</Setter> | |||
<Style.Triggers> | |||
<EventTrigger RoutedEvent="Loaded" > | |||
<EventTrigger.Actions> | |||
<BeginStoryboard x:Name="run1"> | |||
<Storyboard RepeatBehavior="Forever" Storyboard.TargetProperty="RenderTransform.Children[0].Angle"> | |||
<DoubleAnimation From="360" To="0" Duration="0:0:6"/> | |||
</Storyboard> | |||
</BeginStoryboard> | |||
<PauseStoryboard BeginStoryboardName="run1"/> | |||
</EventTrigger.Actions> | |||
</EventTrigger> | |||
<Trigger Property="IsMouseOver" Value="True"> | |||
<Trigger.EnterActions> | |||
<ResumeStoryboard BeginStoryboardName="run1"/> | |||
</Trigger.EnterActions> | |||
</Trigger> | |||
<Trigger Property="IsMouseOver" Value="False"> | |||
<Trigger.EnterActions> | |||
<PauseStoryboard BeginStoryboardName="run1" /> | |||
</Trigger.EnterActions> | |||
</Trigger> | |||
</Style.Triggers> | |||
</Style> | |||
</Border.Style> | |||
</Border> | |||
</Grid> | |||
</Border> | |||
</ControlTemplate> | |||
</Button.Template> | |||
</Button> | |||
</Grid> | |||
<!--#region 用户界面列表--> | |||
<Border Grid.Column="3" Margin="20,0,20,0"> | |||
<Border.Background> | |||
<ImageBrush ImageSource="../Image/方形背景3.png"/> | |||
</Border.Background> | |||
<ScrollViewer CanContentScroll="True" Template="{DynamicResource ScrollViewerControlTemplate1}" | |||
Width="auto" Margin="10" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto"> | |||
<ListBox Background="Transparent" ItemContainerStyle="{StaticResource ItemContainer}" FocusVisualStyle="{x:Null}" Width="auto" | |||
ItemsSource="{Binding userPageList}" > | |||
<ListBox.Template> | |||
<ControlTemplate> | |||
<StackPanel Background="Transparent" IsItemsHost="True"></StackPanel> | |||
</ControlTemplate> | |||
</ListBox.Template> | |||
<ListBox.ItemTemplate> | |||
<DataTemplate> | |||
<Button Background="Transparent" BorderBrush="Transparent" BorderThickness="0" Style="{DynamicResource ButtontextStyle}" | |||
Command="{Binding DataContext.DeletePageCommand, RelativeSource={RelativeSource AncestorType=UserControl,Mode=FindAncestor}}" | |||
CommandParameter="{Binding Name}"> | |||
<Border x:Name="leftborder" Width="130" HorizontalAlignment="Center" Margin="5"> | |||
<Border.Background> | |||
<ImageBrush ImageSource="../Image/文字背景2.png"/> | |||
</Border.Background> | |||
<TextBlock Text="{Binding Name}" Margin="8" | |||
FontSize="18" Foreground="white" HorizontalAlignment="Center" VerticalAlignment="Center"/> | |||
</Border> | |||
</Button> | |||
<DataTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="true"> | |||
<Setter Property="Width" Value="160" TargetName="leftborder"/> | |||
</Trigger> | |||
</DataTemplate.Triggers> | |||
</DataTemplate> | |||
</ListBox.ItemTemplate> | |||
</ListBox> | |||
</ScrollViewer> | |||
</Border> | |||
<!--#endregion--> | |||
</Grid> | |||
</Grid> | |||
</Grid> | |||
</Border> | |||
</UserControl> |
@@ -1,4 +1,5 @@ | |||
using BPASmart.Model.用户; | |||
using BPASmart.Model; | |||
using BPASmart.Model; | |||
using BPASmartClient.Helper; | |||
using System; | |||
using System.Collections.Generic; | |||
@@ -0,0 +1,115 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmart.UserManagement.ViewModel | |||
{ | |||
[INotifyPropertyChanged] | |||
partial class EditPowerViewModel | |||
{ | |||
/// <summary> | |||
/// 全部页面 | |||
/// </summary> | |||
public ObservableCollection<pageName> pageList { get; set; } = new ObservableCollection<pageName>(); | |||
/// <summary> | |||
/// 用户权限页面 | |||
/// </summary> | |||
public ObservableCollection<pageName> userPageList { get; set; } = new ObservableCollection<pageName>(); | |||
public ObservableCollection<string> UserNames { get; set; } = new ObservableCollection<string>(); | |||
[ObservableProperty] | |||
private string _currentUserName; | |||
/// <summary> | |||
/// 保存 | |||
/// </summary> | |||
[RelayCommand] | |||
private void SaveUserPower() | |||
{ | |||
Globle.GlobleData.EditUser = null; | |||
ActionManage.GetInstance.Send("ChangeMianContent", string.Empty); | |||
} | |||
/// <summary> | |||
/// 取消 | |||
/// </summary> | |||
[RelayCommand] | |||
private void Cancel() | |||
{ | |||
ActionManage.GetInstance.Send("ChangeMianContent", string.Empty); | |||
} | |||
/// <summary> | |||
/// 添加全部界面 | |||
/// </summary> | |||
[RelayCommand] | |||
private void AddAllPage() | |||
{ | |||
userPageList.Clear(); | |||
foreach(var item in pageList) | |||
{ | |||
userPageList.Add(item); | |||
} | |||
} | |||
/// <summary> | |||
/// 删除全部界面 | |||
/// </summary> | |||
[RelayCommand] | |||
private void DeleteAllPage() | |||
{ | |||
userPageList.Clear(); | |||
} | |||
[RelayCommand] | |||
private void AddPage(object o) | |||
{ | |||
if (o == null) return; | |||
if (o is string materail) | |||
{ | |||
var res = pageList.FirstOrDefault(p => p.Name == materail); | |||
if (userPageList.FirstOrDefault(p => p.Name == res.Name) == null) | |||
{ | |||
userPageList.Add(res); | |||
} | |||
} | |||
} | |||
[RelayCommand] | |||
private void DeletePage(object o) | |||
{ | |||
if (o == null) return; | |||
if (o is string materail) | |||
{ | |||
var res = userPageList.FirstOrDefault(p => p.Name == materail); | |||
userPageList.Remove(res); | |||
} | |||
} | |||
public EditPowerViewModel() | |||
{ | |||
pageList.Add(new pageName { Name = "主界面" }); | |||
pageList.Add(new pageName { Name = "控制界面" }); | |||
pageList.Add(new pageName { Name = "调试界面" }); | |||
pageList.Add(new pageName { Name = "日志界面" }); | |||
pageList.Add(new pageName { Name = "参数界面"}); | |||
pageList.Add(new pageName { Name = "调试界面" }); | |||
pageList.Add(new pageName { Name = "日志界面" }); | |||
pageList.Add(new pageName { Name = "参数界面" }); | |||
foreach(var item in Json<LocalUser>.Data.UserManagers) | |||
{ | |||
UserNames.Add(item.UserName); | |||
} | |||
if (Globle.GlobleData.EditUser != null) | |||
{ | |||
CurrentUserName = Globle.GlobleData.EditUser.UserName; | |||
} | |||
} | |||
} | |||
public class pageName | |||
{ | |||
public string Name { get; set; } | |||
} | |||
} |
@@ -7,7 +7,7 @@ global using System.Collections.Generic; | |||
global using System.Linq; | |||
global using System.Text; | |||
global using System.Threading.Tasks; | |||
global using BPASmart.Model.用户; | |||
global using BPASmart.Model; | |||
namespace BPASmart.UserManagement.ViewModel | |||
{ | |||
@@ -1,4 +1,4 @@ | |||
using BPASmart.Model.用户; | |||
using BPASmart.Model; | |||
using BPASmart.UserManagement.View; | |||
using BPASmartClient.Helper; | |||
using System; | |||
@@ -54,6 +54,8 @@ namespace BPASmart.UserManagement.ViewModel | |||
{ | |||
if (userManagers.Contains(user)) | |||
{ | |||
Globle.GlobleData.EditUser = null; | |||
Globle.GlobleData.EditUser = user; | |||
ActionManage.GetInstance.Send("ChangeMianContent", "EditPower"); | |||
} | |||
@@ -1,7 +1,8 @@ | |||
<Application x:Class="BPASmartClient.JXJFoodSmallStation.App" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:con="clr-namespace:BPASmartClient.CustomResource.Converters;assembly=BPASmartClient.CustomResource" | |||
<Application | |||
x:Class="BPASmartClient.JXJFoodSmallStation.App" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:con="clr-namespace:BPASmartClient.CustomResource.Converters;assembly=BPASmartClient.CustomResource" | |||
xmlns:local="clr-namespace:BPASmartClient.JXJFoodSmallStation"> | |||
<Application.Resources> | |||
<ResourceDictionary> | |||
@@ -1,17 +0,0 @@ | |||
<Project Sdk="Microsoft.NET.Sdk"> | |||
<PropertyGroup> | |||
<TargetFramework>net6.0-windows</TargetFramework> | |||
<ImplicitUsings>enable</ImplicitUsings> | |||
<Nullable>enable</Nullable> | |||
<UseWPF>true</UseWPF> | |||
<UseWindowsForms>true</UseWindowsForms> | |||
</PropertyGroup> | |||
<ItemGroup> | |||
<PackageReference Include="System.Reflection" Version="4.3.0" /> | |||
<PackageReference Include="System.Reflection.Emit" Version="4.7.0" /> | |||
<PackageReference Include="System.Reflection.TypeExtensions" Version="4.7.0" /> | |||
</ItemGroup> | |||
</Project> |
@@ -1,184 +0,0 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.ComponentModel; | |||
using System.Linq; | |||
using System.Reflection; | |||
using System.Reflection.Emit; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.Windows.Controls; | |||
namespace BPASmartClient.MessageName.EnumHelp | |||
{ | |||
/// <summary> | |||
/// 枚举 | |||
/// </summary> | |||
public static class EnumExtensions | |||
{ | |||
public static int jishu = 0; | |||
/// <summary> | |||
/// 根据控件-》创建枚举类型 | |||
/// </summary> | |||
/// <returns></returns> | |||
public static object CreatEnumType(UIElementCollection list) | |||
{ | |||
var currentDomain = AppDomain.CurrentDomain; | |||
var assembly = Assembly.GetExecutingAssembly(); | |||
var assemblyBuilder = AssemblyBuilder.DefineDynamicAssembly(assembly!.GetName(), AssemblyBuilderAccess.Run); | |||
var moduleBuilder = assemblyBuilder.DefineDynamicModule(assembly.GetName().Name!); | |||
var em = moduleBuilder.DefineEnum($"Control_{((Convert.ToInt32(jishu) + 1).ToString().PadLeft(4, '0'))}", TypeAttributes.Public, typeof(string)); | |||
foreach (var item in list) | |||
{ | |||
if (item is System.Windows.Controls.Control e) | |||
{ | |||
if (e.Tag != null) | |||
{ | |||
em.DefineLiteral(e.Tag.ToString(), e.Tag.ToString()); | |||
} | |||
} | |||
} | |||
em.DefineLiteral("空", "空"); | |||
Type finished = em.CreateType()!; | |||
return finished; | |||
//foreach (object o in Enum.GetValues(finished)) | |||
//{ | |||
// Console.WriteLine($"{finished}.{o} = {(int)o};"); | |||
//} | |||
} | |||
/// <summary> | |||
/// 动态创建枚举 | |||
/// </summary> | |||
/// <param name="enumDictionary">枚举元素列表</param> | |||
/// <param name="enumName">枚举名</param> | |||
/// <returns>Enum枚举</returns> | |||
public static Enum CreateEnum(Dictionary<string,int> enumDictionary,string enumName = "DefalutEnum") | |||
{ | |||
if (enumDictionary == null || enumDictionary.Count <= 0) | |||
return null; | |||
AppDomain currentDomain = AppDomain.CurrentDomain; | |||
AssemblyName aName = new AssemblyName("TempAssembly"); | |||
AssemblyBuilder ab = AssemblyBuilder.DefineDynamicAssembly(aName,AssemblyBuilderAccess.Run); | |||
ModuleBuilder mb = ab.DefineDynamicModule(aName.Name); | |||
if (string.IsNullOrEmpty(enumName)) | |||
{ | |||
enumName = "DefalutEnum"; | |||
} | |||
EnumBuilder eb = mb.DefineEnum(enumName,TypeAttributes.Public,typeof(int)); | |||
foreach (var item in enumDictionary) | |||
{ | |||
eb.DefineLiteral(item.Key,item.Value); | |||
} | |||
Type finished = eb.CreateType(); | |||
Enum eEnum = Activator.CreateInstance(finished) as Enum; | |||
//foreach (object item in Enum.GetValues(eEnum.GetType())) | |||
//{ | |||
// Debug.LogError(string.Format("{0}.{1} = {2}", finished, item, ((int)item))); | |||
//} | |||
return eEnum; | |||
} | |||
/// <summary> | |||
/// 动态创建枚举 | |||
/// </summary> | |||
/// <param name="enumDictionary">枚举元素列表</param> | |||
/// <param name="enumName">枚举名</param> | |||
/// <returns>Enum枚举</returns> | |||
public static Enum CreateEnum(List<string> enumList,string enumName = "DefalutEnum") | |||
{ | |||
if (enumList == null || enumList.Count <= 0) | |||
return null; | |||
AppDomain currentDomain = AppDomain.CurrentDomain; | |||
AssemblyName aName = new AssemblyName("TempAssembly"); | |||
AssemblyBuilder ab = AssemblyBuilder.DefineDynamicAssembly(aName,AssemblyBuilderAccess.Run); | |||
ModuleBuilder mb = ab.DefineDynamicModule(aName.Name); | |||
if (string.IsNullOrEmpty(enumName)) | |||
{ | |||
enumName = "DefalutEnum"; | |||
} | |||
EnumBuilder eb = mb.DefineEnum(enumName,TypeAttributes.Public,typeof(int)); | |||
for (int i = 0; i < enumList.Count; i++) | |||
{ | |||
eb.DefineLiteral(enumList[i],i); | |||
} | |||
Type finished = eb.CreateType(); | |||
Enum eEnum = Activator.CreateInstance(finished) as Enum; | |||
//foreach (object item in Enum.GetValues(eEnum.GetType())) | |||
//{ | |||
// Debug.LogError(string.Format("{0}.{1} = {2}", finished, item, ((int)item))); | |||
//} | |||
return eEnum; | |||
} | |||
/// <summary> | |||
/// 根据枚举int值获取枚举名称 | |||
/// </summary> | |||
/// <typeparam name="T">枚举类型</typeparam> | |||
/// <param name="status">枚举值</param> | |||
/// <returns></returns> | |||
public static string GetEnumName<T>(this int status) | |||
{ | |||
return Enum.GetName(typeof(T), status); | |||
} | |||
/// <summary> | |||
/// 根据枚举名称获取枚举值 | |||
/// </summary> | |||
public static T ToEnumValue<T>(string name) | |||
{ | |||
return (T)Enum.Parse(typeof(T),name); | |||
} | |||
/// <summary> | |||
/// 获取枚举变量值的 Description 属性 | |||
/// </summary> | |||
/// <param name="obj">枚举变量</param> | |||
/// <returns>如果包含 Description 属性,则返回 Description 属性的值,否则返回枚举变量值的名称</returns> | |||
public static string GetDescription(this Enum obj) | |||
{ | |||
return GetDescription(obj, false); | |||
} | |||
/// <summary> | |||
/// 获取枚举变量值的 Description 属性 | |||
/// </summary> | |||
/// <param name="obj">枚举变量</param> | |||
/// <param name="isTop">是否改变为返回该类、枚举类型的头 Description 属性,而不是当前的属性或枚举变量值的 Description 属性</param> | |||
/// <returns>如果包含 Description 属性,则返回 Description 属性的值,否则返回枚举变量值的名称</returns> | |||
public static string GetDescription(this Enum obj, bool isTop) | |||
{ | |||
if (obj == null) | |||
{ | |||
return string.Empty; | |||
} | |||
Type enumType = obj.GetType(); | |||
DescriptionAttribute dna; | |||
if (isTop) | |||
{ | |||
dna = (DescriptionAttribute)Attribute.GetCustomAttribute(enumType, typeof(DescriptionAttribute)); | |||
} | |||
else | |||
{ | |||
FieldInfo fi = enumType.GetField(System.Enum.GetName(enumType, obj)); | |||
dna = (DescriptionAttribute)Attribute.GetCustomAttribute( | |||
fi, typeof(DescriptionAttribute)); | |||
} | |||
if ((dna != null) | |||
&& (string.IsNullOrEmpty(dna.Description) == false)) | |||
{ | |||
return dna.Description; | |||
} | |||
return obj.ToString(); | |||
} | |||
} | |||
} |
@@ -1,18 +0,0 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.MessageName.EnumHelp | |||
{ | |||
/// <summary> | |||
/// 运行状态-枚举 | |||
/// </summary> | |||
public enum InterfaceModeEnum | |||
{ | |||
POST, | |||
GET, | |||
PUT | |||
} | |||
} |
@@ -1,41 +0,0 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.MessageName.EnumHelp | |||
{ | |||
/// <summary> | |||
/// 运行状态-枚举 | |||
/// </summary> | |||
public enum RunEnum | |||
{ | |||
/// <summary> | |||
/// 运行(滚动线默认右转) | |||
/// </summary> | |||
Run, | |||
/// <summary> | |||
/// 运行-左转(滚动线独有) | |||
/// </summary> | |||
Run_Left, | |||
/// <summary> | |||
/// 停止 | |||
/// </summary> | |||
Stop | |||
} | |||
/// <summary> | |||
/// 运行状态Model | |||
/// </summary> | |||
public class RunEnumModel | |||
{ | |||
/// <summary> | |||
/// 消息id号:ID号 | |||
/// </summary> | |||
public string MessageID { get; set; } | |||
/// <summary> | |||
/// 运行状态 | |||
/// </summary> | |||
public RunEnum Run { get; set; } | |||
} | |||
} |
@@ -1,119 +0,0 @@ | |||
using System.ComponentModel; | |||
using System.Reflection; | |||
using System.Reflection.Emit; | |||
namespace BPASmartClient.MessageName | |||
{ | |||
/// <summary> | |||
/// 消息名称管理中心---不在使用 | |||
/// 特性:Category,消息分组 | |||
/// Description,消息备注 | |||
/// Browsable,是否使用 | |||
/// 消息发送案例: | |||
/// Class_InnerMessageBus.GetInstance().PostMessage(this, MessageName.xxx, "12321"); | |||
/// 接收数据案例: | |||
/// Class_InnerMessageBus.GetInstance().ListenMessage(this, MessageName.xxx, "xxnameHandler"); | |||
/// public void xxnameHandler(object sender, InnerMessageEventArgs e) { } | |||
/// </summary> | |||
//public class MessageName | |||
//{ | |||
// #region XX消息 | |||
// /// <summary> | |||
// /// xxx消息 | |||
// /// </summary> | |||
// [Category("消息分组"),Description("消息备注"),Browsable(true)] | |||
// public static string xxx = "xxx"; | |||
// #endregion | |||
// #region 滚动线消息事件管理中心 | |||
// /// <summary> | |||
// /// 滚动线控制滚动消息 | |||
// /// </summary> | |||
// [Category("滚动线"), Description("滚动线控制滚动"), Browsable(true)] | |||
// public static string ConveyorBeltIsRun = "ConveyorBeltIsRun"; | |||
// /// <summary> | |||
// /// 滚动线控制左转 | |||
// /// </summary> | |||
// [Category("滚动线"), Description("滚动线控制左转"), Browsable(true)] | |||
// public static string ConveyorBeltLeft = "ConveyorBeltLeft"; | |||
// /// <summary> | |||
// /// 滚动线控制右转 | |||
// /// </summary> | |||
// [Category("滚动线"), Description("滚动线控制右转"), Browsable(true)] | |||
// public static string ConveyorBeltRight = "ConveyorBeltRight"; | |||
// /// <summary> | |||
// /// 滚动线控制停止 | |||
// /// </summary> | |||
// [Category("滚动线"), Description("滚动线控制停止"), Browsable(true)] | |||
// public static string ConveyorBeltStop = "ConveyorBeltStop"; | |||
// #endregion | |||
//} | |||
/// <summary> | |||
/// 消息名称管理中心-枚举 | |||
/// </summary> | |||
public enum MessageNameEnum | |||
{ | |||
/// <summary> | |||
/// 无 | |||
/// </summary> | |||
Null, | |||
/// <summary> | |||
/// 物料仓运行状态 | |||
/// </summary> | |||
SilosRunStatus, | |||
/// <summary> | |||
/// 物料仓数据设置 | |||
/// </summary> | |||
SilosSetData, | |||
/// <summary> | |||
/// 滚动线运行状态 | |||
/// </summary> | |||
ConveyorBeltRunStatus, | |||
/// <summary> | |||
/// 发送消息 | |||
/// </summary> | |||
SendMessageName, | |||
/// <summary> | |||
/// 接收消息 | |||
/// </summary> | |||
ReceiveMessageName, | |||
} | |||
/// <summary> | |||
/// 消息基类 | |||
/// </summary> | |||
public class MessageBase | |||
{ | |||
/// <summary> | |||
/// 消息号 | |||
/// </summary> | |||
public string MeaageID { get; set; } | |||
// <summary> | |||
/// 消息名称:枚举 | |||
/// </summary> | |||
public MessageNameEnum MeaageName { get; set; } | |||
public MessageBase() | |||
{ | |||
MeaageID = GetMessageID.GetID(); | |||
} | |||
} | |||
/// <summary> | |||
/// 四位消息号 | |||
/// </summary> | |||
public static class GetMessageID | |||
{ | |||
public static int i = 0; | |||
public static string GetID() | |||
{ | |||
i++; | |||
return ((Convert.ToInt32(i) + 1).ToString().PadLeft(8, '0')); | |||
} | |||
} | |||
} |
@@ -1,62 +0,0 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.MessageName.发送消息Model | |||
{ | |||
/// <summary> | |||
/// 事件消息【发送端】Model配置 | |||
/// </summary> | |||
public class EventSendMessage: MessageBase | |||
{ | |||
/// <summary> | |||
/// 控件名称 | |||
/// </summary> | |||
public string ControlName { get; set; } | |||
/// <summary> | |||
/// 控件标题 | |||
/// </summary> | |||
public string ControlTitle { get; set; } | |||
/// <summary> | |||
/// 控件触发源 | |||
/// </summary> | |||
public object ControlSource { get; set; } | |||
/// <summary> | |||
/// 控件状态 | |||
/// </summary> | |||
public string ControlStatus { get; set; } | |||
/// <summary> | |||
/// 控件类型 | |||
/// </summary> | |||
public ControlEventType EventType { get; set; } | |||
} | |||
/// <summary> | |||
/// 控件类型 | |||
/// </summary> | |||
public enum ControlEventType | |||
{ | |||
/// <summary> | |||
/// 单击 | |||
/// </summary> | |||
Click, | |||
/// <summary> | |||
/// 左键按下 | |||
/// </summary> | |||
MouseLeftButtonDown, | |||
/// <summary> | |||
/// 文本改变事件 | |||
/// </summary> | |||
TextChanged, | |||
/// <summary> | |||
/// 选中 | |||
/// </summary> | |||
Checked, | |||
/// <summary> | |||
/// 取消选中 | |||
/// </summary> | |||
Unchecked, | |||
} | |||
} |
@@ -1,35 +0,0 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.MessageName.接收消息Model | |||
{ | |||
/// <summary> | |||
/// 事件消息[接收端]Model:配置 | |||
/// </summary> | |||
public class EventReceiveMessage:MessageBase | |||
{ | |||
///// <summary> | |||
///// 消息号 | |||
///// </summary> | |||
//public string MeaageID { get; set; } | |||
//// <summary> | |||
///// 消息名称:枚举 | |||
///// </summary> | |||
//public MessageNameEnum MeaageName { get; set; } | |||
/// <summary> | |||
/// 空:保留 | |||
/// </summary> | |||
public string Value { get; set; } | |||
/// <summary> | |||
/// 消息标题:标志控件说明 | |||
/// </summary> | |||
public string Title { get; set; } | |||
//public EventReceiveMessage() | |||
//{ | |||
// MeaageID = GetMessageID.GetID(); | |||
//} | |||
} | |||
} |
@@ -1,23 +0,0 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.MessageName.接收消息Model.滚动线 | |||
{ | |||
/// <summary> | |||
/// 滚动线数据设置-Model | |||
/// </summary> | |||
public class ConveyorBeltMessageModel | |||
{ | |||
/// <summary> | |||
/// 消息ID号:id 号 | |||
/// </summary> | |||
public string MessageID { get; set; } | |||
/// <summary> | |||
/// 滚动线:标题 | |||
/// </summary> | |||
public string Title { get; set; } | |||
} | |||
} |
@@ -1,31 +0,0 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.MessageName.接收消息Model.物料仓 | |||
{ | |||
/// <summary> | |||
/// 物料仓数据设置-Model | |||
/// </summary> | |||
public class SilosMessageModel | |||
{ | |||
/// <summary> | |||
/// 消息ID号:id 号 | |||
/// </summary> | |||
public string MessageID { get; set; } | |||
/// <summary> | |||
/// 物料仓:标题 | |||
/// </summary> | |||
public string Title { get; set; } | |||
/// <summary> | |||
/// 物料仓:重量(G) 35.23 | |||
/// </summary> | |||
public string Value { get; set; } | |||
/// <summary> | |||
/// 物料仓:仓号说明 | |||
/// </summary> | |||
public string Text { get; set; } | |||
} | |||
} |
@@ -0,0 +1,13 @@ | |||
<Project Sdk="Microsoft.NET.Sdk"> | |||
<PropertyGroup> | |||
<TargetFramework>net6.0</TargetFramework> | |||
<ImplicitUsings>enable</ImplicitUsings> | |||
<Nullable>enable</Nullable> | |||
</PropertyGroup> | |||
<ItemGroup> | |||
<ProjectReference Include="..\BPASmartClient.Device\BPASmartClient.Device.csproj" /> | |||
</ItemGroup> | |||
</Project> |
@@ -0,0 +1,200 @@ | |||
using BPA.Message.Enum; | |||
using BPASmartClient.Device; | |||
using BPASmartClient.EventBus; | |||
using BPASmartClient.Model; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using static BPASmartClient.EventBus.EventBus; | |||
namespace BPASmartClient.MorkMOC | |||
{ | |||
public class Control_MorkMOC : BaseDevice | |||
{ | |||
GVL_MorkMOC morkMoc = new GVL_MorkMOC(); | |||
PolymerBatching polymerBatching = new PolymerBatching(); | |||
//放大倍数 | |||
const int expand = 10; | |||
public override DeviceClientType DeviceType => throw new NotImplementedException(); | |||
public override void DoMain() | |||
{ | |||
ServerInit(); | |||
DataParse(); | |||
} | |||
private void ServerInit() | |||
{ | |||
//物料信息 | |||
EventBus.EventBus.GetInstance().Subscribe<MaterialDeliveryEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||
{ | |||
if (@event == null) return; | |||
if (@event is MaterialDeliveryEvent material) | |||
{ | |||
orderMaterialDelivery = material.orderMaterialDelivery; | |||
} | |||
}); | |||
//配方数据信息 | |||
EventBus.EventBus.GetInstance().Subscribe<RecipeBomEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||
{ | |||
if (@event == null) return; | |||
if (@event is RecipeBomEvent recipe) | |||
{ | |||
recipeBoms = recipe.recipeBoms; | |||
} | |||
}); | |||
} | |||
private void DataParse() | |||
{ | |||
EventBus.EventBus.GetInstance().Subscribe<DoOrderEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||
{ | |||
if (@event == null) return; | |||
if (@event is DoOrderEvent order) | |||
{ | |||
if (order.MorkOrder.GoodBatchings == null) return; | |||
OrderCount++; | |||
morkMoc.doOrderEvents.Add(order); | |||
OrderChange(order.MorkOrder.SuborderId, ORDER_STATUS.WAIT); | |||
DeviceProcessLogShow($"接收到{OrderCount}次订单"); | |||
Dictionary<int, int> OrderPushes = new Dictionary<int, int>(); | |||
foreach (var item in order.MorkOrder.GoodBatchings) | |||
{ | |||
var res = orderMaterialDelivery?.BatchingInfo?.FirstOrDefault(p => p.BatchingId == item.BatchingId); | |||
if (res != null) | |||
{ | |||
OrderPushes.TryAdd(int.Parse(res.BatchingLoc), item.BatchingCount); | |||
} | |||
} | |||
morkMoc.morkOrderPushes.Enqueue(new OrderLocInfo() | |||
{ | |||
GoodName = order.MorkOrder.GoodsName, | |||
SuborderId = order.MorkOrder.SuborderId, | |||
GoodPushes = OrderPushes | |||
}); | |||
} | |||
}); | |||
} | |||
/// <summary> | |||
/// 订单改变通知 | |||
/// </summary> | |||
/// <param name="subid"></param> | |||
/// <param name="oRDER_STATUS"></param> | |||
private void OrderChange(string subid, ORDER_STATUS oRDER_STATUS) | |||
{ | |||
var res = morkMoc.doOrderEvents.FirstOrDefault(p => p.MorkOrder.SuborderId == subid); | |||
string goodName = string.Empty; | |||
string SortNum = string.Empty; | |||
EventBus.EventBus.GetInstance().Publish(new OrderStatusChangedEvent() | |||
{ | |||
SortNum = res.MorkOrder.SortNum.ToString(), | |||
GoodName = res.MorkOrder.GoodsName, | |||
Status = oRDER_STATUS, | |||
SubOrderId = res.MorkOrder.SuborderId, | |||
deviceClientType = DeviceType | |||
}); | |||
if (oRDER_STATUS == ORDER_STATUS.COMPLETED_COOK) morkMoc.doOrderEvents.Remove(res); | |||
} | |||
public override void MainTask() | |||
{ | |||
MakeProcess(); | |||
} | |||
/// <summary> | |||
/// 制作流程 | |||
/// </summary> | |||
private void MakeProcess() | |||
{ | |||
if (morkMoc.morkOrderPushes.Count > 0) | |||
{ | |||
if (morkMoc.morkOrderPushes.TryDequeue(out OrderLocInfo orderLoc)) | |||
{ | |||
// 第一步:设置每个仓的出料量 | |||
SetMaterialsWeight(orderLoc.GoodPushes); | |||
DeviceProcessLogShow("设置出料量完成"); | |||
//第二步:循环出料 | |||
OutMaterials(orderLoc.GoodPushes); | |||
DeviceProcessLogShow($"{orderLoc.GoodName}制作完成"); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 设定出料重量 | |||
/// </summary> | |||
/// <param name="goodPushes"></param> | |||
private void SetMaterialsWeight(Dictionary<int,int> goodPushes) | |||
{ | |||
foreach(var good in goodPushes) | |||
{ | |||
WriteControl(polymerBatching.plcData[good.Key - 1].WeightVar, good.Value * expand); | |||
DeviceProcessLogShow($"{good.Key}号通道出料量:{good.Value}g"); | |||
Thread.Sleep(300); | |||
} | |||
} | |||
/// <summary> | |||
/// 循环出料 | |||
/// </summary> | |||
private void OutMaterials(Dictionary<int, int> goodPushes) | |||
{ | |||
foreach (var good in goodPushes) | |||
{ | |||
WriteControl(polymerBatching.plcData[good.Key - 1].StartUpVar, true); | |||
Thread.Sleep(3000);//写入PLC开启通道后 PLC会先把完成信号置0,等待出料完成后置1 | |||
while(!morkMoc.OutMaterailCompelete)//接收到完成信号后退出循环 | |||
{ | |||
Thread.Sleep(1000); | |||
//需要加入超时提示或处理 | |||
} | |||
DeviceProcessLogShow($"{good.Key}号通道出料完成"); | |||
} | |||
} | |||
public override void ReadData() | |||
{ | |||
GetStatus("M10.0", new Action<object>((obj) => | |||
{ | |||
if (obj is bool[] bools && bools.Length > 0 ) | |||
{ | |||
morkMoc.OutMaterailCompelete = bools[0]; | |||
} | |||
})); | |||
} | |||
public override void ResetProgram() | |||
{ | |||
throw new NotImplementedException(); | |||
} | |||
public override void SimOrder() | |||
{ | |||
throw new NotImplementedException(); | |||
} | |||
public override void Stop() | |||
{ | |||
throw new NotImplementedException(); | |||
} | |||
private void GetStatus(string key, Action<object> action) | |||
{ | |||
if (peripheralStatus.ContainsKey(key)) | |||
{ | |||
if (peripheralStatus[key] != null) | |||
{ | |||
action?.Invoke(peripheralStatus[key]); | |||
} | |||
} | |||
} | |||
} | |||
} |
@@ -0,0 +1,26 @@ | |||
using BPASmartClient.Model; | |||
using System; | |||
using System.Collections.Concurrent; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.MorkMOC | |||
{ | |||
public class GVL_MorkMOC | |||
{ | |||
/// <summary> | |||
/// 订单队列 | |||
/// </summary> | |||
public ConcurrentQueue<OrderLocInfo> morkOrderPushes = new ConcurrentQueue<OrderLocInfo>(); | |||
/// <summary> | |||
/// 订单暂存列表 | |||
/// </summary> | |||
public List<DoOrderEvent> doOrderEvents { get; set; } = new List<DoOrderEvent>(); | |||
public bool OutMaterailCompelete = false; | |||
} | |||
} |
@@ -0,0 +1,16 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Text; | |||
namespace BPASmartClient.MorkMOC | |||
{ | |||
public class OrderLocInfo | |||
{ | |||
public string SuborderId { get; set; } | |||
public ushort RecipeNumber { get; set; } | |||
public string GoodName { get; set; } | |||
public Dictionary<int, int> GoodPushes { get; set; } | |||
} | |||
} |
@@ -0,0 +1,52 @@ | |||
using BPASmartClient.Helper; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Data; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.MorkMOC | |||
{ | |||
public class PolymerBatching | |||
{ | |||
public List<PLCData> plcData = new List<PLCData>(); | |||
public PolymerBatching() | |||
{ | |||
plcData.Add(new PLCData { Positon = 1,WeightVar = "VW200", StartUpVar = "M4.0" }); | |||
plcData.Add(new PLCData { Positon = 2, WeightVar = "VW202", StartUpVar = "M4.1" }); | |||
plcData.Add(new PLCData { Positon = 3, WeightVar = "VW204", StartUpVar = "M4.2" }); | |||
plcData.Add(new PLCData { Positon = 4, WeightVar = "VW206", StartUpVar = "M4.3" }); | |||
plcData.Add(new PLCData { Positon = 5, WeightVar = "VW208", StartUpVar = "M4.4" }); | |||
plcData.Add(new PLCData { Positon = 6, WeightVar = "VW210", StartUpVar = "M4.5" }); | |||
plcData.Add(new PLCData { Positon = 7, WeightVar = "VW212", StartUpVar = "M4.6" }); | |||
plcData.Add(new PLCData { Positon = 8, WeightVar = "VW214", StartUpVar = "M4.7" }); | |||
plcData.Add(new PLCData { Positon = 9, WeightVar = "VW216", StartUpVar = "M5.0" }); | |||
plcData.Add(new PLCData { Positon = 10, WeightVar = "VW218", StartUpVar = "M5.1" }); | |||
plcData.Add(new PLCData { Positon = 11, WeightVar = "VW220", StartUpVar = "M5.2" }); | |||
plcData.Add(new PLCData { Positon = 12, WeightVar = "VW222", StartUpVar = "M5.3" }); | |||
plcData.Add(new PLCData { Positon = 13, WeightVar = "VW224", StartUpVar = "M5.4" }); | |||
plcData.Add(new PLCData { Positon = 14, WeightVar = "VW226", StartUpVar = "M5.5" }); | |||
} | |||
} | |||
public class PLCData | |||
{ | |||
/// <summary> | |||
/// 通道位置 | |||
/// </summary> | |||
public int Positon; | |||
/// <summary> | |||
/// PLC通道重量点位 | |||
/// </summary> | |||
public string WeightVar; | |||
/// <summary> | |||
/// PLC通道启动点位 | |||
/// </summary> | |||
public string StartUpVar; | |||
} | |||
} |
@@ -34,7 +34,7 @@ namespace BPASmartClient.MorkS | |||
public override void DoMain() | |||
{ | |||
MonitorViewModel.DeviceId = DeviceId; | |||
ServerInit(); | |||
@@ -60,12 +60,12 @@ namespace BPASmartClient.MorkS | |||
ActionManage.GetInstance.Register(new Action<object[]>((o) => | |||
{ | |||
if (o.Length > 0 ) | |||
if (o.Length > 0) | |||
{ | |||
Random rd = new Random(); | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
int NoodleLoc = (int)o[0] == 0? rd.Next(1, 6) : (int)o[0]; | |||
int NoodleLoc = (int)o[0] == 0 ? rd.Next(1, 6) : (int)o[0]; | |||
int BowlLoc = (int)o[1] == 0 ? rd.Next(10, 12) : (int)o[1]; | |||
string guid = new Guid().ToString(); | |||
@@ -144,7 +144,7 @@ namespace BPASmartClient.MorkS | |||
private void GetStatus(string key, Action<object> action) | |||
{ | |||
if (peripheralStatus.ContainsKey(key)) | |||
{ | |||
{ | |||
if (peripheralStatus[key] != null) | |||
{ | |||
action?.Invoke(peripheralStatus[key]); | |||
@@ -273,7 +273,7 @@ namespace BPASmartClient.MorkS | |||
if (order.MorkOrder.GoodBatchings == null) return; | |||
OrderCount++; | |||
OrderChange(order.MorkOrder.SuborderId, ORDER_STATUS.WAIT); | |||
DeviceProcessLogShow($"接收到{OrderCount}次订单"); | |||
DeviceProcessLogShow($"接收到{OrderCount}次订单,订单ID:{order.MorkOrder.SuborderId}"); | |||
foreach (var item in order.MorkOrder.GoodBatchings) | |||
{ | |||
var res = orderMaterialDelivery?.BatchingInfo?.FirstOrDefault(p => p.BatchingId == item.BatchingId); | |||
@@ -556,7 +556,7 @@ namespace BPASmartClient.MorkS | |||
DeviceProcessLogShow("取餐过程中复位出餐完成信号"); | |||
} | |||
if (!string.IsNullOrEmpty(mORKS.OutMealId)) OrderChange(mORKS.OutMealId, ORDER_STATUS.COMPLETED_TAKE); | |||
mORKS.OutMealId = mORKS.IngredientsCompleteId; | |||
mORKS.OutMealName = mORKS.IngredientsCompleteName; | |||
mORKS.IngredientsCompleteId = string.Empty; | |||
@@ -596,7 +596,7 @@ namespace BPASmartClient.MorkS | |||
} | |||
//取餐完成逻辑处理 | |||
if (Delay.GetInstance("CompleteChange1").Start(mORKS.CookCompleteFlatBit && !mORKS.TakeMealDetect, 1)) | |||
if (Delay.GetInstance("CompleteChange1").Start( !mORKS.TakeMealDetect, 1)&&mORKS.CookCompleteFlatBit == true) | |||
{ | |||
OrderChange(mORKS.OutMealId, ORDER_STATUS.COMPLETED_TAKE); | |||
DeviceProcessLogShow($"订单【{mORKS.OutMealId}】取餐完成"); | |||
@@ -633,10 +633,10 @@ namespace BPASmartClient.MorkS | |||
/// </summary> | |||
/// <param name="meal"></param> | |||
private void WaitMeaLSpeak(string meal) | |||
{ | |||
{ | |||
VoiceAPI.m_SystemPlayWav(@"Vioce\电子提示音.wav"); | |||
Thread.Sleep(1000); | |||
if(meal!= null) mORKS.speech.Speak(meal); | |||
if (meal != null) mORKS.speech.Speak(meal); | |||
VoiceAPI.m_SystemPlayWav(@"Vioce\取餐通知.wav"); | |||
} | |||
@@ -802,12 +802,15 @@ namespace BPASmartClient.MorkS | |||
if (msm.NoodleLoc >= 1 && msm.NoodleLoc <= 5) | |||
{ | |||
mORKS.RBTakeNoodleTask.Enqueue(new OrderLocInfo() { Loc = (ushort)msm.NoodleLoc, SuborderId = guid }); | |||
MessageLog.GetInstance.Show($"添加订单:面条位置【{(ushort)msm.NoodleLoc}】"); | |||
} | |||
if (msm.Bowloc >= 10 && msm.Bowloc <= 11) | |||
{ | |||
mORKS.TakeBowlTask.Enqueue(new OrderLocInfo() { Loc = (ushort)msm.Bowloc, SuborderId = guid }); | |||
MessageLog.GetInstance.Show($"添加订单:碗位置【{(ushort)msm.Bowloc}】"); | |||
} | |||
} | |||
}); | |||
} | |||
@@ -53,8 +53,6 @@ | |||
<ItemGroup> | |||
<ProjectReference Include="..\BPASmart.Model\BPASmart.Model.csproj" /> | |||
<ProjectReference Include="..\BPASmartClient.DATABUS\BPASmartClient.DATABUS.csproj" /> | |||
<ProjectReference Include="..\BPASmartClient.MessageCommunication\BPASmartClient.MessageCommunication.csproj" /> | |||
<ProjectReference Include="..\BPASmartClient.MessageName\BPASmartClient.MessageName.csproj" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
@@ -1,11 +1,4 @@ | |||
using BPASmartClient.Compiler; | |||
using BPASmartClient.MessageCommunication; | |||
using BPASmartClient.MessageCommunication.MsgControl; | |||
using BPASmartClient.MessageName; | |||
using BPASmartClient.MessageName.EnumHelp; | |||
using BPASmartClient.MessageName.发送消息Model; | |||
using BPASmartClient.MessageName.接收消息Model; | |||
using BPASmartClient.MessageName.接收消息Model.滚动线; | |||
using Newtonsoft.Json; | |||
using System; | |||
using System.Collections.Generic; | |||
@@ -55,26 +48,6 @@ namespace BPASmartClient.SCADAControl.CustomerControls | |||
StrokeDashArray = new DoubleCollection { 1.5, 1.5 }; | |||
StrokeFillBrush = new SolidColorBrush((System.Windows.Media.Color)System.Windows.Media.ColorConverter.ConvertFromString("#00BEFA")); | |||
StrokeThickness = 2; | |||
this.Loaded += NewConveyorBelt_Loaded; ; | |||
} | |||
private void NewConveyorBelt_Loaded(object sender, RoutedEventArgs e) | |||
{ | |||
EventReceiveNameList.CollectionChanged += EventNameList_CollectionChanged; | |||
} | |||
private void EventNameList_CollectionChanged(object? sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) | |||
{ | |||
if (EventReceiveNameList.Count > 0) | |||
{ | |||
try | |||
{ | |||
EventReceiveNameListStr = JsonConvert.SerializeObject(EventReceiveNameList); | |||
} | |||
catch (Exception ex) | |||
{ | |||
} | |||
} | |||
} | |||
public string ControlType => "滚动线"; | |||
@@ -315,84 +288,12 @@ namespace BPASmartClient.SCADAControl.CustomerControls | |||
} | |||
public static readonly DependencyProperty ConveyorBeltStopProperty = | |||
DependencyProperty.Register("ConveyorBeltStop", typeof(string), typeof(NewConveyorBelt), new PropertyMetadata(string.Empty)); | |||
[Category("名称[自动生成]")] | |||
public string EventReceiveNameListStr | |||
{ | |||
get { return (string)GetValue(EventReceiveNameListStrProperty); } | |||
set { SetValue(EventReceiveNameListStrProperty, value); } | |||
} | |||
public static readonly DependencyProperty EventReceiveNameListStrProperty = | |||
DependencyProperty.Register("EventReceiveNameListStr",typeof(string),typeof(NewConveyorBelt),new PropertyMetadata(string.Empty,new PropertyChangedCallback(onEventReceiveNameListStrChanged))); | |||
private static void onEventReceiveNameListStrChanged(DependencyObject d,DependencyPropertyChangedEventArgs e) => (d as NewConveyorBelt)?.ReceiveNameRefresh(); | |||
[Category("消息接收名称集合")] | |||
public ObservableCollection<EventReceiveMessage> EventReceiveNameList | |||
{ | |||
get { return (ObservableCollection<EventReceiveMessage>)GetValue(EventReceiveNameListProperty); } | |||
set { SetValue(EventReceiveNameListProperty, value); } | |||
} | |||
public static readonly DependencyProperty EventReceiveNameListProperty = | |||
DependencyProperty.Register("EventReceiveNameList", typeof(ObservableCollection<EventReceiveMessage>), typeof(NewConveyorBelt), new PropertyMetadata(new ObservableCollection<EventReceiveMessage>(), onEventNameListChanged)); | |||
private static void onEventNameListChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) => (d as NewConveyorBelt)?.RunNameRefresh(); | |||
#endregion | |||
#region 属性变更事件 | |||
List<string> MessageNameL = null; | |||
public void Register() | |||
{ | |||
if (!string.IsNullOrEmpty(EventReceiveNameListStr)) | |||
{ | |||
try | |||
{ | |||
EventReceiveNameList = JsonConvert.DeserializeObject<ObservableCollection<EventReceiveMessage>>(EventReceiveNameListStr); | |||
} | |||
catch (Exception ex) | |||
{ | |||
} | |||
} | |||
List<string> MessageNameNew = EventReceiveNameList?.Select(o => o.MeaageName.ToString())?.Distinct()?.ToList(); | |||
if (MessageNameL == null || !MessageNameNew.SequenceEqual(MessageNameL)) | |||
{ | |||
MessageNameL?.ForEach(o => Class_InnerMessageBus.GetInstance().RemoveMessage(o,"NewConveyorBeltEventHandler")); | |||
MessageNameNew?.ForEach(x => Class_InnerMessageBus.GetInstance().ListenMessage(this,x,"NewConveyorBeltEventHandler")); | |||
MessageNameL = MessageNameNew; | |||
} | |||
} | |||
public void NewConveyorBeltEventHandler(object sender, InnerMessageEventArgs e) | |||
{ | |||
try | |||
{ | |||
if (IsExecuteState = true) | |||
{ | |||
if (e.obj_MessageObj is RunEnumModel)//接收到运行消息 | |||
{ | |||
RunEnumModel mode = (RunEnumModel)e.obj_MessageObj; | |||
var msg = EventReceiveNameList?.ToList().Find(par => par.MeaageName.ToString() == e.str_MessageStr && par.MeaageID == mode.MessageID); | |||
//必对消息号: | |||
if (msg != null) | |||
{ | |||
Direction = mode.Run == RunEnum.Run ? 1 : ((mode.Run == RunEnum.Run_Left) ? 2 : 0); | |||
} | |||
} | |||
else if (e.obj_MessageObj is ConveyorBeltMessageModel)//接收到数据模型 | |||
{ | |||
ConveyorBeltMessageModel mode = (ConveyorBeltMessageModel)e.obj_MessageObj; | |||
var msg = EventReceiveNameList?.ToList().Find(par => par.MeaageName.ToString() == e.str_MessageStr && par.MeaageID == mode.MessageID); | |||
//必对消息号: | |||
if (msg != null) | |||
{ | |||
Text = mode.Title; | |||
} | |||
} | |||
} | |||
} | |||
catch (Exception ex) | |||
{ | |||
} | |||
} | |||
private void Refursh() | |||
@@ -1,12 +1,5 @@ | |||
using BPASmartClient.Compiler; | |||
using BPASmartClient.DATABUS; | |||
using BPASmartClient.MessageCommunication; | |||
using BPASmartClient.MessageCommunication.MsgControl; | |||
using BPASmartClient.MessageName; | |||
using BPASmartClient.MessageName.EnumHelp; | |||
using BPASmartClient.MessageName.发送消息Model; | |||
using BPASmartClient.MessageName.接收消息Model; | |||
using BPASmartClient.MessageName.接收消息Model.物料仓; | |||
using Newtonsoft.Json; | |||
using System; | |||
using System.Collections; | |||
@@ -1,8 +1,8 @@ | |||
using BPASmart.Model; | |||
using BPASmartClient.Compiler; | |||
using BPASmartClient.DATABUS; | |||
using BPASmartClient.MessageName.EnumHelp; | |||
using BPASmartClient.SCADAControl; | |||
using BPASmartClient.SCADAControl.EnumClass; | |||
using Newtonsoft.Json; | |||
using Newtonsoft.Json.Linq; | |||
using StackExchange.Redis; | |||
@@ -1,8 +1,7 @@ | |||
using BPASmartClient.Compiler; | |||
using BPASmartClient.DATABUS; | |||
using BPASmartClient.MessageName.EnumHelp; | |||
using BPASmartClient.MessageName.接收消息Model.物料仓; | |||
using BPASmartClient.SCADAControl.Converters; | |||
using BPASmartClient.SCADAControl.EnumClass; | |||
using Newtonsoft.Json; | |||
using System; | |||
using System.Collections.Generic; | |||
@@ -1,8 +1,7 @@ | |||
using BPASmartClient.Compiler; | |||
using BPASmartClient.DATABUS; | |||
using BPASmartClient.MessageName.EnumHelp; | |||
using BPASmartClient.MessageName.接收消息Model.物料仓; | |||
using BPASmartClient.SCADAControl.Converters; | |||
using BPASmartClient.SCADAControl.EnumClass; | |||
using Newtonsoft.Json; | |||
using System; | |||
using System.Collections.Generic; | |||
@@ -1,7 +1,6 @@ | |||
using BPASmart.Model; | |||
using BPASmartClient.Compiler; | |||
using BPASmartClient.DATABUS; | |||
using BPASmartClient.MessageName.EnumHelp; | |||
using BPASmartClient.SCADAControl; | |||
using Newtonsoft.Json; | |||
using StackExchange.Redis; | |||
@@ -1,7 +1,6 @@ | |||
using BPASmart.Model; | |||
using BPASmartClient.Compiler; | |||
using BPASmartClient.DATABUS; | |||
using BPASmartClient.MessageName.EnumHelp; | |||
using BPASmartClient.SCADAControl; | |||
using Newtonsoft.Json; | |||
using StackExchange.Redis; | |||
@@ -1,12 +1,5 @@ | |||
using BPASmartClient.Compiler; | |||
using BPASmartClient.DATABUS; | |||
using BPASmartClient.MessageCommunication; | |||
using BPASmartClient.MessageCommunication.MsgControl; | |||
using BPASmartClient.MessageName; | |||
using BPASmartClient.MessageName.EnumHelp; | |||
using BPASmartClient.MessageName.发送消息Model; | |||
using BPASmartClient.MessageName.接收消息Model; | |||
using BPASmartClient.MessageName.接收消息Model.物料仓; | |||
using Newtonsoft.Json; | |||
using System; | |||
using System.Collections; | |||
@@ -4,7 +4,7 @@ using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.MessageName.EnumHelp | |||
namespace BPASmartClient.SCADAControl.EnumClass | |||
{ | |||
/// <summary> | |||
/// 数据来源类型 | |||
@@ -36,4 +36,14 @@ namespace BPASmartClient.MessageName.EnumHelp | |||
/// </summary> | |||
静态数据 | |||
} | |||
/// <summary> | |||
/// 运行状态-枚举 | |||
/// </summary> | |||
public enum InterfaceModeEnum | |||
{ | |||
POST, | |||
GET, | |||
PUT | |||
} | |||
} |
@@ -30,6 +30,7 @@ | |||
<ResourceDictionary> | |||
<ImageBrush x:Key="hbl" ImageSource="/BPASmartClient.CustomResource;component/Image/HBL.png" /> | |||
<ImageBrush x:Key="dbxt" ImageSource="/BPASmartClient.CustomResource;component/Image/顶部线条.png" /> | |||
<SolidColorBrush x:Key="PoupTextblockColor" Color="#009dff" /> | |||
</ResourceDictionary> | |||
</ResourceDictionary.MergedDictionaries> | |||
@@ -6,6 +6,7 @@ using System.Data; | |||
using System.Linq; | |||
using System.Threading.Tasks; | |||
using System.Windows; | |||
using BPA.Helper; | |||
using BPASmartClient.CustomResource.Pages.Enums; | |||
using BPASmartClient.CustomResource.Pages.Model; | |||
using BPASmartClient.CustomResource.Pages.View; | |||
@@ -21,18 +22,21 @@ namespace BPASmartClient.SmallBatchingSystem | |||
protected override void OnStartup(StartupEventArgs e) | |||
{ | |||
base.OnStartup(e); | |||
Json<ConfigInfoModel>.Read(); | |||
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; | |||
MenuInit(); | |||
Control.GetInstance.Init(); | |||
SiloServer siloServer = new SiloServer(); | |||
MainView mv = new MainView(); | |||
LoginView lv = new LoginView(); | |||
var res = lv.ShowDialog(); | |||
if (res != null && res == true) | |||
{ | |||
MessageLog.GetInstance.ShowUserLog("用户登录"); | |||
mv.Show(); | |||
} | |||
else | |||
mv.Close(); | |||
//LoginView lv = new LoginView(); | |||
//var res = lv.ShowDialog(); | |||
//if (res != null && res == true) | |||
//{ | |||
// MessageLog.GetInstance.ShowUserLog("用户登录"); | |||
mv.Show(); | |||
//} | |||
//else | |||
// mv.Close(); | |||
MainWindow = mv; | |||
} | |||
@@ -40,22 +44,40 @@ namespace BPASmartClient.SmallBatchingSystem | |||
{ | |||
#region 配方管理菜单 | |||
ObservableCollection<SubMenumodel> RecipeManage = new ObservableCollection<SubMenumodel>(); | |||
RecipeManage.Add(new SubMenumodel() | |||
{ | |||
SubMenuName = "料仓管理", | |||
SubMenuVisibility = Visibility.Visible, | |||
AssemblyName = "BPASmartClient.SmallBatchingSystem", | |||
ToggleWindowPath = "Views.SiloManagementView" | |||
}); | |||
RecipeManage.Add(new SubMenumodel() | |||
{ | |||
SubMenuName = "出料口管理", | |||
AssemblyName = "BPASmartClient.SmallBatchingSystem", | |||
SubMenuVisibility = Visibility.Visible, | |||
ToggleWindowPath = "Views.OutletManagementView" | |||
}); | |||
RecipeManage.Add(new SubMenumodel() | |||
{ | |||
SubMenuName = "配方管理", | |||
SubMenuPermission = new Permission[] { Permission.管理员 }, | |||
AssemblyName = "BPASmartClient.DosingSystem", | |||
ToggleWindowPath = "View.RecipeSettingsView" | |||
AssemblyName = "BPASmartClient.SmallBatchingSystem", | |||
SubMenuVisibility = Visibility.Visible, | |||
ToggleWindowPath = "Views.RecipeView" | |||
}); | |||
RecipeManage.Add(new SubMenumodel() | |||
{ | |||
SubMenuName = "配方下发", | |||
SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员 }, | |||
AssemblyName = "BPASmartClient.DosingSystem", | |||
ToggleWindowPath = "View.RecipeControlView" | |||
AssemblyName = "BPASmartClient.SmallBatchingSystem", | |||
SubMenuVisibility = Visibility.Visible, | |||
ToggleWindowPath = "Views.RecipeControlView" | |||
}); | |||
MenuManage.GetInstance.menuModels.Add(new MenuModel() | |||
{ | |||
MainMenuIcon = "", | |||
@@ -20,6 +20,7 @@ | |||
<ItemGroup> | |||
<ProjectReference Include="..\BPASmart.RecipeManagement\BPASmart.RecipeManagement.csproj" /> | |||
<ProjectReference Include="..\BPASmartClient.CustomResource\BPASmartClient.CustomResource.csproj" /> | |||
<ProjectReference Include="..\BPASmartClient.Modbus\BPASmartClient.Modbus.csproj" /> | |||
</ItemGroup> | |||
</Project> |
@@ -0,0 +1,20 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
namespace BPASmartClient.SmallBatchingSystem | |||
{ | |||
public class BaseModel : ObservableObject | |||
{ | |||
public int Index { get; set; } = -1; | |||
public RelayCommand AddCommand { get; set; } | |||
public RelayCommand CancelCommand { get; set; } | |||
public RelayCommand SaveCommand { get; set; } | |||
public RelayCommand<object> RemoveCommand { get; set; } | |||
public RelayCommand<object> DetailsCommand { get; set; } | |||
} | |||
} |
@@ -4,7 +4,7 @@ using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.SmallBatchingSystem.Models | |||
namespace BPASmartClient.SmallBatchingSystem | |||
{ | |||
public class CommunicationPar | |||
{ | |||
@@ -0,0 +1,18 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.Collections.ObjectModel; | |||
namespace BPASmartClient.SmallBatchingSystem | |||
{ | |||
public class ConfigInfoModel | |||
{ | |||
public ObservableCollection<SiloInfoModel> SiloInfoModels { get; set; } = new ObservableCollection<SiloInfoModel>(); | |||
public ObservableCollection<OutletInfoModel> OutletInfoModels { get; set; } = new ObservableCollection<OutletInfoModel>(); | |||
public ObservableCollection<RecipeInfo> Recipes { get; set; } = new ObservableCollection<RecipeInfo>(); | |||
} | |||
} |
@@ -0,0 +1,34 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System.Collections.ObjectModel; | |||
namespace BPASmartClient.SmallBatchingSystem | |||
{ | |||
/// <summary> | |||
/// 出料口信息 | |||
/// </summary> | |||
public class OutletInfoModel : ObservableObject | |||
{ | |||
/// <summary> | |||
/// 出料口名称 | |||
/// </summary> | |||
public string OutletName { get { return _mOutletName; } set { _mOutletName = value; OnPropertyChanged(); } } | |||
private string _mOutletName; | |||
/// <summary> | |||
/// 出料口位置 | |||
/// </summary> | |||
public int OutletLoc { get { return _mOutletLoc; } set { _mOutletLoc = value; OnPropertyChanged(); } } | |||
private int _mOutletLoc; | |||
/// <summary> | |||
/// 出料口对应的料仓信息 | |||
/// </summary> | |||
public ObservableCollection<string> SiloInfos { get; set; } = new ObservableCollection<string>(); | |||
} | |||
} |
@@ -4,7 +4,7 @@ using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.SmallBatchingSystem.Models | |||
namespace BPASmartClient.SmallBatchingSystem | |||
{ | |||
public class PLCModel | |||
{ | |||
@@ -0,0 +1,14 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.SmallBatchingSystem | |||
{ | |||
public class PlcDataModel | |||
{ | |||
public static bool[] TargetLocFeedback { get; set; } = new bool[16]; | |||
public static bool BatchingCompleted { get; set; } | |||
} | |||
} |
@@ -0,0 +1,19 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System.Collections.ObjectModel; | |||
namespace BPASmartClient.SmallBatchingSystem | |||
{ | |||
public class RecipeInfo : ObservableObject | |||
{ | |||
public string RecipeName { get { return _mRecipeName; } set { _mRecipeName = value; OnPropertyChanged(); } } | |||
private string _mRecipeName; | |||
public ObservableCollection<RecipeRawMaterialInfo> SiloInfoModels { get; set; } = new ObservableCollection<RecipeRawMaterialInfo>(); | |||
} | |||
} |
@@ -0,0 +1,31 @@ | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.SmallBatchingSystem | |||
{ | |||
public class RecipeRawMaterialInfo : ObservableObject | |||
{ | |||
/// <summary> | |||
/// 原料名称 | |||
/// </summary> | |||
public string SiloName { get { return _mSiloName; } set { _mSiloName = value; OnPropertyChanged(); } } | |||
private string _mSiloName; | |||
/// <summary> | |||
/// 原料重量 | |||
/// </summary> | |||
public int SiloWeight { get { return _mSiloWeight; } set { _mSiloWeight = value; OnPropertyChanged(); } } | |||
private int _mSiloWeight; | |||
/// <summary> | |||
/// 选中索引 | |||
/// </summary> | |||
public int SelectIndex { get { return _mSelectIndex; } set { _mSelectIndex = value; OnPropertyChanged(); } } | |||
private int _mSelectIndex; | |||
} | |||
} |
@@ -5,13 +5,24 @@ using System.Text; | |||
using System.Threading.Tasks; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
namespace BPASmartClient.SmallBatchingSystem.Models | |||
namespace BPASmartClient.SmallBatchingSystem | |||
{ | |||
/// <summary> | |||
/// 原料仓信息 | |||
/// </summary> | |||
public class SiloInfoModel : ObservableObject | |||
{ | |||
public SiloInfoModel() | |||
{ | |||
/// <summary> | |||
/// 原料名称 | |||
/// </summary> | |||
public string SiloName { get { return _mSiloName; } set { _mSiloName = value; OnPropertyChanged(); } } | |||
private string _mSiloName; | |||
/// <summary> | |||
/// 料仓原料位置 | |||
/// </summary> | |||
public int SiloLoc { get { return _mSiloLoc; } set { _mSiloLoc = value; OnPropertyChanged(); } } | |||
private int _mSiloLoc; | |||
} | |||
} | |||
} |
@@ -0,0 +1,115 @@ | |||
using BPA.Helper; | |||
using BPASmartClient.SmallBatchingSystem; | |||
using System; | |||
using System.Collections.Concurrent; | |||
using System.Collections.Generic; | |||
using System.Diagnostics; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.SmallBatchingSystem | |||
{ | |||
public class Control | |||
{ | |||
private volatile static Control _Instance; | |||
public static Control GetInstance => _Instance ?? (_Instance = new Control()); | |||
private Control() { } | |||
public ConcurrentQueue<RecipeInfo> MakeOrderQueue { get; set; } = new ConcurrentQueue<RecipeInfo>(); | |||
public void Init() | |||
{ | |||
ThreadManage.GetInstance().Start(new Action(() => | |||
{ | |||
PlcServer.GetInstance.Connect(); | |||
}), "设备初始化"); | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
while (MakeOrderQueue.Count > 0) | |||
{ | |||
if (MakeOrderQueue.TryDequeue(out RecipeInfo recipeInfo)) | |||
{ | |||
List<int> OutletInfo = new List<int>(); | |||
recipeInfo.SiloInfoModels.ToList()?.ForEach(item => | |||
{ | |||
var res = Json<ConfigInfoModel>.Data.OutletInfoModels.FirstOrDefault(p => p.SiloInfos.FirstOrDefault(s => s.Contains(item.SiloName)) != null); | |||
if (res != null) if (!OutletInfo.Contains(res.OutletLoc)) OutletInfo.Add(res.OutletLoc); | |||
}); | |||
OutletInfo.ForEach(temp => | |||
{ | |||
PlcServer.GetInstance.WriteData("VW302", (ushort)temp);//设置出料口位置 | |||
PlcServer.GetInstance.WriteData("M10.0", true);//定位启动 | |||
int index = temp - 1; | |||
if (index >= 0 && index < PlcDataModel.TargetLocFeedback.Length) | |||
{ | |||
while (!PlcDataModel.TargetLocFeedback[index]) Thread.Sleep(1);//等待定位反馈 | |||
recipeInfo.SiloInfoModels.ToList()?.ForEach(temp1 => | |||
{ | |||
var res = Json<ConfigInfoModel>.Data.SiloInfoModels.FirstOrDefault(p => p.SiloName == temp1.SiloName); | |||
if (res != null) | |||
{ | |||
PlcServer.GetInstance.WriteData(GetWeightAdd(res.SiloLoc), (ushort)temp1.SiloWeight); | |||
PlcServer.GetInstance.WriteData(GetStartSingleAdd(res.SiloLoc), true); | |||
while (!PlcDataModel.BatchingCompleted) Thread.Sleep(1);//等待出料完成 | |||
PlcServer.GetInstance.WriteData("M4.0", false);//复位出料完成信号 | |||
while (PlcDataModel.BatchingCompleted) Thread.Sleep(1);//等待出料完成信号复位成功 | |||
} | |||
}); | |||
} | |||
}); | |||
PlcServer.GetInstance.WriteData("M10.4", true); | |||
} | |||
} | |||
Thread.Sleep(10); | |||
}), "配方流程控制"); | |||
} | |||
/// <summary> | |||
/// 获取重量设置地址 | |||
/// </summary> | |||
/// <param name="num"></param> | |||
/// <returns></returns> | |||
private string GetWeightAdd(int num) | |||
{ | |||
if (num > 0) | |||
{ | |||
var s = 100 + (num - 1) * 2; | |||
return $"VW{s}"; | |||
} | |||
return default; | |||
} | |||
/// <summary> | |||
/// 获取启动信号地址 | |||
/// </summary> | |||
/// <param name="num"></param> | |||
/// <returns></returns> | |||
private string GetStartSingleAdd(int num) | |||
{ | |||
if (num > 0) | |||
{ | |||
string Add = string.Empty; | |||
var t = num / 8; | |||
var c = (num % 8); | |||
if (c == 0) | |||
{ | |||
t--; | |||
c = 7; | |||
} | |||
else c--; | |||
Add = $"M{ t}.{c}"; | |||
return Add; | |||
} | |||
return default; | |||
} | |||
} | |||
} |
@@ -4,11 +4,11 @@ using System.Linq; | |||
using System.Text; | |||
using System.Threading; | |||
using System.Threading.Tasks; | |||
using BPA.Communication; | |||
using BPA.Helper; | |||
using BPASmartClient.SmallBatchingSystem.Models; | |||
using BPASmartClient.Modbus; | |||
using BPASmartClient.SmallBatchingSystem; | |||
namespace BPASmartClient.SmallBatchingSystem.Services | |||
namespace BPASmartClient.SmallBatchingSystem | |||
{ | |||
public class PlcServer | |||
{ | |||
@@ -16,7 +16,7 @@ namespace BPASmartClient.SmallBatchingSystem.Services | |||
public static PlcServer GetInstance => _Instance ?? (_Instance = new PlcServer()); | |||
private PlcServer() { } | |||
ModbusTcp Communication = new ModbusTcp(); | |||
public ModbusTcp Communication = new ModbusTcp(); | |||
public void Connect() | |||
{ | |||
@@ -26,6 +26,20 @@ namespace BPASmartClient.SmallBatchingSystem.Services | |||
MessageLog.GetInstance.Show("设备连接成功"); | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
var res = ReadData("M20.0", 16);//到达目标位置信号 | |||
if (res != null && res is bool[] bools && bools.Length == 16) | |||
{ | |||
for (int i = 0; i < bools.Length; i++) | |||
{ | |||
PlcDataModel.TargetLocFeedback[i] = bools[i]; | |||
} | |||
} | |||
var res1 = ReadData("M4.0", 1);//通道出料完成 | |||
if (res1 != null && res1 is bool[] bools1 && bools1.Length == 1) | |||
{ | |||
PlcDataModel.BatchingCompleted = bools1[0]; | |||
} | |||
Thread.Sleep(10); | |||
}), "PLC 数据监听"); | |||
@@ -33,5 +47,18 @@ namespace BPASmartClient.SmallBatchingSystem.Services | |||
Communication.ModbusTcpConnect(Json<CommunicationPar>.Data.Host, Json<CommunicationPar>.Data.Port); | |||
} | |||
public void WriteData(string address, object value) | |||
{ | |||
if (address != null && value != null) | |||
Communication.Write(address, value); | |||
} | |||
public object ReadData(string address, int length) | |||
{ | |||
object res = null; | |||
if (address != null) | |||
res = Communication.Read(address, (ushort)length); | |||
return res; | |||
} | |||
} | |||
} |
@@ -0,0 +1,221 @@ | |||
using BPASmart.Model; | |||
using BPASmartClient.Helper; | |||
using System; | |||
using System.Collections.Concurrent; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.SmallBatchingSystem | |||
{ | |||
/// <summary> | |||
/// 料仓服务线程 | |||
/// </summary> | |||
public class SiloServer | |||
{ | |||
public SiloServer() | |||
{ | |||
BusinessThread(); | |||
RefreshRecips(); | |||
MakeToRecipsID("2d1ac4da-110b-4d4d-9e94-36aac6d67124"); | |||
} | |||
#region 临时变量 | |||
/// <summary> | |||
/// 物料数据 | |||
/// </summary> | |||
public ObservableCollection<RecipeMaterials> RecipeMaterialsDic = new ObservableCollection<RecipeMaterials>(); | |||
/// <summary> | |||
/// 当前配方 | |||
/// </summary> | |||
public ObservableCollection<Recipes> RecipesDic = new ObservableCollection<Recipes>(); | |||
#endregion | |||
#region 订单管理 | |||
public ConcurrentQueue<Recipes> MakeOrderQueue { get; set; } = new ConcurrentQueue<Recipes>(); | |||
#endregion | |||
#region 业务 | |||
/// <summary> | |||
/// 业务线程 | |||
/// </summary> | |||
public void BusinessThread() | |||
{ | |||
ThreadManage.GetInstance().Start(new Action(() => | |||
{ | |||
PlcServer.GetInstance.Connect(); | |||
}), "启动PLC", false); | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
// if (PlcServer.GetInstance.Communication.Connected) | |||
{ | |||
if (MakeOrderQueue.TryDequeue(out Recipes recipes)) | |||
{ | |||
Make(recipes); | |||
} | |||
} | |||
}), "配料线程启动", true); | |||
} | |||
#endregion | |||
#region 调用函数 | |||
/// <summary> | |||
/// 刷新配方数据 | |||
/// </summary> | |||
public void RefreshRecips() | |||
{ | |||
try | |||
{ | |||
//读取料仓物料数据 配方数据 | |||
Json<LocalMaterails>.Read(); | |||
Json<LocalRecipes>.Read(); | |||
RecipeMaterialsDic = Json<LocalMaterails>.Data.locaMaterails; | |||
RecipesDic = Json<LocalRecipes>.Data.locaRecipes; | |||
RecipesDic?.ToList().ForEach(par => | |||
{ | |||
par.recipeMaterials?.ToList().ForEach((recipeMaterial) => | |||
{ | |||
RecipeMaterials recipe = RecipeMaterialsDic?.ToList().Find(k => k.ID == recipeMaterial.ID); | |||
if (recipe != null) | |||
{ | |||
recipeMaterial.MaterialType = recipe.MaterialType; | |||
recipeMaterial.MaterialPosion = recipe.MaterialPosion; | |||
recipeMaterial.PropertyCollections = recipe.PropertyCollections; | |||
} | |||
}); | |||
}); | |||
} | |||
catch (Exception ex) | |||
{ | |||
} | |||
} | |||
/// <summary> | |||
/// 根据配方ID制作流程 | |||
/// </summary> | |||
public void MakeToRecipsID(string id) | |||
{ | |||
try | |||
{ | |||
//chaxun 配方 | |||
Recipes info = RecipesDic?.ToList().Find(par => par.ID == id); | |||
if (info != null) | |||
{ | |||
//添加到队列 | |||
MakeOrderQueue.Enqueue(info); | |||
} | |||
} | |||
catch (Exception ex) | |||
{ | |||
} | |||
} | |||
/// <summary> | |||
/// 根据配方控制流程 | |||
/// </summary> | |||
/// <param name="recipes"></param> | |||
public async void Make(Recipes recipes) | |||
{ | |||
try | |||
{ | |||
//遍历配方物料集合 | |||
recipes?.recipeMaterials?.ToList().ForEach(recipe => | |||
{ | |||
//料仓位置 | |||
int recipesLoc = 1; | |||
int.TryParse(recipe.PropertyCollections?.First()?.PropertyValue, out recipesLoc); | |||
//原料位置 | |||
int storeLoc = 1; int.TryParse(recipe.MaterialPosion, out recipesLoc); | |||
//原料需求(g)数 | |||
int storeWeight = recipe.MaterialWeight; | |||
//1.写PLC VW302 目标位置 -> recipesLoc M10.0 定位启动 开始运行 | |||
//2.读取PLC M20.0 到达目标位置 <- 标志 (bool) 【等待】 | |||
//3.写PLC VW100 料口X需求 ->写入重量 storeWeight | |||
//4.写PLC M0.0 启动出料口xx ->storeLoc (bool) | |||
//5.读PLC M4.0 通道XX出料完成<-标志 (bool) 【等待】 | |||
if (storeWeight > 0) | |||
{ | |||
WriteData("VW302", recipesLoc); | |||
WriteData("M10.0", true); | |||
#region 读取是否到达目标位置,超时10秒 | |||
bool IsOver = false; | |||
int fade1 = 1000; | |||
while (fade1 != -1 && !IsOver) | |||
{ | |||
IsOver = (bool)ReadData("M20.0", 1); | |||
Thread.Sleep(10); | |||
fade1--; | |||
} | |||
#endregion | |||
if (IsOver)//到达指定位置 | |||
{ | |||
//写需求 | |||
string adder = $"VW{100 + 2 * (storeLoc - 1)}"; | |||
WriteData(adder, storeWeight); | |||
//写启动料口 | |||
adder = storeLoc <= 8 ? $"M0.{(storeLoc - 1)}" : $"M1.{(storeLoc - 9)}"; | |||
WriteData(adder, true); | |||
//读取通道下料是否完成 | |||
adder = storeLoc <= 8 ? $"M4.{(storeLoc - 1)}" : $"M5.{(storeLoc - 9)}"; | |||
#region 通道XX出料完成,超时10秒 | |||
bool IsXLOver = false; | |||
int fade1XL = 1000; | |||
while (fade1XL != -1 && !IsXLOver) | |||
{ | |||
IsXLOver = (bool)ReadData("M20.0", 1); | |||
Thread.Sleep(30); | |||
fade1XL--; | |||
} | |||
#endregion | |||
} | |||
} | |||
}); | |||
//6.写PLC M10.4 上位机配料完成 | |||
WriteData("M10.4", true); | |||
} | |||
catch (Exception ex) { } | |||
} | |||
#endregion | |||
#region 调用外部PLC | |||
/// <summary> | |||
/// 写PLC | |||
/// </summary> | |||
/// <param name="address"></param> | |||
/// <param name="value"></param> | |||
public void WriteData(string address, object value) | |||
{ | |||
//PlcServer.GetInstance.WriteData(address, value); | |||
} | |||
/// <summary> | |||
/// 读PLC | |||
/// </summary> | |||
/// <param name="address"></param> | |||
/// <param name="length"></param> | |||
/// <returns></returns> | |||
public object ReadData(string address, int length) | |||
{ | |||
//return PlcServer.GetInstance.ReadData(address, length); | |||
return null; | |||
} | |||
#endregion | |||
} | |||
} |
@@ -0,0 +1,88 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using BPA.Helper; | |||
using BPASmartClient.SmallBatchingSystem.Views; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
namespace BPASmartClient.SmallBatchingSystem.ViewModels | |||
{ | |||
public class NewOutletViewModel : BaseModel | |||
{ | |||
public NewOutletViewModel() | |||
{ | |||
Json<ConfigInfoModel>.Data.SiloInfoModels.ToList()?.ForEach(item => { SileName.Add(item.SiloName); }); | |||
ActionManage.GetInstance.Register(new Action<object>((o) => | |||
{ | |||
if (o != null && o is OutletInfoModel tempOutletInfo) | |||
{ | |||
OutletName = tempOutletInfo.OutletName; | |||
OutletLoc = tempOutletInfo.OutletLoc; | |||
tempOutletInfo.SiloInfos?.ToList()?.ForEach((item => | |||
{ | |||
int tempIndex = Array.FindIndex(SileName.ToArray(), p => p.Contains(item)); | |||
SiloInfos.Add(new RawMaterialInfo() { RawMaterialName = item, SelectIndex = tempIndex }); | |||
})); | |||
Index = Array.FindIndex(Json<ConfigInfoModel>.Data.OutletInfoModels.ToArray(), p => p.OutletName == tempOutletInfo.OutletName); | |||
} | |||
}), "OpenNewOutlet", true); | |||
AddCommand = new RelayCommand(() => { SiloInfos.Add(new RawMaterialInfo()); }); | |||
CancelCommand = new RelayCommand(() => { ActionManage.GetInstance.Send("NewOutletViewClose"); }); | |||
SaveCommand = new RelayCommand(() => | |||
{ | |||
ObservableCollection<string> SileNames = new ObservableCollection<string>(); | |||
SiloInfos.ToList()?.ForEach(item => { SileNames.Add(item.RawMaterialName); }); | |||
if (Index >= 0 && Index < Json<ConfigInfoModel>.Data.OutletInfoModels.Count) | |||
{ | |||
Json<ConfigInfoModel>.Data.OutletInfoModels.ElementAt(Index).OutletName = OutletName; | |||
Json<ConfigInfoModel>.Data.OutletInfoModels.ElementAt(Index).OutletLoc = OutletLoc; | |||
Json<ConfigInfoModel>.Data.OutletInfoModels.ElementAt(Index).SiloInfos = SileNames; | |||
} | |||
else | |||
{ | |||
Json<ConfigInfoModel>.Data.OutletInfoModels.Add(new OutletInfoModel() | |||
{ | |||
OutletLoc = OutletLoc, | |||
OutletName = OutletName, | |||
SiloInfos = SileNames | |||
}); | |||
} | |||
ActionManage.GetInstance.Send("NewOutletViewClose"); | |||
}); | |||
RemoveCommand = new RelayCommand<object>((o) => | |||
{ | |||
if (!string.IsNullOrEmpty(o?.ToString())) | |||
{ | |||
var res = SiloInfos.FirstOrDefault(p => p.RawMaterialName == o.ToString()); | |||
if (res != null) SiloInfos.Remove(res); | |||
} | |||
}); | |||
} | |||
public string OutletName { get { return _mOutletName; } set { _mOutletName = value; OnPropertyChanged(); } } | |||
private string _mOutletName; | |||
public int OutletLoc { get { return _mOutletLoc; } set { _mOutletLoc = value; OnPropertyChanged(); } } | |||
private int _mOutletLoc; | |||
public ObservableCollection<RawMaterialInfo> SiloInfos { get; set; } = new ObservableCollection<RawMaterialInfo>(); | |||
public ObservableCollection<string> SileName { get; set; } = new ObservableCollection<string>(); | |||
} | |||
public class RawMaterialInfo : ObservableObject | |||
{ | |||
public string RawMaterialName { get { return _mRawMaterialName; } set { _mRawMaterialName = value; OnPropertyChanged(); } } | |||
private string _mRawMaterialName; | |||
public int SelectIndex { get { return _mSelectIndex; } set { _mSelectIndex = value; OnPropertyChanged(); } } | |||
private int _mSelectIndex; | |||
} | |||
} |
@@ -0,0 +1,82 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using System.Collections.ObjectModel; | |||
using BPA.Helper; | |||
namespace BPASmartClient.SmallBatchingSystem.ViewModels | |||
{ | |||
public class NewRecipeViewModel : BaseModel | |||
{ | |||
//int Index = -1; | |||
public NewRecipeViewModel() | |||
{ | |||
Json<ConfigInfoModel>.Data.SiloInfoModels.ToList()?.ForEach(item => { SileName.Add(item.SiloName); }); | |||
ActionManage.GetInstance.Register(new Action<object>((o) => | |||
{ | |||
if (o != null && o is RecipeInfo tempRecipeInfo) | |||
{ | |||
RecipeName = tempRecipeInfo.RecipeName; | |||
tempRecipeInfo.SiloInfoModels.ToList()?.ForEach(item => | |||
{ | |||
int tempIndex = Array.FindIndex(SileName.ToArray(), p => p.Contains(item.SiloName)); | |||
SiloInfos.Add(new RecipeRawMaterialInfo() { SiloName = item.SiloName, SiloWeight = item.SiloWeight, SelectIndex = tempIndex }); | |||
}); | |||
Index = Array.FindIndex(Json<ConfigInfoModel>.Data.Recipes.ToArray(), p => p.RecipeName == tempRecipeInfo.RecipeName); | |||
} | |||
}), "OpenNewRecipe", true); | |||
AddCommand = new RelayCommand(() => { SiloInfos.Add(new RecipeRawMaterialInfo()); }); | |||
CancelCommand = new RelayCommand(() => { ActionManage.GetInstance.Send("NewRecipeViewModelClose"); }); | |||
SaveCommand = new RelayCommand(() => | |||
{ | |||
if (Index >= 0 && Index < Json<ConfigInfoModel>.Data.OutletInfoModels.Count) | |||
{ | |||
Json<ConfigInfoModel>.Data.Recipes.ElementAt(Index).RecipeName = RecipeName; | |||
Json<ConfigInfoModel>.Data.Recipes.ElementAt(Index).SiloInfoModels.Clear(); | |||
SiloInfos.ToList()?.ForEach(item => | |||
{ | |||
Json<ConfigInfoModel>.Data.Recipes.ElementAt(Index).SiloInfoModels.Add(item); | |||
}); | |||
} | |||
else | |||
{ | |||
Json<ConfigInfoModel>.Data.Recipes.Add(new RecipeInfo() | |||
{ | |||
RecipeName = RecipeName, | |||
SiloInfoModels = SiloInfos | |||
}); | |||
} | |||
ActionManage.GetInstance.Send("NewRecipeViewModelClose"); | |||
}); | |||
RemoveCommand = new RelayCommand<object>((o) => | |||
{ | |||
if (!string.IsNullOrEmpty(o?.ToString())) | |||
{ | |||
var res = SiloInfos.FirstOrDefault(p => p.SiloName == o.ToString()); | |||
if (res != null) SiloInfos.Remove(res); | |||
} | |||
}); | |||
} | |||
public string RecipeName { get { return _mRecipeName; } set { _mRecipeName = value; OnPropertyChanged(); } } | |||
private string _mRecipeName; | |||
//public RelayCommand AddCommand { get; set; } | |||
//public RelayCommand CnacelCommand { get; set; } | |||
//public RelayCommand SaveCommand { get; set; } | |||
//public RelayCommand<object> RemoveCommand { get; set; } | |||
public ObservableCollection<RecipeRawMaterialInfo> SiloInfos { get; set; } = new ObservableCollection<RecipeRawMaterialInfo>(); | |||
public ObservableCollection<string> SileName { get; set; } = new ObservableCollection<string>(); | |||
} | |||
} |
@@ -0,0 +1,54 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using BPA.Helper; | |||
namespace BPASmartClient.SmallBatchingSystem.ViewModels | |||
{ | |||
public class NewSiloViewModel : BaseModel | |||
{ | |||
public NewSiloViewModel() | |||
{ | |||
CancelCommand = new RelayCommand(() => { ActionManage.GetInstance.Send("SiloClose"); }); | |||
SaveCommand = new RelayCommand(() => | |||
{ | |||
if (Index >= 0 && Index < Json<ConfigInfoModel>.Data.SiloInfoModels.Count) | |||
{ | |||
Json<ConfigInfoModel>.Data.SiloInfoModels.ElementAt(Index).SiloName = SiloInfoModelObj.SiloName; | |||
Json<ConfigInfoModel>.Data.SiloInfoModels.ElementAt(Index).SiloLoc = SiloInfoModelObj.SiloLoc; | |||
} | |||
else | |||
{ | |||
Json<ConfigInfoModel>.Data.SiloInfoModels.Add(new SiloInfoModel() | |||
{ | |||
SiloLoc = SiloInfoModelObj.SiloLoc, | |||
SiloName = SiloInfoModelObj.SiloName, | |||
}); | |||
} | |||
ActionManage.GetInstance.Send("SiloClose"); | |||
}); | |||
ActionManage.GetInstance.Register(new Action<object>((o) => | |||
{ | |||
if (o != null && o is SiloInfoModel tempSilo) | |||
{ | |||
SiloInfoModelObj.SiloLoc = tempSilo.SiloLoc; | |||
SiloInfoModelObj.SiloName = tempSilo.SiloName; | |||
Index = Array.FindIndex(Json<ConfigInfoModel>.Data.SiloInfoModels.ToArray(), p => p.SiloName == tempSilo.SiloName); | |||
} | |||
}), "OpenNewSilo", true); | |||
} | |||
public SiloInfoModel SiloInfoModelObj { get { return _mSiloInfoModelObj; } set { _mSiloInfoModelObj = value; OnPropertyChanged(); } } | |||
private SiloInfoModel _mSiloInfoModelObj = new SiloInfoModel(); | |||
public string ErrorInfo { get { return _mErrorInfo; } set { _mErrorInfo = value; OnPropertyChanged(); } } | |||
private string _mErrorInfo; | |||
} | |||
} |
@@ -1,17 +1,53 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using BPA.Helper; | |||
using BPASmartClient.SmallBatchingSystem.Views; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
namespace BPASmartClient.SmallBatchingSystem.ViewModels | |||
{ | |||
public class OutletManagementViewModel : ObservableObject | |||
public class OutletManagementViewModel : BaseModel | |||
{ | |||
public OutletManagementViewModel() | |||
{ | |||
AddCommand = new RelayCommand(() => | |||
{ | |||
NewOutletView newOutletView = new NewOutletView(); | |||
newOutletView.ShowDialog(); | |||
}); | |||
SaveCommand = new RelayCommand(() => { Json<ConfigInfoModel>.Save(); }); | |||
OutletInfoModels = Json<ConfigInfoModel>.Data.OutletInfoModels; | |||
RemoveCommand = new RelayCommand<object>((o) => | |||
{ | |||
if (!string.IsNullOrEmpty(o?.ToString())) | |||
{ | |||
var res = Json<ConfigInfoModel>.Data.OutletInfoModels.FirstOrDefault(p => p.OutletName == o.ToString()); | |||
if (res != null) Json<ConfigInfoModel>.Data.OutletInfoModels.Remove(res); | |||
} | |||
}); | |||
DetailsCommand = new RelayCommand<object>((o) => | |||
{ | |||
if (!string.IsNullOrEmpty(o?.ToString())) | |||
{ | |||
var res = Json<ConfigInfoModel>.Data.OutletInfoModels.FirstOrDefault(p => p.OutletName == o.ToString()); | |||
if (res != null) | |||
{ | |||
NewOutletView newOutletView = new NewOutletView(); | |||
ActionManage.GetInstance.Send("OpenNewOutlet", res); | |||
newOutletView.ShowDialog(); | |||
} | |||
} | |||
}); | |||
} | |||
public ObservableCollection<OutletInfoModel> OutletInfoModels { get; set; } | |||
} | |||
} |
@@ -0,0 +1,35 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using BPA.Helper; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
namespace BPASmartClient.SmallBatchingSystem.ViewModels | |||
{ | |||
public class RecipeControlViewModel : ObservableObject | |||
{ | |||
public RecipeControlViewModel() | |||
{ | |||
Recipes = Json<ConfigInfoModel>.Data.Recipes; | |||
StartCommand = new RelayCommand<object>((o) => | |||
{ | |||
if (!string.IsNullOrEmpty(o?.ToString())) | |||
{ | |||
int index = Array.FindIndex(Json<ConfigInfoModel>.Data.Recipes.ToArray(), p => p.RecipeName == o.ToString()); | |||
if (index >= 0 && index < Json<ConfigInfoModel>.Data.Recipes.Count) | |||
{ | |||
Control.GetInstance.MakeOrderQueue.Enqueue(Json<ConfigInfoModel>.Data.Recipes.ElementAt(index)); | |||
} | |||
} | |||
}); | |||
} | |||
public ObservableCollection<RecipeInfo> Recipes { get; set; } | |||
public RelayCommand<object> StartCommand { get; set; } | |||
} | |||
} |
@@ -0,0 +1,51 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using BPA.Helper; | |||
using BPASmartClient.SmallBatchingSystem.Views; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
namespace BPASmartClient.SmallBatchingSystem.ViewModels | |||
{ | |||
public class RecipeViewModel : BaseModel | |||
{ | |||
public RecipeViewModel() | |||
{ | |||
AddCommand = new RelayCommand(() => | |||
{ | |||
NewRecipeView newOutletView = new NewRecipeView(); | |||
newOutletView.ShowDialog(); | |||
}); | |||
SaveCommand = new RelayCommand(() => { Json<ConfigInfoModel>.Save(); }); | |||
RecipeInfoModels = Json<ConfigInfoModel>.Data.Recipes; | |||
RemoveCommand = new RelayCommand<object>((o) => | |||
{ | |||
if (!string.IsNullOrEmpty(o?.ToString())) | |||
{ | |||
var res = Json<ConfigInfoModel>.Data.Recipes.FirstOrDefault(p => p.RecipeName == o.ToString()); | |||
if (res != null) Json<ConfigInfoModel>.Data.Recipes.Remove(res); | |||
} | |||
}); | |||
DetailsCommand = new RelayCommand<object>((o) => | |||
{ | |||
if (!string.IsNullOrEmpty(o?.ToString())) | |||
{ | |||
var res = Json<ConfigInfoModel>.Data.Recipes.FirstOrDefault(p => p.RecipeName == o.ToString()); | |||
if (res != null) | |||
{ | |||
NewRecipeView newOutletView = new NewRecipeView(); | |||
ActionManage.GetInstance.Send("OpenNewRecipe", res); | |||
newOutletView.ShowDialog(); | |||
} | |||
} | |||
}); | |||
} | |||
public ObservableCollection<RecipeInfo> RecipeInfoModels { get; set; } | |||
} | |||
} |
@@ -3,10 +3,50 @@ using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using BPASmartClient.SmallBatchingSystem.Views; | |||
using System.Collections.ObjectModel; | |||
using BPA.Helper; | |||
namespace BPASmartClient.SmallBatchingSystem.ViewModels | |||
{ | |||
public class SiloManagementViewModel | |||
public class SiloManagementViewModel : BaseModel | |||
{ | |||
public SiloManagementViewModel() | |||
{ | |||
AddCommand = new RelayCommand(() => | |||
{ | |||
NewSiloView newSiloView = new NewSiloView(); | |||
newSiloView.ShowDialog(); | |||
}); | |||
SaveCommand = new RelayCommand(() => { Json<ConfigInfoModel>.Save(); }); | |||
SiloInfoModels = Json<ConfigInfoModel>.Data.SiloInfoModels; | |||
RemoveCommand = new RelayCommand<object>((o) => | |||
{ | |||
if (!string.IsNullOrEmpty(o?.ToString())) | |||
{ | |||
var res = Json<ConfigInfoModel>.Data.SiloInfoModels.FirstOrDefault(p => p.SiloName == o.ToString()); | |||
if (res != null) Json<ConfigInfoModel>.Data.SiloInfoModels.Remove(res); | |||
} | |||
}); | |||
DetailsCommand = new RelayCommand<object>((o) => | |||
{ | |||
if (!string.IsNullOrEmpty(o?.ToString())) | |||
{ | |||
var res = Json<ConfigInfoModel>.Data.SiloInfoModels.FirstOrDefault(p => p.SiloName == o.ToString()); | |||
if (res != null) | |||
{ | |||
NewSiloView newSiloView = new NewSiloView(); | |||
ActionManage.GetInstance.Send("OpenNewSilo", res); | |||
newSiloView.ShowDialog(); | |||
} | |||
} | |||
}); | |||
} | |||
public ObservableCollection<SiloInfoModel> SiloInfoModels { get; set; } | |||
} | |||
} |
@@ -0,0 +1,312 @@ | |||
<Window | |||
x:Class="BPASmartClient.SmallBatchingSystem.Views.NewOutletView" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:con="clr-namespace:BPASmartClient.SmallBatchingSystem.Converter" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:local="clr-namespace:BPASmartClient.SmallBatchingSystem.Views" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:vm="clr-namespace:BPASmartClient.SmallBatchingSystem.ViewModels" | |||
Title="NewOutletView" | |||
Width="600" | |||
Height="400" | |||
AllowsTransparency="True" | |||
Background="{x:Null}" | |||
WindowStartupLocation="CenterScreen" | |||
WindowStyle="None" | |||
mc:Ignorable="d"> | |||
<Window.DataContext> | |||
<vm:NewOutletViewModel /> | |||
</Window.DataContext> | |||
<Window.Resources> | |||
<SolidColorBrush x:Key="FontColor" Color="#FF2AB2E7" /> | |||
<SolidColorBrush x:Key="tabColor" Color="#FF2AB2E7" /> | |||
<!--<SolidColorBrush x:Key="bordColor" Color="#33ffffff" />--> | |||
<SolidColorBrush x:Key="bordColor" Color="#332AB2E7" /> | |||
<con:DataTableRedundantConverter x:Key="tabConvert" /> | |||
<Style x:Key="TextBlockStyle" TargetType="TextBlock"> | |||
<Setter Property="VerticalAlignment" Value="Center" /> | |||
<Setter Property="HorizontalAlignment" Value="Right" /> | |||
<Setter Property="Foreground" Value="{StaticResource FontColor}" /> | |||
<Setter Property="FontSize" Value="20" /> | |||
</Style> | |||
<Style x:Key="TextBoxStyle" TargetType="TextBox"> | |||
<Setter Property="FontFamily" Value="楷体" /> | |||
<Setter Property="FontSize" Value="22" /> | |||
<Setter Property="VerticalContentAlignment" Value="Center" /> | |||
<Setter Property="Width" Value="188" /> | |||
<Setter Property="Padding" Value="6,0,0,0" /> | |||
<Setter Property="Height" Value="37" /> | |||
<Setter Property="BorderThickness" Value="0" /> | |||
<Setter Property="Foreground" Value="{StaticResource PoupTextblockColor}" /> | |||
<Setter Property="BorderBrush" Value="{StaticResource PoupTextblockColor}" /> | |||
<Setter Property="CaretBrush" Value="{StaticResource PoupTextblockColor}" /> | |||
<Setter Property="VerticalAlignment" Value="Center" /> | |||
<Setter Property="Background"> | |||
<Setter.Value> | |||
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/textBox.png" Stretch="Fill" /> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<Style x:Key="ControlButtonStyle" TargetType="Button"> | |||
<Setter Property="Margin" Value="0" /> | |||
<Setter Property="FontSize" Value="18" /> | |||
<Setter Property="Foreground" Value="#FFF53F62" /> | |||
<Setter Property="FontWeight" Value="SemiBold" /> | |||
<Setter Property="FontFamily" Value="楷体" /> | |||
<Setter Property="VerticalContentAlignment" Value="Center" /> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="Button"> | |||
<Border | |||
Name="TitleBarBr" | |||
BorderBrush="#00c2f4" | |||
BorderThickness="0" | |||
CornerRadius="0" | |||
Opacity="0.8"> | |||
<ContentPresenter | |||
Margin="{TemplateBinding Margin}" | |||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" | |||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" /> | |||
<Border.Background> | |||
<ImageBrush | |||
ImageSource="/BPASmartClient.CustomResource;component/Image/组合边框1.1.png" | |||
Opacity="0.8" | |||
Stretch="Fill" /> | |||
</Border.Background> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="true"> | |||
<Setter TargetName="TitleBarBr" Property="Opacity" Value="1" /> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<Style x:Key="TitleTextblockStyle" TargetType="TextBlock"> | |||
<Setter Property="FontSize" Value="16" /> | |||
<Setter Property="HorizontalAlignment" Value="Center" /> | |||
<Setter Property="VerticalAlignment" Value="Center" /> | |||
<Setter Property="Foreground" Value="{StaticResource tabColor}" /> | |||
<Setter Property="FontFamily" Value="楷体" /> | |||
<Setter Property="FontWeight" Value="SemiBold" /> | |||
</Style> | |||
</Window.Resources> | |||
<Grid> | |||
<Grid.Background> | |||
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/容器边框.png" /> | |||
</Grid.Background> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="0.18*" /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<TextBlock | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="20" | |||
Foreground="{StaticResource FontColor}" | |||
Text="新建出料口" /> | |||
<Grid Grid.Row="1"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="0.2*" /> | |||
<RowDefinition Height="0.2*" /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<StackPanel Orientation="Horizontal"> | |||
<TextBlock | |||
Margin="15,0,0,0" | |||
HorizontalAlignment="Left" | |||
FontSize="16" | |||
Style="{StaticResource TextBlockStyle}" | |||
Text="出料口名称:" /> | |||
<TextBox | |||
Name="outName" | |||
Width="180" | |||
Height="35" | |||
FontSize="20" | |||
Style="{StaticResource TextBoxStyle}" | |||
Text="{Binding OutletName}" /> | |||
<TextBlock | |||
Margin="15,0,0,0" | |||
HorizontalAlignment="Left" | |||
FontSize="16" | |||
Style="{StaticResource TextBlockStyle}" | |||
Text="出料口位置:" /> | |||
<TextBox | |||
Name="outLoc" | |||
Width="180" | |||
Height="35" | |||
Margin="5,0,0,0" | |||
FontSize="20" | |||
Style="{StaticResource TextBoxStyle}" | |||
Text="{Binding OutletLoc}" /> | |||
</StackPanel> | |||
<StackPanel | |||
Grid.Row="1" | |||
Margin="10,0,0,0" | |||
HorizontalAlignment="Right" | |||
Orientation="Horizontal"> | |||
<!--<TextBox | |||
Name="outName" | |||
Width="180" | |||
Height="35" | |||
Margin="5,0,0,0" | |||
FontSize="20" | |||
Style="{StaticResource TextBoxStyle}" />--> | |||
<Button | |||
Width="90" | |||
Height="30" | |||
Margin="5,0,5,0" | |||
Command="{Binding AddCommand}" | |||
Content="添加原料" | |||
FontSize="20" | |||
Style="{StaticResource ImageButtonStyle}" /> | |||
<Button | |||
Width="90" | |||
Height="30" | |||
Margin="5,0,5,0" | |||
Command="{Binding CancelCommand}" | |||
Content="取消" | |||
FontSize="20" | |||
Style="{StaticResource ImageButtonStyle}" /> | |||
<Button | |||
Grid.Column="1" | |||
Width="90" | |||
Height="30" | |||
Margin="5,0,5,0" | |||
Command="{Binding SaveCommand}" | |||
Content="保存" | |||
FontSize="20" | |||
Style="{StaticResource ImageButtonStyle}" /> | |||
</StackPanel> | |||
<Grid Grid.Row="2" Margin="15,0,10,0"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="35" /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<!--#region 表格标题栏设置--> | |||
<Grid Margin="0,10,0,0" Background="#ff0C255F"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
<ColumnDefinition Width="0.68*" /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Grid.Column="0" | |||
Style="{StaticResource TitleTextblockStyle}" | |||
Text="原料" /> | |||
<Grid Grid.Column="1"> | |||
<TextBlock Style="{StaticResource TitleTextblockStyle}" Text="功能操作" /> | |||
<Border | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid> | |||
<Border | |||
Grid.ColumnSpan="2" | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1,0,1,0" /> | |||
</Grid> | |||
<!--#endregion--> | |||
<ScrollViewer | |||
Grid.Row="1" | |||
HorizontalScrollBarVisibility="Hidden" | |||
VerticalScrollBarVisibility="Hidden"> | |||
<ItemsControl ItemsSource="{Binding SiloInfos}"> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<!--<RadioButton Content="{Binding RawMaterialName}" Name="rb" GroupName="all"> | |||
<RadioButton.Template> | |||
<ControlTemplate TargetType="RadioButton">--> | |||
<Grid Name="gr" Height="30"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
<ColumnDefinition Width="0.68*" /> | |||
</Grid.ColumnDefinitions> | |||
<ComboBox | |||
Name="cb" | |||
Grid.Column="0" | |||
Height="{Binding ElementName=gr, Path=ActualHeight}" | |||
VerticalAlignment="Center" | |||
BorderBrush="#FF074B92" | |||
BorderThickness="1" | |||
FontFamily="楷体" | |||
FontSize="20" | |||
Foreground="#FF2AB2E7" | |||
IsEditable="False" | |||
ItemsSource="{Binding DataContext.SileName, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}" | |||
SelectedIndex="{Binding SelectIndex}" | |||
Style="{StaticResource ComboBoxStyle}" | |||
Text="{Binding RawMaterialName}" /> | |||
<Button | |||
Grid.Column="1" | |||
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}" | |||
CommandParameter="{Binding RawMaterialName}" | |||
Content="删除" | |||
FontSize="16" | |||
Style="{StaticResource ControlButtonStyle}" /> | |||
<!--<Button | |||
Grid.Column="1" | |||
Width="80" | |||
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}" | |||
CommandParameter="{Binding RawMaterialName}" | |||
Content="删除" />--> | |||
</Grid> | |||
<!--</ControlTemplate> | |||
</RadioButton.Template> | |||
</RadioButton>--> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
</ScrollViewer> | |||
</Grid> | |||
</Grid> | |||
</Grid> | |||
</Window> |
@@ -0,0 +1,30 @@ | |||
using BPA.Helper; | |||
using BPASmartClient.SmallBatchingSystem.ViewModels; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.Windows; | |||
using System.Windows.Controls; | |||
using System.Windows.Data; | |||
using System.Windows.Documents; | |||
using System.Windows.Input; | |||
using System.Windows.Media; | |||
using System.Windows.Media.Imaging; | |||
using System.Windows.Shapes; | |||
namespace BPASmartClient.SmallBatchingSystem.Views | |||
{ | |||
/// <summary> | |||
/// NewOutletView.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class NewOutletView : Window | |||
{ | |||
public NewOutletView() | |||
{ | |||
InitializeComponent(); | |||
ActionManage.GetInstance.Register(new Action(() => { this.Close(); }), "NewOutletViewClose", true); | |||
} | |||
} | |||
} |
@@ -0,0 +1,318 @@ | |||
<Window | |||
x:Class="BPASmartClient.SmallBatchingSystem.Views.NewRecipeView" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:con="clr-namespace:BPASmartClient.SmallBatchingSystem.Converter" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:local="clr-namespace:BPASmartClient.SmallBatchingSystem.Views" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:vm="clr-namespace:BPASmartClient.SmallBatchingSystem.ViewModels" | |||
Title="NewPfView" | |||
Width="500" | |||
Height="300" | |||
AllowsTransparency="True" | |||
Background="{x:Null}" | |||
WindowStartupLocation="CenterScreen" | |||
WindowStyle="None" | |||
mc:Ignorable="d"> | |||
<Window.DataContext> | |||
<vm:NewRecipeViewModel /> | |||
</Window.DataContext> | |||
<Window.Resources> | |||
<SolidColorBrush x:Key="FontColor" Color="#FF2AB2E7" /> | |||
<SolidColorBrush x:Key="tabColor" Color="#FF2AB2E7" /> | |||
<!--<SolidColorBrush x:Key="bordColor" Color="#33ffffff" />--> | |||
<SolidColorBrush x:Key="bordColor" Color="#332AB2E7" /> | |||
<con:DataTableRedundantConverter x:Key="tabConvert" /> | |||
<Style x:Key="TextBlockStyle" TargetType="TextBlock"> | |||
<Setter Property="VerticalAlignment" Value="Center" /> | |||
<Setter Property="HorizontalAlignment" Value="Right" /> | |||
<Setter Property="Foreground" Value="{StaticResource FontColor}" /> | |||
<Setter Property="FontSize" Value="20" /> | |||
</Style> | |||
<Style x:Key="TextBoxStyle" TargetType="TextBox"> | |||
<Setter Property="FontFamily" Value="楷体" /> | |||
<Setter Property="FontSize" Value="22" /> | |||
<Setter Property="VerticalContentAlignment" Value="Center" /> | |||
<Setter Property="Width" Value="188" /> | |||
<Setter Property="Padding" Value="6,0,0,0" /> | |||
<Setter Property="Height" Value="37" /> | |||
<Setter Property="BorderThickness" Value="0" /> | |||
<Setter Property="Foreground" Value="{StaticResource PoupTextblockColor}" /> | |||
<Setter Property="BorderBrush" Value="{StaticResource PoupTextblockColor}" /> | |||
<Setter Property="CaretBrush" Value="{StaticResource PoupTextblockColor}" /> | |||
<Setter Property="VerticalAlignment" Value="Center" /> | |||
<Setter Property="Background"> | |||
<Setter.Value> | |||
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/textBox.png" Stretch="Fill" /> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<Style x:Key="ControlButtonStyle" TargetType="Button"> | |||
<Setter Property="Margin" Value="0" /> | |||
<Setter Property="FontSize" Value="18" /> | |||
<Setter Property="Foreground" Value="#FFF53F62" /> | |||
<Setter Property="FontWeight" Value="SemiBold" /> | |||
<Setter Property="FontFamily" Value="楷体" /> | |||
<Setter Property="VerticalContentAlignment" Value="Center" /> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="Button"> | |||
<Border | |||
Name="TitleBarBr" | |||
BorderBrush="#00c2f4" | |||
BorderThickness="0" | |||
CornerRadius="0" | |||
Opacity="0.8"> | |||
<ContentPresenter | |||
Margin="{TemplateBinding Margin}" | |||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" | |||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" /> | |||
<Border.Background> | |||
<ImageBrush | |||
ImageSource="/BPASmartClient.CustomResource;component/Image/组合边框1.1.png" | |||
Opacity="0.8" | |||
Stretch="Fill" /> | |||
</Border.Background> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="true"> | |||
<Setter TargetName="TitleBarBr" Property="Opacity" Value="1" /> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<Style x:Key="TitleTextblockStyle" TargetType="TextBlock"> | |||
<Setter Property="FontSize" Value="16" /> | |||
<Setter Property="HorizontalAlignment" Value="Center" /> | |||
<Setter Property="VerticalAlignment" Value="Center" /> | |||
<Setter Property="Foreground" Value="{StaticResource tabColor}" /> | |||
<Setter Property="FontFamily" Value="楷体" /> | |||
<Setter Property="FontWeight" Value="SemiBold" /> | |||
</Style> | |||
<Style x:Key="InputTextboxStyle" TargetType="TextBox"> | |||
<Setter Property="Margin" Value="5,0,0,0" /> | |||
<Setter Property="BorderThickness" Value="0" /> | |||
<Setter Property="HorizontalAlignment" Value="Left" /> | |||
<Setter Property="Width" Value="150" /> | |||
<Setter Property="Height" Value="40" /> | |||
<Setter Property="CaretBrush" Value="{StaticResource TitleBorderColor}" /> | |||
<Setter Property="Foreground" Value="{StaticResource TitleBorderColor}" /> | |||
<Setter Property="VerticalContentAlignment" Value="Center" /> | |||
<Setter Property="FontSize" Value="14" /> | |||
<Setter Property="Background" Value="Transparent" /> | |||
<Setter Property="VerticalAlignment" Value="Center" /> | |||
</Style> | |||
</Window.Resources> | |||
<Grid> | |||
<Grid.Background> | |||
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/容器边框.png" /> | |||
</Grid.Background> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="0.18*" /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<TextBlock | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="20" | |||
Foreground="{StaticResource FontColor}" | |||
Text="新建配方" /> | |||
<Grid Grid.Row="1"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="0.2*" /> | |||
<RowDefinition Height="0.2*" /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<TextBlock | |||
Margin="15,0,0,0" | |||
HorizontalAlignment="Left" | |||
Style="{StaticResource TextBlockStyle}" | |||
Text="配方名称:" /> | |||
<StackPanel | |||
Grid.Row="1" | |||
Margin="10,0,0,0" | |||
Orientation="Horizontal"> | |||
<TextBox | |||
Name="outName" | |||
Width="180" | |||
Height="35" | |||
Margin="5,0,0,0" | |||
FontSize="20" | |||
Style="{StaticResource TextBoxStyle}" | |||
Text="{Binding RecipeName}" /> | |||
<Button | |||
Width="90" | |||
Height="30" | |||
Margin="5,0,5,0" | |||
Command="{Binding AddCommand}" | |||
Content="添加原料" | |||
FontSize="20" | |||
Style="{StaticResource ImageButtonStyle}" /> | |||
<Button | |||
Width="90" | |||
Height="30" | |||
Margin="5,0,5,0" | |||
Command="{Binding CancelCommand}" | |||
Content="取消" | |||
FontSize="20" | |||
Style="{StaticResource ImageButtonStyle}" /> | |||
<Button | |||
Grid.Column="1" | |||
Width="90" | |||
Height="30" | |||
Margin="5,0,5,0" | |||
Command="{Binding SaveCommand}" | |||
Content="保存" | |||
FontSize="20" | |||
Style="{StaticResource ImageButtonStyle}" /> | |||
</StackPanel> | |||
<Grid Grid.Row="2" Margin="15,0,10,0"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="35" /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<!--#region 表格标题栏设置--> | |||
<Grid Margin="0,10,0,0" Background="#ff0C255F"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition Width="0.68*" /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Grid.Column="0" | |||
Style="{StaticResource TitleTextblockStyle}" | |||
Text="选择料仓" /> | |||
<Grid Grid.Column="1"> | |||
<TextBlock Style="{StaticResource TitleTextblockStyle}" Text="重量( g )" /> | |||
<Border | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid> | |||
<TextBlock | |||
Grid.Column="2" | |||
Style="{StaticResource TitleTextblockStyle}" | |||
Text="功能操作" /> | |||
<Border | |||
Grid.ColumnSpan="2" | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1,0,1,0" /> | |||
</Grid> | |||
<!--#endregion--> | |||
<ScrollViewer | |||
Grid.Row="1" | |||
HorizontalScrollBarVisibility="Hidden" | |||
VerticalScrollBarVisibility="Hidden"> | |||
<ItemsControl ItemsSource="{Binding SiloInfos}"> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<RadioButton GroupName="all"> | |||
<RadioButton.Template> | |||
<ControlTemplate TargetType="RadioButton"> | |||
<Grid Name="gr" Height="30"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition Width="0.68*" /> | |||
</Grid.ColumnDefinitions> | |||
<ComboBox | |||
Name="cb" | |||
Grid.Column="0" | |||
Height="{Binding ElementName=gr, Path=ActualHeight}" | |||
VerticalAlignment="Center" | |||
BorderBrush="#FF074B92" | |||
BorderThickness="1" | |||
FontFamily="楷体" | |||
FontSize="20" | |||
Foreground="#FF2AB2E7" | |||
IsEditable="False" | |||
ItemsSource="{Binding DataContext.SileName, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}" | |||
SelectedIndex="{Binding SelectIndex}" | |||
Style="{StaticResource ComboBoxStyle}" | |||
Text="{Binding SiloName}" /> | |||
<Grid Grid.Column="1"> | |||
<TextBox | |||
Height="{Binding ElementName=gr, Path=ActualHeight}" | |||
FontSize="20" | |||
Style="{StaticResource InputTextboxStyle}" | |||
Text="{Binding SiloWeight}" /> | |||
<Border | |||
BorderBrush="#FF074B92" | |||
BorderThickness="1,0,1,1" | |||
Cursor="SizeWE" /> | |||
</Grid> | |||
<Button | |||
Grid.Column="2" | |||
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}" | |||
CommandParameter="{Binding SiloName}" | |||
Content="删除" | |||
FontSize="16" | |||
Style="{StaticResource ControlButtonStyle}" /> | |||
<!--<Button | |||
Grid.Column="2" | |||
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}" | |||
CommandParameter="{Binding SiloName}" | |||
Content="删除" />--> | |||
</Grid> | |||
</ControlTemplate> | |||
</RadioButton.Template> | |||
</RadioButton> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
</ScrollViewer> | |||
</Grid> | |||
</Grid> | |||
</Grid> | |||
</Window> |
@@ -0,0 +1,61 @@ | |||
using BPA.Helper; | |||
using BPASmartClient.SmallBatchingSystem.ViewModels; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.Windows; | |||
using System.Windows.Controls; | |||
using System.Windows.Data; | |||
using System.Windows.Documents; | |||
using System.Windows.Input; | |||
using System.Windows.Media; | |||
using System.Windows.Media.Imaging; | |||
using System.Windows.Shapes; | |||
namespace BPASmartClient.SmallBatchingSystem.Views | |||
{ | |||
/// <summary> | |||
/// NewPfView.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class NewRecipeView : Window | |||
{ | |||
public NewRecipeView() | |||
{ | |||
InitializeComponent(); | |||
ActionManage.GetInstance.Register(new Action(() => { this.Close(); }), "NewRecipeViewModelClose", true); | |||
} | |||
private void Button_Click_1(object sender, RoutedEventArgs e) | |||
{ | |||
//this.Close(); | |||
} | |||
private void Button_Click(object sender, RoutedEventArgs e) | |||
{ | |||
//if (Json<ConfigInfoModel>.Data.Recipes.FirstOrDefault(p => p.RecipeName == this.outName.Text) == null) | |||
//{ | |||
// Json<ConfigInfoModel>.Data.Recipes.Add(new RecipeInfo() | |||
// { | |||
// RecipeName = this.outName.Text, | |||
// SiloInfoModels = NewRecipeViewModel.SiloInfoModels | |||
// }); | |||
//} | |||
//else | |||
//{ | |||
// int index = Array.FindIndex(Json<ConfigInfoModel>.Data.Recipes.ToArray(), p => p.RecipeName == outName.Text); | |||
// if (index >= 0 && index < Json<ConfigInfoModel>.Data.Recipes.Count) | |||
// { | |||
// Json<ConfigInfoModel>.Data.Recipes.ElementAt(index).RecipeName = outName.Text; | |||
// Json<ConfigInfoModel>.Data.Recipes.ElementAt(index).SiloInfoModels.Clear(); | |||
// NewRecipeViewModel.SiloInfoModels.ToList().ForEach(item => | |||
// { | |||
// Json<ConfigInfoModel>.Data.Recipes.ElementAt(index).SiloInfoModels.Add(item); | |||
// }); | |||
// } | |||
//} | |||
//this.Close(); | |||
} | |||
} | |||
} |
@@ -0,0 +1,145 @@ | |||
<Window | |||
x:Class="BPASmartClient.SmallBatchingSystem.Views.NewSiloView" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:local="clr-namespace:BPASmartClient.SmallBatchingSystem.Views" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:vm="clr-namespace:BPASmartClient.SmallBatchingSystem.ViewModels" | |||
Title="NewSiloView" | |||
Width="500" | |||
Height="300" | |||
AllowsTransparency="True" | |||
Background="{x:Null}" | |||
WindowStartupLocation="CenterScreen" | |||
WindowStyle="None" | |||
mc:Ignorable="d"> | |||
<Window.DataContext> | |||
<vm:NewSiloViewModel /> | |||
</Window.DataContext> | |||
<Window.Resources> | |||
<SolidColorBrush x:Key="FontColor" Color="#FF2AB2E7" /> | |||
<Style x:Key="TextBlockStyle" TargetType="TextBlock"> | |||
<Setter Property="VerticalAlignment" Value="Center" /> | |||
<Setter Property="HorizontalAlignment" Value="Right" /> | |||
<Setter Property="Foreground" Value="{StaticResource FontColor}" /> | |||
<Setter Property="FontSize" Value="20" /> | |||
</Style> | |||
<Style x:Key="TextBoxStyle" TargetType="TextBox"> | |||
<Setter Property="FontFamily" Value="楷体" /> | |||
<Setter Property="FontSize" Value="22" /> | |||
<Setter Property="VerticalContentAlignment" Value="Center" /> | |||
<Setter Property="Width" Value="188" /> | |||
<Setter Property="Padding" Value="6,0,0,0" /> | |||
<Setter Property="Height" Value="37" /> | |||
<Setter Property="BorderThickness" Value="0" /> | |||
<Setter Property="Foreground" Value="{StaticResource PoupTextblockColor}" /> | |||
<Setter Property="BorderBrush" Value="{StaticResource PoupTextblockColor}" /> | |||
<Setter Property="CaretBrush" Value="{StaticResource PoupTextblockColor}" /> | |||
<Setter Property="VerticalAlignment" Value="Center" /> | |||
<Setter Property="Background"> | |||
<Setter.Value> | |||
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/textBox.png" Stretch="Fill" /> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
</Window.Resources> | |||
<Grid> | |||
<Grid.Background> | |||
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/容器边框.png" /> | |||
</Grid.Background> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="0.18*" /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<TextBlock | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="20" | |||
Foreground="{StaticResource FontColor}" | |||
Text="新建料仓" /> | |||
<Grid Grid.Row="1"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
<RowDefinition Height="0.5*" /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="0.8*" /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock Style="{StaticResource TextBlockStyle}" Text="料仓原料名称:" /> | |||
<TextBlock | |||
Grid.Row="1" | |||
Style="{StaticResource TextBlockStyle}" | |||
Text="料仓原料位置:" /> | |||
<TextBox | |||
Name="SiloName" | |||
Grid.Column="1" | |||
Width="250" | |||
Height="40" | |||
Margin="0,0,5,0" | |||
FontSize="20" | |||
Style="{StaticResource TextBoxStyle}" | |||
Text="{Binding SiloInfoModelObj.SiloName}" /> | |||
<TextBox | |||
Name="SiloLoc" | |||
Grid.Row="1" | |||
Grid.Column="1" | |||
Width="250" | |||
Height="40" | |||
Margin="0,0,5,0" | |||
FontSize="20" | |||
Style="{StaticResource TextBoxStyle}" | |||
Text="{Binding SiloInfoModelObj.SiloLoc}" /> | |||
<TextBlock | |||
Grid.Row="2" | |||
Grid.ColumnSpan="2" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Top" | |||
FontSize="20" | |||
Foreground="#FFF53F62" | |||
Text="{Binding ErrorInfo}" /> | |||
<Button | |||
Grid.Row="3" | |||
Width="150" | |||
Height="40" | |||
Margin="5,0,5,0" | |||
Command="{Binding CancelCommand}" | |||
Content="取消" | |||
FontSize="20" | |||
Style="{StaticResource ImageButtonStyle}" /> | |||
<Button | |||
Grid.Row="3" | |||
Grid.Column="1" | |||
Width="150" | |||
Height="40" | |||
Margin="5,0,5,0" | |||
Command="{Binding SaveCommand}" | |||
Content="保存" | |||
FontSize="20" | |||
Style="{StaticResource ImageButtonStyle}" /> | |||
</Grid> | |||
</Grid> | |||
</Window> |
@@ -0,0 +1,44 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.Windows; | |||
using System.Windows.Controls; | |||
using System.Windows.Data; | |||
using System.Windows.Documents; | |||
using System.Windows.Input; | |||
using System.Windows.Media; | |||
using System.Windows.Media.Imaging; | |||
using System.Windows.Shapes; | |||
using BPA.Helper; | |||
namespace BPASmartClient.SmallBatchingSystem.Views | |||
{ | |||
/// <summary> | |||
/// NewSiloView.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class NewSiloView : Window | |||
{ | |||
public NewSiloView() | |||
{ | |||
InitializeComponent(); | |||
ActionManage.GetInstance.Register(new Action(() => { this.Close(); }), "SiloClose", true); | |||
} | |||
private void Button_Click(object sender, RoutedEventArgs e) | |||
{ | |||
this.Close(); | |||
} | |||
private void Button_Click_1(object sender, RoutedEventArgs e) | |||
{ | |||
Json<ConfigInfoModel>.Data.SiloInfoModels.Add(new SiloInfoModel() | |||
{ | |||
SiloLoc = Convert.ToInt32(this.SiloLoc.Text), | |||
SiloName = this.SiloName.Text, | |||
}); | |||
this.Close(); | |||
} | |||
} | |||
} |
@@ -1,12 +1,296 @@ | |||
<UserControl x:Class="BPASmartClient.SmallBatchingSystem.Views.OutletManagementView" | |||
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:BPASmartClient.SmallBatchingSystem.Views" | |||
mc:Ignorable="d" | |||
d:DesignHeight="450" d:DesignWidth="800"> | |||
<Grid> | |||
<UserControl | |||
x:Class="BPASmartClient.SmallBatchingSystem.Views.OutletManagementView" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:con="clr-namespace:BPASmartClient.SmallBatchingSystem.Converter" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:local="clr-namespace:BPASmartClient.SmallBatchingSystem.Views" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | |||
xmlns:vm="clr-namespace:BPASmartClient.SmallBatchingSystem.ViewModels" | |||
d:DesignHeight="450" | |||
d:DesignWidth="800" | |||
mc:Ignorable="d"> | |||
<UserControl.DataContext> | |||
<vm:OutletManagementViewModel /> | |||
</UserControl.DataContext> | |||
<UserControl.Resources> | |||
<SolidColorBrush x:Key="tabColor" Color="#FF2AB2E7" /> | |||
<!--<SolidColorBrush x:Key="bordColor" Color="#33ffffff" />--> | |||
<SolidColorBrush x:Key="bordColor" Color="#332AB2E7" /> | |||
<con:DataTableRedundantConverter x:Key="tabConvert" /> | |||
<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="RowRadioButtonStyle" TargetType="{x:Type RadioButton}"> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type RadioButton}"> | |||
<Border | |||
x:Name="NvaBor" | |||
Background="Transparent" | |||
BorderBrush="#FF2AB2E7" | |||
BorderThickness="0"> | |||
<ContentControl | |||
Margin="10,4" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
HorizontalContentAlignment="Center" | |||
VerticalContentAlignment="Center" | |||
Content="{TemplateBinding Content}" | |||
FontSize="16" /> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsChecked" Value="True"> | |||
<Setter TargetName="NvaBor" Property="Background" Value="#22ffffff" /> | |||
<Setter TargetName="NvaBor" Property="BorderThickness" Value="0" /> | |||
</Trigger> | |||
<MultiTrigger> | |||
<MultiTrigger.Conditions> | |||
<Condition Property="IsChecked" Value="false" /> | |||
<Condition Property="IsMouseOver" Value="True" /> | |||
</MultiTrigger.Conditions> | |||
<MultiTrigger.Setters> | |||
<Setter TargetName="NvaBor" Property="Background" Value="#22ffffff" /> | |||
</MultiTrigger.Setters> | |||
</MultiTrigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<Style x:Key="InputTextboxStyle" TargetType="TextBox"> | |||
<Setter Property="Margin" Value="5,0,0,0" /> | |||
<Setter Property="BorderThickness" Value="0" /> | |||
<Setter Property="HorizontalAlignment" Value="Left" /> | |||
<Setter Property="Width" Value="150" /> | |||
<Setter Property="Height" Value="40" /> | |||
<Setter Property="CaretBrush" Value="{StaticResource TitleBorderColor}" /> | |||
<Setter Property="Foreground" Value="{StaticResource TitleBorderColor}" /> | |||
<Setter Property="VerticalContentAlignment" Value="Center" /> | |||
<Setter Property="FontSize" Value="14" /> | |||
<Setter Property="Background" Value="Transparent" /> | |||
<Setter Property="VerticalAlignment" Value="Center" /> | |||
</Style> | |||
<Style x:Key="ControlButtonStyle" TargetType="Button"> | |||
<Setter Property="Margin" Value="0" /> | |||
<Setter Property="FontSize" Value="18" /> | |||
<Setter Property="Foreground" Value="#FFF53F62" /> | |||
<Setter Property="FontWeight" Value="SemiBold" /> | |||
<Setter Property="FontFamily" Value="楷体" /> | |||
<Setter Property="VerticalContentAlignment" Value="Center" /> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="Button"> | |||
<Border | |||
Name="TitleBarBr" | |||
BorderBrush="#00c2f4" | |||
BorderThickness="0" | |||
CornerRadius="0" | |||
Opacity="0.8"> | |||
<ContentPresenter | |||
Margin="{TemplateBinding Margin}" | |||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" | |||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" /> | |||
<Border.Background> | |||
<ImageBrush | |||
ImageSource="/BPASmartClient.CustomResource;component/Image/组合边框1.1.png" | |||
Opacity="0.8" | |||
Stretch="Fill" /> | |||
</Border.Background> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="true"> | |||
<Setter TargetName="TitleBarBr" Property="Opacity" Value="1" /> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<Style x:Key="TitleTextblockStyle" TargetType="TextBlock"> | |||
<Setter Property="FontSize" Value="16" /> | |||
<Setter Property="HorizontalAlignment" Value="Center" /> | |||
<Setter Property="VerticalAlignment" Value="Center" /> | |||
<Setter Property="Foreground" Value="{StaticResource tabColor}" /> | |||
<Setter Property="FontFamily" Value="楷体" /> | |||
<Setter Property="FontWeight" Value="SemiBold" /> | |||
</Style> | |||
</UserControl.Resources> | |||
<Grid Margin="10"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="40" /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal"> | |||
<Button | |||
Width="150" | |||
Height="40" | |||
Margin="10,0,10,0" | |||
Command="{Binding AddCommand}" | |||
Content="添加出料口" | |||
FontSize="20" | |||
Style="{StaticResource ImageButtonStyle}" /> | |||
<Button | |||
Width="150" | |||
Height="40" | |||
Margin="10,0,10,0" | |||
Command="{Binding SaveCommand}" | |||
Content="保存参数" | |||
FontSize="20" | |||
Style="{StaticResource ImageButtonStyle}" /> | |||
</StackPanel> | |||
<Grid Grid.Row="1"> | |||
<ListView | |||
Margin="10" | |||
Background="Transparent" | |||
BorderBrush="#00BEFA" | |||
BorderThickness="0" | |||
ItemsSource="{Binding OutletInfoModels}" | |||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"> | |||
<ListView.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<WrapPanel Orientation="Horizontal" /> | |||
</ItemsPanelTemplate> | |||
</ListView.ItemsPanel> | |||
<ListView.ItemTemplate> | |||
<DataTemplate> | |||
<Border | |||
Name="ShadowElement" | |||
Width="180" | |||
Height="150" | |||
Margin="10" | |||
VerticalAlignment="Top" | |||
BorderBrush="#00BEFA" | |||
BorderThickness="0" | |||
ClipToBounds="True" | |||
CornerRadius="0"> | |||
<Border.Background> | |||
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/蓝色背景.png" Stretch="Fill" /> | |||
</Border.Background> | |||
<Grid Margin="20,0"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<TextBlock | |||
Grid.Row="0" | |||
Grid.ColumnSpan="2" | |||
Margin="0,10,0,0" | |||
VerticalAlignment="Center" | |||
FontSize="20" | |||
Foreground="#00BEFA" | |||
Text="{Binding OutletName}" /> | |||
<StackPanel | |||
Grid.Row="1" | |||
VerticalAlignment="Center" | |||
Orientation="Horizontal"> | |||
<TextBlock | |||
Grid.Row="1" | |||
FontSize="14" | |||
Foreground="#aa00BEFA" | |||
Text="出料口位置:" /> | |||
<TextBlock | |||
Grid.Row="1" | |||
FontSize="14" | |||
Foreground="#aa00BEFA" | |||
Text="{Binding OutletLoc}" /> | |||
</StackPanel> | |||
<Grid | |||
Name="gr" | |||
Grid.Row="2" | |||
Height="30" | |||
Margin="0,0,0,10"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<pry:IcoButton | |||
Width="{Binding ElementName=gr, Path=ActualWidth}" | |||
Height="{Binding ElementName=gr, Path=ActualHeight}" | |||
Margin="4,4,3,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Background="#11F53F62" | |||
BorderThickness="0" | |||
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ListBox, Mode=FindAncestor}}" | |||
CommandParameter="{Binding OutletName}" | |||
Content="删除" | |||
EnterBackground="#22F53F62" | |||
FontStyle="Normal" | |||
Foreground="#FFF53F62" | |||
IcoText="" | |||
Style="{StaticResource IcoButtonStyle}" /> | |||
<pry:IcoButton | |||
Grid.Column="1" | |||
Width="{Binding ElementName=gr, Path=ActualWidth}" | |||
Height="{Binding ElementName=gr, Path=ActualHeight}" | |||
Margin="3,4,4,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Background="#112AB2E7" | |||
BorderThickness="0" | |||
Command="{Binding DataContext.DetailsCommand, RelativeSource={RelativeSource AncestorType=ListBox, Mode=FindAncestor}}" | |||
CommandParameter="{Binding OutletName}" | |||
Content="编辑" | |||
EnterBackground="#222AB2E7" | |||
Foreground="#FF2AB2E7" | |||
IcoText="" | |||
Style="{StaticResource IcoButtonStyle}" /> | |||
</Grid> | |||
</Grid> | |||
</Border> | |||
</DataTemplate> | |||
</ListView.ItemTemplate> | |||
</ListView> | |||
</Grid> | |||
</Grid> | |||
</UserControl> |
@@ -1,4 +1,5 @@ | |||
using System; | |||
using BPA.Helper; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
@@ -23,6 +24,12 @@ namespace BPASmartClient.SmallBatchingSystem.Views | |||
public OutletManagementView() | |||
{ | |||
InitializeComponent(); | |||
this.Unloaded += OutletManagementView_Unloaded; | |||
} | |||
private void OutletManagementView_Unloaded(object sender, RoutedEventArgs e) | |||
{ | |||
Json<ConfigInfoModel>.Save(); | |||
} | |||
} | |||
} |
@@ -0,0 +1,638 @@ | |||
<UserControl | |||
x:Class="BPASmartClient.SmallBatchingSystem.Views.RecipeControlView" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:local="clr-namespace:BPASmartClient.SmallBatchingSystem.Views" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | |||
xmlns:vm="clr-namespace:BPASmartClient.SmallBatchingSystem.ViewModels" | |||
d:DesignHeight="450" | |||
d:DesignWidth="800" | |||
mc:Ignorable="d"> | |||
<UserControl.DataContext> | |||
<vm:RecipeControlViewModel /> | |||
</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="Transparent" /> | |||
<Setter Property="Foreground" Value="#ddd" /> | |||
<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 | |||
Name="radiobutton" | |||
Background="{TemplateBinding Background}" | |||
CornerRadius="5" | |||
Opacity="0.85"> | |||
<Grid> | |||
<ContentPresenter | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Content="{TemplateBinding Content}" | |||
TextBlock.FontFamily="{TemplateBinding FontFamily}" | |||
TextBlock.FontSize="{TemplateBinding FontSize}" | |||
TextBlock.Foreground="{TemplateBinding Foreground}" /> | |||
<Image | |||
Name="im" | |||
Source="/BPASmartClient.CustomResource;component/Image/按钮/组 8.png" | |||
Stretch="Fill" /> | |||
</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" />--> | |||
<Setter TargetName="im" Property="Source" Value="/BPASmartClient.CustomResource;component/Image/按钮/组 7.png" /> | |||
</Trigger> | |||
<Trigger Property="IsChecked" Value="False"> | |||
<Setter TargetName="im" Property="Source" Value="/BPASmartClient.CustomResource;component/Image/按钮/组 8.png" /> | |||
</Trigger> | |||
<Trigger Property="IsMouseOver" Value="True"> | |||
<!--<Setter TargetName="back_border" Property="BorderBrush" Value="white" /> | |||
<Setter TargetName="back_border" Property="BorderThickness" Value="1,1,1,1" />--> | |||
<Setter TargetName="radiobutton" Property="Opacity" Value="1" /> | |||
<!--<Setter TargetName="im" Property="Source" Value="/BPASmartClient.CustomResource;component/Image/按钮背景蓝色.png" />--> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<Style x:Key="materialMakingButton" TargetType="Button"> | |||
<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" | |||
Padding="2" | |||
BorderBrush="White" | |||
BorderThickness="0"> | |||
<TextBlock | |||
x:Name="txState" | |||
Margin="1" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
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 TargetName="txState" Property="FontSize" Value="17 " /> | |||
</MultiTrigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
<Style.Triggers /> | |||
</Style> | |||
<DataTemplate x:Key="TreeItemTemplate" DataType="TreeViewItem"> | |||
<Grid Height="28" Margin="50,0,0,0"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="*" /> | |||
<ColumnDefinition Width="*" /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Margin="10,0" | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Center" | |||
FontSize="15" | |||
Foreground="#aa2AB2E7" | |||
Text="原料:" /> | |||
<TextBlock | |||
Grid.Column="1" | |||
Margin="10,0" | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Center" | |||
FontSize="15" | |||
Foreground="#aa2AB2E7" | |||
Text="{Binding RawMaterialName}" /> | |||
</Grid> | |||
</DataTemplate> | |||
<Style x:Key="recipeTreeItem" TargetType="TreeViewItem"> | |||
<Setter Property="Background" Value="Transparent" /> | |||
<Setter Property="BorderThickness" Value="0" /> | |||
<Setter Property="IsExpanded" Value="True" /> | |||
<Setter Property="HeaderTemplate"> | |||
<Setter.Value> | |||
<HierarchicalDataTemplate ItemTemplate="{StaticResource TreeItemTemplate}" ItemsSource="{Binding RawMaterials, Mode=TwoWay}"> | |||
<StackPanel | |||
Height="28" | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Center" | |||
Orientation="Horizontal"> | |||
<TextBlock | |||
Margin="5,0,0,0" | |||
VerticalAlignment="Center" | |||
FontSize="15" | |||
Foreground="#FF2AB2E7" | |||
Text="配方:" /> | |||
<TextBlock | |||
Margin="5,0,0,0" | |||
VerticalAlignment="Center" | |||
FontSize="15" | |||
Foreground="#FF2AB2E7" | |||
Text="{Binding RecipeName}" /> | |||
</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> | |||
<Border | |||
x:Name="Bd" | |||
Grid.Column="0" | |||
Padding="{TemplateBinding Padding}" | |||
Background="{TemplateBinding Background}" | |||
BorderBrush="{TemplateBinding BorderBrush}" | |||
BorderThickness="{TemplateBinding BorderThickness}"> | |||
<ContentPresenter | |||
x:Name="PART_Header" | |||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" | |||
ContentSource="Header" /> | |||
</Border> | |||
<ItemsPresenter | |||
x:Name="ItemsHost" | |||
Grid.Row="1" | |||
Grid.Column="0" | |||
Grid.ColumnSpan="2" | |||
Visibility="Collapsed" /> | |||
<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.TargetName="ItemsHost" Storyboard.TargetProperty="(UIElement.Visibility)"> | |||
<DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}" /> | |||
</ObjectAnimationUsingKeyFrames> | |||
</Storyboard> | |||
</VisualState> | |||
<VisualState x:Name="Collapsed" /> | |||
</VisualStateGroup> | |||
</VisualStateManager.VisualStateGroups> | |||
</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.25*" /> | |||
</Grid.ColumnDefinitions> | |||
<Grid Name="ggr" Margin="10"> | |||
<pry:ImageBorder Width="{Binding ElementName=ggr, Path=ActualWidth}" Height="{Binding ElementName=ggr, Path=ActualHeight}" /> | |||
<ListBox | |||
Margin="5" | |||
VerticalAlignment="Top" | |||
Background="Transparent" | |||
BorderThickness="0" | |||
ItemsSource="{Binding Recipes}" | |||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"> | |||
<ListBox.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<UniformGrid | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Top" | |||
Columns="6" /> | |||
</ItemsPanelTemplate> | |||
</ListBox.ItemsPanel> | |||
<ListBox.ItemTemplate> | |||
<DataTemplate> | |||
<Grid | |||
Name="tt" | |||
Height="220" | |||
Margin="5"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="30" /> | |||
<RowDefinition Height="20" /> | |||
<RowDefinition Height="128" /> | |||
<RowDefinition Height="2" /> | |||
<RowDefinition Height="40" /> | |||
</Grid.RowDefinitions> | |||
<Image | |||
Grid.RowSpan="5" | |||
Source="/BPASmartClient.CustomResource;component/Image/配方背景/竖背景框.png" | |||
Stretch="Fill" /> | |||
<TextBlock | |||
Grid.Row="0" | |||
Margin="2,5,0,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Top" | |||
FontSize="18" | |||
Foreground="#FF2AB2E7" | |||
Text="{Binding RecipeName}" /> | |||
<TextBlock | |||
Grid.Row="1" | |||
Margin="5,0,0,0" | |||
VerticalAlignment="Top" | |||
Foreground="#FF2AB2E7" | |||
Text="配方信息:" /> | |||
<ScrollViewer | |||
Grid.Row="2" | |||
VerticalAlignment="Top" | |||
Background="Transparent" | |||
HorizontalScrollBarVisibility="Hidden" | |||
VerticalScrollBarVisibility="Hidden"> | |||
<Grid> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="auto" /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<ItemsControl ItemsSource="{Binding SiloInfoModels}"> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<Grid Width="150"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
<ColumnDefinition Width="0.1*" /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Margin="5,0,0,0" | |||
HorizontalAlignment="Right" | |||
VerticalAlignment="Center" | |||
Foreground="#aa2AB2E7" | |||
Text="{Binding SiloName}" /> | |||
<TextBlock | |||
Grid.Column="1" | |||
Margin="1,0,0,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Foreground="#aa2AB2E7" | |||
Text=":" /> | |||
<TextBlock | |||
Grid.Column="2" | |||
Margin="5,0,0,0" | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Center" | |||
Foreground="#aa2AB2E7" | |||
Text="{Binding SiloWeight}" /> | |||
</Grid> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
</Grid> | |||
</ScrollViewer> | |||
<!--<Grid | |||
Grid.Row="3" | |||
Height="2" | |||
VerticalAlignment="Bottom"> | |||
<Grid.Background> | |||
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/直线.png" Stretch="Fill" /> | |||
</Grid.Background> | |||
</Grid>--> | |||
<Image | |||
Grid.Row="3" | |||
Width="{Binding ElementName=tt, Path=ActualWidth}" | |||
Height="2" | |||
VerticalAlignment="Bottom" | |||
Source="/BPASmartClient.CustomResource;component/Image/直线.png" | |||
Stretch="Fill" /> | |||
<Grid | |||
Name="gr" | |||
Grid.Row="4" | |||
Height="30" | |||
Margin="0,0,0,10" | |||
VerticalAlignment="Bottom" | |||
Background="Transparent"> | |||
<!--<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions>--> | |||
<!--<Image | |||
Height="2" | |||
Grid.ColumnSpan="2" | |||
Width="{Binding ElementName=gr, Path=ActualWidth}" | |||
VerticalAlignment="Top" | |||
Source="/BPASmartClient.CustomResource;component/Image/直线.png" />--> | |||
<pry:IcoButton | |||
Width="{Binding ElementName=gr, Path=ActualWidth}" | |||
Height="{Binding ElementName=gr, Path=ActualHeight}" | |||
Margin="4,4,4,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Background="#222bd06f" | |||
BorderThickness="0" | |||
Command="{Binding DataContext.StartCommand, RelativeSource={RelativeSource AncestorType=ListBox, Mode=FindAncestor}}" | |||
CommandParameter="{Binding RecipeName}" | |||
Content="配方下发" | |||
EnterBackground="#332bd06f" | |||
FontStyle="Normal" | |||
Foreground="#ff2bd06f" | |||
IcoText="" | |||
IsEnabled="{Binding IsEnable}" | |||
Style="{StaticResource IcoButtonStyle}" /> | |||
<!--<pry:IcoButton | |||
Width="{Binding ElementName=gr, Path=ActualWidth}" | |||
Height="{Binding ElementName=gr, Path=ActualHeight}" | |||
Margin="4,4,3,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Background="#11F53F62" | |||
BorderThickness="0" | |||
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ListBox, Mode=FindAncestor}}" | |||
CommandParameter="{Binding RecipCode}" | |||
Content="删除" | |||
EnterBackground="#22F53F62" | |||
FontStyle="Normal" | |||
Foreground="#FFF53F62" | |||
IcoText="" | |||
Style="{StaticResource IcoButtonStyle}" /> | |||
<pry:IcoButton | |||
Grid.Column="1" | |||
Width="{Binding ElementName=gr, Path=ActualWidth}" | |||
Height="{Binding ElementName=gr, Path=ActualHeight}" | |||
Margin="3,4,4,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Background="#112AB2E7" | |||
BorderThickness="0" | |||
Command="{Binding DataContext.DetailsCommand, RelativeSource={RelativeSource AncestorType=ListBox, Mode=FindAncestor}}" | |||
CommandParameter="{Binding RecipCode}" | |||
Content="编辑" | |||
EnterBackground="#222AB2E7" | |||
Foreground="#FF2AB2E7" | |||
IcoText="" | |||
Style="{StaticResource IcoButtonStyle}" />--> | |||
</Grid> | |||
<!--</StackPanel>--> | |||
</Grid> | |||
<!--<Grid Name="tt" Margin="5"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="auto" /> | |||
<RowDefinition Height="auto" /> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<Image | |||
Grid.RowSpan="4" | |||
Source="/BPASmartClient.CustomResource;component/Image/配方背景/竖背景框.png" | |||
Stretch="Fill" /> | |||
<TextBlock | |||
Grid.Row="0" | |||
Margin="2,5,0,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Top" | |||
FontSize="18" | |||
Foreground="#FF2AB2E7" | |||
Text="{Binding RecipeName}" /> | |||
<TextBlock | |||
Grid.Row="1" | |||
Margin="5,0,0,5" | |||
Foreground="#ffc000" | |||
Text="配方信息:" /> | |||
<ScrollViewer | |||
Grid.Row="2" | |||
HorizontalScrollBarVisibility="Hidden" | |||
VerticalScrollBarVisibility="Hidden"> | |||
<Grid> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="auto" /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<ItemsControl ItemsSource="{Binding RawMaterials}"> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<Grid> | |||
<TextBlock | |||
Grid.Row="1" | |||
Margin="5,0,0,0" | |||
HorizontalAlignment="Right" | |||
VerticalAlignment="Center" | |||
Foreground="#aaffc000" | |||
Text="{Binding RawMaterialName}" /> | |||
</Grid> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
<ItemsControl Grid.Column="1" ItemsSource="{Binding RawMaterials}"> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<StackPanel Orientation="Horizontal"> | |||
<TextBlock | |||
Margin="5,0,0,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Foreground="#aaffc000" | |||
Text=":" /> | |||
<TextBlock | |||
Margin="5,0,0,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Foreground="#aaffc000" | |||
Text="{Binding RawMaterialWeight}" /> | |||
<TextBlock | |||
Margin="5,0,0,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Foreground="#aaffc000" | |||
Text="g" /> | |||
</StackPanel> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
</Grid> | |||
</ScrollViewer> | |||
<Grid | |||
Name="grb" | |||
Grid.Row="3" | |||
Height="30" | |||
Margin="0,0,0,10" | |||
VerticalAlignment="Bottom" | |||
Background="Transparent"> | |||
<Image | |||
Width="{Binding ElementName=grb, Path=ActualWidth}" | |||
VerticalAlignment="Top" | |||
StretchDirection="Both" | |||
Source="/BPASmartClient.CustomResource;component/Image/直线.png" /> | |||
<pry:IcoButton | |||
Width="{Binding ElementName=grb, Path=ActualWidth}" | |||
Height="{Binding ElementName=grb, Path=ActualHeight}" | |||
Margin="4,4,4,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Background="#222bd06f" | |||
BorderThickness="0" | |||
Command="{Binding DataContext.StartCommand, RelativeSource={RelativeSource AncestorType=ListBox, Mode=FindAncestor}}" | |||
CommandParameter="{Binding RecipeName}" | |||
Content="配方下发" | |||
EnterBackground="#332bd06f" | |||
FontStyle="Normal" | |||
Foreground="#ff2bd06f" | |||
IcoText="" | |||
IsEnabled="{Binding IsEnable}" | |||
Style="{StaticResource IcoButtonStyle}" /> | |||
</Grid> | |||
</Grid>--> | |||
</DataTemplate> | |||
</ListBox.ItemTemplate> | |||
</ListBox> | |||
</Grid> | |||
</Grid> | |||
</UserControl> |
@@ -0,0 +1,28 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.Windows; | |||
using System.Windows.Controls; | |||
using System.Windows.Data; | |||
using System.Windows.Documents; | |||
using System.Windows.Input; | |||
using System.Windows.Media; | |||
using System.Windows.Media.Imaging; | |||
using System.Windows.Navigation; | |||
using System.Windows.Shapes; | |||
namespace BPASmartClient.SmallBatchingSystem.Views | |||
{ | |||
/// <summary> | |||
/// RecipeControlView.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class RecipeControlView : UserControl | |||
{ | |||
public RecipeControlView() | |||
{ | |||
InitializeComponent(); | |||
} | |||
} | |||
} |
@@ -0,0 +1,359 @@ | |||
<UserControl | |||
x:Class="BPASmartClient.SmallBatchingSystem.Views.RecipeView" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:con="clr-namespace:BPASmartClient.SmallBatchingSystem.Converter" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:local="clr-namespace:BPASmartClient.SmallBatchingSystem.Views" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | |||
xmlns:vm="clr-namespace:BPASmartClient.SmallBatchingSystem.ViewModels" | |||
d:DesignHeight="450" | |||
d:DesignWidth="800" | |||
mc:Ignorable="d"> | |||
<UserControl.DataContext> | |||
<vm:RecipeViewModel /> | |||
</UserControl.DataContext> | |||
<UserControl.Resources> | |||
<SolidColorBrush x:Key="tabColor" Color="#FF2AB2E7" /> | |||
<!--<SolidColorBrush x:Key="bordColor" Color="#33ffffff" />--> | |||
<SolidColorBrush x:Key="bordColor" Color="#332AB2E7" /> | |||
<con:DataTableRedundantConverter x:Key="tabConvert" /> | |||
<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="RowRadioButtonStyle" TargetType="{x:Type RadioButton}"> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type RadioButton}"> | |||
<Border | |||
x:Name="NvaBor" | |||
Background="Transparent" | |||
BorderBrush="#FF2AB2E7" | |||
BorderThickness="0"> | |||
<ContentControl | |||
Margin="10,4" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
HorizontalContentAlignment="Center" | |||
VerticalContentAlignment="Center" | |||
Content="{TemplateBinding Content}" | |||
FontSize="16" /> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsChecked" Value="True"> | |||
<Setter TargetName="NvaBor" Property="Background" Value="#22ffffff" /> | |||
<Setter TargetName="NvaBor" Property="BorderThickness" Value="0" /> | |||
</Trigger> | |||
<MultiTrigger> | |||
<MultiTrigger.Conditions> | |||
<Condition Property="IsChecked" Value="false" /> | |||
<Condition Property="IsMouseOver" Value="True" /> | |||
</MultiTrigger.Conditions> | |||
<MultiTrigger.Setters> | |||
<Setter TargetName="NvaBor" Property="Background" Value="#22ffffff" /> | |||
</MultiTrigger.Setters> | |||
</MultiTrigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<Style x:Key="InputTextboxStyle" TargetType="TextBox"> | |||
<Setter Property="Margin" Value="5,0,0,0" /> | |||
<Setter Property="BorderThickness" Value="0" /> | |||
<Setter Property="HorizontalAlignment" Value="Left" /> | |||
<Setter Property="Width" Value="150" /> | |||
<Setter Property="Height" Value="40" /> | |||
<Setter Property="CaretBrush" Value="{StaticResource TitleBorderColor}" /> | |||
<Setter Property="Foreground" Value="{StaticResource TitleBorderColor}" /> | |||
<Setter Property="VerticalContentAlignment" Value="Center" /> | |||
<Setter Property="FontSize" Value="14" /> | |||
<Setter Property="Background" Value="Transparent" /> | |||
<Setter Property="VerticalAlignment" Value="Center" /> | |||
</Style> | |||
<Style x:Key="ControlButtonStyle" TargetType="Button"> | |||
<Setter Property="Margin" Value="0" /> | |||
<Setter Property="FontSize" Value="18" /> | |||
<Setter Property="Foreground" Value="#FFF53F62" /> | |||
<Setter Property="FontWeight" Value="SemiBold" /> | |||
<Setter Property="FontFamily" Value="楷体" /> | |||
<Setter Property="VerticalContentAlignment" Value="Center" /> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="Button"> | |||
<Border | |||
Name="TitleBarBr" | |||
BorderBrush="#00c2f4" | |||
BorderThickness="0" | |||
CornerRadius="0" | |||
Opacity="0.8"> | |||
<ContentPresenter | |||
Margin="{TemplateBinding Margin}" | |||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" | |||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" /> | |||
<Border.Background> | |||
<ImageBrush | |||
ImageSource="/BPASmartClient.CustomResource;component/Image/组合边框1.1.png" | |||
Opacity="0.8" | |||
Stretch="Fill" /> | |||
</Border.Background> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="true"> | |||
<Setter TargetName="TitleBarBr" Property="Opacity" Value="1" /> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<Style x:Key="TitleTextblockStyle" TargetType="TextBlock"> | |||
<Setter Property="FontSize" Value="16" /> | |||
<Setter Property="HorizontalAlignment" Value="Center" /> | |||
<Setter Property="VerticalAlignment" Value="Center" /> | |||
<Setter Property="Foreground" Value="{StaticResource tabColor}" /> | |||
<Setter Property="FontFamily" Value="楷体" /> | |||
<Setter Property="FontWeight" Value="SemiBold" /> | |||
</Style> | |||
</UserControl.Resources> | |||
<Grid Margin="10"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="40" /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal"> | |||
<Button | |||
Width="150" | |||
Height="40" | |||
Margin="10,0,10,0" | |||
Command="{Binding AddCommand}" | |||
Content="新建配方" | |||
FontSize="20" | |||
Style="{StaticResource ImageButtonStyle}" /> | |||
<Button | |||
Width="150" | |||
Height="40" | |||
Margin="10,0,10,0" | |||
Command="{Binding SaveCommand}" | |||
Content="保存配方" | |||
FontSize="20" | |||
Style="{StaticResource ImageButtonStyle}" /> | |||
</StackPanel> | |||
<Grid Grid.Row="1"> | |||
<ListBox | |||
Grid.Row="2" | |||
Margin="5" | |||
VerticalAlignment="Top" | |||
Background="Transparent" | |||
BorderThickness="0" | |||
ItemsSource="{Binding RecipeInfoModels}" | |||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"> | |||
<ListBox.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<UniformGrid | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Top" | |||
Columns="8" /> | |||
</ItemsPanelTemplate> | |||
</ListBox.ItemsPanel> | |||
<ListBox.ItemTemplate> | |||
<DataTemplate> | |||
<Grid | |||
Name="tt" | |||
Height="220" | |||
Margin="5"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="30" /> | |||
<RowDefinition Height="20" /> | |||
<RowDefinition Height="128" /> | |||
<RowDefinition Height="2" /> | |||
<RowDefinition Height="40" /> | |||
</Grid.RowDefinitions> | |||
<Image | |||
Grid.RowSpan="5" | |||
Source="/BPASmartClient.CustomResource;component/Image/配方背景/竖背景框.png" | |||
Stretch="Fill" /> | |||
<TextBlock | |||
Grid.Row="0" | |||
Margin="2,5,0,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Top" | |||
FontSize="18" | |||
Foreground="#FF2AB2E7" | |||
Text="{Binding RecipeName}" /> | |||
<TextBlock | |||
Grid.Row="1" | |||
Margin="5,0,0,0" | |||
VerticalAlignment="Top" | |||
Foreground="#FF2AB2E7" | |||
Text="配方信息:" /> | |||
<ScrollViewer | |||
Grid.Row="2" | |||
VerticalAlignment="Top" | |||
Background="Transparent" | |||
HorizontalScrollBarVisibility="Hidden" | |||
VerticalScrollBarVisibility="Hidden"> | |||
<Grid> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="auto" /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<ItemsControl ItemsSource="{Binding SiloInfoModels}"> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<Grid Width="150"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
<ColumnDefinition Width="0.1*" /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Margin="5,0,0,0" | |||
HorizontalAlignment="Right" | |||
VerticalAlignment="Center" | |||
Foreground="#aa2AB2E7" | |||
Text="{Binding SiloName}" /> | |||
<TextBlock | |||
Grid.Column="1" | |||
Margin="1,0,0,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Foreground="#aa2AB2E7" | |||
Text=":" /> | |||
<TextBlock | |||
Grid.Column="2" | |||
Margin="5,0,0,0" | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Center" | |||
Foreground="#aa2AB2E7" | |||
Text="{Binding SiloWeight}" /> | |||
</Grid> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
</Grid> | |||
</ScrollViewer> | |||
<Image | |||
Grid.Row="3" | |||
Width="{Binding ElementName=tt, Path=ActualWidth}" | |||
Height="2" | |||
VerticalAlignment="Bottom" | |||
Source="/BPASmartClient.CustomResource;component/Image/直线.png" | |||
Stretch="Fill" /> | |||
<Grid | |||
Name="gr" | |||
Grid.Row="4" | |||
Height="30" | |||
Margin="0,0,0,10" | |||
VerticalAlignment="Bottom" | |||
Background="Transparent"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<Image | |||
Grid.ColumnSpan="2" | |||
Width="{Binding ElementName=gr, Path=ActualWidth}" | |||
Height="2" | |||
VerticalAlignment="Top" | |||
Source="/BPASmartClient.CustomResource;component/Image/直线.png" /> | |||
<pry:IcoButton | |||
Width="{Binding ElementName=gr, Path=ActualWidth}" | |||
Height="{Binding ElementName=gr, Path=ActualHeight}" | |||
Margin="4,4,3,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Background="#11F53F62" | |||
BorderThickness="0" | |||
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ListBox, Mode=FindAncestor}}" | |||
CommandParameter="{Binding RecipeName}" | |||
Content="删除" | |||
EnterBackground="#22F53F62" | |||
FontStyle="Normal" | |||
Foreground="#FFF53F62" | |||
IcoText="" | |||
Style="{StaticResource IcoButtonStyle}" /> | |||
<pry:IcoButton | |||
Grid.Column="1" | |||
Width="{Binding ElementName=gr, Path=ActualWidth}" | |||
Height="{Binding ElementName=gr, Path=ActualHeight}" | |||
Margin="3,4,4,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Background="#112AB2E7" | |||
BorderThickness="0" | |||
Command="{Binding DataContext.DetailsCommand, RelativeSource={RelativeSource AncestorType=ListBox, Mode=FindAncestor}}" | |||
CommandParameter="{Binding RecipeName}" | |||
Content="编辑" | |||
EnterBackground="#222AB2E7" | |||
Foreground="#FF2AB2E7" | |||
IcoText="" | |||
Style="{StaticResource IcoButtonStyle}" /> | |||
</Grid> | |||
<!--</StackPanel>--> | |||
</Grid> | |||
</DataTemplate> | |||
</ListBox.ItemTemplate> | |||
</ListBox> | |||
</Grid> | |||
</Grid> | |||
</UserControl> |
@@ -0,0 +1,35 @@ | |||
using BPA.Helper; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.Windows; | |||
using System.Windows.Controls; | |||
using System.Windows.Data; | |||
using System.Windows.Documents; | |||
using System.Windows.Input; | |||
using System.Windows.Media; | |||
using System.Windows.Media.Imaging; | |||
using System.Windows.Navigation; | |||
using System.Windows.Shapes; | |||
namespace BPASmartClient.SmallBatchingSystem.Views | |||
{ | |||
/// <summary> | |||
/// PfView.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class RecipeView : UserControl | |||
{ | |||
public RecipeView() | |||
{ | |||
InitializeComponent(); | |||
this.Unloaded += RecipeView_Unloaded; | |||
} | |||
private void RecipeView_Unloaded(object sender, RoutedEventArgs e) | |||
{ | |||
Json<ConfigInfoModel>.Save(); | |||
} | |||
} | |||
} |
@@ -6,6 +6,7 @@ | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:local="clr-namespace:BPASmartClient.SmallBatchingSystem.Views" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | |||
xmlns:vm="clr-namespace:BPASmartClient.SmallBatchingSystem.ViewModels" | |||
d:DesignHeight="450" | |||
d:DesignWidth="800" | |||
@@ -21,6 +22,32 @@ | |||
<SolidColorBrush x:Key="bordColor" Color="#332AB2E7" /> | |||
<con:DataTableRedundantConverter x:Key="tabConvert" /> | |||
<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="RowRadioButtonStyle" TargetType="{x:Type RadioButton}"> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
@@ -125,7 +152,6 @@ | |||
<Grid Margin="10"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="40" /> | |||
<RowDefinition Height="40" /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
@@ -136,7 +162,7 @@ | |||
Height="40" | |||
Margin="10,0,10,0" | |||
Command="{Binding AddCommand}" | |||
Content="添加原料参数" | |||
Content="添加料仓" | |||
FontSize="20" | |||
Style="{StaticResource ImageButtonStyle}" /> | |||
<Button | |||
@@ -149,220 +175,135 @@ | |||
Style="{StaticResource ImageButtonStyle}" /> | |||
</StackPanel> | |||
<!--#region 表格标题栏设置--> | |||
<Grid | |||
Grid.Row="1" | |||
Margin="0,10,0,0" | |||
Background="#ff0C255F"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Grid.Column="0" | |||
Style="{StaticResource TitleTextblockStyle}" | |||
Text="原料名称" /> | |||
<Grid Grid.Column="1"> | |||
<TextBlock Style="{StaticResource TitleTextblockStyle}" Text="慢加重量(g)" /> | |||
<Border | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid> | |||
<TextBlock | |||
Grid.Column="2" | |||
Style="{StaticResource TitleTextblockStyle}" | |||
Text="提前关阀重量" /> | |||
<Grid Grid.Column="3"> | |||
<TextBlock Style="{StaticResource TitleTextblockStyle}" Text="快加速度" /> | |||
<Border | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid> | |||
<TextBlock | |||
Grid.Column="4" | |||
Style="{StaticResource TitleTextblockStyle}" | |||
Text="慢加速度" /> | |||
<Grid Grid.Column="5"> | |||
<TextBlock Style="{StaticResource TitleTextblockStyle}" Text="伺服手动速度" /> | |||
<Border | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid> | |||
<TextBlock | |||
Grid.Column="6" | |||
Style="{StaticResource TitleTextblockStyle}" | |||
Text="料仓上限重量" /> | |||
<Grid Grid.Column="7"> | |||
<TextBlock Style="{StaticResource TitleTextblockStyle}" Text="料仓下限重量" /> | |||
<Border | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid> | |||
<TextBlock | |||
Grid.Column="8" | |||
Style="{StaticResource TitleTextblockStyle}" | |||
Text="搅拌速度" /> | |||
<Grid Grid.Column="9"> | |||
<TextBlock Style="{StaticResource TitleTextblockStyle}" Text="功能操作" /> | |||
<Border | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid> | |||
<Border | |||
Grid.ColumnSpan="10" | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1,0,1,0" /> | |||
</Grid> | |||
<!--#endregion--> | |||
<Grid Grid.Row="2"> | |||
<ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"> | |||
<ItemsControl ItemsSource="{Binding deviceParModels}"> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<Grid Name="gr" Height="30"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<TextBox | |||
Grid.Column="0" | |||
Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}" | |||
Style="{StaticResource InputTextboxStyle}" | |||
Text="{Binding MaterialName}" /> | |||
<Grid Grid.Column="1"> | |||
<TextBox | |||
Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}" | |||
Style="{StaticResource InputTextboxStyle}" | |||
Text="{Binding SlowlyAddWeight}" /> | |||
<Border | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid> | |||
<TextBox | |||
Grid.Column="2" | |||
Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}" | |||
Style="{StaticResource InputTextboxStyle}" | |||
Text="{Binding PreCloseValveWeight}" /> | |||
<Grid Grid.Column="3"> | |||
<TextBox | |||
Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}" | |||
Style="{StaticResource InputTextboxStyle}" | |||
Text="{Binding RapidAcceleration}" /> | |||
<Border | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid> | |||
<TextBox | |||
Grid.Column="4" | |||
Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}" | |||
Style="{StaticResource InputTextboxStyle}" | |||
Text="{Binding SlowAcceleration}" /> | |||
<Grid Grid.Column="5"> | |||
<TextBox | |||
Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}" | |||
Style="{StaticResource InputTextboxStyle}" | |||
Text="{Binding ServoManualSpeed}" /> | |||
<Border | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid> | |||
<TextBox | |||
Grid.Column="6" | |||
Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}" | |||
Style="{StaticResource InputTextboxStyle}" | |||
Text="{Binding SiloUpperLimitWeight}" /> | |||
<Grid Grid.Column="7"> | |||
<TextBox | |||
Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}" | |||
Style="{StaticResource InputTextboxStyle}" | |||
Text="{Binding LowerLimitWeightOfSilo}" /> | |||
<Border | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid> | |||
<TextBox | |||
Grid.Column="8" | |||
Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}" | |||
Style="{StaticResource InputTextboxStyle}" | |||
Text="{Binding StirringSpeed}" /> | |||
<Grid Grid.Row="1"> | |||
<ListView | |||
Margin="10" | |||
Background="Transparent" | |||
BorderBrush="#00BEFA" | |||
BorderThickness="0" | |||
ItemsSource="{Binding SiloInfoModels}" | |||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"> | |||
<ListView.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<WrapPanel Orientation="Horizontal" /> | |||
</ItemsPanelTemplate> | |||
</ListView.ItemsPanel> | |||
<ListView.ItemTemplate> | |||
<DataTemplate> | |||
<Border | |||
Name="ShadowElement" | |||
Width="180" | |||
Height="150" | |||
Margin="10" | |||
VerticalAlignment="Top" | |||
BorderBrush="#00BEFA" | |||
BorderThickness="0" | |||
ClipToBounds="True" | |||
CornerRadius="0"> | |||
<Border.Background> | |||
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/蓝色背景.png" Stretch="Fill" /> | |||
</Border.Background> | |||
<Grid Grid.Column="9"> | |||
<Button | |||
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}" | |||
CommandParameter="{Binding MaterialName}" | |||
<Grid Margin="20,0"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<TextBlock | |||
Grid.Row="0" | |||
Grid.ColumnSpan="2" | |||
Margin="0,10,0,0" | |||
VerticalAlignment="Center" | |||
FontSize="20" | |||
Foreground="#00BEFA" | |||
Text="{Binding SiloName}" /> | |||
<StackPanel | |||
Grid.Row="1" | |||
VerticalAlignment="Center" | |||
Orientation="Horizontal"> | |||
<TextBlock | |||
Grid.Row="1" | |||
FontSize="14" | |||
Foreground="#aa00BEFA" | |||
Text="料仓位置:" /> | |||
<TextBlock | |||
Grid.Row="1" | |||
FontSize="14" | |||
Foreground="#aa00BEFA" | |||
Text="{Binding SiloLoc}" /> | |||
</StackPanel> | |||
<Grid | |||
Name="gr" | |||
Grid.Row="2" | |||
Height="30" | |||
Margin="0,0,0,10"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<pry:IcoButton | |||
Width="{Binding ElementName=gr, Path=ActualWidth}" | |||
Height="{Binding ElementName=gr, Path=ActualHeight}" | |||
Margin="4,4,3,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Background="#11F53F62" | |||
BorderThickness="0" | |||
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ListBox, Mode=FindAncestor}}" | |||
CommandParameter="{Binding SiloName}" | |||
Content="删除" | |||
FontSize="16" | |||
Style="{StaticResource ControlButtonStyle}" /> | |||
<Border | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
EnterBackground="#22F53F62" | |||
FontStyle="Normal" | |||
Foreground="#FFF53F62" | |||
IcoText="" | |||
Style="{StaticResource IcoButtonStyle}" /> | |||
<pry:IcoButton | |||
Grid.Column="1" | |||
Width="{Binding ElementName=gr, Path=ActualWidth}" | |||
Height="{Binding ElementName=gr, Path=ActualHeight}" | |||
Margin="3,4,4,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Background="#112AB2E7" | |||
BorderThickness="0" | |||
Command="{Binding DataContext.DetailsCommand, RelativeSource={RelativeSource AncestorType=ListBox, Mode=FindAncestor}}" | |||
CommandParameter="{Binding SiloName}" | |||
Content="编辑" | |||
EnterBackground="#222AB2E7" | |||
Foreground="#FF2AB2E7" | |||
IcoText="" | |||
Style="{StaticResource IcoButtonStyle}" /> | |||
</Grid> | |||
<Border | |||
Grid.ColumnSpan="10" | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1,0,1,1" /> | |||
<!--<Button | |||
Grid.Row="2" | |||
Width="130" | |||
Height="30" | |||
Margin="0,0,0,0" | |||
VerticalAlignment="Top" | |||
Command="{Binding DataContext.ChangeNameCommand, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}" | |||
CommandParameter="{Binding IpAddress}" | |||
Content="修改原料名称" | |||
FontSize="16" | |||
IsEnabled="{Binding IsEnable}" | |||
Style="{StaticResource ImageButtonStyle}" />--> | |||
</Grid> | |||
<DataTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="true"> | |||
<Setter TargetName="gr" Property="Background" Value="#112AB2E7" /> | |||
</Trigger> | |||
</DataTemplate.Triggers> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
</ScrollViewer> | |||
</Border> | |||
</DataTemplate> | |||
</ListView.ItemTemplate> | |||
</ListView> | |||
</Grid> | |||
@@ -1,4 +1,5 @@ | |||
using System; | |||
using BPA.Helper; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
@@ -23,6 +24,12 @@ namespace BPASmartClient.SmallBatchingSystem.Views | |||
public SiloManagementView() | |||
{ | |||
InitializeComponent(); | |||
this.Unloaded += SiloManagementView_Unloaded; | |||
} | |||
private void SiloManagementView_Unloaded(object sender, RoutedEventArgs e) | |||
{ | |||
Json<ConfigInfoModel>.Save(); | |||
} | |||
} | |||
} |
@@ -27,6 +27,7 @@ namespace BPASmartClient.ViewModel | |||
ConfirmButton(); | |||
if (Json<KeepDataBase>.Data.orderLists.Count > 0) | |||
{ | |||
Message.MessageLog.GetInstance.Show($"重启软件前订单剩余{Json<KeepDataBase>.Data.orderLists.Count}个"); | |||
ThreadManage.GetInstance().Start(new Action(() => | |||
{ | |||
Thread.Sleep(10000); | |||
@@ -42,12 +42,14 @@ | |||
<Compile Remove="TheTextBox.cs" /> | |||
<Compile Remove="TheTimer.cs" /> | |||
<Compile Remove="TheToggleButton.xaml.cs" /> | |||
<Compile Remove="ViewModel\MainViewModel.cs" /> | |||
<Compile Remove="WaveProgressBar.cs" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<None Remove="Fonts\ds-digib.ttf" /> | |||
<None Remove="Images\bj.png" /> | |||
<None Remove="Images\Exp.png" /> | |||
<None Remove="Images\fyf.ico" /> | |||
<None Remove="Images\gaugeMask.png" /> | |||
<None Remove="Images\hbl.ico" /> | |||
@@ -83,6 +85,7 @@ | |||
<ItemGroup> | |||
<Resource Include="Fonts\ds-digib.ttf" /> | |||
<Resource Include="Images\bj.png" /> | |||
<Resource Include="Images\Exp.png" /> | |||
<Resource Include="Images\fyf.ico" /> | |||
<Resource Include="Images\gaugeMask.png" /> | |||
<Resource Include="Images\hbl.ico" /> | |||
@@ -99,15 +102,8 @@ | |||
<Resource Include="Images\光柱.png" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Folder Include="Helper\" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<ProjectReference Include="..\BPASmart.Model\BPASmart.Model.csproj" /> | |||
<ProjectReference Include="..\BPASmartClient.DATABUS\BPASmartClient.DATABUS.csproj" /> | |||
<ProjectReference Include="..\BPASmartClient.MessageCommunication\BPASmartClient.MessageCommunication.csproj" /> | |||
<ProjectReference Include="..\BPASmartClient.MessageName\BPASmartClient.MessageName.csproj" /> | |||
<ProjectReference Include="..\BPASmartClient.SCADAControl\BPASmartClient.SCADAControl.csproj" /> | |||
</ItemGroup> | |||
@@ -123,4 +119,8 @@ | |||
</Reference> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Folder Include="Helper\" /> | |||
</ItemGroup> | |||
</Project> |
@@ -0,0 +1,162 @@ | |||
using BPASmartClient.Compiler; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BeDesignerSCADA.Common | |||
{ | |||
/// <summary> | |||
/// 页面菜单属性 | |||
/// </summary> | |||
public class MenuModel : ObservableObject | |||
{ | |||
/// <summary> | |||
/// 是否显示菜单 | |||
/// </summary> | |||
private bool _IsVisibility; | |||
public bool IsVisibility | |||
{ | |||
get | |||
{ | |||
return _IsVisibility; | |||
} | |||
set | |||
{ | |||
_IsVisibility = value; | |||
OnPropertyChanged("IsVisibility"); | |||
} | |||
} | |||
/// <summary> | |||
/// 程序集名称 | |||
/// </summary> | |||
private string _Name; | |||
public string Name | |||
{ | |||
get | |||
{ | |||
return _Name; | |||
} | |||
set | |||
{ | |||
_Name = value; | |||
OnPropertyChanged("Name"); | |||
} | |||
} | |||
/// <summary> | |||
/// 菜单显示方向 | |||
/// </summary> | |||
private MenuAlignment _Alignment; | |||
public MenuAlignment Alignment | |||
{ | |||
get | |||
{ | |||
return _Alignment; | |||
} | |||
set | |||
{ | |||
_Alignment = value; | |||
OnPropertyChanged("Alignment"); | |||
} | |||
} | |||
/// <summary> | |||
/// 页面控件集合 | |||
/// </summary> | |||
public Dictionary<string, PageBase> PageChildren = new Dictionary<string, PageBase>(); | |||
} | |||
/// <summary> | |||
/// 菜单选择枚举 | |||
/// </summary> | |||
public enum MenuAlignment | |||
{ | |||
左边, | |||
顶部, | |||
右边, | |||
底部, | |||
} | |||
/// <summary> | |||
/// 页面Model | |||
/// </summary> | |||
public class PageModel : PageBase | |||
{ | |||
/// <summary> | |||
/// 页面控件集合 | |||
/// </summary> | |||
public CanvasPanel visual { get; set; } | |||
} | |||
/// <summary> | |||
/// 页面 | |||
/// </summary> | |||
public class PageBase : ObservableObject | |||
{ | |||
/// <summary> | |||
/// 是否首页 | |||
/// </summary> | |||
private bool _IsHome; | |||
public bool IsHome | |||
{ | |||
get | |||
{ | |||
return _IsHome; | |||
} | |||
set | |||
{ | |||
_IsHome = value; | |||
OnPropertyChanged("IsHome"); | |||
} | |||
} | |||
/// <summary> | |||
/// 排序 | |||
/// </summary> | |||
public int Sort { get; set; } | |||
/// <summary> | |||
/// 页面名称 | |||
/// </summary> | |||
private string _Name; | |||
public string Name | |||
{ | |||
get | |||
{ | |||
return _Name; | |||
} | |||
set | |||
{ | |||
_Name = value; | |||
OnPropertyChanged("Name"); | |||
} | |||
} | |||
/// <summary> | |||
/// 菜单名称 | |||
/// </summary> | |||
private string _MenuName; | |||
public string MenuName | |||
{ | |||
get | |||
{ | |||
return _MenuName; | |||
} | |||
set | |||
{ | |||
_MenuName = value; | |||
OnPropertyChanged("MenuName"); | |||
} | |||
} | |||
/// <summary> | |||
/// 页面ID | |||
/// </summary> | |||
public string Id { get; set; } | |||
/// <summary> | |||
/// 页面子控件集合 | |||
/// </summary> | |||
public List<string> ChildrenStr { get; set; } | |||
public PageBase() | |||
{ | |||
ChildrenStr = new List<string>(); | |||
Id = Guid.NewGuid().ToString(); | |||
} | |||
} | |||
} |