fix 老档案数据处理
This commit is contained in:
@@ -39,7 +39,7 @@ public class AssignmentService : IAssignmentService
|
|||||||
var data = await GetDataAsync(request);
|
var data = await GetDataAsync(request);
|
||||||
if (data.IsEmpty()) return new List<DeviceTaskToDeviceByDeviceResponse>();
|
if (data.IsEmpty()) return new List<DeviceTaskToDeviceByDeviceResponse>();
|
||||||
|
|
||||||
//await HandlerOldDeviceGainfoAsync(data);
|
await HandlerOldDeviceGainfoAsync(data);
|
||||||
await HandlerTimePeriodAsync(data);
|
await HandlerTimePeriodAsync(data);
|
||||||
var deviceUploadInfos = await GetDeviceUploadRecordInfosAsync(data);
|
var deviceUploadInfos = await GetDeviceUploadRecordInfosAsync(data);
|
||||||
|
|
||||||
@@ -194,42 +194,45 @@ public class AssignmentService : IAssignmentService
|
|||||||
task.ModifiedTime = now;
|
task.ModifiedTime = now;
|
||||||
});
|
});
|
||||||
|
|
||||||
// if (await _dbContext.Queryable<OldDeviceGainfoEntity>().Where(x => x.Status != OldDeviceGainfoEnumType.Deleted).AnyAsync())
|
if (await _dbContext.Queryable<OldDeviceGainfoEntity>().Where(x => x.Status != OldDeviceGainfoEnumType.Deleted).AnyAsync())
|
||||||
// {
|
{
|
||||||
// var dCodes = await _dbContext.Queryable<DeviceTaskEntity>()
|
var dCodes = await _dbContext.Queryable<DeviceTaskEntity>()
|
||||||
// .LeftJoin<GainfoEntity>((x, ga) => x.UserNo == ga.No)
|
.LeftJoin<GainfoEntity>((x, ga) => x.UserNo == ga.No)
|
||||||
// .Where(x => taskIds.Contains(x.Id))
|
.Where(x => taskIds.Contains(x.Id))
|
||||||
// .Where(x => x.Status == DeviceTaskStatusEnumType.Process)
|
.Where(x => x.Status == DeviceTaskStatusEnumType.Process)
|
||||||
// .Select((x, ga) => new
|
.Select((x, ga) => new
|
||||||
// {
|
{
|
||||||
// x.DeviceUniqueNo,
|
x.DeviceUniqueNo,
|
||||||
// ga.Code,
|
ga.Code,
|
||||||
// ga.No
|
ga.No
|
||||||
// })
|
})
|
||||||
// .ToListAsync();
|
.ToListAsync();
|
||||||
//
|
|
||||||
// var oldDeviceGainfoWhere = LinqExpressionExtensions.False<OldDeviceGainfoEntity>();
|
var oldDeviceGainfoWhere = LinqExpressionExtensions.False<OldDeviceGainfoEntity>();
|
||||||
// dCodes.ForEach(item => { oldDeviceGainfoWhere = oldDeviceGainfoWhere.Or(x => x.Code == item.Code && x.DeviceUniqueNo == item.DeviceUniqueNo); });
|
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)
|
var oldData = await _dbContext.Queryable<OldDeviceGainfoEntity>().Where(x => x.Status == OldDeviceGainfoEnumType.Wait)
|
||||||
// .Where(oldDeviceGainfoWhere)
|
.Where(oldDeviceGainfoWhere)
|
||||||
// .ToListAsync();
|
.ToListAsync();
|
||||||
//
|
|
||||||
// oldData.ForEach(d =>
|
oldData.ForEach(d =>
|
||||||
// {
|
{
|
||||||
// var current = dCodes.First(x => x.Code == d.Code);
|
var current = dCodes.FirstOrDefault(x => x.Code == d.Code);
|
||||||
// var task = deviceTasks.FirstOrDefault(x => x.UserNo == current.No && x.DeviceUniqueNo == current.DeviceUniqueNo);
|
if (current != null)
|
||||||
// if (task != null)
|
{
|
||||||
// {
|
var task = deviceTasks.FirstOrDefault(x => x.UserNo == current.No && x.DeviceUniqueNo == current.DeviceUniqueNo);
|
||||||
// d.Status = task.Status == DeviceTaskStatusEnumType.Success
|
if (task != null)
|
||||||
// ? OldDeviceGainfoEnumType.Deleted
|
{
|
||||||
// : OldDeviceGainfoEnumType.Error;
|
d.Status = task.Status == DeviceTaskStatusEnumType.Success
|
||||||
//
|
? OldDeviceGainfoEnumType.Deleted
|
||||||
// d.Remark = task.ResultMessage;
|
: OldDeviceGainfoEnumType.Error;
|
||||||
// }
|
|
||||||
// });
|
d.Remark = task.ResultMessage;
|
||||||
//
|
}
|
||||||
// await _dbContext.UpdateAsync(oldData);
|
}
|
||||||
// }
|
});
|
||||||
|
|
||||||
|
await _dbContext.UpdateAsync(oldData);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
await _dbContext.UpdateAsync(deviceTasks);
|
await _dbContext.UpdateAsync(deviceTasks);
|
||||||
@@ -391,7 +394,8 @@ public class AssignmentService : IAssignmentService
|
|||||||
{
|
{
|
||||||
var oldDeviceGainfoWhere = LinqExpressionExtensions.False<OldDeviceGainfoEntity>();
|
var oldDeviceGainfoWhere = LinqExpressionExtensions.False<OldDeviceGainfoEntity>();
|
||||||
data.ForEach(item => { oldDeviceGainfoWhere = oldDeviceGainfoWhere.Or(x => x.Code == item.UserCode && x.DeviceUniqueNo == item.DeviceUniqueNo); });
|
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)
|
var oldData = await _dbContext.Queryable<OldDeviceGainfoEntity>()
|
||||||
|
.Where(x => x.Status == OldDeviceGainfoEnumType.Wait || x.Status == OldDeviceGainfoEnumType.Error)
|
||||||
.Where(oldDeviceGainfoWhere)
|
.Where(oldDeviceGainfoWhere)
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user