From 6abe7bf5c66a67c20887f07bfcdb376cdde802f2 Mon Sep 17 00:00:00 2001 From: SoulStar Date: Thu, 26 Sep 2024 11:07:09 +0800 Subject: [PATCH] =?UTF-8?q?add=20-=20=E6=B7=BB=E5=8A=A0AGV=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../base/BaseStateRefreshBusiness.cs | 2 +- SlnMesnac.TouchSocket/AirPorthttpClient.cs | 110 +++++++++++++++--- 2 files changed, 94 insertions(+), 18 deletions(-) diff --git a/SlnMesnac.Business/base/BaseStateRefreshBusiness.cs b/SlnMesnac.Business/base/BaseStateRefreshBusiness.cs index 6977a54..721e974 100644 --- a/SlnMesnac.Business/base/BaseStateRefreshBusiness.cs +++ b/SlnMesnac.Business/base/BaseStateRefreshBusiness.cs @@ -31,7 +31,7 @@ namespace SlnMesnac.Business.@base { try { - var response = AirPorthttpClient.AGVStateRequest(); + var response = AirPorthttpClient.AGVAllStateRequest(); _AGVStateService.UpdateOrAddByResponse(response); } catch (Exception e) diff --git a/SlnMesnac.TouchSocket/AirPorthttpClient.cs b/SlnMesnac.TouchSocket/AirPorthttpClient.cs index eb2b10d..28177a6 100644 --- a/SlnMesnac.TouchSocket/AirPorthttpClient.cs +++ b/SlnMesnac.TouchSocket/AirPorthttpClient.cs @@ -31,7 +31,6 @@ namespace SlnMesnac.TouchSocket } public static WebApiClient AirportAGVClient; - public static WebApiClient AirportManipulatorClient; private WebApiClient CreateWebApiClient(string IpHost) { @@ -63,25 +62,14 @@ namespace SlnMesnac.TouchSocket return Task.CompletedTask; } - /// - /// - /// - /// - public static string AGVCallRequest() - { - JToken responseValue = AirportAGVClient.InvokeT("POST:", null, new AGVSingalEntity()); - - return responseValue.ToString(); - } - /// /// AGV下发任务请求 /// /// /// - public static AGVResponseEntity AGVAddTaskRequest(AGVRequestAddTaskEntity addTaskEntity) + public static AGVResponseEntity AGVAddTaskRequest(AGVRequestAddTaskEntity requestValue) { - JToken responseValue = AirportAGVClient.InvokeT("POST:/api/task/addTask", null, addTaskEntity); + JToken responseValue = AirportAGVClient.InvokeT("POST:/api/task/addTask", null, requestValue); if (responseValue == null) { return new AGVResponseEntity(); @@ -96,15 +84,57 @@ namespace SlnMesnac.TouchSocket return responseEntity; } + /// + /// 取消/终止任务请求 + /// + /// + public static AGVResponseEntity AGVOperationalTaskRequest(AGVRequestOperationalTaskEntity requestValue) + { + JToken responseValue = AirportAGVClient.InvokeT("POST:/api/task/operationalTask", null, requestValue); + if (responseValue == null) + { + return new AGVResponseEntity(); + } + string json = responseValue.ToString(); + if (string.IsNullOrEmpty(json)) + { + return new AGVResponseEntity(); + } + AGVResponseEntity responseEntity; + responseEntity = JsonSerializer.Deserialize>(json); + return responseEntity; + } /// - /// 获取AGV所有信息 + /// 查询任务状态请求 /// /// /// - public static AGVResponseEntity> AGVStateRequest() + public static AGVResponseEntity AGVGetTaskStateDetailRequest(AGVRequestTaskStateDetailEntity requestValue) { - JToken responseValue = AirportAGVClient.InvokeT("GET:http://192.168.40.81:5102/api/task/robot/getRobot", null); + JToken responseValue = AirportAGVClient.InvokeT("PUT:/api/task/getTaskStateDetail", null, requestValue); + if (responseValue == null) + { + return new AGVResponseEntity(); + } + string json = responseValue.ToString(); + if (string.IsNullOrEmpty(json)) + { + return new AGVResponseEntity(); + } + AGVResponseEntity ResponseEntity; + ResponseEntity = JsonSerializer.Deserialize>(json); + return ResponseEntity; + } + + /// + /// 获取所有AGV信息请求 + /// + /// + /// + public static AGVResponseEntity> AGVAllStateRequest() + { + JToken responseValue = AirportAGVClient.InvokeT("GET:/api/task/robot/getRobot", null); if (responseValue == null) { return new AGVResponseEntity>(); @@ -118,6 +148,52 @@ namespace SlnMesnac.TouchSocket ResponseEntity = JsonSerializer.Deserialize>>(json); return ResponseEntity; } + + /// + /// 获取当前激活地图信息请求 + /// + /// + /// + public static AGVResponseEntity AGVMapActiveRequest() + { + JToken responseValue = AirportAGVClient.InvokeT("GET:/api/v1.0.0/Maps/mapActive", null); + if (responseValue == null) + { + return new AGVResponseEntity(); + } + string json = responseValue.ToString(); + if (string.IsNullOrEmpty(json)) + { + return new AGVResponseEntity(); + } + AGVResponseEntity ResponseEntity; + ResponseEntity = JsonSerializer.Deserialize>(json); + return ResponseEntity; + } + + /// + /// 获取当前地图所有位置点请求 + /// + /// + /// + public static AGVResponseEntity> AGVMapPositionRequest(string requestValue) + { + JToken responseValue = AirportAGVClient.InvokeT("GET:/api/v1.0.0/Positions?mapId={0}", null, requestValue); + if (responseValue == null) + { + return new AGVResponseEntity>(); + } + string json = responseValue.ToString(); + if (string.IsNullOrEmpty(json)) + { + return new AGVResponseEntity>(); + } + AGVResponseEntity> ResponseEntity; + ResponseEntity = JsonSerializer.Deserialize>>(json); + return ResponseEntity; + } + + } }