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