|
|
|
@ -40,11 +40,11 @@ public class CarPrepareState : IState
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//云平台车辆认证
|
|
|
|
|
/*var cloudCheckVel = CloudCheckVel(machine);
|
|
|
|
|
var cloudCheckVel = CloudCheckVel(machine);
|
|
|
|
|
if (cloudCheckVel != InvokeStatus.Done)
|
|
|
|
|
{
|
|
|
|
|
return SwappingStateMachine.ReturnWithInvokeErr(cloudCheckVel, ExceptionReason.None);
|
|
|
|
|
}*/
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//检查tbox链接状态
|
|
|
|
|
InvokeStatus checkTBoxConnect = CheckTBoxConnectFlag(machine);
|
|
|
|
@ -62,7 +62,7 @@ public class CarPrepareState : IState
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//云端数据上报
|
|
|
|
|
// InvokeStatus cloudTBox = CloudTBoxFlag(machine);
|
|
|
|
|
// InvokeStatus cloudTBox = CloudTBoxFlag(machine);
|
|
|
|
|
/*if (cloudTBox != InvokeStatus.Done)
|
|
|
|
|
{
|
|
|
|
|
return SwappingStateMachine.ReturnWithInvokeErr(cloudTBox, ExceptionReason.None);
|
|
|
|
@ -109,16 +109,16 @@ public class CarPrepareState : IState
|
|
|
|
|
//写入口等 :红灯
|
|
|
|
|
if (PlcApi.WriteEntranceLamp(1020))
|
|
|
|
|
{
|
|
|
|
|
// machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.InfoCarInPosition.GetLed());
|
|
|
|
|
// machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.InfoCarInPosition.GetLed());
|
|
|
|
|
SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.InfoCarInPosition);
|
|
|
|
|
machine.VehiclesInPlaceFlag = true;
|
|
|
|
|
//告知云平台换电准备完成
|
|
|
|
|
machine.BusinessSwappingForCloudState =
|
|
|
|
|
InfoEnum.BusinessSwappingForCloudState.SwapReady;
|
|
|
|
|
machine.ExceptionReason = ExceptionReason.None;
|
|
|
|
|
// CloudApi.SendStateLog(machine.SwapOrder, machine.BusinessSwappingForCloudState);
|
|
|
|
|
// CloudApi.SendStateLog(machine.SwapOrder, machine.BusinessSwappingForCloudState);
|
|
|
|
|
//清除下发的指令,等待新的指令
|
|
|
|
|
// CloudApi.ClearCarCanStartInfo();
|
|
|
|
|
// CloudApi.ClearCarCanStartInfo();
|
|
|
|
|
|
|
|
|
|
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.CarInPositionFlag,
|
|
|
|
|
machine);
|
|
|
|
@ -127,7 +127,7 @@ public class CarPrepareState : IState
|
|
|
|
|
}, () =>
|
|
|
|
|
{
|
|
|
|
|
machine.ExceptionReason = ExceptionReason.CarInPositionError;
|
|
|
|
|
// machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.ErrorCarInPositionTimeout.GetLed());
|
|
|
|
|
// machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.ErrorCarInPositionTimeout.GetLed());
|
|
|
|
|
SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.ErrorCarInPositionTimeout);
|
|
|
|
|
}, false, () => { }
|
|
|
|
|
, 20, InvokeStatus.None);
|
|
|
|
@ -143,37 +143,29 @@ public class CarPrepareState : IState
|
|
|
|
|
return Invoker.Invoke("cloud check vehicle", 500, 20, machine.IsCanceled,
|
|
|
|
|
() => machine.CloudVelCheckFlag, () =>
|
|
|
|
|
{
|
|
|
|
|
if (BaseEnumExtensions.GetEnumByCode<StationConstant.StationModel>(
|
|
|
|
|
StaticStationInfo.StationModel) == StationConstant.StationModel.Remote)
|
|
|
|
|
{
|
|
|
|
|
int vehicleCheck = -1;
|
|
|
|
|
//CloudApi.VehicleCheck(machine.RfidReadModel, machine.SwapOrder);
|
|
|
|
|
|
|
|
|
|
if (vehicleCheck != 0)
|
|
|
|
|
{
|
|
|
|
|
_log.Info("cloud check vehicle error");
|
|
|
|
|
// machine.LedTool?.WriteProgramContent("换电准备中:云平台车辆验证完成");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
machine.ExceptionReason = ExceptionReason.None;
|
|
|
|
|
_log.Info("cloud check vehicle done");
|
|
|
|
|
machine.CloudVelCheckFlag = true;
|
|
|
|
|
// machine.LedTool?.WriteProgramContent("换电准备中:云平台车辆验证完成");
|
|
|
|
|
int vehicleCheck = -1;
|
|
|
|
|
vehicleCheck= CloudApi.VehicleCheck(machine.RfidReadModel, machine.SwapOrder);
|
|
|
|
|
|
|
|
|
|
//TODO::
|
|
|
|
|
// machine.SwapOrder.CloudSn=
|
|
|
|
|
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.CloudVelCheckFlag,
|
|
|
|
|
machine);
|
|
|
|
|
}
|
|
|
|
|
if (vehicleCheck != 0)
|
|
|
|
|
{
|
|
|
|
|
_log.Info("cloud check vehicle error");
|
|
|
|
|
// machine.LedTool?.WriteProgramContent("换电准备中:云平台车辆验证完成");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
machine.ExceptionReason = ExceptionReason.None;
|
|
|
|
|
_log.Info("cloud check vehicle done");
|
|
|
|
|
machine.CloudVelCheckFlag = true;
|
|
|
|
|
// machine.LedTool?.WriteProgramContent("换电准备中:云平台车辆验证完成");
|
|
|
|
|
|
|
|
|
|
//TODO::
|
|
|
|
|
// machine.SwapOrder.CloudSn=
|
|
|
|
|
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.CloudVelCheckFlag,
|
|
|
|
|
machine);
|
|
|
|
|
}
|
|
|
|
|
}, () =>
|
|
|
|
|
{
|
|
|
|
|
// machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.ErrorCloudCheck.GetLed());
|
|
|
|
|
// machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.ErrorCloudCheck.GetLed());
|
|
|
|
|
SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.ErrorCloudCheck);
|
|
|
|
|
}, false, () => { machine.ExceptionReason = ExceptionReason.CloudCheckError; }
|
|
|
|
|
, 20, InvokeStatus.None);
|
|
|
|
@ -195,12 +187,14 @@ public class CarPrepareState : IState
|
|
|
|
|
{
|
|
|
|
|
machine.BoxConnectFlag = true;
|
|
|
|
|
}
|
|
|
|
|
}, () => { machine.ExceptionReason = ExceptionReason.ConnTBoxError;
|
|
|
|
|
SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.ErrorTBoxConn);}, false, () =>
|
|
|
|
|
}, () =>
|
|
|
|
|
{
|
|
|
|
|
machine.ExceptionReason = ExceptionReason.ConnTBoxError;
|
|
|
|
|
SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.ErrorTBoxConn);
|
|
|
|
|
}, false, () =>
|
|
|
|
|
{
|
|
|
|
|
machine.ExceptionReason = ExceptionReason.ConnTBoxError;
|
|
|
|
|
// machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.ErrorTBoxConn.GetLed());
|
|
|
|
|
|
|
|
|
|
// machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.ErrorTBoxConn.GetLed());
|
|
|
|
|
}
|
|
|
|
|
, 20, InvokeStatus.None);
|
|
|
|
|
}
|
|
|
|
@ -217,8 +211,8 @@ public class CarPrepareState : IState
|
|
|
|
|
{
|
|
|
|
|
Task<TboxCarInfoModel> carInfo = TBoxApi.GetCarInfo(machine.RfidReadModel.VelVin);
|
|
|
|
|
var tBoxCarInfoModel = carInfo.Result;
|
|
|
|
|
//TODO::不知道Tbox给的CardNo是什么
|
|
|
|
|
if (tBoxCarInfoModel.CarNo!.Trim().Equals(machine.RfidReadModel!.VelNo.Trim()))
|
|
|
|
|
|
|
|
|
|
if (tBoxCarInfoModel.CarNo!.Trim().Equals(machine.RfidReadModel!.VelVin.Trim()))
|
|
|
|
|
{
|
|
|
|
|
machine.BoxLocalCheckFlag = true;
|
|
|
|
|
machine.BoxCarInfoModel = tBoxCarInfoModel;
|
|
|
|
@ -248,17 +242,14 @@ public class CarPrepareState : IState
|
|
|
|
|
if (tBoxCarInfoModel.Connected)
|
|
|
|
|
{
|
|
|
|
|
//将数据上报云平台
|
|
|
|
|
// CloudApi.UploadTBoxCarInfo(machine.SwapOrder!, machine.BoxCarInfoModel);
|
|
|
|
|
// CloudApi.UploadTBoxCarInfo(machine.SwapOrder!, machine.BoxCarInfoModel);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}, () =>
|
|
|
|
|
{
|
|
|
|
|
// machine.LedTool?.WriteProgramContent("车辆电池数据上报异常,请联系站务人员");
|
|
|
|
|
// SoundTool.PlayOneSound(InfoEnum.SwapInfo.ErrorSelectPack);
|
|
|
|
|
}, false, () =>
|
|
|
|
|
{
|
|
|
|
|
machine.ExceptionReason = ExceptionReason.CloudCarDataUploadError;
|
|
|
|
|
}
|
|
|
|
|
// machine.LedTool?.WriteProgramContent("车辆电池数据上报异常,请联系站务人员");
|
|
|
|
|
// SoundTool.PlayOneSound(InfoEnum.SwapInfo.ErrorSelectPack);
|
|
|
|
|
}, false, () => { machine.ExceptionReason = ExceptionReason.CloudCarDataUploadError; }
|
|
|
|
|
, 20, InvokeStatus.None);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -295,9 +286,9 @@ public class CarPrepareState : IState
|
|
|
|
|
|
|
|
|
|
if (orderBatteryInfo.CanSwap != InfoEnum.SelectBinStatusInfo.Success)
|
|
|
|
|
{
|
|
|
|
|
// machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.ErrorSelectPack.GetLed());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.ErrorSelectPack.GetLed());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_log.Info($"SelectPack error CanSwap={machine.SwapOrderBatteryInfo.CanSwap}");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
@ -310,9 +301,9 @@ public class CarPrepareState : IState
|
|
|
|
|
}
|
|
|
|
|
}, () =>
|
|
|
|
|
{
|
|
|
|
|
machine.ExceptionReason = ExceptionReason.SelectPackError;
|
|
|
|
|
machine.ExceptionReason = ExceptionReason.SelectPackError;
|
|
|
|
|
SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.ErrorSelectPack);
|
|
|
|
|
}
|
|
|
|
|
,false,() => { },10,InvokeStatus.None);
|
|
|
|
|
, false, () => { }, 10, InvokeStatus.None);
|
|
|
|
|
}
|
|
|
|
|
}
|