Browse Source

写日志

Lishi
xxe 2 years ago
parent
commit
5a2961dc8c
1 changed files with 34 additions and 24 deletions
  1. +34
    -24
      HKCardOUT/Logic/Service/HKCore.cs

+ 34
- 24
HKCardOUT/Logic/Service/HKCore.cs View File

@@ -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条展示


Loading…
Cancel
Save