Browse Source

临时更新

master
taoye 2 years ago
parent
commit
949518c410
13 changed files with 1160 additions and 42 deletions
  1. +8
    -1
      BPASmartClient.JXJFoodBigStation/App.xaml.cs
  2. +31
    -0
      BPASmartClient.JXJFoodBigStation/Converter/DataTableRedundantConverter.cs
  3. +29
    -0
      BPASmartClient.JXJFoodBigStation/Converter/EnbleConvert.cs
  4. +29
    -0
      BPASmartClient.JXJFoodBigStation/Converter/IntToSourceConvert.cs
  5. +29
    -0
      BPASmartClient.JXJFoodBigStation/Converter/RunStatusConvert.cs
  6. +2
    -0
      BPASmartClient.JXJFoodBigStation/Model/HK_PLC/HKPlcCommAddress.cs
  7. +13
    -13
      BPASmartClient.JXJFoodBigStation/Model/RawMaterial/RawMaterialModel.cs
  8. +9
    -3
      BPASmartClient.JXJFoodBigStation/Model/RawMaterial/RecipeModel.cs
  9. +877
    -0
      BPASmartClient.JXJFoodBigStation/View/RecipeSendDownView.xaml
  10. +54
    -0
      BPASmartClient.JXJFoodBigStation/View/RecipeSendDownView.xaml.cs
  11. +14
    -14
      BPASmartClient.JXJFoodBigStation/ViewModel/RecipeInfosViewModel.cs
  12. +15
    -11
      BPASmartClient.JXJFoodBigStation/ViewModel/RecipeReceiveViewModel.cs
  13. +50
    -0
      BPASmartClient.JXJFoodBigStation/ViewModel/RecipeSendDownViewModel.cs

+ 8
- 1
BPASmartClient.JXJFoodBigStation/App.xaml.cs View File

@@ -56,11 +56,18 @@ namespace BPASmartClient.JXJFoodBigStation
ObservableCollection<SubMenumodel> RecipeManage = new ObservableCollection<SubMenumodel>();
RecipeManage.Add(new SubMenumodel()
{
SubMenuName = "服务配方管理",
SubMenuName = "本地配方管理",
SubMenuPermission = new Permission[] { Permission.管理员 },
AssemblyName = "BPASmartClient.JXJFoodBigStation",
ToggleWindowPath = "View.RecipeReceiveView"
});
RecipeManage.Add(new SubMenumodel()
{
SubMenuName = "本地配方下发",
SubMenuPermission = new Permission[] { Permission.管理员 },
AssemblyName = "BPASmartClient.JXJFoodBigStation",
ToggleWindowPath = "View.RecipeSendDownView"
});
MenuManage.GetInstance.menuModels.Add(new MenuModel()
{
MainMenuIcon = "&#xe683;",


+ 31
- 0
BPASmartClient.JXJFoodBigStation/Converter/DataTableRedundantConverter.cs View File

@@ -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;
using System.Windows.Media;

namespace BPASmartClient.JXJFoodBigStation.Converter
{
public class DataTableRedundantConverter: IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value != null && value is bool bit)
{
if (bit)
return new SolidColorBrush(Color.FromArgb(255, 245, 63, 98));
else
return new SolidColorBrush(Color.FromArgb(255, 42, 178, 231));
}
return default;
}

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

+ 29
- 0
BPASmartClient.JXJFoodBigStation/Converter/EnbleConvert.cs View File

@@ -0,0 +1,29 @@
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.JXJFoodBigStation.Converter
{
public class EnbleConvert : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is ushort tempValue)
{
if (tempValue == 0) return true;
if (tempValue == 1) return false;

}
return true;
}

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

+ 29
- 0
BPASmartClient.JXJFoodBigStation/Converter/IntToSourceConvert.cs View File

@@ -0,0 +1,29 @@
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.JXJFoodBigStation.Converter
{
public class IntToSourceConvert: IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is ushort tempValue)
{
if (tempValue == 0) return "本地原料";
if (tempValue == 1) return "设备原料";

}
return "未知";
}

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

+ 29
- 0
BPASmartClient.JXJFoodBigStation/Converter/RunStatusConvert.cs View File

@@ -0,0 +1,29 @@
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.JXJFoodBigStation.Converter
{
public class RunStatusConvert : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is ushort tempValue)
{
if (tempValue == 1) return "等待配料";
if (tempValue == 2) return "配料中";
if (tempValue == 3) return "配料完成";
}
return "等待配料";
}

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

+ 2
- 0
BPASmartClient.JXJFoodBigStation/Model/HK_PLC/HKPlcCommAddress.cs View File

@@ -97,5 +97,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC
/// </summary>
public static string StationIsExistTray { get; set; } = "M4007";
#endregion

public static string StationIsExistCar { get; set; }
}
}

+ 13
- 13
BPASmartClient.JXJFoodBigStation/Model/RawMaterial/RawMaterialModel.cs View File

@@ -12,29 +12,29 @@ namespace BPASmartClient.JXJFoodBigStation.Model
/// </summary>
public class RawMaterialModel : ObservableObject
{
/// <summary>
/// 原料名称
/// </summary>
public string RawMaterialName { get { return _mRawMaterialName; } set { _mRawMaterialName = value; OnPropertyChanged(); } }
private string _mRawMaterialName;
private int _mIp;
public int DeviceIp { get { return _mIp; } set { _mIp = value; } }

/// <summary>
/// 原料
/// 原料对应的桶号
/// </summary>
public int RawMateriaLocation { get { return _mRawMaterialLocation; } set { _mRawMaterialLocation = value; OnPropertyChanged(); } }
private int _mRawMaterialLocation;
public int RawMaterialBarrelNum { get { return _mRawMaterialBarrelNum; } set { _mRawMaterialBarrelNum = value; OnPropertyChanged(); } }
private int _mRawMaterialBarrelNum;

/// <summary>
/// 原料设备IP
/// 需要原料重量
/// </summary>
public string DeviceIp { get; set; }
public double RawMaterialWeight { get { return _mRawMaterialWeight; } set { _mRawMaterialWeight = value; OnPropertyChanged(); } }
private double _mRawMaterialWeight;

/// <summary>
/// 原料重量设置
/// 原料对应料仓的位置/名称
/// </summary>
public uint RawMaterialWeight { get { return _mRawMaterialWeight; } set { _mRawMaterialWeight = value; OnPropertyChanged(); } }
private uint _mRawMaterialWeight;
public int RawMaterialLocation { get { return _mRawMaterialLocation; } set { _mRawMaterialLocation = value; OnPropertyChanged(); } }
private int _mRawMaterialLocation;

/// <summary>
/// 原料类型 MW18
/// 1:液体


+ 9
- 3
BPASmartClient.JXJFoodBigStation/Model/RawMaterial/RecipeModel.cs View File

@@ -34,8 +34,14 @@ namespace BPASmartClient.JXJFoodBigStation.Model
/// <summary>
/// 配方编码
/// </summary>
public string RecipCode { get { return _mRecipCode; } set { _mRecipCode = value; OnPropertyChanged(); } }
private string _mRecipCode;
public long RecipeCode { get { return _mRecipCode; } set { _mRecipCode = value; OnPropertyChanged(); } }
private long _mRecipCode;

/// <summary>
/// 托盘编号
/// </summary>
public int TrayCode { get { return _mTrayCode; } set { _mTrayCode = value; OnPropertyChanged(); } }
private int _mTrayCode;

[Newtonsoft.Json.JsonIgnore]
public AutoResetEvent Are { get; set; } = new AutoResetEvent(false);
@@ -43,7 +49,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model
/// <summary>
/// 原料集合
/// </summary>
public ObservableCollection<RawMaterialModel> RawMaterials { get; set; } = new ObservableCollection<RawMaterialModel>();
public ObservableCollection<RawMaterialModel> RawMaterial { get; set; } = new ObservableCollection<RawMaterialModel>();

}
}

+ 877
- 0
BPASmartClient.JXJFoodBigStation/View/RecipeSendDownView.xaml View File

@@ -0,0 +1,877 @@
<UserControl x:Class="BPASmartClient.JXJFoodBigStation.View.RecipeSendDownView"
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:con="clr-namespace:BPASmartClient.JXJFoodBigStation.Converter"
xmlns:local="clr-namespace:BPASmartClient.JXJFoodBigStation.View"
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource"
xmlns:vm="clr-namespace:BPASmartClient.JXJFoodBigStation.ViewModel"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.DataContext>
<vm:RecipeSendDownViewModel/>
</UserControl.DataContext>
<UserControl.Resources>
<con:EnbleConvert x:Key="EnbleConvert"/>
<con:IntToSourceConvert x:Key="IntToSourceConvert"/>
<con:RunStatusConvert x:Key="RunStatusConvert"/>
<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>
<!--<Border
x:Name="back_border"
BorderBrush="Black"
BorderThickness="0"
CornerRadius="1">
<Border.Effect>
<BlurEffect KernelType="Gaussian" Radius="2" />
</Border.Effect>
</Border>
<Border
x:Name="fore_border"
Margin="2"
BorderBrush="White"
BorderThickness="0"
CornerRadius="{Binding ElementName=button, Path=CornerRadius}"
Opacity="0.7">
<Border.Effect>
<BlurEffect KernelType="Gaussian" Radius="2" />
</Border.Effect>
</Border>-->


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

<!--#region 下拉列表样式-->
<Style x:Key="ToggleButtonStyle" TargetType="{x:Type ToggleButton}">
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
<!--<Setter Property="Height" Value="10" />-->
<Setter Property="HorizontalContentAlignment" Value="Left" />
<Setter Property="VerticalContentAlignment" Value="Top" />
<Setter Property="Padding" Value="10,10" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ToggleButton}">
<Grid>
<Border
x:Name="border2"
Width="auto"
Margin="{TemplateBinding Padding}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Background="{TemplateBinding Background}">
<ContentPresenter
Margin="{TemplateBinding Padding}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
RecognizesAccessKey="True"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Border>
</Grid>

<ControlTemplate.Triggers>
<!--<Trigger Property="IsPressed" Value="true">
<Setter Property="Background" Value="#FFd2e7f4" />
</Trigger>
<Trigger Property="IsChecked" Value="true">
<Setter TargetName="border2" Property="Background" Value="#191E36" />
</Trigger>
<Trigger Property="IsChecked" Value="false">
<Setter TargetName="border2" Property="Background" Value="#191E36" />
</Trigger>-->
<!--<Trigger Property="IsEnabled" Value="false">
<Setter Property="Foreground" Value="White" />
</Trigger>-->
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="border2" Property="Background" Value="#191E36" />
</Trigger>
<Trigger Property="IsMouseOver" Value="False">
<Setter TargetName="border2" Property="Background" Value="Transparent" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

<Style x:Key="ExpanderStyle" TargetType="{x:Type Expander}">
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="VerticalContentAlignment" Value="Stretch" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="BorderThickness" Value="1" />

<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Expander}">
<DockPanel>
<ToggleButton
x:Name="HeaderSite"
Height="20"
Width="auto"
MinWidth="0"
MinHeight="0"
Margin="1"
Padding="{TemplateBinding Padding}"
Background="Transparent"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
Content="{TemplateBinding Header}"
ContentTemplate="{TemplateBinding HeaderTemplate}"
ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}"
DockPanel.Dock="Top"
FontFamily="{TemplateBinding FontFamily}"
FontSize="{TemplateBinding FontSize}"
FontStretch="{TemplateBinding FontStretch}"
FontStyle="{TemplateBinding FontStyle}"
FontWeight="{TemplateBinding FontWeight}"
Foreground="{TemplateBinding Foreground}"
IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
Style="{StaticResource ToggleButtonStyle}" />
<ContentPresenter
x:Name="ExpandSite"
Margin="{TemplateBinding Padding}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
DockPanel.Dock="Left"
Focusable="false"
Visibility="Visible" />
</DockPanel>
<ControlTemplate.Triggers>
<Trigger Property="IsExpanded" Value="True">
<Setter TargetName="ExpandSite" Property="Visibility" Value="Collapsed" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--#endregion-->
</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">
<ItemsControl ItemsSource="{Binding RawMaterial}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Expander Style="{StaticResource ExpanderStyle}" Margin="40,0,0,0">
<Expander.Header>
<StackPanel Orientation="Horizontal">
<Border Width="15" Height="15" CornerRadius="15" HorizontalAlignment="Left" Margin="0,0,5,0">
<Border.Background>
<RadialGradientBrush>
<GradientStop Color="#FF2AB2E7" Offset="0.5" />
<GradientStop Color="White"/>
</RadialGradientBrush>
</Border.Background>
</Border>
<TextBlock Text="{Binding RawMaterialLocation }" Foreground="#FF2AB2E7" VerticalAlignment="Center"/>
</StackPanel>
</Expander.Header>
<Expander.Content>
<StackPanel Margin="36,0,0,0">
<StackPanel Orientation="Horizontal">
<TextBlock Text="托盘编号:" Foreground="#FF2AB2E7"/>
<TextBlock Text="{Binding RawMaterialBarrelNum}" Foreground="#FF2AB2E7"/>
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Text="原料重量:" Foreground="#FF2AB2E7"/>
<TextBlock Text="{Binding RawMaterialWeight}" Foreground="#FF2AB2E7"/>
</StackPanel>
</StackPanel>

</Expander.Content>
</Expander>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>


</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
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="&#xe6cf;"
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="&#xe68e;"
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="&#xe636;"
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="&#xe6cf;"
IsEnabled="{Binding IsEnable}"
Style="{StaticResource IcoButtonStyle}" />


</Grid>

</Grid>-->
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>

</Grid>

<Grid
Name="gr"
Grid.Column="1"
Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="50" />
<RowDefinition />
</Grid.RowDefinitions>

<pry:ImageBorder
Grid.RowSpan="2"
Width="{Binding ElementName=gr, Path=ActualWidth}"
Height="{Binding ElementName=gr, Path=ActualHeight}" />

<Grid Margin="5">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<RadioButton
Click="RadioButtonWait_Click"
Command="{Binding ChangeRecipeStateCommand}"
Content="等待中"
GroupName="state"
IsChecked="True"
Style="{DynamicResource RadioState}" />
<RadioButton
Grid.Column="1"
Click="RadioButtonMaking_Click"
Content="执行中"
GroupName="state"
Style="{DynamicResource RadioState}" />
<RadioButton
Grid.Column="2"
Click="RadioButtonCompelete_Click"
Content="已完成"
GroupName="state"
Style="{DynamicResource RadioState}" />

</Grid>


<ScrollViewer
Grid.Row="1"
HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Hidden">
<Border>
<Grid Grid.Row="1">
<Grid x:Name="repiceListMaking" Margin="5">
<Grid.RowDefinitions>
<RowDefinition Height="30" />
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock
Margin="10,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="18"
Foreground="#FF2AB2E7"
Text="{Binding CurrentRecipeName}" />
<ItemsControl
Grid.Row="1"
Margin="50,0"
ItemsSource="{Binding recipeProcesses}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid Margin="5">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="16" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock
Margin="10,0,5,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="15"
Foreground="#AA2AB2E7"
Text="{Binding RawMaterialName}"
ToolTip="{Binding RawMaterialSource, Converter={StaticResource IntToSourceConvert}}" />
<TextBlock
Grid.Column="1"
Margin="0,0,5,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="15"
Foreground="#AA2AB2E7"
Text=":" />
<Button
Grid.Column="2"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Command="{Binding DataContext.ChangeRecipeStateCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}"
CommandParameter="{Binding RawMaterialId}"
Content="{Binding RecipeStatus, Converter={StaticResource RunStatusConvert}}"
IsEnabled="{Binding RawMaterialSource, Converter={StaticResource EnbleConvert}}"
Style="{StaticResource materialMakingButton}" />
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>

</ItemsControl>

</Grid>
<!--<TreeView x:Name="repiceListMaking" ItemsSource="{Binding RecipeProcesse}"
ScrollViewer.VerticalScrollBarVisibility="Disabled" HorizontalAlignment="Stretch" Background="Wheat" ItemContainerStyle="{StaticResource recipeTreeItem}">
</TreeView>-->

<!-- 等待和已完成 -->

<TreeView
x:Name="repiceList"
HorizontalAlignment="Stretch"
Background="Transparent"
BorderThickness="0"
ItemContainerStyle="{StaticResource recipeTreeItem}"
ItemsSource="{Binding UserTreeWait}"
ScrollViewer.VerticalScrollBarVisibility="Visible" />




</Grid>
</Border>
</ScrollViewer>
</Grid>

</Grid>
</UserControl>

+ 54
- 0
BPASmartClient.JXJFoodBigStation/View/RecipeSendDownView.xaml.cs View File

@@ -0,0 +1,54 @@
using BPASmartClient.JXJFoodBigStation.ViewModel;
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.JXJFoodBigStation.View
{
/// <summary>
/// RecipeSendDownView.xaml 的交互逻辑
/// </summary>
public partial class RecipeSendDownView : UserControl
{
public RecipeSendDownView()
{
InitializeComponent();
}

private void RadioButtonCompelete_Click(object sender, RoutedEventArgs e)
{
repiceList.ItemsSource = RecipeSendDownViewModel.UserTreeCompelete;
repiceList.Visibility = Visibility.Visible;
repiceListMaking.Visibility = Visibility.Hidden;


}

private void RadioButtonWait_Click(object sender, RoutedEventArgs e)
{
repiceList.ItemsSource = RecipeSendDownViewModel.UserTreeWait;
repiceList.Visibility = Visibility.Visible;
repiceListMaking.Visibility = Visibility.Hidden;
}

private void RadioButtonMaking_Click(object sender, RoutedEventArgs e)
{
repiceListMaking.Visibility = Visibility.Visible;
repiceList.Visibility = Visibility.Hidden;

}
}

}

+ 14
- 14
BPASmartClient.JXJFoodBigStation/ViewModel/RecipeInfosViewModel.cs View File

@@ -20,7 +20,7 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel
{
ActionManage.GetInstance.Register(new Action<object>((o) =>
{
if (o != null && o is RemoteRecipeData rm)
if (o != null && o is RecipeModel rm)
{
RecipeName = rm.RecipeName;
RecipeCode = rm.RecipeCode;
@@ -36,23 +36,23 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel
}), "RecipeInfo");

AddRecipe = new RelayCommand(() => {
RawMaterialsInfo.Add(new RemoteRecipeRawMaterial());
RawMaterialsInfo.Add(new RawMaterialModel());
});
Comfirm = new RelayCommand(() =>
{
var bom= Json<RemoteRecipeDataColl>.Data.Recipes.FirstOrDefault(p => p.RecipeCode == RecipeCode);
var bom= Json<LocaPar>.Data.Recipes.FirstOrDefault(p => p.RecipeCode == RecipeCode);
if (bom == null)//新配方
{
var name= Json<RemoteRecipeDataColl>.Data.Recipes.FirstOrDefault(p => p.RecipeName == RecipeName);
var name= Json<LocaPar>.Data.Recipes.FirstOrDefault(p => p.RecipeName == RecipeName);
if (name == null)
{
go:
long recipeCode = new Random().Next(10000, 99999);
var res = Json<RemoteRecipeDataColl>.Data.Recipes.FirstOrDefault(p => p.RecipeCode == recipeCode);
var res = Json<LocaPar>.Data.Recipes.FirstOrDefault(p => p.RecipeCode == recipeCode);
if (res == null)
{
Json<RemoteRecipeDataColl>.Data.Recipes.Add(new RemoteRecipeData { RecipeCode = recipeCode, RawMaterial= RawMaterialsInfo,RecipeName=RecipeName,TrayCode=TrayCode});
Json<RemoteRecipeDataColl>.Save();
Json<LocaPar>.Data.Recipes.Add(new RecipeModel { RecipeCode = recipeCode, RawMaterial= RawMaterialsInfo,RecipeName=RecipeName,TrayCode=TrayCode});
Json<LocaPar>.Save();
}
else
{
@@ -76,24 +76,24 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel
bom.RawMaterial.Add(item);
}
bom.RecipeName = RecipeName;
Json<RemoteRecipeDataColl>.Save();
Json<LocaPar>.Save();
ActionManage.GetInstance.Send("CloseRecipeInfosView");
}
});

SaveAs = new RelayCommand(() => {

var bom = Json<RemoteRecipeDataColl>.Data.Recipes.FirstOrDefault(p => p.RecipeName == RecipeName);
var rec = Json<RemoteRecipeDataColl>.Data.Recipes.FirstOrDefault(p => p.RecipeCode == RecipeCode);
var bom = Json<LocaPar>.Data.Recipes.FirstOrDefault(p => p.RecipeName == RecipeName);
var rec = Json<LocaPar>.Data.Recipes.FirstOrDefault(p => p.RecipeCode == RecipeCode);
if (bom == null && rec != null)//配方名称更改
{
prop: long recipeCode = new Random().Next(10000, 99999);//配方唯一ID,后期根据实际要求更改
var res = Json<RemoteRecipeDataColl>.Data.Recipes.FirstOrDefault(p => p.RecipeCode == recipeCode);
var res = Json<LocaPar>.Data.Recipes.FirstOrDefault(p => p.RecipeCode == recipeCode);
if (res == null)
{
Json<RemoteRecipeDataColl>.Data.Recipes.Add(new RemoteRecipeData { RecipeCode = recipeCode, RawMaterial = RawMaterialsInfo, RecipeName = RecipeName, TrayCode = TrayCode });//配方添加
Json<RemoteRecipeDataColl>.Save();
Json<LocaPar>.Data.Recipes.Add(new RecipeModel { RecipeCode = recipeCode, RawMaterial = RawMaterialsInfo, RecipeName = RecipeName, TrayCode = TrayCode });//配方添加
Json<LocaPar>.Save();
}
else
{
@@ -139,6 +139,6 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel

public RelayCommand<int> RemoveRecipe { get; set; }

public ObservableCollection<RemoteRecipeRawMaterial> RawMaterialsInfo { get; set; } = new ObservableCollection<RemoteRecipeRawMaterial>() ;
public ObservableCollection<RawMaterialModel> RawMaterialsInfo { get; set; } = new ObservableCollection<RawMaterialModel>() ;
}
}

+ 15
- 11
BPASmartClient.JXJFoodBigStation/ViewModel/RecipeReceiveViewModel.cs View File

@@ -23,18 +23,18 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel
{
public class RecipeReceiveViewModel : ObservableObject
{
public ObservableCollection<RemoteRecipeRawMaterial> RawMaterials { get; set; } = new ObservableCollection<RemoteRecipeRawMaterial>();
public ObservableCollection<RawMaterialModel> RawMaterials { get; set; } = new ObservableCollection<RawMaterialModel>();
public RecipeReceiveViewModel()
{
Json<RemoteRecipeDataColl>.Read();
Recipes = Json<RemoteRecipeDataColl>.Data.Recipes;
Json<LocaPar>.Read();
Recipes = Json<LocaPar>.Data.Recipes;
DetailsCommand = new RelayCommand<object>((o) =>
{
if (o != null && o is long num)
{
ActionManage.GetInstance.CancelRegister("RecipeInfo");
RecipeInfosView nrv = new RecipeInfosView();
var res = Json<RemoteRecipeDataColl>.Data.Recipes.FirstOrDefault(p => p.RecipeCode == num);
var res = Json<LocaPar>.Data.Recipes.FirstOrDefault(p => p.RecipeCode == num);
ActionManage.GetInstance.Send("RecipeInfo", res);
nrv.Show();
MessageLog.GetInstance.ShowUserLog($"查看配方——{res.RecipeName}");
@@ -49,7 +49,7 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel
NewSimulateRecipe = new RelayCommand(() =>
{
RawMaterials.Clear();
string recipeName = "配方" + (Json<RemoteRecipeDataColl>.Data.Recipes.Count + 1) + "";
string recipeName = "配方" + (Json<LocaPar>.Data.Recipes.Count + 1) + "";
go:
long recipeCode = new Random().Next(10000, 99999);
foreach (var item in Recipes)
@@ -67,14 +67,14 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel
{
a = 1;
}
RawMaterials.Add(new RemoteRecipeRawMaterial()
RawMaterials.Add(new RawMaterialModel()
{
RawMaterialWeight = new Random().Next(10, 1000),
RawMaterialBarrelNum = a,
RawMaterialLocation = i,
});
}
Json<RemoteRecipeDataColl>.Data.Recipes.Add(new RemoteRecipeData()
Json<LocaPar>.Data.Recipes.Add(new RecipeModel()
{
RecipeName = recipeName,
RecipeCode = recipeCode,
@@ -85,15 +85,19 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel
});
ClearAllRecipe = new RelayCommand(() =>
{
Json<RemoteRecipeDataColl>.Data.Recipes.Clear();
Json<RemoteRecipeDataColl>.Save();
Json<LocaPar>.Data.Recipes.Clear();
Json<LocaPar>.Save();
});

RemoveCommand = new RelayCommand<long>((recipeCode) => {

var res = Recipes.FirstOrDefault(p=>p.RecipeCode==recipeCode);
if(res!=null)
Recipes.Remove(res);
{
Recipes.Remove(res);
Json<LocaPar>.Save();
}
});
}

@@ -106,6 +110,6 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel

public RelayCommand<long> RemoveCommand { get; set; }

public ObservableCollection<RemoteRecipeData> Recipes { get; set; } = new ObservableCollection<RemoteRecipeData>();
public ObservableCollection<RecipeModel> Recipes { get; set; } = new ObservableCollection<RecipeModel>();
}
}

+ 50
- 0
BPASmartClient.JXJFoodBigStation/ViewModel/RecipeSendDownViewModel.cs View File

@@ -0,0 +1,50 @@
using BPASmartClient.Helper;
using BPASmartClient.JXJFoodBigStation.Model;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.JXJFoodBigStation.ViewModel
{
internal class RecipeSendDownViewModel:ObservableObject
{

public static ObservableCollection<RecipeModel> Recipes { get; set; } = Json<LocaPar>.Data.Recipes;
/// <summary>
/// 当前正在制作的配方
/// </summary>

public static ObservableCollection<RawMaterialModel> recipeProcesses { get; set; } = new ObservableCollection<RawMaterialModel>();
/// <summary>
/// 等待制作的配方
/// </summary>
public static ObservableCollection<RecipeModel> UserTreeWait { get; set; } = new ObservableCollection<RecipeModel>();
/// <summary>
/// 已完成的配方
/// </summary>
public static ObservableCollection<RecipeModel> UserTreeCompelete { get; set; } = new ObservableCollection<RecipeModel>();

public RelayCommand<string> StartCommand { get; set; }

public RecipeSendDownViewModel()
{
StartCommand = new RelayCommand<string>((recipeName) => {
if (recipeName != null)
{
//配方下发逻辑
var res= Recipes.FirstOrDefault(p=>p.RecipeName==recipeName);
if (res != null)
{
}
}
});
}
}
}

Loading…
Cancel
Save