人工操作bug修复

master
lxw 6 months ago
parent c5cafea201
commit a73ec84a8d

@ -24,30 +24,41 @@ public class CancelState : IState
public StateResult Handle(SwappingStateMachine machine)
{
_log.Info($"'goto cancel");
machine.CancelFlag = false;
if (machine.SwapOrderBatteryInfo!=null && machine.SwapOrderBatteryInfo.swapAmtOrder != null)
{
machine.SwapOrderBatteryInfo.swapAmtOrder.Status = (byte)InfoEnum.AmtOrderStatus.SwapFail;
_swapAmtOrderRepository.Update(machine.SwapOrderBatteryInfo.swapAmtOrder);
}
if (machine.SwapOrder != null)
try
{
machine.SwapOrder.SwapResult = (byte)InfoEnum.SwapOrderResult.Fail;
_swapOrderRepository.Update(machine.SwapOrder);
}
machine.CancelFlag = false;
if (machine.SwapOrderBatteryInfo!=null && machine.SwapOrderBatteryInfo.swapAmtOrder != null)
{
machine.SwapOrderBatteryInfo.swapAmtOrder.Status = (byte)InfoEnum.AmtOrderStatus.SwapFail;
_swapAmtOrderRepository.Update(machine.SwapOrderBatteryInfo.swapAmtOrder);
}
_manualOperationRecordRepository.Insert(new ManualOperationRecord()
{
Type = 2,
CreatedBy = UserManager.Account,
UpdatedBy = UserManager.Account,
Operator = machine.OperateModel.Operator,
Reason = machine.OperateModel.Reason,
});
if (machine.SwapOrder != null)
{
machine.SwapOrder.SwapResult = (byte)InfoEnum.SwapOrderResult.Fail;
_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();
machine.Reset();
}
catch (Exception e)
{
machine.Reset();
_log.Error($"CancelState err={e}");
}
return new StateResult()
{
SwappingState = SwappingState.StationReady

@ -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)
{
machine.SwapOrder.SwapResult = (byte)InfoEnum.SwapOrderResult.Success;
machine.SwapOrder.VehicleLeaveTime = DateTime.Now;
_swapOrderRepository.Update(machine.SwapOrder);
}
_manualOperationRecordRepository.Insert(new ManualOperationRecord()
_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)
{
Type = 2,
CreatedBy = UserManager.Account,
UpdatedBy = UserManager.Account,
Operator = machine.OperateModel.Operator,
Reason = machine.OperateModel.Reason,
});
machine.Reset();
machine.Reset();
_log.Error($"ManualSuccState err={e}");
}
return new StateResult()
{
SwappingState = SwappingState.StationReady

Loading…
Cancel
Save