@@ -17,7 +17,6 @@ | |||||
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/BeveledRadioButtonStyle.xaml" /> | <ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/BeveledRadioButtonStyle.xaml" /> | ||||
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/DatePickeerDictionary.xaml" /> | <ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/DatePickeerDictionary.xaml" /> | ||||
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/RecButtonStyle.xaml" /> | <ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/RecButtonStyle.xaml" /> | ||||
<ResourceDictionary> | <ResourceDictionary> | ||||
<con:ColorConverter x:Key="ColorConverter" /> | <con:ColorConverter x:Key="ColorConverter" /> | ||||
<con:TextConverter x:Key="TextConverter" /> | <con:TextConverter x:Key="TextConverter" /> | ||||
@@ -39,16 +38,16 @@ | |||||
<ControlTemplate TargetType="{x:Type GroupItem}"> | <ControlTemplate TargetType="{x:Type GroupItem}"> | ||||
<Expander ExpandDirection="Down" IsExpanded="True"> | <Expander ExpandDirection="Down" IsExpanded="True"> | ||||
<Expander.Header> | <Expander.Header> | ||||
<StackPanel Orientation="Horizontal" Margin="5,10"> | |||||
<StackPanel Margin="5,10" Orientation="Horizontal"> | |||||
<TextBlock | <TextBlock | ||||
VerticalAlignment="Center" | VerticalAlignment="Center" | ||||
FontSize="16" | |||||
FontSize="14" | |||||
Foreground="White" | Foreground="White" | ||||
Text="{Binding Path=Name}" /> | Text="{Binding Path=Name}" /> | ||||
<TextBlock | <TextBlock | ||||
Margin="5,0,0,0" | Margin="5,0,0,0" | ||||
VerticalAlignment="Center" | VerticalAlignment="Center" | ||||
FontSize="16" | |||||
FontSize="14" | |||||
Foreground="White" | Foreground="White" | ||||
Text="{Binding Path=ItemCount, StringFormat=数量:{0}个}" /> | Text="{Binding Path=ItemCount, StringFormat=数量:{0}个}" /> | ||||
</StackPanel> | </StackPanel> | ||||
@@ -59,6 +58,8 @@ | |||||
</Setter.Value> | </Setter.Value> | ||||
</Setter> | </Setter> | ||||
</Style> | </Style> | ||||
</ResourceDictionary> | </ResourceDictionary> | ||||
</Application.Resources> | </Application.Resources> | ||||
</Application> | </Application> |
@@ -1065,6 +1065,11 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
{ | { | ||||
GVL_BigStation.Order_CancelStep = 20; | GVL_BigStation.Order_CancelStep = 20; | ||||
} | } | ||||
//以下为新增,复位DB99托盘号,配方号,桶重量参数,以及配方下发确认和配料完成。 | |||||
StockBinParReset(); | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX0.3", false); | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX1.4", false); | |||||
GVL_BigStation.Recipe1DosingFinish = false; | |||||
} | } | ||||
break; | break; | ||||
case 10: | case 10: | ||||
@@ -1102,7 +1107,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
{ | { | ||||
Json<RemoteRecipe>.Data.Recipes.RemoveAt(index); | Json<RemoteRecipe>.Data.Recipes.RemoveAt(index); | ||||
}); | }); | ||||
MessageNotify.GetInstance.ShowRunLog($"正在执行请求订单流程,配方还未到PLC,订单号:{GVL_BigStation.Order_CancelRecipeCode}"); | |||||
MessageNotify.GetInstance.ShowRunLog($"正在执行请求取消订单流程,配方还未到PLC,订单号:{GVL_BigStation.Order_CancelRecipeCode}"); | |||||
GVL_BigStation.Order_Cancel = false; | GVL_BigStation.Order_Cancel = false; | ||||
GVL_BigStation.Order_CancelRecipeCode = ""; | GVL_BigStation.Order_CancelRecipeCode = ""; | ||||
GVL_BigStation.Order_CancelStep = 0; | GVL_BigStation.Order_CancelStep = 0; | ||||
@@ -11,5 +11,6 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
public class LocalRecipe | public class LocalRecipe | ||||
{ | { | ||||
public ObservableCollection<RecipeData> Recipes { get; set; } = new ObservableCollection<RecipeData>(); | public ObservableCollection<RecipeData> Recipes { get; set; } = new ObservableCollection<RecipeData>(); | ||||
public ObservableCollection<RecipeData> SelectedRecipes { get; set; } = new ObservableCollection<RecipeData>(); | |||||
} | } | ||||
} | } |
@@ -340,8 +340,8 @@ | |||||
FontSize="16" | FontSize="16" | ||||
Foreground="Orange" | Foreground="Orange" | ||||
IsReadOnly="False" | IsReadOnly="False" | ||||
Text="{Binding RecipeCategory}" | |||||
ItemsSource="{Binding Categorys}" /> | |||||
ItemsSource="{Binding Categorys}" | |||||
Text="{Binding RecipeCategory}" /> | |||||
</StackPanel> | </StackPanel> | ||||
<Grid> | <Grid> | ||||
<Grid.RowDefinitions> | <Grid.RowDefinitions> | ||||
@@ -210,8 +210,9 @@ | |||||
IsEnabled="True" | IsEnabled="True" | ||||
Style="{StaticResource IcoButtonStyle}" /> | Style="{StaticResource IcoButtonStyle}" /> | ||||
</StackPanel> | </StackPanel> | ||||
<ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Hidden"> | |||||
<ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Disabled"> | |||||
<ListBox | <ListBox | ||||
x:Name="recipeBox" | |||||
Grid.Row="2" | Grid.Row="2" | ||||
Margin="5" | Margin="5" | ||||
VerticalAlignment="Top" | VerticalAlignment="Top" | ||||
@@ -228,6 +229,14 @@ | |||||
</ItemsPanelTemplate> | </ItemsPanelTemplate> | ||||
</ListBox.ItemsPanel> | </ListBox.ItemsPanel> | ||||
<ListBox.GroupStyle> | |||||
<GroupStyle> | |||||
<GroupStyle.ContainerStyle> | |||||
<Style BasedOn="{StaticResource ListBoxGroupStyle}" TargetType="{x:Type GroupItem}" /> | |||||
</GroupStyle.ContainerStyle> | |||||
</GroupStyle> | |||||
</ListBox.GroupStyle> | |||||
<ListBox.ItemTemplate> | <ListBox.ItemTemplate> | ||||
<DataTemplate> | <DataTemplate> | ||||
@@ -284,16 +293,17 @@ | |||||
FontSize="12" | FontSize="12" | ||||
Foreground="#FF2AB2E7" | Foreground="#FF2AB2E7" | ||||
Text="{Binding RecipeName}" /> | Text="{Binding RecipeName}" /> | ||||
<TextBlock | <TextBlock | ||||
Grid.Row="2" | |||||
Grid.Row="5" | |||||
Grid.Column="0" | Grid.Column="0" | ||||
Margin="2,5,0,0" | Margin="2,5,0,0" | ||||
HorizontalAlignment="Center" | HorizontalAlignment="Center" | ||||
VerticalAlignment="Center" | VerticalAlignment="Center" | ||||
FontSize="12" | FontSize="12" | ||||
Foreground="#FF2AB2E7" | Foreground="#FF2AB2E7" | ||||
Text="配方编号:" /> | |||||
Text="配方类别:" /> | |||||
<TextBlock | <TextBlock | ||||
Grid.Row="2" | Grid.Row="2" | ||||
@@ -391,6 +401,24 @@ | |||||
</ItemsControl.ItemTemplate> | </ItemsControl.ItemTemplate> | ||||
</ItemsControl> | </ItemsControl> | ||||
</ScrollViewer>--> | </ScrollViewer>--> | ||||
<TextBlock | |||||
Grid.Row="5" | |||||
Grid.Column="1" | |||||
Margin="2,5,0,0" | |||||
HorizontalAlignment="Center" | |||||
VerticalAlignment="Center" | |||||
FontSize="12" | |||||
Foreground="#FF2AB2E7" | |||||
Text="{Binding RecipeCategory}" /> | |||||
<TextBlock | |||||
Grid.Row="2" | |||||
Grid.Column="0" | |||||
Margin="2,5,0,0" | |||||
HorizontalAlignment="Center" | |||||
VerticalAlignment="Center" | |||||
FontSize="12" | |||||
Foreground="#FF2AB2E7" | |||||
Text="配方编号:" /> | |||||
<Image | <Image | ||||
Grid.Row="6" | Grid.Row="6" | ||||
@@ -1,6 +1,7 @@ | |||||
using BPASmartClient.JXJFoodBigStation.Model; | using BPASmartClient.JXJFoodBigStation.Model; | ||||
using System; | using System; | ||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.ComponentModel; | |||||
using System.Linq; | using System.Linq; | ||||
using System.Reflection; | using System.Reflection; | ||||
using System.Text; | using System.Text; | ||||
@@ -26,6 +27,10 @@ namespace BPASmartClient.JXJFoodBigStation.View | |||||
{ | { | ||||
InitializeComponent(); | InitializeComponent(); | ||||
this.IsUseLocalRecipe.Click += (o, e) => { GVL_BigStation.IsUseLocalRecipe = (bool)IsUseLocalRecipe.IsChecked; }; | this.IsUseLocalRecipe.Click += (o, e) => { GVL_BigStation.IsUseLocalRecipe = (bool)IsUseLocalRecipe.IsChecked; }; | ||||
ICollectionView cv = CollectionViewSource.GetDefaultView(recipeBox.ItemsSource); | |||||
cv.GroupDescriptions.Add(new PropertyGroupDescription("RecipeCategory")); | |||||
} | } | ||||
} | } | ||||
} | } |
@@ -417,20 +417,29 @@ | |||||
</Style> | </Style> | ||||
<!--#endregion--> | <!--#endregion--> | ||||
</UserControl.Resources> | </UserControl.Resources> | ||||
<Grid Margin="20"> | <Grid Margin="20"> | ||||
<Grid.ColumnDefinitions> | <Grid.ColumnDefinitions> | ||||
<ColumnDefinition /> | <ColumnDefinition /> | ||||
</Grid.ColumnDefinitions> | </Grid.ColumnDefinitions> | ||||
<Grid Name="ggr" Margin="10"> | |||||
<Grid.RowDefinitions> | |||||
<RowDefinition Height="40" /> | |||||
<RowDefinition Height="1*" /> | |||||
</Grid.RowDefinitions> | |||||
<Button Content="筛选配方" Style="{StaticResource ButtonStyle}" Command="{Binding SelectRecipesCommand}" /> | |||||
<Grid | |||||
Name="ggr" | |||||
Grid.Row="1" | |||||
Margin="10"> | |||||
<pry:ImageBorder Width="{Binding ElementName=ggr, Path=ActualWidth}" Height="{Binding ElementName=ggr, Path=ActualHeight}" /> | <pry:ImageBorder Width="{Binding ElementName=ggr, Path=ActualWidth}" Height="{Binding ElementName=ggr, Path=ActualHeight}" /> | ||||
<ListBox | <ListBox | ||||
Margin="5" | Margin="5" | ||||
VerticalAlignment="Top" | VerticalAlignment="Top" | ||||
Background="Transparent" | Background="Transparent" | ||||
BorderThickness="0" | BorderThickness="0" | ||||
ItemsSource="{Binding Recipes}" | |||||
ItemsSource="{Binding SelectedRecipes}" | |||||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"> | ScrollViewer.HorizontalScrollBarVisibility="Disabled"> | ||||
<ListBox.ItemsPanel> | <ListBox.ItemsPanel> | ||||
<ItemsPanelTemplate> | <ItemsPanelTemplate> | ||||
@@ -0,0 +1,222 @@ | |||||
<Window | |||||
x:Class="BPASmartClient.JXJFoodBigStation.View.SelectRecipesView" | |||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||||
xmlns:Converter="clr-namespace:BPASmartClient.JXJFoodBigStation.Converter" | |||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||||
xmlns:local="clr-namespace:BPASmartClient.JXJFoodBigStation.View" | |||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||||
xmlns:vm="clr-namespace:BPASmartClient.JXJFoodBigStation.ViewModel" | |||||
Title="SelectRecipesView" | |||||
Width="1000" | |||||
Height="620" | |||||
AllowsTransparency="True" | |||||
Background="{x:Null}" | |||||
Topmost="True" | |||||
WindowStartupLocation="CenterScreen" | |||||
WindowStyle="None" | |||||
mc:Ignorable="d"> | |||||
<Window.DataContext> | |||||
<vm:SelectRecipesViewModel /> | |||||
</Window.DataContext> | |||||
<Window.Resources> | |||||
<ResourceDictionary> | |||||
<ResourceDictionary.MergedDictionaries> | |||||
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml" /> | |||||
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml" /> | |||||
</ResourceDictionary.MergedDictionaries> | |||||
<!--修改了勾选的大小--> | |||||
<Style x:Key="CheckBoxLarge" TargetType="{x:Type CheckBox}"> | |||||
<Setter Property="Foreground" Value="{DynamicResource foreground}" /> | |||||
<Setter Property="VerticalContentAlignment" Value="Center" /> | |||||
<Setter Property="FocusVisualStyle"> | |||||
<Setter.Value> | |||||
<Style> | |||||
<Setter Property="Control.Template"> | |||||
<Setter.Value> | |||||
<ControlTemplate> | |||||
<Rectangle | |||||
Margin="1" | |||||
SnapsToDevicePixels="True" | |||||
Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" | |||||
StrokeDashArray="1 2" | |||||
StrokeThickness="1" /> | |||||
</ControlTemplate> | |||||
</Setter.Value> | |||||
</Setter> | |||||
</Style> | |||||
</Setter.Value> | |||||
</Setter> | |||||
<Setter Property="Template"> | |||||
<Setter.Value> | |||||
<ControlTemplate TargetType="{x:Type CheckBox}"> | |||||
<StackPanel | |||||
Background="Transparent" | |||||
Orientation="Horizontal" | |||||
SnapsToDevicePixels="True"> | |||||
<Grid> | |||||
<Image | |||||
Width="24" | |||||
Height="28" | |||||
Source="/BPASmartClient.CustomResource;component/Image/Cb_HalfChecked.png" /> | |||||
<Image | |||||
x:Name="image1" | |||||
Width="24" | |||||
Height="28" | |||||
Source="/BPASmartClient.CustomResource;component/Image/Cb_HalfChecked.png" /> | |||||
</Grid> | |||||
<ContentPresenter | |||||
Margin="{TemplateBinding Padding}" | |||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" | |||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" | |||||
Content="{TemplateBinding Content}" | |||||
ContentStringFormat="{TemplateBinding ContentStringFormat}" | |||||
RecognizesAccessKey="True" | |||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" /> | |||||
</StackPanel> | |||||
<ControlTemplate.Triggers> | |||||
<Trigger Property="HasContent" Value="True"> | |||||
<Setter Property="FocusVisualStyle"> | |||||
<Setter.Value> | |||||
<Style> | |||||
<Setter Property="Control.Template"> | |||||
<Setter.Value> | |||||
<ControlTemplate> | |||||
<Rectangle | |||||
Margin="14,0,0,0" | |||||
SnapsToDevicePixels="True" | |||||
Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" | |||||
StrokeDashArray="1 2" | |||||
StrokeThickness="1" /> | |||||
</ControlTemplate> | |||||
</Setter.Value> | |||||
</Setter> | |||||
</Style> | |||||
</Setter.Value> | |||||
</Setter> | |||||
<Setter Property="Padding" Value="4,0,0,0" /> | |||||
</Trigger> | |||||
<Trigger Property="IsEnabled" Value="False"> | |||||
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" /> | |||||
</Trigger> | |||||
<Trigger Property="IsChecked" Value="true"> | |||||
<Setter TargetName="image1" Property="Source" Value="/BPASmartClient.CustomResource;component/Image/Cb_Checked.png" /> | |||||
</Trigger> | |||||
<Trigger Property="IsChecked" Value="{x:Null}"> | |||||
<Setter TargetName="image1" Property="Source" Value="/BPASmartClient.CustomResource;component/Image/Cb_HalfChecked.png" /> | |||||
</Trigger> | |||||
</ControlTemplate.Triggers> | |||||
</ControlTemplate> | |||||
</Setter.Value> | |||||
</Setter> | |||||
</Style> | |||||
</ResourceDictionary> | |||||
</Window.Resources> | |||||
<Border | |||||
Name="br" | |||||
BorderBrush="#0CADF5" | |||||
BorderThickness="2"> | |||||
<Border.Background> | |||||
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/bg.png" /> | |||||
</Border.Background> | |||||
<Grid> | |||||
<Grid.RowDefinitions> | |||||
<RowDefinition Height="40" /> | |||||
<RowDefinition Height="40" /> | |||||
<RowDefinition Height="1*" /> | |||||
</Grid.RowDefinitions> | |||||
<TextBlock | |||||
HorizontalAlignment="Center" | |||||
FontSize="35" | |||||
Text="配方筛选界面" /> | |||||
<StackPanel | |||||
Grid.Row="1" | |||||
Margin="10,0" | |||||
HorizontalAlignment="Right" | |||||
Orientation="Horizontal"> | |||||
<Button | |||||
Width="100" | |||||
Margin="20,0" | |||||
Command="{Binding AllSelectCommand}" | |||||
Content="全选" /> | |||||
<Button | |||||
Width="100" | |||||
Margin="20,0" | |||||
Command="{Binding AllCancelCommand}" | |||||
Content="取消全选" /> | |||||
<Button | |||||
Width="100" | |||||
Margin="20,0" | |||||
Command="{Binding ConfirmCommand}" | |||||
Content="确认选择" /> | |||||
<Button | |||||
Width="100" | |||||
Margin="20,0" | |||||
Command="{Binding CancelCommand}" | |||||
Content="退出" /> | |||||
</StackPanel> | |||||
<Border | |||||
Grid.Row="2" | |||||
BorderBrush="#FFA2C2E8" | |||||
BorderThickness="1"> | |||||
<!-- 视图显示 --> | |||||
<ListBox | |||||
Margin="5" | |||||
Background="Transparent" | |||||
ItemsSource="{Binding AllRecipes}" | |||||
ScrollViewer.VerticalScrollBarVisibility="Visible"> | |||||
<ListBox.GroupStyle> | |||||
<GroupStyle> | |||||
<GroupStyle.ContainerStyle> | |||||
<Style BasedOn="{StaticResource ListBoxGroupStyle}" TargetType="{x:Type GroupItem}" /> | |||||
</GroupStyle.ContainerStyle> | |||||
</GroupStyle> | |||||
</ListBox.GroupStyle> | |||||
<ListBox.ItemTemplate> | |||||
<DataTemplate> | |||||
<StackPanel Orientation="Vertical"> | |||||
<StackPanel Orientation="Horizontal"> | |||||
<!--<CheckBox Margin="5" Command="{Binding DataContext.CheckCommand, RelativeSource={RelativeSource AncestorType=ListBox, Mode=FindAncestor}}" IsChecked="{Binding IsSelected}"> | |||||
<CheckBox.CommandParameter> | |||||
<MultiBinding Converter="{StaticResource CheckRecipeConverter}"> | |||||
<Binding Path="IsChecked" RelativeSource="{RelativeSource Self}" /> | |||||
<Binding Path="RecipeCode" /> | |||||
</MultiBinding> | |||||
</CheckBox.CommandParameter> | |||||
</CheckBox>--> | |||||
<CheckBox | |||||
Margin="5" | |||||
IsChecked="{Binding IsSelected, Mode=TwoWay}" Style="{StaticResource CheckBoxLarge}"/> | |||||
<TextBlock | |||||
Margin="10" | |||||
VerticalAlignment="Center" | |||||
FontSize="16" | |||||
Text="{Binding Recipe.RecipeCode, StringFormat=配方编号:{0}}" /> | |||||
<TextBlock | |||||
Margin="10,0" | |||||
VerticalAlignment="Center" | |||||
FontSize="16" | |||||
Text="{Binding Recipe.RecipeName, StringFormat=配方名称:{0}}" /> | |||||
</StackPanel> | |||||
<Line | |||||
Stroke="#FFA2C2E8" | |||||
StrokeThickness="3" | |||||
X1="0" | |||||
X2="1000" | |||||
Y1="0" | |||||
Y2="0" /> | |||||
</StackPanel> | |||||
</DataTemplate> | |||||
</ListBox.ItemTemplate> | |||||
</ListBox> | |||||
</Border> | |||||
</Grid> | |||||
</Border> | |||||
</Window> |
@@ -0,0 +1,31 @@ | |||||
using BPASmartClient.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.Shapes; | |||||
namespace BPASmartClient.JXJFoodBigStation.View | |||||
{ | |||||
/// <summary> | |||||
/// SelectRecipesView.xaml 的交互逻辑 | |||||
/// </summary> | |||||
public partial class SelectRecipesView : Window | |||||
{ | |||||
public SelectRecipesView() | |||||
{ | |||||
InitializeComponent(); | |||||
this.br.MouseLeftButtonDown += (o, e) => { if (e.LeftButton == MouseButtonState.Pressed) this.DragMove(); }; | |||||
ActionManage.GetInstance.CancelRegister("CloseSelectRecipesView"); | |||||
ActionManage.GetInstance.Register(new Action(() => { this.Close(); }), "CloseSelectRecipesView"); | |||||
} | |||||
} | |||||
} |
@@ -4,6 +4,7 @@ using BPASmartClient.CustomResource.UserControls.MessageShow; | |||||
using BPASmartClient.Helper; | using BPASmartClient.Helper; | ||||
using BPASmartClient.JXJFoodBigStation.Model; | using BPASmartClient.JXJFoodBigStation.Model; | ||||
using BPASmartClient.JXJFoodBigStation.Model.Siemens; | using BPASmartClient.JXJFoodBigStation.Model.Siemens; | ||||
using BPASmartClient.JXJFoodBigStation.View; | |||||
using Microsoft.Toolkit.Mvvm.ComponentModel; | using Microsoft.Toolkit.Mvvm.ComponentModel; | ||||
using Microsoft.Toolkit.Mvvm.Input; | using Microsoft.Toolkit.Mvvm.Input; | ||||
using System; | using System; | ||||
@@ -31,7 +32,16 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel | |||||
/// </summary> | /// </summary> | ||||
public static ObservableCollection<RecipeData> UserTreeCompelete { get; set; } = new ObservableCollection<RecipeData>(); | public static ObservableCollection<RecipeData> UserTreeCompelete { get; set; } = new ObservableCollection<RecipeData>(); | ||||
/// <summary> | |||||
/// 筛选后的配方列表。 | |||||
/// </summary> | |||||
public static ObservableCollection<RecipeData> SelectedRecipes { get; set; } = Json<LocalRecipe>.Data.SelectedRecipes; | |||||
public RelayCommand<string> StartCommand { get; set; } | public RelayCommand<string> StartCommand { get; set; } | ||||
public RelayCommand SelectRecipesCommand { get; set; } | |||||
public RecipeSendDownViewModel() | public RecipeSendDownViewModel() | ||||
{ | { | ||||
@@ -68,6 +78,22 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel | |||||
} | } | ||||
} | } | ||||
}); | }); | ||||
SelectRecipesCommand = new RelayCommand(() => | |||||
{ | |||||
var selectView = new SelectRecipesView(); | |||||
selectView.ShowDialog(); | |||||
Json<LocalRecipe>.Data.SelectedRecipes.Clear(); | |||||
foreach ( var recipe in SelectRecipesViewModel.SelectRecipes ) | |||||
{ | |||||
if ( recipe != null && !Json<LocalRecipe>.Data.SelectedRecipes.Contains(recipe)) | |||||
{ | |||||
Json<LocalRecipe>.Data.SelectedRecipes.Add(recipe); | |||||
} | |||||
} | |||||
}); | |||||
} | } | ||||
} | } | ||||
} | } |
@@ -0,0 +1,114 @@ | |||||
using BPASmartClient.CustomResource.Pages.Model; | |||||
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 SelectRecipesViewModel:ObservableObject | |||||
{ | |||||
public SelectRecipesViewModel() | |||||
{ | |||||
AllRecipes = new(); | |||||
foreach (var item in Json<LocalRecipe>.Data.SelectedRecipes) | |||||
{ | |||||
SelectRecipes.Add(item); | |||||
} | |||||
if (Json<LocalRecipe>.Data.Recipes != null) | |||||
{ | |||||
foreach (var item in Json<LocalRecipe>.Data.Recipes) | |||||
{ | |||||
AllRecipes.Add(new RecipeDataWithCheck() | |||||
{ | |||||
Recipe = item, | |||||
IsSelected = SelectRecipes.Any(p => p.RecipeCode == item.RecipeCode) | |||||
}); | |||||
} | |||||
} | |||||
ConfirmCommand = new(() => | |||||
{ | |||||
RefreshSelected(); | |||||
ActionManage.GetInstance.Send("CloseSelectRecipesView"); | |||||
}); | |||||
CancelCommand = new(() => | |||||
{ | |||||
ActionManage.GetInstance.Send("CloseSelectRecipesView"); | |||||
}); | |||||
AllSelectCommand = new(() => | |||||
{ | |||||
foreach (var item in AllRecipes) | |||||
{ | |||||
item.IsSelected = true; | |||||
} | |||||
}); | |||||
AllCancelCommand = new(() => | |||||
{ | |||||
foreach (var item in AllRecipes) | |||||
{ | |||||
item.IsSelected = false; | |||||
} | |||||
}); | |||||
} | |||||
private void RefreshSelected() | |||||
{ | |||||
SelectRecipes.Clear(); | |||||
foreach (var item in AllRecipes) | |||||
{ | |||||
if (item.IsSelected==true) | |||||
{ | |||||
SelectRecipes.Add(item.Recipe); | |||||
} | |||||
} | |||||
} | |||||
public ObservableCollection<RecipeDataWithCheck> AllRecipes {get; set; } | |||||
public static ObservableCollection<RecipeData> SelectRecipes { get; set; } = new ObservableCollection<RecipeData>(); | |||||
/// <summary> | |||||
/// 取消筛选,即关闭本窗口。 | |||||
/// </summary> | |||||
public RelayCommand CancelCommand { get; set; } | |||||
/// <summary> | |||||
/// 全选。 | |||||
/// </summary> | |||||
public RelayCommand AllSelectCommand { get; set; } | |||||
/// <summary> | |||||
/// 全部取消选择。 | |||||
/// </summary> | |||||
public RelayCommand AllCancelCommand { get; set; } | |||||
/// <summary> | |||||
/// 确认选择。 | |||||
/// </summary> | |||||
public RelayCommand ConfirmCommand { get; set; } | |||||
internal class RecipeDataWithCheck:ObservableObject | |||||
{ | |||||
public RecipeData Recipe { get; set; } | |||||
private bool _IsSelected; | |||||
public bool IsSelected | |||||
{ | |||||
get { return _IsSelected; } | |||||
set { _IsSelected = value; OnPropertyChanged(); } | |||||
} | |||||
} | |||||
} | |||||
} |