diff --git a/BMA.EHR.Command.Service/Controllers/OrderController.cs b/BMA.EHR.Command.Service/Controllers/OrderController.cs
index 613e52f1..f4a848c2 100644
--- a/BMA.EHR.Command.Service/Controllers/OrderController.cs
+++ b/BMA.EHR.Command.Service/Controllers/OrderController.cs
@@ -3,10 +3,10 @@ using BMA.EHR.Application.Repositories;
using BMA.EHR.Application.Repositories.Commands;
using BMA.EHR.Application.Requests.Commands;
using BMA.EHR.Application.Responses;
+using BMA.EHR.Domain.Extensions;
using BMA.EHR.Command.Service.Requests;
using BMA.EHR.Command.Service.Responses;
using BMA.EHR.Domain.Common;
-using BMA.EHR.Domain.Extensions;
using BMA.EHR.Domain.Models.Commands.Core;
using BMA.EHR.Domain.Shared;
using BMA.EHR.Infrastructure.Persistence;
@@ -16,10 +16,8 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using Swashbuckle.AspNetCore.Annotations;
-using System.Net;
using System.Net.Http.Headers;
using System.Security.Claims;
-using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace BMA.EHR.Command.Service.Controllers
@@ -6575,5 +6573,73 @@ namespace BMA.EHR.Command.Service.Controllers
}
#endregion
+
+ ///
+ /// ออกคำสั่ง C-PM-11
+ ///
+ ///
+ ///
+ /// ค่าตัวแปรที่ส่งมาไม่ถูกต้อง
+ /// ไม่ได้ Login เข้าระบบ
+ /// เมื่อเกิดข้อผิดพลาดในการทำงาน
+ [HttpPost("command11/report/excecute")]
+ public async Task> PostReportCommand11Execute([FromBody] ReportExecuteRequest req)
+ {
+ // create new profile
+ foreach (var recv in req.refIds)
+ {
+ var baseAPI = _configuration["API"];
+ var apiUrl = $"{baseAPI}/org/profile/command11/{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-12
+ ///
+ ///
+ ///
+ /// ค่าตัวแปรที่ส่งมาไม่ถูกต้อง
+ /// ไม่ได้ Login เข้าระบบ
+ /// เมื่อเกิดข้อผิดพลาดในการทำงาน
+ [HttpPost("command12/report/excecute")]
+ public async Task> PostReportCommand12Execute([FromBody] ReportExecuteRequest req)
+ {
+ // create new profile
+ foreach (var recv in req.refIds)
+ {
+ var baseAPI = _configuration["API"];
+ var apiUrl = $"{baseAPI}/org/profile/command12/{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();
+ }
}
}
diff --git a/BMA.EHR.Command.Service/Requests/ReportExecuteRequest.cs b/BMA.EHR.Command.Service/Requests/ReportExecuteRequest.cs
new file mode 100644
index 00000000..c66de13b
--- /dev/null
+++ b/BMA.EHR.Command.Service/Requests/ReportExecuteRequest.cs
@@ -0,0 +1,21 @@
+using BMA.EHR.Domain.Models.MetaData;
+using Microsoft.EntityFrameworkCore;
+
+namespace BMA.EHR.Command.Service.Requests
+{
+ public class ReportExecuteRequest
+ {
+ public ReportExecuteRequestObj[] refIds { get; set; }
+ }
+ public class ReportExecuteRequestObj
+ {
+ public string? refId { get; set; }
+ public DateTime commandAffectDate { get; set; }
+ public string? commandNo { get; set; }
+ public int commandYear { get; set; }
+ public string? templateDoc { get; set; }
+ public double? amount { get; set; }
+ public double? positionSalaryAmount { get; set; }
+ public double? mouthSalaryAmount { get; set; }
+ }
+}
diff --git a/BMA.EHR.Command.Service/Requests/ReportPersonRequest.cs b/BMA.EHR.Command.Service/Requests/ReportPersonRequest.cs
new file mode 100644
index 00000000..3747c878
--- /dev/null
+++ b/BMA.EHR.Command.Service/Requests/ReportPersonRequest.cs
@@ -0,0 +1,10 @@
+using BMA.EHR.Domain.Models.MetaData;
+using Microsoft.EntityFrameworkCore;
+
+namespace BMA.EHR.Command.Service.Requests
+{
+ public class ReportPersonRequest
+ {
+ public string[] refIds { get; set; }
+ }
+}
diff --git a/BMA.EHR.Placement.Service/Controllers/PlacementController.cs b/BMA.EHR.Placement.Service/Controllers/PlacementController.cs
index 402fe56b..52351ef6 100644
--- a/BMA.EHR.Placement.Service/Controllers/PlacementController.cs
+++ b/BMA.EHR.Placement.Service/Controllers/PlacementController.cs
@@ -142,10 +142,15 @@ namespace BMA.EHR.Placement.Service.Controllers
{
var data = await _context.PlacementProfiles.Where(x => x.Placement.Id == examId).Select(x => new
{
+ Id = x.Id,
PersonalId = x.Id,
Avatar = x.ProfileImg == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.ProfileImg.Id,
FullName = $"{x.Prefix}{x.Firstname} {x.Lastname}",
+ Prefix = x.Prefix,
+ Firstname = x.Firstname,
+ Lastname = x.Lastname,
IdCard = x.CitizenId,
+ CitizenId = x.CitizenId,
ExamNumber = x.ExamNumber,
posmasterId = x.posmasterId,
root = x.root,
@@ -189,10 +194,15 @@ namespace BMA.EHR.Placement.Service.Controllers
{
var _data = new
{
+ p.Id,
p.PersonalId,
Avatar = p.Avatar == Guid.Parse("00000000-0000-0000-0000-000000000000") ? null : await _documentService.ImagesPath(p.Avatar),
p.FullName,
+ p.Prefix,
+ p.Firstname,
+ p.Lastname,
p.IdCard,
+ p.CitizenId,
p.ExamNumber,
p.posmasterId,
p.root,
diff --git a/BMA.EHR.Retirement.Service/Controllers/RetirementOtherController.cs b/BMA.EHR.Retirement.Service/Controllers/RetirementOtherController.cs
index a3b2ec1a..1ba37ef2 100644
--- a/BMA.EHR.Retirement.Service/Controllers/RetirementOtherController.cs
+++ b/BMA.EHR.Retirement.Service/Controllers/RetirementOtherController.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.Retirement;
using BMA.EHR.Domain.Shared;
using BMA.EHR.Infrastructure.Persistence;
@@ -623,5 +624,147 @@ namespace BMA.EHR.Retirement.Service.Controllers
return Success();
}
+
+ ///
+ /// ออกคำสั่ง C-PM-08
+ ///
+ ///
+ ///
+ /// ค่าตัวแปรที่ส่งมาไม่ถูกต้อง
+ /// ไม่ได้ Login เข้าระบบ
+ /// เมื่อเกิดข้อผิดพลาดในการทำงาน
+ [HttpPost("appoint/report/excecute")]
+ public async Task> PostReportExecuteAppoint([FromBody] ReportExecuteRequest req)
+ {
+ // create new profile
+ foreach (var recv in req.refIds)
+ {
+ var placementProfile = await _context.RetirementOthers
+ .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.PositionNumberOld,
+ position = placementProfile.PositionOld,
+ positionLine = "",
+ positionPathSide = "",
+ positionExecutive = "",
+ positionType = placementProfile.PositionTypeOld,
+ positionLevel = placementProfile.PositionLevelOld,
+ refCommandNo = $"{recv.commandNo}/{recv.commandYear.ToThaiYear()}",
+ templateDoc = recv.templateDoc,
+ });
+ var _result = await _res.Content.ReadAsStringAsync();
+ }
+
+ var baseAPILeave = _configuration["API"];
+ var apiUrlLeave = $"{baseAPI}/org/profile/leave/{placementProfile.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, apiUrlLeave);
+ string? _null = null;
+ var _res = await client.PostAsJsonAsync(apiUrlLeave, new
+ {
+ isLeave = false,
+ leaveReason = _null,
+ dateLeave = _null,
+ });
+ var _result = await _res.Content.ReadAsStringAsync();
+ }
+
+ // update placementstatus
+ placementProfile.Status = "DONE";
+
+ await _context.SaveChangesAsync();
+ }
+ return Success();
+ }
+
+ ///
+ /// ออกคำสั่ง C-PM-09
+ ///
+ ///
+ ///
+ /// ค่าตัวแปรที่ส่งมาไม่ถูกต้อง
+ /// ไม่ได้ Login เข้าระบบ
+ /// เมื่อเกิดข้อผิดพลาดในการทำงาน
+ [HttpPost("out/report/excecute")]
+ public async Task> PostReportExecuteOut([FromBody] ReportExecuteRequest req)
+ {
+ // create new profile
+ foreach (var recv in req.refIds)
+ {
+ var placementProfile = await _context.RetirementOthers
+ .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.PositionNumberOld,
+ position = placementProfile.PositionOld,
+ positionLine = "",
+ positionPathSide = "",
+ positionExecutive = "",
+ positionType = placementProfile.PositionTypeOld,
+ positionLevel = placementProfile.PositionLevelOld,
+ refCommandNo = $"{recv.commandNo}/{recv.commandYear.ToThaiYear()}",
+ templateDoc = recv.templateDoc,
+ });
+ var _result = await _res.Content.ReadAsStringAsync();
+ }
+
+ var baseAPILeave = _configuration["API"];
+ var apiUrlLeave = $"{baseAPI}/org/profile/leave/{placementProfile.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, apiUrlLeave);
+ string? _null = null;
+ var _res = await client.PostAsJsonAsync(apiUrlLeave, new
+ {
+ isLeave = false,
+ leaveReason = _null,
+ dateLeave = _null,
+ });
+ var _result = await _res.Content.ReadAsStringAsync();
+ }
+
+ // update placementstatus
+ placementProfile.Status = "DONE";
+
+ await _context.SaveChangesAsync();
+ }
+ return Success();
+ }
}
}
diff --git a/BMA.EHR.Retirement.Service/Requests/ReportExecuteRequest.cs b/BMA.EHR.Retirement.Service/Requests/ReportExecuteRequest.cs
new file mode 100644
index 00000000..c9d87113
--- /dev/null
+++ b/BMA.EHR.Retirement.Service/Requests/ReportExecuteRequest.cs
@@ -0,0 +1,21 @@
+using BMA.EHR.Domain.Models.MetaData;
+using Microsoft.EntityFrameworkCore;
+
+namespace BMA.EHR.Retirement.Service.Requests
+{
+ public class ReportExecuteRequest
+ {
+ public ReportExecuteRequestObj[] refIds { get; set; }
+ }
+ public class ReportExecuteRequestObj
+ {
+ public string? refId { get; set; }
+ public DateTime commandAffectDate { get; set; }
+ public string? commandNo { get; set; }
+ public int commandYear { get; set; }
+ public string? templateDoc { get; set; }
+ public double? amount { get; set; }
+ public double? positionSalaryAmount { get; set; }
+ public double? mouthSalaryAmount { get; set; }
+ }
+}
diff --git a/BMA.EHR.Retirement.Service/Requests/ReportPersonRequest.cs b/BMA.EHR.Retirement.Service/Requests/ReportPersonRequest.cs
new file mode 100644
index 00000000..5a6136be
--- /dev/null
+++ b/BMA.EHR.Retirement.Service/Requests/ReportPersonRequest.cs
@@ -0,0 +1,10 @@
+using BMA.EHR.Domain.Models.MetaData;
+using Microsoft.EntityFrameworkCore;
+
+namespace BMA.EHR.Retirement.Service.Requests
+{
+ public class ReportPersonRequest
+ {
+ public string[] refIds { get; set; }
+ }
+}