瀏覽代碼

添加日志

Lishi
xxe 2 年之前
父節點
當前提交
590af666f6
共有 3 個檔案被更改,包括 44 行新增28 行删除
  1. +2
    -2
      HKCardOUT/HKCardOUT.csproj
  2. +30
    -13
      HKCardOUT/Logic/Service/HKCore.cs
  3. +12
    -13
      HKCardOUT/ViewModels/RootViewModel.cs

+ 2
- 2
HKCardOUT/HKCardOUT.csproj 查看文件

@@ -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>


+ 30
- 13
HKCardOUT/Logic/Service/HKCore.cs 查看文件

@@ -2,6 +2,7 @@
using HKCardOUT.Helper;
using HKCardOUT.Logic.Model;
using HKControl;
using HKLog;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -16,8 +17,12 @@ namespace HKCardOUT.Logic.Service
{
List<SaleLog> Commom(SaleLog input)
{
if (DataBus.StartDevice)
if (!Main.GetInstance.GetIsSwipe(input.Location.AsInt())) return null;
if (DataBus.StartDevice) {

var checkDevice = !Main.GetInstance.GetIsSwipe(input.Location.AsInt());
HKLogImport.WriteInfo("设备是否可以出餐" + checkDevice);
if (checkDevice) return null;
}
var Old = DbContext.Context.Queryable<SaleLog>()
.Where(t => t.CardNo == input.CardNo)
.Where(t => t.CreateTime.Year == DateTime.Now.Year)
@@ -81,7 +86,11 @@ namespace HKCardOUT.Logic.Service
{
try
{
if (!GetCardStutas(input.CardNo)) return false;
if (!GetCardStutas(input.CardNo))
{
HKLogImport.WriteInfo($"当前卡异常,卡号:【{input.CardNo}】");
return false;
}
var Old = Commom(input);
if (Old == null) return false;
var AMDay = Old.Where(t => t.CreateTime >= DataBus.Times.AMStartTime && t.CreateTime < DataBus.Times.AMEndTime)
@@ -89,7 +98,7 @@ namespace HKCardOUT.Logic.Service
.Where(t => t.CreateTime.Month == DateTime.Now.Month)
.Where(t => t.CreateTime.Day == DateTime.Now.Day)
.Count();
HKLog.HKLogImport.WriteInfo($"卡号{input.CardNo}上午消费次数:{AMDay}");
HKLogImport.WriteInfo($"卡号{input.CardNo}上午消费次数:{AMDay}");
if (DataBus.Admin.Contains(input.CardNo))
{
var entity1 = DbContext.Context.Insertable(input).CallEntityMethod(t => t.Create()).ExecuteReturnEntity();
@@ -97,8 +106,8 @@ namespace HKCardOUT.Logic.Service
{
if (DataBus.StartDevice)
{
Main.GetInstance.Start(input.Location.AsInt());
UHF_RS485_Helper.GetInstance().OpenBeep(input.Location.AsInt());
Main.GetInstance.Start(input.Location.AsInt());
HKLogImport.WriteInfo($"设备位置:{input.Location},卡号:{input.CardNo},成功出餐");
}
return true;
}
@@ -111,7 +120,7 @@ namespace HKCardOUT.Logic.Service
if (DataBus.StartDevice)
{
Main.GetInstance.Start(input.Location.AsInt());
UHF_RS485_Helper.GetInstance().OpenBeep(input.Location.AsInt());
HKLogImport.WriteInfo($"设备位置:{input.Location},卡号:{input.CardNo},成功出餐");
}
return true;
}
@@ -135,7 +144,11 @@ namespace HKCardOUT.Logic.Service
{
try
{
if (!GetCardStutas(input.CardNo)) return false;
if (!GetCardStutas(input.CardNo))
{
HKLogImport.WriteInfo($"当前卡异常,卡号:【{input.CardNo}】");
return false;
}
var Old = Commom(input);
if (Old == null) return false;
var PMDay = Old.Where(t => t.CreateTime >= DataBus.Times.PMStartTime && t.CreateTime < DataBus.Times.PMEndTime).
@@ -152,7 +165,7 @@ namespace HKCardOUT.Logic.Service
if (DataBus.StartDevice)
{
Main.GetInstance.Start(input.Location.AsInt());
UHF_RS485_Helper.GetInstance().OpenBeep(input.Location.AsInt());
HKLogImport.WriteInfo($"设备位置:{input.Location},卡号:{input.CardNo},成功出餐");
}
return true;
}
@@ -165,7 +178,7 @@ namespace HKCardOUT.Logic.Service
if (DataBus.StartDevice)
{
Main.GetInstance.Start(input.Location.AsInt());
UHF_RS485_Helper.GetInstance().OpenBeep(input.Location.AsInt());
HKLogImport.WriteInfo($"设备位置:{input.Location},卡号:{input.CardNo},成功出餐");
}
return true;
}
@@ -189,7 +202,11 @@ namespace HKCardOUT.Logic.Service
{
try
{
if (!GetCardStutas(input.CardNo)) return false;
if (!GetCardStutas(input.CardNo))
{
HKLogImport.WriteInfo($"当前卡异常,卡号:【{input.CardNo}】");
return false;
}
var Old = Commom(input);
if (Old == null) return false;
var ATDay = Old.Where(t => t.CreateTime >= DataBus.Times.ATStartTime && t.CreateTime < DataBus.Times.ATEndTime)
@@ -206,7 +223,7 @@ namespace HKCardOUT.Logic.Service
if (DataBus.StartDevice)
{
Main.GetInstance.Start(input.Location.AsInt());
UHF_RS485_Helper.GetInstance().OpenBeep(input.Location.AsInt());
HKLogImport.WriteInfo($"设备位置:{input.Location},卡号:{input.CardNo},成功出餐");
}
return true;
}
@@ -219,7 +236,7 @@ namespace HKCardOUT.Logic.Service
if (DataBus.StartDevice)
{
Main.GetInstance.Start(input.Location.AsInt());
UHF_RS485_Helper.GetInstance().OpenBeep(input.Location.AsInt());
HKLogImport.WriteInfo($"设备位置:{input.Location},卡号:{input.CardNo},成功出餐");
}
return true;
}


+ 12
- 13
HKCardOUT/ViewModels/RootViewModel.cs 查看文件

@@ -3,29 +3,25 @@ using HKCardOUT.Helper;
using HKCardOUT.Logic.Model;
using HKCardOUT.Logic.Service;
using HKCardOUT.Views;
using NStandard;
using HKLog;
using Stylet;
using StyletIoC;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO.Ports;
using System.Diagnostics;
using System.IO;
using System.IO.Ports;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Windows.Documents;
using System.Threading.Tasks;
using UHFHelper;
using XExten.Advance.InternalFramework.Securities.Common;
using XExten.Advance.LinqFramework;
using XExten.Advance.StaticFramework;
using System.Diagnostics;
using System.Threading.Tasks;
using HandyControl.Controls;
using System.Windows.Media.Imaging;
using HKLog;
using System.Collections.Concurrent;

namespace HKCardOUT.ViewModels
{
@@ -33,7 +29,6 @@ namespace HKCardOUT.ViewModels
{
public delegate void ReadCardFunc(DKoutput? input);
public event ReadCardFunc ReadFunc;
//private readonly object locker = new object();
private IContainer Container;
public RootViewModel(IContainer Container)
{
@@ -93,8 +88,10 @@ namespace HKCardOUT.ViewModels
if (res != null)
{
HKLog.HKLogImport.WriteInfo($"{DateTime.Now.ToString("HH:mm:ss")} 卡号地址:{res.Address}----------卡号数据:{res.ResData}");
if (!res.ResData.IsMatch(new Regex("0{20}")))
ReadFunc?.Invoke(res);
if (!res.ResData.IsNullOrEmpty()) {
if (res.ResData.Length==20)
ReadFunc?.Invoke(res);
}
Thread.Sleep(2000);
}
}
@@ -217,6 +214,8 @@ namespace HKCardOUT.ViewModels
Location = input.Address.AsInt().ToString(),
Date = DateTime.Now
};
UHF_RS485_Helper.GetInstance().OpenBeep(mo.Location.AsInt());
HKLogImport.WriteInfo("读卡成功:" + mo.ToJson());
if (Stacks.Count > 0)
{
var check = Stacks.Where(t => t.CardNo == mo.CardNo).Where(t => t.Location == mo.Location).FirstOrDefault();
@@ -238,7 +237,7 @@ namespace HKCardOUT.ViewModels
if (Info != null)
{
var Core = Container.Get<HKCore>();
HKLogImport.WriteInfo("队列读取成功:" + Info.ToJson());
if (Info.Date >= DataBus.Times.AMStartTime && Info.Date < DataBus.Times.AMEndTime)
{
Core.DeviceSaleAM(new SaleLog


Loading…
取消
儲存