MainWindow页面去掉加载FingerprintUtil.Login页面OnNavigatedTo去掉订阅指纹事件
This commit is contained in:
parent
1ba351b659
commit
8ea3075d3c
|
@ -15,9 +15,9 @@ namespace DM_Weight.Converter
|
||||||
if (!string.IsNullOrEmpty(values[0].ToString()) && values[0].ToString().Length >= 1)
|
if (!string.IsNullOrEmpty(values[0].ToString()) && values[0].ToString().Length >= 1)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
int iIndex = values[0].ToString().IndexOf("号");
|
||||||
int iLength = values[0].ToString().Length;
|
//int iLength = values[0].ToString().Length;
|
||||||
int ButtonDrawerNo = int.Parse(values[0].ToString().Substring(0, 1));
|
int ButtonDrawerNo = int.Parse(values[0].ToString().Substring(0, iIndex));
|
||||||
int SelectedDrawerNo = int.Parse(values[1].ToString());
|
int SelectedDrawerNo = int.Parse(values[1].ToString());
|
||||||
return ButtonDrawerNo == SelectedDrawerNo;
|
return ButtonDrawerNo == SelectedDrawerNo;
|
||||||
}
|
}
|
||||||
|
|
|
@ -810,7 +810,6 @@ namespace DM_Weight.Port
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region 抽屉串口操作
|
#region 抽屉串口操作
|
||||||
// 打开抽屉
|
// 打开抽屉
|
||||||
public async Task<byte[]> OpenDrawer()
|
public async Task<byte[]> OpenDrawer()
|
||||||
|
|
|
@ -287,7 +287,7 @@ namespace DM_Weight.ViewModels
|
||||||
//}
|
//}
|
||||||
if (SelectedMenu != null && SelectedMenu.PremissionName == "退出")
|
if (SelectedMenu != null && SelectedMenu.PremissionName == "退出")
|
||||||
{
|
{
|
||||||
bool[] boolArrs = ModbusHelper.GetInstance().GetAllBoxState();
|
bool[] boolArrs = {false,false };//ModbusHelper.GetInstance().GetAllBoxState();
|
||||||
bool allTrue = Array.TrueForAll(boolArrs, b => b);
|
bool allTrue = Array.TrueForAll(boolArrs, b => b);
|
||||||
//false是关着,true是开着
|
//false是关着,true是开着
|
||||||
if (!allTrue)
|
if (!allTrue)
|
||||||
|
|
|
@ -74,38 +74,38 @@ namespace DM_Weight.ViewModels
|
||||||
public UserList Operator { get; set; }
|
public UserList Operator { get; set; }
|
||||||
public UserList Reviewer { get; set; }
|
public UserList Reviewer { get; set; }
|
||||||
|
|
||||||
public bool DrawerPortMsg
|
//public bool DrawerPortMsg
|
||||||
{
|
//{
|
||||||
get => !_portUtil.drawerSerial.IsOpen;
|
// get => !_portUtil.drawerSerial.IsOpen;
|
||||||
}
|
//}
|
||||||
public bool CanBusPortMsg
|
//public bool CanBusPortMsg
|
||||||
{
|
//{
|
||||||
get => _portUtil._canBusExsit && !_portUtil.canBusSerial.IsOpen;
|
// get => _portUtil._canBusExsit && !_portUtil.canBusSerial.IsOpen;
|
||||||
}
|
//}
|
||||||
|
|
||||||
private bool _fingerMsg= CHKFunction.HKUserId>=0;
|
private bool _fingerMsg;// = CHKFunction.HKUserId >= 0;
|
||||||
|
|
||||||
public bool FingerMsg
|
public bool FingerMsg
|
||||||
{
|
{
|
||||||
get => _fingerMsg;
|
get => _fingerMsg;
|
||||||
set => SetProperty(ref _fingerMsg, value);
|
set => SetProperty(ref _fingerMsg, value);
|
||||||
}
|
}
|
||||||
public bool FridgePortMsg
|
//public bool FridgePortMsg
|
||||||
{
|
//{
|
||||||
get => !_portUtil.fridgeSerial.IsOpen;
|
// get => !_portUtil.fridgeSerial.IsOpen;
|
||||||
}
|
//}
|
||||||
//温湿度
|
//温湿度
|
||||||
public bool WSDPortMsg
|
public bool WSDPortMsg
|
||||||
{
|
{
|
||||||
get => !_portUtil.wsdSerial.IsOpen;
|
get => !_portUtil.wsdSerial.IsOpen;
|
||||||
}
|
}
|
||||||
//录像机登录状态
|
//录像机登录状态
|
||||||
private bool _hikMsg;
|
//private bool _hikMsg;
|
||||||
public bool HIKMsg
|
//public bool HIKMsg
|
||||||
{
|
//{
|
||||||
get=>_hikMsg;
|
// get=>_hikMsg;
|
||||||
set=>SetProperty(ref _hikMsg, value);
|
// set=>SetProperty(ref _hikMsg, value);
|
||||||
}
|
//}
|
||||||
|
|
||||||
//public LoginWindowViewModel(IRegionManager regionManager, IEventAggregator eventAggregator, PortUtil portUtil, FingerprintUtil fingerprintUtil)
|
//public LoginWindowViewModel(IRegionManager regionManager, IEventAggregator eventAggregator, PortUtil portUtil, FingerprintUtil fingerprintUtil)
|
||||||
//{
|
//{
|
||||||
|
@ -122,6 +122,7 @@ namespace DM_Weight.ViewModels
|
||||||
_eventAggregator = eventAggregator;
|
_eventAggregator = eventAggregator;
|
||||||
FingerMsg = !_fingerprintUtil.bIsConnected;
|
FingerMsg = !_fingerprintUtil.bIsConnected;
|
||||||
_eventAggregator.GetEvent<FingerprintEvent>().Subscribe(LoginEvent);
|
_eventAggregator.GetEvent<FingerprintEvent>().Subscribe(LoginEvent);
|
||||||
|
logger.Info("LoginWindowViewModel");
|
||||||
}
|
}
|
||||||
private DelegateCommand? _loginCommand;
|
private DelegateCommand? _loginCommand;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using DM_Weight.Models;
|
using DM_Weight.Models;
|
||||||
|
using DM_Weight.msg;
|
||||||
using DM_Weight.Port;
|
using DM_Weight.Port;
|
||||||
using DM_Weight.util;
|
using DM_Weight.util;
|
||||||
using log4net;
|
using log4net;
|
||||||
|
@ -16,12 +17,17 @@ using System.Security.Cryptography.Pkcs;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using System.Timers;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
|
|
||||||
namespace DM_Weight.ViewModels
|
namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
public class OpenBoxNewWindowViewModel : BindableBase, INavigationAware, IRegionMemberLifetime
|
public class OpenBoxNewWindowViewModel : BindableBase, INavigationAware, IRegionMemberLifetime
|
||||||
{
|
{
|
||||||
|
//定时查询药箱状态
|
||||||
|
System.Timers.Timer StateTimer = new System.Timers.Timer(3000);
|
||||||
|
|
||||||
|
|
||||||
private readonly ILog logger = LogManager.GetLogger(typeof(CheckOrderNewWindowViewModel));
|
private readonly ILog logger = LogManager.GetLogger(typeof(CheckOrderNewWindowViewModel));
|
||||||
private int _drawerType = -1;
|
private int _drawerType = -1;
|
||||||
|
|
||||||
|
@ -567,7 +573,7 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
get => new DelegateCommand<string>(OpenBoxAction);
|
get => new DelegateCommand<string>(OpenBoxAction);
|
||||||
}
|
}
|
||||||
public async void OpenBoxAction(string strDrawerNo)
|
public void OpenBoxAction(string strDrawerNo)
|
||||||
{
|
{
|
||||||
DrawerNo = Convert.ToInt32(strDrawerNo);
|
DrawerNo = Convert.ToInt32(strDrawerNo);
|
||||||
DrawerType = SqlSugarHelper.Db.Queryable<ChannelList>().Where(cl => cl.MachineId == "DM5" && cl.DrawerNo == Convert.ToInt32(strDrawerNo)).Select(cl => cl.DrawerType).First();
|
DrawerType = SqlSugarHelper.Db.Queryable<ChannelList>().Where(cl => cl.MachineId == "DM5" && cl.DrawerNo == Convert.ToInt32(strDrawerNo)).Select(cl => cl.DrawerType).First();
|
||||||
|
@ -642,17 +648,42 @@ namespace DM_Weight.ViewModels
|
||||||
channelList.DrawerState = SelfContent.Substring(0, 1) == "取" ? 0 : 1;
|
channelList.DrawerState = SelfContent.Substring(0, 1) == "取" ? 0 : 1;
|
||||||
SqlSugarHelper.Db.Updateable(channelList).UpdateColumns(it => new { it.EffDate, it.DrawerState }).ExecuteCommand();
|
SqlSugarHelper.Db.Updateable(channelList).UpdateColumns(it => new { it.EffDate, it.DrawerState }).ExecuteCommand();
|
||||||
|
|
||||||
|
StateTimer.Elapsed += OnTimerElapsed;
|
||||||
|
if (StateTimer.Enabled)
|
||||||
|
{
|
||||||
|
StateTimer.Stop();
|
||||||
|
logger.Info($"停止定时查询状态方法");
|
||||||
|
Thread.Sleep(1000);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
_portUtil.SpeakAsync($"正在打开{DrawerNo}号药箱");
|
_portUtil.SpeakAsync($"正在打开{DrawerNo}号药箱");
|
||||||
|
}
|
||||||
ModbusHelper.GetInstance().OpenBoxDoor(DrawerNo - 1);
|
ModbusHelper.GetInstance().OpenBoxDoor(DrawerNo - 1);
|
||||||
//Thread.Sleep(1000);
|
Thread.Sleep(1000);
|
||||||
//}
|
StateTimer.Start();
|
||||||
|
|
||||||
SelfStatus = 0;
|
SelfStatus = 0;
|
||||||
PublicEnable = true;
|
PublicEnable = true;
|
||||||
SelfEnable = true;
|
SelfEnable = true;
|
||||||
DrawerType = -1;
|
DrawerType = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private void OnTimerElapsed(object sender, ElapsedEventArgs e)
|
||||||
|
{
|
||||||
|
bool[] boolArrs = {false,false,true }; //ModbusHelper.GetInstance().GetAllBoxState();
|
||||||
|
bool allTrue = Array.TrueForAll(boolArrs, b => b == false);
|
||||||
|
logger.Info($"进入定时查询状态方法{allTrue}");
|
||||||
|
if (allTrue)
|
||||||
|
{
|
||||||
|
//药箱全部关闭,停止查询
|
||||||
|
StateTimer.Stop();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_portUtil.SpeakAsync("药箱已打开,请及时关闭");
|
||||||
|
//Console.Beep(800, 1100);
|
||||||
|
}
|
||||||
|
}
|
||||||
public void OnNavigatedTo(NavigationContext navigationContext)
|
public void OnNavigatedTo(NavigationContext navigationContext)
|
||||||
{
|
{
|
||||||
RequestData();
|
RequestData();
|
||||||
|
|
|
@ -165,7 +165,7 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
Id = 1,
|
Id = 1,
|
||||||
//PremissionName = "取药",
|
//PremissionName = "取药",
|
||||||
PremissionName = "操作药箱",
|
PremissionName = "药箱操作",
|
||||||
PremissionImage = "/Images/TbQyao.png",
|
PremissionImage = "/Images/TbQyao.png",
|
||||||
};
|
};
|
||||||
ObservableCollection<PremissionDm> quyaoChild = new ObservableCollection<PremissionDm>();
|
ObservableCollection<PremissionDm> quyaoChild = new ObservableCollection<PremissionDm>();
|
||||||
|
|
|
@ -58,7 +58,7 @@ namespace DM_Weight.Views
|
||||||
bool[] boolArrs = ModbusHelper.GetInstance().GetAllBoxState();
|
bool[] boolArrs = ModbusHelper.GetInstance().GetAllBoxState();
|
||||||
bool allTrue = Array.TrueForAll(boolArrs, b => b == false);
|
bool allTrue = Array.TrueForAll(boolArrs, b => b == false);
|
||||||
logger.Info($"进入自动退出定时方法{allTrue}");
|
logger.Info($"进入自动退出定时方法{allTrue}");
|
||||||
if (allTrue)
|
if (allTrue&&idleTimer.Enabled)
|
||||||
{
|
{
|
||||||
idleTimer.Stop();
|
idleTimer.Stop();
|
||||||
//无人操作,自动退出
|
//无人操作,自动退出
|
||||||
|
|
|
@ -198,7 +198,7 @@
|
||||||
<!--<TextBlock Visibility="{Binding DrawerPortMsg, Converter={StaticResource BooleanToVisibilityConverter}}" Text="抽屉串口连接失败" />
|
<!--<TextBlock Visibility="{Binding DrawerPortMsg, Converter={StaticResource BooleanToVisibilityConverter}}" Text="抽屉串口连接失败" />
|
||||||
<TextBlock Visibility="{Binding CanBusPortMsg, Converter={StaticResource BooleanToVisibilityConverter}}" Text="can总线串口连接失败" />-->
|
<TextBlock Visibility="{Binding CanBusPortMsg, Converter={StaticResource BooleanToVisibilityConverter}}" Text="can总线串口连接失败" />-->
|
||||||
<TextBlock Visibility="{Binding FingerMsg, Converter={StaticResource BooleanToVisibilityConverter}}" Text="指纹机连接失败" />
|
<TextBlock Visibility="{Binding FingerMsg, Converter={StaticResource BooleanToVisibilityConverter}}" Text="指纹机连接失败" />
|
||||||
<TextBlock Visibility="{Binding HIKMsg, Converter={StaticResource BooleanToVisibilityConverter}}" Text="录像机登录失败" />
|
<!--<TextBlock Visibility="{Binding HIKMsg, Converter={StaticResource BooleanToVisibilityConverter}}" Text="录像机登录失败" />-->
|
||||||
<!--<TextBlock Visibility="{Binding FridgePortMsg, Converter={StaticResource BooleanToVisibilityConverter}}" Text="冰箱串口连接失败" />-->
|
<!--<TextBlock Visibility="{Binding FridgePortMsg, Converter={StaticResource BooleanToVisibilityConverter}}" Text="冰箱串口连接失败" />-->
|
||||||
<TextBlock Visibility="{Binding WSDPortMsg, Converter={StaticResource BooleanToVisibilityConverter}}" Text="温湿度串口连接失败" />
|
<TextBlock Visibility="{Binding WSDPortMsg, Converter={StaticResource BooleanToVisibilityConverter}}" Text="温湿度串口连接失败" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
Loading…
Reference in New Issue