Merge branch 'develop' of github.com:Frappet/BMA-EHR-BackEnd into develop
This commit is contained in:
commit
a09a732ff1
8 changed files with 811 additions and 71 deletions
|
|
@ -6574,6 +6574,76 @@ namespace BMA.EHR.Command.Service.Controllers
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ส่งรายชื่อออกคำสั่ง C-PM-11
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <response code="200"></response>
|
||||||
|
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||||
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
|
[HttpPost("command11/report")]
|
||||||
|
public async Task<ActionResult<ResponseObject>> PostReportCommand11([FromBody] ReportPersonRequest reqss)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var resultData = new List<CommandReceiver>();
|
||||||
|
|
||||||
|
var baseAPI = _configuration["Node:API"];
|
||||||
|
var apiUrl = $"{baseAPI}/report/pass";
|
||||||
|
|
||||||
|
var response = new PassProbationResponse();
|
||||||
|
using (var client = new HttpClient())
|
||||||
|
{
|
||||||
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||||
|
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||||
|
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||||
|
var res = await client.SendAsync(req);
|
||||||
|
var result = await res.Content.ReadAsStringAsync();
|
||||||
|
|
||||||
|
response = JsonConvert.DeserializeObject<PassProbationResponse>(result);
|
||||||
|
|
||||||
|
var seq = 1;
|
||||||
|
foreach (var d in response!.data)
|
||||||
|
{
|
||||||
|
var _baseAPI = _configuration["API"];
|
||||||
|
var _apiUrl = $"{_baseAPI}/org/profile/profileid/position/{d.person.id}";
|
||||||
|
using (var _client = new HttpClient())
|
||||||
|
{
|
||||||
|
_client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||||
|
_client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||||
|
var _req = new HttpRequestMessage(HttpMethod.Get, _apiUrl);
|
||||||
|
var _res = await _client.SendAsync(_req);
|
||||||
|
var _result = await _res.Content.ReadAsStringAsync();
|
||||||
|
|
||||||
|
var org = JsonConvert.DeserializeObject<OrgRequest>(_result);
|
||||||
|
|
||||||
|
if (org == null || org.result == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
var receiver = new CommandReceiver
|
||||||
|
{
|
||||||
|
Sequence = seq,
|
||||||
|
CitizenId = org.result.citizenId == null ? "" : org.result.citizenId,
|
||||||
|
Prefix = org.result.prefix == null ? "" : org.result.prefix,
|
||||||
|
FirstName = org.result.firstName == null ? "" : org.result.firstName,
|
||||||
|
LastName = org.result.lastName == null ? "" : org.result.lastName,
|
||||||
|
RefPlacementProfileId = org.result.profileId == null ? null : Guid.Parse(org.result.profileId),
|
||||||
|
};
|
||||||
|
seq++;
|
||||||
|
resultData.Add(receiver);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Success();
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ออกคำสั่ง C-PM-11
|
/// ออกคำสั่ง C-PM-11
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -6608,6 +6678,76 @@ namespace BMA.EHR.Command.Service.Controllers
|
||||||
return Success();
|
return Success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ส่งรายชื่อออกคำสั่ง C-PM-12
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <response code="200"></response>
|
||||||
|
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||||
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
|
[HttpPost("command12/report")]
|
||||||
|
public async Task<ActionResult<ResponseObject>> PostReportCommand12([FromBody] ReportPersonRequest reqss)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var resultData = new List<CommandReceiver>();
|
||||||
|
|
||||||
|
var baseAPI = _configuration["Node:API"];
|
||||||
|
var apiUrl = $"{baseAPI}/report/not-pass";
|
||||||
|
|
||||||
|
var response = new PassProbationResponse();
|
||||||
|
using (var client = new HttpClient())
|
||||||
|
{
|
||||||
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||||
|
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||||
|
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||||
|
var res = await client.SendAsync(req);
|
||||||
|
var result = await res.Content.ReadAsStringAsync();
|
||||||
|
|
||||||
|
response = JsonConvert.DeserializeObject<PassProbationResponse>(result);
|
||||||
|
|
||||||
|
var seq = 1;
|
||||||
|
foreach (var d in response!.data)
|
||||||
|
{
|
||||||
|
var _baseAPI = _configuration["API"];
|
||||||
|
var _apiUrl = $"{_baseAPI}/org/profile/profileid/position/{d.person.id}";
|
||||||
|
using (var _client = new HttpClient())
|
||||||
|
{
|
||||||
|
_client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
|
_client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||||
|
var _req = new HttpRequestMessage(HttpMethod.Get, _apiUrl);
|
||||||
|
var _res = await _client.SendAsync(_req);
|
||||||
|
var _result = await _res.Content.ReadAsStringAsync();
|
||||||
|
|
||||||
|
var org = JsonConvert.DeserializeObject<OrgRequest>(_result);
|
||||||
|
|
||||||
|
if (org == null || org.result == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
var receiver = new CommandReceiver
|
||||||
|
{
|
||||||
|
Sequence = seq,
|
||||||
|
CitizenId = org.result.citizenId == null ? "" : org.result.citizenId,
|
||||||
|
Prefix = org.result.prefix == null ? "" : org.result.prefix,
|
||||||
|
FirstName = org.result.firstName == null ? "" : org.result.firstName,
|
||||||
|
LastName = org.result.lastName == null ? "" : org.result.lastName,
|
||||||
|
RefPlacementProfileId = org.result.profileId == null ? null : Guid.Parse(org.result.profileId),
|
||||||
|
};
|
||||||
|
seq++;
|
||||||
|
resultData.Add(receiver);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Success();
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ออกคำสั่ง C-PM-12
|
/// ออกคำสั่ง C-PM-12
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -6642,6 +6782,30 @@ namespace BMA.EHR.Command.Service.Controllers
|
||||||
return Success();
|
return Success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ส่งรายชื่อออกคำสั่ง C-PM-19
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <response code="200"></response>
|
||||||
|
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||||
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
|
[HttpPost("command19/report")]
|
||||||
|
public async Task<ActionResult<ResponseObject>> PostReportCommand19([FromBody] ReportPersonRequest req)
|
||||||
|
{
|
||||||
|
var placementProfiles = await _context.RetirementDischarges
|
||||||
|
.Where(x => req.refIds.Contains(x.Id.ToString()))
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
foreach (var placementProfile in placementProfiles)
|
||||||
|
{
|
||||||
|
// update placementstatus
|
||||||
|
placementProfile.Status = "REPORT";
|
||||||
|
}
|
||||||
|
await _context.SaveChangesAsync();
|
||||||
|
return Success();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ออกคำสั่ง C-PM-19
|
/// ออกคำสั่ง C-PM-19
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -6676,6 +6840,30 @@ namespace BMA.EHR.Command.Service.Controllers
|
||||||
return Success();
|
return Success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ส่งรายชื่อออกคำสั่ง C-PM-20
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <response code="200"></response>
|
||||||
|
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||||
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
|
[HttpPost("command20/report")]
|
||||||
|
public async Task<ActionResult<ResponseObject>> PostReportcommand20([FromBody] ReportPersonRequest req)
|
||||||
|
{
|
||||||
|
var placementProfiles = await _context.RetirementExpulsions
|
||||||
|
.Where(x => req.refIds.Contains(x.Id.ToString()))
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
foreach (var placementProfile in placementProfiles)
|
||||||
|
{
|
||||||
|
// update placementstatus
|
||||||
|
placementProfile.Status = "REPORT";
|
||||||
|
}
|
||||||
|
await _context.SaveChangesAsync();
|
||||||
|
return Success();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ออกคำสั่ง C-PM-20
|
/// ออกคำสั่ง C-PM-20
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -6710,6 +6898,68 @@ namespace BMA.EHR.Command.Service.Controllers
|
||||||
return Success();
|
return Success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ส่งรายชื่อออกคำสั่ง C-PM-21
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <response code="200"></response>
|
||||||
|
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||||
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
|
[HttpPost("command21/report")]
|
||||||
|
public async Task<ActionResult<ResponseObject>> PostReportcommand21([FromBody] ReportPersonRequest req_)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var resultData = new List<CommandReceiver>();
|
||||||
|
|
||||||
|
var baseAPI = _configuration["API"];
|
||||||
|
var apiUrl = $"{baseAPI}/org/profile-employee/report-temp";
|
||||||
|
|
||||||
|
var response = new PassSalaryResponse();
|
||||||
|
using (var client = new HttpClient())
|
||||||
|
{
|
||||||
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||||
|
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||||
|
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||||
|
var res = await client.SendAsync(req);
|
||||||
|
var result = await res.Content.ReadAsStringAsync();
|
||||||
|
|
||||||
|
response = JsonConvert.DeserializeObject<PassSalaryResponse>(result);
|
||||||
|
|
||||||
|
var seq = 1;
|
||||||
|
foreach (var d in response!.result)
|
||||||
|
{
|
||||||
|
var receiver = new CommandReceiver
|
||||||
|
{
|
||||||
|
Sequence = seq,
|
||||||
|
CitizenId = d.citizenId,
|
||||||
|
Prefix = d.prefix == null ? "" : d.prefix,
|
||||||
|
FirstName = d.firstName == null ? "" : d.firstName,
|
||||||
|
LastName = d.lastName == null ? "" : d.lastName,
|
||||||
|
RefPlacementProfileId = d.id,
|
||||||
|
RefDisciplineId = d.id,
|
||||||
|
Organization = d.organization,
|
||||||
|
PositionName = d.positionName,
|
||||||
|
PositionLevel = d.positionLevel,
|
||||||
|
PositionType = d.positionType,
|
||||||
|
PositionNumber = d.positionNumber,
|
||||||
|
BirthDate = d.birthDate,
|
||||||
|
};
|
||||||
|
seq++;
|
||||||
|
|
||||||
|
resultData.Add(receiver);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Success(resultData);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ออกคำสั่ง C-PM-21
|
/// ออกคำสั่ง C-PM-21
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
|
|
@ -568,6 +568,72 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
return Success();
|
return Success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ส่งรายชื่อออกคำสั่ง C-PM-15
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <response code="200"></response>
|
||||||
|
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||||
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
|
[HttpPost("report/report")]
|
||||||
|
public async Task<ActionResult<ResponseObject>> PostReport([FromBody] ReportPersonRequest req)
|
||||||
|
{
|
||||||
|
var placementProfiles = await _context.PlacementOfficers
|
||||||
|
.Where(x => req.refIds.Contains(x.Id.ToString()))
|
||||||
|
.ToListAsync();
|
||||||
|
foreach (var placementProfile in placementProfiles)
|
||||||
|
{
|
||||||
|
// update placementstatus
|
||||||
|
placementProfile.Status = "REPORT";
|
||||||
|
}
|
||||||
|
await _context.SaveChangesAsync();
|
||||||
|
return Success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// เอกสารแนบท้าย C-PM-15
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">Record Id ของคำสั่ง</param>
|
||||||
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||||
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
|
[HttpPost("report/report/attachment")]
|
||||||
|
[AllowAnonymous]
|
||||||
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||||
|
public async Task<ActionResult<ResponseObject>> PostReportAttachment([FromBody] ReportPersonRequest req)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var report_data = await _context.PlacementOfficers
|
||||||
|
.Where(x => req.refIds.Contains(x.Id.ToString()))
|
||||||
|
.Select(p => new
|
||||||
|
{
|
||||||
|
//Seq = r.Sequence.ToString().ToThaiNumber(),
|
||||||
|
//CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(),
|
||||||
|
//FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
|
||||||
|
Seq = "",
|
||||||
|
CitizenId = "",
|
||||||
|
FullName = "",
|
||||||
|
PositionName = p.OrganizationPositionOld == null ? "" : p.OrganizationPositionOld,
|
||||||
|
Organization = p.Organization == null ? "" : p.Organization,
|
||||||
|
StartDate = p.DateStart == null ? "" : p.DateStart.Value.ToThaiShortDate2().ToThaiNumber(),
|
||||||
|
EndDate = p.DateEnd == null ? "" : p.DateEnd.Value.ToThaiShortDate2().ToThaiNumber(),
|
||||||
|
Reason = p.Reason == null ? "" : p.Reason.ToThaiNumber()
|
||||||
|
})
|
||||||
|
.ToListAsync();
|
||||||
|
return Success(report_data);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ออกคำสั่ง C-PM-15
|
/// ออกคำสั่ง C-PM-15
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
|
|
@ -880,6 +880,88 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
return Success(position);
|
return Success(position);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ส่งรายชื่อออกคำสั่ง C-PM-14
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <response code="200"></response>
|
||||||
|
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||||
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
|
[HttpPost("report/report")]
|
||||||
|
public async Task<ActionResult<ResponseObject>> PostReport([FromBody] ReportPersonRequest req)
|
||||||
|
{
|
||||||
|
var placementProfiles = await _context.PlacementReceives
|
||||||
|
.Where(x => req.refIds.Contains(x.Id.ToString()))
|
||||||
|
.ToListAsync();
|
||||||
|
foreach (var placementProfile in placementProfiles)
|
||||||
|
{
|
||||||
|
// update placementstatus
|
||||||
|
placementProfile.Status = "REPORT";
|
||||||
|
}
|
||||||
|
await _context.SaveChangesAsync();
|
||||||
|
return Success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// เอกสารแนบท้าย C-PM-14
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">Record Id ของคำสั่ง</param>
|
||||||
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||||
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
|
[HttpPost("report/report/attachment")]
|
||||||
|
[AllowAnonymous]
|
||||||
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||||
|
public async Task<ActionResult<ResponseObject>> PostReportAttachment([FromBody] ReportPersonRequest req)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var report_data = await _context.PlacementReceives
|
||||||
|
.Where(x => req.refIds.Contains(x.Id.ToString()))
|
||||||
|
.Select(p => new
|
||||||
|
{
|
||||||
|
Education = p.EducationOld == null ? "-" : p.EducationOld,
|
||||||
|
//Seq = r.Sequence.ToString().ToThaiNumber(),
|
||||||
|
//CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(),
|
||||||
|
//FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
|
||||||
|
Seq = "",
|
||||||
|
CitizenId = "",
|
||||||
|
FullName = "",
|
||||||
|
OldOc = p.OrganizationPositionOld ?? "",
|
||||||
|
OldPositionName = p.OrganizationPositionOld ?? "",
|
||||||
|
OldPositionLevel = p.PositionLevelOld ?? "",
|
||||||
|
OldPositionType = p.PositionTypeOld ?? "",
|
||||||
|
OldPositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld.ToThaiNumber(),
|
||||||
|
OldSalary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
||||||
|
NewOc = p.root == null ? "" : p.root,
|
||||||
|
NewPositionName = p.position == null ? "" : p.position,
|
||||||
|
NewPositionLevel = p.posLevelName == null ? "" : p.posLevelName,
|
||||||
|
NewPositionType = p.posTypeName == null ? "" : p.posTypeName,
|
||||||
|
NewPositionNumber = p.posMasterNo == null ? "" :
|
||||||
|
p.node == 4 ? $"{p.child4ShortName}{p.posMasterNo}".ToThaiNumber() :
|
||||||
|
p.node == 3 ? $"{p.child3ShortName}{p.posMasterNo}".ToThaiNumber() :
|
||||||
|
p.node == 2 ? $"{p.child2ShortName}{p.posMasterNo}".ToThaiNumber() :
|
||||||
|
p.node == 1 ? $"{p.child1ShortName}{p.posMasterNo}".ToThaiNumber() :
|
||||||
|
p.node == 0 ? $"{p.rootShortName}{p.posMasterNo}".ToThaiNumber() : "",
|
||||||
|
//NewSalary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
||||||
|
NewSalary = "",
|
||||||
|
AppointDate = p.ReportingDate == null ? "" : p.ReportingDate.Value.ToThaiShortDate2().ToThaiNumber(),
|
||||||
|
Reason = p.Reason == null ? "-" : p.Reason,
|
||||||
|
})
|
||||||
|
.ToListAsync();
|
||||||
|
return Success(report_data);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ออกคำสั่ง C-PM-14
|
/// ออกคำสั่ง C-PM-14
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
|
|
@ -475,6 +475,29 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
// return Success();
|
// return Success();
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ส่งรายชื่อออกคำสั่ง C-PM-16
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <response code="200"></response>
|
||||||
|
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||||
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
|
[HttpPost("report/report")]
|
||||||
|
public async Task<ActionResult<ResponseObject>> PostReport([FromBody] ReportPersonRequest req)
|
||||||
|
{
|
||||||
|
var placementProfiles = await _context.PlacementRepatriations
|
||||||
|
.Where(x => req.refIds.Contains(x.Id.ToString()))
|
||||||
|
.ToListAsync();
|
||||||
|
foreach (var placementProfile in placementProfiles)
|
||||||
|
{
|
||||||
|
// update placementstatus
|
||||||
|
placementProfile.Status = "REPORT";
|
||||||
|
}
|
||||||
|
await _context.SaveChangesAsync();
|
||||||
|
return Success();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ออกคำสั่ง C-PM-16
|
/// ออกคำสั่ง C-PM-16
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
|
|
@ -758,6 +758,77 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
return Success();
|
return Success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ส่งรายชื่อออกคำสั่ง C-PM-13
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <response code="200"></response>
|
||||||
|
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||||
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
|
[HttpPost("report/report")]
|
||||||
|
public async Task<ActionResult<ResponseObject>> PostReport([FromBody] ReportPersonRequest req)
|
||||||
|
{
|
||||||
|
var placementProfiles = await _context.PlacementTransfers
|
||||||
|
.Where(x => req.refIds.Contains(x.Id.ToString()))
|
||||||
|
.ToListAsync();
|
||||||
|
foreach (var placementProfile in placementProfiles)
|
||||||
|
{
|
||||||
|
// update placementstatus
|
||||||
|
placementProfile.Status = "REPORT";
|
||||||
|
}
|
||||||
|
await _context.SaveChangesAsync();
|
||||||
|
return Success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// เอกสารแนบท้าย C-PM-13
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">Record Id ของคำสั่ง</param>
|
||||||
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||||
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
|
[HttpPost("report/report/attachment")]
|
||||||
|
[AllowAnonymous]
|
||||||
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||||
|
public async Task<ActionResult<ResponseObject>> PostReportAttachment([FromBody] ReportPersonRequest req)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var report_data = await _context.PlacementTransfers
|
||||||
|
.Where(x => req.refIds.Contains(x.Id.ToString()))
|
||||||
|
.Select(p => new
|
||||||
|
{
|
||||||
|
//Seq = r.Sequence.ToString().ToThaiNumber(),
|
||||||
|
//CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(),
|
||||||
|
//FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
|
||||||
|
Seq = "",
|
||||||
|
CitizenId = "",
|
||||||
|
FullName = "",
|
||||||
|
Organization = p.OrganizationPositionOld == null ? "" : p.OrganizationPositionOld,
|
||||||
|
PositionName = p.PositionOld == null ? "" : p.PositionOld,
|
||||||
|
PositionLevel = p.PositionLevelOld == null ? "" : p.PositionLevelOld,
|
||||||
|
PositionType = p.PositionTypeOld == null ? "" : p.PositionTypeOld,
|
||||||
|
PositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld.ToThaiNumber(),
|
||||||
|
Salary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
||||||
|
ActiveDate = p.Date == null ? "" : p.Date.Value.ToThaiShortDate2().ToThaiNumber(),
|
||||||
|
//ReceiveOrganizationName = r.Command!.ReceiveOrganizationName ?? "",
|
||||||
|
ReceiveOrganizationName = "",
|
||||||
|
Reason = p.Reason ?? ""
|
||||||
|
})
|
||||||
|
.ToListAsync();
|
||||||
|
return Success(report_data);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ออกคำสั่ง C-PM-13
|
/// ออกคำสั่ง C-PM-13
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
|
|
@ -625,6 +625,85 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
return Success();
|
return Success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ส่งรายชื่อออกคำสั่ง C-PM-08
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <response code="200"></response>
|
||||||
|
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||||
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
|
[HttpPost("appoint/report")]
|
||||||
|
public async Task<ActionResult<ResponseObject>> PostReportAppoint([FromBody] ReportPersonRequest req)
|
||||||
|
{
|
||||||
|
var placementProfiles = await _context.RetirementOthers
|
||||||
|
.Where(x => req.refIds.Contains(x.Id.ToString()))
|
||||||
|
.ToListAsync();
|
||||||
|
foreach (var placementProfile in placementProfiles)
|
||||||
|
{
|
||||||
|
// update placementstatus
|
||||||
|
placementProfile.Status = "REPORT";
|
||||||
|
}
|
||||||
|
await _context.SaveChangesAsync();
|
||||||
|
return Success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// เอกสารแนบท้าย C-PM-08
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">Record Id ของคำสั่ง</param>
|
||||||
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||||
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
|
[HttpPost("appoint/report/attachment")]
|
||||||
|
[AllowAnonymous]
|
||||||
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||||
|
public async Task<ActionResult<ResponseObject>> PostReportAppointAttachment([FromBody] ReportPersonRequest req)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var report_data = await _context.RetirementOthers
|
||||||
|
.Where(x => req.refIds.Contains(x.Id.ToString()))
|
||||||
|
.Select(p => new
|
||||||
|
{
|
||||||
|
Education = p.EducationOld == null ? "-" : p.EducationOld,
|
||||||
|
//Seq = r.Sequence.ToString().ToThaiNumber(),
|
||||||
|
//CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(),
|
||||||
|
//FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
|
||||||
|
Seq = "",
|
||||||
|
CitizenId = "",
|
||||||
|
FullName = "",
|
||||||
|
OldOc = p.rootOld == null ? "" : p.rootOld,
|
||||||
|
OldPositionName = p.OrganizationPositionOld == null ? "" : p.OrganizationPositionOld,
|
||||||
|
OldPositionLevel = p.PositionLevelOld == null ? "" : p.PositionLevelOld,
|
||||||
|
OldPositionType = p.PositionTypeOld == null ? "" : p.PositionTypeOld,
|
||||||
|
OldPositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld.ToThaiNumber(),
|
||||||
|
OldSalary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
||||||
|
OldSalaryDate = p.PositionDate == null ? "" : p.PositionDate.Value.ToThaiShortDate2().ToThaiNumber(),
|
||||||
|
NewOc = p.rootOld == null ? "" : p.rootOld,
|
||||||
|
NewPositionName = p.OrganizationPositionOld == null ? "" : p.OrganizationPositionOld,
|
||||||
|
NewPositionLevel = p.PositionLevelOld == null ? "" : p.PositionLevelOld,
|
||||||
|
NewPositionType = p.PositionTypeOld == null ? "" : p.PositionTypeOld,
|
||||||
|
NewPositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld.ToThaiNumber(),
|
||||||
|
//NewSalary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
||||||
|
NewSalary = "",
|
||||||
|
AppointDate = p.PositionDate == null ? "" : p.PositionDate.Value.ToThaiShortDate2().ToThaiNumber(),
|
||||||
|
LeaveDate = p.LeaveDate == null ? "" : p.LeaveDate.Value.ToThaiShortDate2().ToThaiNumber(),
|
||||||
|
Reason = p.Reason == null ? "-" : p.Reason,
|
||||||
|
})
|
||||||
|
.ToListAsync();
|
||||||
|
return Success(report_data);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ออกคำสั่ง C-PM-08
|
/// ออกคำสั่ง C-PM-08
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -696,6 +775,85 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
return Success();
|
return Success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ส่งรายชื่อออกคำสั่ง C-PM-09
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <response code="200"></response>
|
||||||
|
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||||
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
|
[HttpPost("out/report")]
|
||||||
|
public async Task<ActionResult<ResponseObject>> PostReportOut([FromBody] ReportPersonRequest req)
|
||||||
|
{
|
||||||
|
var placementProfiles = await _context.RetirementOthers
|
||||||
|
.Where(x => req.refIds.Contains(x.Id.ToString()))
|
||||||
|
.ToListAsync();
|
||||||
|
foreach (var placementProfile in placementProfiles)
|
||||||
|
{
|
||||||
|
// update placementstatus
|
||||||
|
placementProfile.Status = "REPORT";
|
||||||
|
}
|
||||||
|
await _context.SaveChangesAsync();
|
||||||
|
return Success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// เอกสารแนบท้าย C-PM-09
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">Record Id ของคำสั่ง</param>
|
||||||
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||||
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
|
[HttpPost("out/report/attachment")]
|
||||||
|
[AllowAnonymous]
|
||||||
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||||
|
public async Task<ActionResult<ResponseObject>> PostReportOutAttachment([FromBody] ReportPersonRequest req)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var report_data = await _context.RetirementOthers
|
||||||
|
.Where(x => req.refIds.Contains(x.Id.ToString()))
|
||||||
|
.Select(p => new
|
||||||
|
{
|
||||||
|
Education = p.EducationOld == null ? "-" : p.EducationOld,
|
||||||
|
//Seq = r.Sequence.ToString().ToThaiNumber(),
|
||||||
|
//CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(),
|
||||||
|
//FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
|
||||||
|
Seq = "",
|
||||||
|
CitizenId = "",
|
||||||
|
FullName = "",
|
||||||
|
OldOc = p.rootOld == null ? "" : p.rootOld,
|
||||||
|
OldPositionName = p.OrganizationPositionOld == null ? "" : p.OrganizationPositionOld,
|
||||||
|
OldPositionLevel = p.PositionLevelOld == null ? "" : p.PositionLevelOld,
|
||||||
|
OldPositionType = p.PositionTypeOld == null ? "" : p.PositionTypeOld,
|
||||||
|
OldPositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld.ToThaiNumber(),
|
||||||
|
OldSalary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
||||||
|
OldSalaryDate = p.PositionDate == null ? "" : p.PositionDate.Value.ToThaiShortDate2().ToThaiNumber(),
|
||||||
|
NewOc = p.rootOld == null ? "" : p.rootOld,
|
||||||
|
NewPositionName = p.OrganizationPositionOld == null ? "" : p.OrganizationPositionOld,
|
||||||
|
NewPositionLevel = p.PositionLevelOld == null ? "" : p.PositionLevelOld,
|
||||||
|
NewPositionType = p.PositionTypeOld == null ? "" : p.PositionTypeOld,
|
||||||
|
NewPositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld.ToThaiNumber(),
|
||||||
|
NewSalary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
||||||
|
AppointDate = p.PositionDate == null ? "" : p.PositionDate.Value.ToThaiShortDate2().ToThaiNumber(),
|
||||||
|
LeaveDate = p.LeaveDate == null ? "" : p.LeaveDate.Value.ToThaiShortDate2().ToThaiNumber(),
|
||||||
|
MilitaryDate = p.MilitaryDate == null ? "" : p.MilitaryDate.Value.ToThaiShortDate2().ToThaiNumber(),
|
||||||
|
Reason = p.Reason == null ? "-" : p.Reason,
|
||||||
|
})
|
||||||
|
.ToListAsync();
|
||||||
|
return Success(report_data);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ออกคำสั่ง C-PM-09
|
/// ออกคำสั่ง C-PM-09
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -766,76 +924,5 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
}
|
}
|
||||||
return Success();
|
return Success();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// ออกคำสั่ง C-PM-18
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
/// <response code="200"></response>
|
|
||||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
|
||||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
||||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
||||||
[HttpPost("leave/report/excecute")]
|
|
||||||
public async Task<ActionResult<ResponseObject>> PostReportExecuteLeave([FromBody] ReportExecuteRequest req)
|
|
||||||
{
|
|
||||||
// create new profile
|
|
||||||
foreach (var recv in req.refIds)
|
|
||||||
{
|
|
||||||
var data = await _context.RetirementOuts
|
|
||||||
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(recv.refId));
|
|
||||||
|
|
||||||
if (data == null)
|
|
||||||
throw new Exception(GlobalMessages.DataNotFound);
|
|
||||||
|
|
||||||
var baseAPI = _configuration["API"];
|
|
||||||
var apiUrl = $"{baseAPI}/org/profile/leave/{data.profileId}";
|
|
||||||
|
|
||||||
using (var client = new HttpClient())
|
|
||||||
{
|
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
|
||||||
var _res = await client.PostAsJsonAsync(apiUrl, new
|
|
||||||
{
|
|
||||||
isLeave = true,
|
|
||||||
leaveReason = "ให้ออกจากราชการ",
|
|
||||||
dateLeave = recv.commandAffectDate,
|
|
||||||
});
|
|
||||||
var _result = await _res.Content.ReadAsStringAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
var apiUrlSalary = $"{baseAPI}/org/profile/salary";
|
|
||||||
using (var client = new HttpClient())
|
|
||||||
{
|
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlSalary);
|
|
||||||
var _res = await client.PostAsJsonAsync(apiUrlSalary, new
|
|
||||||
{
|
|
||||||
profileId = data.profileId,
|
|
||||||
date = recv.commandAffectDate,
|
|
||||||
amount = recv.amount,
|
|
||||||
positionSalaryAmount = recv.positionSalaryAmount,
|
|
||||||
mouthSalaryAmount = recv.mouthSalaryAmount,
|
|
||||||
posNo = data.PositionNumberOld,
|
|
||||||
position = data.PositionOld,
|
|
||||||
positionLine = "",
|
|
||||||
positionPathSide = "",
|
|
||||||
positionExecutive = "",
|
|
||||||
positionType = data.PositionTypeOld,
|
|
||||||
positionLevel = data.PositionLevelOld,
|
|
||||||
refCommandNo = $"{recv.commandNo}/{recv.commandYear.ToThaiYear()}",
|
|
||||||
templateDoc = recv.templateDoc,
|
|
||||||
});
|
|
||||||
var _result = await _res.Content.ReadAsStringAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
// update placementstatus
|
|
||||||
data.Status = "DONE";
|
|
||||||
|
|
||||||
await _context.SaveChangesAsync();
|
|
||||||
}
|
|
||||||
return Success();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -464,5 +464,99 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
|
|
||||||
return Success();
|
return Success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ส่งรายชื่อออกคำสั่ง C-PM-18
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <response code="200"></response>
|
||||||
|
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||||
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
|
[HttpPost("command18/report")]
|
||||||
|
public async Task<ActionResult<ResponseObject>> PostReportCommand18([FromBody] ReportPersonRequest req)
|
||||||
|
{
|
||||||
|
var placementProfiles = await _context.RetirementResigns
|
||||||
|
.Where(x => req.refIds.Contains(x.Id.ToString()))
|
||||||
|
.ToListAsync();
|
||||||
|
foreach (var placementProfile in placementProfiles)
|
||||||
|
{
|
||||||
|
// update placementstatus
|
||||||
|
placementProfile.Status = "REPORT";
|
||||||
|
}
|
||||||
|
await _context.SaveChangesAsync();
|
||||||
|
return Success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ออกคำสั่ง C-PM-18
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <response code="200"></response>
|
||||||
|
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||||
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
|
[HttpPost("command18/report/excecute")]
|
||||||
|
public async Task<ActionResult<ResponseObject>> PostReportExecuteLeave([FromBody] ReportExecuteRequest req)
|
||||||
|
{
|
||||||
|
// create new profile
|
||||||
|
foreach (var recv in req.refIds)
|
||||||
|
{
|
||||||
|
var data = await _context.RetirementOuts
|
||||||
|
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(recv.refId));
|
||||||
|
|
||||||
|
if (data == null)
|
||||||
|
throw new Exception(GlobalMessages.DataNotFound);
|
||||||
|
|
||||||
|
var baseAPI = _configuration["API"];
|
||||||
|
var apiUrl = $"{baseAPI}/org/profile/leave/{data.profileId}";
|
||||||
|
|
||||||
|
using (var client = new HttpClient())
|
||||||
|
{
|
||||||
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
|
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||||
|
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
||||||
|
var _res = await client.PostAsJsonAsync(apiUrl, new
|
||||||
|
{
|
||||||
|
isLeave = true,
|
||||||
|
leaveReason = "ให้ออกจากราชการ",
|
||||||
|
dateLeave = recv.commandAffectDate,
|
||||||
|
});
|
||||||
|
var _result = await _res.Content.ReadAsStringAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
var apiUrlSalary = $"{baseAPI}/org/profile/salary";
|
||||||
|
using (var client = new HttpClient())
|
||||||
|
{
|
||||||
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
|
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||||
|
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlSalary);
|
||||||
|
var _res = await client.PostAsJsonAsync(apiUrlSalary, new
|
||||||
|
{
|
||||||
|
profileId = data.profileId,
|
||||||
|
date = recv.commandAffectDate,
|
||||||
|
amount = recv.amount,
|
||||||
|
positionSalaryAmount = recv.positionSalaryAmount,
|
||||||
|
mouthSalaryAmount = recv.mouthSalaryAmount,
|
||||||
|
posNo = data.PositionNumberOld,
|
||||||
|
position = data.PositionOld,
|
||||||
|
positionLine = "",
|
||||||
|
positionPathSide = "",
|
||||||
|
positionExecutive = "",
|
||||||
|
positionType = data.PositionTypeOld,
|
||||||
|
positionLevel = data.PositionLevelOld,
|
||||||
|
refCommandNo = $"{recv.commandNo}/{recv.commandYear.ToThaiYear()}",
|
||||||
|
templateDoc = recv.templateDoc,
|
||||||
|
});
|
||||||
|
var _result = await _res.Content.ReadAsStringAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
// update placementstatus
|
||||||
|
data.Status = "DONE";
|
||||||
|
|
||||||
|
await _context.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
return Success();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1629,6 +1629,73 @@ $"คำขอลาออกของ {updated.prefix}{updated.firstName} {upda
|
||||||
return Success(retirementQuestionnaireQuestion);
|
return Success(retirementQuestionnaireQuestion);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ส่งรายชื่อออกคำสั่ง C-PM-17
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <response code="200"></response>
|
||||||
|
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||||
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
|
[HttpPost("report/report")]
|
||||||
|
public async Task<ActionResult<ResponseObject>> PostReport([FromBody] ReportPersonRequest req)
|
||||||
|
{
|
||||||
|
var placementProfiles = await _context.RetirementResigns
|
||||||
|
.Where(x => req.refIds.Contains(x.Id.ToString()))
|
||||||
|
.ToListAsync();
|
||||||
|
foreach (var placementProfile in placementProfiles)
|
||||||
|
{
|
||||||
|
// update placementstatus
|
||||||
|
placementProfile.Status = "REPORT";
|
||||||
|
}
|
||||||
|
await _context.SaveChangesAsync();
|
||||||
|
return Success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// เอกสารแนบท้าย C-PM-17
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">Record Id ของคำสั่ง</param>
|
||||||
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||||
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
|
[HttpPost("report/report/attachment")]
|
||||||
|
[AllowAnonymous]
|
||||||
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||||
|
public async Task<ActionResult<ResponseObject>> PostReportAttachment([FromBody] ReportPersonRequest req)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var report_data = await _context.RetirementResigns
|
||||||
|
.Where(x => req.refIds.Contains(x.Id.ToString()))
|
||||||
|
.Select(p => new
|
||||||
|
{
|
||||||
|
//Seq = r.Sequence.ToString().ToThaiNumber(),
|
||||||
|
//CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(),
|
||||||
|
//FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
|
||||||
|
PositionName = p.PositionOld ?? "",
|
||||||
|
Organization = p.OrganizationPositionOld ?? "",
|
||||||
|
PositionLevel = p.PositionLevelOld ?? "",
|
||||||
|
PositionType = p.PositionTypeOld ?? "",
|
||||||
|
PositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld.ToThaiNumber(),
|
||||||
|
ActiveDate = p.ActiveDate == null ? "" : p.ActiveDate.Value.ToThaiShortDate2().ToThaiNumber(),
|
||||||
|
Salary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
||||||
|
Remark = p.Reason ?? "",
|
||||||
|
RemarkHorizontal = p.RemarkHorizontal,
|
||||||
|
})
|
||||||
|
.ToListAsync();
|
||||||
|
return Success(report_data);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ออกคำสั่ง C-PM-17
|
/// ออกคำสั่ง C-PM-17
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue