@@ -14,15 +14,11 @@ namespace Converter | |||
if (value != null) | |||
{ | |||
if (value.ToString() == "正常") | |||
{ | |||
//00BEFA | |||
return Brushes.White;//new SolidColorBrush(Color.FromArgb(255, 0, 190, 250)); | |||
} | |||
return Brushes.White; | |||
else if (value.ToString() == "异常") | |||
{ | |||
//FF F5 3F 62 | |||
return Brushes.Yellow;//new SolidColorBrush(Color.FromArgb(255, 245, 63, 98)); | |||
} | |||
return Brushes.Yellow; | |||
else if (value.ToString() == "未连接") | |||
return Brushes.Yellow; | |||
} | |||
return default; | |||
} | |||
@@ -14,9 +14,9 @@ | |||
<AssemblyVersion>1.0.0.0</AssemblyVersion> | |||
<Platforms>AnyCPU;x86</Platforms> | |||
</PropertyGroup> | |||
<!--<PropertyGroup> | |||
<PropertyGroup> | |||
<ApplicationManifest>App.manifest</ApplicationManifest> | |||
</PropertyGroup>--> | |||
</PropertyGroup> | |||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> | |||
<DefineConstants>TRACE;Core</DefineConstants> | |||
</PropertyGroup> | |||
@@ -19,6 +19,10 @@ namespace HKCardOUT.ViewModels | |||
public AdWindowViewModel() | |||
{ | |||
for (int i = 0; i < 6; i++) | |||
{ | |||
Foods.Add(""); | |||
} | |||
} | |||
#region 属性 | |||
@@ -29,16 +33,8 @@ namespace HKCardOUT.ViewModels | |||
public AdInfoModel RAdinfo { get { return _mRAdinfo; } set { _mRAdinfo = value; OnPropertyChanged(); } } | |||
private AdInfoModel _mRAdinfo = new AdInfoModel(); | |||
ObservableCollection<string> _Foods; | |||
public ObservableCollection<string> Foods | |||
{ | |||
get => _Foods; | |||
set | |||
{ | |||
_Foods = value; | |||
OnPropertyChanged(); | |||
} | |||
} | |||
public ObservableCollection<string> Foods { get; set; } = new ObservableCollection<string>(); | |||
#endregion | |||
@@ -51,26 +47,36 @@ namespace HKCardOUT.ViewModels | |||
{ | |||
App.Current.Dispatcher.Invoke(() => | |||
{ | |||
Foods = new ObservableCollection<string>(res); | |||
for (int i = 0; i < Foods.Count; i++) | |||
{ | |||
if (i >= 0 && i < res.Count) | |||
Foods[i] = res.ElementAt(i); | |||
} | |||
}); | |||
} | |||
} | |||
public void InitData(int[] BindScreen) | |||
{ | |||
FoodsInit(BindScreen); | |||
ThreadManage.GetInstance().StartLong(() => | |||
{ | |||
FoodsInit(BindScreen); | |||
var model = (new HKCore()).PullDaySaleLog(BindScreen); | |||
LAdInfo.Gate = $"{BindScreen[1]}号档口"; | |||
RAdinfo.Gate = $"{BindScreen[0]}号档口"; | |||
LAdInfo.Count = model.Where(t => t.Key == $"{BindScreen[1]}").FirstOrDefault().Value; | |||
RAdinfo.Count = model.Where(t => t.Key == $"{BindScreen[0]}").FirstOrDefault().Value; | |||
LAdInfo.Msg = Main.GetInstance.GetIsSwipe(BindScreen[1]) ? "正常" : "异常"; | |||
RAdinfo.Msg = Main.GetInstance.GetIsSwipe(BindScreen[0]) ? "正常" : "异常"; | |||
if (Main.GetInstance.GetIsConnect(BindScreen[1])) | |||
LAdInfo.Msg = Main.GetInstance.GetIsSwipe(BindScreen[1]) ? "正常" : "异常"; | |||
else | |||
LAdInfo.Msg = "未连接"; | |||
if (Main.GetInstance.GetIsConnect(BindScreen[0])) | |||
RAdinfo.Msg = Main.GetInstance.GetIsSwipe(BindScreen[0]) ? "正常" : "异常"; | |||
else | |||
RAdinfo.Msg = "未连接"; | |||
for (int i = 0; i < BindScreen.Length; i++) | |||
{ | |||
if (DataBus.SaleLogDtoList.ContainsKey(BindScreen[i].ToString())) | |||
@@ -109,7 +109,7 @@ | |||
<TextBlock | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="50" | |||
FontSize="45" | |||
Foreground="{Binding LAdInfo.Msg, Converter={StaticResource TextForegroundConvert}}" | |||
Text="{Binding LAdInfo.Msg}" /> | |||
@@ -317,7 +317,7 @@ | |||
<TextBlock | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="50" | |||
FontSize="45" | |||
Foreground="{Binding RAdinfo.Msg, Converter={StaticResource TextForegroundConvert}}" | |||
Text="{Binding RAdinfo.Msg}" /> | |||
@@ -5,7 +5,7 @@ | |||
//启动设备调试 | |||
"StartDevice": true, | |||
//串口 | |||
"COM": "COM8", | |||
"COM": "COM7", | |||
//定时任务时间表达式 每隔6小时推送一次 | |||
"Cron": "0 0 0/6 * * ?", | |||
//店铺ID | |||
@@ -51,6 +51,35 @@ namespace HKControl | |||
return false; | |||
} | |||
public bool GetIsConnect(int CarNum) | |||
{ | |||
switch (CarNum) | |||
{ | |||
case 1: | |||
if (!SiemensDicitonary.ContainsKey(1)) return false; | |||
return SiemensDicitonary[1].IsConnected; | |||
case 2: | |||
if (!SiemensDicitonary.ContainsKey(1)) return false; | |||
return SiemensDicitonary[1].IsConnected; | |||
case 3: | |||
if (!SiemensDicitonary.ContainsKey(2)) return false; | |||
return SiemensDicitonary[2].IsConnected; | |||
case 4: | |||
if (!SiemensDicitonary.ContainsKey(2)) return false; | |||
return SiemensDicitonary[2].IsConnected; | |||
case 5: | |||
if (!SiemensDicitonary.ContainsKey(3)) return false; | |||
return SiemensDicitonary[3].IsConnected; | |||
case 6: | |||
if (!SiemensDicitonary.ContainsKey(3)) return false; | |||
return SiemensDicitonary[3].IsConnected; | |||
default: | |||
break; | |||
} | |||
return false; | |||
} | |||
/// <summary> | |||
/// 获取指定档口是否配餐完成 | |||
/// </summary> | |||
@@ -184,7 +213,7 @@ namespace HKControl | |||
{ | |||
HKLog.HKLogImport.WriteInfo($"地址:{add} {num} 号出餐口控制"); | |||
SiemensDicitonary[num].Write(add, true); | |||
Thread.Sleep(2000); | |||
Thread.Sleep(500); | |||
SiemensDicitonary[num].Write(add, false); | |||
} | |||