|
|
|
@ -26,7 +26,7 @@ public class SwapCanStartState : IState
|
|
|
|
|
|
|
|
|
|
public StateResult Handle(SwappingStateMachine machine)
|
|
|
|
|
{
|
|
|
|
|
/*InvokeStatus swapCanStart = SwapCanStart(machine);
|
|
|
|
|
InvokeStatus swapCanStart = SwapCanStart(machine);
|
|
|
|
|
|
|
|
|
|
if (InvokeStatus.Done != swapCanStart)
|
|
|
|
|
{
|
|
|
|
@ -36,8 +36,7 @@ public class SwapCanStartState : IState
|
|
|
|
|
return new StateResult()
|
|
|
|
|
{
|
|
|
|
|
SwappingState = SwappingState.CarCtrl
|
|
|
|
|
};*/
|
|
|
|
|
return null;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -45,8 +44,9 @@ public class SwapCanStartState : IState
|
|
|
|
|
/// 等待云平台下发换电
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
/*public InvokeStatus SwapCanStart(SwappingStateMachine machine)
|
|
|
|
|
public InvokeStatus SwapCanStart(SwappingStateMachine machine)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
return Invoker.Invoke("check swapCanStart", 1000, 50, machine.IsCanceled,
|
|
|
|
|
() => machine.CloudCarCanStartFlag, () =>
|
|
|
|
|
{
|
|
|
|
@ -55,38 +55,41 @@ public class SwapCanStartState : IState
|
|
|
|
|
BaseEnumExtensions.GetEnumByCode<StationConstant.StationModel>(
|
|
|
|
|
StaticStationInfo.StationModel))
|
|
|
|
|
{
|
|
|
|
|
CarCanStart carCanStart = CloudApi.CarCanStart();
|
|
|
|
|
if (carCanStart != null)
|
|
|
|
|
// CloudApi.UploadCloudReady(machine.plateNumber);
|
|
|
|
|
if (machine.swapStart != null)
|
|
|
|
|
{
|
|
|
|
|
//车牌号
|
|
|
|
|
if (carCanStart.cn.Equals(machine.BoxCarInfoModel.CarNo))
|
|
|
|
|
if (machine.swapStart.command == "start")
|
|
|
|
|
{
|
|
|
|
|
_log.Info("SwapCanStart start");
|
|
|
|
|
//更新换电订单
|
|
|
|
|
machine.SwapOrder.CloudSn = machine.swapStart.orderId;
|
|
|
|
|
//machine.SwapOrder.CloudSn = "1764482218541527041";
|
|
|
|
|
machine.CloudCarCanStartFlag = true;
|
|
|
|
|
}
|
|
|
|
|
// 其他非启动换电状态处理
|
|
|
|
|
else if (machine.swapStart.command == "stop"|| machine.swapStart.command == "reset")
|
|
|
|
|
{
|
|
|
|
|
_log.Info("SwapCanStart stop");
|
|
|
|
|
//语音提示云平台取消换电
|
|
|
|
|
StationSoftMgr.SwappingStateMachineCancel();
|
|
|
|
|
machine.CloudCarCanStartFlag = false;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else if (machine.swapStart.command == "suspend")
|
|
|
|
|
{
|
|
|
|
|
//可以开始换电
|
|
|
|
|
if (carCanStart.cs == 1)
|
|
|
|
|
{
|
|
|
|
|
_log.Info("SwapCanStart ok");
|
|
|
|
|
//更新换电订单
|
|
|
|
|
machine.SwapOrder.CloudSn = carCanStart.on;
|
|
|
|
|
_swapOrderRepository.Update(machine.SwapOrder.CloudSn);
|
|
|
|
|
machine.CloudCarCanStartFlag = true;
|
|
|
|
|
|
|
|
|
|
_swapOrderStepService.InsertSwapStepForSwapMain(InfoEnum.BusinessSwappingStep.CloudCarCanStartFlag,
|
|
|
|
|
machine.StepSort++, machine.SwapOrder.Sn);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
_log.Info("SwapCanStart cancel");
|
|
|
|
|
//语音提示云平台取消换电
|
|
|
|
|
machine.CloudCarCanStartFlag = false;
|
|
|
|
|
// machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.CloudSendSwapCancel.GetLed());
|
|
|
|
|
SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.CloudSendSwapError);
|
|
|
|
|
machine.BusinessSwappingForCloudState =
|
|
|
|
|
InfoEnum.BusinessSwappingForCloudState.SwapReady;
|
|
|
|
|
// CloudApi.SendStateLog(machine.SwapOrder,
|
|
|
|
|
// machine.BusinessSwappingForCloudState);
|
|
|
|
|
}
|
|
|
|
|
_log.Info("SwapCanStart suspend");
|
|
|
|
|
machine.CloudCarCanStartFlag = false;
|
|
|
|
|
//语音提示云平台暂停换电
|
|
|
|
|
}
|
|
|
|
|
else if (machine.swapStart.command == "continue")
|
|
|
|
|
{
|
|
|
|
|
_log.Info("SwapCanStart continue");
|
|
|
|
|
machine.CloudCarCanStartFlag = true;
|
|
|
|
|
//语音提示云平台继续换电
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
@ -97,9 +100,8 @@ public class SwapCanStartState : IState
|
|
|
|
|
}, () =>
|
|
|
|
|
{
|
|
|
|
|
machine.ExceptionReason = ExceptionReason.CloudSendSwapError;
|
|
|
|
|
// machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.CloudSendSwapError.GetLed());
|
|
|
|
|
SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.CloudSendSwapError);
|
|
|
|
|
}, false, () => { }
|
|
|
|
|
, 10, InvokeStatus.None);
|
|
|
|
|
}*/
|
|
|
|
|
}
|
|
|
|
|
}
|