Sfoglia il codice sorgente

调整添加原料页面

JXJAgvReake
ZhaoGang 1 anno fa
parent
commit
2c7dbd78d5
8 ha cambiato i file con 146 aggiunte e 9 eliminazioni
  1. +0
    -1
      BPASmartClient.Tourism/BPASmartClient.TourismCollege.csproj
  2. +1
    -1
      BPASmartClient.Tourism/Model/AccessoriesInfo.cs
  3. +1
    -1
      BPASmartClient.Tourism/Model/IngredientsInfo.cs
  4. +1
    -1
      BPASmartClient.Tourism/Model/RawMaterial.cs
  5. +1
    -1
      BPASmartClient.Tourism/Model/SeasoningInfo.cs
  6. +97
    -2
      BPASmartClient.Tourism/View/AddRawMaterialView.xaml
  7. +1
    -2
      BPASmartClient.Tourism/View/AddRawMaterialView.xaml.cs
  8. +44
    -0
      BPASmartClient.Tourism/ViewModel/AddRawMaterialViewModel.cs

+ 0
- 1
BPASmartClient.Tourism/BPASmartClient.TourismCollege.csproj Vedi File

@@ -10,7 +10,6 @@
<ProjectReference Include="..\BPASmartClient.Business\BPASmartClient.Business.csproj" />
<ProjectReference Include="..\BPASmartClient.CustomResource\BPASmartClient.CustomResource.csproj" />
<ProjectReference Include="..\BPASmartClient.Device\BPASmartClient.Device.csproj" />
<ProjectReference Include="..\BPASmartClient.Model\BPASmartClient.Model.csproj" />
<ProjectReference Include="..\BPASmartClient.MORKSM.BK.PLC\BPASmartClient.PLC.csproj" />
</ItemGroup>



+ 1
- 1
BPASmartClient.Tourism/Model/AccessoriesInfo.cs Vedi File

@@ -9,7 +9,7 @@ namespace BPASmartClient.TourismCollege.Model
/// <summary>
/// 辅料信息
/// </summary>
internal class AccessoriesInfo : RawMaterial
public class AccessoriesInfo : RawMaterial
{
/// <summary>
/// 辅料位置


+ 1
- 1
BPASmartClient.Tourism/Model/IngredientsInfo.cs Vedi File

@@ -9,7 +9,7 @@ namespace BPASmartClient.TourismCollege.Model
/// <summary>
/// 主料信息
/// </summary>
internal class IngredientsInfo : RawMaterial
public class IngredientsInfo : RawMaterial
{




+ 1
- 1
BPASmartClient.Tourism/Model/RawMaterial.cs Vedi File

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

namespace BPASmartClient.TourismCollege.Model
{
internal class RawMaterial : NotifyBase
public class RawMaterial : NotifyBase
{
/// <summary>
/// 原料ID


+ 1
- 1
BPASmartClient.Tourism/Model/SeasoningInfo.cs Vedi File

@@ -9,7 +9,7 @@ namespace BPASmartClient.TourismCollege.Model
/// <summary>
/// 调料信息
/// </summary>
internal class SeasoningInfo : RawMaterial
public class SeasoningInfo : RawMaterial
{
/// <summary>
/// 调料位置


+ 97
- 2
BPASmartClient.Tourism/View/AddRawMaterialView.xaml Vedi File

@@ -5,14 +5,109 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.TourismCollege.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:BPASmartClient.TourismCollege.ViewModel"
Width="800"
Height="450"
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.RowDefinitions>
<RowDefinition Height="50" />
<RowDefinition Height="1*" />
<RowDefinition Height="1*" />
</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>
</UserControl>

+ 1
- 2
BPASmartClient.Tourism/View/AddRawMaterialView.xaml.cs Vedi File

@@ -17,12 +17,11 @@ namespace BPASmartClient.TourismCollege.View
/// <summary>
/// AddRawMaterialView.xaml 的交互逻辑
/// </summary>
public partial class AddRawMaterialView : Window
public partial class AddRawMaterialView : UserControl
{
public AddRawMaterialView()
{
InitializeComponent();
this.DataContext=new AddRawMaterialViewModel();
}
}
}

+ 44
- 0
BPASmartClient.Tourism/ViewModel/AddRawMaterialViewModel.cs Vedi File

@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -8,6 +9,49 @@ namespace BPASmartClient.TourismCollege.ViewModel
{
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; }
}
}

Caricamento…
Annulla
Salva