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 @@ - + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - + + @@ -84,35 +29,49 @@ --> - + - + - + - + - + - - - + + + - + - + - + - + - + - - - + - - - - - - + + + + + + - + - + - - + + - - + + - - + + - + - - - + + + - + - + - - + + - + - - + + - + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 RemoveCommand { get; set; }//移除 + public RelayCommand DetailsCommand { get; set; }//编辑 + + /// + /// 错误信息 + /// + public string ErrorInfo { get { return _mErrorInfo; } set { _mErrorInfo = value; OnPropertyChanged(); } } + private string _mErrorInfo = string.Empty; + } +} diff --git a/DosingSystem/View/ChangeDeviceNameView.xaml b/DosingSystem/View/ChangeDeviceNameView.xaml index 5538aa49..f44050de 100644 --- a/DosingSystem/View/ChangeDeviceNameView.xaml +++ b/DosingSystem/View/ChangeDeviceNameView.xaml @@ -104,14 +104,14 @@ Width="148" Height="30" Margin="0,0,7,0" - Command="{Binding ConfirmCommand}" + Command="{Binding AddCommand}" Content="确认" /> - + - - - + - @@ -147,50 +194,37 @@ - - + + - - + + - - + + - - +