fix 批量更新任务状态
This commit is contained in:
@@ -188,10 +188,24 @@ public class AssignmentService : IAssignmentService
|
||||
}
|
||||
|
||||
|
||||
public async Task UpdateDeviceTaskStatusAsync(UpdateDeviceTaskStatusRequest request)
|
||||
public async Task UpdateDeviceTaskStatusAsync(List<UpdateDeviceTaskStatusRequest> requests)
|
||||
{
|
||||
for (int i = 0; i < 5; i++)
|
||||
foreach (var request in requests)
|
||||
{
|
||||
//for (int i = 0; i < 5; i++)
|
||||
//{
|
||||
|
||||
|
||||
// if (effect == 0)
|
||||
// {
|
||||
// continue;
|
||||
// }
|
||||
|
||||
// return;
|
||||
//}
|
||||
|
||||
//throw new UserFriendlyException("操作失败,请重试");
|
||||
|
||||
var deviceTask = await _dbContext.Queryable<DeviceTaskEntity>().Where(x => x.Id == request.TaskId).SingleAsync();
|
||||
deviceTask.ThrowIfNull("设备任务不存在");
|
||||
(deviceTask.Status != DeviceTaskStatusEnumType.Process)
|
||||
@@ -206,16 +220,7 @@ public class AssignmentService : IAssignmentService
|
||||
.SetColumns(x => x.ModifiedTime == DateTime.Now)
|
||||
.Where(x => x.Id == request.TaskId && x.Version == deviceTask.Version)
|
||||
.ExecuteCommandAsync();
|
||||
|
||||
if (effect == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
throw new UserFriendlyException("操作失败,请重试");
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user