diff --git a/Entity/Api/Req/SetBusinessHoursReq.cs b/Entity/Api/Req/SetBusinessHoursReq.cs
new file mode 100644
index 0000000..3c67bcb
--- /dev/null
+++ b/Entity/Api/Req/SetBusinessHoursReq.cs
@@ -0,0 +1,13 @@
+namespace Entity.Api.Req;
+
+public class SetBusinessHoursReq
+{
+ ///
+ /// 营业时间:开始时间
+ ///
+ public string BusinessStartHours { get; set; }
+ ///
+ /// 营业时间:结束时间
+ ///
+ public string BusinessEndHours { get; set; }
+}
\ No newline at end of file
diff --git a/Entity/Api/Req/SetChargingOperationModeReq.cs b/Entity/Api/Req/SetChargingOperationModeReq.cs
new file mode 100644
index 0000000..8d778e6
--- /dev/null
+++ b/Entity/Api/Req/SetChargingOperationModeReq.cs
@@ -0,0 +1,9 @@
+namespace Entity.Api.Req;
+
+public class SetChargingOperationModeReq
+{
+ ///
+ /// 充电模式 0:手动充电;1:自动充电
+ ///
+ public int ChargeType { get; set; }
+}
\ No newline at end of file
diff --git a/Entity/Api/Req/SetDayTimeReq.cs b/Entity/Api/Req/SetDayTimeReq.cs
index 1f859ff..fd55af8 100644
--- a/Entity/Api/Req/SetDayTimeReq.cs
+++ b/Entity/Api/Req/SetDayTimeReq.cs
@@ -14,10 +14,10 @@ namespace Entity.Api.Req
///
/// 日 灯光开启时间
///
- public string StartTime { get; set; }
+ public string LightDayStartTime { get; set; }
///
/// 日 灯光关闭时间
///
- public string EndTime { get; set; }
+ public string LightDayEndTime { get; set; }
}
}
diff --git a/Entity/Api/Req/SetReplacementStrategyReq.cs b/Entity/Api/Req/SetReplacementStrategyReq.cs
new file mode 100644
index 0000000..fa0a87d
--- /dev/null
+++ b/Entity/Api/Req/SetReplacementStrategyReq.cs
@@ -0,0 +1,13 @@
+namespace Entity.Api.Req;
+
+public class SetReplacementStrategyReq
+{
+ ///
+ /// 换电标准SOC
+ ///
+ public float SwapSoc { get; set; }
+ ///
+ /// 充电标准SOC
+ ///
+ public float FullSoc { get; set; }
+}
\ No newline at end of file
diff --git a/Entity/Api/Req/SetSwitchingOperaModeReq.cs b/Entity/Api/Req/SetSwitchingOperaModeReq.cs
new file mode 100644
index 0000000..7fd4296
--- /dev/null
+++ b/Entity/Api/Req/SetSwitchingOperaModeReq.cs
@@ -0,0 +1,9 @@
+namespace Entity.Api.Req;
+
+public class SetSwitchingOperaModeReq
+{
+ ///
+ /// 换电运营模式:1:自动;2:手动
+ ///
+ public int SwapType { get; set; }
+}
\ No newline at end of file
diff --git a/Entity/Api/Resp/BaseSetStationConfigInfo.cs b/Entity/Api/Resp/BaseSetStationConfigInfo.cs
new file mode 100644
index 0000000..2c8c7e4
--- /dev/null
+++ b/Entity/Api/Resp/BaseSetStationConfigInfo.cs
@@ -0,0 +1,37 @@
+namespace Entity.Api.Resp;
+
+public class BaseSetStationConfigInfo
+{
+ ///
+ /// 灯光日间时间:开始时间
+ ///
+ public string LigthStartTime { get; set; }
+ ///
+ /// 灯光日间时间:结束时间
+ ///
+ public string LigthEndTime { get; set; }
+ ///
+ /// 换电策略:换电标准Soc
+ ///
+ public int SetSwapSoc { get; set; }
+ ///
+ /// 换电策略:充电标准Soc
+ ///
+ public int SetFullSoc { get; set; }
+ ///
+ /// 营业时间:开始时间
+ ///
+ public string BusinessStartHours { get; set; }
+ ///
+ /// 营业时间:结束时间
+ ///
+ public string BusinessEndHours{ get; set; }
+ ///
+ /// 充电运营模式:0-手动 1-自动
+ ///
+ public int ChargeType{ get; set; }
+ ///
+ /// 换电运营模式:1-自动 2-手动
+ ///
+ public int SwapType{ get; set; }
+}
\ No newline at end of file
diff --git a/Entity/Constant/StationParamConst.cs b/Entity/Constant/StationParamConst.cs
index da92052..6750f1a 100644
--- a/Entity/Constant/StationParamConst.cs
+++ b/Entity/Constant/StationParamConst.cs
@@ -181,6 +181,26 @@ public class StationParamConst
#endregion 换电站基础信息
+ #region 系统管理-基础设置
+ //提交灯光日间时间
+ public static readonly string SetLightDayStartTime = "Station.LightDayStartTime";
+ public static readonly string SetLightDayEndTime = "Station.LightDayEndTime";
+ //换电策略设置:换电标准SOC
+ public static readonly string SetSwapSoc = "Station.SwapSoc";
+ //换电策略设置:充电标准SOC
+ public static readonly string SetFullSoc = "Station.FullSoc";
+ //充电运营模式: 0:手动充电;1:自动充电
+ public static readonly string ChargeType = "Station.ChargeType";
+ //换电运营模式:1:自动;2:手动
+ public static readonly string SwapType = "Station.SwapType";
+ //营业时间:开始时间
+ public static readonly string BusinessStartHours = "Station.BusinessStartHours";
+ //营业时间:结束时间
+ public static readonly string BusinessEndHours = "Station.BusinessEndHours";
+
+
+ #endregion 系统管理-基础设置
+
//选包策略中最后结束充电时间需要>此值
public static readonly string SwapFinishChargeTime = "Station.SwapFinishChargeTime";
diff --git a/Entity/DbModel/Station/ElecPriceModelVersionDetail.cs b/Entity/DbModel/Station/ElecPriceModelVersionDetail.cs
index 528deff..99fabd3 100644
--- a/Entity/DbModel/Station/ElecPriceModelVersionDetail.cs
+++ b/Entity/DbModel/Station/ElecPriceModelVersionDetail.cs
@@ -30,22 +30,36 @@ namespace Entity.DbModel.Station
///
[SugarColumn(ColumnName="version")]
public int Version {get;set;}
-
///
- /// Desc:开始时间
- /// Default:
- /// Nullable:True
+ /// 开始时间:小时
///
- [SugarColumn(ColumnName="start_time")]
- public DateTime? StartTime {get;set;}
-
+ [SugarColumn(ColumnName = "start_hour")]
+ public int StartHour { get; set; }
///
- /// Desc:结束时间
- /// Default:
- /// Nullable:True
+ /// 开始时间:分组
+ ///
+ [SugarColumn(ColumnName = "start_minute")]
+ public int StartMinute { get; set; }
+ ///
+ /// 开始时间:秒
///
- [SugarColumn(ColumnName="end_time")]
- public DateTime? EndTime {get;set;}
+ [SugarColumn(ColumnName = "start_second")]
+ public int StartSecond { get; set; }
+ ///
+ /// 结束时间:小时
+ ///
+ [SugarColumn(ColumnName = "end_hour")]
+ public int EndHour { get; set; }
+ ///
+ /// 结束时间:分钟
+ ///
+ [SugarColumn(ColumnName = "end_minute")]
+ public int EndMinute { get; set; }
+ ///
+ /// 结束时间:秒
+ ///
+ [SugarColumn(ColumnName = "end_second")]
+ public int EndSecond { get; set; }
///
/// Desc:价格;以分为单位存储
@@ -94,6 +108,21 @@ namespace Entity.DbModel.Station
///
[SugarColumn(ColumnName="updated_time")]
public DateTime? UpdatedTime {get;set;}
+
+ ///
+ /// 判断一个时间段是否包含另一个时间段(包括开始和结束时间的秒数)
+ ///
+ ///
+ ///
+ public bool Contains(ElecPriceModelVersionDetail other)
+ {
+ return (other.StartHour < EndHour ||
+ (other.StartHour == EndHour && other.StartMinute < EndMinute) ||
+ (other.StartHour == EndHour && other.StartMinute == EndMinute && other.StartSecond <= EndSecond)) &&
+ (other.EndHour > StartHour ||
+ (other.EndHour == StartHour && other.EndMinute > StartMinute) ||
+ (other.EndHour == StartHour && other.EndMinute == StartMinute && other.EndSecond >= StartSecond));
+ }
}
}
diff --git a/Service/Cloud/Handler/ChargerElectricityPriceModelHandler.cs b/Service/Cloud/Handler/ChargerElectricityPriceModelHandler.cs
index 36ab97c..283085d 100644
--- a/Service/Cloud/Handler/ChargerElectricityPriceModelHandler.cs
+++ b/Service/Cloud/Handler/ChargerElectricityPriceModelHandler.cs
@@ -53,8 +53,12 @@ public class ChargerElectricityPriceModelHandler : IBaseHandler
Version = version.Version,
Price = (int)d.ep * 10000,
Type = d.pr,
- StartTime = d.st,
- EndTime = d.et
+ StartHour = d.st.Hour,
+ StartMinute = d.st.Minute,
+ StartSecond = d.st.Second,
+ EndHour = d.et.Hour,
+ EndMinute = d.et.Minute,
+ EndSecond = d.et.Second
}).ToList();
_detailRepository.Insert(versionDetails);
}
diff --git a/Service/Plc/Client/PlcMgr.cs b/Service/Plc/Client/PlcMgr.cs
index eb997ae..93a3315 100644
--- a/Service/Plc/Client/PlcMgr.cs
+++ b/Service/Plc/Client/PlcMgr.cs
@@ -342,7 +342,7 @@ public class PlcMgr
///
/// 消防移仓
///
- /// 入仓位选择:0-无操作、1-缓存位舱位号、2-20:电池存储仓位
+ /// 入仓位选择
///
public static bool FireProtectionRelocation(ushort entrySelection)
{
diff --git a/Service/Station/ElecPriceModelVersionDetailServices.cs b/Service/Station/ElecPriceModelVersionDetailServices.cs
new file mode 100644
index 0000000..4bc3e15
--- /dev/null
+++ b/Service/Station/ElecPriceModelVersionDetailServices.cs
@@ -0,0 +1,16 @@
+using Entity.DbModel.Station;
+using HybirdFrameworkCore.Autofac.Attribute;
+using Repository.Station;
+
+namespace Service.Station;
+[Scope("SingleInstance")]
+public class ElecPriceModelVersionDetailServices : BaseServices
+{
+ ElecPriceModelVersionDetailRepository _elecPriceModelVersionDetailRepository;
+ public ElecPriceModelVersionDetailServices(ElecPriceModelVersionDetailRepository dal)
+ {
+ _elecPriceModelVersionDetailRepository = dal;
+ BaseDal = dal;
+ }
+}
+
diff --git a/WebStarter/Controllers/BasicConfig/BaseConfigController.cs b/WebStarter/Controllers/BasicConfig/BaseConfigController.cs
index 0079d2b..b61af8d 100644
--- a/WebStarter/Controllers/BasicConfig/BaseConfigController.cs
+++ b/WebStarter/Controllers/BasicConfig/BaseConfigController.cs
@@ -3,10 +3,15 @@ using Microsoft.AspNetCore.Mvc;
using System.ComponentModel;
using System.Text;
using System;
+using System.Reflection;
using Entity.Api.Resp;
+using Entity.DbModel.Station;
+using Entity.DbModel.System.SysBaseObject;
using HybirdFrameworkCore.Entity;
using Microsoft.VisualBasic;
using Newtonsoft.Json.Linq;
+using Service.Station;
+using Service.System;
namespace WebStarter.Controllers.BasicConfig
{
@@ -17,6 +22,14 @@ namespace WebStarter.Controllers.BasicConfig
[Route("api/[controller]")]
public class BaseConfigController
{
+ private readonly SysConfigService _sysConfigService;
+ private readonly ElecPriceModelVersionDetailServices _elecPriceModelVersionDetailServices;
+ public BaseConfigController(SysConfigService sysConfigService, ElecPriceModelVersionDetailServices elecPriceModelVersionDetailServices)
+ {
+ _sysConfigService = sysConfigService;
+ _elecPriceModelVersionDetailServices = elecPriceModelVersionDetailServices;
+ }
+
#region RFID配置
// ///
// /// 预览
@@ -110,14 +123,192 @@ namespace WebStarter.Controllers.BasicConfig
// }
#endregion RFID配置
+ ///
+ /// 获取换电策略设置 、灯光日间时间、充电运营模式、营业时间段、换电运营模式
+ ///
+ [HttpPost("BaseSetStationConfigInfo")]
+ public async Task> BaseSetStationConfigInfo()
+ {
+ BaseSetStationConfigInfo stationBaseInfoResp = new BaseSetStationConfigInfo();
+ List sysConfigs = await _sysConfigService.GetGroupList("Station");
+ foreach (var item in sysConfigs)
+ {
+ switch (item.Code)
+ {
+ case "LightDayStartTime": stationBaseInfoResp.LigthStartTime = item.Value; break;
+ case "LightDayEndTime": stationBaseInfoResp.LigthEndTime = item.Value; break;
+ case "SwapSoc": stationBaseInfoResp.SetSwapSoc = Convert.ToInt32(item.Value); break;
+ case "FullSoc": stationBaseInfoResp.SetFullSoc = Convert.ToInt32(item.Value); break;
+ case "ChargeType": stationBaseInfoResp.ChargeType = Convert.ToInt32(item.Value); break;
+ case "SwapType": stationBaseInfoResp.SwapType = Convert.ToInt32(item.Value); break;
+ case "BusinessStartHours": stationBaseInfoResp.BusinessStartHours = item.Value; break;
+ case "BusinessEndHours": stationBaseInfoResp.BusinessEndHours = item.Value; break;
+ }
+ }
+ return Result.Success(stationBaseInfoResp);
+ }
+
+ ///
+ /// 提交换电策略设置
+ ///
+ ///
+ ///
+ [HttpPost("SetReplacementStrategy")]
+ public async Task> SetReplacementStrategy([FromBody] SetReplacementStrategyReq input)
+ {
+ bool setResult = SetConfigPorperty(input);
+ return Result.Success(setResult);
+ }
+
///
/// 日间时间设置
///
[HttpPost("SetDaytime")]
public async Task> SetDaytime([FromBody] SetDayTimeReq input)
{
+ bool setResult = SetConfigPorperty(input);
+ return Result.Success(setResult);
+ }
+
+ ///
+ /// 充电运营模式 0:手动充电;1:自动充电
+ ///
+ ///
+ ///
+ [HttpPost("SetChargingOperationMode")]
+ public async Task> SetChargingOperationMode([FromBody] SetChargingOperationModeReq input)
+ {
+ bool setResult = SetConfigPorperty(input);
+ return Result.Success(setResult);
+ }
+
+ ///
+ /// 营业时间设置
+ ///
+ ///
+ ///
+ [HttpPost("SetBusinessHours")]
+ public async Task> SetBusinessHours([FromBody] SetBusinessHoursReq input)
+ {
+ bool setResult = SetConfigPorperty(input);
+ return Result.Success(setResult);
+ }
+ ///
+ /// 换电运营模式:1:自动;2:手动
+ ///
+ ///
+ ///
+ [HttpPost("SetSwitchingOperaModeReq")]
+ public async Task> SetSwitchingOperationMode([FromBody] SetSwitchingOperaModeReq input)
+ {
+ bool setResult = SetConfigPorperty(input);
+ return Result.Success(setResult);
+ }
+
+ ///
+ /// 查询电价信息
+ ///
+ /// 版本号
+ ///
+ [HttpGet("GetStationElecPriceInfoList/{version}")]
+ public async Task>> GetStationElecPriceInfoList(int version)
+ {
+ var data = await _elecPriceModelVersionDetailServices.QueryListByClauseAsync(u => u.Version == version);
+ return Result>.Success(data);
+ }
+
+ ///
+ /// 增加电价信息
+ ///
+ ///
+ ///
+ [HttpPost("AddStationElecPriceInfoList")]
+ public async Task> AddStationElecPriceInfoList([FromBody] List model)
+ {
+ if (null==model||model.Count==0)
+ {
+ Result.Fail("参数不能为空");
+ }
+ var queryByClauseAsync = _elecPriceModelVersionDetailServices.QueryByClauseAsync(u => u.Version == model[0].Version);
+ if(queryByClauseAsync!=null)
+ await _elecPriceModelVersionDetailServices.DeleteAsync(i => i.Version ==model[0].Version);
+ if (TimeListIfContains(model))
+ {
+ await _elecPriceModelVersionDetailServices.InsertAsync(model);
+ return Result.Success(true);
+ }
+ return Result.Fail("时间区间重复请检查");
+ }
- return Result.Success();
+
+ ///
+ /// 修改电价信息
+ ///
+ ///
+ ///
+ [HttpPost("UpdateStationElecPriceInfo")]
+ public async Task> UpdateStationElecPriceInfo([FromBody] List model)
+ {
+ if (null==model||model.Count==0)
+ {
+ Result.Fail("参数不能为空");
+ }
+ var queryByClauseAsync = _elecPriceModelVersionDetailServices.QueryByClauseAsync(u => u.Version == model[0].Version);
+ if(queryByClauseAsync!=null)
+ await _elecPriceModelVersionDetailServices.DeleteAsync(i => i.Version ==model[0].Version);
+ if (TimeListIfContains(model))
+ {
+ await _elecPriceModelVersionDetailServices.InsertAsync(model);
+ return Result.Success(true);
+ }
+ return Result.Fail("时间区间重复请检查");
+ }
+
+
+
+
+
+ ///
+ /// List中判断一个时间段是否包含另一个时间段(包括开始和结束时间的秒数)
+ ///
+ ///
+ ///
+ public bool TimeListIfContains(List timePeriods)
+ {
+ bool hasOverlap = false;
+
+ for (int i = 0; i < timePeriods.Count; i++)
+ {
+ for (int j = i + 1; j < timePeriods.Count; j++)
+ {
+ if (timePeriods[i].Contains(timePeriods[j]) || timePeriods[j].Contains(timePeriods[i]))
+ {
+ hasOverlap = true;
+ return hasOverlap;
+ }
+ }
+ }
+ return hasOverlap;
+ }
+
+ ///
+ /// 设置类属性
+ ///
+ ///
+ ///
+ ///
+ public bool SetConfigPorperty(T t)
+ {
+ bool setResult = false;
+ PropertyInfo[] props = typeof(T).GetProperties();
+ foreach (PropertyInfo fieldInfo in props)
+ {
+ string newConstConfigInfo = "Station" + "." + fieldInfo.Name;
+ object getContent = fieldInfo.GetValue(t);
+ if (getContent != null)
+ setResult = _sysConfigService.Set(newConstConfigInfo, getContent);
+ }
+ return setResult;
}
}
}
diff --git a/WebStarter/Controllers/SwapMonitorController.cs b/WebStarter/Controllers/SwapMonitorController.cs
index 5b596f0..1309650 100644
--- a/WebStarter/Controllers/SwapMonitorController.cs
+++ b/WebStarter/Controllers/SwapMonitorController.cs
@@ -126,7 +126,7 @@ public class SwapMonitorController : ControllerBase
[HttpPost("AllLightsOff")]
public async Task> AllLightsOff()
{
- return Result.Success(PlcMgr.AllLightsOff());
+ return PlcMgr.AllLightsOff()? Result.Success(true):Result.Fail();
}
///
@@ -136,16 +136,16 @@ public class SwapMonitorController : ControllerBase
[HttpPost("AllLightsOn")]
public async Task> AllLightsOn()
{
- return Result.Success(PlcMgr.AllLightsOn());
+ return PlcMgr.AllLightsOn()? Result.Success(true):Result.Fail();
}
///
- ///
+ /// 得到现在灯光状态
///
///
[HttpPost("GetNowLightsOn")]
public async Task> GetNowLightsOn()
{
- return Result.Success(PlcMgr.GetNowLightsOn());
+ return Result.Success(PlcMgr.GetNowLightsOn());
}
///