|
|
@@ -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); |
|
|
|
} |
|
|
|
} |
|
|
|