fix คำนวนเครื่องราชย์ ลูกจ้าง
This commit is contained in:
parent
e653b0e40a
commit
9e953cd5d6
2 changed files with 45 additions and 36 deletions
|
|
@ -7859,6 +7859,19 @@ namespace BMA.EHR.Application.Repositories
|
|||
result_candidate.Add(r);
|
||||
}
|
||||
|
||||
// ย้ายที่ตามที่ มอสแจ้ง
|
||||
if (period.Round != 1)
|
||||
{
|
||||
var insigniaIdList = await _dbContext.Set<Insignia>()
|
||||
.Include(x => x.InsigniaType)
|
||||
.Where(x => x.InsigniaType!.Name == "ชั้นสายสะพาย")
|
||||
.Select(x => x.Id)
|
||||
.ToListAsync();
|
||||
|
||||
|
||||
result_candidate = result_candidate.Where(x => insigniaIdList.Contains(x.RequestInsignia.Id)).ToList();
|
||||
}
|
||||
|
||||
foreach (var r in employee_type2)
|
||||
{
|
||||
var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId);
|
||||
|
|
@ -7881,17 +7894,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
// result_candidate.Add(r);
|
||||
//}
|
||||
|
||||
if (period.Round != 1)
|
||||
{
|
||||
var insigniaIdList = await _dbContext.Set<Insignia>()
|
||||
.Include(x => x.InsigniaType)
|
||||
.Where(x => x.InsigniaType!.Name == "ชั้นสายสะพาย")
|
||||
.Select(x => x.Id)
|
||||
.ToListAsync();
|
||||
|
||||
|
||||
result_candidate = result_candidate.Where(x => insigniaIdList.Contains(x.RequestInsignia.Id)).ToList();
|
||||
}
|
||||
|
||||
|
||||
return result_candidate.OrderBy(x => x.Seq).ThenBy(x => x.Gender).ThenBy(x => x.ProfileId).ToList();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ using BMA.EHR.Domain.Common;
|
|||
using BMA.EHR.Domain.Extensions;
|
||||
using BMA.EHR.Domain.Models.Insignias;
|
||||
using BMA.EHR.Domain.Models.MetaData;
|
||||
using BMA.EHR.Domain.ModelsExam.Candidate;
|
||||
using BMA.EHR.Domain.Shared;
|
||||
using BMA.EHR.Infrastructure.Persistence;
|
||||
using BMA.EHR.Insignia.Service.Requests;
|
||||
|
|
@ -407,6 +408,8 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
var organizations = await _userProfileRepository.GetActiveRootAsync(AccessToken, selectPeriod.RevisionId);
|
||||
var allEmployeeProfileByRoot = new List<GetProfileByRootIdDto>();
|
||||
|
||||
var candidates = new List<InsigniaResultSet>();
|
||||
|
||||
foreach (var organization in organizations)
|
||||
{
|
||||
if (organization == null)
|
||||
|
|
@ -414,34 +417,37 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
|
||||
if (selectPeriod != null && selectPeriod.InsigniaEmployees != null)
|
||||
{
|
||||
var emp =
|
||||
await _userProfileRepository.GetEmployeeProfileByPositionAsync(organization.Id, selectPeriod.InsigniaEmployees.Select(x => x.RefId!.ValueOrBlank()).ToArray(), AccessToken);
|
||||
if (emp != null)
|
||||
allEmployeeProfileByRoot.AddRange(emp);
|
||||
var can = await _repository.GetInsigniaCandidateBKK(periodId, organization.Id);
|
||||
//var emp =
|
||||
// await _userProfileRepository.GetEmployeeProfileByPositionAsync(organization.Id, selectPeriod.InsigniaEmployees.Select(x => x.RefId!.ValueOrBlank()).ToArray(), AccessToken);
|
||||
if (can != null)
|
||||
candidates.AddRange(can);
|
||||
}
|
||||
}
|
||||
|
||||
var resultData = allEmployeeProfileByRoot.Select(x => new
|
||||
{
|
||||
citizenId = x.CitizenId,
|
||||
fullName = $"{x.Prefix}{x.FirstName} {x.LastName}",
|
||||
root = x.Root,
|
||||
child1 = x.Child1 ?? "",
|
||||
child2 = x.Child2 ?? "",
|
||||
child3 = x.Child3 ?? "",
|
||||
child4 = x.Child4 ?? "",
|
||||
dateAppoint = x.DateAppoint == null ? "" : x.DateAppoint.Value.ToThaiShortDate(),
|
||||
salary = x.Amount,
|
||||
salaryCondition = x.ProfileSalary == null || x.ProfileSalary.Count == 0 ? 0 :
|
||||
x.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(selectPeriod.Year, 4, 29))
|
||||
.OrderByDescending(x => x.Order).FirstOrDefault() != null ? x.ProfileSalary
|
||||
.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(selectPeriod.Year, 4, 29))
|
||||
.OrderByDescending(x => x.Order).FirstOrDefault().Amount :
|
||||
x.Amount,
|
||||
insignias = x.ProfileInsignia.ToList(),
|
||||
salaries = x.ProfileSalary.ToList(),
|
||||
profileType = x.ProfileType
|
||||
}).ToList();
|
||||
var resultData = candidates.Where(x => x.ProfileType == "EMPLOYEE").ToList();
|
||||
|
||||
//var resultData = allEmployeeProfileByRoot.Select(x => new
|
||||
//{
|
||||
// citizenId = x.CitizenId,
|
||||
// fullName = $"{x.Prefix}{x.FirstName} {x.LastName}",
|
||||
// root = x.Root,
|
||||
// child1 = x.Child1 ?? "",
|
||||
// child2 = x.Child2 ?? "",
|
||||
// child3 = x.Child3 ?? "",
|
||||
// child4 = x.Child4 ?? "",
|
||||
// dateAppoint = x.DateAppoint == null ? "" : x.DateAppoint.Value.ToThaiShortDate(),
|
||||
// salary = x.Amount,
|
||||
// salaryCondition = x.ProfileSalary == null || x.ProfileSalary.Count == 0 ? 0 :
|
||||
// x.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(selectPeriod.Year, 4, 29))
|
||||
// .OrderByDescending(x => x.Order).FirstOrDefault() != null ? x.ProfileSalary
|
||||
// .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(selectPeriod.Year, 4, 29))
|
||||
// .OrderByDescending(x => x.Order).FirstOrDefault().Amount :
|
||||
// x.Amount,
|
||||
// insignias = x.ProfileInsignia.ToList(),
|
||||
// salaries = x.ProfileSalary.ToList(),
|
||||
// profileType = x.ProfileType
|
||||
//}).ToList();
|
||||
|
||||
|
||||
return Success(resultData);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue