From 16adcd42f6ca6053142dec9a8b28b50485323d27 Mon Sep 17 00:00:00 2001 From: lxw Date: Thu, 20 Jun 2024 14:37:27 +0800 Subject: [PATCH] =?UTF-8?q?=E7=8A=B6=E6=80=81=E5=88=A4=E6=96=ADbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Service/Execute/Step/CarPrepareState.cs | 56 +++++++++++-------------- Service/Execute/Step/DoSwappingState.cs | 52 ++++++++++------------- 2 files changed, 47 insertions(+), 61 deletions(-) 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; }