From c0c5959e109b9b5cb898d6f30873a87dac5d5767 Mon Sep 17 00:00:00 2001
From: NXX <447201003@qq>
Date: Sat, 20 Aug 2022 11:43:40 +0800
Subject: [PATCH] =?UTF-8?q?=E9=85=8D=E6=96=99=E9=9B=86=E6=88=90=E5=8A=9F?=
=?UTF-8?q?=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Model/RawMaterial/RawMaterialModel.cs | 93 ------
.../Model/RawMaterial/RecipeModel.cs | 1 +
.../ViewModel/NewRecipeViewModel.cs | 3 +-
.../柔性味魔方/RawMaterialModel.cs | 5 +-
.../柔性味魔方/RecipeStates.cs | 22 ++
DosingSystem/Converter/RunStatusConvert.cs | 49 ++-
DosingSystem/View/RecipeControlView.xaml | 302 ++++++++++++++++--
DosingSystem/View/RecipeControlView.xaml.cs | 30 +-
DosingSystem/ViewModel/NewRecipeViewModel.cs | 17 +-
.../ViewModel/RecipeControlViewModel.cs | 87 ++++-
10 files changed, 454 insertions(+), 155 deletions(-)
delete mode 100644 BPASmartClient.JXJFoodSmallStation/Model/RawMaterial/RawMaterialModel.cs
create mode 100644 BPASmartClient.Model/柔性味魔方/RecipeStates.cs
diff --git a/BPASmartClient.JXJFoodSmallStation/Model/RawMaterial/RawMaterialModel.cs b/BPASmartClient.JXJFoodSmallStation/Model/RawMaterial/RawMaterialModel.cs
deleted file mode 100644
index e116bd12..00000000
--- a/BPASmartClient.JXJFoodSmallStation/Model/RawMaterial/RawMaterialModel.cs
+++ /dev/null
@@ -1,93 +0,0 @@
-using Microsoft.Toolkit.Mvvm.ComponentModel;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace BPASmartClient.JXJFoodSmallStation.Model
-{
- ///
- /// 原料模块
- ///
- public class RawMaterialModel : ObservableObject
- {
- ///
- /// 原料名称
- ///
- public string RawMaterialName { get { return _mRawMaterialName; } set { _mRawMaterialName = value; OnPropertyChanged(); } }
- private string _mRawMaterialName;
-
- ///
- /// 原料编号
- ///
- public int RawMateriaLocation { get { return _mRawMaterialLocation; } set { _mRawMaterialLocation = value; OnPropertyChanged(); } }
- private int _mRawMaterialLocation;
-
- ///
- /// 原料设备IP
- ///
- public string DeviceIp { get; set; }
-
- ///
- /// 原料重量设置
- ///
- public uint RawMaterialWeight { get { return _mRawMaterialWeight; } set { _mRawMaterialWeight = value; OnPropertyChanged(); } }
- private uint _mRawMaterialWeight;
-
- ///
- /// 原料类型 MW18
- /// 1:液体
- /// 2:膏体
- /// 3:粉体
- ///
- [Newtonsoft.Json.JsonIgnore]
- public ushort RawMaterialType { get { return _mRawMaterialType; } set { _mRawMaterialType = value; OnPropertyChanged(); } }
- private ushort _mRawMaterialType;
-
- ///
- /// 料仓重量反馈 MD40
- ///
- [Newtonsoft.Json.JsonIgnore]
- public float WeightFeedback { get { return _mWeightFeedback; } set { _mWeightFeedback = value; OnPropertyChanged(); } }
- private float _mWeightFeedback;
-
- ///
- /// 上限反馈
- ///
- [Newtonsoft.Json.JsonIgnore]
- public bool UpLimtFeedback { get { return _mUpLimtFeedback; } set { _mUpLimtFeedback = value; OnPropertyChanged(); } }
- private bool _mUpLimtFeedback;
-
- ///
- /// 下限反馈
- ///
- [Newtonsoft.Json.JsonIgnore]
- public bool DownLimtFeedback { get { return _mDownLimtFeedback; } set { _mDownLimtFeedback = value; OnPropertyChanged(); } }
- private bool _mDownLimtFeedback;
-
- ///
- /// 下料重量反馈 MD52
- ///
- [Newtonsoft.Json.JsonIgnore]
- public float UpLimtWeightFeedback { get { return _mUpLimtWeightFeedback; } set { _mUpLimtWeightFeedback = value; OnPropertyChanged(); } }
- private float _mUpLimtWeightFeedback;
-
-
- ///
- /// 原料ID
- ///
- public string RawMaterialId { get { return _mRawMaterialId; } set { _mRawMaterialId = value; OnPropertyChanged(); } }
- private string _mRawMaterialId;
-
- ///
- /// 原料设备执行状态
- /// 1:空闲状态
- /// 2:下料中
- /// 3:下料完成
- ///
- [Newtonsoft.Json.JsonIgnore]
- public ushort RecipeStatus { get { return _mRecipeStatus; } set { _mRecipeStatus = value; OnPropertyChanged(); } }
- private ushort _mRecipeStatus = 1;
- }
-}
diff --git a/BPASmartClient.JXJFoodSmallStation/Model/RawMaterial/RecipeModel.cs b/BPASmartClient.JXJFoodSmallStation/Model/RawMaterial/RecipeModel.cs
index f9c56b47..8286807a 100644
--- a/BPASmartClient.JXJFoodSmallStation/Model/RawMaterial/RecipeModel.cs
+++ b/BPASmartClient.JXJFoodSmallStation/Model/RawMaterial/RecipeModel.cs
@@ -6,6 +6,7 @@ using System.Text;
using System.Threading;
using System.Threading.Tasks;
using BPASmartClient.JXJFoodSmallStation.ViewModel;
+using BPASmartClient.Model;
using Microsoft.Toolkit.Mvvm.ComponentModel;
namespace BPASmartClient.JXJFoodSmallStation.Model
diff --git a/BPASmartClient.JXJFoodSmallStation/ViewModel/NewRecipeViewModel.cs b/BPASmartClient.JXJFoodSmallStation/ViewModel/NewRecipeViewModel.cs
index 05b41c32..e9527cb5 100644
--- a/BPASmartClient.JXJFoodSmallStation/ViewModel/NewRecipeViewModel.cs
+++ b/BPASmartClient.JXJFoodSmallStation/ViewModel/NewRecipeViewModel.cs
@@ -9,6 +9,7 @@ using Microsoft.Toolkit.Mvvm.Input;
using BPASmartClient.Helper;
using BPASmartClient.JXJFoodSmallStation.Model;
using BPASmartClient.CustomResource.Pages.Model;
+using BPASmartClient.Model;
namespace BPASmartClient.JXJFoodSmallStation.ViewModel
{
@@ -100,7 +101,7 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
Json.Data.Recipes.Add(new RecipeModel()
{
SerialNum = Json.Data.Recipes.Count + 1,
- RawMaterials = RawMaterials,
+ RawMaterials = Global.DeviceRawMaterials,
RecipCode = sb.ToString(),
RecipeName = RecipeName,
});
diff --git a/BPASmartClient.Model/柔性味魔方/RawMaterialModel.cs b/BPASmartClient.Model/柔性味魔方/RawMaterialModel.cs
index a2fe649c..71f0229f 100644
--- a/BPASmartClient.Model/柔性味魔方/RawMaterialModel.cs
+++ b/BPASmartClient.Model/柔性味魔方/RawMaterialModel.cs
@@ -26,8 +26,8 @@ namespace BPASmartClient.Model
///
/// 原料重量设置
///
- public float RawMaterialWeight { get { return _mRawMaterialWeight; } set { _mRawMaterialWeight = value; OnPropertyChanged(); } }
- private float _mRawMaterialWeight;
+ public uint RawMaterialWeight { get { return _mRawMaterialWeight; } set { _mRawMaterialWeight = value; OnPropertyChanged(); } }
+ private uint _mRawMaterialWeight;
///
@@ -35,7 +35,6 @@ namespace BPASmartClient.Model
/// 0:本地
/// 1:设备
///
- [Newtonsoft.Json.JsonIgnore]
public ushort RawMaterialSource { get { return _mRawMaterialSource; } set { _mRawMaterialSource = value; OnPropertyChanged(); } }
private ushort _mRawMaterialSource;
diff --git a/BPASmartClient.Model/柔性味魔方/RecipeStates.cs b/BPASmartClient.Model/柔性味魔方/RecipeStates.cs
new file mode 100644
index 00000000..a1341c4f
--- /dev/null
+++ b/BPASmartClient.Model/柔性味魔方/RecipeStates.cs
@@ -0,0 +1,22 @@
+using Microsoft.Toolkit.Mvvm.ComponentModel;
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPASmartClient.Model.柔性味魔方
+{
+ public class RecipeStates:ObservableObject
+ {
+ public string RecipeName { get { return _recipeName; } set { _recipeName = value; OnPropertyChanged(); } }
+ private string _recipeName;
+
+ public ObservableCollection Materails { get; set; } = new ObservableCollection();
+
+
+ }
+
+
+}
diff --git a/DosingSystem/Converter/RunStatusConvert.cs b/DosingSystem/Converter/RunStatusConvert.cs
index 7ac57ada..eb793a9a 100644
--- a/DosingSystem/Converter/RunStatusConvert.cs
+++ b/DosingSystem/Converter/RunStatusConvert.cs
@@ -12,13 +12,13 @@ namespace BPASmartClient.DosingSystem.Converter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
- if (value is int tempValue)
+ if (value is ushort tempValue)
{
- if (tempValue == 1) return ":等待配料";
- if (tempValue == 2) return ":配料中";
- if (tempValue == 3) return ":配料完成";
+ if (tempValue == 1) return "等待配料";
+ if (tempValue == 2) return "配料中";
+ if (tempValue == 3) return "配料完成";
}
- return ":未知";
+ return "等待配料";
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
@@ -26,4 +26,43 @@ namespace BPASmartClient.DosingSystem.Converter
throw new NotImplementedException();
}
}
+
+ public class EnbleConvert : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ if (value is ushort tempValue)
+ {
+ if (tempValue == 0) return true;
+ if (tempValue == 1) return false;
+
+ }
+ return true;
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+ }
+
+ public class IntToSourceConvert : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ if (value is ushort tempValue)
+ {
+ if (tempValue == 0) return "本地原料";
+ if (tempValue == 1) return "设备原料";
+
+ }
+ return "未知";
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+ }
+
}
diff --git a/DosingSystem/View/RecipeControlView.xaml b/DosingSystem/View/RecipeControlView.xaml
index 185647a4..acd58d57 100644
--- a/DosingSystem/View/RecipeControlView.xaml
+++ b/DosingSystem/View/RecipeControlView.xaml
@@ -14,12 +14,14 @@
mc:Ignorable="d">
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -55,7 +246,7 @@
-
+
+ Columns="6" />
-
+
@@ -270,44 +461,85 @@
-
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
-
-
-
-
-
-
+
+
+
diff --git a/DosingSystem/View/RecipeControlView.xaml.cs b/DosingSystem/View/RecipeControlView.xaml.cs
index 6e9330e3..ca107fff 100644
--- a/DosingSystem/View/RecipeControlView.xaml.cs
+++ b/DosingSystem/View/RecipeControlView.xaml.cs
@@ -1,4 +1,5 @@
-using System;
+using BPASmartClient.DosingSystem.ViewModel;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -23,6 +24,33 @@ namespace BPASmartClient.DosingSystem.View
public RecipeControlView()
{
InitializeComponent();
+ RadioButtonWait_Click(null,null);
+ }
+
+
+
+
+ private void RadioButtonCompelete_Click(object sender, RoutedEventArgs e)
+ {
+ repiceList.ItemsSource = RecipeControlViewModel.UserTreeCompelete;
+ repiceList.Visibility = Visibility.Visible;
+ repiceListMaking.Visibility = Visibility.Hidden;
+
+
+ }
+
+ private void RadioButtonWait_Click(object sender, RoutedEventArgs e)
+ {
+ repiceList.ItemsSource = RecipeControlViewModel.UserTreeWait;
+ repiceList.Visibility = Visibility.Visible;
+ repiceListMaking.Visibility = Visibility.Hidden;
+ }
+
+ private void RadioButtonMaking_Click(object sender, RoutedEventArgs e)
+ {
+ repiceListMaking.Visibility = Visibility.Visible;
+ repiceList.Visibility = Visibility.Hidden;
+
}
}
}
diff --git a/DosingSystem/ViewModel/NewRecipeViewModel.cs b/DosingSystem/ViewModel/NewRecipeViewModel.cs
index d60b59da..e0002b4f 100644
--- a/DosingSystem/ViewModel/NewRecipeViewModel.cs
+++ b/DosingSystem/ViewModel/NewRecipeViewModel.cs
@@ -49,7 +49,7 @@ namespace BPASmartClient.DosingSystem.ViewModel
if (obj is string rm)
{
var res = RawMaterials.FirstOrDefault(p => p.RawMaterialId == rm);
- if (res != null) RawMaterials.Remove(res);
+ if (res != null) Global.DeviceRawMaterials.Remove(res);
}
});
@@ -60,7 +60,17 @@ namespace BPASmartClient.DosingSystem.ViewModel
for (int i = 0; i < RawMaterials.Count; i++)
{
var res = DeviceListViewModel.devices.FirstOrDefault(p => p.DeviceName == RawMaterials.ElementAt(i).RawMaterialName);
- if (res != null) RawMaterials.ElementAt(i).DeviceIp = res.IpAddress;//根据设备名称和原料名称的唯一匹配关系,给原料配置IP
+ if (res != null)
+ {
+ RawMaterials.ElementAt(i).DeviceIp = res.IpAddress;//根据设备名称和原料名称的唯一匹配关系,给原料配置IP
+ RawMaterials.ElementAt(i).RawMaterialSource = 1;
+ }
+ var su = Global.DeviceRawMaterials.FirstOrDefault(p => p.RawMaterialName == RawMaterials.ElementAt(i).RawMaterialName);
+ if(su != null)
+ {
+ RawMaterials.ElementAt(i).RawMaterialSource = su.RawMaterialSource;
+ }
+
}
if (RecipCode.Length <= 0)//新建配方
@@ -169,7 +179,8 @@ namespace BPASmartClient.DosingSystem.ViewModel
public RelayCommand SaveCommand { get; set; }
- public ObservableCollection RawMaterials { get; set; } = new ObservableCollection();
+ public ObservableCollection RawMaterials { get; set; } = new ObservableCollection ();
+
public ObservableCollection RawMaterialNames { get; set; } = new ObservableCollection();
}
diff --git a/DosingSystem/ViewModel/RecipeControlViewModel.cs b/DosingSystem/ViewModel/RecipeControlViewModel.cs
index 916eded9..f10de3cd 100644
--- a/DosingSystem/ViewModel/RecipeControlViewModel.cs
+++ b/DosingSystem/ViewModel/RecipeControlViewModel.cs
@@ -14,6 +14,8 @@ using System.Threading;
using BPASmartClient.CustomResource.Pages.Model;
using BPASmartClient.CustomResource.UserControls.MessageShow;
using BPASmartClient.CustomResource.UserControls;
+using BPASmartClient.Model.柔性味魔方;
+using BPASmartClient.Model;
namespace BPASmartClient.DosingSystem.ViewModel
{
@@ -23,7 +25,6 @@ namespace BPASmartClient.DosingSystem.ViewModel
public RecipeControlViewModel()
{
- Recipes = Json.Data.Recipes;
StartCommand = new RelayCommand