diff --git a/BMA.EHR.Command.Service/Controllers/OrderController.cs b/BMA.EHR.Command.Service/Controllers/OrderController.cs
index f4a848c2..e1513832 100644
--- a/BMA.EHR.Command.Service/Controllers/OrderController.cs
+++ b/BMA.EHR.Command.Service/Controllers/OrderController.cs
@@ -6641,5 +6641,105 @@ namespace BMA.EHR.Command.Service.Controllers
}
return Success();
}
+
+ ///
+ /// ออกคำสั่ง C-PM-19
+ ///
+ ///
+ ///
+ /// ค่าตัวแปรที่ส่งมาไม่ถูกต้อง
+ /// ไม่ได้ Login เข้าระบบ
+ /// เมื่อเกิดข้อผิดพลาดในการทำงาน
+ [HttpPost("command19/report/excecute")]
+ public async Task> PostReportCommand19Execute([FromBody] ReportExecuteRequest req)
+ {
+ // create new profile
+ foreach (var recv in req.refIds)
+ {
+ var baseAPI = _configuration["API"];
+ var apiUrl = $"{baseAPI}/org/profile/command19/{recv.refId}";
+ 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
+ {
+ profileId = recv.refId,
+ date = recv.commandAffectDate,
+ refCommandNo = $"{recv.commandNo}/{recv.commandYear.ToThaiYear()}",
+ salaryRef = recv.templateDoc,
+ });
+ var _result = await _res.Content.ReadAsStringAsync();
+ }
+ }
+ return Success();
+ }
+
+ ///
+ /// ออกคำสั่ง C-PM-20
+ ///
+ ///
+ ///
+ /// ค่าตัวแปรที่ส่งมาไม่ถูกต้อง
+ /// ไม่ได้ Login เข้าระบบ
+ /// เมื่อเกิดข้อผิดพลาดในการทำงาน
+ [HttpPost("command20/report/excecute")]
+ public async Task> PostReportCommand20Execute([FromBody] ReportExecuteRequest req)
+ {
+ // create new profile
+ foreach (var recv in req.refIds)
+ {
+ var baseAPI = _configuration["API"];
+ var apiUrl = $"{baseAPI}/org/profile/command20/{recv.refId}";
+ 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
+ {
+ profileId = recv.refId,
+ date = recv.commandAffectDate,
+ refCommandNo = $"{recv.commandNo}/{recv.commandYear.ToThaiYear()}",
+ salaryRef = recv.templateDoc,
+ });
+ var _result = await _res.Content.ReadAsStringAsync();
+ }
+ }
+ return Success();
+ }
+
+ ///
+ /// ออกคำสั่ง C-PM-21
+ ///
+ ///
+ ///
+ /// ค่าตัวแปรที่ส่งมาไม่ถูกต้อง
+ /// ไม่ได้ Login เข้าระบบ
+ /// เมื่อเกิดข้อผิดพลาดในการทำงาน
+ [HttpPost("command21/report/excecute")]
+ public async Task> PostReportCommand21Execute([FromBody] ReportExecuteRequest req)
+ {
+ var data = req.refIds.Select(x => new
+ {
+ id = x.refId,
+ amount = x.amount,
+ positionSalaryAmount = x.positionSalaryAmount,
+ mouthSalaryAmount = x.mouthSalaryAmount,
+ refCommandNo = $"{x.commandNo}/{x.commandYear.ToThaiYear()}",
+ templateDoc = x.templateDoc,
+ });
+ var baseAPI = _configuration["API"];
+ var apiUrl = $"{baseAPI}/org/profile-employee/report/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.Placement.Service/Controllers/PlacementAppointmentController.cs b/BMA.EHR.Placement.Service/Controllers/PlacementAppointmentController.cs
index 77b70913..ea592f96 100644
--- a/BMA.EHR.Placement.Service/Controllers/PlacementAppointmentController.cs
+++ b/BMA.EHR.Placement.Service/Controllers/PlacementAppointmentController.cs
@@ -1221,5 +1221,77 @@ namespace BMA.EHR.Placement.Service.Controllers
}
return Success();
}
+
+ ///
+ /// ออกคำสั่ง C-PM-22
+ ///
+ ///
+ ///
+ /// ค่าตัวแปรที่ส่งมาไม่ถูกต้อง
+ /// ไม่ได้ Login เข้าระบบ
+ /// เมื่อเกิดข้อผิดพลาดในการทำงาน
+ [HttpPost("employee-appoint/report/excecute")]
+ public async Task> PostReportExecuteEmployeeAppoint([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)
+ continue;
+
+ 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.Placement.Service/Controllers/PlacementOfficerController.cs b/BMA.EHR.Placement.Service/Controllers/PlacementOfficerController.cs
index 8ad0b7fa..18412174 100644
--- a/BMA.EHR.Placement.Service/Controllers/PlacementOfficerController.cs
+++ b/BMA.EHR.Placement.Service/Controllers/PlacementOfficerController.cs
@@ -1,6 +1,7 @@
using BMA.EHR.Application.Repositories;
using BMA.EHR.Application.Repositories.MessageQueue;
using BMA.EHR.Domain.Common;
+using BMA.EHR.Domain.Extensions;
using BMA.EHR.Domain.Models.Placement;
using BMA.EHR.Domain.Shared;
using BMA.EHR.Infrastructure.Persistence;
@@ -566,5 +567,60 @@ namespace BMA.EHR.Placement.Service.Controllers
return Success();
}
+
+ ///
+ /// ออกคำสั่ง C-PM-15
+ ///
+ ///
+ ///
+ /// ค่าตัวแปรที่ส่งมาไม่ถูกต้อง
+ /// ไม่ได้ Login เข้าระบบ
+ /// เมื่อเกิดข้อผิดพลาดในการทำงาน
+ [HttpPost("report/excecute")]
+ public async Task> PostReportExecute([FromBody] ReportExecuteRequest req)
+ {
+ // create new profile
+ foreach (var recv in req.refIds)
+ {
+ var data = await _context.PlacementOfficers
+ .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/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();
+ }
}
}
diff --git a/BMA.EHR.Placement.Service/Controllers/PlacementReceiveController.cs b/BMA.EHR.Placement.Service/Controllers/PlacementReceiveController.cs
index 7bf549b9..03a6e88c 100644
--- a/BMA.EHR.Placement.Service/Controllers/PlacementReceiveController.cs
+++ b/BMA.EHR.Placement.Service/Controllers/PlacementReceiveController.cs
@@ -1,6 +1,7 @@
using BMA.EHR.Application.Repositories;
using BMA.EHR.Application.Repositories.MessageQueue;
using BMA.EHR.Domain.Common;
+using BMA.EHR.Domain.Extensions;
using BMA.EHR.Domain.Models.Placement;
using BMA.EHR.Domain.Shared;
using BMA.EHR.Infrastructure.Persistence;
@@ -878,5 +879,82 @@ namespace BMA.EHR.Placement.Service.Controllers
.ToListAsync();
return Success(position);
}
+
+ ///
+ /// ออกคำสั่ง C-PM-14
+ ///
+ ///
+ ///
+ /// ค่าตัวแปรที่ส่งมาไม่ถูกต้อง
+ /// ไม่ได้ Login เข้าระบบ
+ /// เมื่อเกิดข้อผิดพลาดในการทำงาน
+ [HttpPost("report/excecute")]
+ public async Task> PostReportExecute([FromBody] ReportExecuteRequest req)
+ {
+ // create new profile
+ foreach (var recv in req.refIds)
+ {
+ // query placement Profile
+ var placementProfile = await _context.PlacementReceives
+ .FirstOrDefaultAsync(x => x.Id == Guid.Parse(recv.refId));
+
+ if (placementProfile == null)
+ throw new Exception(GlobalMessages.DataNotFound);
+
+ var baseAPI = _configuration["API"];
+ 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 = placementProfile.profileId,
+ date = recv.commandAffectDate,
+ amount = recv.amount,
+ positionSalaryAmount = recv.positionSalaryAmount,
+ mouthSalaryAmount = recv.mouthSalaryAmount,
+ posNo = placementProfile.posMasterNo == null ? "" :
+ placementProfile.node == 4 ? $"{placementProfile.child4ShortName}{placementProfile.posMasterNo}" :
+ placementProfile.node == 3 ? $"{placementProfile.child3ShortName}{placementProfile.posMasterNo}" :
+ placementProfile.node == 2 ? $"{placementProfile.child2ShortName}{placementProfile.posMasterNo}" :
+ placementProfile.node == 1 ? $"{placementProfile.child1ShortName}{placementProfile.posMasterNo}" :
+ placementProfile.node == 0 ? $"{placementProfile.rootShortName}{placementProfile.posMasterNo}" : "",
+ position = placementProfile.position,
+ positionLine = "",
+ positionPathSide = "",
+ positionExecutive = "",
+ positionType = placementProfile.posTypeName,
+ positionLevel = placementProfile.posLevelName,
+ refCommandNo = $"{recv.commandNo}/{recv.commandYear.ToThaiYear()}",
+ templateDoc = recv.templateDoc,
+ });
+ var _result = await _res.Content.ReadAsStringAsync();
+ }
+
+ var baseAPIOrg = _configuration["API"];
+ var apiUrlOrg = $"{baseAPIOrg}/org/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 = placementProfile.posmasterId,
+ positionId = placementProfile.positionId,
+ profileId = placementProfile.profileId,
+ });
+ var _result = await _res.Content.ReadAsStringAsync();
+ }
+
+ // update placementstatus
+ placementProfile.Status = "DONE";
+
+ await _context.SaveChangesAsync();
+ }
+ return Success();
+ }
}
}
diff --git a/BMA.EHR.Placement.Service/Controllers/PlacementRepatriationController.cs b/BMA.EHR.Placement.Service/Controllers/PlacementRepatriationController.cs
index abb7055c..c5bbb70b 100644
--- a/BMA.EHR.Placement.Service/Controllers/PlacementRepatriationController.cs
+++ b/BMA.EHR.Placement.Service/Controllers/PlacementRepatriationController.cs
@@ -1,6 +1,7 @@
using BMA.EHR.Application.Repositories;
using BMA.EHR.Application.Repositories.MessageQueue;
using BMA.EHR.Domain.Common;
+using BMA.EHR.Domain.Extensions;
using BMA.EHR.Domain.Models.Placement;
using BMA.EHR.Domain.Shared;
using BMA.EHR.Infrastructure.Persistence;
@@ -473,5 +474,60 @@ namespace BMA.EHR.Placement.Service.Controllers
// return Success();
// }
+
+ ///
+ /// ออกคำสั่ง C-PM-16
+ ///
+ ///
+ ///
+ /// ค่าตัวแปรที่ส่งมาไม่ถูกต้อง
+ /// ไม่ได้ Login เข้าระบบ
+ /// เมื่อเกิดข้อผิดพลาดในการทำงาน
+ [HttpPost("report/excecute")]
+ public async Task> PostReportExecute([FromBody] ReportExecuteRequest req)
+ {
+ // create new profile
+ foreach (var recv in req.refIds)
+ {
+ var data = await _context.PlacementRepatriations
+ .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/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();
+ }
}
}
diff --git a/BMA.EHR.Placement.Service/Controllers/PlacementTransferController.cs b/BMA.EHR.Placement.Service/Controllers/PlacementTransferController.cs
index 57ff7c6f..92b571bf 100644
--- a/BMA.EHR.Placement.Service/Controllers/PlacementTransferController.cs
+++ b/BMA.EHR.Placement.Service/Controllers/PlacementTransferController.cs
@@ -1,6 +1,7 @@
using BMA.EHR.Application.Repositories;
using BMA.EHR.Application.Repositories.MessageQueue;
using BMA.EHR.Domain.Common;
+using BMA.EHR.Domain.Extensions;
using BMA.EHR.Domain.Models.Placement;
using BMA.EHR.Domain.Shared;
using BMA.EHR.Infrastructure.Persistence;
@@ -12,10 +13,7 @@ using Newtonsoft.Json;
using Swashbuckle.AspNetCore.Annotations;
using System.Net.Http.Headers;
using System.Security.Claims;
-using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
-using Microsoft.AspNetCore.Mvc.RazorPages;
-using System.Drawing.Printing;
namespace BMA.EHR.Placement.Service.Controllers
{
@@ -759,5 +757,60 @@ namespace BMA.EHR.Placement.Service.Controllers
return Success();
}
+
+ ///
+ /// ออกคำสั่ง C-PM-13
+ ///
+ ///
+ ///
+ /// ค่าตัวแปรที่ส่งมาไม่ถูกต้อง
+ /// ไม่ได้ Login เข้าระบบ
+ /// เมื่อเกิดข้อผิดพลาดในการทำงาน
+ [HttpPost("report/excecute")]
+ public async Task> PostReportExecute([FromBody] ReportExecuteRequest req)
+ {
+ // create new profile
+ foreach (var recv in req.refIds)
+ {
+ var data = await _context.PlacementTransfers
+ .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/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();
+ }
}
}
diff --git a/BMA.EHR.Retirement.Service/Controllers/RetirementOtherController.cs b/BMA.EHR.Retirement.Service/Controllers/RetirementOtherController.cs
index 1ba37ef2..fde6ce3e 100644
--- a/BMA.EHR.Retirement.Service/Controllers/RetirementOtherController.cs
+++ b/BMA.EHR.Retirement.Service/Controllers/RetirementOtherController.cs
@@ -766,5 +766,76 @@ namespace BMA.EHR.Retirement.Service.Controllers
}
return Success();
}
+
+ ///
+ /// ออกคำสั่ง C-PM-18
+ ///
+ ///
+ ///
+ /// ค่าตัวแปรที่ส่งมาไม่ถูกต้อง
+ /// ไม่ได้ Login เข้าระบบ
+ /// เมื่อเกิดข้อผิดพลาดในการทำงาน
+ [HttpPost("leave/report/excecute")]
+ public async Task> 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();
+ }
}
}
diff --git a/BMA.EHR.Retirement.Service/Controllers/RetirementResignController.cs b/BMA.EHR.Retirement.Service/Controllers/RetirementResignController.cs
index 5013adeb..0e318488 100644
--- a/BMA.EHR.Retirement.Service/Controllers/RetirementResignController.cs
+++ b/BMA.EHR.Retirement.Service/Controllers/RetirementResignController.cs
@@ -1628,5 +1628,76 @@ $"คำขอลาออกของ {updated.prefix}{updated.firstName} {upda
return Success(retirementQuestionnaireQuestion);
}
+
+ ///
+ /// ออกคำสั่ง C-PM-17
+ ///
+ ///
+ ///
+ /// ค่าตัวแปรที่ส่งมาไม่ถูกต้อง
+ /// ไม่ได้ Login เข้าระบบ
+ /// เมื่อเกิดข้อผิดพลาดในการทำงาน
+ [HttpPost("report/excecute")]
+ public async Task> PostReportExecute([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/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();
+ }
}
}