Browse Source

更新定时任务

master
wanggang 1 year ago
parent
commit
26be25a7cd
  1. 4
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/JobHostdService.cs
  2. 4
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs

4
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/JobHostdService.cs

@ -7,9 +7,11 @@ using System.Net;
using System.Threading;
using System.Threading.Tasks;
using Cronos;
using Microsoft.AspNetCore.SignalR;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using SettleAccount.Job.SignalR;
using Volo.Abp.Application.Services;
using Win.Sfs.SettleAccount.Entities.BQ.Vmi;
@ -86,6 +88,7 @@ public class JobHostdService : BackgroundService, IApplicationService
if (!jobItem.IsRunning)
{
jobLogId = this.JobItemStart(job.Id);
scope.ServiceProvider.GetRequiredService<IHubContext<PageHub>>().Clients.All.ServerToClient("JobItem", "refresh", "");
if (jobLogId.HasValue)
{
try
@ -100,6 +103,7 @@ public class JobHostdService : BackgroundService, IApplicationService
Console.WriteLine(ex.ToString());
this.JobItemFaild(job.Id, jobLogId.Value, ex);
}
scope.ServiceProvider.GetRequiredService<IHubContext<PageHub>>().Clients.All.ServerToClient("JobItem", "refresh", "");
}
}
}

4
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs

@ -128,7 +128,7 @@ public class VmiAppService : ApplicationService, IVmiService, IJobService, ITran
[DisableValidation]
public virtual Task Invoke(IServiceProvider serviceProvider)
{
this._hubContext.Clients.All.ServerToClient("JobItem", "refresh", "");
//this._hubContext.Clients.All.ServerToClient("JobItem", "refresh", "");
Directory.CreateDirectory(Path.Combine(Directory.GetCurrentDirectory(), "wwwroot/files/vmi"));
var date = DateTime.Now.ToString("yyyyMMddHH");
var connectionString = $"Data Source=wwwroot/files/vmi/{date}.db";
@ -166,7 +166,7 @@ public class VmiAppService : ApplicationService, IVmiService, IJobService, ITran
throw;
}
}
this._hubContext.Clients.All.ServerToClient("JobItem", "refresh", "");
//this._hubContext.Clients.All.ServerToClient("JobItem", "refresh", "");
return Task.CompletedTask;
}

Loading…
Cancel
Save