แก้คำสั่ง

This commit is contained in:
kittapath 2024-10-02 22:54:34 +07:00
parent a09a732ff1
commit 4cf3f15fb8
8 changed files with 296 additions and 27 deletions

View file

@ -19,6 +19,7 @@ using Swashbuckle.AspNetCore.Annotations;
using System.Net.Http.Headers;
using System.Security.Claims;
using Newtonsoft.Json.Linq;
using Microsoft.EntityFrameworkCore;
namespace BMA.EHR.Command.Service.Controllers
{
@ -6664,7 +6665,6 @@ namespace BMA.EHR.Command.Service.Controllers
{
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,
@ -6768,7 +6768,6 @@ namespace BMA.EHR.Command.Service.Controllers
{
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,
@ -6793,7 +6792,7 @@ namespace BMA.EHR.Command.Service.Controllers
[HttpPost("command19/report")]
public async Task<ActionResult<ResponseObject>> PostReportCommand19([FromBody] ReportPersonRequest req)
{
var placementProfiles = await _context.RetirementDischarges
var placementProfiles = await _context.RetirementDischarges.AsQueryable()
.Where(x => req.refIds.Contains(x.Id.ToString()))
.ToListAsync();
@ -6826,7 +6825,6 @@ namespace BMA.EHR.Command.Service.Controllers
{
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,
@ -6837,6 +6835,25 @@ namespace BMA.EHR.Command.Service.Controllers
var _result = await _res.Content.ReadAsStringAsync();
}
}
var dataSend = 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 = dataSend });
var result = await res.Content.ReadAsStringAsync();
}
return Success();
}
@ -6851,7 +6868,7 @@ namespace BMA.EHR.Command.Service.Controllers
[HttpPost("command20/report")]
public async Task<ActionResult<ResponseObject>> PostReportcommand20([FromBody] ReportPersonRequest req)
{
var placementProfiles = await _context.RetirementExpulsions
var placementProfiles = await _context.RetirementExpulsions.AsQueryable()
.Where(x => req.refIds.Contains(x.Id.ToString()))
.ToListAsync();
@ -6884,7 +6901,6 @@ namespace BMA.EHR.Command.Service.Controllers
{
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,
@ -6895,6 +6911,25 @@ namespace BMA.EHR.Command.Service.Controllers
var _result = await _res.Content.ReadAsStringAsync();
}
}
var dataSend = 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 = dataSend });
var result = await res.Content.ReadAsStringAsync();
}
return Success();
}
@ -7021,6 +7056,23 @@ namespace BMA.EHR.Command.Service.Controllers
var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
var result = await res.Content.ReadAsStringAsync();
}
foreach (var recv in req.refIds)
{
var apiUrl2 = $"{baseAPI}/org/profile/command25/{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 _res = await client.PostAsJsonAsync(apiUrl2, new
{
profileId = recv.refId,
date = recv.commandAffectDate,
refCommandNo = $"{recv.commandNo}/{recv.commandYear.ToThaiYear()}",
salaryRef = recv.templateDoc,
});
var _result = await _res.Content.ReadAsStringAsync();
}
}
return Success();
}
@ -7053,6 +7105,23 @@ namespace BMA.EHR.Command.Service.Controllers
var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
var result = await res.Content.ReadAsStringAsync();
}
foreach (var recv in req.refIds)
{
var apiUrl2 = $"{baseAPI}/org/profile/command26/{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 _res = await client.PostAsJsonAsync(apiUrl2, new
{
profileId = recv.refId,
date = recv.commandAffectDate,
refCommandNo = $"{recv.commandNo}/{recv.commandYear.ToThaiYear()}",
salaryRef = recv.templateDoc,
});
var _result = await _res.Content.ReadAsStringAsync();
}
}
return Success();
}
@ -7085,6 +7154,23 @@ namespace BMA.EHR.Command.Service.Controllers
var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
var result = await res.Content.ReadAsStringAsync();
}
foreach (var recv in req.refIds)
{
var apiUrl2 = $"{baseAPI}/org/profile/command27/{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 _res = await client.PostAsJsonAsync(apiUrl2, new
{
profileId = recv.refId,
date = recv.commandAffectDate,
refCommandNo = $"{recv.commandNo}/{recv.commandYear.ToThaiYear()}",
salaryRef = recv.templateDoc,
});
var _result = await _res.Content.ReadAsStringAsync();
}
}
return Success();
}
@ -7117,6 +7203,23 @@ namespace BMA.EHR.Command.Service.Controllers
var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
var result = await res.Content.ReadAsStringAsync();
}
foreach (var recv in req.refIds)
{
var apiUrl2 = $"{baseAPI}/org/profile/command28/{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 _res = await client.PostAsJsonAsync(apiUrl2, new
{
profileId = recv.refId,
date = recv.commandAffectDate,
refCommandNo = $"{recv.commandNo}/{recv.commandYear.ToThaiYear()}",
salaryRef = recv.templateDoc,
});
var _result = await _res.Content.ReadAsStringAsync();
}
}
return Success();
}
@ -7149,6 +7252,23 @@ namespace BMA.EHR.Command.Service.Controllers
var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
var result = await res.Content.ReadAsStringAsync();
}
foreach (var recv in req.refIds)
{
var apiUrl2 = $"{baseAPI}/org/profile/command29/{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 _res = await client.PostAsJsonAsync(apiUrl2, new
{
profileId = recv.refId,
date = recv.commandAffectDate,
refCommandNo = $"{recv.commandNo}/{recv.commandYear.ToThaiYear()}",
salaryRef = recv.templateDoc,
});
var _result = await _res.Content.ReadAsStringAsync();
}
}
return Success();
}
@ -7181,6 +7301,23 @@ namespace BMA.EHR.Command.Service.Controllers
var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
var result = await res.Content.ReadAsStringAsync();
}
foreach (var recv in req.refIds)
{
var apiUrl2 = $"{baseAPI}/org/profile/command30/{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 _res = await client.PostAsJsonAsync(apiUrl2, new
{
profileId = recv.refId,
date = recv.commandAffectDate,
refCommandNo = $"{recv.commandNo}/{recv.commandYear.ToThaiYear()}",
salaryRef = recv.templateDoc,
});
var _result = await _res.Content.ReadAsStringAsync();
}
}
return Success();
}
@ -7213,6 +7350,23 @@ namespace BMA.EHR.Command.Service.Controllers
var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
var result = await res.Content.ReadAsStringAsync();
}
foreach (var recv in req.refIds)
{
var apiUrl2 = $"{baseAPI}/org/profile/command31/{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 _res = await client.PostAsJsonAsync(apiUrl2, new
{
profileId = recv.refId,
date = recv.commandAffectDate,
refCommandNo = $"{recv.commandNo}/{recv.commandYear.ToThaiYear()}",
salaryRef = recv.templateDoc,
});
var _result = await _res.Content.ReadAsStringAsync();
}
}
return Success();
}
@ -7245,6 +7399,23 @@ namespace BMA.EHR.Command.Service.Controllers
var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
var result = await res.Content.ReadAsStringAsync();
}
foreach (var recv in req.refIds)
{
var apiUrl2 = $"{baseAPI}/org/profile/command32/{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 _res = await client.PostAsJsonAsync(apiUrl2, new
{
profileId = recv.refId,
date = recv.commandAffectDate,
refCommandNo = $"{recv.commandNo}/{recv.commandYear.ToThaiYear()}",
salaryRef = recv.templateDoc,
});
var _result = await _res.Content.ReadAsStringAsync();
}
}
return Success();
}
@ -7396,5 +7567,33 @@ namespace BMA.EHR.Command.Service.Controllers
}
return Success();
}
/// <summary>
/// ออกคำสั่ง C-PM-38
/// </summary>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("command38/report/excecute")]
public async Task<ActionResult<ResponseObject>> PostReportCommand38Execute([FromBody] ReportExecuteRequest req)
{
return Success();
}
/// <summary>
/// ออกคำสั่ง C-PM-40
/// </summary>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("command40/report/excecute")]
public async Task<ActionResult<ResponseObject>> PostReportCommand40Execute([FromBody] ReportExecuteRequest req)
{
return Success();
}
}
}