From 84473df9614eb3be55602cdde5874e2e0413908c Mon Sep 17 00:00:00 2001 From: xxe Date: Fri, 23 Sep 2022 10:28:54 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=B5=8B=E8=AF=95=E8=B0=83?= =?UTF-8?q?=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HKCardOUT/Bootstrapper.cs | 2 ++ HKCardOUT/Helper/DataBus.cs | 1 + HKCardOUT/Logic/Service/HKCore.cs | 10 +++++++--- HKCardOUT/options.json | 1 + 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/HKCardOUT/Bootstrapper.cs b/HKCardOUT/Bootstrapper.cs index 0e38a83..c6ff493 100644 --- a/HKCardOUT/Bootstrapper.cs +++ b/HKCardOUT/Bootstrapper.cs @@ -11,6 +11,7 @@ using HKCardOUT.QuartzUtil; using HKCardOUT.Logic; using HKCardOUT.Logic.Service; using ImTools; +using XExten.Advance.LinqFramework; namespace HKCardOUT { @@ -40,6 +41,7 @@ namespace HKCardOUT DataBus.SaasRoute = configer["SaasRoute"]; DataBus.StoreId = configer["StoreId"]; DataBus.COM = configer["COM"]; + DataBus.IsTest = configer["IsTest"].AsBool(); DbContext.InitTable(); RemoteService.PullShopInfo(); base.Configure(); diff --git a/HKCardOUT/Helper/DataBus.cs b/HKCardOUT/Helper/DataBus.cs index 1b7811c..e5a7b53 100644 --- a/HKCardOUT/Helper/DataBus.cs +++ b/HKCardOUT/Helper/DataBus.cs @@ -26,6 +26,7 @@ namespace HKCardOUT.Helper } public static bool NetWordState { get; set; } = false; public static string Cron { get; set; } + public static bool IsTest { get; set; } public static string StoreId { get; set; } public static string COM { get; set; } public static string SaasRoute { get; set; } diff --git a/HKCardOUT/Logic/Service/HKCore.cs b/HKCardOUT/Logic/Service/HKCore.cs index 17015f6..cecbd7d 100644 --- a/HKCardOUT/Logic/Service/HKCore.cs +++ b/HKCardOUT/Logic/Service/HKCore.cs @@ -1,4 +1,5 @@ using HandyControl.Controls; +using HKCardOUT.Helper; using HKCardOUT.Logic.Model; using HKControl; using System; @@ -20,7 +21,8 @@ namespace HKCardOUT.Logic.Service public bool DeviceSale(SaleLog input) { if (RemoteService.CheckCardStuatas(input.CardNo) != 1) return false; - if (!Main.GetInstance.GetIsSwipe(input.Location.AsInt())) return false; + if (!DataBus.IsTest) + if (!Main.GetInstance.GetIsSwipe(input.Location.AsInt())) return false; var Old = DbContext.Context.Queryable() .Where(t => t.CardNo == input.CardNo).OrderByDescending(t => t.CreateTime).First(); if (Old != null) @@ -29,7 +31,8 @@ namespace HKCardOUT.Logic.Service if (entity.Id != Guid.Empty) { var res = RemoteService.SyncSaleLog(input.CardNo, input.Location); - Main.GetInstance.Start(input.Location.AsInt()); + if (!DataBus.IsTest) + Main.GetInstance.Start(input.Location.AsInt()); DbContext.Context.Updateable().SetColumns(t => t.IsSync == true).Where(t => t.Id == entity.Id).ExecuteCommand(); return res; } @@ -41,7 +44,8 @@ namespace HKCardOUT.Logic.Service if (entity.Id != Guid.Empty) { var res = RemoteService.SyncSaleLog(input.CardNo, input.Location); - Main.GetInstance.Start(input.Location.AsInt()); + if (!DataBus.IsTest) + Main.GetInstance.Start(input.Location.AsInt()); DbContext.Context.Updateable().SetColumns(t => t.IsSync == true).Where(t => t.Id == entity.Id).ExecuteCommand(); return res; } diff --git a/HKCardOUT/options.json b/HKCardOUT/options.json index 7ce22c8..66845e7 100644 --- a/HKCardOUT/options.json +++ b/HKCardOUT/options.json @@ -1,6 +1,7 @@ { //服务地址 "SaasRoute": "https://bpa.black-pa.com:21527/kitchen/", + "IsTest": true, "COM": "COM3", //定时任务时间表达式 "Cron": "0 0 11,15 * * ? ",