no message
Some checks failed
release-dev / release-dev (push) Failing after 13s

This commit is contained in:
kittapath 2024-12-25 10:21:31 +07:00
parent d88394984b
commit 39acbb7f95
11 changed files with 780 additions and 13 deletions

View file

@ -87,8 +87,8 @@ namespace BMA.EHR.Application.Repositories
Id = i.Id,
Name = i.Name,
ShortName = i.ShortName,
Level = i.InsigniaType.Name,
LevelId = i.InsigniaType.Id
Level = i.InsigniaType?.Name ?? "",
LevelId = i.InsigniaType?.Id ?? null
})
.FirstOrDefault();
@ -6531,24 +6531,39 @@ namespace BMA.EHR.Application.Repositories
(await _userProfileRepository.GetOfficerProfileByRootIdAsync(ocId, AccessToken));
//var allEmployeeProfileByRoot =
// (await _userProfileRepository.GetEmployeeProfileByRootIdAsync(ocId, AccessToken));
Console.WriteLine("111111");
var type_coin = await GetCoinCandidate(periodId, ocId, allOfficerProfilesByRoot);
Console.WriteLine("111112");
var type1_level1 = await GetInsigniaCandidate_Type1_Level1(periodId, ocId, allOfficerProfilesByRoot);
Console.WriteLine("111113");
var type1_level2 = await GetInsigniaCandidate_Type1_Level2(periodId, ocId, allOfficerProfilesByRoot);
Console.WriteLine("111114");
var type1_level3 = await GetInsigniaCandidate_Type1_Level3(periodId, ocId, allOfficerProfilesByRoot);
Console.WriteLine("111115");
var type1_level4 = await GetInsigniaCandidate_Type1_Level4(periodId, ocId, allOfficerProfilesByRoot);
Console.WriteLine("111116");
var type2_level5 = await GetInsigniaCandidate_Type2_Level5(periodId, ocId, allOfficerProfilesByRoot);
Console.WriteLine("111117");
var type2_level6 = await GetInsigniaCandidate_Type2_Level6(periodId, ocId, allOfficerProfilesByRoot);
Console.WriteLine("111118");
var type2_level7 = await GetInsigniaCandidate_Type2_Level7(periodId, ocId, allOfficerProfilesByRoot);
Console.WriteLine("111119");
var type2_level8 = await GetInsigniaCandidate_Type2_Level8(periodId, ocId, allOfficerProfilesByRoot);
Console.WriteLine("111110");
var type2_level9_1 =
await GetInsigniaCandidate_Type2_Level9_1(periodId, ocId, allOfficerProfilesByRoot);
Console.WriteLine("1111111");
var type2_level9_2 =
await GetInsigniaCandidate_Type2_Level9_2(periodId, ocId, allOfficerProfilesByRoot);
Console.WriteLine("1111112");
var type3_level10 = await GetInsigniaCandidate_Type3_Level10(periodId, ocId, allOfficerProfilesByRoot);
Console.WriteLine("1111113");
var type3_level11 = await GetInsigniaCandidate_Type3_Level11(periodId, ocId, allOfficerProfilesByRoot);
Console.WriteLine("1111114");
var type4_level10 = await GetInsigniaCandidate_Type4_Level10(periodId, ocId, allOfficerProfilesByRoot);
Console.WriteLine("1111115");
var type4_level11 = await GetInsigniaCandidate_Type4_Level11(periodId, ocId, allOfficerProfilesByRoot);
Console.WriteLine("1111116");
// union result
foreach (var r in type_coin)
@ -6693,11 +6708,14 @@ namespace BMA.EHR.Application.Repositories
{
try
{
Console.WriteLine("2222222");
var period = await _dbContext.Set<InsigniaPeriod>().FirstOrDefaultAsync(p => p.Id == periodId);
Console.WriteLine("22222221");
if (period == null)
throw new Exception(GlobalMessages.CoinPeriodNotFound);
Console.WriteLine("22222223");
var inst_profile = allProfilesByRoot.Where(x => x.DateAppoint != null)
.Select(p => new
{
@ -6743,6 +6761,8 @@ namespace BMA.EHR.Application.Repositories
PositionSalaryAmount = p.PositionSalaryAmount,
});
Console.WriteLine("22222224");
Console.WriteLine(JsonConvert.SerializeObject(inst_profile));
// check วันที่บรรจะต้องมากกว่า 25 ปี
var result = ((from p in inst_profile
where p.ProfileDateAppoint <= new DateTime(period.Year - 25, 5, 29)
@ -6774,25 +6794,33 @@ namespace BMA.EHR.Application.Repositories
MatchingConditions = new List<MatchingCondition>(),
})).ToList();
Console.WriteLine("22222225");
var result_candidate = new List<InsigniaResultSet>();
Console.WriteLine("22222226");
foreach (var r in result)
{
Console.WriteLine("22222228");
var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId);
Console.WriteLine("22222220");
// Check ได้รับหรือเคยยื่นขอไปในปีที่แล้วหรือไม่?
if (!CanRequestInsignia(r.ProfileId, period.Year))
continue;
Console.WriteLine("22222229");
// Check ว่าชั้นที่ขอสูงกว่าชั้นที่เคยได้รับแล้วหรือไม่?
if (!IsHigherLevel2(r.LastInsignia, r.RequestInsignia.Name))
continue;
Console.WriteLine("222222212");
if (old == null)
{
result_candidate.Add(r);
}
Console.WriteLine("222222243");
}
Console.WriteLine("22222227");
return result_candidate;
}