Pārlūkot izejas kodu

一件测试

Lishi
xxe pirms 2 gadiem
vecāks
revīzija
db0655dfe7
4 mainītis faili ar 32 papildinājumiem un 20 dzēšanām
  1. +3
    -1
      HKCardOUT/Bootstrapper.cs
  2. +3
    -1
      HKCardOUT/Helper/DataBus.cs
  3. +15
    -14
      HKCardOUT/Logic/Service/HKCore.cs
  4. +11
    -4
      HKCardOUT/options.json

+ 3
- 1
HKCardOUT/Bootstrapper.cs Parādīt failu

@@ -42,9 +42,11 @@ namespace HKCardOUT
DataBus.SaasRoute = configer["SaasRoute"];
DataBus.StoreId = configer["StoreId"];
DataBus.COM = configer["COM"];
DataBus.IsTest = configer["IsTest"].AsBool();
DataBus.StartDevice = configer["StartDevice"].AsBool();
DataBus.Cancel = configer["Cancel"].AsBool();
DataBus.AM = configer["AM"];
DataBus.PM = configer["PM"];
DataBus.Count = configer["Count"].AsInt();
DataBus.AT = configer["AT"];
DbContext.InitTable();
RemoteService.PullShopInfo();


+ 3
- 1
HKCardOUT/Helper/DataBus.cs Parādīt failu

@@ -26,13 +26,15 @@ namespace HKCardOUT.Helper
}
public static bool NetWordState { get; set; } = false;
public static string Cron { get; set; }
public static bool IsTest { get; set; }
public static bool StartDevice { get; set; }
public static bool Cancel { get; set; }
public static string StoreId { get; set; }
public static string COM { get; set; }
public static string SaasRoute { get; set; }
public static string AM { get; set; }
public static string PM { get; set; }
public static string AT { get; set; }
public static int Count { get; set; }
public static StoreInfoResponse StoreInfo { get; set; }
public static Dictionary<string, AdWindow> AdStatus { get; set; } = new Dictionary<string, AdWindow>();
}


+ 15
- 14
HKCardOUT/Logic/Service/HKCore.cs Parādīt failu

@@ -13,16 +13,17 @@ namespace HKCardOUT.Logic.Service
{
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;
var Old = DbContext.Context.Queryable<SaleLog>()
.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();
if (Old.Count > 3) return null;
if (DataBus.Cancel)
if (Old.Count > 3) return null;
return Old;
}
/// <summary>
@@ -45,7 +46,7 @@ namespace HKCardOUT.Logic.Service
.Count();
HKLog.HKLogImport.WriteInfo($"卡号{input.CardNo}上午消费次数:{AMDay}");

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


+ 11
- 4
HKCardOUT/options.json Parādīt failu

@@ -1,12 +1,15 @@
{
//服务地址
"SaasRoute": "https://bpa.black-pa.com:21527/kitchen/",
"IsTest": true,
"COM": "COM4",
//启动设备调试
"StartDevice": true,
//串口
"COM": "COM3",
//定时任务时间表达式
"Cron": "0 0 0/1 * * ? ",
"Cron": "0/15 * * * * ? ",
//店铺ID
"StoreId": "a19535e8-119f-4b10-a011-6288fd3ddb37",
//本地数据库
"ConnectionStrings": {
"Sqlite": "HKSQL.db3"
},
@@ -15,5 +18,9 @@
//中午
"PM": "11,14",
//下午
"AT": "17,20"
"AT": "17,20",
//每个时间段的刷卡次数
"Count":1,
//取消单卡刷卡限制
"Cancel":true
}

Notiek ielāde…
Atcelt
Saglabāt