diff --git a/Entity/DbModel/Station/EquipInfo.cs b/Entity/DbModel/Station/EquipInfo.cs
index d4129ef..1b71f8c 100644
--- a/Entity/DbModel/Station/EquipInfo.cs
+++ b/Entity/DbModel/Station/EquipInfo.cs
@@ -86,6 +86,13 @@ namespace Entity.DbModel.Station
///
[SugarColumn(ColumnName="updated_time")]
public DateTime? UpdatedTime {get;set;}
-
+
+ ///
+ /// Desc:0-手动;1-自动充电
+ /// Default:
+ /// Nullable:True
+ ///
+ [SugarColumn(ColumnName="auto_charge")]
+ public int? AutoCharge {get;set;}
}
}
diff --git a/Entity/Dto/Req/EquipInfoReq.cs b/Entity/Dto/Req/EquipInfoReq.cs
new file mode 100644
index 0000000..cf10789
--- /dev/null
+++ b/Entity/Dto/Req/EquipInfoReq.cs
@@ -0,0 +1,37 @@
+using Entity.DbModel.Station;
+
+namespace Entity.Dto.Req;
+
+public class EquipInfoReq : BaseIdReq
+{
+}
+
+public class PageEquipInfoReq : BasePageReq
+{
+ ///
+ /// 名称
+ ///
+ public string Name { get; set; } = "";
+
+ ///
+ /// 设备编码;0-充电机;1-电表
+ ///
+ public string Code { get; set; } = "";
+
+ ///
+ /// 设备状态
+ ///
+ public int? Status { get; set; }
+}
+
+public class AddEquipInfoReq : EquipInfo
+{
+}
+
+public class UpdateEquipInfoReq : AddEquipInfoReq
+{
+}
+
+public class DeleteEquipInfoReq : BaseIdReq
+{
+}
\ No newline at end of file
diff --git a/Entity/Dto/Resp/BinInfoResp.cs b/Entity/Dto/Resp/BinInfoResp.cs
index 8c8318e..a290780 100644
--- a/Entity/Dto/Resp/BinInfoResp.cs
+++ b/Entity/Dto/Resp/BinInfoResp.cs
@@ -160,31 +160,103 @@ public partial class BinInfoResp
///
public DateTime? UpdatedTime { get; set; }
+
///
- /// 功率
+ /// Desc:功率
+ /// Default:
+ /// Nullable:9.9
///
-
public float power { get; set; }
+
///
- /// 缓存仓标记 0:不是 1:是
+ /// Desc:缓存仓标记 0:不是 1:是
+ /// Default:
+ /// Nullable:0
///
public int CacheBinFlag { get; set; }
///
- /// 换电禁用标志 0:不可换电 1:可以换电
+ /// Desc:换电禁用标志 0:不可换电 1:可以换电
+ /// Default:
+ /// Nullable:0
///
public int CanSwapFlag { get; set; }
-
+
///
- /// 充电禁用标志 0:不可充电 1:可以充电
+ /// Desc:充电禁用标志 0:不可充电 1:可以充电
+ /// Default:
+ /// Nullable:0
///
public int CanChargeFlag { get; set; }
-
+
+
///
- /// 充电机是否连接
+ /// Desc:充电机是否连接
+ /// Default:
+ /// Nullable:0
///
public bool ChargeConnectFlag { get; set; }
+ ///
+ /// Desc:本次充电时间
+ /// Default:
+ /// Nullable:0
+ ///
+ public ushort ChargingTime { get; set; }
+ ///
+ /// Desc:估算剩余充电时间
+ /// Default:
+ /// Nullable:0
+ ///
+ public ushort EstimatedRemainingTime { get; set; }
+ ///
+ /// Desc:单次充电电量
+ /// Default:
+ /// Nullable:0
+ ///
+ public float OnceElectricCharge { get; set; }
+ ///
+ /// BMS 需求电压
+ /// Default:
+ /// Nullable:0
+ ///
+ public float BmsNeedVoltage { get; set; }
+ ///
+ /// BMS 需求电流
+ /// Default:
+ /// Nullable:0
+ ///
+ public float BmsNeedCurrent { get; set; }
+ ///
+ /// 电池包总电流,充电为负值,放电为正
+ /// Default:
+ /// Nullable:0
+ ///
+ public float TotalCurrent { get; set; }
+ ///
+ /// 电芯温度最大值
+ /// Default:
+ /// Nullable:0
+ ///
+ public Int16 CellTemperatureMax { get; set; }
+ ///
+ /// 电芯温度最小值
+ /// Default:
+ /// Nullable:0
+ ///
+ public Int16 CellTemperatureMin { get; set; }
+ ///
+ /// 充电开始时间
+ /// Default:
+ /// Nullable:
+ ///
+ public DateTime? ChargingStartTime { get; set; }
+ ///
+ /// 充电结束时间
+ /// Default:
+ /// Nullable:
+ ///
+ public DateTime? ChargingStopTime { get; set; }
}
\ No newline at end of file
diff --git a/Repository/Station/EquipInfoRepository.cs b/Repository/Station/EquipInfoRepository.cs
index d6583ff..d37390e 100644
--- a/Repository/Station/EquipInfoRepository.cs
+++ b/Repository/Station/EquipInfoRepository.cs
@@ -1,4 +1,6 @@
+using System.Linq.Expressions;
using Entity.DbModel.Station;
+using Entity.Dto.Req;
using HybirdFrameworkCore.Autofac.Attribute;
using SqlSugar;
@@ -6,7 +8,28 @@ namespace Repository.Station;
[Scope("SingleInstance")]
public class EquipInfoRepository: BaseRepository
{
+ private ISqlSugarClient DbBaseClient;
+
public EquipInfoRepository(ISqlSugarClient sqlSugar) : base(sqlSugar)
{
+ DbBaseClient = sqlSugar;
+ }
+
+ public async Task> EquipInfoQueryPageAsync(
+ bool isWhere1, Expression> expression1,
+ bool isWhere2, Expression> expression2,
+ bool isWhere3, Expression> expression3,
+ int pageNumber, int pageSize, RefAsync totalNumber,
+ PageEquipInfoReq input, bool blUseNoLock = false)
+ {
+ var page = await DbBaseClient
+ .Queryable()
+ .WhereIF(isWhere1, expression1)
+ .WhereIF(isWhere2, expression2)
+ .WhereIF(isWhere3, expression3)
+ .OrderBuilder(input)
+ .WithNoLockOrNot(blUseNoLock)
+ .ToPageListAsync(pageNumber, pageSize, totalNumber);
+ return page;
}
}
\ No newline at end of file
diff --git a/Service/Station/BinInfoService.cs b/Service/Station/BinInfoService.cs
new file mode 100644
index 0000000..e13164f
--- /dev/null
+++ b/Service/Station/BinInfoService.cs
@@ -0,0 +1,68 @@
+using AutoMapper;
+using Entity.DbModel.Station;
+using Entity.Dto.Resp;
+using HybirdFrameworkCore.Autofac.Attribute;
+using HybirdFrameworkCore.Entity;
+using Repository.Station;
+using Service.Charger.Client;
+
+namespace Service.Station;
+
+[Scope("SingleInstance")]
+public class BinInfoService : BaseServices
+{
+ private readonly BinInfoRepository _binInfoRepository;
+
+ public BinInfoService(BinInfoRepository binInfoRepository)
+ {
+ _binInfoRepository = binInfoRepository;
+ }
+ ///
+ /// 获取仓位数据
+ ///
+ /// 仓位数据列表
+ public List GetChargMonitorChargBinData()
+ {
+ List binInfos = _binInfoRepository.Query();
+ var configuration = new MapperConfiguration(cfg => cfg.CreateMap());
+ var mapper = configuration.CreateMapper();
+
+ // 转换为 BinInfoResp 列表
+ List binInfoList = mapper.Map>(binInfos);
+ // 功率赋值
+ foreach (var binInfoResp in binInfoList)
+ {
+ ChargerClient? chargerClient = ClientMgr.GetBySn(binInfoResp.ChargerNo);
+ if (chargerClient != null)
+ {
+ binInfoResp.power = chargerClient.RealTimeChargePower;
+ binInfoResp.ChargeConnectFlag = chargerClient.Connected;
+ binInfoResp.ChargingTime = chargerClient.UploadTelemetryData.ChargingTime;
+ binInfoResp.EstimatedRemainingTime = chargerClient.UploadTelemetryData.EstimatedRemainingTime;
+ if (chargerClient.BatteryPackTotalElectricity != null)
+ binInfoResp.OnceElectricCharge = chargerClient.BatteryPackTotalElectricity.OnceElectricCharge;
+ binInfoResp.BmsNeedVoltage = chargerClient.UploadTelemetryData.BmsNeedVoltage;
+ binInfoResp.BmsNeedCurrent = chargerClient.UploadTelemetryData.BmsNeedCurrent;
+ if (chargerClient.BatteryPackData != null)
+ binInfoResp.TotalCurrent = chargerClient.BatteryPackData.TotalCurrent;
+ if (chargerClient.BatteryPackDataVoltage != null)
+ binInfoResp.CellTemperatureMax = chargerClient.BatteryPackDataVoltage.CellTemperatureMax;
+ if (chargerClient.BatteryPackDataVoltage != null)
+ binInfoResp.CellTemperatureMin = chargerClient.BatteryPackDataVoltage.CellTemperatureMin;
+ binInfoResp.ChargingStartTime = chargerClient.ChargingStartTime;
+ binInfoResp.ChargingStopTime = chargerClient.ChargingStopTime;
+ }
+ }
+
+ return binInfoList;
+ }
+ ///
+ /// 禁用仓位
+ ///
+ ///
+ /// 修改结果
+ public bool UpdateStatus(int id)
+ {
+ return _binInfoRepository.UpdateStatus(id);
+ }
+}
\ No newline at end of file
diff --git a/Service/Station/EquipInfoService.cs b/Service/Station/EquipInfoService.cs
new file mode 100644
index 0000000..402cbce
--- /dev/null
+++ b/Service/Station/EquipInfoService.cs
@@ -0,0 +1,79 @@
+using System.ComponentModel;
+using Entity.Base;
+using Entity.DbModel.Station;
+using Entity.Dto.Req;
+using HybirdFrameworkCore.Autofac.Attribute;
+using HybirdFrameworkCore.Entity;
+using Mapster;
+using Repository.Station;
+using SqlSugar;
+
+namespace Service.Station;
+
+[Scope("SingleInstance")]
+public class EquipInfoService : BaseServices
+{
+ private readonly EquipInfoRepository _equipInfoRepository;
+
+ public EquipInfoService(EquipInfoRepository equipInfoRepository)
+ {
+ _equipInfoRepository = equipInfoRepository;
+ }
+
+ ///
+ /// 获取分页列表 🔖
+ ///
+ /// 查询参数
+ /// 分页列表
+ public async Task> Page(PageEquipInfoReq input)
+ {
+ RefAsync total = 0;
+ var items = await _equipInfoRepository.EquipInfoQueryPageAsync(
+ !string.IsNullOrEmpty(input.Name), u => u.Name.Contains(input.Name),
+ !string.IsNullOrEmpty(input.Code), u => u.Code.Contains(input.Code),
+ input.Status != null, (u => input.Status != null && u.Status.Equals(input.Status.Value)),
+ input.Page, input.PageSize, total, input);
+ return SqlSugarPagedExtensions.CreateSqlSugarPagedList(items, total, input.Page, input.PageSize);
+ }
+
+ ///
+ /// 修改充电模式配置 🔖
+ ///
+ /// 修改参数
+ /// 修改结果
+ [DisplayName("更新充电模式配置")]
+ public async Task> UpdateEquipInfoReq(UpdateEquipInfoReq input)
+ {
+ var isExist = await _equipInfoRepository.QueryByClauseAsync
+ (u => (u.Name == input.Name || u.Code == input.Code) && u.Id != input.Id);
+ if (isExist != null)
+ {
+ return Result