pry 2 лет назад
Родитель
Сommit
80256a01dd
3 измененных файлов: 156 добавлений и 144 удалений
  1. +26
    -0
      HKCardOUT/DTO/AdInfoModel.cs
  2. +115
    -83
      HKCardOUT/ViewModels/AdWindowViewModel.cs
  3. +15
    -61
      HKCardOUT/Views/AdWindow.xaml

+ 26
- 0
HKCardOUT/DTO/AdInfoModel.cs Просмотреть файл

@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;
using BPA.Helper;

namespace DTO
{
public class AdInfoModel : NotifyBase
{
public string Gate { get { return _mGate; } set { _mGate = value; OnPropertyChanged(); } }
private string _mGate;

public string Msg { get { return _mMsg; } set { _mMsg = value; OnPropertyChanged(); } }
private string _mMsg;

public int Count { get { return _mCount; } set { _mCount = value; OnPropertyChanged(); } }
private int _mCount;

public ScreenInfoDto Info { get { return _mInfo; } set { _mInfo = value; OnPropertyChanged(); } }
private ScreenInfoDto _mInfo = new ScreenInfoDto();

public ObservableCollection<ScreenInfoDto> AInfo { get; set; } = new ObservableCollection<ScreenInfoDto>();

}
}

+ 115
- 83
HKCardOUT/ViewModels/AdWindowViewModel.cs Просмотреть файл

@@ -14,101 +14,85 @@ using System.Collections.Concurrent;

namespace HKCardOUT.ViewModels
{
public class AdWindowViewModel : PropertyChangedBase
public class AdWindowViewModel : NotifyBase
{

public AdWindowViewModel()
{
//ALInfo = new ObservableCollection<ScreenInfoDto>();
//ARInfo = new ObservableCollection<ScreenInfoDto>();
_LInfo = new ScreenInfoDto();
_RInfo = new ScreenInfoDto();
//_LInfo = new ScreenInfoDto();
//_RInfo = new ScreenInfoDto();
}

#region 属性
string _LGate;
public string LGate
{
get => _LGate;
set => SetAndNotify(ref _LGate, value);
}

string _RGate;
public string RGate
{
get => _RGate;
set => SetAndNotify(ref _RGate, value);
}
public AdInfoModel LAdInfo { get { return _mLAdInfo; } set { _mLAdInfo = value; OnPropertyChanged(); } }
private AdInfoModel _mLAdInfo = new AdInfoModel();

string _LMsg;
public string LMsg
{
get => _LMsg;
set => SetAndNotify(ref _LMsg, value);
}

string _RMsg;
public string RMsg
{
get => _RMsg;
set => SetAndNotify(ref _RMsg, value);
}
public AdInfoModel RAdinfo { get { return _mRAdinfo; } set { _mRAdinfo = value; OnPropertyChanged(); } }
private AdInfoModel _mRAdinfo = new AdInfoModel();

int _LCount;
public int LCount
{
get => _LCount;
set => SetAndNotify(ref _LCount, value);
}

int _RCount;
public int RCount
{
get => _RCount;
set => SetAndNotify(ref _RCount, value);
}
//string _LGate;
//public string LGate
//{
// get => _LGate;
// set => SetAndNotify(ref _LGate, value);
//}

ScreenInfoDto _LInfo;
public ScreenInfoDto LInfo
{
get => _LInfo;
set => SetAndNotify(ref _LInfo, value);
}
//string _RGate;
//public string RGate
//{
// get => _RGate;
// set => SetAndNotify(ref _RGate, value);
//}

ScreenInfoDto _RInfo;
public ScreenInfoDto RInfo
{
get => _RInfo;
set => SetAndNotify(ref _RInfo, value);
}
//string _LMsg;
//public string LMsg
//{
// get => _LMsg;
// set => SetAndNotify(ref _LMsg, value);
//}

//ObservableCollection<ScreenInfoDto> _ALInfo;
//public ObservableCollection<ScreenInfoDto> ALInfo
//string _RMsg;
//public string RMsg
//{
// get => _ALInfo;
// set => SetAndNotify(ref _ALInfo, value);
// get => _RMsg;
// set => SetAndNotify(ref _RMsg, value);
//}

public ObservableCollection<ScreenInfoDto> ALInfo { get; set; } = new ObservableCollection<ScreenInfoDto>();
//int _LCount;
//public int LCount
//{
// get => _LCount;
// set => SetAndNotify(ref _LCount, value);
//}

//ObservableCollection<ScreenInfoDto> _ARInfo;
//public ObservableCollection<ScreenInfoDto> ARInfo
//int _RCount;
//public int RCount
//{
// get => _ARInfo;
// set => SetAndNotify(ref _ARInfo, value);
// get => _RCount;
// set => SetAndNotify(ref _RCount, value);
//}
public ObservableCollection<ScreenInfoDto> ARInfo { get; set; } = new ObservableCollection<ScreenInfoDto>();

//ScreenInfoDto _LInfo;
//public ScreenInfoDto LInfo
//{
// get => _LInfo;
// set => SetAndNotify(ref _LInfo, value);
//}

//ObservableCollection<string> _Foods = new ObservableCollection<string>();
//public ObservableCollection<string> Foods
//ScreenInfoDto _RInfo;
//public ScreenInfoDto RInfo
//{
// get => _Foods;
// set => SetAndNotify(ref _Foods, value);
// get => _RInfo;
// set => SetAndNotify(ref _RInfo, value);
//}

//public ObservableCollection<ScreenInfoDto> ALInfo { get; set; } = new ObservableCollection<ScreenInfoDto>();

//public ObservableCollection<ScreenInfoDto> ARInfo { get; set; } = new ObservableCollection<ScreenInfoDto>();

public ObservableCollection<string> Foods { get; set; } = new ObservableCollection<string>();

//public ConcurrentQueue<SaleLogDto> saleLogDtos { get; set; } = new ConcurrentQueue<SaleLogDto>();
#endregion


@@ -141,17 +125,65 @@ namespace HKCardOUT.ViewModels

public void InitData(int[] BindScreen)
{
//FoodsInit(BindScreen);
//ThreadManage.GetInstance().StartLong(() =>
//{
// var model = (new HKCore()).PullDaySaleLog(BindScreen);

// LGate = $"{BindScreen[1]}号档口";
// RGate = $"{BindScreen[0]}号档口";
// LCount = model.Where(t => t.Key == $"{BindScreen[1]}").FirstOrDefault().Value;
// RCount = model.Where(t => t.Key == $"{BindScreen[0]}").FirstOrDefault().Value;
// LMsg = Main.GetInstance.GetIsSwipe(BindScreen[1]) ? "正常" : "异常";
// RMsg = Main.GetInstance.GetIsSwipe(BindScreen[0]) ? "正常" : "异常";

// for (int i = 0; i < BindScreen.Length; i++)
// {
// if (DataBus.SaleLogDtoList.ContainsKey(BindScreen[i].ToString()))
// {
// if (DataBus.SaleLogDtoList[BindScreen[i].ToString()].Count > 0)
// {
// if (DataBus.SaleLogDtoList[BindScreen[i].ToString()].TryDequeue(out SaleLogDto info))
// {
// ScreenInfoDto data = new ScreenInfoDto
// {
// CardNo = info.CardNo,
// UserName = "",
// Location = info.Location,
// };
// data.UserName = DataBus.UserListDto
// .Where(t => t.Cards.Select(x => x.CardNum).Contains(data.CardNo))
// .Select(x => x.Name).FirstOrDefault();

// App.Current.Dispatcher.Invoke(() =>
// {
// if (LInfo != null && !string.IsNullOrEmpty(LInfo.UserName))
// ALInfo.Insert(0, LInfo); LInfo.Time = DateTime.Now.ToString("HH:mm:ss");
// if (RInfo != null && !string.IsNullOrEmpty(RInfo.UserName))
// ARInfo.Insert(0, RInfo); RInfo.Time = DateTime.Now.ToString("HH:mm:ss");
// });
// LInfo = data.Location == $"{BindScreen[1]}" ? data : new ScreenInfoDto();
// RInfo = data.Location == $"{BindScreen[0]}" ? data : new ScreenInfoDto();
// }
// }
// }
// }

// Thread.Sleep(10);
//}, $"屏幕刷卡信息{BindScreen[0]}-{BindScreen[1]}", true);


FoodsInit(BindScreen);
ThreadManage.GetInstance().StartLong(() =>
{
var model = (new HKCore()).PullDaySaleLog(BindScreen);

LGate = $"{BindScreen[1]}号档口";
RGate = $"{BindScreen[0]}号档口";
LCount = model.Where(t => t.Key == $"{BindScreen[1]}").FirstOrDefault().Value;
RCount = model.Where(t => t.Key == $"{BindScreen[0]}").FirstOrDefault().Value;
LMsg = HKControl.Main.GetInstance.GetIsSwipe(BindScreen[1]) ? "正常" : "异常";
RMsg = HKControl.Main.GetInstance.GetIsSwipe(BindScreen[0]) ? "正常" : "异常";
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]) ? "正常" : "异常";

for (int i = 0; i < BindScreen.Length; i++)
{
@@ -173,19 +205,19 @@ namespace HKCardOUT.ViewModels

App.Current.Dispatcher.Invoke(() =>
{
if (LInfo != null && !string.IsNullOrEmpty(LInfo.UserName))
ALInfo.Insert(0, LInfo); LInfo.Time = DateTime.Now.ToString("HH:mm:ss");
if (RInfo != null && !string.IsNullOrEmpty(RInfo.UserName))
ARInfo.Insert(0, RInfo); RInfo.Time = DateTime.Now.ToString("HH:mm:ss");
if (LAdInfo.Info != null && !string.IsNullOrEmpty(LAdInfo.Info.UserName))
LAdInfo.AInfo.Insert(0, LAdInfo.Info); LAdInfo.Info.Time = DateTime.Now.ToString("HH:mm:ss");
if (RAdinfo.Info != null && !string.IsNullOrEmpty(RAdinfo.Info.UserName))
RAdinfo.AInfo.Insert(0, RAdinfo.Info); RAdinfo.Info.Time = DateTime.Now.ToString("HH:mm:ss");
});
LInfo = data.Location == $"{BindScreen[1]}" ? data : new ScreenInfoDto();
RInfo = data.Location == $"{BindScreen[0]}" ? data : new ScreenInfoDto();
LAdInfo.Info = data.Location == $"{BindScreen[1]}" ? data : new ScreenInfoDto();
RAdinfo.Info = data.Location == $"{BindScreen[0]}" ? data : new ScreenInfoDto();
}
}
}
}

Thread.Sleep(100);
Thread.Sleep(10);
}, $"屏幕刷卡信息{BindScreen[0]}-{BindScreen[1]}", true);
}
}


+ 15
- 61
HKCardOUT/Views/AdWindow.xaml Просмотреть файл

@@ -8,10 +8,10 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:view2="clr-namespace:Microsoft.Web.WebView2.Wpf;assembly=Microsoft.Web.WebView2.Wpf"
xmlns:viewModels="clr-namespace:HKCardOUT.ViewModels"
d:DataContext="{d:DesignInstance Type=viewModels:AdWindowViewModel}"
Background="#3f4c5d"
Width="1920"
Height="1080"
d:DataContext="{d:DesignInstance Type=viewModels:AdWindowViewModel}"
Background="#3f4c5d"
WindowStyle="None"
mc:Ignorable="d">
<!--<Window.Background>
@@ -70,7 +70,7 @@
HorizontalAlignment="Center"
Foreground="#ddd"
Style="{StaticResource Lbl}"
Text="{Binding LGate}" />
Text="{Binding LAdInfo.Gate}" />
</Grid>

<Grid Grid.Row="1" Margin="5">
@@ -111,8 +111,8 @@
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="50"
Foreground="{Binding LMsg, Converter={StaticResource TextForegroundConvert}}"
Text="{Binding LMsg}" />
Foreground="{Binding LAdInfo.Msg, Converter={StaticResource TextForegroundConvert}}"
Text="{Binding LAdInfo.Msg}" />

<TextBlock
Grid.Row="1"
@@ -129,7 +129,7 @@
VerticalAlignment="Center"
FontSize="60"
Foreground="#ddd"
Text="{Binding LCount}" />
Text="{Binding LAdInfo.Count}" />
</Grid>

<Grid Grid.Row="2" Margin="5">
@@ -150,7 +150,7 @@
VerticalAlignment="Center"
FontSize="50"
Foreground="#ddd"
Text="{Binding LInfo.UserName}" />
Text="{Binding LAdInfo.Info.UserName}" />
</Grid>

<Grid Grid.Row="3" Margin="5">
@@ -160,7 +160,7 @@
VerticalAlignment="Top"
Background="Transparent"
BorderThickness="0"
ItemsSource="{Binding ALInfo}"
ItemsSource="{Binding LAdInfo.AInfo}"
Style="{StaticResource WrapPanelVerticalListBox}">
<ListBox.ItemTemplate>
<DataTemplate>
@@ -189,11 +189,6 @@
</ListBox.ItemTemplate>
</ListBox>
</Grid>


<!--<TextBlock Style="{StaticResource Lbl}" Text="今日刷卡历史" />-->


</Grid>

<Grid x:Name="content" Grid.Column="1">
@@ -219,36 +214,14 @@

<TextBlock
HorizontalAlignment="Center"
Foreground="#ddd"
FontSize="30"
Foreground="#ddd"
Style="{StaticResource Lbl}"
Text="今日菜品" />
</Grid>


<Grid Grid.Row="1" Grid.RowSpan="2">
<!--<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock
x:Name="one"
FontSize="30"
Style="{StaticResource Lbl}"
TextAlignment="Center" />
<TextBlock
x:Name="two"
Grid.Column="1"
FontSize="30"
Style="{StaticResource Lbl}"
TextAlignment="Center" />
</Grid>-->
<!--<TextBlock
FontSize="30"
Style="{StaticResource Lbl}"
Text="今日菜品"
TextAlignment="Center" />-->
<ListBox
Background="Transparent"
BorderThickness="0"
@@ -262,20 +235,6 @@
<ListBox.ItemTemplate>
<DataTemplate>
<Grid Height="135" Margin="5">
<!--<Border
Margin="10,0"
Background="#ddd"
Style="{StaticResource borderStyle}" />-->

<!--<Border Margin="10 0" Style="{StaticResource borderStyle}">
<Border.Background>
<LinearGradientBrush StartPoint="1,0" EndPoint="0.5,1">
<GradientStop Offset="1" Color="#C93ADA" />
<GradientStop Offset="0" Color="#5844DD" />
</LinearGradientBrush>
</Border.Background>
</Border>-->

<Border Margin="10,0" Style="{StaticResource borderStyle}">
<Border.Background>
<LinearGradientBrush StartPoint="1,0" EndPoint="0.5,1">
@@ -325,7 +284,7 @@
HorizontalAlignment="Center"
Foreground="#ddd"
Style="{StaticResource Lbl}"
Text="{Binding RGate}" />
Text="{Binding RAdinfo.Gate}" />
</Grid>

<Grid Grid.Row="1" Margin="5">
@@ -364,8 +323,8 @@
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="50"
Foreground="{Binding RMsg, Converter={StaticResource TextForegroundConvert}}"
Text="{Binding RMsg}" />
Foreground="{Binding RAdinfo.Msg, Converter={StaticResource TextForegroundConvert}}"
Text="{Binding RAdinfo.Msg}" />

<TextBlock
Grid.Row="1"
@@ -382,7 +341,7 @@
VerticalAlignment="Center"
FontSize="60"
Foreground="#ddd"
Text="{Binding RCount}" />
Text="{Binding RAdinfo.Count}" />
</Grid>

<Grid Grid.Row="2" Margin="5">
@@ -403,7 +362,7 @@
VerticalAlignment="Center"
FontSize="50"
Foreground="#ddd"
Text="{Binding RInfo.UserName}" />
Text="{Binding RAdinfo.Info.UserName}" />
</Grid>

<Grid Grid.Row="3" Margin="5">
@@ -413,7 +372,7 @@
VerticalAlignment="Top"
Background="Transparent"
BorderThickness="0"
ItemsSource="{Binding ARInfo}"
ItemsSource="{Binding RAdinfo.AInfo}"
Style="{StaticResource WrapPanelVerticalListBox}">
<ListBox.ItemTemplate>
<DataTemplate>
@@ -442,11 +401,6 @@
</ListBox.ItemTemplate>
</ListBox>
</Grid>


<!--<TextBlock Style="{StaticResource Lbl}" Text="今日刷卡历史" />-->


</Grid>

</Grid>


Загрузка…
Отмена
Сохранить