คำสั่งวินัย
This commit is contained in:
parent
f644654384
commit
1747891818
15 changed files with 6826 additions and 83 deletions
|
|
@ -1277,6 +1277,42 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
}
|
||||
}
|
||||
|
||||
public async Task<CommandType23Response?> GetCommandType25AttachmentAsync(Guid id)
|
||||
{
|
||||
try
|
||||
{
|
||||
var raw_data = await _dbContext.Set<CommandReceiver>()
|
||||
.Include(c => c.Command)
|
||||
.Where(c => c.Command.Id == id)
|
||||
.ToListAsync();
|
||||
if (raw_data == null)
|
||||
{
|
||||
throw new Exception(GlobalMessages.CommandNotFound);
|
||||
}
|
||||
var report_data = (from r in raw_data
|
||||
join pf in _dbContext.Set<Profile>()
|
||||
.Include(x => x.Position)
|
||||
.Include(x => x.PosNo)
|
||||
.Include(x => x.Salaries)
|
||||
on r.CitizenId equals pf.CitizenId
|
||||
orderby r.Sequence
|
||||
select new CommandType23Response
|
||||
{
|
||||
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
|
||||
Positionname = pf.Position == null ? "" : pf.Position.Name,
|
||||
Positionno = pf.PosNo == null ? "" : pf.PosNo.Name,
|
||||
Organizationname = pf.Oc == null ? "" : pf.Oc.Replace("/", " "),
|
||||
Salary = pf.Salaries == null || pf.Salaries.Count == 0 ? "" : pf.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
||||
}).FirstOrDefault();
|
||||
|
||||
return report_data;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -141,10 +141,10 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
result = await GetReceiver18Async(command);
|
||||
break;
|
||||
case "C-PM-19":
|
||||
result = await GetReceiver19Async(command);
|
||||
result = await GetReceiver19Async(command, token);
|
||||
break;
|
||||
case "C-PM-20":
|
||||
result = await GetReceiver20Async(command);
|
||||
result = await GetReceiver20Async(command, token);
|
||||
break;
|
||||
case "C-PM-21":
|
||||
result = await GetReceiver21Async(command);
|
||||
|
|
@ -1333,11 +1333,11 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
/// </summary>
|
||||
/// <param name="command">object ของรายการคำสั่ง</param>
|
||||
/// <returns></returns>
|
||||
private async Task<List<CommandReceiver>> GetReceiver19Async(Command command)
|
||||
private async Task<List<CommandReceiver>> GetReceiver19Async(Command command, string token)
|
||||
{
|
||||
try
|
||||
{
|
||||
var result = new List<CommandReceiver>();
|
||||
var resultData = new List<CommandReceiver>();
|
||||
// TODO : ต้องมา list คนตามประเภทอีกครั้งนึง
|
||||
|
||||
// 1. หารายชื่อที่ถูกเลือกไปแล้ว ในประเภทเดียวกัน
|
||||
|
|
@ -1375,10 +1375,53 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
};
|
||||
seq++;
|
||||
|
||||
result.Add(receiver);
|
||||
resultData.Add(receiver);
|
||||
}
|
||||
|
||||
return result;
|
||||
var baseAPI = _configuration["API"];
|
||||
var apiUrl = $"{baseAPI}/discipline/result/report/up";
|
||||
|
||||
var commandType = await _dbContext.Set<CommandType>()
|
||||
.Where(x => x.CommandCode.Trim().ToUpper() == "C-PM-19")
|
||||
.FirstOrDefaultAsync();
|
||||
var response = new PassDisciplineResponse();
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||
var res = await client.SendAsync(req);
|
||||
var result = await res.Content.ReadAsStringAsync();
|
||||
|
||||
response = JsonConvert.DeserializeObject<PassDisciplineResponse>(result);
|
||||
|
||||
foreach (var d in response!.result)
|
||||
{
|
||||
if (commandType == null || commandType.Id != d.CommandId)
|
||||
continue;
|
||||
var pf = await _dbContext.Set<Profile>()
|
||||
.Include(x => x.Prefix)
|
||||
.FirstOrDefaultAsync(x => x.Id == d.id);
|
||||
|
||||
if (pf != null)
|
||||
{
|
||||
var receiver = new CommandReceiver
|
||||
{
|
||||
Sequence = seq,
|
||||
CitizenId = pf.CitizenId!,
|
||||
Prefix = pf.Prefix!.Name,
|
||||
FirstName = pf.FirstName!,
|
||||
LastName = pf.LastName!,
|
||||
RefPlacementProfileId = pf.Id,
|
||||
Amount = 0,
|
||||
};
|
||||
seq++;
|
||||
|
||||
resultData.Add(receiver);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return resultData;
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
|
@ -1391,11 +1434,11 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
/// </summary>
|
||||
/// <param name="command">object ของรายการคำสั่ง</param>
|
||||
/// <returns></returns>
|
||||
private async Task<List<CommandReceiver>> GetReceiver20Async(Command command)
|
||||
private async Task<List<CommandReceiver>> GetReceiver20Async(Command command, string token)
|
||||
{
|
||||
try
|
||||
{
|
||||
var result = new List<CommandReceiver>();
|
||||
var resultData = new List<CommandReceiver>();
|
||||
// TODO : ต้องมา list คนตามประเภทอีกครั้งนึง
|
||||
|
||||
// 1. หารายชื่อที่ถูกเลือกไปแล้ว ในประเภทเดียวกัน
|
||||
|
|
@ -1433,10 +1476,53 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
};
|
||||
seq++;
|
||||
|
||||
result.Add(receiver);
|
||||
resultData.Add(receiver);
|
||||
}
|
||||
|
||||
return result;
|
||||
var baseAPI = _configuration["API"];
|
||||
var apiUrl = $"{baseAPI}/discipline/result/report/up";
|
||||
|
||||
var commandType = await _dbContext.Set<CommandType>()
|
||||
.Where(x => x.CommandCode.Trim().ToUpper() == "C-PM-20")
|
||||
.FirstOrDefaultAsync();
|
||||
var response = new PassDisciplineResponse();
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||
var res = await client.SendAsync(req);
|
||||
var result = await res.Content.ReadAsStringAsync();
|
||||
|
||||
response = JsonConvert.DeserializeObject<PassDisciplineResponse>(result);
|
||||
|
||||
foreach (var d in response!.result)
|
||||
{
|
||||
if (commandType == null || commandType.Id != d.CommandId)
|
||||
continue;
|
||||
var pf = await _dbContext.Set<Profile>()
|
||||
.Include(x => x.Prefix)
|
||||
.FirstOrDefaultAsync(x => x.Id == d.id);
|
||||
|
||||
if (pf != null)
|
||||
{
|
||||
var receiver = new CommandReceiver
|
||||
{
|
||||
Sequence = seq,
|
||||
CitizenId = pf.CitizenId!,
|
||||
Prefix = pf.Prefix!.Name,
|
||||
FirstName = pf.FirstName!,
|
||||
LastName = pf.LastName!,
|
||||
RefPlacementProfileId = pf.Id,
|
||||
Amount = 0,
|
||||
};
|
||||
seq++;
|
||||
|
||||
resultData.Add(receiver);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return resultData;
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
|
@ -1760,7 +1846,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
var apiUrl = $"{baseAPI}/discipline/result/report/stop";
|
||||
|
||||
var commandType = await _dbContext.Set<CommandType>()
|
||||
.Where(x => x.CommandCode.Trim().ToUpper() == "C-PM-25")
|
||||
.Where(x => x.CommandCode.Trim().ToUpper() == "C-PM-26")
|
||||
.FirstOrDefaultAsync();
|
||||
var response = new PassDisciplineResponse();
|
||||
using (var client = new HttpClient())
|
||||
|
|
@ -1822,7 +1908,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
var apiUrl = $"{baseAPI}/discipline/result/report/up";
|
||||
|
||||
var commandType = await _dbContext.Set<CommandType>()
|
||||
.Where(x => x.CommandCode.Trim().ToUpper() == "C-PM-25")
|
||||
.Where(x => x.CommandCode.Trim().ToUpper() == "C-PM-27")
|
||||
.FirstOrDefaultAsync();
|
||||
var response = new PassDisciplineResponse();
|
||||
using (var client = new HttpClient())
|
||||
|
|
@ -1884,7 +1970,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
var apiUrl = $"{baseAPI}/discipline/result/report/up";
|
||||
|
||||
var commandType = await _dbContext.Set<CommandType>()
|
||||
.Where(x => x.CommandCode.Trim().ToUpper() == "C-PM-25")
|
||||
.Where(x => x.CommandCode.Trim().ToUpper() == "C-PM-28")
|
||||
.FirstOrDefaultAsync();
|
||||
var response = new PassDisciplineResponse();
|
||||
using (var client = new HttpClient())
|
||||
|
|
@ -1946,7 +2032,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
var apiUrl = $"{baseAPI}/discipline/result/report/up";
|
||||
|
||||
var commandType = await _dbContext.Set<CommandType>()
|
||||
.Where(x => x.CommandCode.Trim().ToUpper() == "C-PM-25")
|
||||
.Where(x => x.CommandCode.Trim().ToUpper() == "C-PM-29")
|
||||
.FirstOrDefaultAsync();
|
||||
var response = new PassDisciplineResponse();
|
||||
using (var client = new HttpClient())
|
||||
|
|
@ -2008,7 +2094,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
var apiUrl = $"{baseAPI}/discipline/result/report/down";
|
||||
|
||||
var commandType = await _dbContext.Set<CommandType>()
|
||||
.Where(x => x.CommandCode.Trim().ToUpper() == "C-PM-25")
|
||||
.Where(x => x.CommandCode.Trim().ToUpper() == "C-PM-30")
|
||||
.FirstOrDefaultAsync();
|
||||
var response = new PassDisciplineResponse();
|
||||
using (var client = new HttpClient())
|
||||
|
|
@ -2070,7 +2156,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
var apiUrl = $"{baseAPI}/discipline/result/report/down";
|
||||
|
||||
var commandType = await _dbContext.Set<CommandType>()
|
||||
.Where(x => x.CommandCode.Trim().ToUpper() == "C-PM-25")
|
||||
.Where(x => x.CommandCode.Trim().ToUpper() == "C-PM-31")
|
||||
.FirstOrDefaultAsync();
|
||||
var response = new PassDisciplineResponse();
|
||||
using (var client = new HttpClient())
|
||||
|
|
@ -6733,7 +6819,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
/// C-PM-21 - คำสั่งแต่งตั้งลูกจ้างชั่วคราวเป็นลูกจ้างประจำ
|
||||
/// </summary>
|
||||
/// <param name="command">object ของรายการคำสั่ง</param>
|
||||
/// <returns></returns>
|
||||
/// <returns></returns>GenerateCommandReportType25_Cover
|
||||
private async Task ExecuteCommand21Async(Command command)
|
||||
{
|
||||
try
|
||||
|
|
|
|||
|
|
@ -0,0 +1,11 @@
|
|||
namespace BMA.EHR.Application.Responses.Reports
|
||||
{
|
||||
public class CommandType23Response
|
||||
{
|
||||
public string? FullName { get; set; } = string.Empty;
|
||||
public string? Positionname { get; set; } = string.Empty;
|
||||
public string? Positionno { get; set; } = string.Empty;
|
||||
public string? Organizationname { get; set; } = string.Empty;
|
||||
public string? Salary { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue