fix กรณีไม่ได้กรอกข้อมูลตรวจสอบคุณสมบัติให้แสดงว่าง #2349

This commit is contained in:
harid 2026-03-12 11:13:43 +07:00
parent bb0b296086
commit 75718a955d

View file

@ -1604,11 +1604,6 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
r.ExamId = workSheet?.Cells[row, 2]?.GetValue<string>(); r.ExamId = workSheet?.Cells[row, 2]?.GetValue<string>();
//var recruit = await _context.Disables.AsQueryable()
// .Include(x => x.PeriodExam)
// .Where(x => x.PeriodExam == rec_import && x.ExamId == r.ExamId)
// .FirstOrDefaultAsync();
// ใช้ dictionary lookup แทน query DB ทีละรอบ // ใช้ dictionary lookup แทน query DB ทีละรอบ
if (!string.IsNullOrEmpty(r.ExamId) && recruitsDict.TryGetValue(r.ExamId, out var recruit)) if (!string.IsNullOrEmpty(r.ExamId) && recruitsDict.TryGetValue(r.ExamId, out var recruit))
{ {
@ -1633,26 +1628,19 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
r.FullScore = 300; r.FullScore = 300;
r.TotalScore = string.IsNullOrWhiteSpace(workSheet?.Cells[row, 13]?.GetValue<string>()) ? 0.00 : Math.Round(workSheet.Cells[row, 13].GetValue<double>(), 2); r.TotalScore = string.IsNullOrWhiteSpace(workSheet?.Cells[row, 13]?.GetValue<string>()) ? 0.00 : Math.Round(workSheet.Cells[row, 13].GetValue<double>(), 2);
if (workSheet?.Cells[row, 7]?.GetValue<string>() == "ขาดสอบ") var examStatusCol7 = workSheet?.Cells[row, 7]?.GetValue<string>()?.Trim();
{ var examStatusCol14 = workSheet?.Cells[row, 14]?.GetValue<string>()?.Trim();
r.ExamStatus = "ขส."; r.ExamStatus =
} examStatusCol7 == "ขาดสอบ" ? "ขส." :
else if (workSheet?.Cells[row, 14]?.GetValue<string>() == "ได้") examStatusCol14 == "ได้" ? "ผ่าน" :
{ examStatusCol14 == "ตก" ? "ไม่ผ่าน" : "-";
r.ExamStatus = "ผ่าน";
}
else if (workSheet?.Cells[row, 14]?.GetValue<string>() == "ตก")
{
r.ExamStatus = "ไม่ผ่าน";
}
else
{
r.ExamStatus = "-";
}
r.RemarkScore = string.IsNullOrWhiteSpace(workSheet?.Cells[row, 15]?.GetValue<string>()) ? string.Empty : workSheet?.Cells[row, 15]?.GetValue<string>(); r.RemarkScore = string.IsNullOrWhiteSpace(workSheet?.Cells[row, 15]?.GetValue<string>()) ? string.Empty : workSheet?.Cells[row, 15]?.GetValue<string>();
r.ExamAttribute = (workSheet?.Cells[row, 16]?.GetValue<string>()?.Trim() == "ผ่าน") ? "มีคุณสมบัติ" : "ไม่มีคุณสมบัติ"; var examAttr = workSheet?.Cells[row, 16]?.GetValue<string>()?.Trim();
r.ExamAttribute =
examAttr == "ผ่าน" ? "มีคุณสมบัติ" :
examAttr == "ไม่ผ่าน" ? "ไม่มีคุณสมบัติ" : "";
r.Major = workSheet.Name; r.Major = workSheet.Name;
@ -2098,11 +2086,11 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
// ? _disableService.CheckValidCertificate(x.disable.Certificates.First().IssueDate, 5) // ? _disableService.CheckValidCertificate(x.disable.Certificates.First().IssueDate, 5)
// ? "มีคุณสมบัติ" : "ไม่มีคุณสมบัติ" // ? "มีคุณสมบัติ" : "ไม่มีคุณสมบัติ"
// : "ไม่มีคุณสมบัติ", // : "ไม่มีคุณสมบัติ",
examAttribute = x.score == null
? "ไม่มีคุณสมบัติ" examAttribute = x.score != null && !string.IsNullOrEmpty(x.score.ExamAttribute) &&
: string.IsNullOrEmpty(x.score.ExamAttribute) (x.score.ExamAttribute == "มีคุณสมบัติ" || x.score.ExamAttribute == "ไม่มีคุณสมบัติ")
? "ไม่มีคุณสมบัติ" ? x.score.ExamAttribute : "",
: x.score.ExamAttribute,
remark = x.disable.Remark, remark = x.disable.Remark,
isSpecial = x.disable.Isspecial == "Y" ? x.disable.Isspecial : "", isSpecial = x.disable.Isspecial == "Y" ? x.disable.Isspecial : "",
applyDate = x.disable.ApplyDate.HasValue && x.disable.ApplyDate.Value != DateTime.MinValue applyDate = x.disable.ApplyDate.HasValue && x.disable.ApplyDate.Value != DateTime.MinValue
@ -2227,11 +2215,11 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
// ? "มีคุณสมบัติ" // ? "มีคุณสมบัติ"
// : "ไม่มีคุณสมบัติ" // : "ไม่มีคุณสมบัติ"
// : "ไม่มีคุณสมบัติ", // : "ไม่มีคุณสมบัติ",
ExamAttribute = sr == null
? "ไม่มีคุณสมบัติ" ExamAttribute = sr != null && !string.IsNullOrEmpty(sr.ExamAttribute) &&
: string.IsNullOrEmpty(sr.ExamAttribute) (sr.ExamAttribute == "มีคุณสมบัติ" || sr.ExamAttribute == "ไม่มีคุณสมบัติ")
? "ไม่มีคุณสมบัติ" ? sr.ExamAttribute : "",
: sr.ExamAttribute,
IsSpecial = p.Isspecial, IsSpecial = p.Isspecial,
Remark = p.Remark, Remark = p.Remark,
University = p.Educations.First().University, University = p.Educations.First().University,