状态判断bug

zw
lxw 5 months ago
parent 1c14a95116
commit 16adcd42f6

@ -114,21 +114,21 @@ public class CarPrepareState : IState
() => machine.VehiclesInPlaceFlag, () => () => machine.VehiclesInPlaceFlag, () =>
{ {
var result = TBoxApi.GetCarInfo(machine.RfidReadModel.VelVin); var result = TBoxApi.GetCarInfo(machine.RfidReadModel.VelVin);
bool keyStatus = false; int succCount = 0;
bool breakStatus = false; List<bool> succL = new List<bool>()
bool nStatus = false;
TboxCarInfoModel tboxCarInfoModel = result.Result;
if (StaticStationInfo.TboxStateFlameout ||
StaticStationInfo.TboxStateBreak ||
StaticStationInfo.TboxStateN)
{ {
StaticStationInfo.TboxStateFlameout, StaticStationInfo.TboxStateBreak, StaticStationInfo.TboxStateN
};
var successCount = succL.Where(i => i).Count();
TboxCarInfoModel tboxCarInfoModel = result.Result;
var status = tboxCarInfoModel?.CarStatus; var status = tboxCarInfoModel?.CarStatus;
if (StaticStationInfo.TboxStateFlameout) if (StaticStationInfo.TboxStateFlameout)
{ {
if (status?.Keys == 0) if (status?.Keys == 0)
{ {
keyStatus = true; succCount++;
} }
} }
@ -136,7 +136,7 @@ public class CarPrepareState : IState
{ {
if (status?.Break == 1) if (status?.Break == 1)
{ {
breakStatus = true; succCount++;
} }
} }
@ -144,18 +144,12 @@ public class CarPrepareState : IState
{ {
if (status?.Gear == 0) if (status?.Gear == 0)
{ {
nStatus = true; succCount++;
}
} }
} }
else
{
keyStatus = true;
breakStatus = true;
nStatus = true;
}
if (keyStatus && breakStatus && nStatus)
if (succCount == successCount)
{ {
machine.VehiclesInPlaceFlag = true; machine.VehiclesInPlaceFlag = true;
//写入口等 :红灯 //写入口等 :红灯

@ -416,20 +416,20 @@ public class DoSwappingState : IState
var result = TBoxApi.GetCarInfo(machine.RfidReadModel.VelVin); var result = TBoxApi.GetCarInfo(machine.RfidReadModel.VelVin);
TboxCarInfoModel tboxCarInfoModel = result.Result; TboxCarInfoModel tboxCarInfoModel = result.Result;
bool keyStatus = false; int succCount = 0;
bool breakStatus = false; List<bool> succL = new List<bool>()
bool nStatus = false;
if (StaticStationInfo.TboxStateFlameout ||
StaticStationInfo.TboxStateBreak ||
StaticStationInfo.TboxStateN)
{ {
StaticStationInfo.TboxStateFlameout, StaticStationInfo.TboxStateBreak, StaticStationInfo.TboxStateN
};
var successCount = succL.Where(i => i).Count();
var status = tboxCarInfoModel?.CarStatus; var status = tboxCarInfoModel?.CarStatus;
if (StaticStationInfo.TboxStateFlameout) if (StaticStationInfo.TboxStateFlameout)
{ {
if (status?.Keys == 0) if (status?.Keys == 0)
{ {
keyStatus = true; succCount++;
} }
} }
@ -437,7 +437,7 @@ public class DoSwappingState : IState
{ {
if (status?.Break == 1) if (status?.Break == 1)
{ {
breakStatus = true; succCount++;
} }
} }
@ -445,19 +445,11 @@ public class DoSwappingState : IState
{ {
if (status?.Gear == 0) if (status?.Gear == 0)
{ {
nStatus = true; succCount++;
} }
} }
}
else
{
keyStatus = true;
breakStatus = true;
nStatus = true;
}
if (keyStatus && breakStatus && nStatus) if (succCount==successCount)
{ {
machine.VehiclesInPlace2Flag = true; machine.VehiclesInPlace2Flag = true;
} }

Loading…
Cancel
Save