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.9 KiB
55 lines
1.9 KiB
using Autofac;
|
|
using Entity.Constant;
|
|
using Entity.DbModel.Station;
|
|
using HybirdFrameworkCore.Autofac;
|
|
using log4net;
|
|
using Repository.Station;
|
|
using Service.Mgr;
|
|
|
|
namespace Service.Execute.Step;
|
|
|
|
/// <summary>
|
|
/// 手动确认成功状态
|
|
/// </summary>
|
|
public class ManualSuccState : IState
|
|
{
|
|
private readonly SwapOrderRepository _swapOrderRepository = AppInfo.Container.Resolve<SwapOrderRepository>();
|
|
|
|
private readonly SwapAmtOrderRepository _swapAmtOrderRepository =
|
|
AppInfo.Container.Resolve<SwapAmtOrderRepository>();
|
|
|
|
private static readonly ILog _log = LogManager.GetLogger(typeof(CancelState));
|
|
private static readonly ManualOperationRecordRepository _manualOperationRecordRepository =
|
|
AppInfo.Container.Resolve<ManualOperationRecordRepository>();
|
|
public StateResult Handle(SwappingStateMachine machine)
|
|
{
|
|
_log.Info($"'goto ManualSucc");
|
|
machine.ManualSwapSuccFlag = false;
|
|
if (machine.SwapOrderBatteryInfo.swapAmtOrder != null)
|
|
{
|
|
machine.SwapOrderBatteryInfo.swapAmtOrder.Status = (byte)InfoEnum.AmtOrderStatus.SwapFinish;
|
|
_swapAmtOrderRepository.Update(machine.SwapOrderBatteryInfo.swapAmtOrder);
|
|
}
|
|
|
|
if (machine.SwapOrder != null)
|
|
{
|
|
machine.SwapOrder.SwapResult = (byte)InfoEnum.SwapOrderResult.Success;
|
|
machine.SwapOrder.VehicleLeaveTime = DateTime.Now;
|
|
_swapOrderRepository.Update(machine.SwapOrder);
|
|
}
|
|
|
|
_manualOperationRecordRepository.Insert(new ManualOperationRecord()
|
|
{
|
|
Type = 2,
|
|
CreatedBy = UserManager.Account,
|
|
UpdatedBy = UserManager.Account,
|
|
Operator = machine.OperateModel.Operator,
|
|
Reason = machine.OperateModel.Reason,
|
|
});
|
|
machine.Reset();
|
|
return new StateResult()
|
|
{
|
|
SwappingState = SwappingState.StationReady
|
|
};
|
|
}
|
|
} |