计划任务修改
parent
56be1f0e69
commit
83cc46f6e3
|
|
@ -1202,6 +1202,19 @@ namespace OpenAuth.App.ServiceApp
|
|||
Wpml = wpml
|
||||
};
|
||||
await Repository.ChangeRepository<SugarRepositiry<LasaTaskAssign>>().InsertAsync(taskAssign);
|
||||
|
||||
// 添加任务历史
|
||||
await Repository.ChangeRepository<SugarRepositiry<LasaTaskHistory>>()
|
||||
.InsertAsync(new LasaTaskHistory
|
||||
{
|
||||
Id = Guid.NewGuid().ToString(),
|
||||
TaskName = task.TaskName,
|
||||
Status = 0,
|
||||
TaskId = taskId,
|
||||
ExecuteTime = DateTime.Now,
|
||||
FlightId = data.flight_id,
|
||||
ExternalTaskId = task.ExternalTaskId
|
||||
});
|
||||
}
|
||||
|
||||
public async Task PendingFlyTask(string taskId)
|
||||
|
|
|
|||
|
|
@ -95,6 +95,8 @@ public class ConfigSubscribe : IJob
|
|||
long code = 0;
|
||||
// rtmp://175.27.168.120:6019/live/
|
||||
//var rtmp = "rtmp://box.wisestcity.com:1935/live/7";
|
||||
|
||||
// 机场推流地址地址
|
||||
var rtmp = "rtmp://175.27.168.120:6019/live/7";
|
||||
switch (tempStr)
|
||||
{
|
||||
|
|
@ -105,12 +107,6 @@ public class ConfigSubscribe : IJob
|
|||
// 临时凭证上传
|
||||
case "storage_config_get":
|
||||
_logger.LogInformation($"进入临时凭证获取处理");
|
||||
// {"bid":"afc5c13e-da1c-4a15-aec1-a765aac34c57",
|
||||
// "data":{"module":0},
|
||||
// "method":"storage_config_get",
|
||||
// "need_reply":0,"tid":"50e8102c-da72-42b1-a899-a82a519456d9",
|
||||
// "timestamp":1750575776430,
|
||||
// "gateway":"8UUXN5400A079H"}
|
||||
// 配置中读取minio配置
|
||||
var storageConfigRequest = new TopicServicesRequest<object>()
|
||||
{
|
||||
|
|
@ -243,7 +239,7 @@ public class ConfigSubscribe : IJob
|
|||
var isExist = await _sqlSugarClient
|
||||
.Queryable<LasaMediaFile>()
|
||||
.Where(x => x.Id.Equals(parentKey)).CountAsync();
|
||||
if (isExist == 0)
|
||||
if (isExist == 0) //
|
||||
{
|
||||
var date = DateTime.Now;
|
||||
var timeStr = date.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
|
|
@ -578,6 +574,18 @@ public class ConfigSubscribe : IJob
|
|||
await _sqlSugarClient.Updateable(taskRecord1)
|
||||
.IgnoreNullColumns().ExecuteCommandAsync();
|
||||
// todo 关于断点原因为773(电量低),处置
|
||||
var taskHistory = await _sqlSugarClient
|
||||
.Queryable<LasaTaskHistory>()
|
||||
.Where(x => x.TaskId == flightId1)
|
||||
.FirstAsync();
|
||||
var taskHistoryUpdate = new LasaTaskHistory()
|
||||
{
|
||||
Id = taskHistory.Id,
|
||||
Status = 2, //
|
||||
Reason = $"{DateTime.Now:yyyy-MM-dd HH:mm:ss} {ErrorMap[code]}(错误码: {code})"
|
||||
};
|
||||
await _sqlSugarClient.Updateable(taskHistoryUpdate)
|
||||
.IgnoreNullColumns().ExecuteCommandAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -586,6 +594,7 @@ public class ConfigSubscribe : IJob
|
|||
{
|
||||
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))
|
||||
{
|
||||
|
|
@ -613,6 +622,17 @@ public class ConfigSubscribe : IJob
|
|||
Status = 5
|
||||
};
|
||||
await _sqlSugarClient.Updateable(record).IgnoreNullColumns().ExecuteCommandAsync();
|
||||
var taskHistory = await _sqlSugarClient
|
||||
.Queryable<LasaTaskHistory>()
|
||||
.Where(x => x.TaskId == flightId1)
|
||||
.FirstAsync();
|
||||
var taskHistoryUpdate = new LasaTaskHistory()
|
||||
{
|
||||
Id = taskHistory.Id,
|
||||
Status = 5
|
||||
};
|
||||
await _sqlSugarClient.Updateable(taskHistoryUpdate)
|
||||
.IgnoreNullColumns().ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
var step = (int)data.output.progress.current_step;
|
||||
|
|
@ -753,14 +773,15 @@ public class ConfigSubscribe : IJob
|
|||
};
|
||||
_sqlSugarClient.Updateable(taskAssignRecord).IgnoreNullColumns()
|
||||
.ExecuteCommand();
|
||||
var taskRecord = new LasaTask()
|
||||
/* 冗余逻辑去除
|
||||
var taskRecord = new LasaTask()
|
||||
{
|
||||
Id = taskAssign.TaskId,
|
||||
FlightId = flightId,
|
||||
};
|
||||
_sqlSugarClient.Updateable(taskRecord).IgnoreNullColumns()
|
||||
.ExecuteCommand();
|
||||
// todo 锁定这个机场 ,不再执行其它任务
|
||||
// todo 锁定这个机场 ,不再执行其它任务*/
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -780,6 +801,18 @@ public class ConfigSubscribe : IJob
|
|||
Reason = $"{DateTime.Now:yyyy-MM-dd HH:mm:ss} {errorMsg}(错误码: {code})"
|
||||
};
|
||||
_sqlSugarClient.Updateable(taskUpdate).IgnoreNullColumns().ExecuteCommand();
|
||||
|
||||
var taskHistory1 = _sqlSugarClient
|
||||
.Queryable<LasaTaskHistory>()
|
||||
.Where(x => x.TaskId == taskAssign.FlightId)
|
||||
.First();
|
||||
var taskHistoryUpdate1 = new LasaTaskHistory()
|
||||
{
|
||||
Id = taskHistory1.Id,
|
||||
Status = 2,
|
||||
Reason = $"{DateTime.Now:yyyy-MM-dd HH:mm:ss} {errorMsg}(错误码: {code})"
|
||||
};
|
||||
_sqlSugarClient.Updateable(taskHistoryUpdate1).IgnoreNullColumns().ExecuteCommand();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -791,6 +824,17 @@ public class ConfigSubscribe : IJob
|
|||
{
|
||||
Id = taskAssignExecute.TaskId,
|
||||
};
|
||||
|
||||
var taskHistory = await _sqlSugarClient
|
||||
.Queryable<LasaTaskHistory>()
|
||||
.Where(x => x.TaskId == taskAssignExecute.FlightId)
|
||||
.FirstAsync();
|
||||
var taskHistoryUpdate = new LasaTaskHistory()
|
||||
{
|
||||
Id = taskHistory.Id
|
||||
};
|
||||
|
||||
|
||||
var flyTask = await _sqlSugarClient.Queryable<LasaTask>()
|
||||
.Where(x => x.Id == taskAssignExecute.TaskId)
|
||||
.FirstAsync();
|
||||
|
|
@ -802,11 +846,14 @@ public class ConfigSubscribe : IJob
|
|||
// TOdo 和航线进度方法中返回的错误有没有区别 ????
|
||||
taskRecordExecute.Status = 2;
|
||||
taskRecordExecute.Reason = $"{DateTime.Now:yyyy-MM-dd HH:mm:ss} {errorMsg}(错误码: {code})";
|
||||
taskHistoryUpdate.Reason = $"{DateTime.Now:yyyy-MM-dd HH:mm:ss} {errorMsg}(错误码: {code})";
|
||||
taskHistoryUpdate.Status = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
// 任务开始执行
|
||||
taskRecordExecute.Status = 1; // 任务执行中
|
||||
taskHistoryUpdate.Status = 1;
|
||||
Console.WriteLine($"任务执行响应 {code} {message}");
|
||||
}
|
||||
|
||||
|
|
@ -819,12 +866,13 @@ public class ConfigSubscribe : IJob
|
|||
{
|
||||
var droneTask = new DroneDocktask()
|
||||
{
|
||||
id = detail.taskid,
|
||||
id = detail.taskid, // 这里的id是部级任务表的id
|
||||
state = 1
|
||||
};
|
||||
await _sqlSugarClient.Updateable(droneTask).IgnoreNullColumns().ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
await _sqlSugarClient.Updateable(taskHistoryUpdate).IgnoreNullColumns().ExecuteCommandAsync();
|
||||
await _sqlSugarClient.Updateable(taskRecordExecute).IgnoreNullColumns().ExecuteCommandAsync();
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue