From 3812fa69ced89028e30b0e4c9c0c9d6baf043421 Mon Sep 17 00:00:00 2001 From: CZ Date: Thu, 7 Nov 2024 13:47:00 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=85=E7=94=B5=E6=9C=BA=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Service/Charger/Common/ChargerConst.cs | 27 +++++++++++++++++++ .../Handler/UploadRemoteSignalDataHandler.cs | 10 +++---- 2 files changed, 30 insertions(+), 7 deletions(-) diff --git a/Service/Charger/Common/ChargerConst.cs b/Service/Charger/Common/ChargerConst.cs index 48dfc52..e3fd6d8 100644 --- a/Service/Charger/Common/ChargerConst.cs +++ b/Service/Charger/Common/ChargerConst.cs @@ -1,4 +1,5 @@ using DotNetty.Common.Utilities; +using Entity.Constant; namespace Service.Charger.Common; @@ -47,6 +48,32 @@ public static class ChargerConst return 0; } + + //充电及数据 + //00H:待机 + //01H:工作 + //02H:工作完成 + //03H: 故障 + //04H: 启动中 + + //Desc:充电状态;0-未知;1-正在充电;2-无电池;3-禁用;4-充电完成5故障;6启动中 + + /// + /// 根据充电机状态设置数据库状态 + /// + public static int WorkStatus(int workStatus) + { + switch (workStatus) + { + case 0: return 0; + case 1: return 1; + case 2: return 4; + case 3: return 5; + case 4: return 6; + } + + return 0; + } } /// diff --git a/Service/Charger/Handler/UploadRemoteSignalDataHandler.cs b/Service/Charger/Handler/UploadRemoteSignalDataHandler.cs index 6a95c52..683d15a 100644 --- a/Service/Charger/Handler/UploadRemoteSignalDataHandler.cs +++ b/Service/Charger/Handler/UploadRemoteSignalDataHandler.cs @@ -54,13 +54,9 @@ namespace Service.Charger.Handler client.TotalWarning = msg.TotalWarning; client.UploadRemoteSignalData = msg; - //Desc:充电状态;0-未知;1-正在充电;2-无电池;3-禁用;4-充电完成 - if (msg.WorkStatus == 1) - BinInfoRepository.Update(i => i.ChargeStatus == msg.WorkStatus, i => i.ChargerNo == sn); - else if (msg.WorkStatus == 2 || msg.WorkStatus == 0) - { - BinInfoRepository.Update(i => i.ChargeStatus == 4, i => i.ChargerNo == sn); - } + //充电及数据00H:待机01H:工作02H:工作完成03H: 故障04H: 启动中 + //Desc:充电状态;0-未知;1-正在充电;2-无电池;3-禁用;4-充电完成5故障;6启动中 + BinInfoRepository.Update(i => i.ChargeStatus == ChargerConst.WorkStatus(msg.WorkStatus), i => i.ChargerNo == sn); #region 充电机故障显示