|
|
@@ -20,37 +20,47 @@ namespace HKCardOUT.Logic.Service |
|
|
|
/// <returns></returns> |
|
|
|
public bool DeviceSale(SaleLog input) |
|
|
|
{ |
|
|
|
if (RemoteService.CheckCardStuatas(input.CardNo) != 1) return false; |
|
|
|
if (!DataBus.IsTest) |
|
|
|
if (!Main.GetInstance.GetIsSwipe(input.Location.AsInt())) return false; |
|
|
|
var Old = DbContext.Context.Queryable<SaleLog>() |
|
|
|
.Where(t => t.CardNo == input.CardNo).OrderByDescending(t => t.CreateTime).First(); |
|
|
|
if (Old != null) |
|
|
|
try |
|
|
|
{ |
|
|
|
var entity = DbContext.Context.Insertable(input).CallEntityMethod(t => t.Create()).ExecuteReturnEntity(); |
|
|
|
if (entity.Id != Guid.Empty) |
|
|
|
if (RemoteService.CheckCardStuatas(input.CardNo) != 1) return false; |
|
|
|
if (!DataBus.IsTest) |
|
|
|
if (!Main.GetInstance.GetIsSwipe(input.Location.AsInt())) return false; |
|
|
|
var Old = DbContext.Context.Queryable<SaleLog>() |
|
|
|
.Where(t => t.CardNo == input.CardNo).OrderByDescending(t => t.CreateTime).First(); |
|
|
|
if (Old != null) |
|
|
|
{ |
|
|
|
var res = RemoteService.SyncSaleLog(input.CardNo, input.Location); |
|
|
|
if (!DataBus.IsTest) |
|
|
|
Main.GetInstance.Start(input.Location.AsInt()); |
|
|
|
DbContext.Context.Updateable<SaleLog>().SetColumns(t => t.IsSync == true).Where(t => t.Id == entity.Id).ExecuteCommand(); |
|
|
|
return res; |
|
|
|
var entity = DbContext.Context.Insertable(input).CallEntityMethod(t => t.Create()).ExecuteReturnEntity(); |
|
|
|
if (entity.Id != Guid.Empty) |
|
|
|
{ |
|
|
|
var res = RemoteService.SyncSaleLog(input.CardNo, input.Location); |
|
|
|
if (!DataBus.IsTest) |
|
|
|
Main.GetInstance.Start(input.Location.AsInt()); |
|
|
|
DbContext.Context.Updateable<SaleLog>().SetColumns(t => t.IsSync == true).Where(t => t.Id == entity.Id).ExecuteCommand(); |
|
|
|
return res; |
|
|
|
} |
|
|
|
return false; |
|
|
|
} |
|
|
|
return false; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
var entity = DbContext.Context.Insertable(input).CallEntityMethod(t => t.Create()).ExecuteReturnEntity(); |
|
|
|
if (entity.Id != Guid.Empty) |
|
|
|
else |
|
|
|
{ |
|
|
|
var res = RemoteService.SyncSaleLog(input.CardNo, input.Location); |
|
|
|
if (!DataBus.IsTest) |
|
|
|
Main.GetInstance.Start(input.Location.AsInt()); |
|
|
|
DbContext.Context.Updateable<SaleLog>().SetColumns(t => t.IsSync == true).Where(t => t.Id == entity.Id).ExecuteCommand(); |
|
|
|
return res; |
|
|
|
var entity = DbContext.Context.Insertable(input).CallEntityMethod(t => t.Create()).ExecuteReturnEntity(); |
|
|
|
if (entity.Id != Guid.Empty) |
|
|
|
{ |
|
|
|
var res = RemoteService.SyncSaleLog(input.CardNo, input.Location); |
|
|
|
if (!DataBus.IsTest) |
|
|
|
Main.GetInstance.Start(input.Location.AsInt()); |
|
|
|
DbContext.Context.Updateable<SaleLog>().SetColumns(t => t.IsSync == true).Where(t => t.Id == entity.Id).ExecuteCommand(); |
|
|
|
return res; |
|
|
|
} |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
HKLog.HKLogImport.WriteError(ex); |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
/// <summary> |
|
|
|
/// 获取当天消费前100条展示 |
|
|
|