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.
|
|
|
|
using HybirdFrameworkCore.Autofac.Attribute;
|
|
|
|
|
using HybirdFrameworkCore.AutoTask;
|
|
|
|
|
using log4net;
|
|
|
|
|
using Repository.Station;
|
|
|
|
|
|
|
|
|
|
namespace Service.MyTask;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 电池充电是风扇启停
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Scope]
|
|
|
|
|
public class FanChangeTask : ITask
|
|
|
|
|
{
|
|
|
|
|
private static readonly ILog Log = LogManager.GetLogger(typeof(FanChangeTask));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public BinInfoRepository _binInfoRepository { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private volatile bool _stop;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public string Name()
|
|
|
|
|
{
|
|
|
|
|
return "FanChangeTask";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int Interval()
|
|
|
|
|
{
|
|
|
|
|
return 1000 * 3;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <para>0:无状态</para>
|
|
|
|
|
/// <para>1000:已全部打开</para>
|
|
|
|
|
/// <para>1010:已全部关闭</para>
|
|
|
|
|
public void Handle()
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
int count = _binInfoRepository.GetCount(i => i.ChargeStatus == 1);
|
|
|
|
|
if (count > 0)
|
|
|
|
|
{
|
|
|
|
|
// PlcMgr.AirBlowerControl(1000);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//PlcMgr.AirBlowerControl(1010);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
Log.Error($" FanChangeTask err e={e}");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool Stoped()
|
|
|
|
|
{
|
|
|
|
|
return _stop;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Stop()
|
|
|
|
|
{
|
|
|
|
|
_stop = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void ResetStop()
|
|
|
|
|
{
|
|
|
|
|
_stop = false;
|
|
|
|
|
}
|
|
|
|
|
}
|