using AngleSharp.Dom;
|
using Magicodes.ExporterAndImporter.Excel.Utility.TemplateExport;
|
using MailKit.Search;
|
using Masuit.Tools;
|
using Microsoft.Extensions.Hosting;
|
using Microsoft.Extensions.Logging;
|
using SixLabors.Fonts;
|
using SqlSugar;
|
using System;
|
using System.Data;
|
using System.Net;
|
using System.Net.Mail;
|
using System.Text;
|
using System.Xml.Linq;
|
using WIDESEA_Cache;
|
using WIDESEA_Core.Const;
|
using WIDESEA_DTO.WMS;
|
using WIDESEA_IServices;
|
using WIDESEAWCS_BasicInfoRepository;
|
|
namespace WIDESEA_StorageTaskServices
|
{
|
public class MyBackgroundService : IHostedService, IDisposable
|
{
|
private readonly ILogger<MyBackgroundService> _logger;
|
private readonly IStockInfoRepository _stockInfoRepository;
|
private readonly IDt_TaskRepository _taskRepository;
|
private readonly ISys_ConfigService _configService;
|
private readonly ILocationInfoRepository _locationRepository;
|
private readonly IUnitOfWorkManage _unitOfWorkManage;
|
private Timer _timer;
|
|
public MyBackgroundService(ILogger<MyBackgroundService> logger, ILocationInfoRepository locationRepository, IStockInfoRepository stockInfoRepository,IDt_TaskRepository taskRepository,ISys_ConfigService configService,IUnitOfWorkManage unitOfWorkManage)
|
{
|
_logger = logger;
|
_locationRepository = locationRepository;
|
_stockInfoRepository = stockInfoRepository;
|
_taskRepository = taskRepository;
|
_configService = configService;
|
_unitOfWorkManage = unitOfWorkManage;
|
}
|
|
public MyBackgroundService()
|
{
|
}
|
|
public Task StartAsync(CancellationToken cancellationToken)
|
{
|
_timer = new Timer(DoWork, null, TimeSpan.Zero, TimeSpan.FromMinutes(10));
|
return Task.CompletedTask;
|
}
|
|
private void DoWork(object state)
|
{
|
try
|
{
|
|
}
|
catch (Exception ex)
|
{
|
ConsoleHelper.WriteErrorLine($"错误信息:" + ex.Message);
|
}
|
}
|
|
|
|
public Task StopAsync(CancellationToken cancellationToken)
|
{
|
_logger.LogInformation("MyBackgroundService is stopping.");
|
_timer?.Change(Timeout.Infinite, 0);
|
return Task.CompletedTask;
|
}
|
|
public void Dispose()
|
{
|
_timer?.Dispose();
|
}
|
}
|
}
|