diff --git a/BPASmartClient.CustomResource/Pages/Model/MessageLog.cs b/BPASmartClient.CustomResource/Pages/Model/MessageLog.cs
index afc3925a..cd9263f6 100644
--- a/BPASmartClient.CustomResource/Pages/Model/MessageLog.cs
+++ b/BPASmartClient.CustomResource/Pages/Model/MessageLog.cs
@@ -102,29 +102,31 @@ namespace BPASmartClient.CustomResource.Pages.Model
public bool ShowDialog(string info, DialogType dialogType = DialogType.Information)
{
PromptView PV = new PromptView();
+ PV.TextBlockInfo = info;
switch (dialogType)
{
case DialogType.Warning:
PV.TextBlockIcon = "";
PV.TextBlockForeground = Brushes.Yellow;
- PV.TextBlockInfo = $"警告:{info}";
- PV.Cancel.Visibility = Visibility.Collapsed;
+ PV.infoType.Text = "警告:";
+ //PV.Cancel.Visibility = Visibility.Collapsed;
break;
case DialogType.Error:
PV.TextBlockIcon = "";
PV.TextBlockForeground = Brushes.Red;
- PV.TextBlockInfo = $"错误:{info}";
- PV.Cancel.Visibility = Visibility.Collapsed;
+ PV.infoType.Text = "错误:";
+ //PV.Cancel.Visibility = Visibility.Collapsed;
break;
case DialogType.Information:
PV.TextBlockIcon = "";
PV.TextBlockForeground = Brushes.DeepSkyBlue;
- PV.TextBlockInfo = $"提示:{info}";
- PV.Cancel.Visibility = Visibility.Visible;
+ PV.infoType.Text = "提示:";
+ //PV.Cancel.Visibility = Visibility.Visible;
break;
default:
break;
}
+ PV.infoType.Foreground = PV.TextBlockForeground;
var res = PV.ShowDialog();
return res == null ? false : (bool)res;
}
diff --git a/BPASmartClient.CustomResource/Pages/View/PromptView.xaml b/BPASmartClient.CustomResource/Pages/View/PromptView.xaml
index 1892c83b..f3e888b0 100644
--- a/BPASmartClient.CustomResource/Pages/View/PromptView.xaml
+++ b/BPASmartClient.CustomResource/Pages/View/PromptView.xaml
@@ -29,7 +29,7 @@
-
+
@@ -44,24 +44,31 @@
BorderThickness="0"
Click="Button_Click" />
-
+
+
-
+
@@ -77,7 +84,7 @@
Width="90"
Height="30"
Margin="5,0,5,0"
- Click="Cancel_Click"
+ Click="Cancel_Click"
Content="取消"
FontSize="20"
Style="{StaticResource ImageButtonStyle}" />
@@ -98,10 +105,5 @@
-
-
-
-
-
diff --git a/BPASmartClient.CustomResource/Pages/View/PromptView.xaml.cs b/BPASmartClient.CustomResource/Pages/View/PromptView.xaml.cs
index e8d5fc3e..ffef6c16 100644
--- a/BPASmartClient.CustomResource/Pages/View/PromptView.xaml.cs
+++ b/BPASmartClient.CustomResource/Pages/View/PromptView.xaml.cs
@@ -23,6 +23,7 @@ namespace BPASmartClient.CustomResource.Pages.View
public PromptView()
{
InitializeComponent();
+ this.main.MouseLeftButtonDown += (o, e) => { if (e.LeftButton == MouseButtonState.Pressed) this.DragMove(); };
}
public string TextBlockIcon
diff --git a/BPASmartClient.CustomResource/UserControls/ConveyBelt2.xaml b/BPASmartClient.CustomResource/UserControls/ConveyBelt2.xaml
index 19924a19..b75ede12 100644
--- a/BPASmartClient.CustomResource/UserControls/ConveyBelt2.xaml
+++ b/BPASmartClient.CustomResource/UserControls/ConveyBelt2.xaml
@@ -1,16 +1,73 @@
-
-
+
+
+
+
+
+
-
+
-
-
+
-
+
-
+
-
-
-
-
diff --git a/BPASmartClient.CustomResource/UserControls/MaterialStock.xaml b/BPASmartClient.CustomResource/UserControls/MaterialStock.xaml
index bde8d31a..5c1e433b 100644
--- a/BPASmartClient.CustomResource/UserControls/MaterialStock.xaml
+++ b/BPASmartClient.CustomResource/UserControls/MaterialStock.xaml
@@ -1,80 +1,25 @@
-
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/BPASmartClient.DosingProject/Model/RawMaterial/DeviceInquire.cs b/BPASmartClient.DosingProject/Model/RawMaterial/DeviceInquire.cs
index 56040b5c..c4ff9f55 100644
--- a/BPASmartClient.DosingProject/Model/RawMaterial/DeviceInquire.cs
+++ b/BPASmartClient.DosingProject/Model/RawMaterial/DeviceInquire.cs
@@ -210,7 +210,7 @@ namespace BPASmartClient.DosingHKProject.Model
{
if (Global.DeviceRawMaterials.FirstOrDefault(p => p.RawMaterialName == DeviceName) == null)
{
- Global.DeviceRawMaterials.Add(new RawMaterialModel() { RawMaterialName = DeviceName, DeviceIp = ip, RawMaterialSource = 1});
+ Global.DeviceRawMaterials.Add(new RawMaterialModel() { RawMaterialName = DeviceName, DeviceIp = ip, RawMaterialSource = 1 });
}
}
else
diff --git a/BPASmartClient.Modbus/ModbusTcp.cs b/BPASmartClient.Modbus/ModbusTcp.cs
index 8734228e..fac46761 100644
--- a/BPASmartClient.Modbus/ModbusTcp.cs
+++ b/BPASmartClient.Modbus/ModbusTcp.cs
@@ -567,7 +567,7 @@ namespace BPASmartClient.Modbus
}
catch (Exception ex)
{
- MessageLog.GetInstance.Show(ex.ToString());
+ ShowEx?.Invoke(ex.ToString());
tcpClient = null;
Connect();
}
diff --git a/BPASmartClient.Model/柔性味魔方/RawMaterialModel.cs b/BPASmartClient.Model/柔性味魔方/RawMaterialModel.cs
index 71f0229f..ef1173e2 100644
--- a/BPASmartClient.Model/柔性味魔方/RawMaterialModel.cs
+++ b/BPASmartClient.Model/柔性味魔方/RawMaterialModel.cs
@@ -38,6 +38,15 @@ namespace BPASmartClient.Model
public ushort RawMaterialSource { get { return _mRawMaterialSource; } set { _mRawMaterialSource = value; OnPropertyChanged(); } }
private ushort _mRawMaterialSource;
+
+ ///
+ /// 选中索引
+ ///
+ [Newtonsoft.Json.JsonIgnore]
+ public int SelectIndex { get { return _mSelectIndex; } set { _mSelectIndex = value; OnPropertyChanged(); } }
+ private int _mSelectIndex;
+
+
///
/// 原料类型 MW18
/// 1:液体
diff --git a/BPASmartClient.SmallBatchingSystem/ViewModels/NewRecipeViewModel.cs b/BPASmartClient.SmallBatchingSystem/ViewModels/NewRecipeViewModel.cs
index 5764539e..6c49bdd9 100644
--- a/BPASmartClient.SmallBatchingSystem/ViewModels/NewRecipeViewModel.cs
+++ b/BPASmartClient.SmallBatchingSystem/ViewModels/NewRecipeViewModel.cs
@@ -22,7 +22,7 @@ namespace BPASmartClient.SmallBatchingSystem.ViewModels
RecipeName = tempRecipeInfo.RecipeName;
tempRecipeInfo.SiloInfoModels.ToList()?.ForEach(item =>
{
- int tempIndex = Array.FindIndex(SileName.ToArray(), p => p.Contains(item.SiloName));
+ int tempIndex = Array.FindIndex(SileName.ToArray(), p => p == item.SiloName);
SiloInfos.Add(new RecipeRawMaterialInfo() { SiloName = item.SiloName, SiloWeight = item.SiloWeight, SelectIndex = tempIndex });
});
Index = Array.FindIndex(Json.Data.Recipes.ToArray(), p => p.RecipeName == tempRecipeInfo.RecipeName);
diff --git a/DosingSystem/App.xaml.cs b/DosingSystem/App.xaml.cs
index c082611c..1d35aca8 100644
--- a/DosingSystem/App.xaml.cs
+++ b/DosingSystem/App.xaml.cs
@@ -11,7 +11,6 @@ using BPASmartClient.CustomResource.Pages.Enums;
using BPASmartClient.CustomResource.Pages.Model;
using BPASmartClient.CustomResource.Pages.View;
using BPASmartClient.CustomResource.Pages.ViewModel;
-using BPASmartClient.DosingSystem.Model;
using BPASmartClient.DosingSystem.View;
using BPASmartClient.Helper;
using BPASmartClient.Nfc;
@@ -27,10 +26,12 @@ namespace BPASmartClient.DosingSystem
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
+ BPASmartClient.Helper.SystemHelper.GetInstance.CreateDesktopShortcut();
MenuInit();
DataInit();
DeviceInquire.GetInstance.Init();//配料机设备上线监听,设备列表初始化
MainView mv = new MainView();
+
//mv.Show();
LoginView lv = new LoginView();
var res = lv.ShowDialog();
@@ -55,7 +56,7 @@ namespace BPASmartClient.DosingSystem
private void MenuInit()
{
- NfcServer.GetInstance.Init();
+ //NfcServer.GetInstance.Init();
#region 配方管理菜单
ObservableCollection RecipeManage = new ObservableCollection();
diff --git a/DosingSystem/Model/ActionMenu.cs b/DosingSystem/Model/ActionMenu.cs
deleted file mode 100644
index 00113337..00000000
--- a/DosingSystem/Model/ActionMenu.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Microsoft.Toolkit.Mvvm.ComponentModel;
-using Microsoft.Toolkit.Mvvm.Input;
-
-namespace BPASmartClient.DosingSystem.Model
-{
- public class ActionMenu : ObservableObject
- {
- public string CommandParameter { get { return _mCommandParameter; } set { _mCommandParameter = value; OnPropertyChanged(); } }
- private string _mCommandParameter;
-
- //public Permission[] permission { get { return _mpermission; } set { _mpermission = value; OnPropertyChanged(); } }
- //private Permission[] _mpermission;
-
- public string MenuName { get { return _mMenuName; } set { _mMenuName = value; OnPropertyChanged(); } }
- private string _mMenuName;
-
-
- //public string NameSpace { get { return _mNameSpace; } set { _mNameSpace = value; OnPropertyChanged(); } }
- //private string _mNameSpace;
-
-
- }
-}
diff --git a/DosingSystem/Model/AlarmInfo.cs b/DosingSystem/Model/AlarmInfo.cs
index 00dd0772..7944fa96 100644
--- a/DosingSystem/Model/AlarmInfo.cs
+++ b/DosingSystem/Model/AlarmInfo.cs
@@ -5,7 +5,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
-namespace BPASmartClient.DosingSystem.Model
+namespace BPASmartClient.DosingSystem
{
public class AlarmInfo
{
diff --git a/DosingSystem/Model/ConveyorServer.cs b/DosingSystem/Model/ConveyorServer.cs
deleted file mode 100644
index f2b36ed3..00000000
--- a/DosingSystem/Model/ConveyorServer.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Microsoft.Toolkit.Mvvm.ComponentModel;
-
-namespace BPASmartClient.DosingSystem.Model
-{
- public class ConveyorServer
- {
- public ConveyorServer()
- {
-
- }
- }
-}
diff --git a/DosingSystem/Model/CylinderStatusModel.cs b/DosingSystem/Model/CylinderStatusModel.cs
index 6c43e5b6..8e94d96b 100644
--- a/DosingSystem/Model/CylinderStatusModel.cs
+++ b/DosingSystem/Model/CylinderStatusModel.cs
@@ -5,7 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;
-namespace BPASmartClient.DosingSystem.Model
+namespace BPASmartClient.DosingSystem
{
public class CylinderStatusModel : ObservableObject
{
diff --git a/DosingSystem/Model/DeviceAddress.cs b/DosingSystem/Model/DeviceAddress.cs
index e0653f23..e2d5530f 100644
--- a/DosingSystem/Model/DeviceAddress.cs
+++ b/DosingSystem/Model/DeviceAddress.cs
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
-namespace BPASmartClient.DosingSystem.Model
+namespace BPASmartClient.DosingSystem
{
public class DeviceAddress
{
diff --git a/DosingSystem/Model/DeviceCurrentStatus.cs b/DosingSystem/Model/DeviceCurrentStatus.cs
index 6a727d95..e1854196 100644
--- a/DosingSystem/Model/DeviceCurrentStatus.cs
+++ b/DosingSystem/Model/DeviceCurrentStatus.cs
@@ -5,7 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;
-namespace BPASmartClient.DosingSystem.Model
+namespace BPASmartClient.DosingSystem
{
public class DeviceCurrentStatus : ObservableObject
{
diff --git a/DosingSystem/Model/DeviceInquire.cs b/DosingSystem/Model/DeviceInquire.cs
index 6472b679..a6570bd1 100644
--- a/DosingSystem/Model/DeviceInquire.cs
+++ b/DosingSystem/Model/DeviceInquire.cs
@@ -12,7 +12,7 @@ using System.Net.NetworkInformation;
using System.Threading;
using System.Threading.Tasks;
-namespace BPASmartClient.DosingSystem.Model
+namespace BPASmartClient.DosingSystem
{
public class DeviceInquire
{
@@ -71,7 +71,11 @@ namespace BPASmartClient.DosingSystem.Model
DeviceNum = i + 1,
Weight = new Random().Next(100, 10000) / 100.0
});
-
+ Global.DeviceRawMaterials.Add(new RawMaterialModel()
+ {
+ DeviceIp = $"192.168.1.{i + 1}",
+ RawMaterialName = $"测试设备{i + 1}",
+ });
devices.Add(new Devices()
{
DeviceName = $"测试设备{i + 1}",
@@ -87,7 +91,11 @@ namespace BPASmartClient.DosingSystem.Model
DeviceNum = i + 1,
Weight = new Random().Next(100, 10000) / 100.0
});
-
+ Global.DeviceRawMaterials.Add(new RawMaterialModel()
+ {
+ DeviceIp = $"192.168.1.{i + 1}",
+ RawMaterialName = $"测试设备{i + 1}",
+ });
devices.Add(new Devices()
{
DeviceName = $"测试设备{i + 1}",
@@ -337,7 +345,7 @@ namespace BPASmartClient.DosingSystem.Model
if (modbusTcp.Connected)
{
modbusTcp.SetReal(DeviceAddress.WeightSet, Value);//写入配方量
- string returnValue = modbusTcp.Write(DeviceAddress.Start, (ushort)1);//设备启动写入
+ modbusTcp.Write(DeviceAddress.Start, (ushort)1);//设备启动写入
//配料设备参数写入
var res = Json.Data.deviceParModels.FirstOrDefault(p => p.MaterialName == DeviceName);
if (res != null)
diff --git a/DosingSystem/Model/DevicePar.cs b/DosingSystem/Model/DevicePar.cs
index 715f4e2b..f59897ad 100644
--- a/DosingSystem/Model/DevicePar.cs
+++ b/DosingSystem/Model/DevicePar.cs
@@ -6,7 +6,7 @@ using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using System.Collections.ObjectModel;
-namespace BPASmartClient.DosingSystem.Model
+namespace BPASmartClient.DosingSystem
{
public class DevicePar
{
diff --git a/DosingSystem/Model/DeviceParModel.cs b/DosingSystem/Model/DeviceParModel.cs
index f7400050..c9dfe67f 100644
--- a/DosingSystem/Model/DeviceParModel.cs
+++ b/DosingSystem/Model/DeviceParModel.cs
@@ -5,7 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;
-namespace BPASmartClient.DosingSystem.Model
+namespace BPASmartClient.DosingSystem
{
public class DeviceParModel : ObservableObject
{
diff --git a/DosingSystem/Model/GlobalData.cs b/DosingSystem/Model/GlobalData.cs
deleted file mode 100644
index 6a6904de..00000000
--- a/DosingSystem/Model/GlobalData.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-using BPASmartClient.Model;
-using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace BPASmartClient.DosingSystem.Model
-{
- public class GlobalData
- {
-
- }
-}
diff --git a/DosingSystem/Model/LocaPar.cs b/DosingSystem/Model/LocaPar.cs
index cd848da0..992f898f 100644
--- a/DosingSystem/Model/LocaPar.cs
+++ b/DosingSystem/Model/LocaPar.cs
@@ -7,12 +7,12 @@ using System.Collections.ObjectModel;
using BPASmartClient.DosingSystem.ViewModel;
using BPASmartClient.Model;
-namespace BPASmartClient.DosingSystem.Model
+namespace BPASmartClient.DosingSystem
{
public class LocaPar
{
public ObservableCollection Recipes { get; set; } = new ObservableCollection();
-
+
}
}
diff --git a/DosingSystem/Model/RawMaterialDeviceStatus.cs b/DosingSystem/Model/RawMaterialDeviceStatus.cs
index 777fe2a3..6d218b33 100644
--- a/DosingSystem/Model/RawMaterialDeviceStatus.cs
+++ b/DosingSystem/Model/RawMaterialDeviceStatus.cs
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
-namespace BPASmartClient.DosingSystem.Model
+namespace BPASmartClient.DosingSystem
{
public class RawMaterialDeviceStatus
{
diff --git a/DosingSystem/Model/RecipeModel.cs b/DosingSystem/Model/RecipeModel.cs
index a29ee2a5..df6e89b2 100644
--- a/DosingSystem/Model/RecipeModel.cs
+++ b/DosingSystem/Model/RecipeModel.cs
@@ -8,7 +8,7 @@ using System.Threading.Tasks;
using BPASmartClient.Model;
using Microsoft.Toolkit.Mvvm.ComponentModel;
-namespace BPASmartClient.DosingSystem.Model
+namespace BPASmartClient.DosingSystem
{
///
/// 配方模块
diff --git a/DosingSystem/Model/RecipeProcess.cs b/DosingSystem/Model/RecipeProcess.cs
index 23864689..9de11200 100644
--- a/DosingSystem/Model/RecipeProcess.cs
+++ b/DosingSystem/Model/RecipeProcess.cs
@@ -5,7 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;
-namespace BPASmartClient.DosingSystem.Model
+namespace BPASmartClient.DosingSystem
{
public class RecipeProcess : ObservableObject
{
diff --git a/DosingSystem/Model/StockStatusModel.cs b/DosingSystem/Model/StockStatusModel.cs
index 9f41139c..2470c0c0 100644
--- a/DosingSystem/Model/StockStatusModel.cs
+++ b/DosingSystem/Model/StockStatusModel.cs
@@ -5,15 +5,15 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
-namespace BPASmartClient.DosingSystem.Model
+namespace BPASmartClient.DosingSystem
{
- internal class StockStatusModel:ObservableObject
+ public class StockStatusModel : ObservableObject
{
///
/// 料仓物料重量
///
private double _materialWeight;
- public double MaterialWeight { get { return _materialWeight; } set { _materialWeight = value;OnPropertyChanged(); } }
+ public double MaterialWeight { get { return _materialWeight; } set { _materialWeight = value; OnPropertyChanged(); } }
///
/// 料仓物料名称
///
@@ -30,6 +30,13 @@ namespace BPASmartClient.DosingSystem.Model
private bool _isLayOff;
public bool IsLayOff { get { return _isLayOff; } set { _isLayOff = value; OnPropertyChanged(); } }
+ ///
+ /// 打开状态
+ ///
+ public bool IsOpen { get { return _mIsOpen; } set { _mIsOpen = value; OnPropertyChanged(); } }
+ private bool _mIsOpen;
+
+
///
/// 是否故障报警
///
diff --git a/DosingSystem/Model/ViewModelBase.cs b/DosingSystem/Model/ViewModelBase.cs
new file mode 100644
index 00000000..ae5f8e17
--- /dev/null
+++ b/DosingSystem/Model/ViewModelBase.cs
@@ -0,0 +1,27 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Microsoft.Toolkit.Mvvm.ComponentModel;
+using Microsoft.Toolkit.Mvvm.Input;
+using System.Collections.ObjectModel;
+
+namespace BPASmartClient.DosingSystem
+{
+ public class ViewModelBase : ObservableObject
+ {
+ public int Index { get; set; } = -1;
+ public RelayCommand AddCommand { get; set; }//添加
+ public RelayCommand CancelCommand { get; set; }//取消
+ public RelayCommand SaveCommand { get; set; }//保存
+ public RelayCommand
diff --git a/DosingSystem/View/DeviceListView.xaml b/DosingSystem/View/DeviceListView.xaml
index 384d0606..c1713812 100644
--- a/DosingSystem/View/DeviceListView.xaml
+++ b/DosingSystem/View/DeviceListView.xaml
@@ -126,7 +126,7 @@
Height="30"
Margin="0,0,0,0"
VerticalAlignment="Top"
- Command="{Binding DataContext.ChangeNameCommand, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}"
+ Command="{Binding DataContext.DetailsCommand, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}"
CommandParameter="{Binding IpAddress}"
Content="修改原料名称"
FontSize="16"
diff --git a/DosingSystem/View/ManualControlView.xaml b/DosingSystem/View/ManualControlView.xaml
index a4d1114c..0d0a181b 100644
--- a/DosingSystem/View/ManualControlView.xaml
+++ b/DosingSystem/View/ManualControlView.xaml
@@ -52,328 +52,311 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ Source="/BPASmartClient.CustomResource;component/Image/标签.png" />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/DosingSystem/View/ManualControlView.xaml.cs b/DosingSystem/View/ManualControlView.xaml.cs
index 3cd21a96..9922bd73 100644
--- a/DosingSystem/View/ManualControlView.xaml.cs
+++ b/DosingSystem/View/ManualControlView.xaml.cs
@@ -23,6 +23,14 @@ namespace BPASmartClient.DosingSystem.View
public ManualControlView()
{
InitializeComponent();
+ this.SizeChanged += ManualControlView_SizeChanged;
+ }
+
+ private void ManualControlView_SizeChanged(object sender, SizeChangedEventArgs e)
+ {
+ this.cy.Height = this.list1.ActualHeight + 40;
+ this.zd.Height = this.list2.ActualHeight + 40;
+ this.tp.Height = this.list3.ActualHeight + 40;
}
}
}
diff --git a/DosingSystem/View/NewRecipeView.xaml b/DosingSystem/View/NewRecipeView.xaml
index bd04e1ed..605bb4fa 100644
--- a/DosingSystem/View/NewRecipeView.xaml
+++ b/DosingSystem/View/NewRecipeView.xaml
@@ -173,7 +173,7 @@
Foreground="#FF2AB2E7"
IsEditable="False"
ItemsSource="{Binding DataContext.RawMaterialNames, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}"
- SelectedIndex="0"
+ SelectedIndex="{Binding SelectIndex}"
Style="{StaticResource ComboBoxStyle}"
Text="{Binding RawMaterialName}" />
diff --git a/DosingSystem/View/RecipeSettingsView.xaml b/DosingSystem/View/RecipeSettingsView.xaml
index 1b77b734..dfeb3154 100644
--- a/DosingSystem/View/RecipeSettingsView.xaml
+++ b/DosingSystem/View/RecipeSettingsView.xaml
@@ -101,10 +101,11 @@
ScrollViewer.HorizontalScrollBarVisibility="Disabled">
-
+ Columns="8" />-->
+
@@ -113,6 +114,7 @@
@@ -252,7 +254,7 @@
Background="#11F53F62"
BorderThickness="0"
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ListBox, Mode=FindAncestor}}"
- CommandParameter="{Binding RecipCode}"
+ CommandParameter="{Binding RecipeName}"
Content="删除"
EnterBackground="#22F53F62"
FontStyle="Normal"
@@ -270,7 +272,7 @@
Background="#112AB2E7"
BorderThickness="0"
Command="{Binding DataContext.DetailsCommand, RelativeSource={RelativeSource AncestorType=ListBox, Mode=FindAncestor}}"
- CommandParameter="{Binding RecipCode}"
+ CommandParameter="{Binding RecipeName}"
Content="编辑"
EnterBackground="#222AB2E7"
Foreground="#FF2AB2E7"
diff --git a/DosingSystem/View/RecipeSettingsView.xaml.cs b/DosingSystem/View/RecipeSettingsView.xaml.cs
index d13a3baa..55bf6e65 100644
--- a/DosingSystem/View/RecipeSettingsView.xaml.cs
+++ b/DosingSystem/View/RecipeSettingsView.xaml.cs
@@ -1,4 +1,5 @@
-using System;
+using BPA.Helper;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
@@ -24,6 +25,12 @@ namespace BPASmartClient.DosingSystem.View
public RecipeSettingsView()
{
InitializeComponent();
+ this.Unloaded += RecipeSettingsView_Unloaded;
+ }
+
+ private void RecipeSettingsView_Unloaded(object sender, RoutedEventArgs e)
+ {
+ Json.Save();
}
//public static void SetAlignment()
diff --git a/DosingSystem/View/StockControlView.xaml b/DosingSystem/View/StockControlView.xaml
index e0d10533..2431bb98 100644
--- a/DosingSystem/View/StockControlView.xaml
+++ b/DosingSystem/View/StockControlView.xaml
@@ -1,37 +1,82 @@
-
+
+
+
+
+
+
-
+
-
-
-
+
+
+
-
-
+
+
+ ItemsSource="{Binding statusTop}"
+ ScrollViewer.HorizontalScrollBarVisibility="Disabled"
+ ScrollViewer.VerticalScrollBarVisibility="Disabled">
-
@@ -39,107 +84,109 @@
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
-
-
-
-
+
-
@@ -147,50 +194,37 @@
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
+
diff --git a/DosingSystem/ViewModel/ChangeDeviceNameViewModel.cs b/DosingSystem/ViewModel/ChangeDeviceNameViewModel.cs
index 2d011145..d51d91bc 100644
--- a/DosingSystem/ViewModel/ChangeDeviceNameViewModel.cs
+++ b/DosingSystem/ViewModel/ChangeDeviceNameViewModel.cs
@@ -4,14 +4,14 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BPASmartClient.Helper;
-using BPASmartClient.DosingSystem.Model;
+
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using BPASmartClient.CustomResource.Pages.Model;
namespace BPASmartClient.DosingSystem.ViewModel
{
- public class ChangeDeviceNameViewModel : ObservableObject
+ public class ChangeDeviceNameViewModel : ViewModelBase
{
public ChangeDeviceNameViewModel()
{
@@ -20,8 +20,8 @@ namespace BPASmartClient.DosingSystem.ViewModel
if (o != null && o is string str) IpAddress = str;
}), "ChangeDeviceNameViewOpen");
- CancleCommand = new RelayCommand(() => { ActionManage.GetInstance.Send("ChangeDeviceNameViewClose"); });
- ConfirmCommand = new RelayCommand(() =>
+ CancelCommand = new RelayCommand(() => { ActionManage.GetInstance.Send("ChangeDeviceNameViewClose"); });
+ AddCommand = new RelayCommand(() =>
{
if (string.IsNullOrEmpty(DeviceName))
{
@@ -58,13 +58,13 @@ namespace BPASmartClient.DosingSystem.ViewModel
private static string IpAddress = string.Empty;
- public RelayCommand ConfirmCommand { get; set; }
+ //public RelayCommand ConfirmCommand { get; set; }
- public RelayCommand CancleCommand { get; set; }
+ //public RelayCommand CancleCommand { get; set; }
- public string ErrorInfo { get { return _mErrorInfo; } set { _mErrorInfo = value; OnPropertyChanged(); } }
- private string _mErrorInfo;
+ //public string ErrorInfo { get { return _mErrorInfo; } set { _mErrorInfo = value; OnPropertyChanged(); } }
+ //private string _mErrorInfo;
public string DeviceName { get { return _mDeviceName; } set { _mDeviceName = value; OnPropertyChanged(); } }
diff --git a/DosingSystem/ViewModel/DeviceListViewModel.cs b/DosingSystem/ViewModel/DeviceListViewModel.cs
index bcefd24d..234a50fd 100644
--- a/DosingSystem/ViewModel/DeviceListViewModel.cs
+++ b/DosingSystem/ViewModel/DeviceListViewModel.cs
@@ -10,15 +10,15 @@ using System.Windows;
using BPASmartClient.Helper;
using Microsoft.Toolkit.Mvvm.Input;
using BPASmartClient.DosingSystem.View;
-using BPASmartClient.DosingSystem.Model;
+
namespace BPASmartClient.DosingSystem.ViewModel
{
- public class DeviceListViewModel : ObservableObject
+ public class DeviceListViewModel : ViewModelBase
{
public DeviceListViewModel()
{
- ChangeNameCommand = new RelayCommand((o) =>
+ DetailsCommand = new RelayCommand((o) =>
{
if (o != null && o is string str)
{
@@ -30,7 +30,7 @@ namespace BPASmartClient.DosingSystem.ViewModel
devices = DeviceInquire.GetInstance.devices;
}
- public RelayCommand ChangeNameCommand { get; set; }
+ //public RelayCommand ChangeNameCommand { get; set; }
//public static ObservableCollection devices { get; set; } = new ObservableCollection();
public ObservableCollection devices { get; set; }
diff --git a/DosingSystem/ViewModel/DeviceMaterialParViewModel.cs b/DosingSystem/ViewModel/DeviceMaterialParViewModel.cs
index c71fbe5d..e4f02028 100644
--- a/DosingSystem/ViewModel/DeviceMaterialParViewModel.cs
+++ b/DosingSystem/ViewModel/DeviceMaterialParViewModel.cs
@@ -5,7 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using System.Collections.ObjectModel;
-using BPASmartClient.DosingSystem.Model;
+
using BPASmartClient.Helper;
using Microsoft.Toolkit.Mvvm.Input;
using BPASmartClient.CustomResource.UserControls.MessageShow;
@@ -14,7 +14,7 @@ using System.Diagnostics;
namespace BPASmartClient.DosingSystem.ViewModel
{
- public class DeviceMaterialParViewModel : ObservableObject
+ public class DeviceMaterialParViewModel : ViewModelBase
{
public DeviceMaterialParViewModel()
{
@@ -60,10 +60,10 @@ namespace BPASmartClient.DosingSystem.ViewModel
public ObservableCollection deviceParModels { get; set; }
- public RelayCommand RemoveCommand { get; set; }
+ //public RelayCommand RemoveCommand { get; set; }
- public RelayCommand AddCommand { get; set; }
- public RelayCommand SaveCommand { get; set; }
+ //public RelayCommand AddCommand { get; set; }
+ //public RelayCommand SaveCommand { get; set; }
}
}
diff --git a/DosingSystem/ViewModel/HardwareStatusViewModel.cs b/DosingSystem/ViewModel/HardwareStatusViewModel.cs
index cd722046..35f77703 100644
--- a/DosingSystem/ViewModel/HardwareStatusViewModel.cs
+++ b/DosingSystem/ViewModel/HardwareStatusViewModel.cs
@@ -9,7 +9,7 @@ using System.Collections.ObjectModel;
using System.Windows;
using BPASmartClient.Helper;
using Microsoft.Toolkit.Mvvm.Input;
-using BPASmartClient.DosingSystem.Model;
+
namespace BPASmartClient.DosingSystem.ViewModel
{
diff --git a/DosingSystem/ViewModel/NewMaterialViewModel.cs b/DosingSystem/ViewModel/NewMaterialViewModel.cs
index 2443d389..590b6eca 100644
--- a/DosingSystem/ViewModel/NewMaterialViewModel.cs
+++ b/DosingSystem/ViewModel/NewMaterialViewModel.cs
@@ -1,5 +1,5 @@
using BPASmartClient.CustomResource.Pages.Model;
-using BPASmartClient.DosingSystem.Model;
+
using BPASmartClient.Helper;
using BPASmartClient.Model;
using Microsoft.Toolkit.Mvvm.ComponentModel;
@@ -13,28 +13,28 @@ using System.Threading.Tasks;
namespace BPASmartClient.DosingSystem.ViewModel;
-public class NewMaterialViewModel:ObservableObject
+public class NewMaterialViewModel : ViewModelBase
{
public ObservableCollection Materials { get; set; } = Json.Data.LocalMaterails;
public string MaterialName { get { return _materialName; } set { _materialName = value; OnPropertyChanged(); } }
private string _materialName = string.Empty;
- public string ErrorInfo { get { return _mErrorInfo; } set { _mErrorInfo = value; OnPropertyChanged(); } }
- private string _mErrorInfo;
+ //public string ErrorInfo { get { return _mErrorInfo; } set { _mErrorInfo = value; OnPropertyChanged(); } }
+ //private string _mErrorInfo;
- public RelayCommand RemoveCommand { get; set; }
+ //public RelayCommand RemoveCommand { get; set; }
- public RelayCommand SaveCommand { get; set; }
+ //public RelayCommand SaveCommand { get; set; }
private void Remove(object o)
{
if (o == null) return;
- if(o is string id)
+ if (o is string id)
{
- var res = Materials.FirstOrDefault(p=>p.RawMaterialId == id);
+ var res = Materials.FirstOrDefault(p => p.RawMaterialId == id);
Materials.Remove(res);
Json.Save();
MessageLog.GetInstance.ShowUserLog($"删除原料--{res.RawMaterialName}");
@@ -47,10 +47,10 @@ public class NewMaterialViewModel:ObservableObject
SaveCommand = new RelayCommand(() =>
{
- if(MaterialName == String.Empty) { ErrorInfo = "原料名称不能为空";return; }
- if(Global.DeviceRawMaterials.FirstOrDefault(p=>p.RawMaterialName == MaterialName) != null) { ErrorInfo = "设备中已存在该原料名称";return;}
- if(Json.Data.LocalMaterails.FirstOrDefault(p=>p.RawMaterialName == MaterialName) != null) { ErrorInfo = "本地原料名称重复";return ;}
- Json.Data.LocalMaterails.Add(new RawMaterialModel { RawMaterialName = MaterialName, RawMaterialId = Guid.NewGuid().ToString() , RawMaterialSource = 0 });
+ if (MaterialName == String.Empty) { ErrorInfo = "原料名称不能为空"; return; }
+ if (Global.DeviceRawMaterials.FirstOrDefault(p => p.RawMaterialName == MaterialName) != null) { ErrorInfo = "设备中已存在该原料名称"; return; }
+ if (Json.Data.LocalMaterails.FirstOrDefault(p => p.RawMaterialName == MaterialName) != null) { ErrorInfo = "本地原料名称重复"; return; }
+ Json.Data.LocalMaterails.Add(new RawMaterialModel { RawMaterialName = MaterialName, RawMaterialId = Guid.NewGuid().ToString(), RawMaterialSource = 0 });
Json.Save();
MessageLog.GetInstance.ShowUserLog($"添加原料--{MaterialName}");
});
diff --git a/DosingSystem/ViewModel/NewRecipeViewModel.cs b/DosingSystem/ViewModel/NewRecipeViewModel.cs
index 4e51c28a..cc72812b 100644
--- a/DosingSystem/ViewModel/NewRecipeViewModel.cs
+++ b/DosingSystem/ViewModel/NewRecipeViewModel.cs
@@ -7,13 +7,14 @@ using Microsoft.Toolkit.Mvvm.ComponentModel;
using System.Collections.ObjectModel;
using Microsoft.Toolkit.Mvvm.Input;
using BPASmartClient.Helper;
-using BPASmartClient.DosingSystem.Model;
using BPASmartClient.CustomResource.Pages.Model;
using BPASmartClient.Model;
+using BPASmartClient.CustomResource.UserControls.MessageShow;
+using BPASmartClient.CustomResource.UserControls;
namespace BPASmartClient.DosingSystem.ViewModel
{
- public class NewRecipeViewModel : ObservableObject
+ public class NewRecipeViewModel : ViewModelBase
{
public NewRecipeViewModel()
{
@@ -24,11 +25,13 @@ namespace BPASmartClient.DosingSystem.ViewModel
RecipeName = rm.RecipeName;
foreach (var item in rm.RawMaterials)
{
+ item.SelectIndex = Array.FindIndex(RawMaterialNames.ToArray(), p => p == item.RawMaterialName);
RawMaterials.Add(item);
}
RecipCode = rm.RecipCode;
+ Index = Array.FindIndex(Json.Data.Recipes.ToArray(), p => p.RecipeName == RecipeName);
}
- }), "Details");
+ }), "Details", true);
AddCommand = new RelayCommand(() =>
{
@@ -55,72 +58,88 @@ namespace BPASmartClient.DosingSystem.ViewModel
SaveCommand = new RelayCommand(() =>
{
- ErrorInfo = String.Empty;
- if (RecipeName == String.Empty) { ErrorInfo = "配方名称未填写"; return; }
- for (int i = 0; i < RawMaterials.Count; i++)
- {
- var res = DeviceInquire.GetInstance.devices.FirstOrDefault(p => p.DeviceName == RawMaterials.ElementAt(i).RawMaterialName);
- 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 (string.IsNullOrEmpty(RecipeName)) { ErrorInfo = "请输入配方名称"; return; }
- if (RecipCode.Length <= 0)//新建配方
+ //编辑配方
+ if (Index >= 0 && Index < Json.Data.Recipes.Count)
{
var res = Array.FindIndex(Json.Data.Recipes.ToArray(), p => p.RecipeName == RecipeName);
-
- if (res >= 0 && res < Json.Data.Recipes.Count)
+ if (res >= 0 && res != Index)
{
- ErrorInfo = "该配方已存在,请重新输入";
+ ErrorInfo = "配方名称已经存在!";
+ return;
}
- else
+ Json.Data.Recipes.ElementAt(Index).RecipeName = RecipeName;
+ Json.Data.Recipes.ElementAt(Index).RawMaterials.Clear();
+ RawMaterials.ToList()?.ForEach(item =>
{
- AddRecipes();
- }
+ Json.Data.Recipes.ElementAt(Index).RawMaterials.Add(item);
+ });
+ Json.Save();
+ NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"{RecipeName} 配方编辑完成");
}
- else//修改配方
+ else //新建配方
{
- var res = Array.FindIndex(Json.Data.Recipes.ToArray(), p => p.RecipCode == RecipCode);
- if (res >= 0 && res < Json.Data.Recipes.Count)
+ if (Json.Data.Recipes.FirstOrDefault(p => p.RecipeName == RecipeName) != null)
{
- Json.Data.Recipes.ElementAt(res).RecipeName = RecipeName;
- Json.Data.Recipes.ElementAt(res).RawMaterials.Clear();
- foreach (var item in RawMaterials)
- {
- Json.Data.Recipes.ElementAt(res).RawMaterials.Add(item);
- }
+ ErrorInfo = "配方名称已存在!";
+ return;
}
+
+ Json.Data.Recipes.Add(new RecipeModel()
+ {
+ RecipeName = RecipeName,
+ RawMaterials = RawMaterials,
+ });
+ Json.Save();
+ NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"新建配方成功!");
}
+
+ //for (int i = 0; i < RawMaterials.Count; i++)
+ //{
+ // var res = DeviceInquire.GetInstance.devices.FirstOrDefault(p => p.DeviceName == RawMaterials.ElementAt(i).RawMaterialName);
+ // 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)//新建配方
+ //{
+ // var res = Array.FindIndex(Json.Data.Recipes.ToArray(), p => p.RecipeName == RecipeName);
+
+ // if (res >= 0 && res < Json.Data.Recipes.Count)
+ // {
+ // ErrorInfo = "该配方已存在,请重新输入";
+ // }
+ // else
+ // {
+ // AddRecipes();
+ // }
+ //}
+ //else//修改配方
+ //{
+ // var res = Array.FindIndex(Json.Data.Recipes.ToArray(), p => p.RecipCode == RecipCode);
+ // if (res >= 0 && res < Json.Data.Recipes.Count)
+ // {
+ // Json.Data.Recipes.ElementAt(res).RecipeName = RecipeName;
+ // Json.Data.Recipes.ElementAt(res).RawMaterials.Clear();
+ // foreach (var item in RawMaterials)
+ // {
+ // Json.Data.Recipes.ElementAt(res).RawMaterials.Add(item);
+ // }
+ // }
+ //}
ActionManage.GetInstance.Send("CloseNewRecipeView");
});
- //RawMaterialNames.Add("乳化剂");
- //RawMaterialNames.Add("酶制剂");
- //RawMaterialNames.Add("增味剂");
-
-
- //RawMaterialNames.Add("营养强化剂");
- //RawMaterialNames.Add("抗结剂");
- //RawMaterialNames.Add("消泡剂");
- //RawMaterialNames.Add("膨松剂");
- //RawMaterialNames.Add("防腐剂");
- //RawMaterialNames.Add("着色剂");
- //RawMaterialNames.Add("甜味剂");
- //RawMaterialNames.Add("酸味剂");
- //RawMaterialNames.Add("增白剂");
- //RawMaterialNames.Add("香料");
- //RawMaterialNames.Add("抗氧化剂");
- //RawMaterialNames.Add("食用香料");
- //RawMaterialNames.Add("增稠剂");
-
if (Global.userInfo.permission == CustomResource.Pages.Enums.Permission.管理员)
{
foreach (var item in Global.DeviceRawMaterials)
@@ -170,14 +189,14 @@ namespace BPASmartClient.DosingSystem.ViewModel
public string RecipeName { get { return _mRecipeName; } set { _mRecipeName = value; OnPropertyChanged(); } }
private string _mRecipeName = string.Empty;
- public string ErrorInfo { get { return _mErrorInfo; } set { _mErrorInfo = value; OnPropertyChanged(); } }
- private string _mErrorInfo;
+ //public string ErrorInfo { get { return _mErrorInfo; } set { _mErrorInfo = value; OnPropertyChanged(); } }
+ //private string _mErrorInfo;
- public RelayCommand AddCommand { get; set; }
+ //public RelayCommand AddCommand { get; set; }
- public RelayCommand RemoveCommand { get; set; }
+ //public RelayCommand RemoveCommand { get; set; }
- public RelayCommand SaveCommand { get; set; }
+ //public RelayCommand SaveCommand { get; set; }
public ObservableCollection RawMaterials { get; set; } = new ObservableCollection();
diff --git a/DosingSystem/ViewModel/RecipeControlViewModel.cs b/DosingSystem/ViewModel/RecipeControlViewModel.cs
index 845eeac3..9d7a22e1 100644
--- a/DosingSystem/ViewModel/RecipeControlViewModel.cs
+++ b/DosingSystem/ViewModel/RecipeControlViewModel.cs
@@ -9,7 +9,7 @@ using System.Collections.ObjectModel;
using System.Windows;
using BPASmartClient.Helper;
using Microsoft.Toolkit.Mvvm.Input;
-using BPASmartClient.DosingSystem.Model;
+
using System.Threading;
using BPASmartClient.CustomResource.Pages.Model;
using BPASmartClient.CustomResource.UserControls.MessageShow;
diff --git a/DosingSystem/ViewModel/RecipeSettingsViewModel.cs b/DosingSystem/ViewModel/RecipeSettingsViewModel.cs
index 076f3a78..8963ce07 100644
--- a/DosingSystem/ViewModel/RecipeSettingsViewModel.cs
+++ b/DosingSystem/ViewModel/RecipeSettingsViewModel.cs
@@ -9,7 +9,6 @@ using System.Collections.ObjectModel;
using System.Windows;
using BPASmartClient.Helper;
using Microsoft.Toolkit.Mvvm.Input;
-using BPASmartClient.DosingSystem.Model;
using BPASmartClient.DosingSystem.View;
using BPASmartClient.CustomResource.UserControls;
using BPASmartClient.CustomResource.UserControls.Model;
@@ -46,27 +45,31 @@ namespace BPASmartClient.DosingSystem.ViewModel
});
RemoveCommand = new RelayCommand((o) =>
{
- if (o is string str)
+ if (!string.IsNullOrEmpty(o?.ToString()))
{
- if (MessageLog.GetInstance.ShowDialog($"是否删除【{str}】配方"))
+ if (MessageLog.GetInstance.ShowDialog($"是否删除【{o.ToString()}】配方,删除后数据将永久丢失!无法找回", DialogType.Warning))
{
- var res = Json.Data.Recipes.FirstOrDefault(p => p.RecipCode == str);
+ var res = Json.Data.Recipes.FirstOrDefault(p => p.RecipeName == o.ToString());
if (res != null) Json.Data.Recipes.Remove(res);
- MessageLog.GetInstance.ShowUserLog($"删除名称——{res.RecipeName}");
+ Json.Save();
+ NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"配方删除成功!");
+ MessageLog.GetInstance.ShowUserLog($"删除配方 {res.RecipeName}");
}
}
});
DetailsCommand = new RelayCommand((o) =>
{
- if (o != null && o is string str)
+ if (!string.IsNullOrEmpty(o?.ToString()))
{
- ActionManage.GetInstance.CancelRegister("Details");
- NewRecipeView nrv = new NewRecipeView();
- var res = Json.Data.Recipes.FirstOrDefault(p => p.RecipCode == str);
- ActionManage.GetInstance.Send("Details", res);
- nrv.ShowDialog();
- MessageLog.GetInstance.ShowUserLog($"编辑配方名称——{res.RecipeName}");
+ var res = Json.Data.Recipes.FirstOrDefault(p => p.RecipeName == o.ToString());
+ if (res != null)
+ {
+ NewRecipeView nrv = new NewRecipeView();
+ ActionManage.GetInstance.Send("Details", res);
+ nrv.ShowDialog();
+ }
+ //MessageLog.GetInstance.ShowUserLog($"编辑配方名称——{res.RecipeName}");
}
});
diff --git a/DosingSystem/ViewModel/StockControViewModel.cs b/DosingSystem/ViewModel/StockControViewModel.cs
index 23cc1553..68d008b3 100644
--- a/DosingSystem/ViewModel/StockControViewModel.cs
+++ b/DosingSystem/ViewModel/StockControViewModel.cs
@@ -1,29 +1,54 @@
-using BPASmartClient.DosingSystem.Model;
+
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using Microsoft.Toolkit.Mvvm.ComponentModel;
+using Microsoft.Toolkit.Mvvm.Input;
namespace BPASmartClient.DosingSystem.ViewModel
{
- internal class StockControViewModel
+ public class StockControViewModel : ObservableObject
{
public StockControViewModel()
{
- for (int i = 0; i < 6; i++)
+ Task.Factory.StartNew(() =>
{
- statusTop.Add(new StockStatusModel { IsFault = false, IsLayOff = true, IsRunning = true, MaterialName = $"{i+1}号料仓", MaterialWeight = 85+i });
- }
- for (int i =6; i < 12; i++)
- {
- statusDown.Add(new StockStatusModel { IsFault = false, IsLayOff = true, IsRunning = true, MaterialName = $"{i+1}号料仓", MaterialWeight = 85 + i });
- }
-
+ App.Current.Dispatcher.Invoke(() =>
+ {
+ for (int i = 0; i < 6; i++)
+ {
+ statusTop.Add(new StockStatusModel { IsFault = false, IsLayOff = true, IsRunning = true, MaterialName = $"{i + 1}号料仓", MaterialWeight = 85 + i });
+ }
+ for (int i = 6; i < 12; i++)
+ {
+ statusDown.Add(new StockStatusModel { IsFault = false, IsLayOff = true, IsRunning = true, MaterialName = $"{i + 1}号料仓", MaterialWeight = 85 + i });
+ }
+ });
+ });
+
+ StartConveyerBeltCommand = new RelayCommand(() => { ConveyerBeltWork = !ConveyerBeltWork; });
}
-
+ //启动输送带
+ public RelayCommand StartConveyerBeltCommand { get; set; }
+
+ //停止输送带
+ //public RelayCommand StopConveyerBeltCommand { get; set; }
+
+ //开盖控制
+ public RelayCommand UnCapControlCommand { get; set; }
+
+ //放料控制
+ public RelayCommand BlowingControlCommand { get; set; }
+
+
+ public bool ConveyerBeltWork { get { return _mConveyerBeltWork; } set { _mConveyerBeltWork = value; OnPropertyChanged(); } }
+ private bool _mConveyerBeltWork;
+
+
public ObservableCollection statusTop { get; set; } = new ObservableCollection();
public ObservableCollection statusDown { get; set; } = new ObservableCollection();
}