能辉后背主流程修改完成

master
lxw 5 months ago
parent 7a55e5268e
commit 78215001c0

@ -26,15 +26,15 @@ public class InfoEnum
[Info("通道拍照定位失败,请在三分钟内重新调整车辆位置", "通道拍照定位失败,请在三分钟内重新调整车辆位置")]ErrChannelStatus,
[Info("电池拆卸中,请稍后", "电池拆卸中,请稍后")] InfoUnPack ,
[Info("亏电电池拆卸中,请稍候", "亏电电池拆卸中,请稍候")] InfoUnPack ,
[Info("电池安装中,请稍后", "电池安装中,请稍后")] InfoPack ,
[Info("满电电池安装中,请稍候", "满电电池安装中,请稍候")] InfoPack ,
[Info("电池包已安装完成", "电池包已安装完成")] InfoPackFinish ,
[Info("航车已回归安全位置", "航车已回归安全位置")] InfoToSafePosition ,
[Info("换电已完成,请驶离", "换电已完成,请驶离")] InfoCarLeave ,
[Info("换电完成,请将车辆驶出换电站", "换电完成,请将车辆驶出换电站")] InfoCarLeave ,
[Info("换电失败,请驶离", "换电失败,请驶离")] ErrInfoCarLeave ,
[Info("电池入仓中,请稍后", "电池入仓中,请稍后")] InfoOldBatteryCarryIn ,
[Info("电池出仓中,请稍后", "电池出仓中,请稍后")] InfoNewBatteryCarryOut ,
[Info("亏电池搬运中,请稍候", "亏电池搬运中,请稍候")] InfoOldBatteryCarryIn ,
[Info("满电电池搬运中,请稍候", "满电电池搬运中,请稍候")] InfoNewBatteryCarryOut ,
[Info("车辆上锁失败", "车辆上锁失败")] ErrLockCar ,
[Info("通道的电池仓无可用换电电池","通道的电池仓无可用换电电池")] NoBatteryErr,
[Info("结束充电电池数量不足","通道的电池仓无可用换电电池")] LessOfFinishChargingErr,
@ -45,7 +45,7 @@ public class InfoEnum
[Info("换电站处于本地模式,不能远程换电","换电站处于本地模式,不能远程换电")] InfoStationModelRemoteErr,
[Info("车辆驶入","车辆驶入")] CarInInfo,
[Info("请将车辆行驶到指定位置,并拉起手刹","请将车辆行驶到指定位置,并拉起手刹")] CarInInfo,
[Info("换电任务启动","换电任务启动")] StartSwapInfo,
[Info("航车拍照中,请稍后","航车拍照中,请稍后")] CarTakePhotoInfo,
[Info("启动换电失败,请联系站务人员","启动换电失败,请联系站务人员")] ErrStartSwap,
@ -53,6 +53,14 @@ public class InfoEnum
[Info("电池移仓中","电池移仓中")] InfoBatteryMove,
[Info("消防移仓中","消防移仓中")] InfoFireRemove,
[Info("拍照失败,请在三分钟内挪车","拍照失败,请在三分钟内挪车")] ErrChannel1020,
[Info("车辆识别","车辆识别")] BeginReadRfid,
[Info("下发启动换电到车载设备超时", "下发启动换电到车载设备超时")] ErrStartSwapToTBox ,
[Info("请将货箱放下", "请将货箱放下")] InfoTboxDown ,
[Info("请将车辆下电", "请将车辆下电")] InfoTboxEnergyDown ,
[Info("请将货箱抬起", "请将货箱抬起")] InfoTboxHandUp ,
[Info("请将车辆上电", "请将车辆上电")] InfoTboxEnergyUp ,
[Info("通道定位失败,车辆出站请重新进站","通道定位失败,车辆出站请重新进站")] CarTakePhotoErrRepeat,
[Info("请操作换电启动按钮","请操作换电启动按钮")] InfoManualStartSwap
}
@ -106,6 +114,7 @@ public class InfoEnum
[Const("云平台车辆认证")] CloudVelCheckFlag,
[Const("车辆到位")] CarInPositionFlag,
[Const("云平台下发换电指令")] CloudCarCanStartFlag,
[Const("换电就绪")] TBoxSwapReadyFlag,
[Const("车辆解锁")] VelUnlockFlag,
[Const("下发plc选包")] DistributeSelectPackFlag,

@ -85,6 +85,34 @@ public class TBoxApi
}
/// <summary>
/// 下发开始换电指令到tbox
/// </summary>
/// <returns></returns>
public static async Task<byte> StartSwap(string carNo)
{
Log.Info($" TBoxApi start StartSwap carNo={carNo} ");
string url = BASE_URL + "/startSwap/" + carNo;
try
{
string s = await _httpClient.GetStringAsync(url);
Log.Info($"StartSwap resp = {s}");
if (string.IsNullOrWhiteSpace(s))
{
return 0;
}
return byte.Parse(s);
}
catch (Exception e)
{
Log.Error($"StartSwap e = {e}");
return 0;
}
}
public static async Task<bool> UnLockCarManyTimes(string carNo)
{
Log.Info($" TBoxApi start UnLockCarManyTimes carNo={carNo} ");
@ -149,7 +177,7 @@ public class TBoxApi
return false;
}
}
/// <summary>
/// Tbox连接
/// /Car/unLock/
@ -172,7 +200,7 @@ public class TBoxApi
return false;
}
}
/// <summary>
/// Tbox断连
/// /Car/unLock/
@ -231,7 +259,7 @@ public class TBoxApi
public static async Task<bool> LockCar(string carNo)
{
Log.Info("LockCar");
string url = BASE_URL +StaticStationInfo.TboxUrlLock + carNo;
string url = BASE_URL + StaticStationInfo.TboxUrlLock + carNo;
try
{
string s = await _httpClient.GetStringAsync(url);

@ -1,3 +1,5 @@
using Service.Car.Msg.Car.Req;
namespace Service.Execute.Model.Tbox;
/// <summary>
@ -24,4 +26,11 @@ public class TboxCarInfoModel
/// 车辆状态信息
/// </summary>
public CarStatus? CarStatus { get; set; }
/// <summary>
/// 温度故障数据
/// </summary>
/// <returns></returns>
public TemperatureDetectionMsg? TemperatureDetectionMsg { get; set; }
}

@ -0,0 +1,198 @@
using HybirdFrameworkCore.Autofac.Attribute;
namespace Service.Car.Msg.Car.Req;
/// <summary>
/// 温度监测信息
/// </summary>
public class TemperatureDetectionMsg
{
/// <summary>
/// 故障等级
/// /// 0无故障
/// 1:1 级故障
/// 2:2 级故障
/// 3:3 级故障
/// </summary>
[Property(248, 8)]
public byte FaultLevel { get; set; }
/// <summary>
/// 换电系统故障码
/// 0换电连接器未过温
///1换电连接器温度检测 1 过温一级故障
/// 注:暂不定义一级故障
///2换电连接器温度检测 2 过温一级故障
/// 注:暂不定义一级故障
///3换电连接器温度检测 3 过温一级故障
/// 注:暂不定义一级故障
///4换电连接器温度检测 4 过温一级故障
/// 注:暂不定义一级故障
///5换电连接器温度检测 5 过温一级故障
/// 注:暂不定义一级故障
///6换电连接器温度检测 6 过温一级故障
/// 注:暂不定义一级故障
///7换电连接器温度检测 7 过温一级故障
/// 注:暂不定义一级故障
///8换电连接器温度检测 8 过温一级故障
/// 注:暂不定义一级故障
///9换电连接器温度检测 1 过温二级故障
/// 判定条件Tmax90℃,持续 3s
///解
/// 除条件Tmax80℃, 持续 3s
///10换电连接器温度检测 2 过温二级故障
/// 判定条件Tmax90℃,持续 3s
///解除条件Tmax80℃, 持续 3s
///11换电连接器温度检测 3 过温二级故障
/// 判定条件Tmax90℃,持续 3s
///解除条件Tmax80℃, 持续 3s
///12换电连接器温度检测 4 过温二级故障
/// 判定条件Tmax90℃,持续 3s
///解除条件Tmax80℃, 持续 3s
///13换电连接器温度检测 5 过温二级故障
/// 判定条件Tmax90℃,持续 3s
///解除条件Tmax80℃, 持续 3s
///14换电连接器温度检测 6 过温二级故障
/// 判定条件Tmax90℃,持续 3s
///解除条件Tmax80℃, 持续 3s
///15换电连接器温度检测 7 过温二级故障
/// 判定条件Tmax90℃,持续 3s
///解除条件Tmax80℃, 持续 3s
///16换电连接器温度检测 8 过温二级故障
/// 判定条件Tmax90℃,持续 3s
/// 0换电连接器未过温
/// 1换电连接器温度检测 1 过温一级故障
/// 注:暂不定义一级故障
/// 2换电连接器温度检测 2 过温一级故障
/// 注:暂不定义一级故障
/// 3换电连接器温度检测 3 过温一级故障
/// 注:暂不定义一级故障
/// 4换电连接器温度检测 4 过温一级故障
/// 注:暂不定义一级故障
/// 5换电连接器温度检测 5 过温一级故障
/// 注:暂不定义一级故障
/// 6换电连接器温度检测 6 过温一级故障
/// 注:暂不定义一级故障
/// 7换电连接器温度检测 7 过温一级故障
/// 注:暂不定义一级故障
/// 8换电连接器温度检测 8 过温一级故障
/// 注:暂不定义一级故障
/// 9换电连接器温度检测 1 过温二级故障
/// 判定条件Tmax90℃,持续 3s
/// 解
/// 除条件Tmax80℃, 持续 3s
/// 10换电连接器温度检测 2 过温二级故障
/// 判定条件Tmax90℃,持续 3s
/// 解除条件Tmax80℃, 持续 3s
/// 11换电连接器温度检测 3 过温二级故障
/// 判定条件Tmax90℃,持续 3s
/// 解除条件Tmax80℃, 持续 3s
/// 12换电连接器温度检测 4 过温二级故障
/// 判定条件Tmax90℃,持续 3s
/// 解除条件Tmax80℃, 持续 3s
/// 13换电连接器温度检测 5 过温二级故障
/// 判定条件Tmax90℃,持续 3s
/// 解除条件Tmax80℃, 持续 3s
/// 14换电连接器温度检测 6 过温二级故障
/// 判定条件Tmax90℃,持续 3s
/// 解除条件Tmax80℃, 持续 3s
/// 15换电连接器温度检测 7 过温二级故障
/// 判定条件Tmax90℃,持续 3s
/// 解除条件Tmax80℃, 持续 3s
/// 16换电连接器温度检测 8 过温二级故障
/// 判定条件Tmax90℃,持续 3s
/// 解除条件Tmax80℃, 持续 3s
/// 17换电连接器温度检测 1 过温三级故障
/// 判定条件Tmax100℃,持续 3s
/// 解除条件:需重新上电且 Tmax70℃, 持续
/// 3s
/// 18换电连接器温度检测 2 过温三级故障
/// 判定条件Tmax100℃,持续 3s
/// 解除条件:需重新上电且 Tmax70℃, 持续
/// 3s
/// 19换电连接器温度检测 3 过温三级故障
/// 判定条件Tmax100℃,持续 3s
/// 解除条件:需重新上电且 Tmax70℃, 持续
/// 3s
/// 20换电连接器温度检测 4 过温三级故障
/// 判定条件Tmax100℃,持续 3s
/// 解除条件:需重新上电且 Tmax70℃, 持续
/// 3s
/// 21换电连接器温度检测 5 过温三级故障
/// 判定条件Tmax100℃,持续 3s
/// 解除条件:需重新上电且 Tmax70℃, 持续
/// 3s
/// 22换电连接器温度检测 6 过温三级故障
/// 判定条件Tmax100℃,持续 3s
/// 解除条件:需重新上电且 Tmax70℃, 持续
/// 3s
/// 23换电连接器温度检测 7 过温三级故障
/// 判定条件Tmax100℃,持续 3s
/// 解除条件:需重新上电且 Tmax70℃, 持续
/// 3s
/// 24换电连接器温度检测 8 过温三级故障
/// 判定条件Tmax100℃,持续 3s
/// 解除条件:需重新上电且 Tmax70℃, 持续
/// 3s
/// 25换电连接器温度检测传感器 1 开路二级
/// 故障
/// 26换电连接器温度检测传感器 2 开路二级
/// 故障
/// 27换电连接器温度检测传感器 3 开路二级
/// 故障
/// 28换电连接器温度检测传感器 4 开路二级
/// 故障
/// 29换电连接器温度检测传感器 5 开路二级
/// 故障
/// 30换电连接器温度检测传感器 6 开路二级
/// 故障
/// 31换电连接器温度检测传感器 7 开路二级
/// 故障
/// 32换电连接器温度检测传感器 8 开路二级
/// 故障
/// </summary>
[Property(248+8, 8)]
public byte FaultCode { get; set; }
/// <summary>
/// 换电连接器温度检测 1放电 1正 有效值-40~210单位℃
/// </summary>
[Property(248+2*8, 8)]
public double ConnectorTemp1 { get; set; }
/// <summary>
/// 换电连接器温度检 测 2放电 1负 有效值-40~210单位℃
/// </summary>
[Property(248+3*8, 8)]
public double ConnectorTemp2 { get; set; }
/// <summary>
/// 换电连接器温度检测3放电2 正) 有效值-40~210单位℃
/// </summary>
[Property(248+4*8, 8)]
public double ConnectorTemp3 { get; set; }
/// <summary>
/// 换电连接器温度检测 4放电 2负 有效值-40~210单位℃
/// </summary>
[Property(248+5*8, 8)]
public double ConnectorTemp4 { get; set; }
/// <summary>
/// 换电连接器温度检测 5充电 1正有效值-40~210单位℃
/// </summary>
[Property(248+6*8, 8)]
public double ConnectorTemp5 { get; set; }
/// <summary>
/// 换电连接器温度检测 6充电 1负 有效值-40~210单位℃
/// </summary>
[Property(248+7*8, 8)]
public double ConnectorTemp6 { get; set; }
/// <summary>
/// 换电连接器温度检测 7充电 2正 有效值-40~210单位℃
/// </summary>
[Property(248+8*8, 8)]
public double ConnectorTemp7 { get; set; }
/// <summary>
///换电连接器温度检测 8充电 2负 有效值-40~210单位℃
/// </summary>
[Property(248+9*8, 8)]
public double ConnectorTemp8 { get; set; }
}

@ -20,6 +20,13 @@ public class CarCtrlState : IState
public StateResult Handle(SwappingStateMachine machine)
{
//拍照定位
//查看通道状态
StateResult checkChannelStatus = CheckChannelStatus(machine);
if (checkChannelStatus != null)
{
return checkChannelStatus;
}
//解锁车辆
@ -29,14 +36,40 @@ public class CarCtrlState : IState
return SwappingStateMachine.ReturnWithInvokeErr(unLockCar, ExceptionReason.None);
}
//下发选包
/*InvokeStatus distributeSelectPack = DistributeSelectPack(machine);
//站控下发换电启动命令到VCU和TBOX //vcu反馈换电就绪
InvokeStatus startSwapToTBox = StartSwapToTBox(machine);
if (startSwapToTBox != InvokeStatus.Done)
{
return SwappingStateMachine.ReturnWithInvokeErr(startSwapToTBox, ExceptionReason.None);
}
//TBOX收到抬起到位信号
InvokeStatus tBoxHandUp = TBoxHandUp(machine);
if (tBoxHandUp != InvokeStatus.Done)
{
return SwappingStateMachine.ReturnWithInvokeErr(tBoxHandUp, ExceptionReason.None);
}
//TBOX收到车辆下电OK信号
InvokeStatus tBoxEnergyDown = TBoxEnergyDown(machine);
if (tBoxEnergyDown != InvokeStatus.Done)
{
return SwappingStateMachine.ReturnWithInvokeErr(tBoxEnergyDown, ExceptionReason.None);
}
//请操作换电启动按钮
SoundApi.PlayOneSound((int) InfoEnum.SwapInfo.InfoManualStartSwap);
Thread.Sleep(2000);
/*//下发选包
InvokeStatus distributeSelectPack = DistributeSelectPack(machine);
if (distributeSelectPack != InvokeStatus.Done)
{
return SwappingStateMachine.ReturnWithInvokeErr(distributeSelectPack, ExceptionReason.None);
}
*/
}*/
return new StateResult()
{
@ -54,7 +87,7 @@ public class CarCtrlState : IState
() => machine.VelUnlockFlag, () =>
{
Task<bool> result = TBoxApi.UnLockCarManyTimes(machine.RfidReadModel.VelVin);
bool unLock = result.Result;
if (unLock)
{
@ -72,12 +105,97 @@ public class CarCtrlState : IState
}
}, () =>
{
// machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.ErrUnLockCar.GetLed());
// machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.ErrUnLockCar.GetLed());
SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.ErrUnLockCar);
}, false, () => { machine.ExceptionReason = ExceptionReason.UnLockCarError; }
, 10, InvokeStatus.None);
}
/// <summary>
///收到抬起到位信号
/// </summary>
/// <returns></returns>
public InvokeStatus StartSwapToTBox(SwappingStateMachine machine)
{
return Invoker.Invoke("StartSwapToTBox", 500, 10, machine.IsCanceled,
() => machine.TboxHandUpFlag, () =>
{
Task<byte> result = TBoxApi.StartSwap(machine.RfidReadModel.VelVin);
byte res = result.Result;
//换电就绪
if (res == 1)
{
//查询车辆锁止状态
machine.TboxHandUpFlag = true;
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.TBoxSwapReadyFlag,
machine);
}
}, () =>
{
// machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.ErrUnLockCar.GetLed());
SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.ErrStartSwapToTBox);
}, false, () => { machine.ExceptionReason = ExceptionReason.StartSwapToTBoxError; }
, 10, InvokeStatus.None);
}
/// <summary>
///收到抬起到位信号
/// </summary>
/// <returns></returns>
public InvokeStatus TBoxHandUp(SwappingStateMachine machine)
{
return Invoker.Invoke("TBoxHandUp", 500, 5, machine.IsCanceled,
() => machine.TboxHandUpFlag, () =>
{
Task<byte> result = TBoxApi.StartSwap(machine.RfidReadModel.VelVin);
byte res = result.Result;
//换电就绪
if (res == 2)
{
//查询车辆锁止状态
machine.TboxHandUpFlag = true;
// _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.TBoxSwapReadyFlag,
// machine);
}
}, () =>
{
// machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.ErrUnLockCar.GetLed());
SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.InfoTboxHandUp);
}, false, () => { }
, 10, InvokeStatus.None);
}
/// <summary>
///收到下电成功
/// </summary>
/// <returns></returns>
public InvokeStatus TBoxEnergyDown(SwappingStateMachine machine)
{
return Invoker.Invoke("TBoxEnergyDown", 500, 5, machine.IsCanceled,
() => machine.TboxEnergyDownFlag, () =>
{
Task<byte> result = TBoxApi.StartSwap(machine.RfidReadModel.VelVin);
byte res = result.Result;
//换电就绪
if (res == 3)
{
//查询车辆锁止状态
machine.TboxEnergyDownFlag = true;
// _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.TBoxSwapReadyFlag,
// machine);
}
}, () =>
{
// machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.ErrUnLockCar.GetLed());
SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.InfoTboxEnergyDown);
}, false, () => { }
, 10, InvokeStatus.None);
}
/// <summary>
/// 下发选包
@ -99,8 +217,60 @@ public class CarCtrlState : IState
}
}, () =>
{
// machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.ErrDistributeSelectPack.GetLed());
// machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.ErrDistributeSelectPack.GetLed());
});
}
/// <summary>
/// 查看通道状态
/// :0无效值
/// 1000;拍照OK
///1010;拍照NG
///1020;拍照超限,请移车
/// </summary>
/// <returns></returns>
public StateResult CheckChannelStatus(SwappingStateMachine machine)
{
int count = 0;
while (!machine.ChannelStatusOkFlag)
{
if (machine.CancelFlag)
{
_log.Info($" CheckChannelStatus canceled");
return StateResult.Cancel;
}
_log.Info("begin plc CheckChannelStatus");
Thread.Sleep(2000);
var channelStatus = PlcApi.ChannelStatus();
if (count % 10 == 0)
{
SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.CarTakePhotoInfo);
}
count++;
if (channelStatus == 1000)
{
machine.ChannelStatusOkFlag = true;
return null;
}
else
{
SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.CarTakePhotoErrRepeat);
//故障 不能继续换电,提示驶离,上报云平台,修改换电订单
machine.SwapStatus = (int)InfoEnum.SwapOrderResult.Fail;
machine.SwapFailReason = "拍照故障 plc故障码1010";
//跳转到SwappDone
return new StateResult()
{
SwappingState = SwappingState.SwapDone
};
}
}
return null;
}
}

@ -50,13 +50,7 @@ public class DoSwappingState : IState
return SwappingStateMachine.ReturnWithInvokeErr(holdOn, ExceptionReason.None);
}
//查看通道状态
StateResult checkChannelStatus = CheckChannelStatus(machine);
if (checkChannelStatus != null)
{
return checkChannelStatus;
}
//旧电池拆卸
InvokeStatus unPack = UnPack(machine);
@ -331,77 +325,7 @@ public class DoSwappingState : IState
}
/// <summary>
/// 查看通道状态
/// :0无效值
/// 1000;拍照OK
///1010;拍照NG
///1020;拍照超限,请移车
/// </summary>
/// <returns></returns>
public StateResult CheckChannelStatus(SwappingStateMachine machine)
{
int count = 0;
while (!machine.ChannelStatusOkFlag)
{
if (machine.CancelFlag)
{
_log.Info($" CheckChannelStatus canceled");
return StateResult.Cancel;
}
_log.Info("begin plc CheckChannelStatus");
Thread.Sleep(2000);
var channelStatus = PlcApi.ChannelStatus();
if (count % 10 == 0)
{
SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.CarTakePhotoInfo);
}
count++;
if (channelStatus == 1000)
{
machine.ChannelStatusOkFlag = true;
return null;
}
else if (channelStatus == 1020)
{
//需要移车 先解锁 提示移动车辆,等待3分钟
var lockCar = TBoxApi.LockCarManyTimes(machine.RfidReadModel.VelVin);
if (lockCar.Result)
{
// machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.ErrChannelStatus.GetLed());
SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.ErrChannelStatus);
//等待2分钟
Thread.Sleep(3*60 *1000);
machine.VehiclesInPlace2Flag = false;
machine.StartSwappingFlag = false;
machine.PlcHoldFlag = false;
machine.ChannelStatusOkFlag = false;
//回归到本阶段的读锁止状态
return new StateResult()
{
SwappingState = SwappingState.DoSwapping
};
}
}
else if (channelStatus == 1010)
{
//故障 不能继续换电,提示驶离,上报云平台,修改换电订单
machine.SwapStatus = (int)InfoEnum.SwapOrderResult.Fail;
machine.SwapFailReason = "拍照故障 plc故障码1010";
//跳转到SwappDone
return new StateResult()
{
SwappingState = SwappingState.SwapDone
};
}
}
return null;
}
/// <summary>

@ -62,7 +62,8 @@ public class StationReadyState : IState
{
return SwappingStateMachine.ReturnWithInvokeErr(entranceRadar, ExceptionReason.None);
}
//语音播报车辆识别
SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.BeginReadRfid);
//开始读rifd
var beginRfid = BeginRead(machine);

@ -63,6 +63,7 @@ public class SwapDoneState : IState
machine.BusinessSwappingForCloudState = InfoEnum.BusinessSwappingForCloudState.SwapDoneWithVel;
// CloudApi.SendStateLog(machine.SwapOrder, machine.BusinessSwappingForCloudState);
}
//TODO::缺少车辆自检
//云平台没有匹配的失败状态
//车辆上锁 ,提示请驶离
@ -73,6 +74,21 @@ public class SwapDoneState : IState
return SwappingStateMachine.ReturnWithInvokeErr(lockCar, ExceptionReason.None);
}
//TBOX收到车辆上电OK信号
InvokeStatus tBoxEnergyUp = TBoxEnergyUp(machine);
if (tBoxEnergyUp != InvokeStatus.Done)
{
return SwappingStateMachine.ReturnWithInvokeErr(tBoxEnergyUp, ExceptionReason.None);
}
//TBOX收到货箱放下
InvokeStatus tBoxDown = TBoxDown(machine);
if (tBoxDown != InvokeStatus.Done)
{
return SwappingStateMachine.ReturnWithInvokeErr(tBoxDown, ExceptionReason.None);
}
//出口雷达监测
InvokeStatus existRadar = ExistRadar(machine);
if (existRadar != InvokeStatus.Done)
@ -107,26 +123,9 @@ public class SwapDoneState : IState
{
machine.ManualConfirmCarLockFlag = false;
machine.BoxCarInfoModel = carInfo.Result;
//设置出口的是绿灯
if (PlcApi.WriteExistLamp(1000))
{
/*machine.LedTool?.WriteProgramContent(
machine.SwapStatus == (int)InfoEnum.SwapOrderResult.Success
? InfoEnum.SwapInfo.InfoCarLeave.GetLed()
: InfoEnum.SwapInfo.ErrInfoCarLeave.GetLed());*/
SoundApi.PlayOneSound(machine.SwapStatus == (int)InfoEnum.SwapOrderResult.Success
? (int)InfoEnum.SwapInfo.InfoCarLeave
: (int)InfoEnum.SwapInfo.ErrInfoCarLeave);
machine.VelLockFlag = true;
//断连Tbox
if (StaticStationInfo.TboxStateDisConnect)
{
TBoxApi.DisConnect(machine.BoxCarInfoModel.CarNo);
}
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.VelLockFlag,
machine);
}
machine.VelLockFlag = true;
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.VelLockFlag,
machine);
}
}
}, () =>
@ -178,4 +177,75 @@ public class SwapDoneState : IState
: (int)InfoEnum.SwapInfo.ErrInfoCarLeave);
}, false, () => { }, 10, InvokeStatus.None);
}
/// <summary>
///收到货箱放下
/// </summary>
/// <returns></returns>
public InvokeStatus TBoxDown(SwappingStateMachine machine)
{
return Invoker.Invoke("TBoxDown", 500, 5, machine.IsCanceled,
() => machine.TboxDownFlag, () =>
{
Task<byte> result = TBoxApi.StartSwap(machine.RfidReadModel.VelVin);
byte res = result.Result;
//换电就绪
if (res == 7)
{
//设置出口的是绿灯
if (PlcApi.WriteExistLamp(1000))
{
machine.TboxDownFlag = true;
/*machine.LedTool?.WriteProgramContent(
machine.SwapStatus == (int)InfoEnum.SwapOrderResult.Success
? InfoEnum.SwapInfo.InfoCarLeave.GetLed()
: InfoEnum.SwapInfo.ErrInfoCarLeave.GetLed());*/
SoundApi.PlayOneSound(machine.SwapStatus == (int)InfoEnum.SwapOrderResult.Success
? (int)InfoEnum.SwapInfo.InfoCarLeave
: (int)InfoEnum.SwapInfo.ErrInfoCarLeave);
//断连Tbox
if (StaticStationInfo.TboxStateDisConnect)
{
TBoxApi.DisConnect(machine.BoxCarInfoModel.CarNo);
}
}
}
}, () =>
{
// machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.ErrUnLockCar.GetLed());
SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.InfoTboxDown);
}, false, () => { }
, 10, InvokeStatus.None);
}
/// <summary>
///收到上电成功
/// </summary>
/// <returns></returns>
public InvokeStatus TBoxEnergyUp(SwappingStateMachine machine)
{
return Invoker.Invoke("TBoxEnergyUp", 500, 5, machine.IsCanceled,
() => machine.TboxEnergyUpFlag, () =>
{
Task<byte> result = TBoxApi.StartSwap(machine.RfidReadModel.VelVin);
byte res = result.Result;
//换电就绪
if (res == 6)
{
//查询车辆锁止状态
machine.TboxEnergyUpFlag = true;
// _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.TBoxSwapReadyFlag,
// machine);
}
}, () =>
{
// machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.ErrUnLockCar.GetLed());
SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.InfoTboxEnergyUp);
}, false, () => { }
, 10, InvokeStatus.None);
}
}

@ -21,5 +21,6 @@ namespace Service.Execute.SwapException;
LockCarError,
LvPwrOffError,
SelfCheckError,
TimeOutError
TimeOutError,
StartSwapToTBoxError
}

@ -106,6 +106,15 @@ public class SwappingStateMachine : IDisposable
//车辆解锁
public bool VelUnlockFlag = false;
//TODO::新加
//给Tbox下发开始换电
public bool StartSwapToTBoxFlag = false;
public bool TboxHandUpFlag = false;
public bool TboxEnergyDownFlag = false;
public bool TboxDownFlag = false;
public bool TboxEnergyUpFlag = false;
//开始换电
public bool StartSwappingFlag = false;
@ -280,7 +289,7 @@ public class SwappingStateMachine : IDisposable
Log.Info($"ManualSwapSuccFlag machine ok");
return true;
}
public bool ManualConfirmLockCar()
{
ManualConfirmCarLockFlag = true;
@ -288,7 +297,7 @@ public class SwappingStateMachine : IDisposable
Log.Info($"ManualConfirmLockCar ok");
return true;
}
public bool ManualConfirmUnLockCar()
{
ManualConfirmCarUnlockFlag = true;
@ -298,7 +307,6 @@ public class SwappingStateMachine : IDisposable
}
private void ResetData()
{
BusinessSwappingForCloudState = InfoEnum.BusinessSwappingForCloudState.Idle;
@ -401,6 +409,12 @@ public class SwappingStateMachine : IDisposable
RadarOutFlag = false;
StartSwapToTBoxFlag = false;
TboxHandUpFlag = false;
TboxEnergyDownFlag = false;
TboxDownFlag = false;
TboxEnergyUpFlag = false;
}
//关于仓库锁定相关重置

Loading…
Cancel
Save