parent
9ef9d0811b
commit
e98a740405
@ -1,32 +0,0 @@
|
||||
namespace Service.BusinessTask;
|
||||
|
||||
public abstract class AbstractTaskHandler
|
||||
{
|
||||
private volatile bool _stopFlag = false;
|
||||
|
||||
public void Start()
|
||||
{
|
||||
Thread thread = new Thread(Process);
|
||||
thread.IsBackground = true;
|
||||
thread.Name = Name();
|
||||
thread.Start();
|
||||
}
|
||||
|
||||
private void Process()
|
||||
{
|
||||
while (!_stopFlag)
|
||||
{
|
||||
Handle();
|
||||
Thread.Sleep(Interval());
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract int Interval();
|
||||
protected abstract void Handle();
|
||||
protected abstract string Name();
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
_stopFlag = true;
|
||||
}
|
||||
}
|
@ -1,19 +1,13 @@
|
||||
using Autofac;
|
||||
using Entity.Constant;
|
||||
using Entity.DbModel.Station;
|
||||
using HybirdFrameworkCore.Autofac;
|
||||
using HybirdFrameworkCore.Autofac.Attribute;
|
||||
using HybirdFrameworkCore.AutoTask;
|
||||
using HybirdFrameworkCore.Entity;
|
||||
using log4net;
|
||||
using Repository.Station;
|
||||
using Service.Execute;
|
||||
using Service.Execute.Api;
|
||||
using Service.Execute.Model;
|
||||
using Service.Plc.Client;
|
||||
using Service.Station;
|
||||
|
||||
namespace Service.BusinessTask.MyTask;
|
||||
namespace Service.MyTask;
|
||||
|
||||
/// <summary>
|
||||
/// 电池移仓任务
|
Loading…
Reference in new issue