From d54eb8816ecb8e6ed46ede1c81f455bc3eaa8e9a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=A6=82=E6=84=8F=20=E5=BD=AD?= <2417589739@qq.com>
Date: Mon, 16 May 2022 09:47:49 +0800
Subject: [PATCH 01/14] =?UTF-8?q?=E5=8F=82=E6=95=B0=E9=85=8D=E7=BD=AE?=
=?UTF-8?q?=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../RecDictionarys/GlobalStyle.xaml | 12 +-
BPASmartClient/App.config | 14 +-
BPASmartClient/App.xaml | 2 +
.../Control/ShopDeviceConfigView.xaml | 1399 ++++++++---------
BPASmartClient/DeviceInfo.xml | 2 +-
BPASmartClient/MainWindow.xaml | 2 +-
6 files changed, 686 insertions(+), 745 deletions(-)
diff --git a/BPASmartClient.CustomResource/RecDictionarys/GlobalStyle.xaml b/BPASmartClient.CustomResource/RecDictionarys/GlobalStyle.xaml
index 2426ffba..8b6a4b0d 100644
--- a/BPASmartClient.CustomResource/RecDictionarys/GlobalStyle.xaml
+++ b/BPASmartClient.CustomResource/RecDictionarys/GlobalStyle.xaml
@@ -4,5 +4,15 @@
xmlns:con="clr-namespace:BPASmartClient.CustomResource.Converters">
-
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/BPASmartClient/App.config b/BPASmartClient/App.config
index 2fb2713f..1caea14f 100644
--- a/BPASmartClient/App.config
+++ b/BPASmartClient/App.config
@@ -3,7 +3,7 @@
-
+
@@ -16,8 +16,10 @@
-
- -->
+ -->
+
+
+
@@ -37,10 +39,10 @@
-
-
+
+
-
+
diff --git a/BPASmartClient/App.xaml b/BPASmartClient/App.xaml
index 29cb2e65..a85b3559 100644
--- a/BPASmartClient/App.xaml
+++ b/BPASmartClient/App.xaml
@@ -13,6 +13,8 @@
+
+
diff --git a/BPASmartClient/Control/ShopDeviceConfigView.xaml b/BPASmartClient/Control/ShopDeviceConfigView.xaml
index 358590c6..a242d89d 100644
--- a/BPASmartClient/Control/ShopDeviceConfigView.xaml
+++ b/BPASmartClient/Control/ShopDeviceConfigView.xaml
@@ -7,8 +7,8 @@
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"
- d:DesignHeight="450"
- d:DesignWidth="800"
+ d:DesignHeight="900"
+ d:DesignWidth="1200"
mc:Ignorable="d">
@@ -19,6 +19,7 @@
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -72,193 +323,204 @@
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+ FontSize="20"
+ Foreground="#ff23caca"
+ IsEditable="False"
+ ItemsSource="{Binding ClientDevices}"
+ SelectedIndex="0"
+ Style="{StaticResource ComboBoxStyle}"
+ Text="{Binding ClientDeviceType}" />
-
+
-
-
+
-
-
-
-
-
+
-
-
-
-
+
-
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+ Grid.Column="5"
+ Width="170"
+ HorizontalAlignment="Left"
+ Style="{StaticResource TextBoxStyle}"
+ Text="" />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Text="请选择设备模块:" />
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
+
-
+ Text="IP地址:" />
+ Width="170"
+ HorizontalAlignment="Left"
+ Style="{StaticResource TextBoxStyle}"
+ Text="{Binding Path=Device.IP}" />
-
+ Text="端口号:" />
+ Width="170"
+ HorizontalAlignment="Left"
+ Style="{StaticResource TextBoxStyle}"
+ Text="{Binding Path=Device.PortNum}" />
-
-
-
-
-
+ HorizontalAlignment="Right"
+ Style="{StaticResource TextBlockStyle}"
+ Text="站号:" />
+
+
-
+
- -->
-
-
+
-
-
-
-
+
+
+
+
- -->
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
- -->
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- -->
-
-
+
+
+
+
+
+
+
-
diff --git a/BPASmartClient/DeviceInfo.xml b/BPASmartClient/DeviceInfo.xml
index 89e636c8..48d28f7c 100644
--- a/BPASmartClient/DeviceInfo.xml
+++ b/BPASmartClient/DeviceInfo.xml
@@ -38,7 +38,7 @@
-->
-
+
diff --git a/BPASmartClient/MainWindow.xaml b/BPASmartClient/MainWindow.xaml
index dc110869..f68747fa 100644
--- a/BPASmartClient/MainWindow.xaml
+++ b/BPASmartClient/MainWindow.xaml
@@ -13,7 +13,7 @@
Height="800"
AllowsTransparency="True"
Background="{x:Null}"
- Topmost="True"
+ Topmost="False"
WindowStartupLocation="CenterScreen"
WindowStyle="None"
mc:Ignorable="d">
From 73de27797a749ba5b3389a063368978a0b04fa23 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=A6=82=E6=84=8F=20=E5=BD=AD?= <2417589739@qq.com>
Date: Mon, 16 May 2022 13:50:34 +0800
Subject: [PATCH 02/14] =?UTF-8?q?=E5=8F=82=E6=95=B0=E9=85=8D=E7=BD=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Model/DeviceConfigModel.cs | 4 +
.../NewShopWindowModel.cs | 26 +-
.../ShopDeviceConfigViewModel.cs | 47 ++-
.../Control/ShopDeviceConfigView.xaml | 82 +++--
.../DialogWindow/NewShopWindow.xaml | 312 ++++++------------
.../DialogWindow/NewShopWindow.xaml.cs | 18 +-
BPASmartClient/MainWindow.xaml.cs | 2 +-
7 files changed, 238 insertions(+), 253 deletions(-)
diff --git a/BPASmartClient.ViewModel/Model/DeviceConfigModel.cs b/BPASmartClient.ViewModel/Model/DeviceConfigModel.cs
index 8301b3ca..49e9d013 100644
--- a/BPASmartClient.ViewModel/Model/DeviceConfigModel.cs
+++ b/BPASmartClient.ViewModel/Model/DeviceConfigModel.cs
@@ -73,6 +73,10 @@ namespace BPASmartClient.ViewModel.Model
private string _mCommunicationModule = string.Empty;
+ public string CommunicationName { get { return _mCommunicationName; } set { _mCommunicationName = value; OnPropertyChanged(); } }
+ private string _mCommunicationName = string.Empty;
+
+
}
diff --git a/BPASmartClient.ViewModel/NewShopWindowModel.cs b/BPASmartClient.ViewModel/NewShopWindowModel.cs
index 7c2e1cc7..cef93844 100644
--- a/BPASmartClient.ViewModel/NewShopWindowModel.cs
+++ b/BPASmartClient.ViewModel/NewShopWindowModel.cs
@@ -3,7 +3,10 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using BPASmartClient.Helper;
using Microsoft.Toolkit.Mvvm.ComponentModel;
+using Microsoft.Toolkit.Mvvm.Input;
+using Microsoft.Toolkit.Mvvm.Messaging;
namespace BPASmartClient.ViewModel
{
@@ -11,7 +14,28 @@ namespace BPASmartClient.ViewModel
{
public NewShopWindowModel()
{
-
+ CloseWindowCommand = new RelayCommand(() => { WeakReferenceMessenger.Default.Send("", "CloseWindow"); });
+ CancelCommand = new RelayCommand(() => { WeakReferenceMessenger.Default.Send("", "CloseWindow"); });
+ DefineCommand = new RelayCommand(() =>
+ {
+ ActionManage.GetInstance.Send("ShopPar", new string[] { ShopName, ShopId });
+ WeakReferenceMessenger.Default.Send("", "CloseWindow");
+ });
}
+
+ public RelayCommand CloseWindowCommand { get; set; }
+
+ public RelayCommand CancelCommand { get; set; }
+
+ public RelayCommand DefineCommand { get; set; }
+
+ public string ShopName { get { return _mShopName; } set { _mShopName = value; OnPropertyChanged(); } }
+ private string _mShopName;
+
+ public string ShopId { get { return _mShopId; } set { _mShopId = value; OnPropertyChanged(); } }
+ private string _mShopId;
+
+
+
}
}
diff --git a/BPASmartClient.ViewModel/ShopDeviceConfigViewModel.cs b/BPASmartClient.ViewModel/ShopDeviceConfigViewModel.cs
index 51572f95..e7e0de7c 100644
--- a/BPASmartClient.ViewModel/ShopDeviceConfigViewModel.cs
+++ b/BPASmartClient.ViewModel/ShopDeviceConfigViewModel.cs
@@ -3,7 +3,11 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using BPASmartClient.Helper;
using Microsoft.Toolkit.Mvvm.ComponentModel;
+using Microsoft.Toolkit.Mvvm.Input;
+using BPASmartClient.ViewModel.Model;
+using System.Collections.ObjectModel;
namespace BPASmartClient.ViewModel
{
@@ -11,9 +15,50 @@ namespace BPASmartClient.ViewModel
{
public ShopDeviceConfigViewModel()
{
- //NewCommand = new Action(() => {ActionManager });
+ ActionManage.GetInstance.Register(new Action
-->
-
+
diff --git a/HBLConsole.MORKIC/BPASmartClient.MORKIC.csproj b/HBLConsole.MORKIC/BPASmartClient.MORKIC.csproj
index e444219e..0dcf2236 100644
--- a/HBLConsole.MORKIC/BPASmartClient.MORKIC.csproj
+++ b/HBLConsole.MORKIC/BPASmartClient.MORKIC.csproj
@@ -5,7 +5,7 @@
-
+
From 338de893cdcd5f8a590f0803cd11ecc9cdaac598 Mon Sep 17 00:00:00 2001
From: fyf
Date: Wed, 18 May 2022 13:48:32 +0800
Subject: [PATCH 11/14] 6
---
BPASmartClient/Control/DataVView.xaml.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/BPASmartClient/Control/DataVView.xaml.cs b/BPASmartClient/Control/DataVView.xaml.cs
index 3ffd3018..d0067c42 100644
--- a/BPASmartClient/Control/DataVView.xaml.cs
+++ b/BPASmartClient/Control/DataVView.xaml.cs
@@ -44,7 +44,7 @@ namespace BPASmartClient.Control
dispatcherTimer.Stop();
}));
};
- dispatcherTimer.Interval = TimeSpan.FromSeconds(20);
+ dispatcherTimer.Interval = TimeSpan.FromSeconds(120);
}
From b27c0a2b45049024016bcafa5d3fc1a46dd2baf0 Mon Sep 17 00:00:00 2001
From: fyf
Date: Wed, 18 May 2022 16:07:19 +0800
Subject: [PATCH 12/14] 3232
---
.../Themes/MyStyle.xaml | 64 ++++++++++++++++++-
BPASmartClient/Control/DataVView.xaml | 12 ++--
BPASmartClient/MainWindow.xaml | 16 ++---
3 files changed, 74 insertions(+), 18 deletions(-)
diff --git a/BPASmartClient.CustomResource/Themes/MyStyle.xaml b/BPASmartClient.CustomResource/Themes/MyStyle.xaml
index 5a02829c..eee7a413 100644
--- a/BPASmartClient.CustomResource/Themes/MyStyle.xaml
+++ b/BPASmartClient.CustomResource/Themes/MyStyle.xaml
@@ -957,7 +957,67 @@
-
+
+
+
-
-
-
-
+
+
+
@@ -584,7 +592,7 @@
-
+
diff --git a/BPASmartClient.Device/BPASmartClient.Device.csproj b/BPASmartClient.Device/BPASmartClient.Device.csproj
index 3164a1d8..3f4f0b9f 100644
--- a/BPASmartClient.Device/BPASmartClient.Device.csproj
+++ b/BPASmartClient.Device/BPASmartClient.Device.csproj
@@ -2,6 +2,8 @@
net6.0
+ bin\
+ portable
diff --git a/BPASmartClient.Helper/ActionManage.cs b/BPASmartClient.Helper/ActionManage.cs
index ba2f19c6..e9a8a7dd 100644
--- a/BPASmartClient.Helper/ActionManage.cs
+++ b/BPASmartClient.Helper/ActionManage.cs
@@ -72,13 +72,13 @@ namespace BPASmartClient.Helper
if (actions.ContainsKey(key))
if (par == null)
{
- if (actions[key].FuncObj != null)
- return actions[key].FuncObj;
+ //if (actions[key].FuncObj != null)
+ return actions[key].FuncObj?.Invoke();
}
else
{
- if (actions[key].FuncPar != null)
- return actions[key].FuncPar(par);
+ //if (actions[key].FuncPar != null)
+ return actions[key].FuncPar?.Invoke(par);
}
return default;
}
diff --git a/BPASmartClient.Helper/ExpandMethod.cs b/BPASmartClient.Helper/ExpandMethod.cs
index f0d1ccac..97336f6e 100644
--- a/BPASmartClient.Helper/ExpandMethod.cs
+++ b/BPASmartClient.Helper/ExpandMethod.cs
@@ -41,11 +41,13 @@ namespace BPASmartClient.Helper
/// 委托回调
public static void Invoke(this Action action, Action callback)
{
- if (action != null)
- {
- action();
- if (callback != null) callback();
- }
+ action?.Invoke();
+ callback?.Invoke();
+ //if (action != null)
+ //{
+ // action();
+ // if (callback != null) callback();
+ //}
}
///
@@ -56,20 +58,24 @@ namespace BPASmartClient.Helper
/// 委托回调
public static void Invoke(this Action action, object par, Action callback)
{
- if (action != null)
- {
- action(par);
- if (callback != null) callback();
- }
+ action?.Invoke(par);
+ callback?.Invoke();
+ //if (action != null)
+ //{
+ // action(par);
+ // if (callback != null) callback();
+ //}
}
public static void Invokes(this Action action, object[] par, Action callback)
{
- if (action != null)
- {
- action(par);
- if (callback != null) callback();
- }
+ action?.Invoke(par);
+ callback?.Invoke();
+ //if (action != null)
+ //{
+ // action(par);
+ // if (callback != null) callback();
+ //}
}
diff --git a/BPASmartClient.Helper/LocaPath.cs b/BPASmartClient.Helper/LocaPath.cs
index afc71e39..ccd14562 100644
--- a/BPASmartClient.Helper/LocaPath.cs
+++ b/BPASmartClient.Helper/LocaPath.cs
@@ -7,10 +7,8 @@ using System.Threading.Tasks;
namespace BPASmartClient.Helper
{
- public class LocaPath:Singleton
+ public class LocaPath : Singleton
{
-
-
public string FilePath { get; set; } = string.Empty;
public string Getpath(string name)
@@ -19,5 +17,14 @@ namespace BPASmartClient.Helper
return $"{AppDomain.CurrentDomain.BaseDirectory}{FilePath}JSON\\{name}.json";
}
+ public string GetDeviceConfigPath
+ {
+ get
+ {
+ Directory.CreateDirectory(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $"AccessFile\\DeviceConfig"));
+ return $"{AppDomain.CurrentDomain.BaseDirectory}AccessFile\\DeviceConfig\\";
+ }
+ }
+
}
}
diff --git a/BPASmartClient.MQTT/BPASmartClient.MQTT.csproj b/BPASmartClient.MQTT/BPASmartClient.MQTT.csproj
index 69f50a3d..04bceac9 100644
--- a/BPASmartClient.MQTT/BPASmartClient.MQTT.csproj
+++ b/BPASmartClient.MQTT/BPASmartClient.MQTT.csproj
@@ -5,7 +5,7 @@
-
+
diff --git a/BPASmartClient.MorkD/BPASmartClient.MorkD.csproj b/BPASmartClient.MorkD/BPASmartClient.MorkD.csproj
index dbc15171..b4b46ffa 100644
--- a/BPASmartClient.MorkD/BPASmartClient.MorkD.csproj
+++ b/BPASmartClient.MorkD/BPASmartClient.MorkD.csproj
@@ -2,6 +2,8 @@
net6.0
+ bin\
+ portable
diff --git a/BPASmartClient.MorkF/BPASmartClient.MorkF.csproj b/BPASmartClient.MorkF/BPASmartClient.MorkF.csproj
index e39ff09d..09946d55 100644
--- a/BPASmartClient.MorkF/BPASmartClient.MorkF.csproj
+++ b/BPASmartClient.MorkF/BPASmartClient.MorkF.csproj
@@ -4,6 +4,8 @@
net6.0
enable
enable
+ bin\
+ portable
diff --git a/BPASmartClient.MorkS/BPASmartClient.MorkS.csproj b/BPASmartClient.MorkS/BPASmartClient.MorkS.csproj
index ce6a7f77..11f083b1 100644
--- a/BPASmartClient.MorkS/BPASmartClient.MorkS.csproj
+++ b/BPASmartClient.MorkS/BPASmartClient.MorkS.csproj
@@ -2,6 +2,8 @@
net6.0
+ bin\
+ portable
diff --git a/BPASmartClient.MorkS/Control.cs b/BPASmartClient.MorkS/Control_Morks.cs
similarity index 92%
rename from BPASmartClient.MorkS/Control.cs
rename to BPASmartClient.MorkS/Control_Morks.cs
index b788434d..ae2ac5b7 100644
--- a/BPASmartClient.MorkS/Control.cs
+++ b/BPASmartClient.MorkS/Control_Morks.cs
@@ -17,7 +17,7 @@ using System.Reflection;
namespace BPASmartClient.MorkS
{
- public class Control : BaseDevice
+ public class Control_Morks : BaseDevice
{
public override DeviceClientType DeviceType => DeviceClientType.MORKS;
GVL_MORKS mORKS = new GVL_MORKS();
@@ -223,16 +223,19 @@ namespace BPASmartClient.MorkS
mORKS.AllowRun = mORKS.InitComplete;
//IsHealth = mORKS.Error && mORKS.InitComplete;
IsHealth = true;
- TakeBowlTask();
- TakeNoodleTask();
+ if (mORKS.AllowRun)
+ {
+ TakeBowlTask();
- OutNoodleTask();
+ TakeNoodleTask();
- SingleDetect();
+ OutNoodleTask();
- TurntableControl();
+ SingleDetect();
+ TurntableControl();
+ }
}
@@ -245,11 +248,39 @@ namespace BPASmartClient.MorkS
{
if (mORKS.TakeBowlTask.TryDequeue(out OrderLocInfo orderLocInfo))
{
- mORKS.TakeBowlId = orderLocInfo.SuborderId;
- TakeBowlControl(orderLocInfo.Loc);
- SetRecipeNumber(orderLocInfo.RecipeNumber);
- OrderChange(mORKS.TakeBowlId, ORDER_STATUS.COOKING);
- DeviceProcessLogShow($"订单【{ mORKS.TakeBowlId}】执行取碗控制,位置:[{orderLocInfo.Loc}]");
+ ushort BowLoc = 0;
+ var res = orderMaterialDelivery?.BatchingInfo?.Where(p => p.BatchingId == orderLocInfo.BatchingId).ToList();
+ if (res != null)
+ {
+ foreach (var item in res)
+ {
+ if (ushort.TryParse(item.BatchingLoc, out ushort loc))
+ {
+ if (loc == 10 && alarm.Supply1_LossBowl)
+ {
+ BowLoc = loc;
+ break;
+ }
+ else if (loc == 11 && alarm.Supply2_LossBowl)
+ {
+ BowLoc = loc;
+ break;
+ }
+ }
+
+ }
+ }
+
+ if (BowLoc >= 10 && BowLoc <= 11)
+ {
+ mORKS.TakeBowlId = orderLocInfo.SuborderId;
+ //TakeBowlControl(orderLocInfo.Loc);
+ TakeBowlControl(BowLoc);
+ SetRecipeNumber(orderLocInfo.RecipeNumber);
+ OrderChange(mORKS.TakeBowlId, ORDER_STATUS.COOKING);
+ DeviceProcessLogShow($"订单【{ mORKS.TakeBowlId}】执行取碗控制,位置:[{orderLocInfo.Loc}]");
+ }
+
}
mORKS.TakeBowlInterlock = true;
}
diff --git a/BPASmartClient.MorkT/BPASmartClient.MorkT.csproj b/BPASmartClient.MorkT/BPASmartClient.MorkT.csproj
index 288c5e34..efbf696e 100644
--- a/BPASmartClient.MorkT/BPASmartClient.MorkT.csproj
+++ b/BPASmartClient.MorkT/BPASmartClient.MorkT.csproj
@@ -2,6 +2,7 @@
net6.0
+ D:\HBL\Porgram\BPASmartClient\BPASmartClient\bin\Debug\net6.0-windows\Devices
diff --git a/BPASmartClient.ViewModel/BPASmartClient.ViewModel.csproj b/BPASmartClient.ViewModel/BPASmartClient.ViewModel.csproj
index b99aa4f8..69df2f85 100644
--- a/BPASmartClient.ViewModel/BPASmartClient.ViewModel.csproj
+++ b/BPASmartClient.ViewModel/BPASmartClient.ViewModel.csproj
@@ -8,6 +8,8 @@
+
+
diff --git a/BPASmartClient.ViewModel/MainViewModel.cs b/BPASmartClient.ViewModel/MainViewModel.cs
index 60990cc7..bef488e8 100644
--- a/BPASmartClient.ViewModel/MainViewModel.cs
+++ b/BPASmartClient.ViewModel/MainViewModel.cs
@@ -52,7 +52,7 @@ namespace BPASmartClient.ViewModel
public MainViewModel()
{
- IsAlarm =new AlarmModel();
+ IsAlarm = new AlarmModel();
OrderStatusViewModel.Init();
//设备告警日志
MessageLog.GetInstance.AlarmLogNotify = new Action(() =>
@@ -75,6 +75,12 @@ namespace BPASmartClient.ViewModel
dispatcherTimer.Interval = TimeSpan.FromSeconds(1);
dispatcherTimer.Start();
}
+
+
+ public bool AutoStart { get { return SystemHelper.GetInstance.IsAutoStart(); } set { SystemHelper.GetInstance.AutoStart(value); OnPropertyChanged(); } }
+
+
+
}
public class AlarmModel : ObservableObject
@@ -118,7 +124,7 @@ namespace BPASmartClient.ViewModel
public AlarmModel()
{
-
+
}
}
}
diff --git a/BPASmartClient.ViewModel/Model/DeviceConfigModel.cs b/BPASmartClient.ViewModel/Model/DeviceConfigModel.cs
index f6f699f3..cf5977b8 100644
--- a/BPASmartClient.ViewModel/Model/DeviceConfigModel.cs
+++ b/BPASmartClient.ViewModel/Model/DeviceConfigModel.cs
@@ -6,6 +6,7 @@ using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using System.Collections.ObjectModel;
using Microsoft.Toolkit.Mvvm.Input;
+using System.Windows;
namespace BPASmartClient.ViewModel.Model
{
@@ -96,12 +97,29 @@ namespace BPASmartClient.ViewModel.Model
///
public class CommunicationPar : ObservableObject
{
+ /////
+ ///// 通讯类型,false:串口,true:网口
+ /////
+ //public bool CommunicationType { get { return _mCommunicationType; } set { _mCommunicationType = value; OnPropertyChanged(); } }
+ //private bool _mCommunicationType;
+
+ ///
+ /// 选择网口通讯
+ ///
+ public bool IsNetworkPort { get { return _mIsNetworkPort; } set { _mIsNetworkPort = value; OnPropertyChanged(); } }
+ private bool _mIsNetworkPort = false;
+
///
- /// 通讯类型,false:串口,true:网口
+ /// 选择串口通讯
///
- public bool CommunicationType { get { return _mCommunicationType; } set { _mCommunicationType = value; OnPropertyChanged(); } }
- private bool _mCommunicationType;
+ public bool IsSerialPort { get { return _mIsSerialPort; } set { _mIsSerialPort = value; OnPropertyChanged(); } }
+ private bool _mIsSerialPort = true;
+ //public Visibility NetworkVisibility { get { return _mNetworkVisibility; } set { _mNetworkVisibility = value; OnPropertyChanged(); } }
+ //private Visibility _mNetworkVisibility = Visibility.Collapsed;
+
+ //public Visibility SerialVisibility { get { return _mSerialVisibility; } set { _mSerialVisibility = value; OnPropertyChanged(); } }
+ //private Visibility _mSerialVisibility = Visibility.Visible;
///
/// IP地址
@@ -138,13 +156,13 @@ namespace BPASmartClient.ViewModel.Model
/// 数据位
///
public int DataBits { get { return _mDataBits; } set { _mDataBits = value; OnPropertyChanged(); } }
- private int _mDataBits;
+ private int _mDataBits = 8;
///
/// 停止位
///
public string StopBits { get { return _mStopBits; } set { _mStopBits = value; OnPropertyChanged(); } }
- private string _mStopBits;
+ private string _mStopBits = "1";
///
/// 校验位
@@ -152,37 +170,22 @@ namespace BPASmartClient.ViewModel.Model
public string Parity { get { return _mParity; } set { _mParity = value; OnPropertyChanged(); } }
private string _mParity;
+ public ObservableCollection variables { get; set; } = new ObservableCollection();
}
- //public enum CommunicationParType
- //{
- // ///
- // /// IP地址
- // ///
- // IPAddress,
- // ///
- // /// 端口号
- // ///
- // Port,
- // ///
- // /// 串口端口号
- // ///
- // SerialPort,
- // ///
- // /// 波特率
- // ///
- // BaudRate,
- // ///
- // /// 数据位
- // ///
- // DataBits,
- // ///
- // /// 停止位
- // ///
- // StopBits,
- // ///
- // /// 校验位
- // ///
- // Parity,
- //}
+ public class Variable : ObservableObject
+ {
+ public int Id { get { return _mId; } set { _mId = value; OnPropertyChanged(); } }
+ private int _mId;
+
+
+ public string Address { get { return _mAddress; } set { _mAddress = value; OnPropertyChanged(); } }
+ private string _mAddress;
+
+
+ public int ReadLeng { get { return _mReadLeng; } set { _mReadLeng = value; OnPropertyChanged(); } }
+ private int _mReadLeng;
+
+
+ }
}
diff --git a/BPASmartClient.ViewModel/NewShopWindowModel.cs b/BPASmartClient.ViewModel/NewShopWindowModel.cs
index cef93844..49787d3b 100644
--- a/BPASmartClient.ViewModel/NewShopWindowModel.cs
+++ b/BPASmartClient.ViewModel/NewShopWindowModel.cs
@@ -7,23 +7,32 @@ using BPASmartClient.Helper;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using Microsoft.Toolkit.Mvvm.Messaging;
+using System.Windows;
+using System.IO;
namespace BPASmartClient.ViewModel
{
public class NewShopWindowModel : ObservableObject
{
+
public NewShopWindowModel()
{
- CloseWindowCommand = new RelayCommand(() => { WeakReferenceMessenger.Default.Send("", "CloseWindow"); });
- CancelCommand = new RelayCommand(() => { WeakReferenceMessenger.Default.Send("", "CloseWindow"); });
+ CancelCommand = new RelayCommand(() => { ActionManage.GetInstance.Send("CloseWindow"); });
DefineCommand = new RelayCommand(() =>
{
+ DirectoryInfo directoryInfo = new DirectoryInfo(LocaPath.GetInstance().GetDeviceConfigPath);
+ var files = directoryInfo.GetFiles();
+ if (files != null && files.FirstOrDefault(p => p.FullName.Contains(ShopName)) != null)
+ {
+ ErrorInfo = "已存在该店铺,请重新输入!";
+ return;
+ }
ActionManage.GetInstance.Send("ShopPar", new string[] { ShopName, ShopId });
- WeakReferenceMessenger.Default.Send("", "CloseWindow");
+ ActionManage.GetInstance.Send("OkCloseWindow");
});
}
- public RelayCommand CloseWindowCommand { get; set; }
+ //public RelayCommand CloseWindowCommand { get; set; }
public RelayCommand CancelCommand { get; set; }
@@ -35,6 +44,10 @@ namespace BPASmartClient.ViewModel
public string ShopId { get { return _mShopId; } set { _mShopId = value; OnPropertyChanged(); } }
private string _mShopId;
+ public string ErrorInfo { get { return _mErrorInfo; } set { _mErrorInfo = value; OnPropertyChanged(); } }
+ private string _mErrorInfo;
+
+
}
diff --git a/BPASmartClient.ViewModel/ShopDeviceConfigViewModel.cs b/BPASmartClient.ViewModel/ShopDeviceConfigViewModel.cs
index a919b862..b5041e8b 100644
--- a/BPASmartClient.ViewModel/ShopDeviceConfigViewModel.cs
+++ b/BPASmartClient.ViewModel/ShopDeviceConfigViewModel.cs
@@ -11,12 +11,16 @@ using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Windows;
+using System.IO.Ports;
+using System.IO;
+using Newtonsoft.Json;
namespace BPASmartClient.ViewModel
{
public class ShopDeviceConfigViewModel : ObservableObject
{
private DeviceConfigModel configModel = new DeviceConfigModel();
+ string FileName => deviceConfig.Count > 0 ? deviceConfig[0].ShopName : string.Empty;
public ShopDeviceConfigViewModel()
{
@@ -28,6 +32,7 @@ namespace BPASmartClient.ViewModel
{
configModel.ShopName = par[0];
configModel.ShopId = par[1];
+ deviceConfig.Clear();
deviceConfig.Add(configModel);
}
}
@@ -37,8 +42,19 @@ namespace BPASmartClient.ViewModel
RemoveDeviceCommand = new RelayCommand(RemoveDevice);
NewCommunicationCommand = new RelayCommand(NewCommunication);
RemoveCommunicationCommand = new RelayCommand(RemoveCommunication);
+
+ DataListInit();
+
+ SaveData = new Action(() =>
+ {
+ if (deviceConfig.Count > 0)
+ {
+ File.WriteAllText($"{LocaPath.GetInstance().GetDeviceConfigPath}{FileName}.json", JsonConvert.SerializeObject(deviceConfig));
+ }
+ });
}
+ #region 右键菜单按钮操作
private void RemoveCommunication(object? obj)
{
if (obj != null && obj is CommunicationModel com)
@@ -78,7 +94,7 @@ namespace BPASmartClient.ViewModel
{
CommunicationName = $"Communication_{num}",
DeviceModelId = deviceConfig.ElementAt(0).deviceModels.FirstOrDefault(p => p.DeviceName == dm.DeviceName)?.Id,
- communicationPar = new CommunicationPar() { CommunicationType = false }
+ communicationPar = new CommunicationPar() { IsNetworkPort = false }
});
break;
@@ -120,97 +136,9 @@ namespace BPASmartClient.ViewModel
}
}
}
+ #endregion
-
- public static event EventHandler StaticPropertyChanged;
- private static void OnStaticPropertyChanged([CallerMemberName] string PropName = "")
- {
- StaticPropertyChanged?.Invoke(null, new PropertyChangedEventArgs(PropName));
- }
-
-
- //public static string DeviceNamePar
- //{
- // get { return _mDeviceNamePar; }
- // set
- // {
- // _mDeviceNamePar = value;
- // if (deviceConfig.Count == 1)
- // {
- // int index = Array.FindIndex(deviceConfig.ElementAt(0).deviceModels.ToArray(), p => p.DeviceName == DeviceName);
- // if (index >= 0 && index < deviceConfig.ElementAt(0).deviceModels.Count)
- // {
- // deviceConfig.ElementAt(0).deviceModels.ElementAt(index).DeviceName = value;
- // }
- // }
- // OnStaticPropertyChanged();
- // }
- //}
- //private static string _mDeviceNamePar;
-
- //public static string DeviceIdPar
- //{
- // get { return _mDeviceIdPar; }
- // set
- // {
- // _mDeviceIdPar = value;
- // if (deviceConfig.Count == 1)
- // {
- // int index = Array.FindIndex(deviceConfig.ElementAt(0).deviceModels.ToArray(), p => p.DeviceName == DeviceName);
- // if (index >= 0 && index < deviceConfig.ElementAt(0).deviceModels.Count)
- // {
- // deviceConfig.ElementAt(0).deviceModels.ElementAt(index).DeviceId = value;
- // }
- // }
- // OnStaticPropertyChanged();
- // }
- //}
- //private static string _mDeviceIdPar;
-
- public static Visibility DeviceParVisibility { get { return _mDeviceParVisibility; } set { _mDeviceParVisibility = value; OnStaticPropertyChanged(); } }
- private static Visibility _mDeviceParVisibility = Visibility.Hidden;
- public static Visibility CommunicationVisibility { get { return _mCommunicationVisibility; } set { _mCommunicationVisibility = value; OnStaticPropertyChanged(); } }
- private static Visibility _mCommunicationVisibility = Visibility.Hidden;
-
-
-
-
- //public static string DeviceModelId
- //{
- // get { return _mDeviceModelId; }
- // set
- // {
- // _mDeviceModelId = value;
-
- // }
- //}
- //private static string _mDeviceModelId;
-
-
- //public static string DeviceName
- //{
- // get { return _mDeviceName; }
- // set
- // {
- // _mDeviceName = value;
- // if (deviceConfig.Count == 1)
- // {
- // var res = deviceConfig.ElementAt(0).deviceModels.FirstOrDefault(p => p.DeviceName == value);
- // if (res != null)
- // {
- // DeviceIdPar = res.DeviceId;
- // DeviceNamePar = res.DeviceName;
- // }
- // }
- // }
- //}
- //private static string _mDeviceName;
-
-
- //public static string CommunicationName { get; set; }
-
-
-
+ #region Command
///
/// 新建设备
///
@@ -231,8 +159,81 @@ namespace BPASmartClient.ViewModel
///
public RelayCommand RemoveCommunicationCommand { get; set; }
+ public Action SaveData { get; set; }
+ #endregion
+
+ #region 列表集合
+ ///
+ /// 设备信息列表
+ ///
public static ObservableCollection deviceConfig { get; set; } = new ObservableCollection();
+ ///
+ /// 端口号列表
+ ///
+ public static ObservableCollection Ports { get; set; } = new ObservableCollection();
+
+ ///
+ /// 波特率列表
+ ///
+ public static ObservableCollection BaudRates { get; set; } = new ObservableCollection();
+
+ ///
+ /// 奇偶校验列表
+ ///
+ public static ObservableCollection Paritys { get; set; } = new ObservableCollection();
+
+ ///
+ /// 设备模块
+ ///
+ public static ObservableCollection DeviceModels { get; set; } = new ObservableCollection();
+
+ ///
+ /// 通讯模块
+ ///
+ public static ObservableCollection CommunicationModel { get; set; } = new ObservableCollection();
+
+ ///
+ /// 店铺集合
+ ///
+ public static ObservableCollection Shops { get; set; } = new ObservableCollection();
+
+ private void DataListInit()
+ {
+ Ports.Clear();
+ SerialPort.GetPortNames().ToList().ForEach((item) => { Ports.Add(item); });
+
+ BaudRates.Clear();
+ int[] rb = new int[] { 110, 300, 600, 1200, 2400, 4800, 9600, 14400, 19200, 38400, 43000, 57600, 76800, 115200 };
+ rb.ToList().ForEach((item) => { BaudRates.Add(item); });
+
+ Paritys.Clear();
+ Enum.GetNames(typeof(Parity)).ToList().ForEach((item) => { Paritys.Add(item); });
+
+ DeviceModels.Clear();
+ DeviceModels.Add("Morks");
+ DeviceModels.Add("Morkt");
+ DeviceModels.Add("Morkic");
+ DeviceModels.Add("Morkjc");
+
+ CommunicationModel.Clear();
+ CommunicationModel.Add("乐百");
+ CommunicationModel.Add("节卡");
+ CommunicationModel.Add("单片机");
+ CommunicationModel.Add("咖啡机");
+ CommunicationModel.Add("冰淇淋机");
+
+ Shops.Clear();
+ DirectoryInfo directoryInfo = new DirectoryInfo(LocaPath.GetInstance().GetDeviceConfigPath);
+ var files = directoryInfo.GetFiles();
+ foreach (var item in files)
+ {
+ var res = Path.GetFileNameWithoutExtension(item.FullName);
+ if (res != null && res.Length > 0 && item.FullName.Contains("json")) Shops.Add(res);
+ }
+ }
+ #endregion
+
}
diff --git a/BPASmartClient/App.config b/BPASmartClient/App.config
index fd222222..0b7359ac 100644
--- a/BPASmartClient/App.config
+++ b/BPASmartClient/App.config
@@ -3,7 +3,7 @@
-
+
@@ -12,16 +12,19 @@
-
+
+
+
+
-
-
-
-
+
+
+
+
@@ -48,10 +54,10 @@
-
+
-
+
diff --git a/BPASmartClient/Control/ShopDeviceConfigView.xaml b/BPASmartClient/Control/ShopDeviceConfigView.xaml
index 11d18b8a..b114f896 100644
--- a/BPASmartClient/Control/ShopDeviceConfigView.xaml
+++ b/BPASmartClient/Control/ShopDeviceConfigView.xaml
@@ -27,6 +27,16 @@
+
+
- -->
-
@@ -473,36 +472,25 @@
Header="删除通讯" />
-
-
-
+
-
-
-
-
+
+
+
+
-
+
@@ -514,17 +502,26 @@
+ Columns="2"
+ Visibility="Collapsed">
+ Foreground="{StaticResource TextBlockForeground}"
+ IsChecked="{Binding SelectedValue.communicationPar.IsNetworkPort, ElementName=tv, Mode=TwoWay}" />
+
+ Foreground="{StaticResource TextBlockForeground}"
+ IsChecked="{Binding SelectedValue.communicationPar.IsSerialPort, ElementName=tv, Mode=TwoWay}" />
+
-
-
-
+
+
@@ -584,9 +584,9 @@
FontSize="20"
Foreground="#ff23caca"
IsEditable="False"
- ItemsSource="{Binding Path=Device.PlcTypes}"
+ ItemsSource="{Binding DeviceModels}"
Style="{StaticResource ComboBoxStyle}"
- Text="{Binding Path=Device.PlcType}" />
+ Text="{Binding SelectedValue.DeviceModule, ElementName=tv, Mode=TwoWay}" />
+
-
+
@@ -671,9 +675,10 @@
+ Visibility="Collapsed">
@@ -707,7 +712,7 @@
FontSize="20"
Foreground="#ff23caca"
IsEditable="False"
- ItemsSource="{Binding Path=Device.Ports}"
+ ItemsSource="{Binding Ports}"
SelectedIndex="0"
Style="{StaticResource ComboBoxStyle}"
Text="{Binding SelectedValue.communicationPar.SerialPort, ElementName=tv, Mode=TwoWay}" />
@@ -730,7 +735,7 @@
FontSize="20"
Foreground="#ff23caca"
IsEditable="False"
- ItemsSource="{Binding Path=Device.BaudRates}"
+ ItemsSource="{Binding BaudRates}"
SelectedIndex="0"
Style="{StaticResource ComboBoxStyle}"
Text="{Binding SelectedValue.communicationPar.BaudRate, ElementName=tv, Mode=TwoWay}" />
@@ -753,7 +758,7 @@
FontSize="20"
Foreground="#ff23caca"
IsEditable="False"
- ItemsSource="{Binding Path=Device.Paritys}"
+ ItemsSource="{Binding Paritys}"
SelectedIndex="0"
Style="{StaticResource ComboBoxStyle}"
Text="{Binding SelectedValue.communicationPar.Parity, ElementName=tv, Mode=TwoWay}" />
@@ -802,8 +807,77 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -850,7 +924,7 @@
Grid.Row="1"
HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Hidden">
-
+
@@ -860,28 +934,35 @@
+
-
-
-
-
-
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Background="Transparent"
+ FontSize="14"
+ Foreground="{StaticResource TitleBorderColor}"
+ Text="{Binding Id}" />
+
+
+
-
+ Width="400"
+ HorizontalAlignment="Left"
+ Style="{StaticResource InputTextboxStyle}"
+ Text="{Binding ReadLeng}" />
e)
@@ -40,60 +49,120 @@ namespace BPASmartClient.Control
Refresh();
}
- private void tv_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
- {
- //if (e.ButtonState == MouseButtonState.Pressed)
- //{
- // Refresh();
- //}
- }
-
private void Refresh()
{
if (this.tv.SelectedValue is DeviceConfigModel deviceConfigModel)
{
- //ShopDeviceConfigViewModel.ShopName = deviceConfigModel.ShopName;
}
else if (this.tv.SelectedValue is DeviceModel deviceModel)
{
- ShopDeviceConfigViewModel.DeviceParVisibility = Visibility.Visible;
- ShopDeviceConfigViewModel.CommunicationVisibility = Visibility.Hidden;
- //ShopDeviceConfigViewModel.DeviceName = deviceModel.DeviceName;
+ this.Device.Visibility = Visibility.Visible;
+ this.CommType.Visibility = Visibility.Collapsed;
+ this.VarTab.Visibility = Visibility.Collapsed;
+ this.Serial.Visibility = Visibility.Collapsed;
+ this.Network.Visibility = Visibility.Collapsed;
+ this.GridCommunication.Visibility = Visibility.Collapsed;
}
else if (this.tv.SelectedValue is CommunicationModel communicationModel)
{
- ShopDeviceConfigViewModel.CommunicationVisibility = Visibility.Visible;
- ShopDeviceConfigViewModel.DeviceParVisibility = Visibility.Hidden;
- //ShopDeviceConfigViewModel.CommunicationName = communicationModel.CommunicationName;
- //ShopDeviceConfigViewModel.DeviceModelId = communicationModel.DeviceModelId;
+ this.Device.Visibility = Visibility.Collapsed;
+ this.CommType.Visibility = Visibility.Visible;
+ this.VarTab.Visibility = Visibility.Visible;
+ this.GridCommunication.Visibility = Visibility.Visible;
+ this.Serial.Visibility = (bool)this.rbSerial.IsChecked ? Visibility.Visible : Visibility.Collapsed;
+ this.Network.Visibility = (bool)this.rbNetwork.IsChecked ? Visibility.Visible : Visibility.Collapsed;
+
+
+ if (ShopDeviceConfigViewModel.deviceConfig.Count > 0)
+ {
+ int index = Array.FindIndex(ShopDeviceConfigViewModel.deviceConfig.ElementAt(0).deviceModels.ToArray(), p => p.Id == communicationModel.DeviceModelId);
+ if (index >= 0 && index < ShopDeviceConfigViewModel.deviceConfig.ElementAt(0).deviceModels.Count)
+ {
+ int commIndex = Array.FindIndex(ShopDeviceConfigViewModel.deviceConfig.ElementAt(0).deviceModels.ElementAt(index).communicationDevcies.ToArray(), p => p.DeviceModelId == communicationModel.DeviceModelId);
+ if (commIndex >= 0 && commIndex < ShopDeviceConfigViewModel.deviceConfig.ElementAt(0).deviceModels.ElementAt(index).communicationDevcies.Count)
+ {
+ if (ShopDeviceConfigViewModel.deviceConfig.ElementAt(0).deviceModels.ElementAt(index).communicationDevcies.ElementAt(commIndex).communicationPar.variables.Count <= 0)
+ {
+ for (int i = 0; i < 20; i++)
+ {
+ ShopDeviceConfigViewModel.deviceConfig.ElementAt(0).deviceModels.ElementAt(index).communicationDevcies.ElementAt(commIndex).communicationPar.variables.Add(new Variable()
+ {
+ Id = ShopDeviceConfigViewModel.deviceConfig.ElementAt(0).deviceModels.ElementAt(index).communicationDevcies.ElementAt(commIndex).communicationPar.variables.Count,
+ Address = string.Empty,
+ ReadLeng = 0
+ });
+ }
+ }
+ }
+ }
+ }
+
}
}
- private void tv_PreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e)
+ private void rbNetwork_Checked(object sender, RoutedEventArgs e)
{
+ rbVisibility();
+ }
+ private void rbSerial_Checked(object sender, RoutedEventArgs e)
+ {
+ rbVisibility();
}
- private void DeviceInfo(object sender, MouseButtonEventArgs e)
+ private void rbVisibility()
{
- var tb = sender as TextBlock;
- if (tb != null)
+ this.Network.Visibility = (bool)this.rbNetwork.IsChecked ? Visibility.Visible : Visibility.Collapsed;
+ this.Serial.Visibility = (bool)this.rbSerial.IsChecked ? Visibility.Visible : Visibility.Collapsed;
+ }
+
+ private void ComboBox_DropDownOpened(object sender, EventArgs e)
+ {
+ ShopDeviceConfigViewModel.Shops.Clear();
+ DirectoryInfo directoryInfo = new DirectoryInfo(LocaPath.GetInstance().GetDeviceConfigPath);
+ var files = directoryInfo.GetFiles();
+ foreach (var item in files)
{
- //ShopDeviceConfigViewModel.DeviceName = tb.Text.Trim();
- //tb.Background = Brushes.Blue;
+ var res = System.IO.Path.GetFileNameWithoutExtension(item.FullName);
+ if (res != null && res.Length > 0 && item.FullName.Contains("json")) ShopDeviceConfigViewModel.Shops.Add(res);
}
}
- private void CommunicationInfo(object sender, MouseButtonEventArgs e)
+
+ private void shop_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
- //var tb = sender as TextBlock;
- //if (tb != null)
- //{
- // ShopDeviceConfigViewModel.CommunicationName = tb.Text.Trim();
- // ShopDeviceConfigViewModel.DeviceModelId = tb.Tag.ToString();
- // tb.Focus();
- // //tb.Background = Brushes.Blue;
+ var text = TextHelper.GetInstance.ReadTextInfo("StartShop", "DeviceConfig");
+ if (this.shop.Items.Contains(text)) this.shop.SelectedValue = text;
+ DirectoryInfo directoryInfo = new DirectoryInfo(LocaPath.GetInstance().GetDeviceConfigPath);
+ var files = directoryInfo.GetFiles();
+ if (files != null && this.shop.SelectedValue != null && this.shop.SelectedValue.ToString().Length > 0)
+ {
+ var file = files.FirstOrDefault(p => p.FullName.Contains(this.shop.SelectedValue.ToString()));
+ if (file != null && File.Exists(file.FullName))
+ {
+ string JsonString = File.ReadAllText(file.FullName);
+ var result = JsonConvert.DeserializeObject>(JsonString);
+ if (result != null)
+ {
+ ShopDeviceConfigViewModel.deviceConfig.Clear();
+ foreach (var item in result)
+ {
+ ShopDeviceConfigViewModel.deviceConfig.Add(item);
+ }
+ VisibilityControl();
+ }
+ }
+ }
+ TextHelper.GetInstance.WriteTextInfo(this.shop.SelectedValue?.ToString(), "StartShop", "DeviceConfig");
+ }
- //}
+ private void VisibilityControl()
+ {
+ if (this.Device != null) this.Device.Visibility = Visibility.Collapsed;
+ if (this.CommType != null) this.CommType.Visibility = Visibility.Collapsed;
+ if (this.VarTab != null) this.VarTab.Visibility = Visibility.Collapsed;
+ if (this.Serial != null) this.Serial.Visibility = Visibility.Collapsed;
+ if (this.Network != null) this.Network.Visibility = Visibility.Collapsed;
+ if (this.GridCommunication != null) this.GridCommunication.Visibility = Visibility.Collapsed;
}
}
}
diff --git a/BPASmartClient/DeviceInfo.xml b/BPASmartClient/DeviceInfo.xml
index 89e636c8..95e5a89b 100644
--- a/BPASmartClient/DeviceInfo.xml
+++ b/BPASmartClient/DeviceInfo.xml
@@ -38,7 +38,7 @@
-->
-
+
diff --git a/BPASmartClient/DialogWindow/NewShopWindow.xaml b/BPASmartClient/DialogWindow/NewShopWindow.xaml
index 838849c1..e2cdd252 100644
--- a/BPASmartClient/DialogWindow/NewShopWindow.xaml
+++ b/BPASmartClient/DialogWindow/NewShopWindow.xaml
@@ -125,7 +125,7 @@
Visibility="Hidden" />
@@ -200,7 +200,7 @@
FontFamily="楷体"
FontSize="20"
Foreground="Red"
- Text="错误提示" />
+ Text="{Binding ErrorInfo}" />
diff --git a/BPASmartClient/DialogWindow/NewShopWindow.xaml.cs b/BPASmartClient/DialogWindow/NewShopWindow.xaml.cs
index 1176065d..b58e0f44 100644
--- a/BPASmartClient/DialogWindow/NewShopWindow.xaml.cs
+++ b/BPASmartClient/DialogWindow/NewShopWindow.xaml.cs
@@ -1,4 +1,5 @@
-using Microsoft.Toolkit.Mvvm.Messaging;
+using BPASmartClient.Helper;
+using Microsoft.Toolkit.Mvvm.Messaging;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -28,13 +29,28 @@ namespace BPASmartClient.DialogWindow
this.DragMove();
};
- WeakReferenceMessenger.Default.Register(this, "CloseWindow", (o, e) =>
+ ActionManage.GetInstance.CancelRegister("CloseWindow");
+ ActionManage.GetInstance.CancelRegister("OkCloseWindow");
+
+ ActionManage.GetInstance.Register(new Action(() =>
{
App.Current.Dispatcher.Invoke(new Action(() =>
{
+ this.DialogResult = false;
this.Close();
}));
- });
+ }), "CloseWindow");
+
+ ActionManage.GetInstance.Register(new Action(() =>
+ {
+ App.Current.Dispatcher.Invoke(new Action(() =>
+ {
+ this.DialogResult = true;
+ this.Close();
+ }));
+ }), "OkCloseWindow");
+
+
}
diff --git a/BPASmartClient/MainWindow.xaml b/BPASmartClient/MainWindow.xaml
index cbc6beea..b9f83f0e 100644
--- a/BPASmartClient/MainWindow.xaml
+++ b/BPASmartClient/MainWindow.xaml
@@ -241,7 +241,7 @@
Cursor="Hand"
Style="{DynamicResource CommonBtn_返回}" />
-
+ Style="{DynamicResource CommonBtn_返回}" />-->
+
+
{
var res = Json.Data.orderLists.FirstOrDefault(p => p.DeviceId == "2")?.morkOrderPushes;
@@ -186,7 +186,7 @@ namespace BPASmartClient
count = 0;
}
}
- App.Current.Dispatcher.Invoke(new Action(() => { this.save.IsEnabled = true; }));
+ //App.Current.Dispatcher.Invoke(new Action(() => { this.save.IsEnabled = true; }));
}));
diff --git a/HBLConsole.MORKIC/BPASmartClient.MORKIC.csproj b/HBLConsole.MORKIC/BPASmartClient.MORKIC.csproj
index 0dcf2236..a6768c85 100644
--- a/HBLConsole.MORKIC/BPASmartClient.MORKIC.csproj
+++ b/HBLConsole.MORKIC/BPASmartClient.MORKIC.csproj
@@ -2,6 +2,8 @@
net6.0
+ bin\
+ portable