diff --git a/Entity/DbModel/Station/BinInfo.cs b/Entity/DbModel/Station/BinInfo.cs index f6f3a84..a57d71c 100644 --- a/Entity/DbModel/Station/BinInfo.cs +++ b/Entity/DbModel/Station/BinInfo.cs @@ -197,7 +197,7 @@ namespace Entity.DbModel.Station /// /// 电池入仓时间 /// - [SugarColumn(ColumnName = "int_time")] + [SugarColumn(ColumnName = "in_time")] public DateTime? InTime { get; set; } } } \ No newline at end of file diff --git a/WebStarter/Controllers/ChargeMonitorController.cs b/WebStarter/Controllers/ChargeMonitorController.cs index c70fdd4..8e66d29 100644 --- a/WebStarter/Controllers/ChargeMonitorController.cs +++ b/WebStarter/Controllers/ChargeMonitorController.cs @@ -28,7 +28,56 @@ public class ChargeMonitorController _binInfoService = binInfoService; _monitorService = monitorService; } + + /// + /// 仓位预约 + /// + /// 仓位 + /// + /// + /// + [HttpPost("BinInfoMakeAnAppointment/{binNo}/{amtLock}")] + public async Task> BinInfoMakeAnAppointment(string binNo,int amtLock) + { + BinInfo binInfo = await _binInfoService.QueryByClauseAsync(u => u.No == binNo); + if (binInfo == null) + throw new Exception("充电仓不存在"); + binInfo.AmtLock = amtLock; + bool result = await _binInfoService.UpdateAsync(binInfo); + if (result) + return Result.Success(result); + else + return Result.Fail(result); + } + + /// + /// 修改仓位电池编码 + /// + /// + /// + /// + /// + [HttpPost("UpdateBatteryNo/{binNo}/{batteryNo}")] + public async Task> UpdateBatteryNo(string binNo, string batteryNo) + { + BinInfo binInfo = await _binInfoService.QueryByClauseAsync(u => u.No == binNo); + if (binInfo == null) + throw new Exception("充电仓不存在"); + BinInfo binInfoBatteryNo = await _binInfoService.QueryByClauseAsync(u => u.BatteryNo == batteryNo); + if (binInfoBatteryNo != null) + { + throw new Exception("已存在相同电池编码"); + } + binInfo.BatteryNo = batteryNo; + bool result = await _binInfoService.UpdateAsync(binInfo); + if (result) + return Result.Success(result); + else + return Result.Fail(result); + } + + /// /// 充电仓查询:条件:仓位编号 仓位名称 ///