fix 不再支持老系统档案号

This commit is contained in:
2026-02-03 18:57:12 +08:00
parent 67481931fc
commit f43c2d6c59
6 changed files with 3 additions and 188 deletions

View File

@@ -43,7 +43,6 @@ public class AssignmentService : IAssignmentService
var data = await GetDataAsync(request);
if (data.IsEmpty()) return new List<DeviceTaskToDeviceByDeviceResponse>();
await HandlerOldDeviceGainfoAsync(data);
await HandlerTimePeriodAsync(data);
var deviceUploadInfos = await GetDeviceUploadRecordInfosAsync(data);
@@ -196,46 +195,6 @@ public class AssignmentService : IAssignmentService
task.ModifiedTime = now;
});
if (await _dbContext.Queryable<OldDeviceGainfoEntity>().Where(x => x.Status != OldDeviceGainfoEnumType.Deleted).AnyAsync())
{
var dCodes = await _dbContext.Queryable<DeviceTaskEntity>()
.LeftJoin<GainfoEntity>((x, ga) => x.UserNo == ga.No)
.Where(x => taskIds.Contains(x.Id))
.Where(x => x.Status == DeviceTaskStatusEnumType.Process)
.Select((x, ga) => new
{
x.DeviceUniqueNo,
ga.Code,
ga.No
})
.ToListAsync();
var oldDeviceGainfoWhere = LinqExpressionExtensions.False<OldDeviceGainfoEntity>();
dCodes.ForEach(item => { oldDeviceGainfoWhere = oldDeviceGainfoWhere.Or(x => x.Code == item.Code && x.DeviceUniqueNo == item.DeviceUniqueNo); });
var oldData = await _dbContext.Queryable<OldDeviceGainfoEntity>().Where(x => x.Status == OldDeviceGainfoEnumType.Wait)
.Where(oldDeviceGainfoWhere)
.ToListAsync();
oldData.ForEach(d =>
{
var current = dCodes.FirstOrDefault(x => x.Code == d.Code);
if (current != null)
{
var task = deviceTasks.FirstOrDefault(x => x.UserNo == current.No && x.DeviceUniqueNo == current.DeviceUniqueNo);
if (task != null)
{
d.Status = task.Status == DeviceTaskStatusEnumType.Success
? OldDeviceGainfoEnumType.Deleted
: OldDeviceGainfoEnumType.Error;
d.Remark = task.ResultMessage;
}
}
});
await _dbContext.UpdateAsync(oldData);
}
await _dbContext.UpdateAsync(deviceTasks);
}
@@ -406,31 +365,6 @@ public class AssignmentService : IAssignmentService
}
/// <summary>
/// 处理老档案数据
/// </summary>
/// <param name="data"></param>
private async Task HandlerOldDeviceGainfoAsync(List<TaskDto> data)
{
if (await _dbContext.Queryable<OldDeviceGainfoEntity>().Where(x => x.Status != OldDeviceGainfoEnumType.Deleted).AnyAsync())
{
var oldDeviceGainfoWhere = LinqExpressionExtensions.False<OldDeviceGainfoEntity>();
data.ForEach(item => { oldDeviceGainfoWhere = oldDeviceGainfoWhere.Or(x => x.Code == item.UserCode && x.DeviceUniqueNo == item.DeviceUniqueNo); });
var oldData = await _dbContext.Queryable<OldDeviceGainfoEntity>()
.Where(x => x.Status == OldDeviceGainfoEnumType.Wait || x.Status == OldDeviceGainfoEnumType.Error)
.Where(oldDeviceGainfoWhere)
.ToListAsync();
data.ForEach(item =>
{
var o = oldData.FirstOrDefault(x => x.Code == item.UserCode && x.DeviceUniqueNo == item.DeviceUniqueNo);
if (o != null)
item.OldUserNo = o.No;
});
}
}
private async Task HandlerTimePeriodAsync(List<TaskDto> data)
{
try