修改红绿灯帧类型

master
zby 2 months ago
parent ed2a3a3ca8
commit 0761a2cd1d

@ -58,13 +58,13 @@ public class CarCtrlState : IState
return Invoker.Invoke("UnLockCar", 500, 100, machine.IsCanceled,
() => machine.VelUnlockFlag, () =>
{
Task<bool> result = TBoxApi.UnLockCarManyTimes(machine.RfidReadModel.VelNo);
Task<bool> result = TBoxApi.UnLockCarManyTimes(machine.RfidReadModel.VelVin);
bool unLock = result.Result;
if (unLock)
{
//查询车辆锁止状态
Task<TboxCarInfoModel> carInfo = TBoxApi.GetCarInfo(machine.RfidReadModel.VelNo);
Task<TboxCarInfoModel> carInfo = TBoxApi.GetCarInfo(machine.RfidReadModel.VelVin);
var resultHeartBeatMsg = carInfo.Result.CarStatus;
if (resultHeartBeatMsg?.LockStatus == 1 || machine.ManualConfirmCarUnlockFlag)
{

@ -166,7 +166,7 @@ public class CarPrepareState : IState
return Invoker.Invoke("check TBox connect", 1000, 10, machine.IsCanceled,
() => machine.BoxConnectFlag, () =>
{
Task<bool> result = TBoxApi.IsConnected(machine.RfidReadModel.VelNo);
Task<bool> result = TBoxApi.IsConnected(machine.RfidReadModel.VelVin);
// result.Wait();
bool isConnect = result.Result;
@ -213,12 +213,12 @@ public class CarPrepareState : IState
return Invoker.Invoke("TBox connect", 1000, 10, machine.IsCanceled,
() => machine.BoxConnectFlag, () =>
{
Task<bool> result = TBoxApi.Connect(machine.RfidReadModel.VelNo);
Task<bool> result = TBoxApi.Connect(machine.RfidReadModel.VelVin);
bool isConnect = result.Result;
if (isConnect)
{
//读取车辆carNo=carVin
Task<TboxCarInfoModel> carInfoResult = TBoxApi.GetCarInfo(machine.RfidReadModel.VelNo);
Task<TboxCarInfoModel> carInfoResult = TBoxApi.GetCarInfo(machine.RfidReadModel.VelVin);
var tboxCarInfoModel = carInfoResult.Result;
var carInfo = tboxCarInfoModel?.CarInfo;
if (carInfo != null)

@ -162,7 +162,7 @@ public class DoSwappingState : IState
return Invoker.Invoke("StartSwapping", 1000, 5, machine.IsCanceled,
() => machine.StartSwappingFlag, () =>
{
Task<bool> result = TBoxApi.UnLockCarManyTimes(machine.RfidReadModel.VelNo);
Task<bool> result = TBoxApi.UnLockCarManyTimes(machine.RfidReadModel.VelVin);
bool unLock = result.Result;
if (unLock)
{

@ -47,6 +47,9 @@ public class StationReadyState : IState
return null;
}
//plc是否是自动模式
var plcIsAuto = PlcIsAuto(machine);
if (InvokeStatus.Done != plcIsAuto)
@ -61,26 +64,24 @@ public class StationReadyState : IState
return SwappingStateMachine.ReturnWithInvokeErr(plcIsRemote, ExceptionReason.None);
}
////开启雷达
//var beginRadar = ControlRadar(machine, 1);
//if (InvokeStatus.Done != beginRadar)
//{
// return SwappingStateMachine.ReturnWithInvokeErr(beginRadar, ExceptionReason.None);
//}
//开启雷达
var beginRadar = ControlRadar(machine, 1);
if (InvokeStatus.Done != beginRadar)
{
return SwappingStateMachine.ReturnWithInvokeErr(beginRadar, ExceptionReason.None);
}
//调整车辆
var adjustCarByRadar = AdjustCarByRadar(machine);
if (InvokeStatus.Done != adjustCarByRadar)
{
return SwappingStateMachine.ReturnWithInvokeErr(adjustCarByRadar, ExceptionReason.None);
}
////调整车辆
//var adjustCarByRadar = AdjustCarByRadar(machine);
//if (InvokeStatus.Done != adjustCarByRadar)
//{
// return SwappingStateMachine.ReturnWithInvokeErr(adjustCarByRadar, ExceptionReason.None);
//}
//手动模式
if (StaticStationInfo.VehicleManually == 1)
{
var rfidPrepared = WaitVinPrepare(machine);
if (InvokeStatus.Done != rfidPrepared)
{
@ -102,10 +103,16 @@ public class StationReadyState : IState
if (InvokeStatus.Done != readRfid)
{
return SwappingStateMachine.ReturnWithInvokeErr(readRfid, ExceptionReason.ReadRfidError);
}
}
}
return new StateResult()
{
SwappingState = SwappingState.CarPrepare,
@ -139,7 +146,11 @@ public class StationReadyState : IState
//SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.InfoStationModel) ;
LedClient.SendMsgByKey(InfoEnum.SwapInfo.InfoStationModel.GetLed());
}, true, () => { }, 5, InvokeStatus.None);
}, true,
() =>
{
}, 5, InvokeStatus.None);
}

@ -29,13 +29,11 @@ public class SwapDoneState : IState
public StateResult Handle(SwappingStateMachine machine)
{
//更新换电订单
machine.SwapOrder!.SwapResult = machine.SwapStatus;
machine.SwapOrder.SwapEndTime = DateTime.Now;
machine.SwapOrder.FailReason = machine.SwapFailReason;
_CommonMgr.UpdateSwapOrder(machine);
////修改预约单
if (machine.SwapOrderBatteryInfo!.swapAmtOrder != null)
{
@ -215,13 +213,13 @@ public class SwapDoneState : IState
return Invoker.Invoke("LockCar", 500, 100, machine.IsCanceled, machine.IsManualSwapSucc,
() => machine.VelLockFlag, () =>
{
Task<bool> result = TBoxApi.LockCarManyTimes(machine.RfidReadModel.VelNo);
Task<bool> result = TBoxApi.LockCarManyTimes(machine.RfidReadModel.VelVin);
bool unLock = result.Result;
if (unLock)
{
//查询车辆锁止状态
Task<TboxCarInfoModel> carInfo = TBoxApi.GetCarInfo(machine.RfidReadModel.VelNo);
Task<TboxCarInfoModel> carInfo = TBoxApi.GetCarInfo(machine.RfidReadModel.VelVin);
if (carInfo.Result?.CarStatus?.LockStatus == 2 || machine.ManualConfirmCarLockFlag)
{

@ -331,17 +331,22 @@ public class SwappingStateMachine : IDisposable
StepSort = 0;
Array values = Enum.GetValues(typeof(InfoEnum.BusinessSwappingStep));
foreach (var value in values)
foreach (var key in StepModel.Keys.ToList())
{
StepModel[(string)value] = new StepModel()
{
StepNo = (int)value,
Status = 0,
StepName = BaseEnumExtensions.GetEnumDescriptionByCode<InfoEnum.BusinessSwappingStep>((int)value)
}
;
;
StepModel[key].Status = 0;
StepModel[key].StartTime = null;
}
//foreach (var value in values)
//{
// StepModel[(string)value] = new StepModel()
// {
// StepNo = (int)value,
// Status = 0,
// StepName = BaseEnumExtensions.GetEnumDescriptionByCode<InfoEnum.BusinessSwappingStep>((int)value)
// }
// ;
// ;
//}
PlcSwapFlag = false;
ManualSwapSuccFlag = false;

@ -197,7 +197,7 @@ public class Decoder : ByteToMessageDecoder
/*0x*/
94 => ModelConvert.Decode<MoveCommandResq>(bytes),
119=> ModelConvert.Decode < TrafficLightResq>(bytes),
121=> ModelConvert.Decode < TrafficLightResq>(bytes),
_ => new ASDU()
};

@ -16,7 +16,7 @@ public class TrafficLightReq: ASDU {
public TrafficLightReq(byte trafficLight)
{
FrameTypeNo = 118;
FrameTypeNo = 120;
MsgBodyCount = 1;
TransReason = 3;
PublicAddr = 0;

@ -143,7 +143,7 @@
"Enabled": false
},
"led": {
"enable": true,
"enable": false,
"ip": "192.168.3.79",
"port": 10000
}

Loading…
Cancel
Save