From 636e629590a7d20f29f65ba636ff20759a12cc9a Mon Sep 17 00:00:00 2001
From: ZhaoGang <15196688790@163.com>
Date: Sat, 24 Jun 2023 17:32:13 +0800
Subject: [PATCH] =?UTF-8?q?=E9=85=8D=E6=96=B9=E7=AE=A1=E7=90=86=E9=A1=B5?=
=?UTF-8?q?=E9=9D=A2=E6=B7=BB=E5=8A=A0=E5=91=BD=E4=BB=A4=E5=B9=B6=E5=81=9A?=
=?UTF-8?q?=E5=9F=BA=E6=9C=AC=E6=B5=8B=E8=AF=95=E3=80=82?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../BPASmartClient.MorkCL.csproj | 1 +
BPASmartClient.Tourism/Control_MorkCL.cs | 6 +
BPASmartClient.Tourism/HelpClass/FuncSet.cs | 11 +-
.../Model/Json/MaterialsInfo.cs | 25 +++
.../Model/Json/RecipesInfo.cs | 14 ++
.../Model/Recipe/TempRecipe.cs | 43 +++++
.../View/AddRawMaterialView.xaml | 20 +-
BPASmartClient.Tourism/View/Debug.xaml | 22 +--
.../View/EditFunctionParamView.xaml | 16 +-
.../View/EditFunctionParamView.xaml.cs | 5 +
.../View/EditRecipeView.xaml | 35 ++--
.../View/EditRecipeView.xaml.cs | 5 +
.../View/ItemStorageView.xaml | 57 +++++-
BPASmartClient.Tourism/View/ParSet.xaml | 2 +-
.../View/RecipeManageView.xaml | 12 +-
.../ViewModel/AddRawMaterialViewModel.cs | 50 ++++-
.../ViewModel/EditFunctionParamViewModel.cs | 20 +-
.../ViewModel/EditRecipeViewModel.cs | 172 ++++++++++++++----
.../ViewModel/ItemStorageViewModel.cs | 38 +++-
.../ViewModel/RecipeManageViewModel.cs | 55 +++---
20 files changed, 477 insertions(+), 132 deletions(-)
create mode 100644 BPASmartClient.Tourism/Model/Json/MaterialsInfo.cs
create mode 100644 BPASmartClient.Tourism/Model/Json/RecipesInfo.cs
create mode 100644 BPASmartClient.Tourism/Model/Recipe/TempRecipe.cs
diff --git a/BPASmartClient.Tourism/BPASmartClient.MorkCL.csproj b/BPASmartClient.Tourism/BPASmartClient.MorkCL.csproj
index 5cf2eeff..c8e31cf8 100644
--- a/BPASmartClient.Tourism/BPASmartClient.MorkCL.csproj
+++ b/BPASmartClient.Tourism/BPASmartClient.MorkCL.csproj
@@ -7,6 +7,7 @@
+
diff --git a/BPASmartClient.Tourism/Control_MorkCL.cs b/BPASmartClient.Tourism/Control_MorkCL.cs
index cbce75a0..3fa9a092 100644
--- a/BPASmartClient.Tourism/Control_MorkCL.cs
+++ b/BPASmartClient.Tourism/Control_MorkCL.cs
@@ -1,5 +1,6 @@
using BPA.Message.Enum;
using BPASmartClient.Device;
+using BPASmartClient.MorkCL.Model.Json;
using BPASmartClient.MorkCL.Server;
using SqlSugar;
using System;
@@ -48,6 +49,11 @@ namespace BPASmartClient.MorkCL
devices[EDeviceType.机器人].Init(ConnectPar.RobotIP);
devices[EDeviceType.压力锅].Init(ConnectPar.PressureCookerIP);
devices[EDeviceType.外部设备].Init(ConnectPar.PPortName);
+
+ #region 读取本地文件数据
+ Json.Read();
+ Json.Read();
+ #endregion
}
public override void MainTask()
diff --git a/BPASmartClient.Tourism/HelpClass/FuncSet.cs b/BPASmartClient.Tourism/HelpClass/FuncSet.cs
index 92d5e768..0ce9e940 100644
--- a/BPASmartClient.Tourism/HelpClass/FuncSet.cs
+++ b/BPASmartClient.Tourism/HelpClass/FuncSet.cs
@@ -13,7 +13,16 @@ namespace BPASmartClient.MorkCL.HelpClass
public class FuncSet
{
public int Step { get; set; }
- public string FuncName { get; set; }
+
+ private string _FuncName;
+ public string FuncName
+ {
+ get { return _FuncName; }
+ set { _FuncName = value;
+ FuncPars = InitData.FunParInit[(EFunc)Enum.Parse(typeof(EFunc),value)]?.ToList();
+ }
+ }
+
public List FuncPars { get; set; }
}
}
diff --git a/BPASmartClient.Tourism/Model/Json/MaterialsInfo.cs b/BPASmartClient.Tourism/Model/Json/MaterialsInfo.cs
new file mode 100644
index 00000000..a3364616
--- /dev/null
+++ b/BPASmartClient.Tourism/Model/Json/MaterialsInfo.cs
@@ -0,0 +1,25 @@
+using BPASmartClient.MorkCL.Model.DataInfo;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPASmartClient.MorkCL.Model.Json
+{
+ public class MaterialsInfo
+ {
+ ///
+ /// 辅料信息集合
+ ///
+ public ObservableCollection Accessories { get; set; }=new ObservableCollection();
+ ///
+ /// 主料信息集合
+ ///
+ public ObservableCollection Ingredients { get; set; }=new ObservableCollection();
+ ///
+ /// 调料信息集合
+ ///
+ public ObservableCollection Seasonings { get; set; }=new ObservableCollection();
+ }
+}
diff --git a/BPASmartClient.Tourism/Model/Json/RecipesInfo.cs b/BPASmartClient.Tourism/Model/Json/RecipesInfo.cs
new file mode 100644
index 00000000..0bc7e8f1
--- /dev/null
+++ b/BPASmartClient.Tourism/Model/Json/RecipesInfo.cs
@@ -0,0 +1,14 @@
+using BPASmartClient.MorkCL.Model.Recipe;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPASmartClient.MorkCL.Model.Json
+{
+ public class RecipesInfo
+ {
+ public ObservableCollection LocalRecipes { get; set; }=new ObservableCollection();
+ }
+}
diff --git a/BPASmartClient.Tourism/Model/Recipe/TempRecipe.cs b/BPASmartClient.Tourism/Model/Recipe/TempRecipe.cs
new file mode 100644
index 00000000..1d3cf005
--- /dev/null
+++ b/BPASmartClient.Tourism/Model/Recipe/TempRecipe.cs
@@ -0,0 +1,43 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPASmartClient.MorkCL.Model.Recipe
+{
+ public class TempRecipeData:NotifyBase
+ {
+ private string _Name;
+
+ public string Name
+ {
+ get { return _Name; }
+ set { _Name = value; OnPropertyChanged(); }
+ }
+ private string _ID;
+
+ public string ID
+ {
+ get { return _ID; }
+ set { _ID = value; OnPropertyChanged(); }
+ }
+ private string _Remark;
+
+ public string Remark
+ {
+ get { return _Remark; }
+ set { _Remark = value; OnPropertyChanged(); }
+ }
+ private Dictionary _Functions;
+
+ public Dictionary Functions
+ {
+ get { return _Functions; }
+ set { _Functions = value; OnPropertyChanged(); }
+ }
+
+
+
+ }
+}
diff --git a/BPASmartClient.Tourism/View/AddRawMaterialView.xaml b/BPASmartClient.Tourism/View/AddRawMaterialView.xaml
index c76f1023..feff48b3 100644
--- a/BPASmartClient.Tourism/View/AddRawMaterialView.xaml
+++ b/BPASmartClient.Tourism/View/AddRawMaterialView.xaml
@@ -48,12 +48,12 @@
+ DockPanel.Dock="Right" Command="{Binding AddMaterialCommand}" CommandParameter="辅料"/>
+ DockPanel.Dock="Right" Command="{Binding SaveMaterialInfoCommand}" CommandParameter="辅料"/>
+ TextAlignment="Center" MinWidth="100"/>
+ DockPanel.Dock="Right" Command="{Binding AddMaterialCommand}" CommandParameter="调料"/>
+ DockPanel.Dock="Right" Command="{Binding SaveMaterialInfoCommand}" CommandParameter="调料"/>
+ TextAlignment="Center" MinWidth="100"/>
+ DockPanel.Dock="Right" Command="{Binding AddMaterialCommand}" CommandParameter="主料"/>
+ DockPanel.Dock="Right" Command="{Binding SaveMaterialInfoCommand}" CommandParameter="主料"/>
+ TextAlignment="Center" MinWidth="100"/>
-
+
\ No newline at end of file
diff --git a/BPASmartClient.Tourism/View/EditRecipeView.xaml.cs b/BPASmartClient.Tourism/View/EditRecipeView.xaml.cs
index 0e3f79fa..a5b8cb6f 100644
--- a/BPASmartClient.Tourism/View/EditRecipeView.xaml.cs
+++ b/BPASmartClient.Tourism/View/EditRecipeView.xaml.cs
@@ -23,6 +23,11 @@ namespace BPASmartClient.MorkCL.View
{
InitializeComponent();
this.br.MouseLeftButtonDown += (o, e) => { if (e.LeftButton == MouseButtonState.Pressed) this.DragMove(); };
+
+ ActionManage.GetInstance.Register(() =>
+ {
+ this.Close();
+ }, "CloseEditRecipeView", true);
}
private void Button_Click(object sender, RoutedEventArgs e)
diff --git a/BPASmartClient.Tourism/View/ItemStorageView.xaml b/BPASmartClient.Tourism/View/ItemStorageView.xaml
index bea77fb3..cd653573 100644
--- a/BPASmartClient.Tourism/View/ItemStorageView.xaml
+++ b/BPASmartClient.Tourism/View/ItemStorageView.xaml
@@ -5,10 +5,14 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.MorkCL.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:vm="clr-namespace:BPASmartClient.MorkCL.ViewModel"
Name="库位状态"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">
+
+
+
@@ -29,7 +33,7 @@
-
+
@@ -53,8 +57,10 @@
Grid.Row="1"
Grid.Column="1"
Margin="3"
- Background="AliceBlue"
- BorderThickness="1">
+ Background="Transparent"
+ BorderThickness="1"
+ ItemsSource="{Binding Materials}"
+ ScrollViewer.HorizontalScrollBarVisibility="Disabled">
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/BPASmartClient.Tourism/View/ParSet.xaml b/BPASmartClient.Tourism/View/ParSet.xaml
index 4fffab36..25ba8d72 100644
--- a/BPASmartClient.Tourism/View/ParSet.xaml
+++ b/BPASmartClient.Tourism/View/ParSet.xaml
@@ -6,7 +6,7 @@
xmlns:local="clr-namespace:BPASmartClient.MorkCL.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
d:DesignHeight="450"
- d:DesignWidth="800"
+ d:DesignWidth="800" Name="参数设置"
mc:Ignorable="d">
diff --git a/BPASmartClient.Tourism/View/RecipeManageView.xaml b/BPASmartClient.Tourism/View/RecipeManageView.xaml
index 88bf1296..74f0b1c4 100644
--- a/BPASmartClient.Tourism/View/RecipeManageView.xaml
+++ b/BPASmartClient.Tourism/View/RecipeManageView.xaml
@@ -171,18 +171,18 @@
-
+ TextAlignment="Center" MinWidth="200"/>
diff --git a/BPASmartClient.Tourism/ViewModel/AddRawMaterialViewModel.cs b/BPASmartClient.Tourism/ViewModel/AddRawMaterialViewModel.cs
index 242cbe16..f86ea98d 100644
--- a/BPASmartClient.Tourism/ViewModel/AddRawMaterialViewModel.cs
+++ b/BPASmartClient.Tourism/ViewModel/AddRawMaterialViewModel.cs
@@ -5,6 +5,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BPASmartClient.MorkCL.Model.DataInfo;
+using BPASmartClient.MorkCL.Model.Json;
namespace BPASmartClient.MorkCL.ViewModel
{
@@ -12,12 +13,51 @@ namespace BPASmartClient.MorkCL.ViewModel
{
public AddRawMaterialViewModel()
{
-
+
InitialTestData();
+
+
+
RemoveAccessoryCommand = new BPARelayCommand((Id) =>
{
Accessories.Remove(Accessories.FirstOrDefault(a=>a.Id==Id));
});
+ RemoveIngreditentCommand = new BPARelayCommand((Id) =>
+ {
+ Ingredients.Remove(Ingredients.FirstOrDefault(a => a.Id == Id));
+ });
+ RemoveSeasoningCommand = new BPARelayCommand((Id) =>
+ {
+ Seasonings.Remove(Seasonings.FirstOrDefault(a => a.Id == Id));
+ });
+
+ AddMaterialCommand = new BPARelayCommand((materialType) =>
+ {
+ switch (materialType)
+ {
+ case "主料":Ingredients.Add(new IngredientsInfo());
+ break;
+ case "辅料":
+ Accessories.Add(new AccessoriesInfo());
+ break;
+ case "调料":
+ Seasonings.Add(new SeasoningInfo());
+ break;
+ }
+ });
+ SaveMaterialInfoCommand = new BPARelayCommand((materialType) =>
+ {
+ //TODO:暂时不写 可能使用数据库保存。
+ switch (materialType)
+ {
+ case "主料":
+ break;
+ case "辅料":
+ break;
+ case "调料":
+ break;
+ }
+ });
}
private void InitialTestData()
@@ -67,5 +107,13 @@ namespace BPASmartClient.MorkCL.ViewModel
/// 删除调料信息
///
public BPARelayCommand RemoveSeasoningCommand { get; set; }
+ ///
+ /// 添加物料信息。
+ ///
+ public BPARelayCommand AddMaterialCommand { get; set; }
+ ///
+ /// 保存物料信息。
+ ///
+ public BPARelayCommand SaveMaterialInfoCommand { get; set; }
}
}
diff --git a/BPASmartClient.Tourism/ViewModel/EditFunctionParamViewModel.cs b/BPASmartClient.Tourism/ViewModel/EditFunctionParamViewModel.cs
index df46dc0d..3d955908 100644
--- a/BPASmartClient.Tourism/ViewModel/EditFunctionParamViewModel.cs
+++ b/BPASmartClient.Tourism/ViewModel/EditFunctionParamViewModel.cs
@@ -13,7 +13,6 @@ namespace BPASmartClient.MorkCL.ViewModel
public EditFunctionParamViewModel()
{
//AddTestData();
- ActionManage.GetInstance.CancelRegister("OpenFuncEditView");
ActionManage.GetInstance.Register((object o) =>
{
FuncPars.Clear();
@@ -34,7 +33,13 @@ namespace BPASmartClient.MorkCL.ViewModel
}
}
}
- }, "OpenFuncEditView");
+ }, "OpenFuncEditView",true);
+
+ SaveParamCommand = new BPARelayCommand(() =>{
+
+ //关闭视图窗口。
+ ActionManage.GetInstance.Send("CloseFuncParmEditView",true);
+ });
}
void AddTestData()
@@ -59,15 +64,6 @@ namespace BPASmartClient.MorkCL.ViewModel
/// 保存参数。
///
public BPARelayCommand SaveParamCommand { get; set; }
- ///
- /// 添加功能
- ///
- public BPARelayCommand AddParamCommand { get; set; }
- ///
- /// 删除功能。
- ///
- public BPARelayCommand