Merge branch 'develop' into working

This commit is contained in:
Suphonchai Phoonsawat 2024-01-06 11:49:54 +07:00
commit c30c65f1f8
10 changed files with 17496 additions and 68 deletions

View file

@ -17,6 +17,8 @@ using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Newtonsoft.Json; using Newtonsoft.Json;
using System.Net.Http.Headers; using System.Net.Http.Headers;
using System.Net.Http.Json;
using System.Net.Http.Json;
using Command = BMA.EHR.Domain.Models.Commands.Core.Command; using Command = BMA.EHR.Domain.Models.Commands.Core.Command;
using Profile = BMA.EHR.Domain.Models.HR.Profile; using Profile = BMA.EHR.Domain.Models.HR.Profile;
@ -1396,11 +1398,11 @@ namespace BMA.EHR.Application.Repositories.Commands
foreach (var d in response!.result) foreach (var d in response!.result)
{ {
if (commandType == null || commandType.Id != d.CommandId) if (commandType == null || commandType.Id != d.commandId)
continue; continue;
var pf = await _dbContext.Set<Profile>() var pf = await _dbContext.Set<Profile>()
.Include(x => x.Prefix) .Include(x => x.Prefix)
.FirstOrDefaultAsync(x => x.Id == d.id); .FirstOrDefaultAsync(x => x.Id == d.personId);
if (pf != null) if (pf != null)
{ {
@ -1412,6 +1414,7 @@ namespace BMA.EHR.Application.Repositories.Commands
FirstName = pf.FirstName!, FirstName = pf.FirstName!,
LastName = pf.LastName!, LastName = pf.LastName!,
RefPlacementProfileId = pf.Id, RefPlacementProfileId = pf.Id,
RefDisciplineId = d.id,
Amount = 0, Amount = 0,
}; };
seq++; seq++;
@ -1497,11 +1500,11 @@ namespace BMA.EHR.Application.Repositories.Commands
foreach (var d in response!.result) foreach (var d in response!.result)
{ {
if (commandType == null || commandType.Id != d.CommandId) if (commandType == null || commandType.Id != d.commandId)
continue; continue;
var pf = await _dbContext.Set<Profile>() var pf = await _dbContext.Set<Profile>()
.Include(x => x.Prefix) .Include(x => x.Prefix)
.FirstOrDefaultAsync(x => x.Id == d.id); .FirstOrDefaultAsync(x => x.Id == d.personId);
if (pf != null) if (pf != null)
{ {
@ -1513,6 +1516,7 @@ namespace BMA.EHR.Application.Repositories.Commands
FirstName = pf.FirstName!, FirstName = pf.FirstName!,
LastName = pf.LastName!, LastName = pf.LastName!,
RefPlacementProfileId = pf.Id, RefPlacementProfileId = pf.Id,
RefDisciplineId = d.id,
Amount = 0, Amount = 0,
}; };
seq++; seq++;
@ -1799,11 +1803,11 @@ namespace BMA.EHR.Application.Repositories.Commands
var seq = 1; var seq = 1;
foreach (var d in response!.result) foreach (var d in response!.result)
{ {
if (commandType == null || commandType.Id != d.CommandId) if (commandType == null || commandType.Id != d.commandId)
continue; continue;
var pf = await _dbContext.Set<Profile>() var pf = await _dbContext.Set<Profile>()
.Include(x => x.Prefix) .Include(x => x.Prefix)
.FirstOrDefaultAsync(x => x.Id == d.id); .FirstOrDefaultAsync(x => x.Id == d.personId);
if (pf != null) if (pf != null)
{ {
@ -1815,6 +1819,7 @@ namespace BMA.EHR.Application.Repositories.Commands
FirstName = pf.FirstName!, FirstName = pf.FirstName!,
LastName = pf.LastName!, LastName = pf.LastName!,
RefPlacementProfileId = pf.Id, RefPlacementProfileId = pf.Id,
RefDisciplineId = d.id,
}; };
seq++; seq++;
@ -1861,11 +1866,11 @@ namespace BMA.EHR.Application.Repositories.Commands
var seq = 1; var seq = 1;
foreach (var d in response!.result) foreach (var d in response!.result)
{ {
if (commandType == null || commandType.Id != d.CommandId) if (commandType == null || commandType.Id != d.commandId)
continue; continue;
var pf = await _dbContext.Set<Profile>() var pf = await _dbContext.Set<Profile>()
.Include(x => x.Prefix) .Include(x => x.Prefix)
.FirstOrDefaultAsync(x => x.Id == d.id); .FirstOrDefaultAsync(x => x.Id == d.personId);
if (pf != null) if (pf != null)
{ {
@ -1877,6 +1882,7 @@ namespace BMA.EHR.Application.Repositories.Commands
FirstName = pf.FirstName!, FirstName = pf.FirstName!,
LastName = pf.LastName!, LastName = pf.LastName!,
RefPlacementProfileId = pf.Id, RefPlacementProfileId = pf.Id,
RefDisciplineId = d.id,
}; };
seq++; seq++;
@ -1923,11 +1929,11 @@ namespace BMA.EHR.Application.Repositories.Commands
var seq = 1; var seq = 1;
foreach (var d in response!.result) foreach (var d in response!.result)
{ {
if (commandType == null || commandType.Id != d.CommandId) if (commandType == null || commandType.Id != d.commandId)
continue; continue;
var pf = await _dbContext.Set<Profile>() var pf = await _dbContext.Set<Profile>()
.Include(x => x.Prefix) .Include(x => x.Prefix)
.FirstOrDefaultAsync(x => x.Id == d.id); .FirstOrDefaultAsync(x => x.Id == d.personId);
if (pf != null) if (pf != null)
{ {
@ -1939,6 +1945,7 @@ namespace BMA.EHR.Application.Repositories.Commands
FirstName = pf.FirstName!, FirstName = pf.FirstName!,
LastName = pf.LastName!, LastName = pf.LastName!,
RefPlacementProfileId = pf.Id, RefPlacementProfileId = pf.Id,
RefDisciplineId = d.id,
}; };
seq++; seq++;
@ -1985,11 +1992,11 @@ namespace BMA.EHR.Application.Repositories.Commands
var seq = 1; var seq = 1;
foreach (var d in response!.result) foreach (var d in response!.result)
{ {
if (commandType == null || commandType.Id != d.CommandId) if (commandType == null || commandType.Id != d.commandId)
continue; continue;
var pf = await _dbContext.Set<Profile>() var pf = await _dbContext.Set<Profile>()
.Include(x => x.Prefix) .Include(x => x.Prefix)
.FirstOrDefaultAsync(x => x.Id == d.id); .FirstOrDefaultAsync(x => x.Id == d.personId);
if (pf != null) if (pf != null)
{ {
@ -2001,6 +2008,7 @@ namespace BMA.EHR.Application.Repositories.Commands
FirstName = pf.FirstName!, FirstName = pf.FirstName!,
LastName = pf.LastName!, LastName = pf.LastName!,
RefPlacementProfileId = pf.Id, RefPlacementProfileId = pf.Id,
RefDisciplineId = d.id,
}; };
seq++; seq++;
@ -2047,11 +2055,11 @@ namespace BMA.EHR.Application.Repositories.Commands
var seq = 1; var seq = 1;
foreach (var d in response!.result) foreach (var d in response!.result)
{ {
if (commandType == null || commandType.Id != d.CommandId) if (commandType == null || commandType.Id != d.commandId)
continue; continue;
var pf = await _dbContext.Set<Profile>() var pf = await _dbContext.Set<Profile>()
.Include(x => x.Prefix) .Include(x => x.Prefix)
.FirstOrDefaultAsync(x => x.Id == d.id); .FirstOrDefaultAsync(x => x.Id == d.personId);
if (pf != null) if (pf != null)
{ {
@ -2063,6 +2071,7 @@ namespace BMA.EHR.Application.Repositories.Commands
FirstName = pf.FirstName!, FirstName = pf.FirstName!,
LastName = pf.LastName!, LastName = pf.LastName!,
RefPlacementProfileId = pf.Id, RefPlacementProfileId = pf.Id,
RefDisciplineId = d.id,
}; };
seq++; seq++;
@ -2109,11 +2118,11 @@ namespace BMA.EHR.Application.Repositories.Commands
var seq = 1; var seq = 1;
foreach (var d in response!.result) foreach (var d in response!.result)
{ {
if (commandType == null || commandType.Id != d.CommandId) if (commandType == null || commandType.Id != d.commandId)
continue; continue;
var pf = await _dbContext.Set<Profile>() var pf = await _dbContext.Set<Profile>()
.Include(x => x.Prefix) .Include(x => x.Prefix)
.FirstOrDefaultAsync(x => x.Id == d.id); .FirstOrDefaultAsync(x => x.Id == d.personId);
if (pf != null) if (pf != null)
{ {
@ -2125,6 +2134,7 @@ namespace BMA.EHR.Application.Repositories.Commands
FirstName = pf.FirstName!, FirstName = pf.FirstName!,
LastName = pf.LastName!, LastName = pf.LastName!,
RefPlacementProfileId = pf.Id, RefPlacementProfileId = pf.Id,
RefDisciplineId = d.id,
}; };
seq++; seq++;
@ -2171,11 +2181,11 @@ namespace BMA.EHR.Application.Repositories.Commands
var seq = 1; var seq = 1;
foreach (var d in response!.result) foreach (var d in response!.result)
{ {
if (commandType == null || commandType.Id != d.CommandId) if (commandType == null || commandType.Id != d.commandId)
continue; continue;
var pf = await _dbContext.Set<Profile>() var pf = await _dbContext.Set<Profile>()
.Include(x => x.Prefix) .Include(x => x.Prefix)
.FirstOrDefaultAsync(x => x.Id == d.id); .FirstOrDefaultAsync(x => x.Id == d.personId);
if (pf != null) if (pf != null)
{ {
@ -2187,6 +2197,7 @@ namespace BMA.EHR.Application.Repositories.Commands
FirstName = pf.FirstName!, FirstName = pf.FirstName!,
LastName = pf.LastName!, LastName = pf.LastName!,
RefPlacementProfileId = pf.Id, RefPlacementProfileId = pf.Id,
RefDisciplineId = d.id,
}; };
seq++; seq++;
@ -2232,7 +2243,7 @@ namespace BMA.EHR.Application.Repositories.Commands
{ {
var pf = await _dbContext.Set<Profile>() var pf = await _dbContext.Set<Profile>()
.Include(x => x.Prefix) .Include(x => x.Prefix)
.FirstOrDefaultAsync(x => x.Id == d.id); .FirstOrDefaultAsync(x => x.Id == d.personId);
if (pf != null) if (pf != null)
{ {
@ -2244,6 +2255,7 @@ namespace BMA.EHR.Application.Repositories.Commands
FirstName = pf.FirstName!, FirstName = pf.FirstName!,
LastName = pf.LastName!, LastName = pf.LastName!,
RefPlacementProfileId = pf.Id, RefPlacementProfileId = pf.Id,
RefDisciplineId = d.id,
}; };
seq++; seq++;
@ -2264,7 +2276,7 @@ namespace BMA.EHR.Application.Repositories.Commands
#region " Execute and Deploy " #region " Execute and Deploy "
private async Task ExecuteCommandByTypeAsync(Command command) private async Task ExecuteCommandByTypeAsync(Command command, string token = "")
{ {
switch (command.CommandType.CommandCode.Trim().ToUpper()) switch (command.CommandType.CommandCode.Trim().ToUpper())
{ {
@ -2321,10 +2333,10 @@ namespace BMA.EHR.Application.Repositories.Commands
await ExecuteCommand18Async(command); await ExecuteCommand18Async(command);
break; break;
case "C-PM-19": case "C-PM-19":
await ExecuteCommand19Async(command); await ExecuteCommand19Async(command, token);
break; break;
case "C-PM-20": case "C-PM-20":
await ExecuteCommand20Async(command); await ExecuteCommand20Async(command, token);
break; break;
case "C-PM-21": case "C-PM-21":
await ExecuteCommand21Async(command); await ExecuteCommand21Async(command);
@ -2338,30 +2350,30 @@ namespace BMA.EHR.Application.Repositories.Commands
case "C-PM-24": case "C-PM-24":
await ExecuteCommand24Async(command); await ExecuteCommand24Async(command);
break; break;
// case "C-PM-25": case "C-PM-25":
// await ExecuteCommand25Async(command); await ExecuteCommand25Async(command, token);
// break; break;
// case "C-PM-26": case "C-PM-26":
// await ExecuteCommand26Async(command); await ExecuteCommand26Async(command, token);
// break; break;
// case "C-PM-27": case "C-PM-27":
// await ExecuteCommand27Async(command); await ExecuteCommand27Async(command, token);
// break; break;
// case "C-PM-28": case "C-PM-28":
// await ExecuteCommand28Async(command); await ExecuteCommand28Async(command, token);
// break; break;
// case "C-PM-29": case "C-PM-29":
// await ExecuteCommand29Async(command); await ExecuteCommand29Async(command, token);
// break; break;
// case "C-PM-30": case "C-PM-30":
// await ExecuteCommand30Async(command); await ExecuteCommand30Async(command, token);
// break; break;
// case "C-PM-31": case "C-PM-31":
// await ExecuteCommand31Async(command); await ExecuteCommand31Async(command, token);
// break; break;
// case "C-PM-32": case "C-PM-32":
// await ExecuteCommand32Async(command); await ExecuteCommand32Async(command, token);
// break; break;
default: throw new Exception(GlobalMessages.MethodForCommandTypeNotImplement); default: throw new Exception(GlobalMessages.MethodForCommandTypeNotImplement);
} }
@ -6442,7 +6454,7 @@ namespace BMA.EHR.Application.Repositories.Commands
/// </summary> /// </summary>
/// <param name="command">object ของรายการคำสั่ง</param> /// <param name="command">object ของรายการคำสั่ง</param>
/// <returns></returns> /// <returns></returns>
private async Task ExecuteCommand19Async(Command command) private async Task ExecuteCommand19Async(Command command, string token = "")
{ {
try try
{ {
@ -6575,6 +6587,22 @@ namespace BMA.EHR.Application.Repositories.Commands
await _dbContext.SaveChangesAsync(); await _dbContext.SaveChangesAsync();
} }
var dataSend = command.Receivers.Select(x => new
{
PersonId = x.RefPlacementProfileId,
Id = x.RefDisciplineId,
});
var baseAPI = _configuration["API"];
var apiUrl = $"{baseAPI}/discipline/result/report/up/resume";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
var res = await client.PostAsJsonAsync(apiUrl, new { result = dataSend });
var result = await res.Content.ReadAsStringAsync();
}
// send cc noti inbox // send cc noti inbox
foreach (var cc in command.Deployments) foreach (var cc in command.Deployments)
{ {
@ -6631,7 +6659,7 @@ namespace BMA.EHR.Application.Repositories.Commands
/// </summary> /// </summary>
/// <param name="command">object ของรายการคำสั่ง</param> /// <param name="command">object ของรายการคำสั่ง</param>
/// <returns></returns> /// <returns></returns>
private async Task ExecuteCommand20Async(Command command) private async Task ExecuteCommand20Async(Command command, string token = "")
{ {
try try
{ {
@ -6764,6 +6792,22 @@ namespace BMA.EHR.Application.Repositories.Commands
await _dbContext.SaveChangesAsync(); await _dbContext.SaveChangesAsync();
} }
var dataSend = command.Receivers.Select(x => new
{
PersonId = x.RefPlacementProfileId,
Id = x.RefDisciplineId,
});
var baseAPI = _configuration["API"];
var apiUrl = $"{baseAPI}/discipline/result/report/up/resume";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
var res = await client.PostAsJsonAsync(apiUrl, new { result = dataSend });
var result = await res.Content.ReadAsStringAsync();
}
// send cc noti inbox // send cc noti inbox
foreach (var cc in command.Deployments) foreach (var cc in command.Deployments)
{ {
@ -7575,6 +7619,262 @@ namespace BMA.EHR.Application.Repositories.Commands
} }
} }
/// <summary>
/// C-PM-25 - xxxx
/// </summary>
/// <param name="command">object ของรายการคำสั่ง</param>
/// <returns></returns>
private async Task ExecuteCommand25Async(Command command, string token = "")
{
try
{
var data = command.Receivers.Select(x => new
{
PersonId = x.RefPlacementProfileId,
Id = x.RefDisciplineId,
});
var baseAPI = _configuration["API"];
var apiUrl = $"{baseAPI}/discipline/result/report/stop/resume";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
var result = await res.Content.ReadAsStringAsync();
}
}
catch
{
throw;
}
}
/// <summary>
/// C-PM-26 - xxxx
/// </summary>
/// <param name="command">object ของรายการคำสั่ง</param>
/// <returns></returns>
private async Task ExecuteCommand26Async(Command command, string token = "")
{
try
{
var data = command.Receivers.Select(x => new
{
PersonId = x.RefPlacementProfileId,
Id = x.RefDisciplineId,
});
var baseAPI = _configuration["API"];
var apiUrl = $"{baseAPI}/discipline/result/report/stop/resume";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
var result = await res.Content.ReadAsStringAsync();
}
}
catch
{
throw;
}
}
/// <summary>
/// C-PM-27 - xxxx
/// </summary>
/// <param name="command">object ของรายการคำสั่ง</param>
/// <returns></returns>
private async Task ExecuteCommand27Async(Command command, string token = "")
{
try
{
var data = command.Receivers.Select(x => new
{
PersonId = x.RefPlacementProfileId,
Id = x.RefDisciplineId,
});
var baseAPI = _configuration["API"];
var apiUrl = $"{baseAPI}/discipline/result/report/up/resume";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
var result = await res.Content.ReadAsStringAsync();
}
}
catch
{
throw;
}
}
/// <summary>
/// C-PM-28 - xxxx
/// </summary>
/// <param name="command">object ของรายการคำสั่ง</param>
/// <returns></returns>
private async Task ExecuteCommand28Async(Command command, string token = "")
{
try
{
var data = command.Receivers.Select(x => new
{
PersonId = x.RefPlacementProfileId,
Id = x.RefDisciplineId,
});
var baseAPI = _configuration["API"];
var apiUrl = $"{baseAPI}/discipline/result/report/up/resume";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
var result = await res.Content.ReadAsStringAsync();
}
}
catch
{
throw;
}
}
/// <summary>
/// C-PM-29 - xxxx
/// </summary>
/// <param name="command">object ของรายการคำสั่ง</param>
/// <returns></returns>
private async Task ExecuteCommand29Async(Command command, string token = "")
{
try
{
var data = command.Receivers.Select(x => new
{
PersonId = x.RefPlacementProfileId,
Id = x.RefDisciplineId,
});
var baseAPI = _configuration["API"];
var apiUrl = $"{baseAPI}/discipline/result/report/up/resume";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
var result = await res.Content.ReadAsStringAsync();
}
}
catch
{
throw;
}
}
/// <summary>
/// C-PM-30 - xxxx
/// </summary>
/// <param name="command">object ของรายการคำสั่ง</param>
/// <returns></returns>
private async Task ExecuteCommand30Async(Command command, string token = "")
{
try
{
var data = command.Receivers.Select(x => new
{
PersonId = x.RefPlacementProfileId,
Id = x.RefDisciplineId,
});
var baseAPI = _configuration["API"];
var apiUrl = $"{baseAPI}/discipline/result/report/down/resume";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
var result = await res.Content.ReadAsStringAsync();
}
}
catch
{
throw;
}
}
/// <summary>
/// C-PM-31 - xxxx
/// </summary>
/// <param name="command">object ของรายการคำสั่ง</param>
/// <returns></returns>
private async Task ExecuteCommand31Async(Command command, string token = "")
{
try
{
var data = command.Receivers.Select(x => new
{
PersonId = x.RefPlacementProfileId,
Id = x.RefDisciplineId,
});
var baseAPI = _configuration["API"];
var apiUrl = $"{baseAPI}/discipline/result/report/down/resume";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
var result = await res.Content.ReadAsStringAsync();
}
}
catch
{
throw;
}
}
/// <summary>
/// C-PM-32 - xxxx
/// </summary>
/// <param name="command">object ของรายการคำสั่ง</param>
/// <returns></returns>
private async Task ExecuteCommand32Async(Command command, string token = "")
{
try
{
var data = command.Receivers.Select(x => new
{
PersonId = x.RefPlacementProfileId,
Id = x.RefDisciplineId,
});
var baseAPI = _configuration["API"];
var apiUrl = $"{baseAPI}/discipline/result/report/reject/resume";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
var result = await res.Content.ReadAsStringAsync();
}
}
catch
{
throw;
}
}
#endregion #endregion
#region " Regenerate Json File " #region " Regenerate Json File "
@ -7646,7 +7946,7 @@ namespace BMA.EHR.Application.Repositories.Commands
#region " Execute Command " #region " Execute Command "
public async Task ExecuteCommandAsync(Guid id) public async Task ExecuteCommandAsync(Guid id, string token = "")
{ {
try try
{ {
@ -7661,7 +7961,7 @@ namespace BMA.EHR.Application.Repositories.Commands
if (command == null) if (command == null)
throw new Exception(GlobalMessages.CommandNotFound); throw new Exception(GlobalMessages.CommandNotFound);
else else
await ExecuteCommandByTypeAsync(command); await ExecuteCommandByTypeAsync(command, token);
} }
catch catch
{ {
@ -7747,6 +8047,7 @@ namespace BMA.EHR.Application.Repositories.Commands
FirstName = item.FirstName!, FirstName = item.FirstName!,
LastName = item.LastName!, LastName = item.LastName!,
RefPlacementProfileId = item.RefPlacementProfileId, RefPlacementProfileId = item.RefPlacementProfileId,
RefDisciplineId = item.RefDisciplineId,
Amount = salary == null ? 0 : salary.SalaryAmount, Amount = salary == null ? 0 : salary.SalaryAmount,
MouthSalaryAmount = salary == null ? 0 : salary.MonthSalaryAmount, MouthSalaryAmount = salary == null ? 0 : salary.MonthSalaryAmount,
PositionSalaryAmount = salary == null ? 0 : salary.PositionSalaryAmount PositionSalaryAmount = salary == null ? 0 : salary.PositionSalaryAmount

View file

@ -10,7 +10,7 @@
public class DisciplineDataResponse public class DisciplineDataResponse
{ {
public Guid id { get; set; } = Guid.Empty; public Guid id { get; set; } = Guid.Empty;
public Guid personId { get; set; } = Guid.Empty;
public Guid? CommandId { get; set; } = Guid.Empty; public Guid? commandId { get; set; } = Guid.Empty;
} }
} }

View file

@ -4608,11 +4608,22 @@ namespace BMA.EHR.Command.Service.Controllers
[ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)] [ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)] [ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> ExecuteCommandAsync(Guid orderId) public async Task<ActionResult<ResponseObject>> ExecuteCommandAsync([FromHeader] string authorization, Guid orderId)
{ {
try try
{ {
await _repository.ExecuteCommandAsync(orderId); var token = string.Empty;
if (AuthenticationHeaderValue.TryParse(authorization, out var headerValue))
{
// we have a valid AuthenticationHeaderValue that has the following details:
var scheme = headerValue.Scheme;
token = headerValue.Parameter;
// scheme will be "Bearer"
// parmameter will be the token itself.
}
await _repository.ExecuteCommandAsync(orderId, token);
return Success(); return Success();
} }

View file

@ -319,7 +319,8 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
.Where(x => x.Status == "REPORT") .Where(x => x.Status == "REPORT")
.Select(x => new .Select(x => new
{ {
Id = x.PersonId, PersonId = x.PersonId,
Id = x.Id,
CommandId = x.CommandTypeId, CommandId = x.CommandTypeId,
}) })
.ToListAsync(); .ToListAsync();
@ -341,7 +342,8 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
.Where(x => x.StatusDiscard == "REPORT") .Where(x => x.StatusDiscard == "REPORT")
.Select(x => new .Select(x => new
{ {
Id = x.PersonId, PersonId = x.PersonId,
Id = x.Id,
CommandId = x.CommandTypeDiscardId, CommandId = x.CommandTypeDiscardId,
}) })
.ToListAsync(); .ToListAsync();
@ -363,14 +365,16 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
.Where(x => x.IsReport == "REPORT") .Where(x => x.IsReport == "REPORT")
.Select(x => new .Select(x => new
{ {
Id = x.PersonId, PersonId = x.PersonId,
Id = x.Id,
}) })
.ToListAsync(); .ToListAsync();
var data2 = await _context.DisciplineDisciplinary_ProfileComplaintInvestigates var data2 = await _context.DisciplineDisciplinary_ProfileComplaintInvestigates
.Where(x => x.IsReport == "REPORT") .Where(x => x.IsReport == "REPORT")
.Select(x => new .Select(x => new
{ {
Id = x.PersonId, PersonId = x.PersonId,
Id = x.Id,
}) })
.ToListAsync(); .ToListAsync();
@ -396,12 +400,115 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
.Where(x => x.Status == "REPORT") .Where(x => x.Status == "REPORT")
.Select(x => new .Select(x => new
{ {
Id = x.PersonId, PersonId = x.PersonId,
Id = x.Id,
CommandId = x.CommandTypeId, CommandId = x.CommandTypeId,
}) })
.ToListAsync(); .ToListAsync();
return Success(data); return Success(data);
} }
/// <summary>
/// รายชื่อออกคำสั่งลงโทษ
/// </summary>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("report/up/resume")]
public async Task<ActionResult<ResponseObject>> GetPersonReportUpResume([FromBody] PassDisciplineResponse req)
{
foreach (var d in req.result)
{
var data = await _context.DisciplineDisciplinary_ProfileComplaintInvestigates
.Where(x => x.Status == "REPORT")
.Where(x => x.Id == d.id)
.FirstOrDefaultAsync();
if (data != null)
data.Status = "NEW";
await _context.SaveChangesAsync();
}
return Success();
}
/// <summary>
/// รายชื่อออกคำสั่งงด/ลดโทษ
/// </summary>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("report/down/resume")]
public async Task<ActionResult<ResponseObject>> GetPersonReportDownResume([FromBody] PassDisciplineResponse req)
{
foreach (var d in req.result)
{
var data = await _context.DisciplineDisciplinary_ProfileComplaintInvestigates
.Where(x => x.StatusDiscard == "REPORT")
.Where(x => x.Id == d.id)
.FirstOrDefaultAsync();
if (data != null)
data.StatusDiscard = "NEW";
await _context.SaveChangesAsync();
}
return Success();
}
/// <summary>
/// รายชื่อออกคำสั่งยุติ
/// </summary>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("report/reject/resume")]
public async Task<ActionResult<ResponseObject>> GetPersonReportRejectResume([FromBody] PassDisciplineResponse req)
{
foreach (var d in req.result)
{
var data1 = await _context.DisciplineInvestigate_ProfileComplaints
.Where(x => x.IsReport == "REPORT")
.Where(x => x.Id == d.id)
.FirstOrDefaultAsync();
if (data1 != null)
data1.IsReport = "NEW";
var data2 = await _context.DisciplineDisciplinary_ProfileComplaintInvestigates
.Where(x => x.IsReport == "REPORT")
.Where(x => x.Id == d.id)
.FirstOrDefaultAsync();
if (data2 != null)
data2.IsReport = "NEW";
await _context.SaveChangesAsync();
}
return Success();
}
/// <summary>
/// รายชื่อออกคำสั่งพักราชการ
/// </summary>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("report/stop/resume")]
public async Task<ActionResult<ResponseObject>> GetPersonReportStopResume([FromBody] PassDisciplineResponse req)
{
foreach (var d in req.result)
{
var data = await _context.DisciplineReport_Profiles
.Where(x => x.Status == "REPORT")
.Where(x => x.Id == d.id)
.FirstOrDefaultAsync();
if (data != null)
data.Status = "NEW";
await _context.SaveChangesAsync();
}
return Success();
}
} }
} }

View file

@ -0,0 +1,17 @@

namespace BMA.EHR.Discipline.Service.Requests
{
public class PassDisciplineResponse
{
// public bool successful { get; set; }
public List<DisciplineDataResponse> result { get; set; } = new();
}
public class DisciplineDataResponse
{
public Guid id { get; set; } = Guid.Empty;
public Guid personId { get; set; } = Guid.Empty;
public Guid? commandId { get; set; } = Guid.Empty;
}
}

View file

@ -36,6 +36,9 @@ namespace BMA.EHR.Domain.Models.Commands.Core
[Comment("รหัสอ้างอิงไปยังข้อมูลผู้บรรจุ")] [Comment("รหัสอ้างอิงไปยังข้อมูลผู้บรรจุ")]
public Guid? RefPlacementProfileId { get; set; } public Guid? RefPlacementProfileId { get; set; }
[Comment("รหัสอ้างอิงไปยังข้อมูลวินัย")]
public Guid? RefDisciplineId { get; set; }
[Comment("เงินเดือน")] [Comment("เงินเดือน")]
public double? Amount { get; set; } public double? Amount { get; set; }

View file

@ -0,0 +1,31 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class updatetablecommandreceiveaddrefdiscripline : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<Guid>(
name: "RefDisciplineId",
table: "CommandReceivers",
type: "char(36)",
nullable: true,
comment: "รหัสอ้างอิงไปยังข้อมูลวินัย",
collation: "ascii_general_ci");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "RefDisciplineId",
table: "CommandReceivers");
}
}
}

View file

@ -575,6 +575,10 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnType("varchar(50)") .HasColumnType("varchar(50)")
.HasComment("คำนำหน้านาม"); .HasComment("คำนำหน้านาม");
b.Property<Guid?>("RefDisciplineId")
.HasColumnType("char(36)")
.HasComment("รหัสอ้างอิงไปยังข้อมูลวินัย");
b.Property<Guid?>("RefPlacementProfileId") b.Property<Guid?>("RefPlacementProfileId")
.HasColumnType("char(36)") .HasColumnType("char(36)")
.HasComment("รหัสอ้างอิงไปยังข้อมูลผู้บรรจุ"); .HasComment("รหัสอ้างอิงไปยังข้อมูลผู้บรรจุ");

View file

@ -4,6 +4,7 @@ using BMA.EHR.Domain.Extensions;
using BMA.EHR.Domain.Shared; using BMA.EHR.Domain.Shared;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using Swashbuckle.AspNetCore.Annotations; using Swashbuckle.AspNetCore.Annotations;
using Telerik.Reporting; using Telerik.Reporting;
using Telerik.Reporting.Processing; using Telerik.Reporting.Processing;
@ -2417,7 +2418,7 @@ namespace BMA.EHR.Report.Service.Controllers
AuthorizedUserFullName = raw_data.AuthorizedUserFullName, AuthorizedUserFullName = raw_data.AuthorizedUserFullName,
AuthorizedPosition = raw_data.AuthorizedPosition, AuthorizedPosition = raw_data.AuthorizedPosition,
ReceiveOrganizationName = raw_data.ReceiveOrganizationName, ReceiveOrganizationName = raw_data.ReceiveOrganizationName,
Title = $"เรื่อง {raw_data.CommandSubject}", Title = $"{raw_data.CommandSubject}",
CaseFault = raw_data.CaseFault, CaseFault = raw_data.CaseFault,
FaultLevel = raw_data.FaultLevel, FaultLevel = raw_data.FaultLevel,
@ -4115,7 +4116,7 @@ namespace BMA.EHR.Report.Service.Controllers
// return Success(res); // return Success(res);
// } // }
return Success(contentData); return Success(data);
} }
catch catch
{ {
@ -4172,7 +4173,7 @@ namespace BMA.EHR.Report.Service.Controllers
// return Success(res); // return Success(res);
// } // }
return Success(contentData); return Success(data);
} }
catch catch
{ {
@ -4229,7 +4230,7 @@ namespace BMA.EHR.Report.Service.Controllers
// return Success(res); // return Success(res);
// } // }
return Success(contentData); return Success(data);
} }
catch catch
{ {
@ -4286,7 +4287,7 @@ namespace BMA.EHR.Report.Service.Controllers
// return Success(res); // return Success(res);
// } // }
return Success(contentData); return Success(data);
} }
catch catch
{ {
@ -4343,7 +4344,7 @@ namespace BMA.EHR.Report.Service.Controllers
// return Success(res); // return Success(res);
// } // }
return Success(contentData); return Success(data);
} }
catch catch
{ {
@ -4400,7 +4401,7 @@ namespace BMA.EHR.Report.Service.Controllers
// return Success(res); // return Success(res);
// } // }
return Success(contentData); return Success(data);
} }
catch catch
{ {
@ -4457,7 +4458,7 @@ namespace BMA.EHR.Report.Service.Controllers
// return Success(res); // return Success(res);
// } // }
return Success(contentData); return Success(data);
} }
catch catch
{ {
@ -4514,7 +4515,7 @@ namespace BMA.EHR.Report.Service.Controllers
// return Success(res); // return Success(res);
// } // }
return Success(contentData); return Success(data);
} }
catch catch
{ {