fix issue : ระบบสรรหา>>จัดการรอบสอบแข่งขัน (ข้อมูลไม่ตรงกับไฟล์ที่ Import) #773

This commit is contained in:
Suphonchai Phoonsawat 2025-02-10 14:27:01 +07:00
parent d664dd42e9
commit 08c7a11ec0
16 changed files with 43 additions and 40 deletions

View file

@ -1,9 +1,6 @@
using Amazon.S3.Model;
using BMA.EHR.MetaData.Service.Models;
using BMA.EHR.Profile.Service.Models.HR;
//using BMA.EHR.Extensions;
using BMA.EHR.Recruit.Service.Core;
using BMA.EHR.Recruit.Service.Data;
using BMA.EHR.Recruit.Service.Extensions;
@ -1242,6 +1239,9 @@ namespace BMA.EHR.Recruit.Service.Controllers
var file = Request.Form.Files[0];
var doc = await _minioService.UploadFileAsync(file);
import_doc_id = doc.Id.ToString("D");
Console.WriteLine($"file id = {import_doc_id}");
var fileContent = (await _minioService.DownloadFileAsync(doc.Id)).FileContent;
// create import history
@ -1284,20 +1284,20 @@ namespace BMA.EHR.Recruit.Service.Controllers
r.ExamId = workSheet?.Cells[row, 2]?.GetValue<string>();
r.FullA = (int)workSheet?.Cells[7, 7]?.GetValue<string>().Replace("(", "").Replace(")", "").Replace("คะแนน", "").Trim().ToInteger();
r.SumA = workSheet?.Cells[row, 7]?.GetValue<string>() == "ขส." ? 0 : (int)workSheet?.Cells[row, 7]?.GetValue<string>().Replace(".00", "").ToInteger();
r.SumA = workSheet?.Cells[row, 7]?.GetValue<string>() == "ขส." ? 0.00 : (double)workSheet?.Cells[row, 7]?.GetValue<double>();
r.PercentageA = workSheet?.Cells[row, 8]?.GetValue<string>() == "ขส." ? 0.0 : (double)workSheet?.Cells[row, 8]?.GetValue<double>();
r.AStatus = workSheet?.Cells[row, 9]?.GetValue<string>();
r.FullB = (int)workSheet?.Cells[7, 12]?.GetValue<string>().Replace("(", "").Replace(")", "").Replace("คะแนน", "").Trim().ToInteger();
r.SumB = workSheet?.Cells[row, 12]?.GetValue<string>() == "ขส." ? 0 : (int)workSheet?.Cells[row, 12]?.GetValue<string>().Replace(".00", "").ToInteger();
r.SumB = workSheet?.Cells[row, 12]?.GetValue<string>() == "ขส." ? 0.00 : (double)workSheet?.Cells[row, 12]?.GetValue<double>();
r.PercentageB = workSheet?.Cells[row, 13]?.GetValue<string>() == "ขส." ? 0.0 : (double)workSheet?.Cells[row, 13]?.GetValue<double>();
r.BStatus = workSheet?.Cells[row, 14]?.GetValue<string>();
r.SumAB = workSheet?.Cells[row, 15]?.GetValue<string>() == "ขส." ? 0 : (int)workSheet?.Cells[row, 15]?.GetValue<string>().Replace(".00", "").ToInteger();
r.SumAB = workSheet?.Cells[row, 15]?.GetValue<string>() == "ขส." ? 0.00 : (double)workSheet?.Cells[row, 15]?.GetValue<double>();
r.ABStatus = workSheet?.Cells[row, 17]?.GetValue<string>();
r.FullC = (int)workSheet?.Cells[7, 20]?.GetValue<string>().Replace("(", "").Replace(")", "").Replace("คะแนน", "").Trim().ToInteger();
r.SumC = workSheet?.Cells[row, 20]?.GetValue<string>() == "ขส." ? 0 : (int)workSheet?.Cells[row, 20]?.GetValue<string>().Replace(".00", "").ToInteger();
r.SumC = workSheet?.Cells[row, 20]?.GetValue<string>() == "ขส." ? 0.00 : (double)workSheet?.Cells[row, 20]?.GetValue<double>();
r.PercentageC = workSheet?.Cells[row, 21]?.GetValue<string>() == "ขส." ? 0.0 : (double)workSheet?.Cells[row, 21]?.GetValue<double>();
r.CStatus = workSheet?.Cells[row, 22]?.GetValue<string>();
@ -1321,7 +1321,7 @@ namespace BMA.EHR.Recruit.Service.Controllers
}
catch (Exception ex)
{
await _minioService.DeleteFileAsync(Guid.Parse(import_doc_id));
//await _minioService.DeleteFileAsync(Guid.Parse(import_doc_id));
return Error(ex);
}
finally
@ -1547,7 +1547,7 @@ namespace BMA.EHR.Recruit.Service.Controllers
ExamName = p.RecruitImport!.Name,
ExamOrder = p.RecruitImport.Order,
ExamYear = p.RecruitImport.Year.ToThaiYear(),
Score = sr == null ? 0 : sr.SumA + sr.SumB + sr.SumC,
Score = sr == null ? 0.0 : sr.SumA + sr.SumB + sr.SumC,
Number = sr == null ? "" : sr.Number,
ExamCount = _recruitService.GetExamCount(p.CitizenId),
ScoreExpire = p.RecruitImport.AnnouncementDate == null ? "" : p.RecruitImport.AnnouncementDate.Value.AddYears(2).ToThaiShortDate(),