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.
60 lines
1.7 KiB
60 lines
1.7 KiB
using Entity.DbModel.Station;
|
|
using HybirdFrameworkCore.Autofac.Attribute;
|
|
using Newtonsoft.Json;
|
|
using Repository.Station;
|
|
using Service.Cloud.Common;
|
|
using Service.Cloud.Msg.Cloud.Req;
|
|
using Service.Cloud.Msg.Host.Resp;
|
|
using Service.Execute.Enum;
|
|
using Service.Init;
|
|
|
|
namespace Service.Cloud.Handler;
|
|
|
|
[Scope("InstancePerDependency")]
|
|
public class AmtBatHandler : IBaseHandler
|
|
{
|
|
private BinInfoRepository _binInfoRepository;
|
|
private AmtOrderInfoRepository _amtOrderInfoRepository;
|
|
|
|
public AmtBatHandler(BinInfoRepository binInfoRepository, AmtOrderInfoRepository amtOrderInfoRepository)
|
|
{
|
|
_binInfoRepository = binInfoRepository;
|
|
_amtOrderInfoRepository = amtOrderInfoRepository;
|
|
}
|
|
|
|
public void Handle(string t)
|
|
{
|
|
AmtBatRes abRes = new AmtBatRes();
|
|
abRes.rs = 3;
|
|
AmtBat? amtBat = JsonConvert.DeserializeObject<AmtBat>(t);
|
|
if (amtBat != null)
|
|
{
|
|
int count = _amtOrderInfoRepository.GetCount(it =>
|
|
it.CarNo == amtBat.cn && it.Status == (byte)InfoEnum.AmtOrderStatus.Success);
|
|
|
|
if (count > 0)
|
|
{
|
|
abRes.rs = 1;
|
|
}
|
|
else
|
|
{
|
|
AmtOrderInfo amtOrderInfo = new AmtOrderInfo()
|
|
{
|
|
Sn = StaticStationInfo.StationNo,
|
|
CarNo = amtBat.cn,
|
|
Batnum = amtBat.bm,
|
|
BatteryType = amtBat.bn,
|
|
StartTime = amtBat.at,
|
|
EndTime = amtBat.at.AddMinutes(amtBat.am)
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
public bool CanHandle(string cmd)
|
|
{
|
|
return CloudConst.amtBat == cmd;
|
|
}
|
|
} |