From dd5ec66a5062a78bcf98f4e3128ee41dea7f86c4 Mon Sep 17 00:00:00 2001 From: rszn <645583145@qq.com> Date: Sun, 30 Jun 2024 21:17:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=B3=E4=BA=8E=E6=8D=A2=E7=94=B5=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E7=9A=84=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Service/MyTask/BatteryMoveTask.cs | 1 + .../Controllers/ChargeMonitorController.cs | 23 +++++++++++++++---- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/Service/MyTask/BatteryMoveTask.cs b/Service/MyTask/BatteryMoveTask.cs index ac38e09..9a63c7e 100644 --- a/Service/MyTask/BatteryMoveTask.cs +++ b/Service/MyTask/BatteryMoveTask.cs @@ -62,6 +62,7 @@ public class BatteryMoveTask : ITask { return; } + var binInfo = queryListByClause[0]; Result success = diff --git a/WebStarter/Controllers/ChargeMonitorController.cs b/WebStarter/Controllers/ChargeMonitorController.cs index 18fbe83..95242a8 100644 --- a/WebStarter/Controllers/ChargeMonitorController.cs +++ b/WebStarter/Controllers/ChargeMonitorController.cs @@ -37,7 +37,7 @@ public class ChargeMonitorController /// /// [HttpPost("BinInfoMakeAnAppointment/{binNo}/{amtLock}")] - public async Task> BinInfoMakeAnAppointment(string binNo,int amtLock) + public async Task> BinInfoMakeAnAppointment(string binNo, int amtLock) { BinInfo binInfo = await _binInfoService.QueryByClauseAsync(u => u.No == binNo); if (binInfo == null) @@ -85,7 +85,7 @@ public class ChargeMonitorController public async Task>> ChargePositionQuery( [FromBody] ChargePositionQueryReq chargePositionQueryReq) { - return Result>.Success( await _binInfoService.ChargePositionQuery(chargePositionQueryReq)); + return Result>.Success(await _binInfoService.ChargePositionQuery(chargePositionQueryReq)); } /// @@ -119,8 +119,23 @@ public class ChargeMonitorController [HttpGet("BatteryRelocation")] public async Task> BatteryRelocation(ushort removeBinNo, ushort putBinNo) { - return _monitorService.BatteryRelocation(removeBinNo, putBinNo,1); - } + Result res = Result.Fail(); + try + { + res = _monitorService.BatteryRelocation(removeBinNo, putBinNo, 1); + } + catch (Exception e) + { + if (PlcMgr.PlcClient?.ReadTaskNo() == 2) + { + PlcMgr.PlcClient?.ResetTaskNo(); + } + + + Result.Fail(); + } + + return res; } /// /// 移仓时下拉项 仓位电池状态