状态判断bug

zw
lxw 5 months ago
parent 1c14a95116
commit 16adcd42f6

@ -114,48 +114,42 @@ 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)
{ {
var status = tboxCarInfoModel?.CarStatus; StaticStationInfo.TboxStateFlameout, StaticStationInfo.TboxStateBreak, StaticStationInfo.TboxStateN
};
var successCount = succL.Where(i => i).Count();
TboxCarInfoModel tboxCarInfoModel = result.Result;
if (StaticStationInfo.TboxStateFlameout) var status = tboxCarInfoModel?.CarStatus;
{
if (status?.Keys == 0)
{
keyStatus = true;
}
}
if (StaticStationInfo.TboxStateBreak) if (StaticStationInfo.TboxStateFlameout)
{
if (status?.Keys == 0)
{ {
if (status?.Break == 1) succCount++;
{
breakStatus = true;
}
} }
}
if (StaticStationInfo.TboxStateN) if (StaticStationInfo.TboxStateBreak)
{
if (status?.Break == 1)
{ {
if (status?.Gear == 0) succCount++;
{
nStatus = true;
}
} }
} }
else
if (StaticStationInfo.TboxStateN)
{ {
keyStatus = true; if (status?.Gear == 0)
breakStatus = true; {
nStatus = true; succCount++;
}
} }
if (keyStatus && breakStatus && nStatus)
if (succCount == successCount)
{ {
machine.VehiclesInPlaceFlag = true; machine.VehiclesInPlaceFlag = true;
//写入口等 :红灯 //写入口等 :红灯
@ -376,7 +370,7 @@ public class CarPrepareState : IState
SwapOrderBatteryInfo orderBatteryInfo = null; SwapOrderBatteryInfo orderBatteryInfo = null;
if (swapAmtOrder != null) if (swapAmtOrder != null)
{ {
orderBatteryInfo = _CommonMgr.SelectPackArm(swapAmtOrder,machine); orderBatteryInfo = _CommonMgr.SelectPackArm(swapAmtOrder, machine);
} }
else else
{ {

@ -416,48 +416,40 @@ 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)
{ {
var status = tboxCarInfoModel?.CarStatus; StaticStationInfo.TboxStateFlameout, StaticStationInfo.TboxStateBreak, StaticStationInfo.TboxStateN
};
var successCount = succL.Where(i => i).Count();
if (StaticStationInfo.TboxStateFlameout) var status = tboxCarInfoModel?.CarStatus;
{
if (status?.Keys == 0)
{
keyStatus = true;
}
}
if (StaticStationInfo.TboxStateBreak) if (StaticStationInfo.TboxStateFlameout)
{
if (status?.Keys == 0)
{ {
if (status?.Break == 1) succCount++;
{
breakStatus = true;
}
} }
}
if (StaticStationInfo.TboxStateN) if (StaticStationInfo.TboxStateBreak)
{
if (status?.Break == 1)
{ {
if (status?.Gear == 0) succCount++;
{
nStatus = true;
}
} }
} }
else
if (StaticStationInfo.TboxStateN)
{ {
keyStatus = true; if (status?.Gear == 0)
breakStatus = true; {
nStatus = true; succCount++;
}
} }
if (succCount==successCount)
if (keyStatus && breakStatus && nStatus)
{ {
machine.VehiclesInPlace2Flag = true; machine.VehiclesInPlace2Flag = true;
} }

Loading…
Cancel
Save