@@ -10,7 +10,6 @@ | |||||
<ProjectReference Include="..\BPASmartClient.Business\BPASmartClient.Business.csproj" /> | <ProjectReference Include="..\BPASmartClient.Business\BPASmartClient.Business.csproj" /> | ||||
<ProjectReference Include="..\BPASmartClient.CustomResource\BPASmartClient.CustomResource.csproj" /> | <ProjectReference Include="..\BPASmartClient.CustomResource\BPASmartClient.CustomResource.csproj" /> | ||||
<ProjectReference Include="..\BPASmartClient.Device\BPASmartClient.Device.csproj" /> | <ProjectReference Include="..\BPASmartClient.Device\BPASmartClient.Device.csproj" /> | ||||
<ProjectReference Include="..\BPASmartClient.Model\BPASmartClient.Model.csproj" /> | |||||
<ProjectReference Include="..\BPASmartClient.MORKSM.BK.PLC\BPASmartClient.PLC.csproj" /> | <ProjectReference Include="..\BPASmartClient.MORKSM.BK.PLC\BPASmartClient.PLC.csproj" /> | ||||
</ItemGroup> | </ItemGroup> | ||||
@@ -9,7 +9,7 @@ namespace BPASmartClient.TourismCollege.Model | |||||
/// <summary> | /// <summary> | ||||
/// 辅料信息 | /// 辅料信息 | ||||
/// </summary> | /// </summary> | ||||
internal class AccessoriesInfo : RawMaterial | |||||
public class AccessoriesInfo : RawMaterial | |||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// 辅料位置 | /// 辅料位置 | ||||
@@ -9,7 +9,7 @@ namespace BPASmartClient.TourismCollege.Model | |||||
/// <summary> | /// <summary> | ||||
/// 主料信息 | /// 主料信息 | ||||
/// </summary> | /// </summary> | ||||
internal class IngredientsInfo : RawMaterial | |||||
public class IngredientsInfo : RawMaterial | |||||
{ | { | ||||
@@ -6,7 +6,7 @@ using System.Threading.Tasks; | |||||
namespace BPASmartClient.TourismCollege.Model | namespace BPASmartClient.TourismCollege.Model | ||||
{ | { | ||||
internal class RawMaterial : NotifyBase | |||||
public class RawMaterial : NotifyBase | |||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// 原料ID | /// 原料ID | ||||
@@ -9,7 +9,7 @@ namespace BPASmartClient.TourismCollege.Model | |||||
/// <summary> | /// <summary> | ||||
/// 调料信息 | /// 调料信息 | ||||
/// </summary> | /// </summary> | ||||
internal class SeasoningInfo : RawMaterial | |||||
public class SeasoningInfo : RawMaterial | |||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// 调料位置 | /// 调料位置 | ||||
@@ -5,14 +5,109 @@ | |||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||||
xmlns:local="clr-namespace:BPASmartClient.TourismCollege.View" | xmlns:local="clr-namespace:BPASmartClient.TourismCollege.View" | ||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||||
xmlns:vm="clr-namespace:BPASmartClient.TourismCollege.ViewModel" | |||||
Width="800" | Width="800" | ||||
Height="450" | Height="450" | ||||
mc:Ignorable="d"> | mc:Ignorable="d"> | ||||
<UserControl.DataContext> | |||||
<vm:AddRawMaterialViewModel /> | |||||
</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> | |||||
</ResourceDictionary> | |||||
</UserControl.Resources> | |||||
<Grid> | <Grid> | ||||
<Grid.RowDefinitions> | <Grid.RowDefinitions> | ||||
<RowDefinition Height="50" /> | |||||
<RowDefinition Height="1*" /> | |||||
<RowDefinition Height="1*" /> | <RowDefinition Height="1*" /> | ||||
</Grid.RowDefinitions> | </Grid.RowDefinitions> | ||||
<Grid.ColumnDefinitions> | |||||
<ColumnDefinition Width="2*" /> | |||||
<ColumnDefinition Width="1*" /> | |||||
</Grid.ColumnDefinitions> | |||||
<!--#region 辅料--> | |||||
<Grid> | |||||
<Grid.RowDefinitions> | |||||
<RowDefinition Height="50" /> | |||||
<RowDefinition Height="1*" /> | |||||
</Grid.RowDefinitions> | |||||
<DockPanel LastChildFill="False"> | |||||
<TextBlock | |||||
Margin="5" | |||||
HorizontalAlignment="Left" | |||||
Text="辅料参数设置" /> | |||||
<Button Content="新增辅料数据" DockPanel.Dock="Right" /> | |||||
</DockPanel> | |||||
<Border Grid.Row="1" BorderThickness="1"> | |||||
<ListView Width="{Binding RelativeSource={RelativeSource AncestorType=Grid, Mode=FindAncestor}}" ItemsSource="{Binding Accessories}"> | |||||
<ListView.View> | |||||
<GridView> | |||||
<GridViewColumn DisplayMemberBinding="{Binding Id}" Header="ID" Width="50"/> | |||||
<GridViewColumn DisplayMemberBinding="{Binding Loc}" Header="位置" Width="50"/> | |||||
<GridViewColumn DisplayMemberBinding="{Binding Name}" Header="名称"/> | |||||
<GridViewColumn Header="操作"> | |||||
<GridViewColumn.CellTemplate> | |||||
<DataTemplate> | |||||
<Button Command="{Binding DataContext.DeleteAccessoryInfoCommand, | |||||
RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}" Content="删除" /> | |||||
</DataTemplate> | |||||
</GridViewColumn.CellTemplate> | |||||
</GridViewColumn> | |||||
</GridView> | |||||
</ListView.View> | |||||
</ListView> | |||||
</Border> | |||||
</Grid> | |||||
<!--#endregion--> | |||||
<!--#region 调料--> | |||||
<Grid Grid.Row="1"> | |||||
<Grid.RowDefinitions> | |||||
<RowDefinition Height="50" /> | |||||
<RowDefinition Height="1*" /> | |||||
</Grid.RowDefinitions> | |||||
<DockPanel LastChildFill="False"> | |||||
<TextBlock | |||||
Margin="5" | |||||
HorizontalAlignment="Left" | |||||
Text="调料参数设置" /> | |||||
<Button Content="新增调料数据" DockPanel.Dock="Right" /> | |||||
</DockPanel> | |||||
<Border Grid.Row="1" BorderThickness="1"> | |||||
<ListView Width="{Binding RelativeSource={RelativeSource AncestorType=Grid, Mode=FindAncestor}}" ItemsSource="{Binding Seasonings}"> | |||||
<ListView.View> | |||||
<GridView> | |||||
<GridViewColumn DisplayMemberBinding="{Binding Id}" Header="ID" Width="50"/> | |||||
<GridViewColumn DisplayMemberBinding="{Binding Loc}" Header="位置" Width="50"/> | |||||
<GridViewColumn DisplayMemberBinding="{Binding Name}" Header="名称"/> | |||||
<GridViewColumn Header="操作"> | |||||
<GridViewColumn.CellTemplate> | |||||
<DataTemplate> | |||||
<Button Command="{Binding DataContext.DeleteAccessoryInfoCommand, | |||||
RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}" Content="删除" /> | |||||
</DataTemplate> | |||||
</GridViewColumn.CellTemplate> | |||||
</GridViewColumn> | |||||
</GridView> | |||||
</ListView.View> | |||||
</ListView> | |||||
</Border> | |||||
</Grid> | |||||
<!--#endregion--> | |||||
<!--#region 原料--> | |||||
<!--#endregion--> | |||||
</Grid> | </Grid> | ||||
</UserControl> | </UserControl> |
@@ -17,12 +17,11 @@ namespace BPASmartClient.TourismCollege.View | |||||
/// <summary> | /// <summary> | ||||
/// AddRawMaterialView.xaml 的交互逻辑 | /// AddRawMaterialView.xaml 的交互逻辑 | ||||
/// </summary> | /// </summary> | ||||
public partial class AddRawMaterialView : Window | |||||
public partial class AddRawMaterialView : UserControl | |||||
{ | { | ||||
public AddRawMaterialView() | public AddRawMaterialView() | ||||
{ | { | ||||
InitializeComponent(); | InitializeComponent(); | ||||
this.DataContext=new AddRawMaterialViewModel(); | |||||
} | } | ||||
} | } | ||||
} | } |
@@ -1,5 +1,6 @@ | |||||
using System; | using System; | ||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Collections.ObjectModel; | |||||
using System.Linq; | using System.Linq; | ||||
using System.Text; | using System.Text; | ||||
using System.Threading.Tasks; | using System.Threading.Tasks; | ||||
@@ -8,6 +9,49 @@ namespace BPASmartClient.TourismCollege.ViewModel | |||||
{ | { | ||||
public class AddRawMaterialViewModel:NotifyBase | public class AddRawMaterialViewModel:NotifyBase | ||||
{ | { | ||||
public AddRawMaterialViewModel() | |||||
{ | |||||
InitialTestData(); | |||||
DeleteAccessoryInfoCommand = new BPARelayCommand<string>((Id) => | |||||
{ | |||||
Accessories.Remove(Accessories.FirstOrDefault(a=>a.Id==Id)); | |||||
}); | |||||
} | |||||
private void InitialTestData() | |||||
{ | |||||
Accessories = new ObservableCollection<AccessoriesInfo>(); | |||||
for (int i = 0; i < 8; i++) | |||||
{ | |||||
Accessories.Add(new AccessoriesInfo() { Id = i.ToString(), Name = $"第{i}样", Loc = i }); | |||||
} | |||||
Ingredients = new(); | |||||
for (int i = 0; i < 12; i++) | |||||
{ | |||||
Ingredients.Add(new IngredientsInfo() { Id = i.ToString(), Name = $"第{i}样"}); | |||||
} | |||||
Seasonings = new(); | |||||
for (int i = 0; i < 3; i++) | |||||
{ | |||||
Seasonings.Add(new SeasoningInfo() { Id = i.ToString(), Name = $"第{i}样", Loc = i }); | |||||
} | |||||
} | |||||
/// <summary> | |||||
/// 辅料信息集合 | |||||
/// </summary> | |||||
public ObservableCollection<AccessoriesInfo> Accessories { get; set; } | |||||
/// <summary> | |||||
/// 主料信息集合 | |||||
/// </summary> | |||||
public ObservableCollection<IngredientsInfo> Ingredients { get; set; } | |||||
/// <summary> | |||||
/// 调料信息集合 | |||||
/// </summary> | |||||
public ObservableCollection<SeasoningInfo> Seasonings { get; set; } | |||||
public BPARelayCommand<string> DeleteAccessoryInfoCommand { get;set; } | |||||
} | } | ||||
} | } |