diff --git a/BMA.EHR.Command.Service/Controllers/OrderController.cs b/BMA.EHR.Command.Service/Controllers/OrderController.cs
index e1513832..7f804153 100644
--- a/BMA.EHR.Command.Service/Controllers/OrderController.cs
+++ b/BMA.EHR.Command.Service/Controllers/OrderController.cs
@@ -6741,5 +6741,410 @@ namespace BMA.EHR.Command.Service.Controllers
}
return Success();
}
+
+ ///
+ /// ออกคำสั่ง C-PM-25
+ ///
+ ///
+ ///
+ /// ค่าตัวแปรที่ส่งมาไม่ถูกต้อง
+ /// ไม่ได้ Login เข้าระบบ
+ /// เมื่อเกิดข้อผิดพลาดในการทำงาน
+ [HttpPost("command25/report/excecute")]
+ public async Task> PostReportCommand25Execute([FromBody] ReportExecuteRequest req)
+ {
+ var data = req.refIds.Select(x => new
+ {
+ Id = x.refId,
+ CommandAffectDate = x.commandAffectDate,
+ CommandNo = x.commandNo,
+ CommandYear = x.commandYear.ToThaiYear(),
+ Detail = "คำสั่งลงโทษ พักจากราชการ"
+ });
+
+ var baseAPI = _configuration["API"];
+ var apiUrl = $"{baseAPI}/discipline/result/report/stop/resume";
+ using (var client = new HttpClient())
+ {
+ client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
+ client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
+ var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
+ var result = await res.Content.ReadAsStringAsync();
+ }
+ return Success();
+ }
+
+ ///
+ /// ออกคำสั่ง C-PM-26
+ ///
+ ///
+ ///
+ /// ค่าตัวแปรที่ส่งมาไม่ถูกต้อง
+ /// ไม่ได้ Login เข้าระบบ
+ /// เมื่อเกิดข้อผิดพลาดในการทำงาน
+ [HttpPost("command26/report/excecute")]
+ public async Task> PostReportCommand26Execute([FromBody] ReportExecuteRequest req)
+ {
+ var data = req.refIds.Select(x => new
+ {
+ Id = x.refId,
+ CommandAffectDate = x.commandAffectDate,
+ CommandNo = x.commandNo,
+ CommandYear = x.commandYear.ToThaiYear(),
+ Detail = "คำสั่งลงโทษ ให้ออกจากราชการไว้ก่อน"
+ });
+
+ var baseAPI = _configuration["API"];
+ var apiUrl = $"{baseAPI}/discipline/result/report/stop/resume";
+ using (var client = new HttpClient())
+ {
+ client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
+ client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
+ var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
+ var result = await res.Content.ReadAsStringAsync();
+ }
+ return Success();
+ }
+
+ ///
+ /// ออกคำสั่ง C-PM-27
+ ///
+ ///
+ ///
+ /// ค่าตัวแปรที่ส่งมาไม่ถูกต้อง
+ /// ไม่ได้ Login เข้าระบบ
+ /// เมื่อเกิดข้อผิดพลาดในการทำงาน
+ [HttpPost("command27/report/excecute")]
+ public async Task> PostReportCommand27Execute([FromBody] ReportExecuteRequest req)
+ {
+ var data = req.refIds.Select(x => new
+ {
+ Id = x.refId,
+ CommandAffectDate = x.commandAffectDate,
+ CommandNo = x.commandNo,
+ CommandYear = x.commandYear.ToThaiYear(),
+ Detail = "คำสั่งลงโทษ ลงโทษ ภาคทัณฑ์"
+ });
+
+ var baseAPI = _configuration["API"];
+ var apiUrl = $"{baseAPI}/discipline/result/report/up/resume";
+ using (var client = new HttpClient())
+ {
+ client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
+ client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
+ var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
+ var result = await res.Content.ReadAsStringAsync();
+ }
+ return Success();
+ }
+
+ ///
+ /// ออกคำสั่ง C-PM-28
+ ///
+ ///
+ ///
+ /// ค่าตัวแปรที่ส่งมาไม่ถูกต้อง
+ /// ไม่ได้ Login เข้าระบบ
+ /// เมื่อเกิดข้อผิดพลาดในการทำงาน
+ [HttpPost("command28/report/excecute")]
+ public async Task> PostReportCommand28Execute([FromBody] ReportExecuteRequest req)
+ {
+ var data = req.refIds.Select(x => new
+ {
+ Id = x.refId,
+ CommandAffectDate = x.commandAffectDate,
+ CommandNo = x.commandNo,
+ CommandYear = x.commandYear.ToThaiYear(),
+ Detail = "คำสั่งลงโทษ ตัดเงินเดือน"
+ });
+
+ var baseAPI = _configuration["API"];
+ var apiUrl = $"{baseAPI}/discipline/result/report/up/resume";
+ using (var client = new HttpClient())
+ {
+ client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
+ client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
+ var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
+ var result = await res.Content.ReadAsStringAsync();
+ }
+ return Success();
+ }
+
+ ///
+ /// ออกคำสั่ง C-PM-29
+ ///
+ ///
+ ///
+ /// ค่าตัวแปรที่ส่งมาไม่ถูกต้อง
+ /// ไม่ได้ Login เข้าระบบ
+ /// เมื่อเกิดข้อผิดพลาดในการทำงาน
+ [HttpPost("command29/report/excecute")]
+ public async Task> PostReportCommand29Execute([FromBody] ReportExecuteRequest req)
+ {
+ var data = req.refIds.Select(x => new
+ {
+ Id = x.refId,
+ CommandAffectDate = x.commandAffectDate,
+ CommandNo = x.commandNo,
+ CommandYear = x.commandYear.ToThaiYear(),
+ Detail = "คำสั่งลงโทษ ลดขั้นเงินเดือน"
+ });
+
+ var baseAPI = _configuration["API"];
+ var apiUrl = $"{baseAPI}/discipline/result/report/up/resume";
+ using (var client = new HttpClient())
+ {
+ client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
+ client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
+ var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
+ var result = await res.Content.ReadAsStringAsync();
+ }
+ return Success();
+ }
+
+ ///
+ /// ออกคำสั่ง C-PM-30
+ ///
+ ///
+ ///
+ /// ค่าตัวแปรที่ส่งมาไม่ถูกต้อง
+ /// ไม่ได้ Login เข้าระบบ
+ /// เมื่อเกิดข้อผิดพลาดในการทำงาน
+ [HttpPost("command30/report/excecute")]
+ public async Task> PostReportCommand30Execute([FromBody] ReportExecuteRequest req)
+ {
+ var data = req.refIds.Select(x => new
+ {
+ Id = x.refId,
+ CommandAffectDate = x.commandAffectDate,
+ CommandNo = x.commandNo,
+ CommandYear = x.commandYear.ToThaiYear(),
+ Detail = "คำสั่งเพิ่มโทษ"
+ });
+
+ var baseAPI = _configuration["API"];
+ var apiUrl = $"{baseAPI}/discipline/result/report/up/resume";
+ using (var client = new HttpClient())
+ {
+ client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
+ client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
+ var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
+ var result = await res.Content.ReadAsStringAsync();
+ }
+ return Success();
+ }
+
+ ///
+ /// ออกคำสั่ง C-PM-31
+ ///
+ ///
+ ///
+ /// ค่าตัวแปรที่ส่งมาไม่ถูกต้อง
+ /// ไม่ได้ Login เข้าระบบ
+ /// เมื่อเกิดข้อผิดพลาดในการทำงาน
+ [HttpPost("command31/report/excecute")]
+ public async Task> PostReportCommand31Execute([FromBody] ReportExecuteRequest req)
+ {
+ var data = req.refIds.Select(x => new
+ {
+ Id = x.refId,
+ CommandAffectDate = x.commandAffectDate,
+ CommandNo = x.commandNo,
+ CommandYear = x.commandYear.ToThaiYear(),
+ Detail = "คำสั่งงดโทษ"
+ });
+
+ var baseAPI = _configuration["API"];
+ var apiUrl = $"{baseAPI}/discipline/result/report/up/resume";
+ using (var client = new HttpClient())
+ {
+ client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
+ client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
+ var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
+ var result = await res.Content.ReadAsStringAsync();
+ }
+ return Success();
+ }
+
+ ///
+ /// ออกคำสั่ง C-PM-32
+ ///
+ ///
+ ///
+ /// ค่าตัวแปรที่ส่งมาไม่ถูกต้อง
+ /// ไม่ได้ Login เข้าระบบ
+ /// เมื่อเกิดข้อผิดพลาดในการทำงาน
+ [HttpPost("command32/report/excecute")]
+ public async Task> PostReportCommand32Execute([FromBody] ReportExecuteRequest req)
+ {
+ var data = req.refIds.Select(x => new
+ {
+ Id = x.refId,
+ CommandAffectDate = x.commandAffectDate,
+ CommandNo = x.commandNo,
+ CommandYear = x.commandYear.ToThaiYear(),
+ Detail = "คำสั่งยุติเรื่อง"
+ });
+
+ var baseAPI = _configuration["API"];
+ var apiUrl = $"{baseAPI}/discipline/result/report/reject/resume";
+ using (var client = new HttpClient())
+ {
+ client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
+ client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
+ var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
+ var result = await res.Content.ReadAsStringAsync();
+ }
+ return Success();
+ }
+
+ ///
+ /// ออกคำสั่ง C-PM-33
+ ///
+ ///
+ ///
+ /// ค่าตัวแปรที่ส่งมาไม่ถูกต้อง
+ /// ไม่ได้ Login เข้าระบบ
+ /// เมื่อเกิดข้อผิดพลาดในการทำงาน
+ [HttpPost("command33/report/excecute")]
+ public async Task> PostReportCommand33Execute([FromBody] ReportExecuteRequest req)
+ {
+ var data = req.refIds.Select(x => new
+ {
+ Id = x.refId,
+ refCommandNo = $"{x.commandNo}/{x.commandYear.ToThaiYear()}",
+ templateDoc = x.templateDoc,
+ });
+
+ var baseAPI = _configuration["API"];
+ var apiUrl = $"{baseAPI}/salary/report/command/33/resume";
+ using (var client = new HttpClient())
+ {
+ client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
+ client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
+ var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
+ var result = await res.Content.ReadAsStringAsync();
+ }
+ return Success();
+ }
+
+ ///
+ /// ออกคำสั่ง C-PM-34
+ ///
+ ///
+ ///
+ /// ค่าตัวแปรที่ส่งมาไม่ถูกต้อง
+ /// ไม่ได้ Login เข้าระบบ
+ /// เมื่อเกิดข้อผิดพลาดในการทำงาน
+ [HttpPost("command34/report/excecute")]
+ public async Task> PostReportCommand34Execute([FromBody] ReportExecuteRequest req)
+ {
+ var data = req.refIds.Select(x => new
+ {
+ Id = x.refId,
+ refCommandNo = $"{x.commandNo}/{x.commandYear.ToThaiYear()}",
+ templateDoc = x.templateDoc,
+ });
+
+ var baseAPI = _configuration["API"];
+ var apiUrl = $"{baseAPI}/salary/report/command/34/resume";
+ using (var client = new HttpClient())
+ {
+ client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
+ client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
+ var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
+ var result = await res.Content.ReadAsStringAsync();
+ }
+ return Success();
+ }
+
+ ///
+ /// ออกคำสั่ง C-PM-35
+ ///
+ ///
+ ///
+ /// ค่าตัวแปรที่ส่งมาไม่ถูกต้อง
+ /// ไม่ได้ Login เข้าระบบ
+ /// เมื่อเกิดข้อผิดพลาดในการทำงาน
+ [HttpPost("command35/report/excecute")]
+ public async Task> PostReportCommand35Execute([FromBody] ReportExecuteRequest req)
+ {
+ var data = req.refIds.Select(x => new
+ {
+ Id = x.refId,
+ refCommandNo = $"{x.commandNo}/{x.commandYear.ToThaiYear()}",
+ templateDoc = x.templateDoc,
+ });
+
+ var baseAPI = _configuration["API"];
+ var apiUrl = $"{baseAPI}/salary/report/command/35/resume";
+ using (var client = new HttpClient())
+ {
+ client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
+ client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
+ var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
+ var result = await res.Content.ReadAsStringAsync();
+ }
+ return Success();
+ }
+
+ ///
+ /// ออกคำสั่ง C-PM-36
+ ///
+ ///
+ ///
+ /// ค่าตัวแปรที่ส่งมาไม่ถูกต้อง
+ /// ไม่ได้ Login เข้าระบบ
+ /// เมื่อเกิดข้อผิดพลาดในการทำงาน
+ [HttpPost("command36/report/excecute")]
+ public async Task> PostReportCommand36Execute([FromBody] ReportExecuteRequest req)
+ {
+ var data = req.refIds.Select(x => new
+ {
+ Id = x.refId,
+ refCommandNo = $"{x.commandNo}/{x.commandYear.ToThaiYear()}",
+ templateDoc = x.templateDoc,
+ });
+
+ var baseAPI = _configuration["API"];
+ var apiUrl = $"{baseAPI}/salary/report/command/36/resume";
+ using (var client = new HttpClient())
+ {
+ client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
+ client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
+ var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
+ var result = await res.Content.ReadAsStringAsync();
+ }
+ return Success();
+ }
+
+ ///
+ /// ออกคำสั่ง C-PM-37
+ ///
+ ///
+ ///
+ /// ค่าตัวแปรที่ส่งมาไม่ถูกต้อง
+ /// ไม่ได้ Login เข้าระบบ
+ /// เมื่อเกิดข้อผิดพลาดในการทำงาน
+ [HttpPost("command37/report/excecute")]
+ public async Task> PostReportCommand37Execute([FromBody] ReportExecuteRequest req)
+ {
+ var data = req.refIds.Select(x => new
+ {
+ refCommandNo = $"{x.commandNo}/{x.commandYear.ToThaiYear()}",
+ templateDoc = x.templateDoc,
+ });
+
+ var baseAPI = _configuration["API"];
+ var apiUrl = $"{baseAPI}/salary/report/command/37/resume";
+ using (var client = new HttpClient())
+ {
+ client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
+ client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
+ var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
+ var result = await res.Content.ReadAsStringAsync();
+ }
+ return Success();
+ }
}
}
diff --git a/BMA.EHR.Discipline.Service/Controllers/DisciplineResultController.cs b/BMA.EHR.Discipline.Service/Controllers/DisciplineResultController.cs
index 6e90ce13..c6b59020 100644
--- a/BMA.EHR.Discipline.Service/Controllers/DisciplineResultController.cs
+++ b/BMA.EHR.Discipline.Service/Controllers/DisciplineResultController.cs
@@ -517,7 +517,7 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlDiscipline);
var _res = await client.PostAsJsonAsync(apiUrlDiscipline, new
{
- profileId = d.personId,
+ profileId = data.PersonId,
date = d.commandAffectDate,
detail = data.DisciplineDisciplinary.Title,
level = data.DisciplineDisciplinary.DisciplinaryFaultLevel,
@@ -564,7 +564,7 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlDiscipline);
var _res = await client.PostAsJsonAsync(apiUrlDiscipline, new
{
- profileId = d.personId,
+ profileId = data.PersonId,
date = d.commandAffectDate,
detail = data.DisciplineDisciplinary.Title,
level = data.DisciplineDisciplinary.DisciplinaryFaultLevel,
@@ -610,7 +610,7 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlDiscipline);
var _res = await client.PostAsJsonAsync(apiUrlDiscipline, new
{
- profileId = d.personId,
+ profileId = data1.PersonId,
date = d.commandAffectDate,
detail = data1.DisciplineInvestigate.Title,
level = "",
@@ -638,7 +638,7 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlDiscipline);
var _res = await client.PostAsJsonAsync(apiUrlDiscipline, new
{
- profileId = d.personId,
+ profileId = data2.PersonId,
date = d.commandAffectDate,
detail = data2.DisciplineDisciplinary.Title,
level = data2.DisciplineDisciplinary.DisciplinaryFaultLevel,
@@ -684,7 +684,7 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlDiscipline);
var _res = await client.PostAsJsonAsync(apiUrlDiscipline, new
{
- profileId = d.personId,
+ profileId = data.PersonId,
date = d.commandAffectDate,
detail = data.DisciplineDisciplinary.Title,
level = data.DisciplineDisciplinary.DisciplinaryFaultLevel,
diff --git a/BMA.EHR.Discipline.Service/Requests/PassDisciplineResponse.cs b/BMA.EHR.Discipline.Service/Requests/PassDisciplineResponse.cs
index c95f888c..2e3a8a81 100644
--- a/BMA.EHR.Discipline.Service/Requests/PassDisciplineResponse.cs
+++ b/BMA.EHR.Discipline.Service/Requests/PassDisciplineResponse.cs
@@ -11,7 +11,7 @@ namespace BMA.EHR.Discipline.Service.Requests
public class DisciplineDataResponse
{
public Guid id { get; set; } = Guid.Empty;
- public Guid personId { get; set; } = Guid.Empty;
+ // public Guid personId { get; set; } = Guid.Empty;
public Guid? commandId { get; set; } = Guid.Empty;
public DateTime? commandAffectDate { get; set; }
diff --git a/BMA.EHR.Placement.Service/Controllers/PlacementAppointmentController.cs b/BMA.EHR.Placement.Service/Controllers/PlacementAppointmentController.cs
index ea592f96..cd2c55b6 100644
--- a/BMA.EHR.Placement.Service/Controllers/PlacementAppointmentController.cs
+++ b/BMA.EHR.Placement.Service/Controllers/PlacementAppointmentController.cs
@@ -1293,5 +1293,77 @@ namespace BMA.EHR.Placement.Service.Controllers
}
return Success();
}
+
+ ///
+ /// ออกคำสั่ง C-PM-24
+ ///
+ ///
+ ///
+ /// ค่าตัวแปรที่ส่งมาไม่ถูกต้อง
+ /// ไม่ได้ Login เข้าระบบ
+ /// เมื่อเกิดข้อผิดพลาดในการทำงาน
+ [HttpPost("employee-move/report/excecute")]
+ public async Task> PostReportExecuteEmployeeMove([FromBody] ReportExecuteRequest req)
+ {
+ // create new profile
+ foreach (var recv in req.refIds)
+ {
+ var data = await _context.PlacementAppointments
+ .FirstOrDefaultAsync(x => x.Id == Guid.Parse(recv.refId));
+
+ if (data == null)
+ throw new Exception(GlobalMessages.DataNotFound);
+ var baseAPI = _configuration["API"];
+ var apiUrlSalary = $"{baseAPI}/org/profile-employee/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
+ {
+ profileEmployeeId = data.profileId,
+ date = recv.commandAffectDate,
+ amount = recv.amount,
+ positionSalaryAmount = recv.positionSalaryAmount,
+ mouthSalaryAmount = recv.mouthSalaryAmount,
+ posNo = data.posMasterNo == null ? "" :
+ data.node == 4 ? $"{data.child4ShortName}{data.posMasterNo}" :
+ data.node == 3 ? $"{data.child3ShortName}{data.posMasterNo}" :
+ data.node == 2 ? $"{data.child2ShortName}{data.posMasterNo}" :
+ data.node == 1 ? $"{data.child1ShortName}{data.posMasterNo}" :
+ data.node == 0 ? $"{data.rootShortName}{data.posMasterNo}" : "",
+ position = data.position,
+ positionType = data.posTypeName,
+ positionLevel = data.posLevelName,
+ refCommandNo = $"{recv.commandNo}/{recv.commandYear.ToThaiYear()}",
+ templateDoc = recv.templateDoc,
+ });
+ var _result = await _res.Content.ReadAsStringAsync();
+ }
+
+ var baseAPIOrg = _configuration["API"];
+ var apiUrlOrg = $"{baseAPIOrg}/org/employee/pos/report/current";
+ 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, apiUrlOrg);
+ var _res = await client.PostAsJsonAsync(apiUrlOrg, new
+ {
+ posmasterId = data.posmasterId,
+ positionId = data.positionId,
+ profileId = data.profileId,
+ });
+ var _result = await _res.Content.ReadAsStringAsync();
+ }
+
+ // update placementstatus
+ data.Status = "DONE";
+
+ await _context.SaveChangesAsync();
+ }
+ return Success();
+ }
}
}
diff --git a/BMA.EHR.Retirement.Service/Controllers/RetirementResignController.cs b/BMA.EHR.Retirement.Service/Controllers/RetirementResignController.cs
index 0e318488..5c81b0a7 100644
--- a/BMA.EHR.Retirement.Service/Controllers/RetirementResignController.cs
+++ b/BMA.EHR.Retirement.Service/Controllers/RetirementResignController.cs
@@ -1699,5 +1699,50 @@ $"คำขอลาออกของ {updated.prefix}{updated.firstName} {upda
}
return Success();
}
+
+ ///
+ /// ออกคำสั่ง C-PM-23
+ ///
+ ///
+ ///
+ /// ค่าตัวแปรที่ส่งมาไม่ถูกต้อง
+ /// ไม่ได้ Login เข้าระบบ
+ /// เมื่อเกิดข้อผิดพลาดในการทำงาน
+ [HttpPost("employee/report/excecute")]
+ public async Task> PostReportExecuteEmployee([FromBody] ReportExecuteRequest req)
+ {
+ // create new profile
+ foreach (var recv in req.refIds)
+ {
+ var data = await _context.RetirementResigns
+ .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-employee/salary/{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.Put, apiUrl);
+ var _res = await client.PutAsJsonAsync(apiUrl, new
+ {
+ isLeave = true,
+ leaveReason = "ลาออกจากราชการ",
+ dateLeave = recv.commandAffectDate,
+ });
+ var _result = await _res.Content.ReadAsStringAsync();
+ }
+
+ // update placementstatus
+ data.Status = "DONE";
+
+ await _context.SaveChangesAsync();
+ }
+ return Success();
+ }
}
}