添加手飞任务智能巡检结束接口

main
陈伟 5 days ago
parent e5026a8d38
commit 7b633c02df

@ -2380,7 +2380,7 @@ namespace OpenAuth.App.ServiceApp
FlightTaskType = 1,
WorkspaceId = task.WorkspaceId,
FlightId = task.FlightId,
Status = 1, // 待执行
Status = 0, // 待执行
CreateTime = date,
ScheduledStartTime = date, // 任务计划执行时间
ExecuteTime = date, // 任务开始执行时间
@ -2464,7 +2464,7 @@ namespace OpenAuth.App.ServiceApp
var taskRecord = new LasaTask()
{
Id = req.TaskId,
Status = 1,
Status = 6, // 智能巡检状态
PushUrl = pushUrl
};
await db.Updateable(taskRecord).IgnoreNullColumns().ExecuteCommandAsync();
@ -2501,7 +2501,7 @@ namespace OpenAuth.App.ServiceApp
Id = taskid,
// ScheduledEndTime = DateTime.Now,
CompletedTime = DateTime.Now,
Status = 5 // 成功
Status =5 // 成功
};
using var db = Repository.AsSugarClient();
try
@ -2511,7 +2511,6 @@ namespace OpenAuth.App.ServiceApp
// 结束智能巡检
using var httpClient = new HttpClient();
await httpClient.PostAsync("http://192.168.10.131:9025/stop_detection", null);
//var response = await httpClient.PostAsync("http://192.168.10.131:9025/stop_detection");
db.Ado.CommitTran();
}
catch (Exception ex)
@ -2685,5 +2684,36 @@ namespace OpenAuth.App.ServiceApp
Result = result
};
}
public async Task<Response<bool>> EndAiInspection(string taskid)
{
var task = new LasaTask()
{
Id = taskid,
// ScheduledEndTime = DateTime.Now,
CompletedTime = DateTime.Now,
Status = 1 // 成功
};
using var db = Repository.AsSugarClient();
try
{
db.Ado.BeginTran();
await db.Updateable(task).IgnoreNullColumns().ExecuteCommandAsync();
// 结束智能巡检
using var httpClient = new HttpClient();
await httpClient.PostAsync("http://192.168.10.131:9025/stop_detection", null);
db.Ado.CommitTran();
}
catch (Exception ex)
{
db.Ado.RollbackTran();
throw new Exception("结束任务失败");
}
return new Response<bool>()
{
Result = true
};
}
}
}

@ -885,7 +885,22 @@ namespace OpenAuth.WebApi.Controllers.ServiceControllers
return await _app.CallAiModel(req);
}
// 手飞任务结束
/// <summary>
/// 结束手飞任务智能巡检
/// </summary>
/// <param name="taskid"></param>
/// <returns></returns>
[HttpPost]
public async Task<Response<bool>> EndAiInspection(string taskid)
{
return await _app.EndAiInspection(taskid);
}
/// <summary>
/// 结束手飞任务
/// </summary>
/// <param name="taskid"></param>
/// <returns></returns>
[HttpPost]
public async Task<Response<bool>> EndHandFlyTask(string taskid)
{

Loading…
Cancel
Save