diff --git a/BPASmartClient.Business/Plugin/MQTTMgr.cs b/BPASmartClient.Business/Plugin/MQTTMgr.cs index c14ffa2b..7ea8120d 100644 --- a/BPASmartClient.Business/Plugin/MQTTMgr.cs +++ b/BPASmartClient.Business/Plugin/MQTTMgr.cs @@ -32,6 +32,7 @@ namespace BPASmartClient.Business private MQTTProxy mqttProxy = new MQTTProxy(); //消息处理者 private List messageRecives = new List(); + public void Initialize() { @@ -59,8 +60,11 @@ namespace BPASmartClient.Business }); var MqttServerConfig = Plugin.GetInstance().GetPlugin().MQTT_Config; var MqttServerAccount = Plugin.GetInstance().GetPlugin().Mqtt_Account; + var deviceConfig = Plugin.GetInstance().GetPlugin().deviceConfigModelJsons; + string deviceId = deviceConfig[0].deviceModels[0].DeviceId; + clientId = Plugin.GetInstance().GetPlugin().ClientId; //MQTT 初始化 - mqttProxy.Connect(MqttServerAccount.UserName, MqttServerAccount.Password, MqttServerConfig.Host, MqttServerConfig.Port, "qsqd--morks--"+ Guid.NewGuid().ToString()); + mqttProxy.Connect(MqttServerAccount.UserName, MqttServerAccount.Password, MqttServerConfig.Host, MqttServerConfig.Port, "ClientId:" + clientId + "DeviceId:" + deviceId + Guid.NewGuid().ToString()); ThreadManage.GetInstance().Start(() => { diff --git a/BPASmartClient.CustomResource/Pages/Model/NfcServer.cs b/BPASmartClient.CustomResource/Pages/Model/NfcServer.cs index 803ac497..c6f7e40d 100644 --- a/BPASmartClient.CustomResource/Pages/Model/NfcServer.cs +++ b/BPASmartClient.CustomResource/Pages/Model/NfcServer.cs @@ -28,16 +28,12 @@ namespace BPASmartClient.CustomResource.Pages.Model if (NFCHelper.GetInstance.GetReadResult?.CardNum.Length > 0) { string id = NFCHelper.GetInstance.GetReadResult?.CardNum; - var res = Global.userManager.userInfos.FirstOrDefault(p => p.CardId?.FirstOrDefault(s => s == id) != null); + var res = Global.userManager.userInfos.FirstOrDefault(p => p.CardId == id) ; if (res != null) { - if (Global.userInfo.permission != res.permission) - { - BPASmartClient.Message.MessageLog.GetInstance.ShowDebugLog("NFC卡登录"); - LoginViewModel.NfcLogin(id); - } + BPASmartClient.Message.MessageLog.GetInstance.ShowDebugLog("NFC卡登录"); + LoginViewModel.NfcLogin(id); } - } } }); diff --git a/BPASmartClient.CustomResource/Pages/Model/UserInfo.cs b/BPASmartClient.CustomResource/Pages/Model/UserInfo.cs index 03778e45..f3b0efb4 100644 --- a/BPASmartClient.CustomResource/Pages/Model/UserInfo.cs +++ b/BPASmartClient.CustomResource/Pages/Model/UserInfo.cs @@ -27,7 +27,7 @@ namespace BPASmartClient.CustomResource.Pages.Model public string Password { get { return _password; } set { _password = value; OnPropertyChanged(); } } private string _password = "admin"; - public List CardId { get; set; } = new List(); + public string CardId { get; set; } = String.Empty; public List locaRawMaterials { get; set; } = new List(); diff --git a/BPASmartClient.CustomResource/Pages/View/LoginView.xaml.cs b/BPASmartClient.CustomResource/Pages/View/LoginView.xaml.cs index 622c8395..709d1fea 100644 --- a/BPASmartClient.CustomResource/Pages/View/LoginView.xaml.cs +++ b/BPASmartClient.CustomResource/Pages/View/LoginView.xaml.cs @@ -1,4 +1,5 @@ -using BPASmartClient.Helper; +using BPASmartClient.CustomResource.Pages.Model; +using BPASmartClient.Helper; using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/BPASmartClient.CustomResource/Pages/View/NfcSetView.xaml b/BPASmartClient.CustomResource/Pages/View/NfcSetView.xaml index 293d1d6f..dcb24c36 100644 --- a/BPASmartClient.CustomResource/Pages/View/NfcSetView.xaml +++ b/BPASmartClient.CustomResource/Pages/View/NfcSetView.xaml @@ -6,6 +6,7 @@ xmlns:local="clr-namespace:BPASmartClient.CustomResource.Pages.View" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:vm="clr-namespace:BPASmartClient.CustomResource.Pages.ViewModel" + xmlns:common="clr-namespace:BPASmartClient.CustomResource.Pages.Model" Title="NfcSetView" Width="500" Height="250" @@ -121,6 +122,39 @@ + + + + + + + + @@ -138,6 +172,7 @@ @@ -176,33 +211,96 @@ - + + + + + + + + + + + + + + + - - - - + + + Text="确认密码:" Height="20" Width="80" /> - - + Text="{Binding CardNum}" /> - + + + + + + + + - + @@ -210,20 +308,27 @@ - +