sort retirement

This commit is contained in:
moss 2025-03-27 16:31:40 +07:00
parent 3542906e41
commit e24515906c

View file

@ -561,6 +561,8 @@ namespace BMA.EHR.Retirement.Service.Controllers
} }
var profile_old = await _context.RetirementProfiles var profile_old = await _context.RetirementProfiles
.Where(x => x.RetirementPeriod == retire) .Where(x => x.RetirementPeriod == retire)
.ToListAsync();
var _profile_old = profile_old
.OrderBy(x => rootOrder.ToObject<List<string>>().IndexOf(x.root)) .OrderBy(x => rootOrder.ToObject<List<string>>().IndexOf(x.root))
.ThenBy(x => posTypeNameOrder.ToObject<List<string>>().IndexOf(x.posTypeName ?? "")) .ThenBy(x => posTypeNameOrder.ToObject<List<string>>().IndexOf(x.posTypeName ?? ""))
.ThenBy(x => posLevelNameOrder.ToObject<List<string>>().IndexOf(x.posLevelName ?? "")) .ThenBy(x => posLevelNameOrder.ToObject<List<string>>().IndexOf(x.posLevelName ?? ""))
@ -601,10 +603,9 @@ namespace BMA.EHR.Retirement.Service.Controllers
posExecutiveId = x.posExecutiveId, posExecutiveId = x.posExecutiveId,
posExecutiveName = x.posExecutiveName, posExecutiveName = x.posExecutiveName,
posNo = x.posNo, posNo = x.posNo,
}) });
.ToListAsync();
var file_name = $"retire_tmp_{DateTime.Now.ToString("yyyyMMddTHHmmss")}"; var file_name = $"retire_tmp_{DateTime.Now.ToString("yyyyMMddTHHmmss")}";
var profile = Newtonsoft.Json.JsonConvert.SerializeObject(profile_old); var profile = Newtonsoft.Json.JsonConvert.SerializeObject(_profile_old);
await _documentService.GenerateJsonFile(profile, "/retire", file_name); await _documentService.GenerateJsonFile(profile, "/retire", file_name);
var history = new RetirementPeriodHistory var history = new RetirementPeriodHistory
{ {