52 lines
1.5 KiB
C#
52 lines
1.5 KiB
C#
using Quartz;
|
|
using System.Threading;
|
|
using System;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace BLL
|
|
{
|
|
public class MyJob : IJob
|
|
{
|
|
public async Task Execute(IJobExecutionContext context)
|
|
{
|
|
JobKey key = context.JobDetail.Key;
|
|
|
|
// note: use context.MergedJobDataMap in production code
|
|
JobDataMap dataMap = context.JobDetail.JobDataMap;
|
|
string InterFaceTaskId = dataMap.GetString("InterFaceTaskId");
|
|
|
|
//使用异步任务来实现
|
|
await Task.Run(() =>
|
|
{
|
|
|
|
InterFaceTaskService.ExecuteTasks(InterFaceTaskId);
|
|
|
|
|
|
//Console.WriteLine($"{DateTime.Now}【{Thread.CurrentThread.ManagedThreadId}】:自定义的工作正在执行... ...");
|
|
});
|
|
}
|
|
}
|
|
public class CLJob : IJob
|
|
{
|
|
public async Task Execute(IJobExecutionContext context)
|
|
{
|
|
JobKey key = context.JobDetail.Key;
|
|
|
|
// note: use context.MergedJobDataMap in production code
|
|
JobDataMap dataMap = context.JobDetail.JobDataMap;
|
|
string InterFaceTaskId = dataMap.GetString("InterFaceTaskId");
|
|
|
|
//使用异步任务来实现
|
|
await Task.Run(() =>
|
|
{
|
|
MonitorService.PipelineWeldingQuantities();
|
|
|
|
|
|
|
|
//Console.WriteLine($"{DateTime.Now}【{Thread.CurrentThread.ManagedThreadId}】:自定义的工作正在执行... ...");
|
|
});
|
|
}
|
|
}
|
|
}
|
|
|