diff --git a/Entity/DbModel/Station/BinInfo.cs b/Entity/DbModel/Station/BinInfo.cs
index dbaffd2..2fbaca6 100644
--- a/Entity/DbModel/Station/BinInfo.cs
+++ b/Entity/DbModel/Station/BinInfo.cs
@@ -43,6 +43,12 @@ namespace Entity.DbModel.Station
///
[SugarColumn(ColumnName = "name")]
public string Name { get; set; }
+
+ ///
+ /// 在位状态:0-不在位;1-在位;其他-无效
+ ///
+ [SugarColumn(ColumnName = "exists")]
+ public int Exists { get; set; }
///
/// Desc:电池编号
diff --git a/Entity/Dto/Req/DistributeElecPriceReq.cs b/Entity/Dto/Req/DistributeElecPriceReq.cs
deleted file mode 100644
index ad72250..0000000
--- a/Entity/Dto/Req/DistributeElecPriceReq.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-namespace Entity.Dto.Req;
-
-public class DistributeElecPriceReq
-{
- ///
- /// 充电机号
- ///
- public string BinNo { get; set; }
- ///
- /// 电价模型详情:版本
- ///
- public int Version { get; set; }
-}
\ No newline at end of file
diff --git a/Entity/Dto/Resp/BatteryStatusInfoResp.cs b/Entity/Dto/Resp/BatteryStatusInfoResp.cs
new file mode 100644
index 0000000..8b4211e
--- /dev/null
+++ b/Entity/Dto/Resp/BatteryStatusInfoResp.cs
@@ -0,0 +1,17 @@
+namespace Entity.Dto.Resp;
+
+public class BatteryStatusInfoResp
+{
+ ///
+ /// 电池总数
+ ///
+ public int btyTotalCount { get;set; }
+ ///
+ /// 正在充电数量
+ ///
+ public int chargingCount { get;set; }
+ ///
+ /// 满足换电数量
+ ///
+ public int canSwapCount { get;set; }
+}
\ No newline at end of file
diff --git a/Service/Charger/ChargerService.cs b/Service/Charger/ChargerService.cs
index 56ba458..f05783b 100644
--- a/Service/Charger/ChargerService.cs
+++ b/Service/Charger/ChargerService.cs
@@ -1,9 +1,11 @@
using Entity.DbModel.Station;
+using Entity.Dto.Resp;
using HybirdFrameworkCore.Autofac.Attribute;
using HybirdFrameworkCore.Entity;
using Repository.Station;
using Service.Charger.Client;
using Service.Charger.Msg.Host.Req;
+using Service.Init;
using SqlSugar;
namespace Service.Charger;
@@ -77,7 +79,7 @@ public class ChargerService
///
///
///
- public Result DistributeElecPriceForCharge(string binNo,int version)
+ public Result DistributeElecPriceForCharge(int version)
{
Dictionary chargerClients = ClientMgr.Dictionary;
if (chargerClients.Values.Count <= 0)
@@ -131,4 +133,23 @@ public class ChargerService
};
return setPeakValleyTime;
}
+
+ ///
+ /// 电池状态信息:电池总数 满电数量、充电中、故障电池、维护中电池
+ ///
+ ///
+ public Result BatteryStatusInfo()
+ {
+ BatteryStatusInfoResp batteryStatusInfoResp = new BatteryStatusInfoResp();
+ List binInfos = BinInfoRepository.QueryListByClause(i => i.Exists == 1 && i.Status == 1);
+ if (binInfos.Count > 0)
+ batteryStatusInfoResp.btyTotalCount = binInfos.Count();
+ List canSwapCounts = BinInfoRepository.QueryListByClause(i => i.Exists == 1 && i.Status == 1&&i.Soc > Convert.ToDecimal(StaticStationInfo.SwapSoc));
+ if (canSwapCounts.Count > 0)
+ batteryStatusInfoResp.canSwapCount = canSwapCounts.Count();
+ List chargingCounts = BinInfoRepository.QueryListByClause(i => i.Exists == 1 && i.Status == 1&&i.ChargeStatus==1);
+ if (chargingCounts.Count > 0)
+ batteryStatusInfoResp.chargingCount = chargingCounts.Count();
+ return Result.Fail();
+ }
}
\ No newline at end of file
diff --git a/WebStarter/Controllers/ChargeController.cs b/WebStarter/Controllers/ChargeController.cs
index 6a18ebb..ab42d13 100644
--- a/WebStarter/Controllers/ChargeController.cs
+++ b/WebStarter/Controllers/ChargeController.cs
@@ -110,10 +110,21 @@ public class ChargeController : ControllerBase
///
///
[HttpGet]
- [Route("DistributeElecPriceForCharge")]
- public Result DistributeElecPriceForCharge([FromBody] DistributeElecPriceReq input )
+ [Route("DistributeElecPriceForCharge/{Version}")]
+ public Result DistributeElecPriceForCharge(int Version)
{
- return _chargerService.DistributeElecPriceForCharge(input.BinNo,input.Version);
+ return _chargerService.DistributeElecPriceForCharge(Version);
}
+ //BatteryStatusInfo
+ ///
+ /// 电池状态信息:电池总数 满电数量、充电中、故障电池、维护中电池
+ ///
+ ///
+ [HttpGet]
+ [Route("BatteryStatusInfo")]
+ public Result BatteryStatusInfo()
+ {
+ return _chargerService.BatteryStatusInfo();
+ }
}
\ No newline at end of file