|
|
|
@ -33,11 +33,72 @@ public class DoSwappingState : IState
|
|
|
|
|
public StateResult Handle(SwappingStateMachine machine)
|
|
|
|
|
{
|
|
|
|
|
//上报云平台换电开始
|
|
|
|
|
// machine.BusinessSwappingForCloudState = InfoEnum.BusinessSwappingForCloudState.BeginSwap;
|
|
|
|
|
// machine.BusinessSwappingStateUpdateTime = DateTime.Now;
|
|
|
|
|
// _log.Info($"BusinessSwappingForCloudState={machine.BusinessSwappingForCloudState}");
|
|
|
|
|
// machine.BusinessSwappingForCloudState = InfoEnum.BusinessSwappingForCloudState.BeginSwap;
|
|
|
|
|
// machine.BusinessSwappingStateUpdateTime = DateTime.Now;
|
|
|
|
|
// _log.Info($"BusinessSwappingForCloudState={machine.BusinessSwappingForCloudState}");
|
|
|
|
|
// CloudApi.SendStateLog(machine.SwapOrder, InfoEnum.BusinessSwappingForCloudState.BeginSwap);
|
|
|
|
|
|
|
|
|
|
//while (true)
|
|
|
|
|
//{
|
|
|
|
|
// _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.Idel,
|
|
|
|
|
// machine);
|
|
|
|
|
// Thread.Sleep(1000);
|
|
|
|
|
// //_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.VelLockFlag,
|
|
|
|
|
// //machine);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.RadarInFlag,
|
|
|
|
|
// machine);
|
|
|
|
|
// Thread.Sleep(1000);
|
|
|
|
|
// _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.RfidReadFlag,
|
|
|
|
|
// machine);
|
|
|
|
|
// Thread.Sleep(1000);
|
|
|
|
|
// _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.CloudVelCheckFlag,
|
|
|
|
|
// machine);
|
|
|
|
|
// Thread.Sleep(1000);
|
|
|
|
|
// _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.CarInPositionFlag,
|
|
|
|
|
// machine);
|
|
|
|
|
// Thread.Sleep(1000);
|
|
|
|
|
// _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.CloudCarCanStartFlag,
|
|
|
|
|
// machine);
|
|
|
|
|
// Thread.Sleep(1000);
|
|
|
|
|
|
|
|
|
|
// _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.VelUnlockFlag,
|
|
|
|
|
// machine);
|
|
|
|
|
// Thread.Sleep(1000);
|
|
|
|
|
|
|
|
|
|
// _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.DistributeSelectPackFlag,
|
|
|
|
|
// machine);
|
|
|
|
|
// Thread.Sleep(1000);
|
|
|
|
|
// _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.StartSwappingFlag,
|
|
|
|
|
// machine);
|
|
|
|
|
// Thread.Sleep(1000);
|
|
|
|
|
// _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.UnOldBatteryFlag,
|
|
|
|
|
// machine);
|
|
|
|
|
// Thread.Sleep(1000);
|
|
|
|
|
// _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.StorageOldBatteryFlag,
|
|
|
|
|
// machine);
|
|
|
|
|
// Thread.Sleep(1000);
|
|
|
|
|
// _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.OutNewBatteryFlag,
|
|
|
|
|
// machine);
|
|
|
|
|
// Thread.Sleep(1000);
|
|
|
|
|
// _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.InstallNewBatteryFlag,
|
|
|
|
|
// machine);
|
|
|
|
|
// Thread.Sleep(1000);
|
|
|
|
|
// _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.FinishNewBatteryFlag,
|
|
|
|
|
// machine);
|
|
|
|
|
// Thread.Sleep(1000);
|
|
|
|
|
// _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.VelLockFlag,
|
|
|
|
|
// machine);
|
|
|
|
|
// Thread.Sleep(1000);
|
|
|
|
|
// //_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.RadarOutFlag,
|
|
|
|
|
// // machine);
|
|
|
|
|
// Thread.Sleep(10000);
|
|
|
|
|
|
|
|
|
|
// machine.Reset();
|
|
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -86,12 +147,13 @@ public class DoSwappingState : IState
|
|
|
|
|
return SwappingStateMachine.ReturnWithInvokeErr(beginRadar, ExceptionReason.None);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 车辆离开
|
|
|
|
|
//var adjustCarByRadar = AdjustCarByRadar(machine);
|
|
|
|
|
//if (InvokeStatus.Done != adjustCarByRadar)
|
|
|
|
|
//{
|
|
|
|
|
// return SwappingStateMachine.ReturnWithInvokeErr(adjustCarByRadar, ExceptionReason.None);
|
|
|
|
|
//}
|
|
|
|
|
//车辆离开
|
|
|
|
|
var adjustCarByRadar = AdjustCarByRadar(machine);
|
|
|
|
|
machine.Reset();
|
|
|
|
|
if (InvokeStatus.Done != adjustCarByRadar)
|
|
|
|
|
{
|
|
|
|
|
return SwappingStateMachine.ReturnWithInvokeErr(adjustCarByRadar, ExceptionReason.None);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -187,6 +249,10 @@ public class DoSwappingState : IState
|
|
|
|
|
machine.SwapOrderBatteryInfo.UpBinInfo.No);
|
|
|
|
|
if (c==0)
|
|
|
|
|
{
|
|
|
|
|
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.StartSwappingFlag,
|
|
|
|
|
machine);
|
|
|
|
|
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.DistributeSelectPackFlag,
|
|
|
|
|
machine);
|
|
|
|
|
SoundClient = AppInfo.Container.Resolve<SoundClient>();
|
|
|
|
|
SoundClient.SoundPlay(SoundEnum.music91);
|
|
|
|
|
Thread.Sleep(3000);
|
|
|
|
@ -200,8 +266,7 @@ public class DoSwappingState : IState
|
|
|
|
|
_CommonMgr.UpdateSwapOrder(machine);
|
|
|
|
|
machine.SwapStatus = 0;
|
|
|
|
|
machine.StartSwappingFlag = true;
|
|
|
|
|
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.StartSwappingFlag,
|
|
|
|
|
machine);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -279,7 +344,9 @@ public class DoSwappingState : IState
|
|
|
|
|
|
|
|
|
|
if (machine.InstallNewBatteryFlag)
|
|
|
|
|
{
|
|
|
|
|
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.InstallNewBatteryFlag,
|
|
|
|
|
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.UnOldBatteryFlag,
|
|
|
|
|
machine);
|
|
|
|
|
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.StorageOldBatteryFlag,
|
|
|
|
|
machine);
|
|
|
|
|
}
|
|
|
|
|
}, () =>
|
|
|
|
@ -316,14 +383,19 @@ public class DoSwappingState : IState
|
|
|
|
|
SoundClient = AppInfo.Container.Resolve<SoundClient>();
|
|
|
|
|
if (b==0)
|
|
|
|
|
{
|
|
|
|
|
SoundClient.SoundPlay(SoundEnum.music77);
|
|
|
|
|
// SoundClient.SoundPlay(SoundEnum.music77);
|
|
|
|
|
|
|
|
|
|
LedClient.SendMsgByKey(InfoEnum.SwapInfo.InfoPackFinish.GetLed());
|
|
|
|
|
b = 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.FinishNewBatteryFlag,
|
|
|
|
|
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.OutNewBatteryFlag,
|
|
|
|
|
machine);
|
|
|
|
|
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.InstallNewBatteryFlag,
|
|
|
|
|
machine);
|
|
|
|
|
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.FinishNewBatteryFlag,
|
|
|
|
|
machine);
|
|
|
|
|
//SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.InfoToSafePosition);
|
|
|
|
|
machine.ToSafePositionFlag = true;
|
|
|
|
|
machine.BusinessSwappingStateUpdateTime = DateTime.Now;
|
|
|
|
@ -369,9 +441,16 @@ public class DoSwappingState : IState
|
|
|
|
|
//SoundClient.SoundPlay(AppSettingsHelper.GetContent("SoundAddr", "Address19"));
|
|
|
|
|
if (v == 0)
|
|
|
|
|
{
|
|
|
|
|
SoundClient.SoundPlay(SoundEnum.music76);
|
|
|
|
|
Thread.Sleep(3000);
|
|
|
|
|
|
|
|
|
|
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.VelLockFlag,
|
|
|
|
|
machine);
|
|
|
|
|
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.RadarOutFlag,
|
|
|
|
|
machine);
|
|
|
|
|
|
|
|
|
|
SoundClient.SoundPlay(SoundEnum.music77);
|
|
|
|
|
Thread.Sleep(3000);
|
|
|
|
|
SoundClient.SoundPlay(SoundEnum.music76);
|
|
|
|
|
|
|
|
|
|
v = 1;
|
|
|
|
|
}
|
|
|
|
|
//断连Tbox
|
|
|
|
@ -380,9 +459,7 @@ public class DoSwappingState : IState
|
|
|
|
|
TBoxApi.DisConnect(machine.BoxCarInfoModel.CarNo);
|
|
|
|
|
}
|
|
|
|
|
//新增小步
|
|
|
|
|
|
|
|
|
|
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.VelLockFlag,
|
|
|
|
|
machine);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}, () =>
|
|
|
|
|