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.
55 lines
1.2 KiB
55 lines
1.2 KiB
using HybirdFrameworkCore.Autofac.Attribute;
|
|
using HybirdFrameworkCore.AutoTask;
|
|
using log4net;
|
|
using Repository.Station;
|
|
using Service.Charger.Client;
|
|
using Service.Charger.Msg.Host.Req;
|
|
|
|
namespace Service.Charger.MyTask;
|
|
|
|
[Scope]
|
|
public class BatteryHolderStatusTask : ITask
|
|
{
|
|
private static readonly ILog Log = LogManager.GetLogger(typeof(BatteryHolderStatusTask));
|
|
private volatile bool _stop;
|
|
|
|
public BinInfoRepository binInfoRepository { get; set; }
|
|
|
|
public string Name()
|
|
{
|
|
return "BatteryHolderStatusTask";
|
|
}
|
|
|
|
public int Interval()
|
|
{
|
|
return 1000 * 2;
|
|
}
|
|
|
|
public void Handle()
|
|
{
|
|
var binInfos = binInfoRepository.Query();
|
|
foreach (var binInfo in binInfos)
|
|
{
|
|
var chargerClient = ClientMgr.GetBySn(binInfo.ChargerNo);
|
|
if (chargerClient != null && chargerClient.Connected)
|
|
{
|
|
chargerClient.SendBatteryHolderStatus((byte)(binInfo.Exists==1?1:0),1,1);
|
|
}
|
|
}
|
|
}
|
|
|
|
public bool Stoped()
|
|
{
|
|
return _stop;
|
|
}
|
|
|
|
public void Stop()
|
|
{
|
|
_stop = true;
|
|
}
|
|
|
|
public void ResetStop()
|
|
{
|
|
_stop = false;
|
|
}
|
|
} |