|
@@ -13,16 +13,17 @@ namespace HKCardOUT.Logic.Service |
|
|
{ |
|
|
{ |
|
|
public class HKCore |
|
|
public class HKCore |
|
|
{ |
|
|
{ |
|
|
List<SaleLog> Commom(SaleLog input) |
|
|
|
|
|
|
|
|
List<SaleLog> Commom(SaleLog input) |
|
|
{ |
|
|
{ |
|
|
if (!DataBus.IsTest) |
|
|
|
|
|
|
|
|
if (DataBus.StartDevice) |
|
|
if (!Main.GetInstance.GetIsSwipe(input.Location.AsInt())) return null; |
|
|
if (!Main.GetInstance.GetIsSwipe(input.Location.AsInt())) return null; |
|
|
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.Year == DateTime.Now.Year) |
|
|
.Where(t => t.CreateTime.Month == DateTime.Now.Month) |
|
|
.Where(t => t.CreateTime.Month == DateTime.Now.Month) |
|
|
.Where(t => t.CreateTime.Day == DateTime.Now.Day).ToList(); |
|
|
.Where(t => t.CreateTime.Day == DateTime.Now.Day).ToList(); |
|
|
if (Old.Count > 3) return null; |
|
|
|
|
|
|
|
|
if (DataBus.Cancel) |
|
|
|
|
|
if (Old.Count > 3) return null; |
|
|
return Old; |
|
|
return Old; |
|
|
} |
|
|
} |
|
|
/// <summary> |
|
|
/// <summary> |
|
@@ -45,7 +46,7 @@ namespace HKCardOUT.Logic.Service |
|
|
.Count(); |
|
|
.Count(); |
|
|
HKLog.HKLogImport.WriteInfo($"卡号{input.CardNo}上午消费次数:{AMDay}"); |
|
|
HKLog.HKLogImport.WriteInfo($"卡号{input.CardNo}上午消费次数:{AMDay}"); |
|
|
|
|
|
|
|
|
if (AMDay < 1) |
|
|
|
|
|
|
|
|
if (AMDay < DataBus.Count) |
|
|
{ |
|
|
{ |
|
|
var entity = DbContext.Context.Insertable(input).CallEntityMethod(t => t.Create()).ExecuteReturnEntity(); |
|
|
var entity = DbContext.Context.Insertable(input).CallEntityMethod(t => t.Create()).ExecuteReturnEntity(); |
|
|
if (entity.Id != Guid.Empty) |
|
|
if (entity.Id != Guid.Empty) |
|
@@ -54,16 +55,16 @@ namespace HKCardOUT.Logic.Service |
|
|
if (DataBus.NetWordState) |
|
|
if (DataBus.NetWordState) |
|
|
{ |
|
|
{ |
|
|
//先出餐后推数据 |
|
|
//先出餐后推数据 |
|
|
if (!DataBus.IsTest) |
|
|
|
|
|
|
|
|
if (DataBus.StartDevice) |
|
|
Main.GetInstance.Start(input.Location.AsInt()); |
|
|
Main.GetInstance.Start(input.Location.AsInt()); |
|
|
var res = RemoteService.SyncSaleLog(input.CardNo, input.Location); |
|
|
var res = RemoteService.SyncSaleLog(input.CardNo, input.Location); |
|
|
if(res) |
|
|
|
|
|
|
|
|
if (res) |
|
|
DbContext.Context.Updateable<SaleLog>().SetColumns(t => t.IsSync == true).Where(t => t.Id == entity.Id).ExecuteCommand(); |
|
|
DbContext.Context.Updateable<SaleLog>().SetColumns(t => t.IsSync == true).Where(t => t.Id == entity.Id).ExecuteCommand(); |
|
|
return res; |
|
|
return res; |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
|
if (!DataBus.IsTest) |
|
|
|
|
|
|
|
|
if (DataBus.StartDevice) |
|
|
Main.GetInstance.Start(input.Location.AsInt()); |
|
|
Main.GetInstance.Start(input.Location.AsInt()); |
|
|
return true; |
|
|
return true; |
|
|
} |
|
|
} |
|
@@ -97,7 +98,7 @@ namespace HKCardOUT.Logic.Service |
|
|
.Where(t => t.CreateTime.Day == DateTime.Now.Day) |
|
|
.Where(t => t.CreateTime.Day == DateTime.Now.Day) |
|
|
.Count(); |
|
|
.Count(); |
|
|
HKLog.HKLogImport.WriteInfo($"卡号{input.CardNo}中午消费次数:{PMDay}"); |
|
|
HKLog.HKLogImport.WriteInfo($"卡号{input.CardNo}中午消费次数:{PMDay}"); |
|
|
if (PMDay < 1) |
|
|
|
|
|
|
|
|
if (PMDay < DataBus.Count) |
|
|
{ |
|
|
{ |
|
|
var entity = DbContext.Context.Insertable(input).CallEntityMethod(t => t.Create()).ExecuteReturnEntity(); |
|
|
var entity = DbContext.Context.Insertable(input).CallEntityMethod(t => t.Create()).ExecuteReturnEntity(); |
|
|
if (entity.Id != Guid.Empty) |
|
|
if (entity.Id != Guid.Empty) |
|
@@ -106,7 +107,7 @@ namespace HKCardOUT.Logic.Service |
|
|
if (DataBus.NetWordState) |
|
|
if (DataBus.NetWordState) |
|
|
{ |
|
|
{ |
|
|
//先出餐后推数据 |
|
|
//先出餐后推数据 |
|
|
if (!DataBus.IsTest) |
|
|
|
|
|
|
|
|
if (DataBus.StartDevice) |
|
|
Main.GetInstance.Start(input.Location.AsInt()); |
|
|
Main.GetInstance.Start(input.Location.AsInt()); |
|
|
var res = RemoteService.SyncSaleLog(input.CardNo, input.Location); |
|
|
var res = RemoteService.SyncSaleLog(input.CardNo, input.Location); |
|
|
if (res) |
|
|
if (res) |
|
@@ -115,7 +116,7 @@ namespace HKCardOUT.Logic.Service |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
|
if (!DataBus.IsTest) |
|
|
|
|
|
|
|
|
if (DataBus.StartDevice) |
|
|
Main.GetInstance.Start(input.Location.AsInt()); |
|
|
Main.GetInstance.Start(input.Location.AsInt()); |
|
|
return true; |
|
|
return true; |
|
|
} |
|
|
} |
|
@@ -149,7 +150,7 @@ namespace HKCardOUT.Logic.Service |
|
|
.Where(t => t.CreateTime.Day == DateTime.Now.Day) |
|
|
.Where(t => t.CreateTime.Day == DateTime.Now.Day) |
|
|
.Count(); |
|
|
.Count(); |
|
|
HKLog.HKLogImport.WriteInfo($"卡号{input.CardNo}下午消费次数:{ATDay}"); |
|
|
HKLog.HKLogImport.WriteInfo($"卡号{input.CardNo}下午消费次数:{ATDay}"); |
|
|
if (ATDay < 1) |
|
|
|
|
|
|
|
|
if (ATDay < DataBus.Count) |
|
|
{ |
|
|
{ |
|
|
var entity = DbContext.Context.Insertable(input).CallEntityMethod(t => t.Create()).ExecuteReturnEntity(); |
|
|
var entity = DbContext.Context.Insertable(input).CallEntityMethod(t => t.Create()).ExecuteReturnEntity(); |
|
|
if (entity.Id != Guid.Empty) |
|
|
if (entity.Id != Guid.Empty) |
|
@@ -158,16 +159,16 @@ namespace HKCardOUT.Logic.Service |
|
|
if (DataBus.NetWordState) |
|
|
if (DataBus.NetWordState) |
|
|
{ |
|
|
{ |
|
|
//先出餐后推数据 |
|
|
//先出餐后推数据 |
|
|
if (!DataBus.IsTest) |
|
|
|
|
|
|
|
|
if (DataBus.StartDevice) |
|
|
Main.GetInstance.Start(input.Location.AsInt()); |
|
|
Main.GetInstance.Start(input.Location.AsInt()); |
|
|
var res = RemoteService.SyncSaleLog(input.CardNo, input.Location); |
|
|
var res = RemoteService.SyncSaleLog(input.CardNo, input.Location); |
|
|
if (res) |
|
|
if (res) |
|
|
DbContext.Context.Updateable<SaleLog>().SetColumns(t => t.IsSync == true).Where(t => t.Id == entity.Id).ExecuteCommand(); |
|
|
DbContext.Context.Updateable<SaleLog>().SetColumns(t => t.IsSync == true).Where(t => t.Id == entity.Id).ExecuteCommand(); |
|
|
return res; |
|
|
return res; |
|
|
} |
|
|
} |
|
|
else |
|
|
|
|
|
|
|
|
else |
|
|
{ |
|
|
{ |
|
|
if (!DataBus.IsTest) |
|
|
|
|
|
|
|
|
if (DataBus.StartDevice) |
|
|
Main.GetInstance.Start(input.Location.AsInt()); |
|
|
Main.GetInstance.Start(input.Location.AsInt()); |
|
|
return true; |
|
|
return true; |
|
|
} |
|
|
} |
|
|