|
|
|
@ -24,29 +24,38 @@ public class ManualSuccState : IState
|
|
|
|
|
public StateResult Handle(SwappingStateMachine machine)
|
|
|
|
|
{
|
|
|
|
|
_log.Info($"'goto ManualSucc");
|
|
|
|
|
machine.ManualSwapSuccFlag = false;
|
|
|
|
|
if (machine.SwapOrderBatteryInfo.swapAmtOrder != null)
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
machine.SwapOrderBatteryInfo.swapAmtOrder.Status = (byte)InfoEnum.AmtOrderStatus.SwapFinish;
|
|
|
|
|
_swapAmtOrderRepository.Update(machine.SwapOrderBatteryInfo.swapAmtOrder);
|
|
|
|
|
}
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (machine.SwapOrder != null)
|
|
|
|
|
_manualOperationRecordRepository.Insert(new ManualOperationRecord()
|
|
|
|
|
{
|
|
|
|
|
Type = 2,
|
|
|
|
|
CreatedBy = UserManager.Account,
|
|
|
|
|
UpdatedBy = UserManager.Account,
|
|
|
|
|
Operator = machine.OperateModel.Operator,
|
|
|
|
|
Reason = machine.OperateModel.Reason,
|
|
|
|
|
});
|
|
|
|
|
machine.Reset();
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
machine.SwapOrder.SwapResult = (byte)InfoEnum.SwapOrderResult.Success;
|
|
|
|
|
machine.SwapOrder.VehicleLeaveTime = DateTime.Now;
|
|
|
|
|
_swapOrderRepository.Update(machine.SwapOrder);
|
|
|
|
|
machine.Reset();
|
|
|
|
|
_log.Error($"ManualSuccState err={e}");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_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
|
|
|
|
|