冰箱超温度报警
This commit is contained in:
parent
5708dc0675
commit
30c807ecd5
|
@ -2,6 +2,8 @@
|
|||
using DM_Weight.msg;
|
||||
using DM_Weight.Port;
|
||||
using DM_Weight.util;
|
||||
using log4net;
|
||||
using log4net.Repository.Hierarchy;
|
||||
using Prism.Commands;
|
||||
using Prism.Events;
|
||||
using Prism.Mvvm;
|
||||
|
@ -19,6 +21,7 @@ namespace DM_Weight.ViewModels
|
|||
{
|
||||
public class FridgeOnlyWindowViewModel : BindableBase, IRegionMemberLifetime, INavigationAware
|
||||
{
|
||||
private readonly ILog logger = LogManager.GetLogger(typeof(FridgeOnlyWindowViewModel));
|
||||
//温度区间
|
||||
private string _temperatureRange = CommonClass.ReadAppSetting("temperatureRange").ToString();
|
||||
public string TemperatureRange
|
||||
|
@ -200,6 +203,7 @@ namespace DM_Weight.ViewModels
|
|||
string exeFileName = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name;
|
||||
doc.Load(exeFileName + ".dll.config");
|
||||
XmlNode node = doc.SelectSingleNode(xPath);
|
||||
logger.Info($"xPath:{xPath} exeFileName:{exeFileName} ReadAppSetting key:{key} value:{node.Attributes["value"].Value}");
|
||||
return Convert.ToInt32(node.Attributes["value"].Value);
|
||||
}
|
||||
|
||||
|
|
|
@ -453,7 +453,7 @@ namespace DM_Weight.ViewModels
|
|||
|
||||
private async void GetWD()
|
||||
{
|
||||
if (!_portUtil.FridgeOperate)
|
||||
if (!_portUtil.FridgeOperate && FridgeState.Equals("0"))
|
||||
{
|
||||
string retStr = string.Empty;
|
||||
byte[] data = null;
|
||||
|
@ -468,6 +468,15 @@ namespace DM_Weight.ViewModels
|
|||
// WD += $"{retTemp}℃";
|
||||
//}
|
||||
}
|
||||
else
|
||||
{
|
||||
AlertMsg alertMsg = new AlertMsg
|
||||
{
|
||||
Message = $"正在获取冰箱温度或已关闭冰箱制冷功能!!!",
|
||||
Type = MsgType.ERROR
|
||||
};
|
||||
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 将收到的返回转换成具体温度数值
|
||||
|
@ -690,6 +699,7 @@ namespace DM_Weight.ViewModels
|
|||
float retT = await _portUtil.GetFridgeTemperature(1);
|
||||
Thread.Sleep(80);
|
||||
WD = $"恒温冷藏抽屉当前温度:{Math.Round((retT), 2)}℃;";
|
||||
AlertColor = Brushes.White;
|
||||
logger.Info(WD);
|
||||
if (tempRange != null && tempRange.Count() >= 2)
|
||||
{
|
||||
|
|
|
@ -20,16 +20,16 @@
|
|||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="1.2*"/>
|
||||
<RowDefinition Height="2*"/>
|
||||
<RowDefinition Height="2*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock Margin="6 0 0 0" Text="冰箱温度区间:" Grid.Row="1" Grid.Column="0" HorizontalAlignment="Right" VerticalAlignment="Center" FontSize="14" FontWeight="Bold" />
|
||||
<TextBox Grid.Row="1"
|
||||
<TextBox Grid.Row="1" Height="50"
|
||||
Grid.Column="1"
|
||||
materialDesign:HintAssist.Hint="温度区间2-8度以-分隔"
|
||||
Margin="6 0 0 10"
|
||||
|
@ -60,7 +60,7 @@
|
|||
Content="打开"
|
||||
materialDesign:ToggleButtonAssist.OnContent="关闭" />
|
||||
<TextBlock Grid.Column="0" Grid.Row="4" Text="冰箱不在区间超时时间:" Margin="0 18 0 0" HorizontalAlignment="Right" VerticalAlignment="Center" FontSize="14" FontWeight="Bold" />
|
||||
<TextBox Grid.Row="4"
|
||||
<TextBox Grid.Row="4" Height="50"
|
||||
Grid.Column="1"
|
||||
materialDesign:HintAssist.Hint="超时时间以分钟为单位"
|
||||
Margin="6 0 0 10" Text="{Binding OutRangeTime, UpdateSourceTrigger=PropertyChanged}"
|
||||
|
|
|
@ -124,7 +124,7 @@
|
|||
<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="{Binding AlertColor}" FontWeight="Bold" FontSize="14"/>
|
||||
<Button Content="查看冰箱温度" Visibility="{Binding HasFridge}" Command="{Binding CheckWDCommand}" Style="{StaticResource MaterialDesignFlatSecondaryLightButton}"/>
|
||||
<Button Content="查看冰箱温度" Visibility="Collapsed" Command="{Binding CheckWDCommand}" Style="{StaticResource MaterialDesignFlatSecondaryLightButton}"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
|
|
Loading…
Reference in New Issue