fix 判断数据状态逻辑修改

This commit is contained in:
2024-07-02 18:33:20 +08:00
parent 4c12571c29
commit 3db76f2318

View File

@@ -219,7 +219,7 @@ public class AssignmentService : IAssignmentService
task.ModifiedTime = now;
});
if (await _dbContext.Queryable<OldDeviceGainfoEntity>().Where(x => x.Status == OldDeviceGainfoEnumType.Wait).AnyAsync())
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)
@@ -336,18 +336,21 @@ public class AssignmentService : IAssignmentService
throw new VersionExceptions("version exceptions");
}
var oldDeviceGainfoWhere = LinqExpressionExtensions.False<OldDeviceGainfoEntity>();
page.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();
page.Data.ForEach(item =>
if (await _dbContext.Queryable<OldDeviceGainfoEntity>().Where(x => x.Status != OldDeviceGainfoEnumType.Deleted).AnyAsync())
{
var o = oldData.FirstOrDefault(x => x.Code == item.UserCode && x.DeviceUniqueNo == item.DeviceUniqueNo);
if (o != null)
item.OldUserNo = o.No;
});
var oldDeviceGainfoWhere = LinqExpressionExtensions.False<OldDeviceGainfoEntity>();
page.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();
page.Data.ForEach(item =>
{
var o = oldData.FirstOrDefault(x => x.Code == item.UserCode && x.DeviceUniqueNo == item.DeviceUniqueNo);
if (o != null)
item.OldUserNo = o.No;
});
}
return page.Data;
}, 5);