增加上锁接口 启用禁用接口

zw
lxw 6 months ago
parent e903270fa1
commit 8e78621716

@ -1,4 +1,5 @@
using SqlSugar;
using Entity.Base;
using SqlSugar;
namespace Entity.DbModel.Station
{
@ -18,7 +19,7 @@ namespace Entity.DbModel.Station
/// Nullable:False
/// </summary>
[SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnName = "id")]
public int Id { get; set; }
public int? Id { get; set; }
/// <summary>
/// Desc:仓位编号
@ -26,7 +27,7 @@ namespace Entity.DbModel.Station
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "no")]
public string No { get; set; }
public string? No { get; set; }
/// <summary>
/// Desc:仓位编码
@ -34,7 +35,7 @@ namespace Entity.DbModel.Station
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "code")]
public string Code { get; set; }
public string? Code { get; set; }
/// <summary>
/// Desc:仓位名称
@ -42,7 +43,7 @@ namespace Entity.DbModel.Station
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "name")]
public string Name { get; set; }
public string? Name { get; set; }
/// <summary>
/// Desc:在位状态0-不在位1-在位2-无效
@ -50,7 +51,7 @@ namespace Entity.DbModel.Station
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "exists")]
public int Exists { get; set; }
public int? Exists { get; set; }
/// <summary>
/// Desc:电池编号
@ -58,7 +59,7 @@ namespace Entity.DbModel.Station
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "battery_no")]
public string BatteryNo { get; set; }
public string? BatteryNo { get; set; }
/// <summary>
/// Desc:充电机编号
@ -66,7 +67,7 @@ namespace Entity.DbModel.Station
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "charger_no")]
public string ChargerNo { get; set; }
public string? ChargerNo { get; set; }
/// <summary>
/// Desc:充电枪编号
@ -74,7 +75,7 @@ namespace Entity.DbModel.Station
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "charger_gun_no")]
public string ChargerGunNo { get; set; }
public string? ChargerGunNo { get; set; }
/// <summary>
/// Desc:水冷编号
@ -82,7 +83,7 @@ namespace Entity.DbModel.Station
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "water_cool_no")]
public string WaterCoolNo { get; set; }
public string? WaterCoolNo { get; set; }
/// <summary>
/// Desc:是否有电插头;0-无电插头1-有电插头
@ -98,7 +99,7 @@ namespace Entity.DbModel.Station
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "elec_plugin_status")]
public string ElecPluginStatus { get; set; }
public string? ElecPluginStatus { get; set; }
/// <summary>
/// Desc:是否有水插头;0-无水插头1-有水插头
@ -106,7 +107,7 @@ namespace Entity.DbModel.Station
/// Nullable:False
/// </summary>
[SugarColumn(ColumnName = "water_plugin_flag")]
public string WaterPluginFlag { get; set; }
public string? WaterPluginFlag { get; set; }
/// <summary>
/// Desc:预约锁定;0-未锁定1-锁定
@ -114,7 +115,7 @@ namespace Entity.DbModel.Station
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "amt_lock")]
public int AmtLock { get; set; }
public int? AmtLock { get; set; }
/// <summary>
/// Desc:soc
@ -170,15 +171,17 @@ namespace Entity.DbModel.Station
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "created_by")]
public string CreatedBy { get; set; }
public string? CreatedBy { get; set; }
/// <summary>
/// Desc:创建时间
/// Default:CURRENT_TIMESTAMP
/// Nullable:True
/// </summary>
[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;
/// <summary>
/// Desc:更新人
@ -186,7 +189,7 @@ namespace Entity.DbModel.Station
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "updated_by")]
public string UpdatedBy { get; set; }
public string? UpdatedBy { get; set; }
/// <summary>
/// Desc:最后结束充电时间 结束充电后更新
@ -202,25 +205,25 @@ namespace Entity.DbModel.Station
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "updated_time")]
public DateTime? UpdatedTime { get; set; }
public DateTime? UpdatedTime { get; set; }= DateTime.Now;
/// <summary>
/// 缓存仓标记 0:不是 1:是
/// </summary>
[SugarColumn(ColumnName = "cache_bin_flag")]
public int CacheBinFlag { get; set; }
public int? CacheBinFlag { get; set; }
/// <summary>
/// 是否可以换电 0:不可换 1可换
/// </summary>
[SugarColumn(ColumnName = "can_swap_flag")]
public int CanSwapFlag { get; set; }
public int? CanSwapFlag { get; set; }
/// <summary>
/// 是否可以充电 0:不可换 1可换
/// </summary>
[SugarColumn(ColumnName = "can_charge_flag")]
public int CanChargeFlag { get; set; }
public int? CanChargeFlag { get; set; }

@ -98,7 +98,7 @@ public class SwapOrderReportCloudTask : AbstractTaskHandler
updateDbBattery.Add(swapOrderBattery);
}
//TODO::获取本日第几次换
//TODO::获取本日第几次换
var uploadSwapOrder = CloudApi.UploadSwapOrder(swapOrder, 0, swapOrderBattery, 1);
if (uploadSwapOrder == 0)
{

@ -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配置
// /// <summary>
// /// 预览
// /// 车型 的ASCLL、解析后信息
@ -122,6 +127,7 @@ namespace WebStarter.Controllers.BasicConfig
// return Result<List<string>>.Success();
// }
#endregion RFID配置
/// <summary>
@ -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<BaseSetStationConfigInfo>.Success(stationBaseInfoResp);
}
/// <summary>
/// 提交换电策略设置
/// </summary>
@ -198,6 +219,7 @@ namespace WebStarter.Controllers.BasicConfig
bool setResult = SetConfigPorperty(input);
return Result<bool>.Success(setResult);
}
/// <summary>
/// 换电运营模式1:自动2:手动
/// </summary>
@ -230,19 +252,22 @@ namespace WebStarter.Controllers.BasicConfig
[HttpPost("AddStationElecPriceInfoList")]
public async Task<Result<bool>> AddStationElecPriceInfoList([FromBody] List<ElecPriceModelVersionDetail> model)
{
if (null==model||model.Count==0)
if (null == model || model.Count == 0)
{
Result<bool>.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<bool>.Success(true);
}
return Result<bool>.Fail("时间区间重复请检查");
return Result<bool>.Fail("时间区间重复请检查");
}
@ -254,23 +279,23 @@ namespace WebStarter.Controllers.BasicConfig
[HttpPost("UpdateStationElecPriceInfo")]
public async Task<Result<bool>> UpdateStationElecPriceInfo([FromBody] List<ElecPriceModelVersionDetail> model)
{
if (null==model||model.Count==0)
if (null == model || model.Count == 0)
{
Result<bool>.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<bool>.Success(true);
}
return Result<bool>.Fail("时间区间重复请检查");
}
return Result<bool>.Fail("时间区间重复请检查");
}
/// <summary>
@ -294,6 +319,7 @@ namespace WebStarter.Controllers.BasicConfig
}
}
}
return hasOverlap;
}
@ -314,6 +340,7 @@ namespace WebStarter.Controllers.BasicConfig
if (getContent != null)
setResult = _sysConfigService.Set(newConstConfigInfo, getContent);
}
return setResult;
}
}

@ -35,14 +35,20 @@ public class BinInfoController : ControllerBase
/// <param name="putBinNo"></param>
/// <returns></returns>
[HttpGet("UpdateCanChargeFlag/{id}/{flag}")]
public async Task<Result<bool>> UpdateCanChargeFlag(int id, int flag)
public Result<bool> UpdateCanChargeFlag(int id, int flag)
{
BinInfo binInfo = new BinInfo()
_BinInfoRepository.Update(it=>it.CanChargeFlag==flag,it=>it.Id==id);
return Result<bool>.Success();
}
[HttpGet("insert")]
public Result<bool> insert()
{
_BinInfoRepository.Insert(new BinInfo()
{
Id = id,
CanChargeFlag = flag
};
_BinInfoRepository.Update(binInfo);
No = "10"
});
BinInfo queryByClause = _BinInfoRepository.QueryByClause(i=>i.Id==16);
return Result<bool>.Success();
}
@ -58,12 +64,8 @@ public class BinInfoController : ControllerBase
[HttpGet("UpdateCanSwapFlag/{id}/{flag}")]
public async Task<Result<bool>> 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<bool>.Success();
}

Loading…
Cancel
Save