Browse Source

档口

Lishi
xxe 2 years ago
parent
commit
c9433887f6
5 changed files with 15 additions and 17 deletions
  1. +5
    -3
      HKCardOUT/Logic/RemoteService.cs
  2. +7
    -11
      HKCardOUT/Logic/Service/HKCore.cs
  3. +1
    -1
      HKCardOUT/ViewModels/RootViewModel.cs
  4. +1
    -1
      HKCardOUT/options.json
  5. +1
    -1
      UHFHelper/UHF_RS485_Helper.cs

+ 5
- 3
HKCardOUT/Logic/RemoteService.cs View File

@@ -22,10 +22,11 @@ namespace HKCardOUT.Logic
/// <param name="input"></param>
public static int CheckCardStuatas(string CardNo)
{
return IHttpMultiClient.HttpMulti.AddNode(t =>
var data = IHttpMultiClient.HttpMulti.AddNode(t =>
{
t.NodePath = ApiRoute.CheckCardStatus + CardNo;
}).Build().RunStringFirst().ToModel<JObject>()["data"]["cardState"].ToString().AsInt();
return data;
}
/// <summary>
/// 同步消费记录
@@ -34,13 +35,14 @@ namespace HKCardOUT.Logic
/// <param name="Money"></param>
public static bool SyncSaleLog(string CardNo, string StallId)
{
var GateId = DataBus.StoreInfo.Devices.FirstOrDefault(t => t.Address.AsInt() == StallId.AsInt())?.GateId;
var data = IHttpMultiClient.HttpMulti.AddNode(t =>
{
t.ReqType = MultiType.POST;
t.JsonParam = (new { GateId=StallId, Type = -1, CardNum = CardNo }).ToJson();
t.JsonParam = (new { GateId = GateId, Type = -1, CardNum = CardNo }).ToJson();
t.NodePath = ApiRoute.SyncSaleLog;
}).Build().RunStringFirst();
var m= bool.Parse(data.ToModel<JObject>()["data"].ToString());
var m = bool.Parse(data.ToModel<JObject>()["data"].ToString());
if (m)
{
UHF_RS485_Helper.GetInstance().OpenBeep(StallId.AsInt());


+ 7
- 11
HKCardOUT/Logic/Service/HKCore.cs View File

@@ -25,24 +25,20 @@ namespace HKCardOUT.Logic.Service
.Where(t => t.CardNo == input.CardNo).OrderByDescending(t => t.CreateTime).First();
if (Old != null)
{
//10秒防止重复刷卡
if (Old.CreateTime.Subtract(DateTime.Now).TotalSeconds > 10d)
var entity = DbContext.Context.Insertable(input).CallEntityMethod(t => t.Create()).ExecuteReturnEntity();
if (entity.Id != Guid.Empty)
{
var entity = DbContext.Context.Insertable(input).CallEntityMethod(t => t.Create()).ExecuteReturnEntity();
if (entity.Id!=Guid.Empty)
{
var res = RemoteService.SyncSaleLog(input.CardNo, input.Location);
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 res = RemoteService.SyncSaleLog(input.CardNo, input.Location);
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;
}
else
{
var entity = DbContext.Context.Insertable(input).CallEntityMethod(t => t.Create()).ExecuteReturnEntity();
if (entity.Id!=Guid.Empty)
if (entity.Id != Guid.Empty)
{
var res = RemoteService.SyncSaleLog(input.CardNo, input.Location);
Main.GetInstance.Start(input.Location.AsInt());


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

@@ -113,7 +113,7 @@ namespace HKCardOUT.ViewModels
}
else
{
var x = await UHF_RS485_Helper.GetInstance().ReadCard(item.Address.AsInt());
var x = await UHF_RS485_Helper.GetInstance().ReadCard(01);
if (x != null)
ReadFunc?.Invoke(x);
}


+ 1
- 1
HKCardOUT/options.json View File

@@ -1,7 +1,7 @@
{
//服务地址
"SaasRoute": "https://bpa.black-pa.com:21527/kitchen/",
"COM": "COM5",
"COM": "COM3",
//定时任务时间表达式
"Cron": "0 0 11,15 * * ? ",
//店铺ID


+ 1
- 1
UHFHelper/UHF_RS485_Helper.cs View File

@@ -75,7 +75,7 @@ namespace UHFHelper
//获取校验码
var crc = result.Skip(16).Take(2).ToArray();
//获取卡号
var cardNo = result.Skip(6).Take(16).ToArray();
var cardNo = result.Skip(6).Take(10).ToArray();
//获取读卡器数据
var readData = result.Skip(0).Take(16).ToArray();
//获取读卡器地址


Loading…
Cancel
Save