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);
|
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)
|
foreach (var r in employee_type2)
|
||||||
{
|
{
|
||||||
var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId);
|
var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId);
|
||||||
|
|
@ -7881,18 +7894,8 @@ namespace BMA.EHR.Application.Repositories
|
||||||
// result_candidate.Add(r);
|
// 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();
|
return result_candidate.OrderBy(x => x.Seq).ThenBy(x => x.Gender).ThenBy(x => x.ProfileId).ToList();
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ using BMA.EHR.Domain.Common;
|
||||||
using BMA.EHR.Domain.Extensions;
|
using BMA.EHR.Domain.Extensions;
|
||||||
using BMA.EHR.Domain.Models.Insignias;
|
using BMA.EHR.Domain.Models.Insignias;
|
||||||
using BMA.EHR.Domain.Models.MetaData;
|
using BMA.EHR.Domain.Models.MetaData;
|
||||||
|
using BMA.EHR.Domain.ModelsExam.Candidate;
|
||||||
using BMA.EHR.Domain.Shared;
|
using BMA.EHR.Domain.Shared;
|
||||||
using BMA.EHR.Infrastructure.Persistence;
|
using BMA.EHR.Infrastructure.Persistence;
|
||||||
using BMA.EHR.Insignia.Service.Requests;
|
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 organizations = await _userProfileRepository.GetActiveRootAsync(AccessToken, selectPeriod.RevisionId);
|
||||||
var allEmployeeProfileByRoot = new List<GetProfileByRootIdDto>();
|
var allEmployeeProfileByRoot = new List<GetProfileByRootIdDto>();
|
||||||
|
|
||||||
|
var candidates = new List<InsigniaResultSet>();
|
||||||
|
|
||||||
foreach (var organization in organizations)
|
foreach (var organization in organizations)
|
||||||
{
|
{
|
||||||
if (organization == null)
|
if (organization == null)
|
||||||
|
|
@ -414,34 +417,37 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
|
|
||||||
if (selectPeriod != null && selectPeriod.InsigniaEmployees != null)
|
if (selectPeriod != null && selectPeriod.InsigniaEmployees != null)
|
||||||
{
|
{
|
||||||
var emp =
|
var can = await _repository.GetInsigniaCandidateBKK(periodId, organization.Id);
|
||||||
await _userProfileRepository.GetEmployeeProfileByPositionAsync(organization.Id, selectPeriod.InsigniaEmployees.Select(x => x.RefId!.ValueOrBlank()).ToArray(), AccessToken);
|
//var emp =
|
||||||
if (emp != null)
|
// await _userProfileRepository.GetEmployeeProfileByPositionAsync(organization.Id, selectPeriod.InsigniaEmployees.Select(x => x.RefId!.ValueOrBlank()).ToArray(), AccessToken);
|
||||||
allEmployeeProfileByRoot.AddRange(emp);
|
if (can != null)
|
||||||
|
candidates.AddRange(can);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var resultData = allEmployeeProfileByRoot.Select(x => new
|
var resultData = candidates.Where(x => x.ProfileType == "EMPLOYEE").ToList();
|
||||||
{
|
|
||||||
citizenId = x.CitizenId,
|
//var resultData = allEmployeeProfileByRoot.Select(x => new
|
||||||
fullName = $"{x.Prefix}{x.FirstName} {x.LastName}",
|
//{
|
||||||
root = x.Root,
|
// citizenId = x.CitizenId,
|
||||||
child1 = x.Child1 ?? "",
|
// fullName = $"{x.Prefix}{x.FirstName} {x.LastName}",
|
||||||
child2 = x.Child2 ?? "",
|
// root = x.Root,
|
||||||
child3 = x.Child3 ?? "",
|
// child1 = x.Child1 ?? "",
|
||||||
child4 = x.Child4 ?? "",
|
// child2 = x.Child2 ?? "",
|
||||||
dateAppoint = x.DateAppoint == null ? "" : x.DateAppoint.Value.ToThaiShortDate(),
|
// child3 = x.Child3 ?? "",
|
||||||
salary = x.Amount,
|
// child4 = x.Child4 ?? "",
|
||||||
salaryCondition = x.ProfileSalary == null || x.ProfileSalary.Count == 0 ? 0 :
|
// dateAppoint = x.DateAppoint == null ? "" : x.DateAppoint.Value.ToThaiShortDate(),
|
||||||
x.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(selectPeriod.Year, 4, 29))
|
// salary = x.Amount,
|
||||||
.OrderByDescending(x => x.Order).FirstOrDefault() != null ? x.ProfileSalary
|
// salaryCondition = x.ProfileSalary == null || x.ProfileSalary.Count == 0 ? 0 :
|
||||||
.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(selectPeriod.Year, 4, 29))
|
// x.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(selectPeriod.Year, 4, 29))
|
||||||
.OrderByDescending(x => x.Order).FirstOrDefault().Amount :
|
// .OrderByDescending(x => x.Order).FirstOrDefault() != null ? x.ProfileSalary
|
||||||
x.Amount,
|
// .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(selectPeriod.Year, 4, 29))
|
||||||
insignias = x.ProfileInsignia.ToList(),
|
// .OrderByDescending(x => x.Order).FirstOrDefault().Amount :
|
||||||
salaries = x.ProfileSalary.ToList(),
|
// x.Amount,
|
||||||
profileType = x.ProfileType
|
// insignias = x.ProfileInsignia.ToList(),
|
||||||
}).ToList();
|
// salaries = x.ProfileSalary.ToList(),
|
||||||
|
// profileType = x.ProfileType
|
||||||
|
//}).ToList();
|
||||||
|
|
||||||
|
|
||||||
return Success(resultData);
|
return Success(resultData);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue