diff --git a/HKCardManager/UserPages/PersonnelEntryPage.cs b/HKCardManager/UserPages/PersonnelEntryPage.cs index 65a1e6d..522d7af 100644 --- a/HKCardManager/UserPages/PersonnelEntryPage.cs +++ b/HKCardManager/UserPages/PersonnelEntryPage.cs @@ -644,8 +644,8 @@ namespace HKCardManager.UserPages string cardNum = ""; if (item.Cards != null && item.Cards.Count > 0) { - cardNum = item.Cards.ElementAt(0).CardNum; - status = ((CarStatus)item.Cards.ElementAt(0).State).ToString(); + cardNum = item.Cards.FirstOrDefault(t=>t.State==1).CardNum; + status = ((CarStatus)item.Cards.FirstOrDefault(t => t.State == 1).State).ToString(); } Global.UserListDtos.Add(new UserInfoModel() { diff --git a/HKCardOUT/Bootstrapper.cs b/HKCardOUT/Bootstrapper.cs index 517f8e6..68f6d52 100644 --- a/HKCardOUT/Bootstrapper.cs +++ b/HKCardOUT/Bootstrapper.cs @@ -18,6 +18,7 @@ using HKLib.RabbitMQ.Config; using HKLib.RabbitMQ.Subscriber; using System.Linq; using BPA.Helper; +using QuartzUtil.Job; namespace HKCardOUT { @@ -132,6 +133,14 @@ namespace HKCardOUT /// protected override void OnLaunch() { + QuartzCoreFactory.QuartzCore().AddJob(new QuartzMap + { + JobDetail = "定时同步卡", + JobName = "同步卡", + JobGroup = "同步卡", + Cron= "0 25,55 11,17 * * ?" + }); + QuartzCoreFactory.QuartzCore().AddJob(new QuartzMap { JobDetail = "定时推送订单", diff --git a/HKCardOUT/QuartzUtil/Job/CardJob.cs b/HKCardOUT/QuartzUtil/Job/CardJob.cs new file mode 100644 index 0000000..5723c7c --- /dev/null +++ b/HKCardOUT/QuartzUtil/Job/CardJob.cs @@ -0,0 +1,18 @@ +using HKCardOUT.Logic; +using Quartz; +using System; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; + +namespace QuartzUtil.Job +{ + public class CardJob : IJob + { + public Task Execute(IJobExecutionContext context) + { + RemoteService.GetCardStuatas(); + return Task.CompletedTask; + } + } +} diff --git a/HKCardOUT/ViewModels/RootViewModel.cs b/HKCardOUT/ViewModels/RootViewModel.cs index 0cee220..b389010 100644 --- a/HKCardOUT/ViewModels/RootViewModel.cs +++ b/HKCardOUT/ViewModels/RootViewModel.cs @@ -43,7 +43,6 @@ namespace HKCardOUT.ViewModels InsertData(); DataCenter.InitQueeue(); DataCenter.CreateData(); - SyncCard(); } /// @@ -289,14 +288,6 @@ namespace HKCardOUT.ViewModels Thread.Sleep(1000); }, "写入数据", true); } - private void SyncCard() - { - ThreadManage.GetInstance().StartLong(() => - { - RemoteService.GetCardStuatas(); - Thread.Sleep(1000 * 60 * 60); - }, "同步卡号", true); - } private static ConcurrentQueue Stacks = new ConcurrentQueue(); #endregion