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