เพิ่มการบันทึกไปทะเบียนประวัติ ตามประเภท officer หรือ employee โดยไปเรียก api ของระบบโครงสร้าง

This commit is contained in:
Suphonchai Phoonsawat 2025-05-28 11:28:14 +07:00
parent d9be2426c4
commit 52d8db409c

View file

@ -2293,24 +2293,71 @@ namespace BMA.EHR.Insignia.Service.Controllers
if (profile.Status != "DONE") if (profile.Status != "DONE")
{ {
profile.Status = "DONE"; profile.Status = "DONE";
var profileInsignia = new PostProfileInsigniaDto
// check profile.ProfileType ก่อนส่งไประบบทะเบียนประวัติ
if (profile.ProfileType == "OFFICER")
{ {
profileId = profile.ProfileId.Value, var profileInsigniaBody = new PostProfileInsigniaDto
year = insigniaNote.Year, {
no = profile.No, profileId = profile!.ProfileId!.Value,
volumeNo = profile.VolumeNo, year = insigniaNote.Year,
section = profile.Section, no = profile!.No ?? "",
page = profile.Page, volumeNo = profile!.VolumeNo ?? "",
receiveDate = profile.DateReceive.Value, section = profile!.Section ?? "",
dateAnnounce = profile.Date.Value, page = profile!.Page ?? "",
insigniaId = profile.RequestInsignia.Id, receiveDate = profile.DateReceive!.Value,
issue = "", dateAnnounce = profile.Date!.Value,
note = "", insigniaId = profile.RequestInsignia!.Id,
refCommandDate = null, issue = "",
refCommandNo = "", note = "",
volume = "", refCommandDate = null,
}; refCommandNo = "",
await _userProfileRepository.PostProfileInsigniaAsync(profileInsignia, AccessToken); volume = "",
};
await _userProfileRepository.PostProfileInsigniaAsync(profileInsigniaBody, AccessToken);
}
else
{
var profileInsigniaBody = new PostProfileEmpInsigniaDto
{
profileEmployeeId = profile!.ProfileId!.Value,
year = insigniaNote.Year,
no = profile!.No ?? "",
volumeNo = profile!.VolumeNo ?? "",
section = profile!.Section ?? "",
page = profile!.Page ?? "",
receiveDate = profile.DateReceive!.Value,
dateAnnounce = profile.Date!.Value,
insigniaId = profile.RequestInsignia!.Id,
issue = "",
note = "",
refCommandDate = null,
refCommandNo = "",
volume = "",
};
await _userProfileRepository.PostProfileEmpInsigniaAsync(profileInsigniaBody, AccessToken);
}
//var profileInsignia = new PostProfileInsigniaDto
//{
// profileId = profile.ProfileId.Value,
// year = insigniaNote.Year,
// no = profile.No,
// volumeNo = profile.VolumeNo,
// section = profile.Section,
// page = profile.Page,
// receiveDate = profile.DateReceive.Value,
// dateAnnounce = profile.Date.Value,
// insigniaId = profile.RequestInsignia.Id,
// issue = "",
// note = "",
// refCommandDate = null,
// refCommandNo = "",
// volume = "",
//};
//await _userProfileRepository.PostProfileInsigniaAsync(profileInsignia, AccessToken);
} }
} }
await _context.SaveChangesAsync(); await _context.SaveChangesAsync();