Browse Source

时间修改

master
xxe 2 years ago
parent
commit
9d4ff79942
2 changed files with 16 additions and 16 deletions
  1. +15
    -15
      HKCardOUT/Logic/Service/HKCore.cs
  2. +1
    -1
      HKCardOUT/ViewModels/RootViewModel.cs

+ 15
- 15
HKCardOUT/Logic/Service/HKCore.cs View File

@@ -28,9 +28,9 @@ namespace HKCardOUT.Logic.Service
} }
var Old = DbContext.Context.Queryable<SaleLog>() var Old = DbContext.Context.Queryable<SaleLog>()
.Where(t => t.CardNo == input.CardNo) .Where(t => t.CardNo == input.CardNo)
.Where(t => t.CreateTime.Year == DateTime.Now.Year)
.Where(t => t.CreateTime.Month == DateTime.Now.Month)
.Where(t => t.CreateTime.Day == DateTime.Now.Day).ToList();
.Where(t => t.CreateTime.Year == DataBus.TodayTime.Year)
.Where(t => t.CreateTime.Month == DataBus.TodayTime.Month)
.Where(t => t.CreateTime.Day == DataBus.TodayTime.Day).ToList();


if (DataBus.Admin.Contains(input.CardNo)) if (DataBus.Admin.Contains(input.CardNo))
{ {
@@ -105,9 +105,9 @@ namespace HKCardOUT.Logic.Service
var Old = Commom(input); var Old = Commom(input);
if (Old == null) return false; if (Old == null) return false;
var AMDay = Old.Where(t => t.CreateTime >= DataBus.Times.AMStartTime && t.CreateTime < DataBus.Times.AMEndTime) var AMDay = Old.Where(t => t.CreateTime >= DataBus.Times.AMStartTime && t.CreateTime < DataBus.Times.AMEndTime)
.Where(t => t.CreateTime.Year == DateTime.Now.Year)
.Where(t => t.CreateTime.Month == DateTime.Now.Month)
.Where(t => t.CreateTime.Day == DateTime.Now.Day)
.Where(t => t.CreateTime.Year == DataBus.TodayTime.Year)
.Where(t => t.CreateTime.Month == DataBus.TodayTime.Month)
.Where(t => t.CreateTime.Day == DataBus.TodayTime.Day)
.Count(); .Count();
HKLogImport.WriteInfo($"卡号{input.CardNo}上午消费次数:{AMDay}"); HKLogImport.WriteInfo($"卡号{input.CardNo}上午消费次数:{AMDay}");
if (DataBus.Admin.Contains(input.CardNo)) if (DataBus.Admin.Contains(input.CardNo))
@@ -167,9 +167,9 @@ namespace HKCardOUT.Logic.Service
var Old = Commom(input); var Old = Commom(input);
if (Old == null) return false; if (Old == null) return false;
var PMDay = Old.Where(t => t.CreateTime >= DataBus.Times.PMStartTime && t.CreateTime < DataBus.Times.PMEndTime). var PMDay = Old.Where(t => t.CreateTime >= DataBus.Times.PMStartTime && t.CreateTime < DataBus.Times.PMEndTime).
Where(t => t.CreateTime.Year == DateTime.Now.Year)
.Where(t => t.CreateTime.Month == DateTime.Now.Month)
.Where(t => t.CreateTime.Day == DateTime.Now.Day)
Where(t => t.CreateTime.Year == DataBus.TodayTime.Year)
.Where(t => t.CreateTime.Month == DataBus.TodayTime.Month)
.Where(t => t.CreateTime.Day == DataBus.TodayTime.Day)
.Count(); .Count();
HKLog.HKLogImport.WriteInfo($"卡号{input.CardNo}中午消费次数:{PMDay}"); HKLog.HKLogImport.WriteInfo($"卡号{input.CardNo}中午消费次数:{PMDay}");
if (DataBus.Admin.Contains(input.CardNo)) if (DataBus.Admin.Contains(input.CardNo))
@@ -229,9 +229,9 @@ namespace HKCardOUT.Logic.Service
var Old = Commom(input); var Old = Commom(input);
if (Old == null) return false; if (Old == null) return false;
var ATDay = Old.Where(t => t.CreateTime >= DataBus.Times.ATStartTime && t.CreateTime < DataBus.Times.ATEndTime) var ATDay = Old.Where(t => t.CreateTime >= DataBus.Times.ATStartTime && t.CreateTime < DataBus.Times.ATEndTime)
.Where(t => t.CreateTime.Year == DateTime.Now.Year)
.Where(t => t.CreateTime.Month == DateTime.Now.Month)
.Where(t => t.CreateTime.Day == DateTime.Now.Day)
.Where(t => t.CreateTime.Year == DataBus.TodayTime.Year)
.Where(t => t.CreateTime.Month == DataBus.TodayTime.Month)
.Where(t => t.CreateTime.Day == DataBus.TodayTime.Day)
.Count(); .Count();
HKLog.HKLogImport.WriteInfo($"卡号{input.CardNo}下午消费次数:{ATDay}"); HKLog.HKLogImport.WriteInfo($"卡号{input.CardNo}下午消费次数:{ATDay}");
if (DataBus.Admin.Contains(input.CardNo)) if (DataBus.Admin.Contains(input.CardNo))
@@ -279,7 +279,7 @@ namespace HKCardOUT.Logic.Service
/// <returns></returns> /// <returns></returns>
public Dictionary<string, int> PullDaySaleLog(int[] screen) public Dictionary<string, int> PullDaySaleLog(int[] screen)
{ {
// var today = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd 00:00:00"));
// var today = DateTime.Parse(DataBus.TodayTime.ToString("yyyy-MM-dd 00:00:00"));
// var count = DbContext.Context.Queryable<SaleLog>().Where(t => t.CreateTime >= today) // var count = DbContext.Context.Queryable<SaleLog>().Where(t => t.CreateTime >= today)
// .WhereIF(screen == 0, t => t.Location == "3" || t.Location == "4") // .WhereIF(screen == 0, t => t.Location == "3" || t.Location == "4")
// .WhereIF(screen == 1, t => t.Location == "1" || t.Location == "2") // .WhereIF(screen == 1, t => t.Location == "1" || t.Location == "2")
@@ -287,7 +287,7 @@ namespace HKCardOUT.Logic.Service
//return count.GroupBy(t => t).ToDictionary(t => t.Key, t => t.Count()); //return count.GroupBy(t => t).ToDictionary(t => t.Key, t => t.Count());
string a = screen[0].ToString(); string a = screen[0].ToString();
string b = screen[1].ToString(); string b = screen[1].ToString();
var today = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd 00:00:00"));
var today = DateTime.Parse(DataBus.TodayTime.ToString("yyyy-MM-dd 00:00:00"));
var count = DbContext.Context.Queryable<SaleLog>().Where(t => t.CreateTime >= today) var count = DbContext.Context.Queryable<SaleLog>().Where(t => t.CreateTime >= today)
.WhereIF(screen.Length == 2, t => t.Location == a || t.Location == b).Select(t => t.Location).ToList(); .WhereIF(screen.Length == 2, t => t.Location == a || t.Location == b).Select(t => t.Location).ToList();
return count.GroupBy(t => t).ToDictionary(t => t.Key, t => t.Count()); return count.GroupBy(t => t).ToDictionary(t => t.Key, t => t.Count());
@@ -298,7 +298,7 @@ namespace HKCardOUT.Logic.Service
/// <returns></returns> /// <returns></returns>
public Dictionary<string, int> GetDayData() public Dictionary<string, int> GetDayData()
{ {
var today = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd 00:00:00"));
var today = DateTime.Parse(DataBus.TodayTime.ToString("yyyy-MM-dd 00:00:00"));
var count = DbContext.Context.Queryable<SaleLog>().Select(t => t.Location).ToList(); var count = DbContext.Context.Queryable<SaleLog>().Select(t => t.Location).ToList();
return count.GroupBy(t => t).ToDictionary(t => t.Key, t => t.Count()); return count.GroupBy(t => t).ToDictionary(t => t.Key, t => t.Count());
} }


+ 1
- 1
HKCardOUT/ViewModels/RootViewModel.cs View File

@@ -212,7 +212,7 @@ namespace HKCardOUT.ViewModels
{ {
CardNo = input.ResData.Substring(1, input.ResData.Length - 1), CardNo = input.ResData.Substring(1, input.ResData.Length - 1),
Location = input.Address.AsInt().ToString(), Location = input.Address.AsInt().ToString(),
Date = DateTime.Now
Date = DataBus.TodayTime
}; };
HKLogImport.WriteInfo("读卡成功:" + mo.ToJson()); HKLogImport.WriteInfo("读卡成功:" + mo.ToJson());
if (Stacks.Count > 0) if (Stacks.Count > 0)


Loading…
Cancel
Save