diff --git a/OpenAuth.App/ServiceApp/ManageApp.cs b/OpenAuth.App/ServiceApp/ManageApp.cs index fa26012..c5180f9 100644 --- a/OpenAuth.App/ServiceApp/ManageApp.cs +++ b/OpenAuth.App/ServiceApp/ManageApp.cs @@ -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> 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() + { + Result = true + }; + } } } \ No newline at end of file diff --git a/OpenAuth.WebApi/Controllers/ServiceControllers/ManageController.cs b/OpenAuth.WebApi/Controllers/ServiceControllers/ManageController.cs index 91902e9..4bb37fe 100644 --- a/OpenAuth.WebApi/Controllers/ServiceControllers/ManageController.cs +++ b/OpenAuth.WebApi/Controllers/ServiceControllers/ManageController.cs @@ -885,7 +885,22 @@ namespace OpenAuth.WebApi.Controllers.ServiceControllers return await _app.CallAiModel(req); } - // 手飞任务结束 + /// + /// 结束手飞任务智能巡检 + /// + /// + /// + [HttpPost] + public async Task> EndAiInspection(string taskid) + { + return await _app.EndAiInspection(taskid); + } + + /// + /// 结束手飞任务 + /// + /// + /// [HttpPost] public async Task> EndHandFlyTask(string taskid) {