แก้คิวรี่เครื่องราช

This commit is contained in:
Kittapath 2023-10-17 12:39:36 +07:00
parent 862408b289
commit 9379e1b421
2 changed files with 4 additions and 5 deletions

View file

@ -2208,7 +2208,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPut("download/excel/{RequestId:length(36)}")]
public async Task<ActionResult<ResponseObject>> DownloadExcelInsigniaByFilter([FromForm] ExportFileInsigniaRequest req, Guid RequestId)
public async Task<ActionResult<ResponseObject>> DownloadExcelInsigniaByFilter([FromBody] ExportFileInsigniaRequest req, Guid RequestId)
{
var insigniaPeriod = await _context.InsigniaRequests
.Include(x => x.Organization)
@ -2230,6 +2230,8 @@ namespace BMA.EHR.Insignia.Service.Controllers
.ThenInclude(x => x.Profile)
.ThenInclude(x => x.Insignias)
.ThenInclude(x => x.Insignia)
.Include(x => x.RequestProfiles)
.ThenInclude(x => x.RequestInsignia)
.FirstOrDefaultAsync(x => x.Id == RequestId);
if (insigniaPeriod == null)
return Error(GlobalMessages.InsigniaPeriodNotFound);
@ -2251,7 +2253,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
var workSheet = excel.Workbook.Worksheets[0];
var requestProfiles = insigniaPeriod.RequestProfiles.Where(x => x.Status == "PENDING").ToList();
if (req.ProfileType != null)
requestProfiles = requestProfiles.Where(x => x.Profile.ProfileType == req.ProfileType.Trim().ToUpper()).ToList();
requestProfiles = requestProfiles.Where(x => x.Profile != null).Where(x => x.Profile.ProfileType.Trim().ToUpper() == req.ProfileType.Trim().ToUpper()).ToList();
if (req.InsigniaId != null)
requestProfiles = requestProfiles.Where(x => x.RequestInsignia.Id == req.InsigniaId).ToList();
// if (req.OrgId != null)