diff --git a/Service/Execute/Step/CarPrepareState.cs b/Service/Execute/Step/CarPrepareState.cs index bdc296f..379ee8d 100644 --- a/Service/Execute/Step/CarPrepareState.cs +++ b/Service/Execute/Step/CarPrepareState.cs @@ -114,48 +114,42 @@ public class CarPrepareState : IState () => machine.VehiclesInPlaceFlag, () => { var result = TBoxApi.GetCarInfo(machine.RfidReadModel.VelVin); - bool keyStatus = false; - bool breakStatus = false; - bool nStatus = false; - TboxCarInfoModel tboxCarInfoModel = result.Result; - if (StaticStationInfo.TboxStateFlameout || - StaticStationInfo.TboxStateBreak || - StaticStationInfo.TboxStateN) + int succCount = 0; + List succL = new List() { - var status = tboxCarInfoModel?.CarStatus; + StaticStationInfo.TboxStateFlameout, StaticStationInfo.TboxStateBreak, StaticStationInfo.TboxStateN + }; + var successCount = succL.Where(i => i).Count(); + TboxCarInfoModel tboxCarInfoModel = result.Result; - if (StaticStationInfo.TboxStateFlameout) - { - if (status?.Keys == 0) - { - keyStatus = true; - } - } + var status = tboxCarInfoModel?.CarStatus; - if (StaticStationInfo.TboxStateBreak) + if (StaticStationInfo.TboxStateFlameout) + { + if (status?.Keys == 0) { - if (status?.Break == 1) - { - breakStatus = true; - } + succCount++; } + } - if (StaticStationInfo.TboxStateN) + if (StaticStationInfo.TboxStateBreak) + { + if (status?.Break == 1) { - if (status?.Gear == 0) - { - nStatus = true; - } + succCount++; } } - else + + if (StaticStationInfo.TboxStateN) { - keyStatus = true; - breakStatus = true; - nStatus = true; + if (status?.Gear == 0) + { + succCount++; + } } - if (keyStatus && breakStatus && nStatus) + + if (succCount == successCount) { machine.VehiclesInPlaceFlag = true; //写入口等 :红灯 @@ -376,7 +370,7 @@ public class CarPrepareState : IState SwapOrderBatteryInfo orderBatteryInfo = null; if (swapAmtOrder != null) { - orderBatteryInfo = _CommonMgr.SelectPackArm(swapAmtOrder,machine); + orderBatteryInfo = _CommonMgr.SelectPackArm(swapAmtOrder, machine); } else { diff --git a/Service/Execute/Step/DoSwappingState.cs b/Service/Execute/Step/DoSwappingState.cs index 3fab8ec..a41c948 100644 --- a/Service/Execute/Step/DoSwappingState.cs +++ b/Service/Execute/Step/DoSwappingState.cs @@ -416,48 +416,40 @@ public class DoSwappingState : IState var result = TBoxApi.GetCarInfo(machine.RfidReadModel.VelVin); TboxCarInfoModel tboxCarInfoModel = result.Result; - bool keyStatus = false; - bool breakStatus = false; - bool nStatus = false; - if (StaticStationInfo.TboxStateFlameout || - StaticStationInfo.TboxStateBreak || - StaticStationInfo.TboxStateN) + int succCount = 0; + List succL = new List() { - var status = tboxCarInfoModel?.CarStatus; + StaticStationInfo.TboxStateFlameout, StaticStationInfo.TboxStateBreak, StaticStationInfo.TboxStateN + }; + var successCount = succL.Where(i => i).Count(); - if (StaticStationInfo.TboxStateFlameout) - { - if (status?.Keys == 0) - { - keyStatus = true; - } - } + var status = tboxCarInfoModel?.CarStatus; - if (StaticStationInfo.TboxStateBreak) + if (StaticStationInfo.TboxStateFlameout) + { + if (status?.Keys == 0) { - if (status?.Break == 1) - { - breakStatus = true; - } + succCount++; } + } - if (StaticStationInfo.TboxStateN) + if (StaticStationInfo.TboxStateBreak) + { + if (status?.Break == 1) { - if (status?.Gear == 0) - { - nStatus = true; - } + succCount++; } } - else + + if (StaticStationInfo.TboxStateN) { - keyStatus = true; - breakStatus = true; - nStatus = true; + if (status?.Gear == 0) + { + succCount++; + } } - - if (keyStatus && breakStatus && nStatus) + if (succCount==successCount) { machine.VehiclesInPlace2Flag = true; }