|
|
|
@ -127,18 +127,26 @@ namespace SlnMesnac.TouchSocket
|
|
|
|
|
///
|
|
|
|
|
public AGVResponseEntity<ResponseAddTaskDataEntity> AGVAddTaskRequest(AGVRequestAddTaskEntity requestValue)
|
|
|
|
|
{
|
|
|
|
|
if (_httpClient == null)
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
_logger.LogError("http服务为空");
|
|
|
|
|
if (_httpClient == null)
|
|
|
|
|
{
|
|
|
|
|
_logger.LogError("http服务为空");
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
//序列化输入数据
|
|
|
|
|
string json = Newtonsoft.Json.JsonConvert.SerializeObject(requestValue);
|
|
|
|
|
var context = new StringContent(json, Encoding.UTF8, "application/json");
|
|
|
|
|
var httpContent = _httpClient.PostAsync($"{Url}/api/task/addTask", context).ConfigureAwait(false).GetAwaiter().GetResult().Content;
|
|
|
|
|
string result = httpContent.ReadAsStringAsync().ConfigureAwait(false).GetAwaiter().GetResult();
|
|
|
|
|
//JToken responseValue = AirportAGVClient.InvokeT<JToken>("POST:/api/task/addTask", null, requestValue);
|
|
|
|
|
return JsonStringToEntity<ResponseAddTaskDataEntity>(result);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
_logger.LogError($"AGV下发任务请求接口异常 {ex.Message}");
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
//序列化输入数据
|
|
|
|
|
string json = Newtonsoft.Json.JsonConvert.SerializeObject(requestValue);
|
|
|
|
|
var context = new StringContent(json, Encoding.UTF8, "application/json");
|
|
|
|
|
var httpContent = _httpClient.PostAsync($"{Url}/api/task/addTask", context).ConfigureAwait(false).GetAwaiter().GetResult().Content;
|
|
|
|
|
string result = httpContent.ReadAsStringAsync().ConfigureAwait(false).GetAwaiter().GetResult();
|
|
|
|
|
//JToken responseValue = AirportAGVClient.InvokeT<JToken>("POST:/api/task/addTask", null, requestValue);
|
|
|
|
|
return JsonStringToEntity<ResponseAddTaskDataEntity>(result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -148,18 +156,27 @@ namespace SlnMesnac.TouchSocket
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public AGVResponseEntity<object> AGVOperationalTaskRequest(AGVRequestOperationalTaskEntity requestValue)
|
|
|
|
|
{
|
|
|
|
|
if (_httpClient == null)
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
_logger.LogError("http服务为空");
|
|
|
|
|
|
|
|
|
|
if (_httpClient == null)
|
|
|
|
|
{
|
|
|
|
|
_logger.LogError("http服务为空");
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
//序列化输入数据
|
|
|
|
|
string json = Newtonsoft.Json.JsonConvert.SerializeObject(requestValue);
|
|
|
|
|
var context = new StringContent(json, Encoding.UTF8, "application/json");
|
|
|
|
|
var httpContent = _httpClient.PostAsync($"{Url}/api/task/operationalTask", context).ConfigureAwait(false).GetAwaiter().GetResult().Content;
|
|
|
|
|
string result = httpContent.ReadAsStringAsync().ConfigureAwait(false).GetAwaiter().GetResult();
|
|
|
|
|
//JToken responseValue = AirportAGVClient.InvokeT<JToken>("POST:/api/task/operationalTask", null, requestValue);
|
|
|
|
|
return JsonStringToEntity<object>(result);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
_logger.LogError($"取消/终止任务请求接口异常 {ex.Message}");
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
//序列化输入数据
|
|
|
|
|
string json = Newtonsoft.Json.JsonConvert.SerializeObject(requestValue);
|
|
|
|
|
var context = new StringContent(json, Encoding.UTF8, "application/json");
|
|
|
|
|
var httpContent = _httpClient.PostAsync($"{Url}/api/task/operationalTask", context).ConfigureAwait(false).GetAwaiter().GetResult().Content;
|
|
|
|
|
string result = httpContent.ReadAsStringAsync().ConfigureAwait(false).GetAwaiter().GetResult();
|
|
|
|
|
//JToken responseValue = AirportAGVClient.InvokeT<JToken>("POST:/api/task/operationalTask", null, requestValue);
|
|
|
|
|
return JsonStringToEntity<object>(result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -169,18 +186,27 @@ namespace SlnMesnac.TouchSocket
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public AGVResponseEntity<ResponseTaskStateDetailDataEntity> AGVGetTaskStateDetailRequest(AGVRequestTaskStateDetailEntity requestValue)
|
|
|
|
|
{
|
|
|
|
|
if (_httpClient == null)
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
_logger.LogError("http服务为空");
|
|
|
|
|
|
|
|
|
|
if (_httpClient == null)
|
|
|
|
|
{
|
|
|
|
|
_logger.LogError("http服务为空");
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
//序列化输入数据
|
|
|
|
|
string json = Newtonsoft.Json.JsonConvert.SerializeObject(requestValue);
|
|
|
|
|
var context = new StringContent(json, Encoding.UTF8, "application/json");
|
|
|
|
|
var httpContent = _httpClient.PutAsync($"{Url}/api/task/getTaskStateDetail", context).ConfigureAwait(false).GetAwaiter().GetResult().Content;
|
|
|
|
|
string result = httpContent.ReadAsStringAsync().ConfigureAwait(false).GetAwaiter().GetResult();
|
|
|
|
|
//JToken responseValue = AirportAGVClient.InvokeT<JToken>("PUT:/api/task/getTaskStateDetail", null, requestValue);
|
|
|
|
|
return JsonStringToEntity<ResponseTaskStateDetailDataEntity>(result);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
_logger.LogError($"查询任务状态接口异常 {ex.Message}");
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
//序列化输入数据
|
|
|
|
|
string json = Newtonsoft.Json.JsonConvert.SerializeObject(requestValue);
|
|
|
|
|
var context = new StringContent(json, Encoding.UTF8, "application/json");
|
|
|
|
|
var httpContent = _httpClient.PutAsync($"{Url}/api/task/getTaskStateDetail", context).ConfigureAwait(false).GetAwaiter().GetResult().Content;
|
|
|
|
|
string result = httpContent.ReadAsStringAsync().ConfigureAwait(false).GetAwaiter().GetResult();
|
|
|
|
|
//JToken responseValue = AirportAGVClient.InvokeT<JToken>("PUT:/api/task/getTaskStateDetail", null, requestValue);
|
|
|
|
|
return JsonStringToEntity<ResponseTaskStateDetailDataEntity>(result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -189,16 +215,25 @@ namespace SlnMesnac.TouchSocket
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public AGVResponseEntity<List<ResponseRobotAtrributeDataEntity>> AGVAllStateRequest()
|
|
|
|
|
{
|
|
|
|
|
if (_httpClient == null)
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (_httpClient == null)
|
|
|
|
|
{
|
|
|
|
|
_logger.LogError("http服务为空");
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
//序列化输入数据
|
|
|
|
|
var httpContent = _httpClient.GetAsync($"{Url}/api/task/robot/getRobot").ConfigureAwait(false).GetAwaiter().GetResult().Content;
|
|
|
|
|
string result = httpContent.ReadAsStringAsync().ConfigureAwait(false).GetAwaiter().GetResult();
|
|
|
|
|
//JToken responseValue = AirportAGVClient.InvokeT<JToken>("GET:/api/task/robot/getRobot", null);
|
|
|
|
|
return JsonStringToEntity<List<ResponseRobotAtrributeDataEntity>>(result);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
_logger.LogError("http服务为空");
|
|
|
|
|
_logger.LogError($"获取所有AGV信息接口异常 {ex.Message}");
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
//序列化输入数据
|
|
|
|
|
var httpContent = _httpClient.GetAsync($"{Url}/api/task/robot/getRobot").ConfigureAwait(false).GetAwaiter().GetResult().Content;
|
|
|
|
|
string result = httpContent.ReadAsStringAsync().ConfigureAwait(false).GetAwaiter().GetResult();
|
|
|
|
|
//JToken responseValue = AirportAGVClient.InvokeT<JToken>("GET:/api/task/robot/getRobot", null);
|
|
|
|
|
return JsonStringToEntity<List<ResponseRobotAtrributeDataEntity>>(result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -207,15 +242,24 @@ namespace SlnMesnac.TouchSocket
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public AGVResponseEntity<ResponseActiveMapDataEntity> AGVMapActiveRequest()
|
|
|
|
|
{
|
|
|
|
|
if (_httpClient == null)
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (_httpClient == null)
|
|
|
|
|
{
|
|
|
|
|
_logger.LogError("http服务为空");
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
var httpContent = _httpClient.GetAsync($"{Url}/api/v1.0.0/Maps/mapActive").ConfigureAwait(false).GetAwaiter().GetResult().Content;
|
|
|
|
|
string result = httpContent.ReadAsStringAsync().ConfigureAwait(false).GetAwaiter().GetResult();
|
|
|
|
|
//JToken responseValue = AirportAGVClient.InvokeT<JToken>("GET:/api/v1.0.0/Maps/mapActive", null);
|
|
|
|
|
return JsonStringToEntity<ResponseActiveMapDataEntity>(result);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
_logger.LogError("http服务为空");
|
|
|
|
|
_logger.LogError($"互殴当前激活地图接口异常 {ex.Message}");
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
var httpContent = _httpClient.GetAsync($"{Url}/api/v1.0.0/Maps/mapActive").ConfigureAwait(false).GetAwaiter().GetResult().Content;
|
|
|
|
|
string result = httpContent.ReadAsStringAsync().ConfigureAwait(false).GetAwaiter().GetResult();
|
|
|
|
|
//JToken responseValue = AirportAGVClient.InvokeT<JToken>("GET:/api/v1.0.0/Maps/mapActive", null);
|
|
|
|
|
return JsonStringToEntity<ResponseActiveMapDataEntity>(result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -225,18 +269,27 @@ namespace SlnMesnac.TouchSocket
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public AGVResponseEntity<List<ResponseMapPositionDataEntity>> AGVMapPositionRequest(string requestValue)
|
|
|
|
|
{
|
|
|
|
|
if (_httpClient == null)
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (_httpClient == null)
|
|
|
|
|
{
|
|
|
|
|
_logger.LogError("http服务为空");
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
//序列化输入数据
|
|
|
|
|
string json = Newtonsoft.Json.JsonConvert.SerializeObject(requestValue);
|
|
|
|
|
var context = new StringContent(json, Encoding.UTF8, "application/json");
|
|
|
|
|
var httpContent = _httpClient.GetAsync($"{Url}/api/v1.0.0/Positions?mapId={requestValue}").ConfigureAwait(false).GetAwaiter().GetResult().Content;
|
|
|
|
|
string result = httpContent.ReadAsStringAsync().ConfigureAwait(false).GetAwaiter().GetResult();
|
|
|
|
|
//JToken responseValue = AirportAGVClient.InvokeT<JToken>("GET:/api/v1.0.0/Positions?mapId={0}", null, requestValue);
|
|
|
|
|
return JsonStringToEntity<List<ResponseMapPositionDataEntity>>(result);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
_logger.LogError("http服务为空");
|
|
|
|
|
_logger.LogError($"获取当前地图所有位置点接口异常 {ex.Message}");
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
//序列化输入数据
|
|
|
|
|
string json = Newtonsoft.Json.JsonConvert.SerializeObject(requestValue);
|
|
|
|
|
var context = new StringContent(json, Encoding.UTF8, "application/json");
|
|
|
|
|
var httpContent = _httpClient.GetAsync($"{Url}/api/v1.0.0/Positions?mapId={requestValue}").ConfigureAwait(false).GetAwaiter().GetResult().Content;
|
|
|
|
|
string result = httpContent.ReadAsStringAsync().ConfigureAwait(false).GetAwaiter().GetResult();
|
|
|
|
|
//JToken responseValue = AirportAGVClient.InvokeT<JToken>("GET:/api/v1.0.0/Positions?mapId={0}", null, requestValue);
|
|
|
|
|
return JsonStringToEntity<List<ResponseMapPositionDataEntity>>(result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -246,24 +299,33 @@ namespace SlnMesnac.TouchSocket
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public AGVResponseEntity<object> AGVErrorClear(string agvIp)
|
|
|
|
|
{
|
|
|
|
|
if (_httpClient == null)
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
_logger.LogError("http服务为空");
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
string token = "bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiYWRtaW4iLCJyb2xlIjoiMSIsImlzcyI6IlNpbmV2YVNlcnZlciIsImF1ZCI6IlNpbmV2YUNsaWVudCJ9.Ujn-JuQDzA_sloITF84z1pdQvvH8DQ0DSFlhz4zP44M";
|
|
|
|
|
|
|
|
|
|
var request = new HttpRequestMessage(HttpMethod.Delete, $"http://{agvIp}/api/v1.0.0/ClearException/0");
|
|
|
|
|
// 单独为此请求添加 Authorization 头部
|
|
|
|
|
request.Headers.Add("Authorization", token);
|
|
|
|
|
// 发送请求
|
|
|
|
|
var response = _httpClient.SendAsync(request).ConfigureAwait(false).GetAwaiter().GetResult();
|
|
|
|
|
// 读取响应内容
|
|
|
|
|
var httpContent = response.Content;
|
|
|
|
|
string result = httpContent.ReadAsStringAsync().ConfigureAwait(false).GetAwaiter().GetResult();
|
|
|
|
|
if (_httpClient == null)
|
|
|
|
|
{
|
|
|
|
|
_logger.LogError("http服务为空");
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
string token = "bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiYWRtaW4iLCJyb2xlIjoiMSIsImlzcyI6IlNpbmV2YVNlcnZlciIsImF1ZCI6IlNpbmV2YUNsaWVudCJ9.Ujn-JuQDzA_sloITF84z1pdQvvH8DQ0DSFlhz4zP44M";
|
|
|
|
|
|
|
|
|
|
return JsonStringToEntity<object>(result);
|
|
|
|
|
var request = new HttpRequestMessage(HttpMethod.Delete, $"http://{agvIp}/api/v1.0.0/ClearException/0");
|
|
|
|
|
// 单独为此请求添加 Authorization 头部
|
|
|
|
|
request.Headers.Add("Authorization", token);
|
|
|
|
|
// 发送请求
|
|
|
|
|
var response = _httpClient.SendAsync(request).ConfigureAwait(false).GetAwaiter().GetResult();
|
|
|
|
|
// 读取响应内容
|
|
|
|
|
var httpContent = response.Content;
|
|
|
|
|
string result = httpContent.ReadAsStringAsync().ConfigureAwait(false).GetAwaiter().GetResult();
|
|
|
|
|
|
|
|
|
|
return JsonStringToEntity<object>(result);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
_logger.LogError($"AGV异常清楚接口异常 {ex.Message}");
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
///// <summary>
|
|
|
|
|