From d3d83ec9c863ca88dc897bd781eeff86333a01d0 Mon Sep 17 00:00:00 2001 From: tq <1916474859@qq,com> Date: Fri, 14 Jun 2024 09:45:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=93=E4=BD=8D=E6=89=8B=E5=8A=A8=E9=A2=84?= =?UTF-8?q?=E7=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Entity/DbModel/Station/BinInfo.cs | 2 +- .../Controllers/ChargeMonitorController.cs | 49 +++++++++++++++++++ 2 files changed, 50 insertions(+), 1 deletion(-) 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); + } + + /// /// 充电仓查询:条件:仓位编号 仓位名称 ///