Fix ประกาศเกษียณลูกจ้าง บันทึกข้อมูลวันที่ประกาศ ระบบแจ้ง Error #2260
All checks were successful
Build & Deploy Retirement Service / build (push) Successful in 1m27s
All checks were successful
Build & Deploy Retirement Service / build (push) Successful in 1m27s
This commit is contained in:
parent
1d8ef79373
commit
35310f7854
1 changed files with 12 additions and 4 deletions
|
|
@ -1306,12 +1306,20 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
{
|
{
|
||||||
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
|
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// แยกดึงข้อมูลเพื่อลดภาระ Database
|
||||||
var retire = await _context.RetirementPeriods
|
var retire = await _context.RetirementPeriods
|
||||||
.Include(x => x.RetirementProfiles)
|
//.Include(x => x.RetirementProfiles)
|
||||||
.Include(x => x.RetirementRawProfiles)
|
//.Include(x => x.RetirementRawProfiles)
|
||||||
.FirstOrDefaultAsync(x => x.Id == retireId);
|
.FirstOrDefaultAsync(x => x.Id == retireId);
|
||||||
|
|
||||||
if (retire == null)
|
if (retire == null)
|
||||||
return Error(GlobalMessages.RetirementNotFound, 404);
|
return Error(GlobalMessages.RetirementNotFound, 404);
|
||||||
|
|
||||||
|
// โหลดข้อมูลลูกแยกกัน
|
||||||
|
var profiles = await _context.RetirementProfiles.Where(x => x.RetirementPeriod.Id == retireId).ToListAsync();
|
||||||
|
var rawProfiles = await _context.RetirementRawProfiles.Where(x => x.RetirementPeriod.Id == retireId).ToListAsync();
|
||||||
|
|
||||||
if (Request.Form.Files != null && Request.Form.Files.Count != 0)
|
if (Request.Form.Files != null && Request.Form.Files.Count != 0)
|
||||||
{
|
{
|
||||||
var file = Request.Form.Files[0];
|
var file = Request.Form.Files[0];
|
||||||
|
|
@ -1366,7 +1374,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
}
|
}
|
||||||
|
|
||||||
var order = 1;
|
var order = 1;
|
||||||
foreach (var profile in retire.RetirementProfiles
|
foreach (var profile in profiles
|
||||||
.OrderBy(x => string.IsNullOrEmpty(x.root) ? int.MaxValue : rootOrder.ToObject<List<string>>().IndexOf(x.root))
|
.OrderBy(x => string.IsNullOrEmpty(x.root) ? int.MaxValue : rootOrder.ToObject<List<string>>().IndexOf(x.root))
|
||||||
.ThenBy(x => child1Order.ToObject<List<string>>().IndexOf(x.child1 ?? ""))
|
.ThenBy(x => child1Order.ToObject<List<string>>().IndexOf(x.child1 ?? ""))
|
||||||
.ThenBy(x => child2Order.ToObject<List<string>>().IndexOf(x.child2 ?? ""))
|
.ThenBy(x => child2Order.ToObject<List<string>>().IndexOf(x.child2 ?? ""))
|
||||||
|
|
@ -1381,7 +1389,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
}
|
}
|
||||||
|
|
||||||
order = 1;
|
order = 1;
|
||||||
foreach (var profile in retire.RetirementRawProfiles
|
foreach (var profile in rawProfiles
|
||||||
.OrderBy(x => string.IsNullOrEmpty(x.root) ? int.MaxValue : rootOrder.ToObject<List<string>>().IndexOf(x.root))
|
.OrderBy(x => string.IsNullOrEmpty(x.root) ? int.MaxValue : rootOrder.ToObject<List<string>>().IndexOf(x.root))
|
||||||
.ThenBy(x => child1Order.ToObject<List<string>>().IndexOf(x.child1 ?? ""))
|
.ThenBy(x => child1Order.ToObject<List<string>>().IndexOf(x.child1 ?? ""))
|
||||||
.ThenBy(x => child2Order.ToObject<List<string>>().IndexOf(x.child2 ?? ""))
|
.ThenBy(x => child2Order.ToObject<List<string>>().IndexOf(x.child2 ?? ""))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue