|
|
|
@ -15,6 +15,7 @@ using MQTTnet.Client;
|
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
using NPOI.SS.Formula.Functions;
|
|
|
|
|
using OpenAuth.App.ServiceApp;
|
|
|
|
|
using OpenAuth.App.ServiceApp.FlyTask.Request;
|
|
|
|
|
using OpenAuth.Repository.Domain;
|
|
|
|
|
using OpenAuth.WebApi;
|
|
|
|
|
using Quartz;
|
|
|
|
@ -570,8 +571,9 @@ public class ConfigSubscribe : IJob
|
|
|
|
|
// "29":"机场退出工作模式"
|
|
|
|
|
// "30":"机场异常恢复","31":"机场上传飞行系统日志","32":"相机录像状态检查","33":"获取媒体文件数量","34":"机场起飞开盖的异常恢复","35":"通知任务结果","36":"日志列表拉取 - 飞行器列表","37":"日志列表拉取 - 拉取机场列表","38":"日志列表拉取 - 上传日志列表结果","39":"日志拉取-拉取飞行器日志","40":"日志拉取-拉取机场日志","41":"日志拉取-压缩飞行器日志","42":"日志拉取-压缩机场日志","43":"日志拉取-上传飞行器日志","44":"日志拉取-上传机场日志","45":"日志拉取-通知结果","46":"自定义飞行区文件更新准备中","47":"自定义飞行区更新中","48":"离线地图更新准备中","49":"离线地图更新中","65533":"结束后等待服务回包","65534":"无具体状态","65535":"UNKNOWN"}
|
|
|
|
|
code = data.result; // result
|
|
|
|
|
var x = (int)data.output.ext.wayline_mission_state;
|
|
|
|
|
var flightId2 = (string)data.output.ext.flight_id;
|
|
|
|
|
var waylineMissionState = (int)data.output.ext.wayline_mission_state;
|
|
|
|
|
string flightId1 = (string)data.output.ext.flight_id;
|
|
|
|
|
var taskAssign1 = _manageApp.GetTaskAssignByFlightId(flightId1);
|
|
|
|
|
// 处理航线进度 ,也有可能是失败
|
|
|
|
|
if (code != 0)
|
|
|
|
|
{
|
|
|
|
@ -592,14 +594,13 @@ public class ConfigSubscribe : IJob
|
|
|
|
|
await _mqttClientManager.PublishAsync(cancelTaskTopic,
|
|
|
|
|
JsonConvert.SerializeObject(cancelTaskRequest));
|
|
|
|
|
//更新任务状态及失败原因?
|
|
|
|
|
string flightId1 = data.output.ext.flight_id;
|
|
|
|
|
var taskId1 = _manageApp.GetTaskAssignByFlightId(flightId1).TaskId;
|
|
|
|
|
|
|
|
|
|
// "773":"低电量返航导致航线中断"
|
|
|
|
|
int reasonCode = data.output.ext.break_point.break_reason;
|
|
|
|
|
// 添加断点信息
|
|
|
|
|
var taskRecord1 = new LasaTask()
|
|
|
|
|
{
|
|
|
|
|
Id = taskId1,
|
|
|
|
|
Id = taskAssign1.TaskId,
|
|
|
|
|
Status = 2,
|
|
|
|
|
Reason = ErrorMap[code],
|
|
|
|
|
BreakPoint = JsonConvert.SerializeObject(data.output.ext.break_point)
|
|
|
|
@ -611,22 +612,68 @@ public class ConfigSubscribe : IJob
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var step = (int)data.output.progress.current_step;
|
|
|
|
|
if (step.Equals(25)) // 航线执行
|
|
|
|
|
{
|
|
|
|
|
var task = await _sqlSugarClient.Queryable<LasaTask>()
|
|
|
|
|
.FirstAsync(y => y.Id == taskAssign1.TaskId);
|
|
|
|
|
if (task != null && !string.IsNullOrEmpty(task.AIInspection) &&
|
|
|
|
|
task.AIInspection.Equals("true") && string.IsNullOrEmpty(task.PushUrl))
|
|
|
|
|
{
|
|
|
|
|
var param = @$"{{
|
|
|
|
|
""bid"": {Guid.NewGuid().ToString()},
|
|
|
|
|
""method"": ""live_start_push"",
|
|
|
|
|
""tid"": {Guid.NewGuid().ToString()},
|
|
|
|
|
""timestamp"": {DateTimeOffset.Now.ToUnixTimeMilliseconds()},
|
|
|
|
|
""data"": {{
|
|
|
|
|
""url_type"": 1,
|
|
|
|
|
""url"": ""rtmp://box.wisestcity.com:1935/live/7"",
|
|
|
|
|
""video_id"": ""1581F8HGX254V00A0BUY/99-0-0/normal-0"",
|
|
|
|
|
""video_quality"": 3
|
|
|
|
|
}}
|
|
|
|
|
}}";
|
|
|
|
|
var topicRequest = $"thing/product/{sn}/services";
|
|
|
|
|
await _mqttClientManager.PublishAsync(topicRequest, param);
|
|
|
|
|
var req = new CallAiModel { TaskId = taskAssign1.TaskId };
|
|
|
|
|
await _manageApp.CallAiModel(req);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 航线成功
|
|
|
|
|
if (x.Equals(9)) // 航结结束,更新任务状态
|
|
|
|
|
if (waylineMissionState.Equals(9)) // 航结结束,更新任务状态
|
|
|
|
|
{
|
|
|
|
|
var task1 = await _sqlSugarClient
|
|
|
|
|
.Queryable<LasaTask>()
|
|
|
|
|
.SingleAsync(a => a.FlightId == flightId2);
|
|
|
|
|
var task = await _sqlSugarClient.Queryable<LasaTask>()
|
|
|
|
|
.FirstAsync(y => y.Id == taskAssign1.TaskId);
|
|
|
|
|
if (!string.IsNullOrEmpty(task.AIInspection) && task.AIInspection.Equals(true) &&
|
|
|
|
|
!string.IsNullOrEmpty(task.PushUrl))
|
|
|
|
|
{
|
|
|
|
|
// todo 停止直播
|
|
|
|
|
// todo 停止 aimodel 运行
|
|
|
|
|
var para = @$"{{
|
|
|
|
|
""bid"": {Guid.NewGuid().ToString()},
|
|
|
|
|
""data"": {{
|
|
|
|
|
""video_id"": ""1581F8HGX254V00A0BUY/99-0-0/normal-0""
|
|
|
|
|
}},
|
|
|
|
|
""tid"":{Guid.NewGuid().ToString()},
|
|
|
|
|
""timestamp:"": {DateTimeOffset.Now.ToUnixTimeMilliseconds()},
|
|
|
|
|
""method"": ""live_stop_push""
|
|
|
|
|
}}";
|
|
|
|
|
var topicRequest = $"thing/product/{sn}/services";
|
|
|
|
|
await _mqttClientManager.PublishAsync(topicRequest, para);
|
|
|
|
|
using var httpClient = new HttpClient();
|
|
|
|
|
await httpClient.PostAsync("http://192.168.10.131:9025/stop_detection", null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var record = new LasaTask()
|
|
|
|
|
{
|
|
|
|
|
Id = task1.Id,
|
|
|
|
|
Id = taskAssign1.TaskId,
|
|
|
|
|
Status = 5
|
|
|
|
|
};
|
|
|
|
|
await _sqlSugarClient.Updateable(record).IgnoreNullColumns().ExecuteCommandAsync();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (result.need_reply.Equals(1))
|
|
|
|
|
/*if (result.need_reply.Equals(1))
|
|
|
|
|
{
|
|
|
|
|
var fileUploadCallbackEventReply = new FileUploadCallbackEventReply<object>()
|
|
|
|
|
{
|
|
|
|
@ -642,7 +689,7 @@ public class ConfigSubscribe : IJob
|
|
|
|
|
};
|
|
|
|
|
await _mqttClientManager.PublishAsync($"thing/product/{sn}/events_reply",
|
|
|
|
|
JsonConvert.SerializeObject(fileUploadCallbackEventReply));
|
|
|
|
|
}
|
|
|
|
|
}*/
|
|
|
|
|
|
|
|
|
|
//Console.WriteLine($"航线进度:{message}");
|
|
|
|
|
break;
|
|
|
|
|