From 8e78621716112f828acd2e16580d50cfe1ac35d6 Mon Sep 17 00:00:00 2001 From: lxw Date: Thu, 30 May 2024 15:57:10 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=B8=8A=E9=94=81=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=20=20=E5=90=AF=E7=94=A8=E7=A6=81=E7=94=A8=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Entity/DbModel/Station/BinInfo.cs | 47 ++++---- .../MyTask/SwapOrderReportCloudTask.cs | 2 +- .../BasicConfig/BaseConfigController.cs | 103 +++++++++++------- WebStarter/Controllers/BinInfoController.cs | 26 +++-- 4 files changed, 105 insertions(+), 73 deletions(-) diff --git a/Entity/DbModel/Station/BinInfo.cs b/Entity/DbModel/Station/BinInfo.cs index 1a7f2f9..f9f53a5 100644 --- a/Entity/DbModel/Station/BinInfo.cs +++ b/Entity/DbModel/Station/BinInfo.cs @@ -1,4 +1,5 @@ -using SqlSugar; +using Entity.Base; +using SqlSugar; namespace Entity.DbModel.Station { @@ -6,7 +7,7 @@ namespace Entity.DbModel.Station ///仓位信息表 /// [SugarTable("bin_info")] - public partial class BinInfo + public partial class BinInfo { public BinInfo() { @@ -18,7 +19,7 @@ namespace Entity.DbModel.Station /// Nullable:False /// [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnName = "id")] - public int Id { get; set; } + public int? Id { get; set; } /// /// Desc:仓位编号 @@ -26,7 +27,7 @@ namespace Entity.DbModel.Station /// Nullable:True /// [SugarColumn(ColumnName = "no")] - public string No { get; set; } + public string? No { get; set; } /// /// Desc:仓位编码 @@ -34,7 +35,7 @@ namespace Entity.DbModel.Station /// Nullable:True /// [SugarColumn(ColumnName = "code")] - public string Code { get; set; } + public string? Code { get; set; } /// /// Desc:仓位名称 @@ -42,7 +43,7 @@ namespace Entity.DbModel.Station /// Nullable:True /// [SugarColumn(ColumnName = "name")] - public string Name { get; set; } + public string? Name { get; set; } /// /// Desc:在位状态:0-不在位;1-在位;2-无效 @@ -50,7 +51,7 @@ namespace Entity.DbModel.Station /// Nullable:True /// [SugarColumn(ColumnName = "exists")] - public int Exists { get; set; } + public int? Exists { get; set; } /// /// Desc:电池编号 @@ -58,7 +59,7 @@ namespace Entity.DbModel.Station /// Nullable:True /// [SugarColumn(ColumnName = "battery_no")] - public string BatteryNo { get; set; } + public string? BatteryNo { get; set; } /// /// Desc:充电机编号 @@ -66,7 +67,7 @@ namespace Entity.DbModel.Station /// Nullable:True /// [SugarColumn(ColumnName = "charger_no")] - public string ChargerNo { get; set; } + public string? ChargerNo { get; set; } /// /// Desc:充电枪编号 @@ -74,7 +75,7 @@ namespace Entity.DbModel.Station /// Nullable:True /// [SugarColumn(ColumnName = "charger_gun_no")] - public string ChargerGunNo { get; set; } + public string? ChargerGunNo { get; set; } /// /// Desc:水冷编号 @@ -82,7 +83,7 @@ namespace Entity.DbModel.Station /// Nullable:True /// [SugarColumn(ColumnName = "water_cool_no")] - public string WaterCoolNo { get; set; } + public string? WaterCoolNo { get; set; } /// /// Desc:是否有电插头;0-无电插头;1-有电插头 @@ -98,7 +99,7 @@ namespace Entity.DbModel.Station /// Nullable:True /// [SugarColumn(ColumnName = "elec_plugin_status")] - public string ElecPluginStatus { get; set; } + public string? ElecPluginStatus { get; set; } /// /// Desc:是否有水插头;0-无水插头;1-有水插头 @@ -106,7 +107,7 @@ namespace Entity.DbModel.Station /// Nullable:False /// [SugarColumn(ColumnName = "water_plugin_flag")] - public string WaterPluginFlag { get; set; } + public string? WaterPluginFlag { get; set; } /// /// Desc:预约锁定;0-未锁定;1-锁定 @@ -114,7 +115,7 @@ namespace Entity.DbModel.Station /// Nullable:True /// [SugarColumn(ColumnName = "amt_lock")] - public int AmtLock { get; set; } + public int? AmtLock { get; set; } /// /// Desc:soc @@ -170,15 +171,17 @@ namespace Entity.DbModel.Station /// Nullable:True /// [SugarColumn(ColumnName = "created_by")] - public string CreatedBy { get; set; } + public string? CreatedBy { get; set; } /// /// Desc:创建时间 /// Default:CURRENT_TIMESTAMP /// Nullable:True /// - [SugarColumn(ColumnName = "created_time")] - public DateTime? CreatedTime { get; set; } + /// [SugarColumn(IsPrimaryKey = false, , ColumnDescription = "创建时间")] + [SugarColumn(ColumnName = "created_time", IsOnlyIgnoreUpdate = true)] + public DateTime? CreatedTime { get; set; }= DateTime.Now; + /// /// Desc:更新人 @@ -186,7 +189,7 @@ namespace Entity.DbModel.Station /// Nullable:True /// [SugarColumn(ColumnName = "updated_by")] - public string UpdatedBy { get; set; } + public string? UpdatedBy { get; set; } /// /// Desc:最后结束充电时间 结束充电后更新 @@ -202,25 +205,25 @@ namespace Entity.DbModel.Station /// Nullable:True /// [SugarColumn(ColumnName = "updated_time")] - public DateTime? UpdatedTime { get; set; } + public DateTime? UpdatedTime { get; set; }= DateTime.Now; /// /// 缓存仓标记 0:不是 1:是 /// [SugarColumn(ColumnName = "cache_bin_flag")] - public int CacheBinFlag { get; set; } + public int? CacheBinFlag { get; set; } /// /// 是否可以换电 0:不可换 1:可换 /// [SugarColumn(ColumnName = "can_swap_flag")] - public int CanSwapFlag { get; set; } + public int? CanSwapFlag { get; set; } /// /// 是否可以充电 0:不可换 1:可换 /// [SugarColumn(ColumnName = "can_charge_flag")] - public int CanChargeFlag { get; set; } + public int? CanChargeFlag { get; set; } diff --git a/Service/BusinessTask/MyTask/SwapOrderReportCloudTask.cs b/Service/BusinessTask/MyTask/SwapOrderReportCloudTask.cs index daa0631..ef81278 100644 --- a/Service/BusinessTask/MyTask/SwapOrderReportCloudTask.cs +++ b/Service/BusinessTask/MyTask/SwapOrderReportCloudTask.cs @@ -98,7 +98,7 @@ public class SwapOrderReportCloudTask : AbstractTaskHandler updateDbBattery.Add(swapOrderBattery); } - //TODO::获取本日第几次换点 + //TODO::获取本日第几次换电 var uploadSwapOrder = CloudApi.UploadSwapOrder(swapOrder, 0, swapOrderBattery, 1); if (uploadSwapOrder == 0) { diff --git a/WebStarter/Controllers/BasicConfig/BaseConfigController.cs b/WebStarter/Controllers/BasicConfig/BaseConfigController.cs index 801db85..4e6cb0f 100644 --- a/WebStarter/Controllers/BasicConfig/BaseConfigController.cs +++ b/WebStarter/Controllers/BasicConfig/BaseConfigController.cs @@ -25,13 +25,18 @@ namespace WebStarter.Controllers.BasicConfig private readonly SysConfigService _sysConfigService; private readonly ElecPriceModelVersionDetailServices _elecPriceModelVersionDetailServices; private readonly ElecPriceModelVersionService _elecPriceModelVersionService; - public BaseConfigController(SysConfigService sysConfigService, ElecPriceModelVersionDetailServices elecPriceModelVersionDetailServices) + + public BaseConfigController(SysConfigService sysConfigService, + ElecPriceModelVersionDetailServices elecPriceModelVersionDetailServices, + ElecPriceModelVersionService priceModelVersionService) { _sysConfigService = sysConfigService; _elecPriceModelVersionDetailServices = elecPriceModelVersionDetailServices; + _elecPriceModelVersionService = priceModelVersionService; } - + #region RFID配置 + // /// // /// 预览 // /// 车型 的ASCLL、解析后信息 @@ -122,6 +127,7 @@ namespace WebStarter.Controllers.BasicConfig // return Result>.Success(); // } + #endregion RFID配置 /// @@ -136,23 +142,38 @@ namespace WebStarter.Controllers.BasicConfig { 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; + 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; } } - stationBaseInfoResp.Version=await _elecPriceModelVersionService.GetNowVersion(); + + stationBaseInfoResp.Version = await _elecPriceModelVersionService.GetNowVersion(); return Result.Success(stationBaseInfoResp); } - - - - + + /// /// 提交换电策略设置 /// @@ -164,7 +185,7 @@ namespace WebStarter.Controllers.BasicConfig bool setResult = SetConfigPorperty(input); return Result.Success(setResult); } - + /// /// 日间时间设置 /// @@ -174,7 +195,7 @@ namespace WebStarter.Controllers.BasicConfig bool setResult = SetConfigPorperty(input); return Result.Success(setResult); } - + /// /// 充电运营模式 0:手动充电;1:自动充电 /// @@ -186,7 +207,7 @@ namespace WebStarter.Controllers.BasicConfig bool setResult = SetConfigPorperty(input); return Result.Success(setResult); } - + /// /// 营业时间设置 /// @@ -198,6 +219,7 @@ namespace WebStarter.Controllers.BasicConfig bool setResult = SetConfigPorperty(input); return Result.Success(setResult); } + /// /// 换电运营模式:1:自动;2:手动 /// @@ -209,7 +231,7 @@ namespace WebStarter.Controllers.BasicConfig bool setResult = SetConfigPorperty(input); return Result.Success(setResult); } - + /// /// 查询电价信息 /// @@ -221,7 +243,7 @@ namespace WebStarter.Controllers.BasicConfig var data = await _elecPriceModelVersionDetailServices.QueryListByClauseAsync(u => u.Version == version); return Result>.Success(data); } - + /// /// 增加电价信息 /// @@ -230,22 +252,25 @@ namespace WebStarter.Controllers.BasicConfig [HttpPost("AddStationElecPriceInfoList")] public async Task> AddStationElecPriceInfoList([FromBody] List model) { - if (null==model||model.Count==0) + 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); + + 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.Fail("时间区间重复请检查"); } - + /// /// 修改电价信息 /// @@ -254,25 +279,25 @@ namespace WebStarter.Controllers.BasicConfig [HttpPost("UpdateStationElecPriceInfo")] public async Task> UpdateStationElecPriceInfo([FromBody] List model) { - if (null==model||model.Count==0) + 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); + + 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.Fail("时间区间重复请检查"); } - - - /// /// List中判断一个时间段是否包含另一个时间段(包括开始和结束时间的秒数) /// @@ -287,13 +312,14 @@ namespace WebStarter.Controllers.BasicConfig { for (int j = i + 1; j < timePeriods.Count; j++) { - if (timePeriods[i].Contains(timePeriods[j]) || timePeriods[j].Contains(timePeriods[i])) - { - hasOverlap = true; + if (timePeriods[i].Contains(timePeriods[j]) || timePeriods[j].Contains(timePeriods[i])) + { + hasOverlap = true; return hasOverlap; } } } + return hasOverlap; } @@ -314,7 +340,8 @@ namespace WebStarter.Controllers.BasicConfig if (getContent != null) setResult = _sysConfigService.Set(newConstConfigInfo, getContent); } + return setResult; } } -} +} \ No newline at end of file diff --git a/WebStarter/Controllers/BinInfoController.cs b/WebStarter/Controllers/BinInfoController.cs index 70764f5..a86e712 100644 --- a/WebStarter/Controllers/BinInfoController.cs +++ b/WebStarter/Controllers/BinInfoController.cs @@ -35,14 +35,20 @@ public class BinInfoController : ControllerBase /// /// [HttpGet("UpdateCanChargeFlag/{id}/{flag}")] - public async Task> UpdateCanChargeFlag(int id, int flag) + public Result UpdateCanChargeFlag(int id, int flag) { - BinInfo binInfo = new BinInfo() + _BinInfoRepository.Update(it=>it.CanChargeFlag==flag,it=>it.Id==id); + return Result.Success(); + } + + [HttpGet("insert")] + public Result insert() + { + _BinInfoRepository.Insert(new BinInfo() { - Id = id, - CanChargeFlag = flag - }; - _BinInfoRepository.Update(binInfo); + No = "10" + }); + BinInfo queryByClause = _BinInfoRepository.QueryByClause(i=>i.Id==16); return Result.Success(); } @@ -58,12 +64,8 @@ public class BinInfoController : ControllerBase [HttpGet("UpdateCanSwapFlag/{id}/{flag}")] public async Task> UpdateCanSwapFlag(int id, int flag) { - BinInfo binInfo = new BinInfo() - { - Id = id, - CanSwapFlag = flag - }; - _BinInfoRepository.Update(binInfo); + + _BinInfoRepository.Update(it=>it.CanSwapFlag==flag,it=>it.Id==id); return Result.Success(); }