每隔1分钟自动获取冰箱温度,添加冰箱设置页面,温度可设置小数,保留一位小数
This commit is contained in:
parent
83bbf8c453
commit
29723e1054
|
@ -37,7 +37,7 @@
|
|||
<!-- 按处方还药或者按取药记录还药 1:处方(ReturnDrugWindow2)2:药品(ReturnDrugWindow)-->
|
||||
<add key="returnDrugMode" value="2" />
|
||||
<!-- 自动退出时间,单位秒,为0时不自动退出 -->
|
||||
<add key="autoExit" value="0"/>
|
||||
<add key="autoExit" value="3"/>
|
||||
|
||||
<!-- 无操作退出录像时间,单位秒,为0时不退出录像 -->
|
||||
<add key="stopRecord" value="0"/>
|
||||
|
|
|
@ -23,10 +23,17 @@ namespace DM_Weight.Common
|
|||
string[] rang = value.ToString().Split('-');
|
||||
if (rang.Length >= 2)
|
||||
{
|
||||
bool bSRange = int.TryParse(rang[0], out int sRange);
|
||||
bool bERange = int.TryParse(rang[1], out int eRange);
|
||||
bool bSRange = float.TryParse(rang[0], out float sRange);
|
||||
bool bERange = float.TryParse(rang[1], out float eRange);
|
||||
if (bSRange && bERange)
|
||||
{
|
||||
string[] sList= sRange.ToString().Split('.');
|
||||
string[] eList= eRange.ToString().Split(".");
|
||||
if ((sList.Length > 1 && sList[1].Length > 1) || (eList.Length > 1 && eList[1].Length>1))
|
||||
{
|
||||
tips = "小数点后保留1位";
|
||||
return new ValidationResult(flag, tips);
|
||||
}
|
||||
if ((sRange < 2 || eRange > 8||sRange>8||eRange<2))
|
||||
{
|
||||
tips = "温度区间设置2-8度,请检查输入";
|
||||
|
|
|
@ -32,10 +32,10 @@ namespace DM_Weight.Finger
|
|||
{
|
||||
_eventAggregator = eventAggregator;
|
||||
logger.Info($"进入构造器,开始连接指纹机");
|
||||
Task.Run(() =>
|
||||
{
|
||||
// Task.Run(() =>
|
||||
//{
|
||||
ConnectionMain();
|
||||
});
|
||||
//});
|
||||
}
|
||||
|
||||
public void ConnectionMain()
|
||||
|
|
|
@ -23,6 +23,7 @@ using System.Windows.Threading;
|
|||
using Newtonsoft.Json.Linq;
|
||||
using DM_Weight.msg;
|
||||
using System.Threading;
|
||||
using DM_Weight.Common;
|
||||
|
||||
namespace DM_Weight.ViewModels
|
||||
{
|
||||
|
@ -301,17 +302,17 @@ namespace DM_Weight.ViewModels
|
|||
_regionManager.RequestNavigate("ContentRegion", "ReturnDrugWindow");
|
||||
}
|
||||
}
|
||||
else if (SelectedChildMenu.PremissionPath.Equals("SettingMainWindow") || SelectedChildMenu.PremissionPath.Equals("SettingWindow"))
|
||||
{
|
||||
//if (Convert.ToInt32(ConfigurationManager.AppSettings["hasFridge"])>0)
|
||||
//{
|
||||
// _regionManager.RequestNavigate("ContentRegion", "SettingMainWindow");
|
||||
//}
|
||||
//else
|
||||
{
|
||||
_regionManager.RequestNavigate("ContentRegion", "SettingWindow");
|
||||
}
|
||||
}
|
||||
//else if (SelectedChildMenu.PremissionPath.Equals("SettingMainWindow") || SelectedChildMenu.PremissionPath.Equals("SettingWindow"))
|
||||
//{
|
||||
// if (Convert.ToInt32(ConfigurationManager.AppSettings["hasFridge"]) > 0)
|
||||
// {
|
||||
// _regionManager.RequestNavigate("ContentRegion", "SettingMainWindow");
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// _regionManager.RequestNavigate("ContentRegion", "SettingWindow");
|
||||
// }
|
||||
//}
|
||||
else
|
||||
{
|
||||
_regionManager.RequestNavigate("ContentRegion", SelectedChildMenu.PremissionPath);
|
||||
|
@ -341,6 +342,7 @@ namespace DM_Weight.ViewModels
|
|||
private PortUtil _portUtil;
|
||||
//private CHKFunction _chkFunction;
|
||||
IEventAggregator _eventAggregator;
|
||||
bool IsLeave = false;
|
||||
public HomeWindowViewModel(IRegionManager iRegionManager, PortUtil portUtil, IDialogService dialogService, IUnityContainer container, IEventAggregator eventAggregator)
|
||||
{
|
||||
_portUtil = portUtil;
|
||||
|
@ -426,7 +428,7 @@ namespace DM_Weight.ViewModels
|
|||
byte[] data = null;
|
||||
float retT = await _portUtil.GetFridgeTemperature(1);
|
||||
Thread.Sleep(80);
|
||||
WD = $"恒温冷藏抽屉当前温度:{Math.Round((retT - 1.5), 2)}℃";
|
||||
WD = $"恒温冷藏抽屉当前温度:{Math.Round((retT), 2)}℃";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -438,13 +440,14 @@ namespace DM_Weight.ViewModels
|
|||
byte[] data = null;
|
||||
float retT = await _portUtil.GetFridgeTemperature(1);
|
||||
Thread.Sleep(80);
|
||||
WD = $"恒温冷藏抽屉当前温度:{Math.Round((retT - 1.5), 2)}℃;";
|
||||
if (Convert.ToInt32(ConfigurationManager.AppSettings["hasFridge"]) > 1)
|
||||
{
|
||||
float retTemp = await _portUtil.GetFridgeTemperature(2);
|
||||
Thread.Sleep(80);
|
||||
WD += $"{retTemp}℃";
|
||||
}
|
||||
WD = $"恒温冷藏抽屉当前温度:{Math.Round((retT), 2)}℃";
|
||||
logger.Info(WD);
|
||||
//if (Convert.ToInt32(ConfigurationManager.AppSettings["hasFridge"]) > 1)
|
||||
//{
|
||||
// float retTemp = await _portUtil.GetFridgeTemperature(2);
|
||||
// Thread.Sleep(80);
|
||||
// WD += $"{retTemp}℃";
|
||||
//}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
|
@ -532,7 +535,7 @@ namespace DM_Weight.ViewModels
|
|||
//.ToTree(pd => pd.Children, pd => pd.ParentId, 0);
|
||||
PremissionDmList = premissions;
|
||||
SelectedMenu = premissions[0];
|
||||
PreSelectedMenu= premissions[0];
|
||||
PreSelectedMenu = premissions[0];
|
||||
SelectedChildMenu = premissions[0].Children[0];
|
||||
_regionManager.RequestNavigate("ContentRegion", premissions[0].Children[0].PremissionPath);
|
||||
FindDrawerCount();
|
||||
|
@ -550,7 +553,7 @@ namespace DM_Weight.ViewModels
|
|||
if ((DateTime.Now - _portUtil.dateTime).TotalSeconds > autoExit && CheckComputerFreeState.GetLastInputTime() > autoExit)
|
||||
{
|
||||
logger.Info($"设备{autoExit}内无人操作,用户【{Operator?.Nickname}】自动退出登录,_portUtil.Operate:{_portUtil.Operate},totalSecond:{(DateTime.Now - _portUtil.dateTime).TotalSeconds},lastInputTime:{CheckComputerFreeState.GetLastInputTime()},autoExit:{autoExit}");
|
||||
|
||||
|
||||
Operator = null;
|
||||
Reviewer = null;
|
||||
//Application.Current.Dispatcher.Invoke(() =>
|
||||
|
@ -648,6 +651,46 @@ namespace DM_Weight.ViewModels
|
|||
////获取录像机的时间
|
||||
//_chkFunction.HIK_DVR_TIME();
|
||||
//_chkFunction.HIKStartDVRRecord();
|
||||
|
||||
new PromiseUtil<int>().taskAsyncLoop(60000, 0, async (options, next, stop) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!_portUtil.FridgeOperate)
|
||||
{
|
||||
string retStr = string.Empty;
|
||||
byte[] data = null;
|
||||
float retT = await _portUtil.GetFridgeTemperature(1);
|
||||
Thread.Sleep(80);
|
||||
WD = $"恒温冷藏抽屉当前温度:{Math.Round((retT), 2)}℃";
|
||||
logger.Info(WD);
|
||||
//if (Convert.ToInt32(ConfigurationManager.AppSettings["hasFridge"]) > 1)
|
||||
//{
|
||||
// float retTemp = await _portUtil.GetFridgeTemperature(2);
|
||||
// Thread.Sleep(80);
|
||||
// WD += $"{retTemp}℃";
|
||||
//}
|
||||
if (IsLeave)
|
||||
{
|
||||
stop();
|
||||
}
|
||||
else
|
||||
{
|
||||
next();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
stop();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.Info($"获取冰箱异常:{ex.Message}");
|
||||
next();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
//每次导航的时候,该实列用不用重新创建,true是不重新创建,false是重新创建
|
||||
|
@ -659,7 +702,8 @@ namespace DM_Weight.ViewModels
|
|||
//这个方法用于拦截请求
|
||||
public void OnNavigatedFrom(NavigationContext navigationContext)
|
||||
{
|
||||
|
||||
IsLeave = true;
|
||||
navigationContext.NavigationService.Region.RegionManager.Regions.Remove(PrismManager.SettingViewRegionName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -191,28 +191,28 @@ _exitCommand ??= new DelegateCommand(Exit);
|
|||
else
|
||||
{
|
||||
//1仅当班人、审核人可登录
|
||||
if (LoginUserCheck.Equals("1"))
|
||||
{
|
||||
//检查当前登录人是否是值班人 (审核人与发药人)
|
||||
listHkcChangeShifts = SqlSugarHelper.Db.Queryable<HkcChangeShifts>()
|
||||
.Where(cs => cs.State == "0").First();
|
||||
if (listHkcChangeShifts != null)
|
||||
{
|
||||
if(!listHkcChangeShifts.FromOperator.Equals(userList.UserName) && !listHkcChangeShifts.FromRviewer.Equals(userList.UserName))
|
||||
{
|
||||
AlertMsg alertMsg = new AlertMsg
|
||||
{
|
||||
Message = "仅值班人可登录,当前登录人非值班人",
|
||||
Type = MsgType.ERROR
|
||||
};
|
||||
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||
Username = "";
|
||||
Password = "";
|
||||
return;
|
||||
}
|
||||
//if (LoginUserCheck.Equals("1"))
|
||||
//{
|
||||
// //检查当前登录人是否是值班人 (审核人与发药人)
|
||||
// listHkcChangeShifts = SqlSugarHelper.Db.Queryable<HkcChangeShifts>()
|
||||
// .Where(cs => cs.State == "0").First();
|
||||
// if (listHkcChangeShifts != null)
|
||||
// {
|
||||
// if(!listHkcChangeShifts.FromOperator.Equals(userList.UserName) && !listHkcChangeShifts.FromRviewer.Equals(userList.UserName))
|
||||
// {
|
||||
// AlertMsg alertMsg = new AlertMsg
|
||||
// {
|
||||
// Message = "仅值班人可登录,当前登录人非值班人",
|
||||
// Type = MsgType.ERROR
|
||||
// };
|
||||
// _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||
// Username = "";
|
||||
// Password = "";
|
||||
// return;
|
||||
// }
|
||||
|
||||
}
|
||||
}
|
||||
// }
|
||||
//}
|
||||
if (userList.PassWord == MD5.GetMD5Hash(Password))
|
||||
{
|
||||
|
||||
|
@ -247,6 +247,7 @@ _exitCommand ??= new DelegateCommand(Exit);
|
|||
|
||||
void SetUser(UserList user)
|
||||
{
|
||||
logger.Info("SetUser");
|
||||
// 单人登录模式
|
||||
if (SingleLogin)
|
||||
{
|
||||
|
@ -254,6 +255,7 @@ _exitCommand ??= new DelegateCommand(Exit);
|
|||
keys.Add("operator", user);
|
||||
System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
|
||||
{
|
||||
logger.Info("跳转Home");
|
||||
_regionManager.RequestNavigate("MainRegion", "HomeWindow", keys);
|
||||
}));
|
||||
}
|
||||
|
@ -364,6 +366,7 @@ _exitCommand ??= new DelegateCommand(Exit);
|
|||
{
|
||||
FingerMsg = !msg.Result;
|
||||
}
|
||||
logger.Info($"LoginBtnEnable:{LoginBtnEnable}");
|
||||
if (LoginBtnEnable)
|
||||
{
|
||||
if (msg.Message.Equals("LOGIN"))
|
||||
|
@ -398,28 +401,28 @@ _exitCommand ??= new DelegateCommand(Exit);
|
|||
else
|
||||
{
|
||||
//1仅当班人、审核人可登录
|
||||
if (LoginUserCheck.Equals("1"))
|
||||
{
|
||||
//if (LoginUserCheck.Equals("1"))
|
||||
//{
|
||||
//检查当前登录人是否是值班人 (审核人与发药人)
|
||||
listHkcChangeShifts = SqlSugarHelper.Db.Queryable<HkcChangeShifts>()
|
||||
.Where(cs => cs.State == "0").First();
|
||||
if (listHkcChangeShifts != null)
|
||||
{
|
||||
if (!listHkcChangeShifts.FromOperator.Equals(userList.UserName) && !listHkcChangeShifts.FromRviewer.Equals(userList.UserName))
|
||||
{
|
||||
AlertMsg alertMsg = new AlertMsg
|
||||
{
|
||||
Message = "仅值班人可登录,当前登录人非值班人",
|
||||
Type = MsgType.ERROR
|
||||
};
|
||||
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||
Username = "";
|
||||
Password = "";
|
||||
return;
|
||||
}
|
||||
//listHkcChangeShifts = SqlSugarHelper.Db.Queryable<HkcChangeShifts>()
|
||||
// .Where(cs => cs.State == "0").First();
|
||||
//if (listHkcChangeShifts != null)
|
||||
//{
|
||||
// if (!listHkcChangeShifts.FromOperator.Equals(userList.UserName) && !listHkcChangeShifts.FromRviewer.Equals(userList.UserName))
|
||||
// {
|
||||
// AlertMsg alertMsg = new AlertMsg
|
||||
// {
|
||||
// Message = "仅值班人可登录,当前登录人非值班人",
|
||||
// Type = MsgType.ERROR
|
||||
// };
|
||||
// _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||
// Username = "";
|
||||
// Password = "";
|
||||
// return;
|
||||
// }
|
||||
|
||||
}
|
||||
}
|
||||
//}
|
||||
//}
|
||||
SetUser(userList);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -555,18 +555,18 @@ namespace DM_Weight.ViewModels
|
|||
PremissionPath = "RoleManagerWindow",
|
||||
};
|
||||
PremissionDm sysset3;
|
||||
//if (Convert.ToInt32(ConfigurationManager.AppSettings["hasFridge"]) > 0)
|
||||
//{
|
||||
// //有冰箱,需要冰箱设置(两个冰箱)
|
||||
// sysset3 = new PremissionDm
|
||||
// {
|
||||
// Id = 53,
|
||||
// PremissionName = "设置",
|
||||
// PremissionPath = "SettingMainWindow",
|
||||
// };
|
||||
if (Convert.ToInt32(ConfigurationManager.AppSettings["hasFridge"]) > 0)
|
||||
{
|
||||
//有冰箱,需要冰箱设置(两个冰箱)
|
||||
sysset3 = new PremissionDm
|
||||
{
|
||||
Id = 53,
|
||||
PremissionName = "设置",
|
||||
PremissionPath = "SettingMainWindow",
|
||||
};
|
||||
|
||||
//}
|
||||
//else
|
||||
}
|
||||
else
|
||||
{
|
||||
sysset3 = new PremissionDm
|
||||
{
|
||||
|
|
|
@ -123,7 +123,7 @@
|
|||
<Grid Grid.Column="2">
|
||||
<StackPanel Margin="6" Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
<Button Content="储物箱" Command="{Binding OpenRecoverCommand}" Visibility="{Binding Is16Drawer, Converter={StaticResource BooleanToVisibilityConverter}}" Style="{StaticResource MaterialDesignFlatSecondaryLightButton}" />
|
||||
<!--<TextBlock Margin="0,10,10,0" Text="{Binding WD}" Foreground="White" FontWeight="Bold" FontSize="14"/>-->
|
||||
<TextBlock Margin="0,10,10,0" Text="{Binding WD}" Foreground="White" FontWeight="Bold" FontSize="14"/>
|
||||
<Button Content="查看冰箱温度" Visibility="{Binding HasFridge}" Command="{Binding CheckWDCommand}" Style="{StaticResource MaterialDesignFlatSecondaryLightButton}"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
|
Loading…
Reference in New Issue