Compare commits

..

No commits in common. "f574964a3658608d02f43ba65a8d1bc1112136d1" and "d935ac416d3290fa75bc20ede31a91728ec6d485" have entirely different histories.

1 changed files with 4 additions and 22 deletions

View File

@ -367,18 +367,15 @@ namespace OpenAuth.App.ServiceApp
{ {
using (var db = UnitWork.CreateContext()) using (var db = UnitWork.CreateContext())
{ {
int[] uavtype = info.TypeId.Split('-', StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)) int[] uavtype = info.TypeId.Split('-', StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToArray();
.ToArray();
if (uavtype.Length == 3) if (uavtype.Length == 3)
{ {
var devicename = db.LasaDeviceDictionary.AsQueryable().Where(r => var devicename = db.LasaDeviceDictionary.AsQueryable().Where(r => r.Domain == uavtype[0] && r.DeviceType == uavtype[1] && r.SubType == uavtype[2]).First();
r.Domain == uavtype[0] && r.DeviceType == uavtype[1] && r.SubType == uavtype[2]).First();
if (devicename != null) if (devicename != null)
{ {
info.TypeId = devicename.DeviceName; info.TypeId = devicename.DeviceName;
} }
} }
var flag = db.LasaUav.Insert(info); var flag = db.LasaUav.Insert(info);
if (db.Commit()) if (db.Commit())
return true; return true;
@ -2541,14 +2538,11 @@ namespace OpenAuth.App.ServiceApp
aiInspection.WarningContent = req.WarningContent; aiInspection.WarningContent = req.WarningContent;
} }
// 关于多次调用问题 // 更新
// todo 关于多次调用问题
var count = await db.Queryable<LasaAiInspection>().Where(x => x.TaskId == req.TaskId).CountAsync(); var count = await db.Queryable<LasaAiInspection>().Where(x => x.TaskId == req.TaskId).CountAsync();
if (count == 0) if (count == 0)
{ {
// 设置任务智能巡检标识
task.AIInspection = "true";
task.Status = 3; // 表示智能巡检中
await db.Updateable(task).ExecuteCommandAsync();
await db.Insertable(aiInspection).ExecuteCommandAsync(); await db.Insertable(aiInspection).ExecuteCommandAsync();
} }
} }
@ -2661,15 +2655,6 @@ namespace OpenAuth.App.ServiceApp
public async Task<Response<bool>> EndHandFlyTask(string taskid) public async Task<Response<bool>> EndHandFlyTask(string taskid)
{ {
// todo
var savedTask = await Repository.ChangeRepository<SugarRepositiry<LasaTask>>().AsQueryable()
.Where(x => x.Id == taskid)
.FirstAsync();
if (savedTask.Status == 3)
{
throw new Exception("智能巡检未关闭");
}
var task = new LasaTask() var task = new LasaTask()
{ {
Id = taskid, Id = taskid,
@ -3033,7 +3018,6 @@ WHERE
#region redis获取数据 #region redis获取数据
public async Task<Response<string>> GetDronePortInfoFromRedis(string key) public async Task<Response<string>> GetDronePortInfoFromRedis(string key)
{ {
var info = _redisCacheContext.Get<string>(key); var info = _redisCacheContext.Get<string>(key);
@ -3044,14 +3028,12 @@ WHERE
Result = info Result = info
}; };
} }
return new Response<string> return new Response<string>
{ {
Message = "暂无数据", Message = "暂无数据",
Code = 500 Code = 500
}; };
} }
#endregion #endregion
} }
} }