|
|
@ -1,6 +1,8 @@
|
|
|
|
using DotNetty.Transport.Channels;
|
|
|
|
using DotNetty.Transport.Channels;
|
|
|
|
|
|
|
|
using Entity.DbModel.Station;
|
|
|
|
using HybirdFrameworkCore.Autofac.Attribute;
|
|
|
|
using HybirdFrameworkCore.Autofac.Attribute;
|
|
|
|
using log4net;
|
|
|
|
using log4net;
|
|
|
|
|
|
|
|
using Repository.Station;
|
|
|
|
using Service.Charger.Client;
|
|
|
|
using Service.Charger.Client;
|
|
|
|
using Service.Charger.Common;
|
|
|
|
using Service.Charger.Common;
|
|
|
|
using Service.Charger.Msg.Charger.Resp;
|
|
|
|
using Service.Charger.Msg.Charger.Resp;
|
|
|
@ -19,6 +21,9 @@ namespace Service.Charger.Handler
|
|
|
|
public class RemoteStartChargingResHandler : SimpleChannelInboundHandler<RemoteStartChargingRes>, IBaseHandler
|
|
|
|
public class RemoteStartChargingResHandler : SimpleChannelInboundHandler<RemoteStartChargingRes>, IBaseHandler
|
|
|
|
{
|
|
|
|
{
|
|
|
|
private static readonly ILog Log = LogManager.GetLogger(typeof(RemoteStartChargingResHandler));
|
|
|
|
private static readonly ILog Log = LogManager.GetLogger(typeof(RemoteStartChargingResHandler));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public ChargeOrderRepository ChargeOrderRepository { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
protected override void ChannelRead0(IChannelHandlerContext ctx, RemoteStartChargingRes msg)
|
|
|
|
protected override void ChannelRead0(IChannelHandlerContext ctx, RemoteStartChargingRes msg)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (ClientMgr.TryGetClient(ctx.Channel, out var sn, out var client))
|
|
|
|
if (ClientMgr.TryGetClient(ctx.Channel, out var sn, out var client))
|
|
|
@ -29,6 +34,16 @@ namespace Service.Charger.Handler
|
|
|
|
client.IsStopped = false;
|
|
|
|
client.IsStopped = false;
|
|
|
|
client.ChargingStatus = (int)ChargingStatus.StartChargingSuccess;
|
|
|
|
client.ChargingStatus = (int)ChargingStatus.StartChargingSuccess;
|
|
|
|
client.ChargingStartTime = DateTime.Now;
|
|
|
|
client.ChargingStartTime = DateTime.Now;
|
|
|
|
|
|
|
|
//查找最新的充电订单
|
|
|
|
|
|
|
|
List<ChargeOrder> chargeOrders = ChargeOrderRepository.QueryListByClause(i => i.BatteryNo == client.BatteryNo, "created_time desc")
|
|
|
|
|
|
|
|
.Take(1).ToList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (chargeOrders.Count > 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
ChargeOrder one = chargeOrders[0];
|
|
|
|
|
|
|
|
ChargeOrderRepository.Update(i => i.CmdStatus == 1 && i.StartTime == client.ChargingStartTime,
|
|
|
|
|
|
|
|
it => it.Id == one.Id);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|