Browse Source

nfc功能

样式分支
NXX 2 years ago
parent
commit
b6e0860c89
21 changed files with 367 additions and 127 deletions
  1. +5
    -1
      BPASmartClient.Business/Plugin/MQTTMgr.cs
  2. +3
    -7
      BPASmartClient.CustomResource/Pages/Model/NfcServer.cs
  3. +1
    -1
      BPASmartClient.CustomResource/Pages/Model/UserInfo.cs
  4. +2
    -1
      BPASmartClient.CustomResource/Pages/View/LoginView.xaml.cs
  5. +130
    -25
      BPASmartClient.CustomResource/Pages/View/NfcSetView.xaml
  6. +2
    -0
      BPASmartClient.CustomResource/Pages/View/NfcSetView.xaml.cs
  7. +12
    -0
      BPASmartClient.CustomResource/Pages/View/RecipeQueueView.xaml
  8. +28
    -0
      BPASmartClient.CustomResource/Pages/View/RecipeQueueView.xaml.cs
  9. +4
    -1
      BPASmartClient.CustomResource/Pages/View/SubPagLoginView.xaml.cs
  10. +47
    -20
      BPASmartClient.CustomResource/Pages/ViewModel/LoginViewModel.cs
  11. +4
    -4
      BPASmartClient.CustomResource/Pages/ViewModel/MainViewModel.cs
  12. +81
    -51
      BPASmartClient.CustomResource/Pages/ViewModel/NfcSetViewModel.cs
  13. +1
    -1
      BPASmartClient.CustomResource/RecDictionarys/DatePickeerDictionary.xaml
  14. +9
    -0
      BPASmartClient.Model/柔性味魔方/RawMaterialModel.cs
  15. +29
    -0
      BPASmartClient.Model/柔性味魔方/RecipeQueueModel.cs
  16. +1
    -1
      BPASmartClient.MorkS/Control_Morks.cs
  17. +1
    -0
      BPASmartClient/App.config
  18. +1
    -1
      DosingSystem/App.xaml.cs
  19. +2
    -2
      DosingSystem/Model/DeviceInquire.cs
  20. +1
    -7
      DosingSystem/ViewModel/NewMaterialViewModel.cs
  21. +3
    -4
      SmartClient.sln

+ 5
- 1
BPASmartClient.Business/Plugin/MQTTMgr.cs View File

@@ -32,6 +32,7 @@ namespace BPASmartClient.Business
private MQTTProxy mqttProxy = new MQTTProxy();
//消息处理者
private List<RecivedHandle> messageRecives = new List<RecivedHandle>();

public void Initialize()
{

@@ -59,8 +60,11 @@ namespace BPASmartClient.Business
});
var MqttServerConfig = Plugin.GetInstance().GetPlugin<ConfigMgr>().MQTT_Config;
var MqttServerAccount = Plugin.GetInstance().GetPlugin<ConfigMgr>().Mqtt_Account;
var deviceConfig = Plugin.GetInstance().GetPlugin<ConfigMgr>().deviceConfigModelJsons;
string deviceId = deviceConfig[0].deviceModels[0].DeviceId;
clientId = Plugin.GetInstance().GetPlugin<ConfigMgr>().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(() =>
{


+ 3
- 7
BPASmartClient.CustomResource/Pages/Model/NfcServer.cs View File

@@ -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);
}

}
}
});


+ 1
- 1
BPASmartClient.CustomResource/Pages/Model/UserInfo.cs View File

@@ -27,7 +27,7 @@ namespace BPASmartClient.CustomResource.Pages.Model
public string Password { get { return _password; } set { _password = value;OnPropertyChanged(); } }
private string _password;

public List<string> CardId { get; set; } = new List<string>();
public string CardId { get; set; } = String.Empty;

public List<RawMaterialModel> locaRawMaterials { get; set; } = new List<RawMaterialModel>();



+ 2
- 1
BPASmartClient.CustomResource/Pages/View/LoginView.xaml.cs View File

@@ -1,4 +1,5 @@
using BPASmartClient.Helper;
using BPASmartClient.CustomResource.Pages.Model;
using BPASmartClient.Helper;
using System;
using System.Collections.Generic;
using System.Diagnostics;


+ 130
- 25
BPASmartClient.CustomResource/Pages/View/NfcSetView.xaml View File

@@ -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 @@
</Setter>
</Style>

<!--#region 密码输入框样式-->
<Style x:Key="PasswordBoxStyle" TargetType="{x:Type PasswordBox}">
<Setter Property="Background" Value="Transparent" />
<Setter Property="FontFamily" Value="Times New Roman" />
<Setter Property="PasswordChar" Value="●" />
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
<Setter Property="KeyboardNavigation.TabNavigation" Value="None" />
<Setter Property="HorizontalContentAlignment" Value="Left" />
<Setter Property="Padding" Value="1" />
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
<Setter Property="AllowDrop" Value="true" />
<Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst" />
<Setter Property="Stylus.IsFlicksEnabled" Value="False" />
<Setter Property="CaretBrush" Value="#009DFF" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="#009DFF" />
<Setter Property="BorderThickness" Value="0,0,0,1" />
</Style>
<!--#endregion-->

<!--#region 用户输入框样式-->
<Style x:Key="UserTextBoxStyle" TargetType="TextBox">
<Setter Property="Background" Value="Transparent" />
<Setter Property="CaretBrush" Value="#009DFF" />
<Setter Property="BorderBrush" Value="#009DFF"/>
<Setter Property="BorderThickness" Value="0,0,0,1"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="FontSize" Value="14" />
</Style>
<!--#endregion-->

</Window.Resources>

<Grid>
@@ -138,6 +172,7 @@
<TextBlock
FontSize="16"
Foreground="#32B8FF"
Margin="0,0,0,10"
Text="用户权限列表:" />

<ItemsControl ItemsSource="{Binding permissions}">
@@ -176,33 +211,96 @@

<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="0.5*" />
<RowDefinition Height="0.25*" />
</Grid.RowDefinitions>
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="92*"/>
<ColumnDefinition Width="135*"/>
<ColumnDefinition Width="67*"/>
</Grid.ColumnDefinitions>
<TextBlock
HorizontalAlignment="Center"
FontSize="16"
VerticalAlignment="Center"
Foreground="#FF32B8FF"
Text="当前卡号:" Height="21" Width="80" />

<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">

<StackPanel Margin="0,5,0,5" Orientation="Horizontal">
<TextBlock
<TextBlock Grid.Row="1"
HorizontalAlignment="Center"
FontSize="16"
VerticalAlignment="Center"
Foreground="#FF32B8FF"
Text="用户名:" Height="20" Width="64" />
<TextBlock Grid.Row="2"
HorizontalAlignment="Center"
FontSize="16"
VerticalAlignment="Center"
Foreground="#FF32B8FF"
Text="当前密码:" Height="20" Width="80" />
<TextBlock Grid.Row="3"
HorizontalAlignment="Center"
FontSize="16"
VerticalAlignment="Center"
Foreground="#FF32B8FF"
Text="当前卡号:" />
Text="确认密码:" Height="20" Width="80" />

<TextBlock
<TextBlock Grid.Column="1"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="#FF32B8FF"
Text="{Binding CardNum}" />
</StackPanel>
Text="{Binding CardNum}" />

<TextBlock
Margin="0,5,0,5"
<TextBox Grid.Row="1" Grid.Column="1"
Margin="11,4,10,4"
Text="{Binding UserName}"
Style="{DynamicResource UserTextBoxStyle}"/>

<PasswordBox Grid.Column="1" Grid.Row="2"
Name="newpb1"
Margin="11,4,10,4"
common:PasswordHelper.Attach="True"
common:PasswordHelper.Password="{Binding CurrentPassword, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
BorderBrush="#009DFF"
FontSize="16"
Foreground="#aadddddd"
Style="{DynamicResource PasswordBoxStyle}"
TabIndex="2" />
<PasswordBox Grid.Column="1" Grid.Row="3"
Name="newpb2"
Margin="11,4,10,4"
common:PasswordHelper.Attach="True"
common:PasswordHelper.Password="{Binding CheckPassword, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
BorderBrush="#009DFF"
FontSize="16"
Foreground="#aadddddd"
Style="{DynamicResource PasswordBoxStyle}"
TabIndex="2" />
<TextBlock Grid.Row="2" Grid.Column="2"
HorizontalAlignment="Center"
FontSize="10"
VerticalAlignment="Center"
Foreground="#FF32B8FF"
Text="(默认888888)" Height="12" Width="62" />

<TextBlock Grid.Row="4" Grid.ColumnSpan="3" Grid.Column="0"
VerticalAlignment="Center"
HorizontalAlignment="Center"
FontSize="16"
Foreground="#FFF53F62"
Text="{Binding Info}" />
</Grid>

</StackPanel>

<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
@@ -210,20 +308,27 @@
<ColumnDefinition />
</Grid.ColumnDefinitions>

<RadioButton
VerticalAlignment="Center"
Content="用户添加"
GroupName="add"
IsChecked="{Binding UserAdd}"
Style="{StaticResource rbStyle}" />
<Button VerticalAlignment="Center"
HorizontalAlignment="Center"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Content="用户添加"
FontSize="16"
Style="{DynamicResource ButtonStyle}"
Command="{Binding UserAddCommand}"/>
<Button Grid.Column="1"
VerticalAlignment="Center"
HorizontalAlignment="Center"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Content="用户注销"
FontSize="16"
Style="{DynamicResource ButtonStyle}"
Command="{Binding UserCancelCommand}"/>



<RadioButton
Grid.Column="1"
VerticalAlignment="Center"
Content="用户注销"
GroupName="add"
IsChecked="{Binding UserCnange}"
Style="{StaticResource rbStyle}" />
</Grid>
</Grid>



+ 2
- 0
BPASmartClient.CustomResource/Pages/View/NfcSetView.xaml.cs View File

@@ -29,6 +29,7 @@ namespace BPASmartClient.CustomResource.Pages.View
{
Application.Current.Dispatcher.Invoke(new Action(() => { this.Close(); }));
NfcServer.GetInstance.EnableLogin = false;

}), "Exit", true);
}

@@ -41,5 +42,6 @@ namespace BPASmartClient.CustomResource.Pages.View
{
this.Close();
}

}
}

+ 12
- 0
BPASmartClient.CustomResource/Pages/View/RecipeQueueView.xaml View File

@@ -0,0 +1,12 @@
<UserControl x:Class="BPASmartClient.CustomResource.Pages.View.RecipeQueueView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.CustomResource.Pages.View"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid>
</Grid>
</UserControl>

+ 28
- 0
BPASmartClient.CustomResource/Pages/View/RecipeQueueView.xaml.cs View File

@@ -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.CustomResource.Pages.View
{
/// <summary>
/// RecipeQueueView.xaml 的交互逻辑
/// </summary>
public partial class RecipeQueueView : UserControl
{
public RecipeQueueView()
{
InitializeComponent();
}
}
}

+ 4
- 1
BPASmartClient.CustomResource/Pages/View/SubPagLoginView.xaml.cs View File

@@ -1,4 +1,5 @@
using BPASmartClient.Helper;
using BPASmartClient.CustomResource.Pages.Model;
using BPASmartClient.Helper;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -42,6 +43,8 @@ namespace BPASmartClient.CustomResource.Pages.View
this.Close();
}
}), "ExitAction", true);

NfcServer.GetInstance.EnableLogin = false;
}

private void PasswordBox_PasswordChanged(object sender, RoutedEventArgs e)


+ 47
- 20
BPASmartClient.CustomResource/Pages/ViewModel/LoginViewModel.cs View File

@@ -22,14 +22,17 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel
{
ActionManage.GetInstance.Send("ExitAction");
});
}

public static void NfcLogin(string cardId)
{
var res = Global.userManager.userInfos.FirstOrDefault(p => p.CardId?.FirstOrDefault(s => s == cardId && s.Length > 0) != null);
var res = Global.userManager.userInfos.FirstOrDefault(p => p.CardId == cardId);
if (res != null)
{
Global.userInfo = res;
//permission权限
for (int i = 0; i < MenuManage.GetInstance.menuModels.Count; i++)
{
if (MenuManage.GetInstance.menuModels.ElementAt(i).MainMenuPermission.Contains(res.permission))
@@ -48,6 +51,24 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel
MenuManage.GetInstance.menuModels.ElementAt(i).subMenumodels.ElementAt(m).SubMenuVisibility = Visibility.Collapsed;
}
}
//分配后的权限
if (res.userTreeViewModels != null)
{
if (res.userTreeViewModels.Count > 0)
{
foreach (var items in MenuManage.GetInstance.menuModels)
{
foreach (var item in items.subMenumodels)
{
items.MainMenuVisibility = Visibility.Visible;
if (res.userTreeViewModels.FirstOrDefault(p => p.Name == item.SubMenuName) != null)
{
item.SubMenuVisibility = Visibility.Visible;
}
}
}
}
}
Application.Current.Dispatcher.Invoke(new Action(() => { ActionManage.GetInstance.Send("LoginOk"); }));

}
@@ -63,10 +84,32 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel
Global.userInfo.LastLogInTime = DateTime.Now.ToString();
res.LastLogInTime = DateTime.Now.ToString();
Config.GetInstance.SaveUser();
if(res.permission == Enums.Permission.管理员)
//permission权限
for (int i = 0; i < MenuManage.GetInstance.menuModels.Count; i++)
{
if (MenuManage.GetInstance.menuModels.ElementAt(i).MainMenuPermission.Contains(res.permission))
MenuManage.GetInstance.menuModels.ElementAt(i).MainMenuVisibility = Visibility.Visible;
else
MenuManage.GetInstance.menuModels.ElementAt(i).MainMenuVisibility = Visibility.Collapsed;

if (MenuManage.GetInstance.menuModels.ElementAt(i).subMenumodels.FirstOrDefault(p => p.SubMenuPermission.Contains(res.permission)) == null)
MenuManage.GetInstance.menuModels.ElementAt(i).MainMenuVisibility = Visibility.Collapsed;

for (int m = 0; m < MenuManage.GetInstance.menuModels.ElementAt(i).subMenumodels.Count; m++)
{
if (MenuManage.GetInstance.menuModels.ElementAt(i).subMenumodels.ElementAt(m).SubMenuPermission.Contains(res.permission))
MenuManage.GetInstance.menuModels.ElementAt(i).subMenumodels.ElementAt(m).SubMenuVisibility = Visibility.Visible;
else
MenuManage.GetInstance.menuModels.ElementAt(i).subMenumodels.ElementAt(m).SubMenuVisibility = Visibility.Collapsed;
}
}

//分配后的权限
if (res.permission == Enums.Permission.管理员)
{
foreach( var items in MenuManage.GetInstance.menuModels)
{
items.MainMenuVisibility = Visibility.Visible;
foreach(var item in items.subMenumodels)
{
item.SubMenuVisibility = Visibility.Visible;
@@ -83,6 +126,7 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel
{
foreach (var item in items.subMenumodels)
{
items.MainMenuVisibility = Visibility.Visible;
if (res.userTreeViewModels.FirstOrDefault(p => p.Name == item.SubMenuName) != null)
{
item.SubMenuVisibility = Visibility.Visible;
@@ -93,24 +137,7 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel
}
}

//for (int i = 0; i < MenuManage.GetInstance.menuModels.Count; i++)
//{
// if (MenuManage.GetInstance.menuModels.ElementAt(i).MainMenuPermission.Contains(res.permission))
// MenuManage.GetInstance.menuModels.ElementAt(i).MainMenuVisibility = Visibility.Visible;
// else
// MenuManage.GetInstance.menuModels.ElementAt(i).MainMenuVisibility = Visibility.Collapsed;

// if (MenuManage.GetInstance.menuModels.ElementAt(i).subMenumodels.FirstOrDefault(p => p.SubMenuPermission.Contains(res.permission)) == null)
// MenuManage.GetInstance.menuModels.ElementAt(i).MainMenuVisibility = Visibility.Collapsed;

// for (int m = 0; m < MenuManage.GetInstance.menuModels.ElementAt(i).subMenumodels.Count; m++)
// {
// if (MenuManage.GetInstance.menuModels.ElementAt(i).subMenumodels.ElementAt(m).SubMenuPermission.Contains(res.permission))
// MenuManage.GetInstance.menuModels.ElementAt(i).subMenumodels.ElementAt(m).SubMenuVisibility = Visibility.Visible;
// else
// MenuManage.GetInstance.menuModels.ElementAt(i).subMenumodels.ElementAt(m).SubMenuVisibility = Visibility.Collapsed;
// }
//}
ActionManage.GetInstance.Send("PermissionChange");
ActionManage.GetInstance.Send("LoginOk");


+ 4
- 4
BPASmartClient.CustomResource/Pages/ViewModel/MainViewModel.cs View File

@@ -27,10 +27,10 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel
}), "PermissionChange");

//测试用
Global.DeviceRawMaterials.Add(new RawMaterialModel { RawMaterialName = "营养强化剂", DeviceIp = "192.168.1.111" });
Global.DeviceRawMaterials.Add(new RawMaterialModel { RawMaterialName = "甜味剂", DeviceIp = "192.168.1.112" });
Global.DeviceRawMaterials.Add(new RawMaterialModel { RawMaterialName = "抗氧化剂", DeviceIp = "192.168.1.113" });
Global.DeviceRawMaterials.Add(new RawMaterialModel { RawMaterialName = "食用香料", DeviceIp = "192.168.1.114" });
Global.DeviceRawMaterials.Add(new RawMaterialModel { RawMaterialName = "营养强化剂", DeviceIp = "192.168.1.111", RawMaterialSource = 1 });
Global.DeviceRawMaterials.Add(new RawMaterialModel { RawMaterialName = "甜味剂", DeviceIp = "192.168.1.112", RawMaterialSource = 1 });
Global.DeviceRawMaterials.Add(new RawMaterialModel { RawMaterialName = "抗氧化剂", DeviceIp = "192.168.1.113", RawMaterialSource = 1 });
Global.DeviceRawMaterials.Add(new RawMaterialModel { RawMaterialName = "食用香料", DeviceIp = "192.168.1.114", RawMaterialSource = 1 });

}



+ 81
- 51
BPASmartClient.CustomResource/Pages/ViewModel/NfcSetViewModel.cs View File

@@ -20,71 +20,94 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel
{
NfcServer.GetInstance.EnableLogin = true;
permissions.Clear();
Enum.GetNames(typeof(Permission)).ToList()?.ForEach(item => { permissions.Add(new PermissionSelect() { PermissionName = item }); });
Enum.GetNames(typeof(Permission)).ToList()?.ForEach(item => {
if(item !="管理员") permissions.Add(new PermissionSelect() { PermissionName = item });
});

NfcServer.GetInstance.Update = new Action(() =>
UserAddCommand = new RelayCommand(() =>
{
CardNum = NFCHelper.GetInstance.GetReadResult.CardNum;
if (CardNum.Length <= 0) return;

if (!UserAdd && !UserCnange)
if (permissions?.FirstOrDefault(p => p.PermissionSelected == true) == null)
{
Info = "Error:请选择一个权限;";
return ;
}
if (CardNum == null || CardNum?.Length <= 0)
{
Info = "Error:请将卡放到刷卡区;";
return ;
}
var per = Global.userManager.userInfos.FirstOrDefault(p => p.CardId == CardNum);
if (per != null)
{
Info = "Error:用户已存在!;";
return;
}
if (permissions?.FirstOrDefault(p => p.PermissionSelected == true) == null)
{
Info = "Error:请选择操作模式;";
Info = "Error:请选择一个权限;";
return;
}

if (UserAdd)
if (UserName == string.Empty)
{
var per = Global.userManager.userInfos.FirstOrDefault(p => p.CardId.Contains(CardNum));
if (per != null)
{
Info = "Error:用户已存在!;";
return;
}
if (permissions?.FirstOrDefault(p => p.PermissionSelected == true) == null)
{
Info = "Error:请选择一个权限;";
return;
}
var res = permissions.FirstOrDefault(p => p.PermissionSelected == true);
if (res != null)
{
int index = Array.FindIndex(Global.userManager.userInfos.ToArray(), p => p.permission.ToString() == res.PermissionName);
if (index >= 0 && index < Global.userManager.userInfos.Count)
{
if (!Global.userManager.userInfos.ElementAt(index).CardId.Contains(NFCHelper.GetInstance.GetReadResult.CardNum))
{
Global.userManager.userInfos.ElementAt(index).CardId.Add(NFCHelper.GetInstance.GetReadResult.CardNum);
Config.GetInstance.SaveUser();
Info = $"Info:ID {NFCHelper.GetInstance.GetReadResult.CardNum} 添加成功;";
Thread.Sleep(1000);
ActionManage.GetInstance.Send("Exit");
}
}
else
Info = $"Info:ID {NFCHelper.GetInstance.GetReadResult.CardNum} 已存在;";
}
Info = "Error:请添加用户名;";
return;
}

if (UserCnange)
var name = Global.userManager.userInfos.FirstOrDefault(p =>p.UserName == UserName);
if (name != null)
{
Info = "Error:用户名已存在!;";
}
var res = permissions.FirstOrDefault(p => p.PermissionSelected == true);
if (res != null)
{
int index = Array.FindIndex(Global.userManager.userInfos.ToArray(), p => p.CardId.FirstOrDefault(s => s == CardNum) != null);
if (index >= 0 && index < Global.userManager.userInfos.Count)
int index = Array.FindIndex(Global.userManager.userInfos.ToArray(), p => p.CardId.ToString() == CardNum);
if (index == -1)
{
if (Global.userManager.userInfos.ElementAt(index).CardId.Contains(CardNum))
Global.userManager.userInfos.ElementAt(index).CardId.Remove(CardNum);
Global.userManager.userInfos.Add(new UserInfo
{
CardId = CardNum,
UserName = UserName,
Password = CurrentPassword,
permission = (Permission)Enum.Parse(typeof(Permission), res.PermissionName)
});
Config.GetInstance.SaveUser();
Info = $"Info:ID {CardNum} 注销成功;";
Info = $"Info:ID {CardNum} 添加成功;";
MessageLog.GetInstance.ShowRunLog($" ID {CardNum} 用户添加成功");
Thread.Sleep(1000);
ActionManage.GetInstance.Send("Exit");
}
else
{
Info = "Info:当前卡在系统中不存在;";
return;
}
Info = $"Info:ID {NFCHelper.GetInstance.GetReadResult.CardNum} 已存在;";
}
});

UserCancelCommand = new RelayCommand(() =>
{
var res = Global.userManager.userInfos.FirstOrDefault(p=>p.CardId == CardNum);
if(res != null)
{
Global.userManager.userInfos.Remove(res);
Config.GetInstance.SaveUser();
Info = $"Info:ID {CardNum} 注销成功;";
MessageLog.GetInstance.ShowRunLog($"ID {CardNum} 用户注销成功");
Thread.Sleep(1000);
ActionManage.GetInstance.Send("Exit");
}
else
{
Info = "Info:当前卡在系统中不存在;";
return;
}
});

NfcServer.GetInstance.Update = new Action(() =>
{
CardNum = NFCHelper.GetInstance.GetReadResult.CardNum;
});
}

private bool Verify()
@@ -110,16 +133,23 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel
public string Info { get { return _mInfo; } set { _mInfo = value; OnPropertyChanged(); } }
private string _mInfo;

public bool UserAdd { get { return _mUserAdd; } set { _mUserAdd = value; OnPropertyChanged(); } }
private bool _mUserAdd;
public string UserName { get { return _userName; } set { _userName = value; OnPropertyChanged(); } }
private string _userName = string.Empty;

public string CurrentPassword { get { return _currentPassword; } set { _currentPassword = value; OnPropertyChanged(); } }
private string _currentPassword = "888888";

public bool UserCnange { get { return _mUserCnange; } set { _mUserCnange = value; OnPropertyChanged(); } }
private bool _mUserCnange;
public string CheckPassword { get { return _checkPassword; } set { _checkPassword = value; OnPropertyChanged(); } }
private string _checkPassword = "888888";

public RelayCommand SavePermission { get; set; }

public RelayCommand DeletePermission { get; set; }

public RelayCommand UserAddCommand { get; set; }

public RelayCommand UserCancelCommand { get; set; }

}

public class PermissionSelect : ObservableObject


+ 1
- 1
BPASmartClient.CustomResource/RecDictionarys/DatePickeerDictionary.xaml View File

@@ -354,7 +354,7 @@
<Setter TargetName="PART_MonthView" Property="Visibility" Value="Hidden" />
<Setter TargetName="PART_YearView" Property="Visibility" Value="Visible" />
</DataTrigger>
<!-- Decade 美 ['dɛked] n. 十年,十年期;十 -->
<DataTrigger Binding="{Binding DisplayMode, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Calendar}}}" Value="Decade">
<Setter TargetName="PART_MonthView" Property="Visibility" Value="Hidden" />
<Setter TargetName="PART_YearView" Property="Visibility" Value="Visible" />


+ 9
- 0
BPASmartClient.Model/柔性味魔方/RawMaterialModel.cs View File

@@ -30,6 +30,15 @@ namespace BPASmartClient.Model
private uint _mRawMaterialWeight;


/// <summary>
/// 原料来源
/// 0:本地
/// 1:设备
/// </summary>
[Newtonsoft.Json.JsonIgnore]
public ushort RawMaterialSource { get { return _mRawMaterialSource; } set { _mRawMaterialSource = value; OnPropertyChanged(); } }
private ushort _mRawMaterialSource;

/// <summary>
/// 原料类型 MW18
/// 1:液体


+ 29
- 0
BPASmartClient.Model/柔性味魔方/RecipeQueueModel.cs View File

@@ -0,0 +1,29 @@
using Microsoft.Toolkit.Mvvm.ComponentModel;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.Model.柔性味魔方
{
public class RecipeQueueModel :ObservableObject
{
public string RecipeName { get{ return _recipeName; }set { _recipeName = value; OnPropertyChanged(); } }
private string _recipeName;

public ObservableCollection<MaterailStates> rawMaterialModels { get; set; } = new ObservableCollection<MaterailStates>();

}

public class MaterailStates: ObservableObject
{
public RawMaterialModel RawMaterial { get; set; } = new RawMaterialModel();

public bool IsCompeleted { get { return _isCompeleted; } set { _isCompeleted = value; OnPropertyChanged(); } }
private bool _isCompeleted;

}
}

+ 1
- 1
BPASmartClient.MorkS/Control_Morks.cs View File

@@ -636,7 +636,7 @@ namespace BPASmartClient.MorkS
{
VoiceAPI.m_SystemPlayWav(@"Vioce\电子提示音.wav");
Thread.Sleep(1000);
mORKS.speech.Speak(meal);
if(meal!= null) mORKS.speech.Speak(meal);
VoiceAPI.m_SystemPlayWav(@"Vioce\取餐通知.wav");
}



+ 1
- 0
BPASmartClient/App.config View File

@@ -40,5 +40,6 @@
<add key="COM_ICChip" value="COM6"/>
<add key="BAUD_IChip" value="9600"/>


</appSettings>
</configuration>

+ 1
- 1
DosingSystem/App.xaml.cs View File

@@ -181,7 +181,7 @@ namespace BPASmartClient.DosingSystem

UserManager.Add(new SubMenumodel()
{
SubMenuName = "NFC登录设置",
SubMenuName = "NFC登录管理",
SubMenuPermission = new Permission[] { Permission.管理员 },
AssemblyName = "BPASmartClient.CustomResource",
ToggleWindowPath = "Pages.View.NfcSetView"


+ 2
- 2
DosingSystem/Model/DeviceInquire.cs View File

@@ -115,12 +115,12 @@ namespace BPASmartClient.DosingSystem.Model
{
if(Global.DeviceRawMaterials.FirstOrDefault(p=>p.RawMaterialName == DeviceName) == null)
{
Global.DeviceRawMaterials.Add(new RawMaterialModel() { RawMaterialName = DeviceName, DeviceIp = ip });
Global.DeviceRawMaterials.Add(new RawMaterialModel() { RawMaterialName = DeviceName, DeviceIp = ip ,RawMaterialSource = 1});
}
}
else
{
Global.DeviceRawMaterials.Add(new RawMaterialModel() { RawMaterialName = DeviceName, DeviceIp = ip });
Global.DeviceRawMaterials.Add(new RawMaterialModel() { RawMaterialName = DeviceName, DeviceIp = ip , RawMaterialSource = 1 });
}

}));


+ 1
- 7
DosingSystem/ViewModel/NewMaterialViewModel.cs View File

@@ -50,15 +50,9 @@ public class NewMaterialViewModel:ObservableObject
if(MaterialName == String.Empty) { ErrorInfo = "原料名称不能为空";return; }
if(Global.DeviceRawMaterials.FirstOrDefault(p=>p.RawMaterialName == MaterialName) != null) { ErrorInfo = "设备中已存在该原料名称";return;}
if(Json<LocaMaterial>.Data.LocalMaterails.FirstOrDefault(p=>p.RawMaterialName == MaterialName) != null) { ErrorInfo = "本地原料名称重复";return ;}
Json<LocaMaterial>.Data.LocalMaterails.Add(new RawMaterialModel { RawMaterialName = MaterialName, RawMaterialId = Guid.NewGuid().ToString() });
Json<LocaMaterial>.Data.LocalMaterails.Add(new RawMaterialModel { RawMaterialName = MaterialName, RawMaterialId = Guid.NewGuid().ToString() , RawMaterialSource = 0 });
Json<LocaMaterial>.Save();
MessageLog.GetInstance.ShowUserLog($"添加原料--{MaterialName}");
});




}
}

+ 3
- 4
SmartClient.sln View File

@@ -121,17 +121,16 @@ EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.KHKJ", "BPASmartClient.KHKJ\BPASmartClient.KHKJ.csproj", "{C0060FB3-7AEA-4D14-ADCE-DB78D3665D5B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.MorkTM", "BPASmartClient.MorkTM\BPASmartClient.MorkTM.csproj", "{1612F583-D328-45C6-8BB1-5D41B8F1D216}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.KHKJ", "BPASmartClient.KHKJ\BPASmartClient.KHKJ.csproj", "{C0060FB3-7AEA-4D14-ADCE-DB78D3665D5B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.Nfc", "BPASmartClient.Nfc\BPASmartClient.Nfc.csproj", "{42D35B7C-764C-4692-AA85-9B343A0F5B7F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.Argox", "BPASmartClient.Argox\BPASmartClient.Argox.csproj", "{B8D499BA-A18A-4FD6-B036-44F02B4D164B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmartClient.S7Net", "BPASmartClient.S7Net\BPASmartClient.S7Net.csproj", "{D1F2379E-1755-4B50-9D67-15C960C33FFA}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.S7Net", "BPASmartClient.S7Net\BPASmartClient.S7Net.csproj", "{D1F2379E-1755-4B50-9D67-15C960C33FFA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmartClient.JXJFoodBigStation", "BPASmartClient.JXJFoodBigStation\BPASmartClient.JXJFoodBigStation.csproj", "{FA695D7E-6F12-4483-A16D-8494609FAE68}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.JXJFoodBigStation", "BPASmartClient.JXJFoodBigStation\BPASmartClient.JXJFoodBigStation.csproj", "{FA695D7E-6F12-4483-A16D-8494609FAE68}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmartClient.JXJFoodSmallStation", "BPASmartClient.JXJFoodSmallStation\BPASmartClient.JXJFoodSmallStation.csproj", "{D609C4CF-FA5C-4D39-B12F-07A60FFE5E40}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.JXJFoodSmallStation", "BPASmartClient.JXJFoodSmallStation\BPASmartClient.JXJFoodSmallStation.csproj", "{D609C4CF-FA5C-4D39-B12F-07A60FFE5E40}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution


Loading…
Cancel
Save