|
|
@ -1,26 +1,21 @@
|
|
|
|
using Autofac;
|
|
|
|
using Autofac;
|
|
|
|
using AutoMapper;
|
|
|
|
|
|
|
|
using Entity.Attr;
|
|
|
|
using Entity.Attr;
|
|
|
|
using Entity.Constant;
|
|
|
|
using Entity.Constant;
|
|
|
|
using Entity.DbModel.Station;
|
|
|
|
using Entity.DbModel.Station;
|
|
|
|
using Entity.Dto;
|
|
|
|
|
|
|
|
using HybirdFrameworkCore.Autofac;
|
|
|
|
using HybirdFrameworkCore.Autofac;
|
|
|
|
using HybirdFrameworkCore.Configuration;
|
|
|
|
|
|
|
|
using log4net;
|
|
|
|
using log4net;
|
|
|
|
using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
using Repository.Station;
|
|
|
|
using Repository.Station;
|
|
|
|
using Service.Execute.Api;
|
|
|
|
using Service.Execute.Api;
|
|
|
|
using Service.Execute.Model;
|
|
|
|
using Service.Execute.Model;
|
|
|
|
using Service.Execute.Model.Tbox;
|
|
|
|
using Service.Execute.Model.Tbox;
|
|
|
|
using Service.Execute.StaticTools;
|
|
|
|
|
|
|
|
using Service.Execute.SwapException;
|
|
|
|
using Service.Execute.SwapException;
|
|
|
|
using Service.Execute.Utils;
|
|
|
|
using Service.Execute.Utils;
|
|
|
|
using Service.Init;
|
|
|
|
using Service.Init;
|
|
|
|
using Service.Led;
|
|
|
|
using Service.Led;
|
|
|
|
using Service.Padar.Client;
|
|
|
|
using Service.Padar.Client;
|
|
|
|
|
|
|
|
using Service.RealTime;
|
|
|
|
using Service.Sound.SoundClient;
|
|
|
|
using Service.Sound.SoundClient;
|
|
|
|
using Service.Station;
|
|
|
|
|
|
|
|
using System.Runtime.CompilerServices;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace Service.Execute.Step;
|
|
|
|
namespace Service.Execute.Step;
|
|
|
|
|
|
|
|
|
|
|
@ -74,8 +69,15 @@ public class CarPrepareState : IState
|
|
|
|
return SwappingStateMachine.ReturnWithInvokeErr(selectPack, ExceptionReason.None);
|
|
|
|
return SwappingStateMachine.ReturnWithInvokeErr(selectPack, ExceptionReason.None);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//在充电的包停止充电
|
|
|
|
|
|
|
|
InvokeStatus stopChargingForUpBin = StopChargingForUpBin(machine);
|
|
|
|
|
|
|
|
if (stopChargingForUpBin != InvokeStatus.Done)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return SwappingStateMachine.ReturnWithInvokeErr(selectPack, ExceptionReason.StopChargingError);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//车辆到位
|
|
|
|
//车辆到位
|
|
|
|
InvokeStatus carInPosition = CarInPosition(machine);
|
|
|
|
InvokeStatus carInPosition = CarInPosition(machine);
|
|
|
|
if (carInPosition != InvokeStatus.Done)
|
|
|
|
if (carInPosition != InvokeStatus.Done)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -412,5 +414,46 @@ public class CarPrepareState : IState
|
|
|
|
, false, () => { }, 20, InvokeStatus.None);
|
|
|
|
, false, () => { }, 20, InvokeStatus.None);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public InvokeStatus StopChargingForUpBin(SwappingStateMachine machine)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return Invoker.Invoke("select pack - stop charging", 1000, 60, machine.IsCanceled,
|
|
|
|
|
|
|
|
() => machine.SelectPackStopChargingFlag,
|
|
|
|
|
|
|
|
() =>
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (machine is { SelectPackFlag: true, SwapOrderBatteryInfo.UpBinInfo.ChargeStatus: 1 })
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var binNo = machine.SwapOrderBatteryInfo?.UpBinInfo.No;
|
|
|
|
|
|
|
|
BinInfo? binInfo = _CommonMgr._binInfoRepository.SelectByBinNo(binNo);
|
|
|
|
|
|
|
|
if (binInfo is { ChargeStatus: 4 })
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
machine.SwapOrderBatteryInfo.UpBinInfo = binInfo;
|
|
|
|
|
|
|
|
machine.SelectPackStopChargingFlag = true;
|
|
|
|
|
|
|
|
HubHolder.S2CMsg(JsonConvert.SerializeObject(new RtMsg
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Cmd = "BeginStopChargingDone",
|
|
|
|
|
|
|
|
Msg = $"{binNo}"
|
|
|
|
|
|
|
|
})).Wait();
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//停止充电
|
|
|
|
|
|
|
|
HubHolder.S2CMsg(JsonConvert.SerializeObject(new RtMsg
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Cmd = "BeginStopCharging",
|
|
|
|
|
|
|
|
Msg = $"{binNo}"
|
|
|
|
|
|
|
|
})).Wait();
|
|
|
|
|
|
|
|
Task<bool> stopCharge = ChargeApi.StopCharge(binNo);
|
|
|
|
|
|
|
|
stopCharge.Wait(TimeSpan.FromSeconds(10));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
machine.SelectPackStopChargingFlag = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|