diff --git a/BPASmartClient.Business/Plugin/ConfigMgr.cs b/BPASmartClient.Business/Plugin/ConfigMgr.cs index 83be6035..c0d68ab5 100644 --- a/BPASmartClient.Business/Plugin/ConfigMgr.cs +++ b/BPASmartClient.Business/Plugin/ConfigMgr.cs @@ -1,8 +1,11 @@ using BPA.ApolloClient; using BPA.Message; +using BPASmartClient.Helper; using BPASmartClient.Message; using BPASmartClient.Model; using Microsoft.Extensions.Configuration; +using Newtonsoft.Json; +using System.Collections.ObjectModel; using System.Xml.Linq; using System.Xml.XPath; @@ -58,6 +61,40 @@ namespace BPASmartClient.Business /// private void InitDeviceModel() { + //var text = TextHelper.GetInstance.ReadTextInfo("StartShop", "DeviceConfig"); + //string path = $"{LocaPath.GetInstance().GetDeviceConfigPath}{text}.json"; + //deviceConfigs = new List(); + //if (File.Exists(path)) + //{ + // string JsonString = File.ReadAllText(path); + // var result = JsonConvert.DeserializeObject>(JsonString); + // if (result != null) + // { + // foreach (var shop in result) + // { + // foreach (var device in shop.deviceModels) + // { + + // DeviceConfig deviceConfig = new DeviceConfig(); + // deviceConfig.Name = device.DeviceName; + // deviceConfig.Module = device.DeviceNamespace; + // deviceConfig.DeviceId = int.Parse(device.DeviceId); + + // foreach (var comms in device.communicationDevcies) + // { + // BPASmartClient.Model.Peripheral peripheral = new BPASmartClient.Model.Peripheral(); + // peripheral.Module = comms.CommunicationNamespace; + // } + // deviceConfigs.Add(deviceConfig); + // } + // } + // } + //} + + + + + deviceConfigs = new List(); var devicePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "DeviceInfo.xml"); var xdoc = XDocument.Load(devicePath); diff --git a/BPASmartClient.Business/Plugin/DeviceMgr.cs b/BPASmartClient.Business/Plugin/DeviceMgr.cs index ec21017d..3cd27e88 100644 --- a/BPASmartClient.Business/Plugin/DeviceMgr.cs +++ b/BPASmartClient.Business/Plugin/DeviceMgr.cs @@ -74,8 +74,6 @@ namespace BPASmartClient.Business } } - - public void StartService() { this.devices.ForEach(device => @@ -129,8 +127,6 @@ namespace BPASmartClient.Business }); } - - public void StopService() { this.devices.ForEach(device => device.Stop()); diff --git a/BPASmartClient.CustomResource/RecDictionarys/DatePickeerDictionary.xaml b/BPASmartClient.CustomResource/RecDictionarys/DatePickeerDictionary.xaml new file mode 100644 index 00000000..355b5f66 --- /dev/null +++ b/BPASmartClient.CustomResource/RecDictionarys/DatePickeerDictionary.xaml @@ -0,0 +1,599 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 14 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #FFE8EDF9 + #FFC5CBF9 + #FF7381F9 + + #FFE8EDF9 + #FFC5CBF9 + #FF888888 + + #FFC5CBF9 + #FFDDDDDD + + White + #FF7381F9 + #FF211AA9 + + #FF3843C4 + #FF211AA9 + + + #FF444444 + sc#1, 0.004391443, 0.002428215, 0.242281124 + + + + #FFCCCCCC + #FF888888 + #FF444444 + + #FF888888 + #FF444444 + + #FFAAAAAA + #FF888888 + + Black + + + + #FFC5CBF9 + Black + #FFC5CBF9 + + #FF3843C4 + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/BPASmartClient.CustomResource/Themes/MyStyle.xaml b/BPASmartClient.CustomResource/Themes/MyStyle.xaml index 51c8b9ec..a6ed93e7 100644 --- a/BPASmartClient.CustomResource/Themes/MyStyle.xaml +++ b/BPASmartClient.CustomResource/Themes/MyStyle.xaml @@ -957,7 +957,7 @@ - + - + - + - - + - + - + - - - + + + - + - - - - + + + + - - - - - - - - - - + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BPASmartClient/Control/AlarmView.xaml.cs b/BPASmartClient/Control/AlarmView.xaml.cs new file mode 100644 index 00000000..c812b5c3 --- /dev/null +++ b/BPASmartClient/Control/AlarmView.xaml.cs @@ -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 BPASmartClient.Control +{ + /// + /// AlarmView.xaml 的交互逻辑 + /// + public partial class AlarmView : UserControl + { + public AlarmView() + { + InitializeComponent(); + } + } +} diff --git a/BPASmartClient/Control/OrderStatusView.xaml b/BPASmartClient/Control/OrderStatusView.xaml index 1c6aee37..56e250c4 100644 --- a/BPASmartClient/Control/OrderStatusView.xaml +++ b/BPASmartClient/Control/OrderStatusView.xaml @@ -36,7 +36,7 @@ - + @@ -118,8 +118,8 @@ + HorizontalScrollBarVisibility="Hidden" + VerticalScrollBarVisibility="Hidden"> @@ -206,7 +206,7 @@ - + - + diff --git a/BPASmartClient/Control/ShopDeviceConfigView.xaml b/BPASmartClient/Control/ShopDeviceConfigView.xaml index b114f896..f78305c1 100644 --- a/BPASmartClient/Control/ShopDeviceConfigView.xaml +++ b/BPASmartClient/Control/ShopDeviceConfigView.xaml @@ -7,7 +7,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" xmlns:vm="clr-namespace:BPASmartClient.ViewModel;assembly=BPASmartClient.ViewModel" - xmlns:vmm="clr-namespace:BPASmartClient.ViewModel.Model;assembly=BPASmartClient.ViewModel" + xmlns:vmm="clr-namespace:BPASmartClient.Model;assembly=BPASmartClient.Model" d:DesignHeight="900" d:DesignWidth="1200" mc:Ignorable="d"> diff --git a/BPASmartClient/Control/ShopDeviceConfigView.xaml.cs b/BPASmartClient/Control/ShopDeviceConfigView.xaml.cs index a608cd93..cebbda96 100644 --- a/BPASmartClient/Control/ShopDeviceConfigView.xaml.cs +++ b/BPASmartClient/Control/ShopDeviceConfigView.xaml.cs @@ -16,8 +16,8 @@ using System.Windows.Navigation; using System.Windows.Shapes; using BPASmartClient.DialogWindow; using BPASmartClient.Helper; +using BPASmartClient.Model; using BPASmartClient.ViewModel; -using BPASmartClient.ViewModel.Model; using Newtonsoft.Json; namespace BPASmartClient.Control @@ -140,7 +140,7 @@ namespace BPASmartClient.Control if (file != null && File.Exists(file.FullName)) { string JsonString = File.ReadAllText(file.FullName); - var result = JsonConvert.DeserializeObject>(JsonString); + var result = JsonConvert.DeserializeObject>(JsonString); if (result != null) { ShopDeviceConfigViewModel.deviceConfig.Clear(); diff --git a/BPASmartClient/Control/SystemSetView.xaml b/BPASmartClient/Control/SystemSetView.xaml index 6cf92742..7d977a72 100644 --- a/BPASmartClient/Control/SystemSetView.xaml +++ b/BPASmartClient/Control/SystemSetView.xaml @@ -1,12 +1,144 @@ - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BPASmartClient/DeviceInfo.xml b/BPASmartClient/DeviceInfo.xml index f442fe8d..5da0b472 100644 --- a/BPASmartClient/DeviceInfo.xml +++ b/BPASmartClient/DeviceInfo.xml @@ -26,19 +26,21 @@ --> - + + + - + - 192.168.1.11 - 508 - M,M550.0,16;M,M0.3,3;M,M100.0,16;M,M235.0,1;M,M102.0,7;M,M103.0,6;VW,VW372,1 + 127.0.0.1 + 502 + M,M230.0,24;M,M0.3,3;M,M100.0,16;M,M235.0,1;M,M102.0,7;M,M103.0,6;VW,VW372,1 - --> + diff --git a/BPASmartClient/MainWindow.xaml b/BPASmartClient/MainWindow.xaml index 9776b21e..dc58adf0 100644 --- a/BPASmartClient/MainWindow.xaml +++ b/BPASmartClient/MainWindow.xaml @@ -50,7 +50,7 @@ Margin="20,0,0,0" VerticalAlignment="Center" Style="{DynamicResource imagetop_Title}" /> - + + Cursor="Hand" /> diff --git a/BPASmartClient/MainWindow.xaml.cs b/BPASmartClient/MainWindow.xaml.cs index 682d7c73..9643449a 100644 --- a/BPASmartClient/MainWindow.xaml.cs +++ b/BPASmartClient/MainWindow.xaml.cs @@ -11,9 +11,11 @@ using BPASmartClient.Message; using BPASmartClient.Model; using BPASmartClient.Model.冰淇淋.Enum; using BPASmartClient.Model.咖啡机.Enum; +using BPASmartClient.Peripheral; using BPASmartClient.ViewModel; using System; using System.Collections.Generic; +using System.IO; using System.Linq; using System.Reflection; using System.Text; @@ -66,6 +68,7 @@ namespace BPASmartClient ThreadManage.GetInstance().Start(new Action(() => { new MainConsole().Start(); + GetDevices(); }), "启动主控制台", false); ThreadManage.GetInstance().Start(new Action(() => @@ -86,6 +89,67 @@ namespace BPASmartClient } #endregion + private void GetDevices() + { + //List IDevices = new List(); + //List IPeripherals = new List(); + + DirectoryInfo directoryInfo = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory); + var files = directoryInfo.GetFiles().Where(p => p.FullName.Contains("BPASmartClient.") && p.FullName.Contains("dll")).ToList(); + List fileList = new List(); + + var assemblies = AppDomain.CurrentDomain.GetAssemblies(); + var dlls = assemblies?.Where(p => p.FullName.Contains("BPASmartClient.")).ToList(); + List dllList = new List(); + + if (files != null) + { + foreach (var item in files) + { + var res = System.IO.Path.GetFileNameWithoutExtension(item.FullName); + if (res != null && res.Length > 0 && res.Contains(".") && !res.Contains("dll")) fileList.Add(res); + } + } + + if (dlls != null) + { + dlls.ForEach((item) => + { + item.GetTypes().ToList().ForEach((type) => + { + if (type.GetInterfaces().Contains(typeof(IDevice))) + { + if (!type.FullName.Contains("BaseDevice")) ShopDeviceConfigViewModel.IDevices.Add(type.FullName); + } + else if (type.GetInterfaces().Contains(typeof(IPeripheral))) + { + if (!type.FullName.Contains("BasePeripheral")) ShopDeviceConfigViewModel.IPeripherals.Add(type.FullName); + } + }); + + dllList.Add(System.IO.Path.GetFileNameWithoutExtension(item.EscapedCodeBase)); + }); + } + + dllList.ForEach((item) => { if (fileList.Contains(item)) fileList.Remove(item); }); + + fileList.ForEach((item) => + { + Assembly.Load(item).GetTypes().ToList().ForEach((type) => + { + if (type.GetInterfaces().Contains(typeof(IDevice))) + { + if (!type.FullName.Contains("BaseDevice")) ShopDeviceConfigViewModel.IDevices.Add(type.FullName); + } + else if (type.GetInterfaces().Contains(typeof(IPeripheral))) + { + if (!type.FullName.Contains("BasePeripheral")) ShopDeviceConfigViewModel.IPeripherals.Add(type.FullName); + } + }); + }); + + } + #region Click /// /// 菜单切换栏 @@ -215,7 +279,7 @@ namespace BPASmartClient MessageLog.GetInstance.ShowEx($"BPASmartClient 中引发错误,MainWindow.xaml.cs 类MenuItem_Click(),描述:[{ex.Message}]"); } - + } private void Button_LogOut(object sender, RoutedEventArgs e)