Bladeren bron

修改配方管理界面。

JXJAgvReake
ZhaoGang 1 jaar geleden
bovenliggende
commit
df6984415e
13 gewijzigde bestanden met toevoegingen van 919 en 184 verwijderingen
  1. +31
    -0
      BPASmartClient.Tourism/Converter/EFuncToTextConverter.cs
  2. +63
    -0
      BPASmartClient.Tourism/CustomStyle/CustomStyle.xaml
  3. +1
    -1
      BPASmartClient.Tourism/Model/EFunc.cs
  4. +1
    -1
      BPASmartClient.Tourism/Model/FuncPar.cs
  5. +1
    -1
      BPASmartClient.Tourism/Model/InitData.cs
  6. +182
    -157
      BPASmartClient.Tourism/View/AddRawMaterialView.xaml
  7. +207
    -0
      BPASmartClient.Tourism/View/EditRecipeView.xaml
  8. +34
    -0
      BPASmartClient.Tourism/View/EditRecipeView.xaml.cs
  9. +1
    -2
      BPASmartClient.Tourism/View/ItemStorageView.xaml
  10. +223
    -5
      BPASmartClient.Tourism/View/RecipeManageView.xaml
  11. +2
    -16
      BPASmartClient.Tourism/View/RecipeManageView.xaml.cs
  12. +103
    -0
      BPASmartClient.Tourism/ViewModel/EditRecipeViewModel.cs
  13. +70
    -1
      BPASmartClient.Tourism/ViewModel/RecipeManageViewModel.cs

+ 31
- 0
BPASmartClient.Tourism/Converter/EFuncToTextConverter.cs Bestand weergeven

@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;

namespace BPASmartClient.MorkCL.Converter
{
public class EFuncToTextConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{

if (value is EFunc para)
{
return Enum.GetName(typeof(EFunc), para);
}
else
{
return null;
}
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}

+ 63
- 0
BPASmartClient.Tourism/CustomStyle/CustomStyle.xaml Bestand weergeven

@@ -0,0 +1,63 @@
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converter="clr-namespace:BPASmartClient.MorkCL.Converter">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Recdictionarys/GlobalStyle.xaml" />
</ResourceDictionary.MergedDictionaries>

<!--#region 转换器-->
<converter:EFuncToTextConverter x:Key="EFuncToTextConverter" />
<!--#endregion-->

<Style x:Key="DataShowTextBoxStyle" TargetType="TextBox">
<Setter Property="Margin" Value="5,0,0,0" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="Height" Value="50" />
<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="IssueRecipeButtonStyle"
BasedOn="{StaticResource ControlButtonStyle}"
TargetType="Button">
<Setter Property="Foreground" Value="{StaticResource FontColor}" />
<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/组合边框2.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>
</ResourceDictionary>

+ 1
- 1
BPASmartClient.Tourism/Model/EFunc.cs Bestand weergeven

@@ -9,7 +9,7 @@ namespace BPASmartClient.MorkCL.Model
/// <summary>
/// 功能枚举列表
/// </summary>
internal enum EFunc
public enum EFunc
{
搅拌启动,
搅拌停止,


+ 1
- 1
BPASmartClient.Tourism/Model/FuncPar.cs Bestand weergeven

@@ -9,7 +9,7 @@ namespace BPASmartClient.MorkCL.Model
/// <summary>
/// 功能参数信息
/// </summary>
internal class FuncPar
public class FuncPar
{
/// <summary>
/// 参数名


+ 1
- 1
BPASmartClient.Tourism/Model/InitData.cs Bestand weergeven

@@ -6,7 +6,7 @@ using System.Threading.Tasks;

namespace BPASmartClient.MorkCL.Model
{
internal class InitData
public class InitData
{
public static Dictionary<EFunc, FuncPar[]> FunParInit { get; private set; } = new()
{


+ 182
- 157
BPASmartClient.Tourism/View/AddRawMaterialView.xaml Bestand weergeven

@@ -7,7 +7,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource"
xmlns:vm="clr-namespace:BPASmartClient.MorkCL.ViewModel"
Name="物料参数"
Name="物料参数"
mc:Ignorable="d">
<UserControl.DataContext>
<vm:AddRawMaterialViewModel />
@@ -15,23 +15,8 @@
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Recdictionarys/GlobalStyle.xaml" />
<ResourceDictionary Source="/BPASmartClient.MorkCL;component/CustomStyle/CustomStyle.xaml" />
</ResourceDictionary.MergedDictionaries>
<Style x:Key="DataShowTextBoxStyle" TargetType="TextBox">
<Setter Property="Margin" Value="5,0,0,0" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="Height" Value="50" />
<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>
</ResourceDictionary>
</UserControl.Resources>

@@ -47,7 +32,7 @@

<!--#region 辅料-->

<pry:ImageBorder Margin="15"/>
<pry:ImageBorder Margin="15" />
<Grid Margin="20">
<Grid.RowDefinitions>
<RowDefinition Height="50" />
@@ -58,16 +43,23 @@
<DockPanel LastChildFill="False">
<TextBlock
Margin="20,0"
Text="辅料参数设置" HorizontalAlignment="Center"/>
<Button Content="新增辅料数据" DockPanel.Dock="Right" Margin="30,0"/>

<Button Content="保存数据" DockPanel.Dock="Right" Margin="30,0"/>
HorizontalAlignment="Center"
Text="辅料参数设置" />
<Button
Margin="30,0"
Content="新增辅料数据"
DockPanel.Dock="Right" />

<Button
Margin="30,0"
Content="保存数据"
DockPanel.Dock="Right" />
</DockPanel>
<!--#region 表格标题栏设置-->
<Grid
Grid.Row="1"
Margin="0,10,0,0"
Background="#ff0C255F">
Grid.Row="1"
Margin="0,10,0,0"
Background="#ff0C255F">

<Grid.ColumnDefinitions>
<ColumnDefinition />
@@ -78,42 +70,42 @@


<TextBlock
Grid.Column="0"
Style="{StaticResource TitleTextblockStyle}"
Text="ID" />
Grid.Column="0"
Style="{StaticResource TitleTextblockStyle}"
Text="ID" />

<Grid Grid.Column="1">
<TextBlock Style="{StaticResource TitleTextblockStyle}" Text="名称" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>

<TextBlock
Grid.Column="2"
Style="{StaticResource TitleTextblockStyle}"
Text="位置" />
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" />
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>


<Border
Grid.ColumnSpan="10"
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0" />
Grid.ColumnSpan="10"
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0" />

</Grid>
<!--#endregion-->

<!--#region 表格数据显示设置 -->
<!--#region 表格数据显示设置-->
<Grid Grid.Row="2">
<ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden">
<ItemsControl ItemsSource="{Binding Accessories}">
@@ -128,42 +120,47 @@
</Grid.ColumnDefinitions>

<TextBox
Grid.Column="0"
Style="{StaticResource DataShowTextBoxStyle}"
Text="{Binding Id}" TextAlignment="Center" IsReadOnly="True"/>
Grid.Column="0"
IsReadOnly="True"
Style="{StaticResource DataShowTextBoxStyle}"
Text="{Binding Id}"
TextAlignment="Center" />

<Grid Grid.Column="1">
<TextBox
Style="{StaticResource DataShowTextBoxStyle}"
Text="{Binding Name}" TextAlignment="Center" />
Style="{StaticResource DataShowTextBoxStyle}"
Text="{Binding Name}"
TextAlignment="Center" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>

<TextBox
Grid.Column="2"
Style="{StaticResource DataShowTextBoxStyle}"
Text="{Binding Loc}" TextAlignment="Center" IsReadOnly="True"/>
Grid.Column="2"
IsReadOnly="True"
Style="{StaticResource DataShowTextBoxStyle}"
Text="{Binding Loc}"
TextAlignment="Center" />

<Grid Grid.Column="3">
<Button
Command="{Binding DataContext.RemoveAccessoryCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}"
CommandParameter="{Binding Id}"
Content="删除"
FontSize="16"
Style="{StaticResource ControlButtonStyle}" />
Command="{Binding DataContext.RemoveAccessoryCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}"
CommandParameter="{Binding Id}"
Content="删除"
FontSize="16"
Style="{StaticResource ControlButtonStyle}" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>

<Border
Grid.ColumnSpan="10"
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,1" />
Grid.ColumnSpan="10"
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,1" />

</Grid>
<DataTemplate.Triggers>
@@ -179,12 +176,12 @@
<!--#endregion-->

</Grid>
<!--#endregion-->
<!--#region 调料-->
<pry:ImageBorder Grid.Row="1" Margin="15"/>
<Grid Margin="20" Grid.Row="1">
<pry:ImageBorder Grid.Row="1" Margin="15" />
<Grid Grid.Row="1" Margin="20">
<Grid.RowDefinitions>
<RowDefinition Height="50" />
<RowDefinition Height="40" />
@@ -194,16 +191,23 @@
<DockPanel LastChildFill="False">
<TextBlock
Margin="20,0"
Text="调料参数设置" HorizontalAlignment="Center"/>
<Button Content="新增调料数据" DockPanel.Dock="Right" Margin="30,0"/>

<Button Content="保存数据" DockPanel.Dock="Right" Margin="30,0"/>
HorizontalAlignment="Center"
Text="调料参数设置" />
<Button
Margin="30,0"
Content="新增调料数据"
DockPanel.Dock="Right" />

<Button
Margin="30,0"
Content="保存数据"
DockPanel.Dock="Right" />
</DockPanel>
<!--#region 表格标题栏设置-->
<Grid
Grid.Row="1"
Margin="0,10,0,0"
Background="#ff0C255F">
Grid.Row="1"
Margin="0,10,0,0"
Background="#ff0C255F">

<Grid.ColumnDefinitions>
<ColumnDefinition />
@@ -214,39 +218,39 @@


<TextBlock
Grid.Column="0"
Style="{StaticResource TitleTextblockStyle}"
Text="ID" />
Grid.Column="0"
Style="{StaticResource TitleTextblockStyle}"
Text="ID" />

<Grid Grid.Column="1">
<TextBlock Style="{StaticResource TitleTextblockStyle}" Text="名称" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>

<TextBlock
Grid.Column="2"
Style="{StaticResource TitleTextblockStyle}"
Text="位置" />
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" />
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>
<Border
Grid.ColumnSpan="10"
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0" />
Grid.ColumnSpan="10"
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0" />

</Grid>
<!--#endregion-->

<!--#region 表格数据显示设置 -->
<!--#region 表格数据显示设置-->
<Grid Grid.Row="2">
<ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden">
<ItemsControl ItemsSource="{Binding Seasonings}">
@@ -261,42 +265,47 @@
</Grid.ColumnDefinitions>

<TextBox
Grid.Column="0"
Style="{StaticResource DataShowTextBoxStyle}"
Text="{Binding Id}" TextAlignment="Center" IsReadOnly="True"/>
Grid.Column="0"
IsReadOnly="True"
Style="{StaticResource DataShowTextBoxStyle}"
Text="{Binding Id}"
TextAlignment="Center" />

<Grid Grid.Column="1">
<TextBox
Style="{StaticResource DataShowTextBoxStyle}"
Text="{Binding Name}" TextAlignment="Center" />
Style="{StaticResource DataShowTextBoxStyle}"
Text="{Binding Name}"
TextAlignment="Center" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>

<TextBox
Grid.Column="2"
Style="{StaticResource DataShowTextBoxStyle}"
Text="{Binding Loc}" TextAlignment="Center" IsReadOnly="True"/>
Grid.Column="2"
IsReadOnly="True"
Style="{StaticResource DataShowTextBoxStyle}"
Text="{Binding Loc}"
TextAlignment="Center" />

<Grid Grid.Column="3">
<Button
Command="{Binding DataContext.RemoveSeasoningCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}"
CommandParameter="{Binding Id}"
Content="删除"
FontSize="16"
Style="{StaticResource ControlButtonStyle}" />
Command="{Binding DataContext.RemoveSeasoningCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}"
CommandParameter="{Binding Id}"
Content="删除"
FontSize="16"
Style="{StaticResource ControlButtonStyle}" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>

<Border
Grid.ColumnSpan="10"
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,1" />
Grid.ColumnSpan="10"
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,1" />

</Grid>
<DataTemplate.Triggers>
@@ -313,11 +322,17 @@

</Grid>
<!--#endregion-->
<!--#region 原料-->
<pry:ImageBorder Grid.RowSpan="2" Grid.Column="1" Margin="15"/>
<Grid Margin="20" Grid.RowSpan="2" Grid.Column="1">
<pry:ImageBorder
Grid.RowSpan="2"
Grid.Column="1"
Margin="15" />
<Grid
Grid.RowSpan="2"
Grid.Column="1"
Margin="20">
<Grid.RowDefinitions>
<RowDefinition Height="50" />
<RowDefinition Height="40" />
@@ -327,16 +342,23 @@
<DockPanel LastChildFill="False">
<TextBlock
Margin="20,0"
Text="主料参数设置" HorizontalAlignment="Center"/>
<Button Content="新增主料数据" DockPanel.Dock="Right" Margin="30,0"/>

<Button Content="保存数据" DockPanel.Dock="Right" Margin="30,0"/>
HorizontalAlignment="Center"
Text="主料参数设置" />
<Button
Margin="30,0"
Content="新增主料数据"
DockPanel.Dock="Right" />

<Button
Margin="30,0"
Content="保存数据"
DockPanel.Dock="Right" />
</DockPanel>
<!--#region 表格标题栏设置-->
<Grid
Grid.Row="1"
Margin="0,10,0,0"
Background="#ff0C255F">
Grid.Row="1"
Margin="0,10,0,0"
Background="#ff0C255F">

<Grid.ColumnDefinitions>
<ColumnDefinition />
@@ -346,39 +368,39 @@


<TextBlock
Grid.Column="0"
Style="{StaticResource TitleTextblockStyle}"
Text="ID" />
Grid.Column="0"
Style="{StaticResource TitleTextblockStyle}"
Text="ID" />

<Grid Grid.Column="1">
<TextBlock Style="{StaticResource TitleTextblockStyle}" Text="名称" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>


<Grid Grid.Column="3">
<TextBlock Style="{StaticResource TitleTextblockStyle}" Text="操作" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>



<Border
Grid.ColumnSpan="10"
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0" />
Grid.ColumnSpan="10"
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0" />

</Grid>
<!--#endregion-->

<!--#region 表格数据显示设置 -->
<!--#region 表格数据显示设置-->
<Grid Grid.Row="2">
<ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden">
<ItemsControl ItemsSource="{Binding Ingredients}">
@@ -392,37 +414,40 @@
</Grid.ColumnDefinitions>

<TextBox
Grid.Column="0"
Style="{StaticResource DataShowTextBoxStyle}"
Text="{Binding Id}" TextAlignment="Center" IsReadOnly="True"/>
Grid.Column="0"
IsReadOnly="True"
Style="{StaticResource DataShowTextBoxStyle}"
Text="{Binding Id}"
TextAlignment="Center" />

<Grid Grid.Column="1">
<TextBox
Style="{StaticResource DataShowTextBoxStyle}"
Text="{Binding Name}" TextAlignment="Center" />
Style="{StaticResource DataShowTextBoxStyle}"
Text="{Binding Name}"
TextAlignment="Center" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>

<Grid Grid.Column="2">
<Button
Command="{Binding DataContext.RemoveSeasoningCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}"
CommandParameter="{Binding Id}"
Content="删除"
FontSize="16"
Style="{StaticResource ControlButtonStyle}" />
Command="{Binding DataContext.RemoveSeasoningCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}"
CommandParameter="{Binding Id}"
Content="删除"
FontSize="16"
Style="{StaticResource ControlButtonStyle}" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>

<Border
Grid.ColumnSpan="10"
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,1" />
Grid.ColumnSpan="10"
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,1" />

</Grid>
<DataTemplate.Triggers>


+ 207
- 0
BPASmartClient.Tourism/View/EditRecipeView.xaml Bestand weergeven

@@ -0,0 +1,207 @@
<Window
x:Class="BPASmartClient.MorkCL.View.EditRecipeView"
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.MorkCL.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:BPASmartClient.MorkCL.ViewModel"
Title="EditRecipeView"
Width="900"
Height="700"
AllowsTransparency="True"
Background="{x:Null}"
Topmost="True"
WindowStartupLocation="CenterScreen"
WindowStyle="None"
mc:Ignorable="d">
<Window.DataContext>
<vm:EditRecipeViewModel />
</Window.DataContext>
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/BPASmartClient.MorkCL;component/CustomStyle/CustomStyle.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
<Border
Name="br"
BorderBrush="#0CADF5"
BorderThickness="0">
<Border.Background>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/弹框/z4.png" />
</Border.Background>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="50" />
<RowDefinition Height="50" />
<RowDefinition Height="1*" />
</Grid.RowDefinitions>
<!--#region 标题栏-->
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
Foreground="DeepSkyBlue"
Text="配方编辑界面" />
<!--#endregion-->

<!--#region 操作栏-->
<Border
Grid.Row="1"
BorderBrush="#3099E5"
BorderThickness="1">
<DockPanel LastChildFill="False">
<TextBlock
Margin="5,0"
DockPanel.Dock="Left"
Text="配方名称:" />
<TextBox
Width="100"
DockPanel.Dock="Left"
FontSize="18"
Foreground="DeepSkyBlue"
Text="{Binding Name}" />
<TextBlock
Margin="10,0"
DockPanel.Dock="Left"
Text="配方ID:" />
<TextBox
Width="100"
DockPanel.Dock="Left"
FontSize="18"
Foreground="DeepSkyBlue"
Text="{Binding ID}" />
<Button
Margin="10,0"
Click="Button_Click"
Content="取消并关闭"
DockPanel.Dock="Right" />
<Button
Margin="10,0"
Command="{Binding SaveParamCommand}"
Content="保存参数"
DockPanel.Dock="Right" />
<Button
Margin="10,0"
Command="{Binding AddFuncCommand}"
Content="添加功能"
DockPanel.Dock="Right" />
</DockPanel>
</Border>
<!--#endregion-->

<!--#region 数据栏-->
<Grid Grid.Row="2" Margin="5">
<Grid.RowDefinitions>
<RowDefinition Height="40" />
<RowDefinition Height="1*" />
</Grid.RowDefinitions>
<!--#region 表格标题栏设置-->
<Grid Margin="0,10,0,0" Background="#ff0C255F">

<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</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>

<TextBlock
Grid.Column="2"
Style="{StaticResource TitleTextblockStyle}"
Text="删除" />


<Border
Grid.ColumnSpan="10"
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0" />

</Grid>
<!--#endregion-->

<!--#region 表格数据-->
<Grid Grid.Row="1">
<ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden">
<ItemsControl ItemsSource="{Binding Functions}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid Name="gr" Height="30">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<Grid>
<TextBlock Text="{Binding Key, Converter={StaticResource EFuncToTextConverter}}" FontSize="24"/>
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="2,0,2,0"
Cursor="SizeWE" />
</Grid>

<Grid Grid.Column="1" >
<Button
Command="{Binding DataContext.EditCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}"
CommandParameter="{Binding Id}"
Content="编辑"
FontSize="16"
Style="{StaticResource IssueRecipeButtonStyle}" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="2,0,2,0"
Cursor="SizeWE" />
</Grid>

<Grid Grid.Column="2">
<Button
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}"
CommandParameter="{Binding Id}"
Content="删除"
FontSize="16"
Style="{StaticResource ControlButtonStyle}" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>

<Border
Grid.ColumnSpan="10"
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,1" />

</Grid>
<DataTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="gr" Property="Background" Value="#112AB2E7" />
</Trigger>
</DataTemplate.Triggers>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
</Grid>
<!--#endregion-->
</Grid>
<!--#endregion-->
</Grid>
</Border>
</Window>

+ 34
- 0
BPASmartClient.Tourism/View/EditRecipeView.xaml.cs Bestand weergeven

@@ -0,0 +1,34 @@
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.MorkCL.View
{
/// <summary>
/// EditRecipeView.xaml 的交互逻辑
/// </summary>
public partial class EditRecipeView : Window
{
public EditRecipeView()
{
InitializeComponent();
this.br.MouseLeftButtonDown += (o, e) => { if (e.LeftButton == MouseButtonState.Pressed) this.DragMove(); };
}

private void Button_Click(object sender, RoutedEventArgs e)
{
this.DialogResult = false;
this.Close();
}
}
}

+ 1
- 2
BPASmartClient.Tourism/View/ItemStorageView.xaml Bestand weergeven

@@ -12,8 +12,7 @@
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml" />
<ResourceDictionary Source="/BPASmartClient.MorkCL;component/CustomStyle/CustomStyle.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>


+ 223
- 5
BPASmartClient.Tourism/View/RecipeManageView.xaml Bestand weergeven

@@ -5,24 +5,242 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.MorkCL.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
d:DesignHeight="450"
d:DesignWidth="800"
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource"
xmlns:vm="clr-namespace:BPASmartClient.MorkCL.ViewModel"
Name="配方管理"
mc:Ignorable="d">
<UserControl.DataContext>
<vm:RecipeManageViewModel />
</UserControl.DataContext>
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Recdictionarys/GlobalStyle.xaml" />
</ResourceDictionary.MergedDictionaries>
<Style x:Key="DataShowTextBoxStyle" TargetType="TextBox">
<Setter Property="Margin" Value="5,0,0,0" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="Height" Value="50" />
<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="IssueRecipeButtonStyle"
BasedOn="{StaticResource ControlButtonStyle}"
TargetType="Button">
<Setter Property="Foreground" Value="{StaticResource FontColor}" />
<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/组合边框2.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>
</ResourceDictionary>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="50" />
<RowDefinition Height="40" />
<RowDefinition Height="1*" />
</Grid.RowDefinitions>
<!--#region 操作栏-->

<!--#region 标题栏设置-->
<pry:ImageBorder Grid.Row="0">
<StackPanel
Height="40"
Margin="5,0"
FlowDirection="RightToLeft"
Orientation="Horizontal">
<Button
Margin="5,0"
VerticalAlignment="Center"
Command="{Binding AddRecipeCommand}"
Content="添加配方" />
<Button
Margin="5,0"
VerticalAlignment="Center"
Command="{Binding SaveParamCommand}"
Content="保存参数" />
</StackPanel>
</pry:ImageBorder>
<!--#endregion-->

<!--#region 配方管理正文-->
<pry:ImageBorder Grid.Row="1" Margin="5">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="40" />
<RowDefinition Height="1*" />
</Grid.RowDefinitions>

<!--#region 标题栏设置-->
<Grid Margin="0,10,0,0" Background="#ff0C255F">

<Grid.ColumnDefinitions>
<ColumnDefinition Width="200" />
<ColumnDefinition />
<ColumnDefinition Width="200" />
<ColumnDefinition Width="200" />
<ColumnDefinition Width="100" />
</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>

<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>

<Grid Grid.Column="4">
<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-->

<!--#region 表格数据显示设置-->
<Grid Grid.Row="1">
<ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden">
<ItemsControl ItemsSource="{Binding Recipes}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="200" />
<ColumnDefinition />
<ColumnDefinition Width="200" />
<ColumnDefinition Width="200" />
<ColumnDefinition Width="100" />
</Grid.ColumnDefinitions>

<TextBox
Grid.Column="0"
IsReadOnly="True"
Style="{StaticResource DataShowTextBoxStyle}"
Text="{Binding ID}"
TextAlignment="Center" />

<Grid Grid.Column="1">
<TextBox
Style="{StaticResource DataShowTextBoxStyle}"
Text="{Binding Remark}"
TextAlignment="Center" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>

<Grid Grid.Column="2" Margin="5">
<Button
Command="{Binding DataContext.IssueCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}"
CommandParameter="{Binding ID}"
Content="下发"
FontSize="16"
Style="{StaticResource IssueRecipeButtonStyle}" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>

<Grid Grid.Column="3" Margin="5">
<Button
Command="{Binding DataContext.EditCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}"
CommandParameter="{Binding Id}"
Content="编辑"
FontSize="16"
Style="{StaticResource IssueRecipeButtonStyle}" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>

<Grid Grid.Column="4">
<Button
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}"
CommandParameter="{Binding Id}"
Content="删除"
FontSize="16"
Style="{StaticResource ControlButtonStyle}" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>

<Border
Grid.ColumnSpan="10"
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,1" />
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
</Grid>
<!--#endregion-->
</Grid>
</pry:ImageBorder>
<!--#endregion-->
</Grid>
</UserControl>
</UserControl>

+ 2
- 16
BPASmartClient.Tourism/View/RecipeManageView.xaml.cs Bestand weergeven

@@ -1,17 +1,4 @@
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;
using System.Windows.Controls;

namespace BPASmartClient.MorkCL.View
{
@@ -23,7 +10,6 @@ namespace BPASmartClient.MorkCL.View
public RecipeManageView()
{
InitializeComponent();

}
}
}
}

+ 103
- 0
BPASmartClient.Tourism/ViewModel/EditRecipeViewModel.cs Bestand weergeven

@@ -0,0 +1,103 @@
using System;
using System.CodeDom;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.MorkCL.ViewModel
{
public class EditRecipeViewModel:NotifyBase
{
public EditRecipeViewModel()
{
AddTestData();

SaveParamCommand = new BPARelayCommand(() =>
{

});
AddFuncCommand = new BPARelayCommand(() =>
{

});
}


private void AddTestData()
{
ID = "32587";
Name = "红烧肉";

var value = EFunc.出餐启动;
string a;
if (value is EFunc para)
{
a= Enum.GetName(typeof(EFunc), para);
}

Functions = new ObservableCollection<EFunc>();
foreach (var item in InitData.FunParInit.Keys)
{
Functions.Add(item);
}

Funcs = new ObservableCollection<string>();
foreach (var item in Enum.GetNames(typeof(EFunc)))
{
Funcs.Add(item);
}
}
/// <summary>
/// 保存参数。
/// </summary>
public BPARelayCommand SaveParamCommand { get; set; }
/// <summary>
/// 添加功能
/// </summary>
public BPARelayCommand AddFuncCommand { get; set; }
/// <summary>
/// 删除功能。
/// </summary>
public BPARelayCommand<string> RemoveCommand { get; set; }
/// <summary>
/// 编辑功能。
/// </summary>
public BPARelayCommand<string> EditCommand { get; set; }



private string _Name;

public string Name
{
get { return _Name; }
set { _Name = value;OnPropertyChanged(); }
}

private string _ID;

public string ID
{
get { return _ID; }
set { _ID = value; OnPropertyChanged(); }
}

private ObservableCollection<string> _Funcs;
public ObservableCollection<string> Funcs
{
get { return _Funcs; }
set { _Funcs = value;OnPropertyChanged(); }
}


private ObservableCollection<EFunc> _Functions;
public ObservableCollection<EFunc> Functions
{
get { return _Functions; }
set { _Functions = value; }
}


}
}

+ 70
- 1
BPASmartClient.Tourism/ViewModel/RecipeManageViewModel.cs Bestand weergeven

@@ -6,7 +6,76 @@ using System.Threading.Tasks;

namespace BPASmartClient.MorkCL.ViewModel
{
public class RecipeManageViewModel
public class RecipeManageViewModel:NotifyBase
{
public RecipeManageViewModel()
{
Recipes = new();
AddTestData();

SaveParamCommand = new(() =>
{

});
AddRecipeCommand = new(() => {
});
RemoveCommand = new((id) =>
{

});
IssueCommand = new((id) =>
{

});
EditCommand = new((id) =>
{
EditRecipeView editRecipeView = new EditRecipeView();
editRecipeView.ShowDialog();
});
}


/// <summary>
/// 配方类,里面应该包含配方数据。
/// </summary>
public ObservableCollection<TempRecipeData> Recipes { get; set; }

/// <summary>
/// 保存参数。
/// </summary>
public BPARelayCommand SaveParamCommand { get; set; }
/// <summary>
/// 添加配方。
/// </summary>
public BPARelayCommand AddRecipeCommand { get; set; }
/// <summary>
/// 移除配方。
/// </summary>
public BPARelayCommand<string> RemoveCommand { get; set; }
/// <summary>
/// 下发配方。
/// </summary>
public BPARelayCommand<string> IssueCommand { get; set; }
/// <summary>
/// 编辑配方。
/// </summary>
public BPARelayCommand<string> EditCommand { get; set; }

void AddTestData()
{
Recipes.Clear();
for (int i = 1; i < 10; i++)
{
Recipes.Add(new TempRecipeData() { ID = i,Name=$"{i}道菜",Remark=$"这是第{i}道菜。" });
}
}
public class TempRecipeData
{
public string Name { get; set; }
public int ID { get; set; }
public string Remark { get; set; }

}
}
}

Laden…
Annuleren
Opslaan