You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
1.1 KiB

  1. using HKCardOUT.Logic;
  2. using HKCardOUT.Logic.Model;
  3. using Quartz;
  4. using System.Threading.Tasks;
  5. namespace HKCardOUT.QuartzUtil.Job
  6. {
  7. public class QuartzJob : IJob
  8. {
  9. public async Task Execute(IJobExecutionContext context)
  10. {
  11. switch (context.JobDetail.Key.Group)
  12. {
  13. default:
  14. {
  15. var WaitSync = DbContext.Context.Queryable<SaleLog>().Where(t => t.IsSync == false).ToList();
  16. if (WaitSync.Count > 0)
  17. {
  18. foreach (var input in WaitSync)
  19. {
  20. var res = RemoteService.SyncSaleLog(input.CardNo, input.Location);
  21. if (res)
  22. await DbContext.Context.Updateable<SaleLog>().SetColumns(t => t.IsSync == true).Where(t => t.Id == input.Id).ExecuteCommandAsync();
  23. }
  24. }
  25. }
  26. break;
  27. }
  28. }
  29. }
  30. }