Procházet zdrojové kódy

配方添加

master
pry před 1 rokem
rodič
revize
82e4592d67
14 změnil soubory, kde provedl 258 přidání a 57 odebrání
  1. +23
    -0
      BPA.Model/NewRecipeModel.cs
  2. +1
    -2
      BPA.Model/ViewItem.cs
  3. +4
    -4
      BPA.SingleDevice/Themes/Generic.xaml
  4. +0
    -20
      BPA.SingleDevice/View/DeviceManagementView.xaml
  5. +66
    -0
      BPA.SingleDevice/View/NewRecipeView.xaml
  6. +3
    -3
      BPA.SingleDevice/View/NewRecipeView.xaml.cs
  7. +59
    -0
      BPA.SingleDevice/View/OrderMainView.xaml
  8. +28
    -0
      BPA.SingleDevice/View/OrderMainView.xaml.cs
  9. +1
    -5
      BPA.SingleDevice/View/RecipeManagementView.xaml
  10. +0
    -12
      BPA.SingleDevice/ViewModel/DeviceManagementViewModel.cs
  11. +3
    -3
      BPA.SingleDevice/ViewModel/MainViewModel.cs
  12. +39
    -0
      BPA.SingleDevice/ViewModel/NewRecipeViewModel.cs
  13. +23
    -0
      BPA.SingleDevice/ViewModel/OrderMainViewModel.cs
  14. +8
    -8
      BPA.SingleDevice/ViewModel/RecipeManagementViewModel.cs

+ 23
- 0
BPA.Model/NewRecipeModel.cs Zobrazit soubor

@@ -0,0 +1,23 @@
using BPA.Helper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPA.Model
{
public class NewRecipeModel : NotifyBase
{

public string Id { get { return _mId; } set { _mId = value; OnPropertyChanged(); } }
private string _mId;

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

public bool IsChecked { get { return _mIsChecked; } set { _mIsChecked = value; OnPropertyChanged(); } }
private bool _mIsChecked;

}
}

+ 1
- 2
BPA.Model/ViewItem.cs Zobrazit soubor

@@ -10,10 +10,9 @@ namespace BPA.Model
{
public class ViewItem : NotifyBase
{
public ViewItem(string name, string description, object content, IconType? iconType = null)
public ViewItem(string name, object content, IconType? iconType = null)
{
Name = name;
Description = description;
Content = content;
Icon = iconType;
}


+ 4
- 4
BPA.SingleDevice/Themes/Generic.xaml Zobrazit soubor

@@ -14,7 +14,7 @@
Margin="0,5,0,0"
ui:GridHelper.RowDefinitions="Auto, Auto, *"
ui:PanelHelper.Spacing="10">
<TextBlock Style="{StaticResource Head3TextBlock}" Text="{TemplateBinding Title}" />
<!--<TextBlock Style="{StaticResource Head3TextBlock}" Text="{TemplateBinding Title}" />
<TextBox
x:Name="descriptionText"
Grid.Row="1"
@@ -23,7 +23,7 @@
BorderThickness="0"
IsReadOnly="True"
Text="{TemplateBinding Description}"
TextWrapping="Wrap" />
TextWrapping="Wrap" />-->
<ui:Card
Grid.Row="2"
Margin="3,5"
@@ -36,11 +36,11 @@
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</ui:Card>
</Grid>
<ControlTemplate.Triggers>
<!--<ControlTemplate.Triggers>
<Trigger Property="Description" Value="{x:Null}">
<Setter TargetName="descriptionText" Property="Visibility" Value="Collapsed" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate.Triggers>-->
</ControlTemplate>
</Setter.Value>
</Setter>


+ 0
- 20
BPA.SingleDevice/View/DeviceManagementView.xaml Zobrazit soubor

@@ -1,20 +0,0 @@
<UserControl
x:Class="BPA.SingleDevice.View.DeviceManagementView"
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:BPA.SingleDevice.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">
<Grid>
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="Transparent"
FontSize="50"
Foreground="White"
Text="设备管理" />
</Grid>
</UserControl>

+ 66
- 0
BPA.SingleDevice/View/NewRecipeView.xaml Zobrazit soubor

@@ -0,0 +1,66 @@
<UserControl
x:Class="BPA.SingleDevice.View.NewRecipeView"
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:BPA.SingleDevice.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ui="http://rubyer.io/winfx/xaml/toolkit"
xmlns:vm="clr-namespace:BPA.SingleDevice.ViewModel"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">

<UserControl.DataContext>
<vm:NewRecipeViewModel />
</UserControl.DataContext>

<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="40" />
<RowDefinition />
<RowDefinition Height="40" />
</Grid.RowDefinitions>

<Grid Margin="10,0" ui:GridHelper.Columns="2">
<TextBlock FontSize="16" Text="配方名称:" />
<TextBox
Grid.Column="1"
Margin="0,5"
Style="{StaticResource DarkTextBox}"
Text="{Binding RawMaterResultInfo.Name}" />
</Grid>

<ScrollViewer Grid.Row="1">
<ListView ItemsSource="{Binding NewRecipeModels}">
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid Columns="5" />
</ItemsPanelTemplate>
</ListView.ItemsPanel>
<ListView.ItemTemplate>
<DataTemplate>
<CheckBox
Margin="10,5"
Content="{Binding Name}"
FontSize="16"
IsChecked="{Binding IsChecked}" />
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</ScrollViewer>

<Grid
Grid.Row="2"
Margin="0,5"
ui:GridHelper.ColumnDefinitions="*,*"
ui:PanelHelper.Spacing="10">
<Button
Grid.Column="0"
Command="{Binding SaveCommand}"
Content="确认" />
<Button Grid.Column="1" Content="取消" />
</Grid>

</Grid>
</UserControl>

BPA.SingleDevice/View/DeviceManagementView.xaml.cs → BPA.SingleDevice/View/NewRecipeView.xaml.cs Zobrazit soubor

@@ -16,11 +16,11 @@ using System.Windows.Shapes;
namespace BPA.SingleDevice.View
{
/// <summary>
/// DeviceManagementView.xaml 的交互逻辑
/// NewRecipeView.xaml 的交互逻辑
/// </summary>
public partial class DeviceManagementView : UserControl
public partial class NewRecipeView : UserControl
{
public DeviceManagementView()
public NewRecipeView()
{
InitializeComponent();
}

+ 59
- 0
BPA.SingleDevice/View/OrderMainView.xaml Zobrazit soubor

@@ -0,0 +1,59 @@
<UserControl
x:Class="BPA.SingleDevice.View.OrderMainView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:BPA.SingleDevice.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPA.SingleDevice.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ui="http://rubyer.io/winfx/xaml/toolkit"
xmlns:vm="clr-namespace:BPA.SingleDevice.ViewModel"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">

<UserControl.DataContext>
<vm:OrderMainViewModel />
</UserControl.DataContext>

<UserControl.Resources>
<Style x:Key="listViewStyle" TargetType="ListView">
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled" />
</Style>
</UserControl.Resources>

<Grid Margin="10">
<ListView ui:ItemsControlHelper.ItemPadding="0" ItemsSource="{Binding Goods}">
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
</ListView.ItemsPanel>
<ListView.ItemTemplate>
<DataTemplate>
<controls:ControlDisplay Grid.Row="1" ui:PanelHelper.Spacing="10">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="120" />
<RowDefinition Height="30" />
<RowDefinition />
</Grid.RowDefinitions>
<Border Width="120" Background="Gray" />
<TextBlock Grid.Row="1" Text="{Binding}" />
<Grid Grid.Row="2" ui:GridHelper.ColumnDefinitions="*,*">
<ui:NumericBox
IsReadOnly="True"
Style="{StaticResource FrontBackNumericBox}"
Value="1" />
<Button
Grid.Column="1"
Margin="10,0,0,0"
Content="开始下单" />
</Grid>
</Grid>
</controls:ControlDisplay>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</Grid>
</UserControl>

+ 28
- 0
BPA.SingleDevice/View/OrderMainView.xaml.cs Zobrazit soubor

@@ -0,0 +1,28 @@
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 BPA.SingleDevice.View
{
/// <summary>
/// OrderMainView.xaml 的交互逻辑
/// </summary>
public partial class OrderMainView : UserControl
{
public OrderMainView()
{
InitializeComponent();
}
}
}

+ 1
- 5
BPA.SingleDevice/View/RecipeManagementView.xaml Zobrazit soubor

@@ -60,11 +60,7 @@
<DataGridTextColumn
Width="100"
Binding="{Binding DeviceNum}"
Header="任务数" />
<DataGridTextColumn
Width="120"
Binding="{Binding WarehouseNum}"
Header="完成进度" />
Header="是否启用" />
<DataGridTextColumn
Width="180"
Binding="{Binding LastModified}"


+ 0
- 12
BPA.SingleDevice/ViewModel/DeviceManagementViewModel.cs Zobrazit soubor

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

namespace BPA.SingleDevice.ViewModel
{
internal class DeviceManagementViewModel
{
}
}

+ 3
- 3
BPA.SingleDevice/ViewModel/MainViewModel.cs Zobrazit soubor

@@ -19,9 +19,9 @@ namespace BPA.SingleDevice.ViewModel
{
ViewItems = new ObservableCollection<ViewItem>
{
new ViewItem("原料管理", "总览", new RawMaterialManagementView(), IconType.Home2Line),
new ViewItem("设备管理", "按钮", new DeviceManagementView(), IconType.CheckboxBlankFill),
new ViewItem("配方管理", "文本框", new RecipeManagementView(), IconType.TBoxLine),
new ViewItem("原料管理", new RawMaterialManagementView(), IconType.ReservedFill),
new ViewItem("配方管理", new RecipeManagementView(), IconType.NewspaperFill),
new ViewItem("点单主页", new OrderMainView(), IconType.Home3Fill),
};

SelecteCommand = new BPARelayCommand<object>(DoNavChanged);


+ 39
- 0
BPA.SingleDevice/ViewModel/NewRecipeViewModel.cs Zobrazit soubor

@@ -0,0 +1,39 @@
using BPA.Helper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.ObjectModel;
using BPA.Model;
using Rubyer;

namespace BPA.SingleDevice.ViewModel
{
public class NewRecipeViewModel : NotifyBase, IDialogDataContext
{
public NewRecipeViewModel()
{
for (int i = 0; i < 60; i++)
{
NewRecipeModels.Add(new NewRecipeModel()
{
Name = $"原料-{i}"
});
}
}

public ObservableCollection<NewRecipeModel> NewRecipeModels { get; set; } = new ObservableCollection<NewRecipeModel>();

public string RecipeName { get { return _mRecipeName; } set { _mRecipeName = value; OnPropertyChanged(); } }
private string _mRecipeName;

public string Title => "";

public event Action<object> RequestClose;

public void OnDialogOpened(object parameters)
{
}
}
}

+ 23
- 0
BPA.SingleDevice/ViewModel/OrderMainViewModel.cs Zobrazit soubor

@@ -0,0 +1,23 @@
using BPA.Helper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.ObjectModel;

namespace BPA.SingleDevice.ViewModel
{
public class OrderMainViewModel : NotifyBase
{
public OrderMainViewModel()
{
for (int i = 0; i < 20; i++)
{
Goods.Add($"商品-{i}");
}
}

public ObservableCollection<string> Goods { get; set; } = new ObservableCollection<string>();
}
}

+ 8
- 8
BPA.SingleDevice/ViewModel/RecipeManagementViewModel.cs Zobrazit soubor

@@ -29,8 +29,8 @@ namespace BPA.SingleDevice.ViewModel

AddCommand = new BPARelayCommand(async () =>
{
var content = new AddRawMaterialDialogView();
var para = await Dialog.Show(content, new Parameters(), "添加原料", (d) => { }, (d, o) =>
var content = new NewRecipeView();
var para = await Dialog.Show(content, new Parameters(), "添加配方", (d) => { }, (d, o) =>
{
if (o is RawMaterResult rm)
{
@@ -45,7 +45,7 @@ namespace BPA.SingleDevice.ViewModel
LastModified = time
}).Result.OnSuccess(() =>
{
RawMaterInfos.Add(new RawMaterInfo(id, rm.Name, rm.DeviceNum, rm.ChNum, time));
//RawMaterInfos.Add(new RawMaterInfo(id, rm.Name, rm.DeviceNum, rm.ChNum, time));
}).OnFail(s => { Message.Error("RawMaterialManagementView", $"添加失败:{s}"); });
}
});
@@ -61,8 +61,8 @@ namespace BPA.SingleDevice.ViewModel
var para = await Dialog.Show(new AddRawMaterialDialogView(), new RawMaterResult()
{
Name = RawMaterInfos[index].Name,
DeviceNum = RawMaterInfos[index].DeviceNum,
ChNum = RawMaterInfos[index].WarehouseNum,
//DeviceNum = RawMaterInfos[index].DeviceNum,
//ChNum = RawMaterInfos[index].WarehouseNum,
Id = RawMaterInfos[index].Id,
}, "原料编辑", (d) => { }, (d, o) =>
{
@@ -79,9 +79,9 @@ namespace BPA.SingleDevice.ViewModel
}).Result.OnSuccess(() =>
{
RawMaterInfos[index].Name = rm.Name;
RawMaterInfos[index].DeviceNum = rm.DeviceNum;
RawMaterInfos[index].WarehouseNum = rm.ChNum;
RawMaterInfos[index].LastModified = time;
//RawMaterInfos[index].DeviceNum = rm.DeviceNum;
//RawMaterInfos[index].WarehouseNum = rm.ChNum;
//RawMaterInfos[index].LastModified = time;
}).OnFail(s => { Message.Error("RawMaterialManagementView", $"修改失败:{s}"); });
}
});


Načítá se…
Zrušit
Uložit