tmp .
This commit is contained in:
@@ -75,9 +75,10 @@ public class AssignmentsController : ControllerBase
|
|||||||
{
|
{
|
||||||
var s = new DateTime(2025, 7, 1);
|
var s = new DateTime(2025, 7, 1);
|
||||||
var e = new DateTime(2025, 8, 1);
|
var e = new DateTime(2025, 8, 1);
|
||||||
var userCodes = await _dbContext.Queryable<GainfoLeaveEntity>().Where(x => x.ResignationDate.HasValue && x.ResignationDate >= s && x.ResignationDate <= e)
|
|
||||||
.Where(x => x.Type != GainfoUserTypeEnumType.External && x.Type != GainfoUserTypeEnumType.Outsource)
|
var userCodes = await _dbContext.Queryable<UserBalanceEntity>()
|
||||||
.Select(x => x.Code)
|
.Where(x => SqlFunc.Subqueryable<UserBalanceTmpEntity>().Where(p => p.UserCode == x.UserCode).NotAny())
|
||||||
|
.Select(x => x.UserCode)
|
||||||
.Distinct()
|
.Distinct()
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
|
|
||||||
@@ -96,9 +97,9 @@ public class AssignmentsController : ControllerBase
|
|||||||
var balance = await _dbContext.Queryable<BalanceRecordEntity>()
|
var balance = await _dbContext.Queryable<BalanceRecordEntity>()
|
||||||
.Where(x => x.UserCode == userCode)
|
.Where(x => x.UserCode == userCode)
|
||||||
.Where(x => x.Status == BalanceRecordStatusEnumType.Valid)
|
.Where(x => x.Status == BalanceRecordStatusEnumType.Valid)
|
||||||
.Where(x => !BalanceRecordSourceConstants.IgnoreSources.Contains(x.Source))
|
|
||||||
.Where(x => x.CostDate >= s && x.CostDate <= e)
|
|
||||||
.Where(x => x.Type == BalanceRecordTypeEnumType.Out)
|
.Where(x => x.Type == BalanceRecordTypeEnumType.Out)
|
||||||
|
.Where(x => x.CostDate >= s && x.CostDate <= e)
|
||||||
|
.Where(x => !BalanceRecordSourceConstants.IgnoreSources.Contains(x.Source))
|
||||||
.SumAsync(x => x.Amount);
|
.SumAsync(x => x.Amount);
|
||||||
|
|
||||||
await _dbContext.Updateable<UserBalanceTmpEntity>()
|
await _dbContext.Updateable<UserBalanceTmpEntity>()
|
||||||
@@ -107,5 +108,40 @@ public class AssignmentsController : ControllerBase
|
|||||||
.Where(x => x.UserCode == userCode)
|
.Where(x => x.UserCode == userCode)
|
||||||
.ExecuteCommandAsync();
|
.ExecuteCommandAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// var userCodes = await _dbContext.Queryable<GainfoLeaveEntity>().Where(x => x.ResignationDate.HasValue && x.ResignationDate >= s && x.ResignationDate <= e)
|
||||||
|
// .Where(x => x.Type != GainfoUserTypeEnumType.External && x.Type != GainfoUserTypeEnumType.Outsource)
|
||||||
|
// .Select(x => x.Code)
|
||||||
|
// .Distinct()
|
||||||
|
// .ToListAsync();
|
||||||
|
//
|
||||||
|
// foreach (var userCode in userCodes)
|
||||||
|
// {
|
||||||
|
// if (!await _dbContext.Queryable<UserBalanceTmpEntity>().Where(x => x.UserCode == userCode).AnyAsync())
|
||||||
|
// {
|
||||||
|
// await _dbContext.InsertAsync(new UserBalanceTmpEntity
|
||||||
|
// {
|
||||||
|
// UserCode = userCode,
|
||||||
|
// Balance = 0,
|
||||||
|
// Version = 0
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// var balance = await _dbContext.Queryable<BalanceRecordEntity>()
|
||||||
|
// .Where(x => x.UserCode == userCode)
|
||||||
|
// .Where(x => x.Status == BalanceRecordStatusEnumType.Valid)
|
||||||
|
// .Where(x => !BalanceRecordSourceConstants.IgnoreSources.Contains(x.Source))
|
||||||
|
// .Where(x => x.CostDate >= s && x.CostDate <= e)
|
||||||
|
// .Where(x => x.Type == BalanceRecordTypeEnumType.In)
|
||||||
|
// .SumAsync(x => x.Amount);
|
||||||
|
//
|
||||||
|
// await _dbContext.Updateable<UserBalanceTmpEntity>()
|
||||||
|
// .SetColumns(x => x.Balance == balance)
|
||||||
|
// .SetColumns(x => x.ModifiedTime == DateTime.Now)
|
||||||
|
// .Where(x => x.UserCode == userCode)
|
||||||
|
// .ExecuteCommandAsync();
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user