คำสั่งวินัย
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -528,6 +528,10 @@ namespace BMA.EHR.Command.Service.Controllers
|
|||
OrderStatusValue = data.CommandStatusId,
|
||||
OrderStatusName = data.CommandStatus.Name,
|
||||
|
||||
FaultLevel = data.FaultLevel,
|
||||
CaseFault = data.CaseFault,
|
||||
Result = data.Result,
|
||||
RefRaw = data.RefRaw,
|
||||
};
|
||||
|
||||
return Success(result);
|
||||
|
|
|
|||
|
|
@ -462,7 +462,7 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers
|
|||
IsSuspend = p.IsSuspend,
|
||||
Status = p.Status,
|
||||
StatusDiscard = p.StatusDiscard,
|
||||
Report = p.DisciplineReport_Profiles.Count() > 0 ? true : false,
|
||||
// Report = p.DisciplineReport_Profiles.Count() > 0 ? true : false,
|
||||
}),//รายการข้อมูลบุคลผู้ถูกสืบสวน
|
||||
OrganizationId = x.Organization,//id หน่วยงานกรณี type เป็นหน่วยงาน
|
||||
DisciplineDisciplinary_DocRelevants = x.DisciplineDisciplinary_DocRelevants.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }),
|
||||
|
|
@ -636,6 +636,7 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers
|
|||
LastUpdatedAt = DateTime.Now,
|
||||
});
|
||||
}
|
||||
var hisDirector = data.DisciplineDisciplinary_DirectorInvestigates;
|
||||
_context.DisciplineDisciplinary_DirectorInvestigates.RemoveRange(data.DisciplineDisciplinary_DirectorInvestigates);
|
||||
foreach (var item in req.directors)
|
||||
{
|
||||
|
|
@ -643,10 +644,12 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers
|
|||
.FirstOrDefaultAsync(x => x.Id == item);
|
||||
if (director != null)
|
||||
{
|
||||
var isDirector = hisDirector.Where(x => x.DisciplineDirector.Id == director.Id).FirstOrDefault();
|
||||
data.DisciplineDisciplinary_DirectorInvestigates.Add(
|
||||
new DisciplineDisciplinary_DirectorInvestigate
|
||||
{
|
||||
DisciplineDirector = director,
|
||||
Duty = isDirector == null ? "" : isDirector.Duty,
|
||||
CreatedFullName = FullName ?? "System Administrator",
|
||||
CreatedUserId = UserId ?? "",
|
||||
CreatedAt = DateTime.Now,
|
||||
|
|
@ -666,31 +669,31 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers
|
|||
foreach (var item in req.persons)
|
||||
{
|
||||
var isReport = hisprofile.Where(x => x.PersonId == item.personId).FirstOrDefault();
|
||||
data.DisciplineDisciplinary_ProfileComplaintInvestigates.Add(
|
||||
new DisciplineDisciplinary_ProfileComplaintInvestigate
|
||||
{
|
||||
CitizenId = item.idcard,
|
||||
Prefix = item.prefix,
|
||||
FirstName = item.firstName,
|
||||
LastName = item.lastName,
|
||||
Organization = item.organization,
|
||||
Position = item.position,
|
||||
PositionLevel = item.positionLevel,
|
||||
Salary = item.salary,
|
||||
PersonId = item.personId,
|
||||
PosNo = item.posNo,
|
||||
Status = isReport == null ? "NEW" : isReport.Status,
|
||||
StatusDiscard = isReport == null ? "NEW" : isReport.StatusDiscard,
|
||||
IsReport = isReport == null ? "NEW" : isReport.IsReport,
|
||||
IsSuspend = isReport == null ? "NEW" : isReport.IsSuspend,
|
||||
CreatedFullName = FullName ?? "System Administrator",
|
||||
CreatedUserId = UserId ?? "",
|
||||
CreatedAt = DateTime.Now,
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
}
|
||||
);
|
||||
|
||||
var disciplineDisciplinary_ProfileComplaintInvestigate = new DisciplineDisciplinary_ProfileComplaintInvestigate
|
||||
{
|
||||
CitizenId = item.idcard,
|
||||
Prefix = item.prefix,
|
||||
FirstName = item.firstName,
|
||||
LastName = item.lastName,
|
||||
Organization = item.organization,
|
||||
Position = item.position,
|
||||
PositionLevel = item.positionLevel,
|
||||
Salary = item.salary,
|
||||
PersonId = item.personId,
|
||||
PosNo = item.posNo,
|
||||
Status = isReport == null ? "NEW" : isReport.Status,
|
||||
StatusDiscard = isReport == null ? "NEW" : isReport.StatusDiscard,
|
||||
IsReport = isReport == null ? "NEW" : isReport.IsReport,
|
||||
IsSuspend = isReport == null ? "NEW" : isReport.IsSuspend,
|
||||
CreatedFullName = FullName ?? "System Administrator",
|
||||
CreatedUserId = UserId ?? "",
|
||||
CreatedAt = DateTime.Now,
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
};
|
||||
data.DisciplineDisciplinary_ProfileComplaintInvestigates.Add(disciplineDisciplinary_ProfileComplaintInvestigate);
|
||||
}
|
||||
}
|
||||
await _context.SaveChangesAsync();
|
||||
|
|
@ -1470,7 +1473,6 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers
|
|||
{
|
||||
var data = await _context.DisciplineDisciplinarys
|
||||
.Include(x => x.DisciplineDisciplinary_ProfileComplaintInvestigates)
|
||||
.ThenInclude(x => x.DisciplineReport_Profiles)
|
||||
.Where(x => x.Id == id)
|
||||
.FirstOrDefaultAsync();
|
||||
if (data == null)
|
||||
|
|
@ -1529,7 +1531,6 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers
|
|||
{
|
||||
var data = await _context.DisciplineDisciplinarys
|
||||
.Include(x => x.DisciplineDisciplinary_ProfileComplaintInvestigates)
|
||||
.ThenInclude(x => x.DisciplineReport_Profiles)
|
||||
.Where(x => x.Id == id)
|
||||
.FirstOrDefaultAsync();
|
||||
if (data == null)
|
||||
|
|
@ -1588,7 +1589,6 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers
|
|||
{
|
||||
var data = await _context.DisciplineDisciplinarys
|
||||
.Include(x => x.DisciplineDisciplinary_ProfileComplaintInvestigates)
|
||||
.ThenInclude(x => x.DisciplineReport_Profiles)
|
||||
.Where(x => x.Id == id)
|
||||
.FirstOrDefaultAsync();
|
||||
if (data == null)
|
||||
|
|
@ -1600,9 +1600,7 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers
|
|||
var personIdDupicate = data.DisciplineDisciplinary_ProfileComplaintInvestigates.Where(x => x.PersonId == item.PersonId && x.Status == "NEW").FirstOrDefault();
|
||||
if (personIdDupicate == null)
|
||||
continue;
|
||||
if (personIdDupicate.DisciplineReport_Profiles.Count() > 0)
|
||||
continue;
|
||||
personIdDupicate.DisciplineReport_Profiles.Add(
|
||||
await _context.DisciplineReport_Profiles.AddAsync(
|
||||
new DisciplineReport_Profile
|
||||
{
|
||||
PersonId = item.PersonId,
|
||||
|
|
@ -1615,6 +1613,10 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers
|
|||
PosNo = item.PosNo,
|
||||
Position = item.Position,
|
||||
PositionLevel = item.PositionLevel,
|
||||
Title = data.Title,
|
||||
OffenseDetails = data.OffenseDetails,
|
||||
DisciplinaryCaseFault = data.DisciplinaryCaseFault,
|
||||
DisciplinaryFaultLevel = data.DisciplinaryFaultLevel,
|
||||
Status = "PENDING",
|
||||
CreatedFullName = FullName ?? "System Administrator",
|
||||
CreatedUserId = UserId ?? "",
|
||||
|
|
|
|||
|
|
@ -405,6 +405,7 @@ namespace BMA.EHR.DisciplineInvestigate.Service.Controllers
|
|||
LastUpdatedAt = DateTime.Now,
|
||||
});
|
||||
}
|
||||
var hisDirector = data.DisciplineInvestigate_Directors;
|
||||
_context.DisciplineInvestigate_Directors.RemoveRange(data.DisciplineInvestigate_Directors);
|
||||
foreach (var item in req.directors)
|
||||
{
|
||||
|
|
@ -412,10 +413,12 @@ namespace BMA.EHR.DisciplineInvestigate.Service.Controllers
|
|||
.FirstOrDefaultAsync(x => x.Id == item);
|
||||
if (director != null)
|
||||
{
|
||||
var isDirector = hisDirector.Where(x => x.DisciplineDirector.Id == director.Id).FirstOrDefault();
|
||||
data.DisciplineInvestigate_Directors.Add(
|
||||
new DisciplineInvestigate_Director
|
||||
{
|
||||
DisciplineDirector = director,
|
||||
Duty = isDirector == null ? "" : isDirector.Duty,
|
||||
CreatedFullName = FullName ?? "System Administrator",
|
||||
CreatedUserId = UserId ?? "",
|
||||
CreatedAt = DateTime.Now,
|
||||
|
|
|
|||
|
|
@ -56,8 +56,6 @@ namespace BMA.EHR.DisciplineSuspend.Service.Controllers
|
|||
public async Task<ActionResult<ResponseObject>> GetDisciplineSuspend(int page = 1, int pageSize = 25, string keyword = "")
|
||||
{
|
||||
var data_search = (from x in _context.DisciplineReport_Profiles
|
||||
.Include(x => x.DisciplineDisciplinary_ProfileComplaintInvestigate)
|
||||
.ThenInclude(x => x.DisciplineDisciplinary)
|
||||
where x.CitizenId.Contains(keyword) ||
|
||||
x.Prefix.Contains(keyword) ||
|
||||
x.FirstName.Contains(keyword) ||
|
||||
|
|
@ -66,7 +64,7 @@ namespace BMA.EHR.DisciplineSuspend.Service.Controllers
|
|||
x.Position.Contains(keyword) ||
|
||||
x.PosNo.Contains(keyword) ||
|
||||
x.PositionLevel.Contains(keyword) ||
|
||||
x.DisciplineDisciplinary_ProfileComplaintInvestigate.DisciplineDisciplinary.Title.Contains(keyword)
|
||||
x.Title.Contains(keyword)
|
||||
select x).ToList();
|
||||
var data = data_search
|
||||
.Select(x => new
|
||||
|
|
@ -85,10 +83,10 @@ namespace BMA.EHR.DisciplineSuspend.Service.Controllers
|
|||
DescriptionSuspend = x.DescriptionSuspend,
|
||||
StartDateSuspend = x.StartDateSuspend,
|
||||
EndDateSuspend = x.EndDateSuspend,
|
||||
Title = x.DisciplineDisciplinary_ProfileComplaintInvestigate.DisciplineDisciplinary.Title,
|
||||
OffenseDetails = x.DisciplineDisciplinary_ProfileComplaintInvestigate.DisciplineDisciplinary.OffenseDetails,//ลักษณะความผิด
|
||||
DisciplinaryFaultLevel = x.DisciplineDisciplinary_ProfileComplaintInvestigate.DisciplineDisciplinary.DisciplinaryFaultLevel,//ระดับโทษความผิด
|
||||
DisciplinaryCaseFault = x.DisciplineDisciplinary_ProfileComplaintInvestigate.DisciplineDisciplinary.DisciplinaryCaseFault,//กรณีความผิด
|
||||
Title = x.Title,
|
||||
OffenseDetails = x.OffenseDetails,//ลักษณะความผิด
|
||||
DisciplinaryFaultLevel = x.DisciplinaryFaultLevel,//ระดับโทษความผิด
|
||||
DisciplinaryCaseFault = x.DisciplinaryCaseFault,//กรณีความผิด
|
||||
})
|
||||
.OrderByDescending(x => x.CitizenId)
|
||||
.Skip((page - 1) * pageSize)
|
||||
|
|
@ -126,10 +124,10 @@ namespace BMA.EHR.DisciplineSuspend.Service.Controllers
|
|||
DescriptionSuspend = x.DescriptionSuspend,
|
||||
StartDateSuspend = x.StartDateSuspend,
|
||||
EndDateSuspend = x.EndDateSuspend,
|
||||
Title = x.DisciplineDisciplinary_ProfileComplaintInvestigate.DisciplineDisciplinary.Title,
|
||||
OffenseDetails = x.DisciplineDisciplinary_ProfileComplaintInvestigate.DisciplineDisciplinary.OffenseDetails,//ลักษณะความผิด
|
||||
DisciplinaryFaultLevel = x.DisciplineDisciplinary_ProfileComplaintInvestigate.DisciplineDisciplinary.DisciplinaryFaultLevel,//ระดับโทษความผิด
|
||||
DisciplinaryCaseFault = x.DisciplineDisciplinary_ProfileComplaintInvestigate.DisciplineDisciplinary.DisciplinaryCaseFault,//กรณีความผิด
|
||||
Title = x.Title,
|
||||
OffenseDetails = x.OffenseDetails,//ลักษณะความผิด
|
||||
DisciplinaryFaultLevel = x.DisciplinaryFaultLevel,//ระดับโทษความผิด
|
||||
DisciplinaryCaseFault = x.DisciplinaryCaseFault,//กรณีความผิด
|
||||
})
|
||||
.Where(x => x.Id == id)
|
||||
.FirstOrDefaultAsync();
|
||||
|
|
|
|||
|
|
@ -43,6 +43,6 @@ namespace BMA.EHR.Domain.Models.Discipline
|
|||
public string? IsSuspend { get; set; } = "NEW";
|
||||
[Required, Comment("Id เรื่องสอบสวน")]
|
||||
public DisciplineDisciplinary DisciplineDisciplinary { get; set; }
|
||||
public virtual List<DisciplineReport_Profile> DisciplineReport_Profiles { get; set; } = new List<DisciplineReport_Profile>();
|
||||
// public virtual List<DisciplineReport_Profile> DisciplineReport_Profiles { get; set; } = new List<DisciplineReport_Profile>();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,16 @@ namespace BMA.EHR.Domain.Models.Discipline
|
|||
public DateTime? StartDateSuspend { get; set; }
|
||||
[Comment("วันสิ้นสุดการสั่งพักราชการ/ให้ออกจากราชการไว้ก่อน")]
|
||||
public DateTime? EndDateSuspend { get; set; }
|
||||
[Required, Comment("Id ผู้ถูกร้องเรียน")]
|
||||
public DisciplineDisciplinary_ProfileComplaintInvestigate DisciplineDisciplinary_ProfileComplaintInvestigate { get; set; }
|
||||
|
||||
[Comment("เรื่องที่ร้องเรียน"), Column(TypeName = "text")]
|
||||
public string? Title { get; set; } = string.Empty;
|
||||
[Comment("ลักษณะความผิดครั้งแรกจะเป็น 'ยังไม่ระบุ' (NOT_SPECIFIED คือ ยังไม่ระบุ, NOT_DEADLY คือ ไม่ร้ายแรง, DEADLY คือ ร้ายแรง)")]
|
||||
public string? OffenseDetails { get; set; } = string.Empty;
|
||||
[Comment("ระดับโทษความผิด กรณีไม่ร้ายแรง: ภาคทัณฑ์, ตัดเงินเดือน, ลดขั้นเงินเดือน | กรณีร้ายแรง: ปลดออก, ไล่ออก")]
|
||||
public string? DisciplinaryFaultLevel { get; set; }
|
||||
[Comment("กรณีความผิด")]
|
||||
public string? DisciplinaryCaseFault { get; set; }
|
||||
// [Required, Comment("Id ผู้ถูกร้องเรียน")]
|
||||
// public DisciplineDisciplinary_ProfileComplaintInvestigate? DisciplineDisciplinary_ProfileComplaintInvestigate { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,22 @@
|
|||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class updatetableDisciplineDisciplinarysaddIsSuspend2 : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,100 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class updatetableDisciplineDisciplinarysaddIsSuspend3 : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_DisciplineReport_Profiles_DisciplineDisciplinary_ProfileComp~",
|
||||
table: "DisciplineReport_Profiles");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_DisciplineReport_Profiles_DisciplineDisciplinary_ProfileComp~",
|
||||
table: "DisciplineReport_Profiles");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "DisciplineDisciplinary_ProfileComplaintInvestigateId",
|
||||
table: "DisciplineReport_Profiles");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "DisciplinaryCaseFault",
|
||||
table: "DisciplineReport_Profiles",
|
||||
type: "longtext",
|
||||
nullable: true,
|
||||
comment: "กรณีความผิด")
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "DisciplinaryFaultLevel",
|
||||
table: "DisciplineReport_Profiles",
|
||||
type: "longtext",
|
||||
nullable: true,
|
||||
comment: "ระดับโทษความผิด กรณีไม่ร้ายแรง: ภาคทัณฑ์, ตัดเงินเดือน, ลดขั้นเงินเดือน | กรณีร้ายแรง: ปลดออก, ไล่ออก")
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "OffenseDetails",
|
||||
table: "DisciplineReport_Profiles",
|
||||
type: "longtext",
|
||||
nullable: true,
|
||||
comment: "ลักษณะความผิดครั้งแรกจะเป็น 'ยังไม่ระบุ' (NOT_SPECIFIED คือ ยังไม่ระบุ, NOT_DEADLY คือ ไม่ร้ายแรง, DEADLY คือ ร้ายแรง)")
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "Title",
|
||||
table: "DisciplineReport_Profiles",
|
||||
type: "text",
|
||||
nullable: true,
|
||||
comment: "เรื่องที่ร้องเรียน")
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "DisciplinaryCaseFault",
|
||||
table: "DisciplineReport_Profiles");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "DisciplinaryFaultLevel",
|
||||
table: "DisciplineReport_Profiles");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "OffenseDetails",
|
||||
table: "DisciplineReport_Profiles");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Title",
|
||||
table: "DisciplineReport_Profiles");
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "DisciplineDisciplinary_ProfileComplaintInvestigateId",
|
||||
table: "DisciplineReport_Profiles",
|
||||
type: "char(36)",
|
||||
nullable: false,
|
||||
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
|
||||
collation: "ascii_general_ci");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_DisciplineReport_Profiles_DisciplineDisciplinary_ProfileComp~",
|
||||
table: "DisciplineReport_Profiles",
|
||||
column: "DisciplineDisciplinary_ProfileComplaintInvestigateId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_DisciplineReport_Profiles_DisciplineDisciplinary_ProfileComp~",
|
||||
table: "DisciplineReport_Profiles",
|
||||
column: "DisciplineDisciplinary_ProfileComplaintInvestigateId",
|
||||
principalTable: "DisciplineDisciplinary_ProfileComplaintInvestigates",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2388,8 +2388,13 @@ namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb
|
|||
.HasColumnType("longtext")
|
||||
.HasComment("เหตุที่ถูกสั่งพักราชการ/ออกจากราชการไว้ก่อน");
|
||||
|
||||
b.Property<Guid>("DisciplineDisciplinary_ProfileComplaintInvestigateId")
|
||||
.HasColumnType("char(36)");
|
||||
b.Property<string>("DisciplinaryCaseFault")
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("กรณีความผิด");
|
||||
|
||||
b.Property<string>("DisciplinaryFaultLevel")
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("ระดับโทษความผิด กรณีไม่ร้ายแรง: ภาคทัณฑ์, ตัดเงินเดือน, ลดขั้นเงินเดือน | กรณีร้ายแรง: ปลดออก, ไล่ออก");
|
||||
|
||||
b.Property<DateTime?>("EndDateSuspend")
|
||||
.HasColumnType("datetime(6)")
|
||||
|
|
@ -2426,6 +2431,10 @@ namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb
|
|||
.HasColumnOrder(102)
|
||||
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
|
||||
|
||||
b.Property<string>("OffenseDetails")
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("ลักษณะความผิดครั้งแรกจะเป็น 'ยังไม่ระบุ' (NOT_SPECIFIED คือ ยังไม่ระบุ, NOT_DEADLY คือ ไม่ร้ายแรง, DEADLY คือ ร้ายแรง)");
|
||||
|
||||
b.Property<string>("Organization")
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("สังกัด");
|
||||
|
|
@ -2462,9 +2471,11 @@ namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb
|
|||
.HasColumnType("longtext")
|
||||
.HasComment("สถานะออกคำสั่ง");
|
||||
|
||||
b.HasKey("Id");
|
||||
b.Property<string>("Title")
|
||||
.HasColumnType("text")
|
||||
.HasComment("เรื่องที่ร้องเรียน");
|
||||
|
||||
b.HasIndex("DisciplineDisciplinary_ProfileComplaintInvestigateId");
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("DisciplineReport_Profiles");
|
||||
});
|
||||
|
|
@ -2895,17 +2906,6 @@ namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb
|
|||
b.Navigation("DisciplineInvestigate");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineReport_Profile", b =>
|
||||
{
|
||||
b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary_ProfileComplaintInvestigate", "DisciplineDisciplinary_ProfileComplaintInvestigate")
|
||||
.WithMany("DisciplineReport_Profiles")
|
||||
.HasForeignKey("DisciplineDisciplinary_ProfileComplaintInvestigateId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("DisciplineDisciplinary_ProfileComplaintInvestigate");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineComplaint", b =>
|
||||
{
|
||||
b.Navigation("DisciplineComplaint_Docs");
|
||||
|
|
@ -2956,11 +2956,6 @@ namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb
|
|||
b.Navigation("DisciplineDisciplinary_ProfileComplaintInvestigates");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary_ProfileComplaintInvestigate", b =>
|
||||
{
|
||||
b.Navigation("DisciplineReport_Profiles");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineInvestigate", b =>
|
||||
{
|
||||
b.Navigation("DisciplineDisciplinarys");
|
||||
|
|
|
|||
|
|
@ -2388,6 +2388,59 @@ namespace BMA.EHR.Report.Service.Controllers
|
|||
}
|
||||
#endregion
|
||||
|
||||
#region " C-PM-25 "
|
||||
|
||||
private async Task<dynamic> GenerateCommandReportType25_Cover(Guid commandId, string exportType)
|
||||
{
|
||||
try
|
||||
{
|
||||
var raw_data = await _repository.GetByIdAsync(commandId);
|
||||
if (raw_data == null)
|
||||
{
|
||||
throw new Exception(GlobalMessages.CommandNotFound);
|
||||
}
|
||||
|
||||
var raw_data_profile = await _commandReportRepository.GetCommandType25AttachmentAsync(commandId);
|
||||
|
||||
var command = new
|
||||
{
|
||||
No = raw_data.CommandNo.ToThaiNumber(),
|
||||
Year = raw_data.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(),
|
||||
Issuerorganizationname = raw_data.IssuerOrganizationName,
|
||||
ConclusionRegisterNo = raw_data.ConclusionRegisterNo.ToThaiNumber(),
|
||||
ConclusionRegisterDate = raw_data.ConclusionRegisterDate == null ? "" : raw_data.ConclusionRegisterDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
||||
ConclusionResultNo = raw_data.ConclusionResultNo.ToThaiNumber(),
|
||||
ConclusionResultDate = raw_data.ConclusionResultDate == null ? "" : raw_data.ConclusionResultDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
||||
PositionList = "",
|
||||
Count = raw_data.Receivers.Count.ToString().ToThaiNumber(),
|
||||
CommandAffectDate = raw_data.CommandAffectDate == null ? "" : raw_data.CommandAffectDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
||||
AuthorizedUserFullName = raw_data.AuthorizedUserFullName,
|
||||
AuthorizedPosition = raw_data.AuthorizedPosition,
|
||||
ReceiveOrganizationName = raw_data.ReceiveOrganizationName,
|
||||
Title = $"เรื่อง {raw_data.CommandSubject}",
|
||||
|
||||
CaseFault = raw_data.CaseFault,
|
||||
FaultLevel = raw_data.FaultLevel,
|
||||
RefRaw = raw_data.RefRaw,
|
||||
Result = raw_data.Result,
|
||||
|
||||
Fullname = raw_data_profile == null ? "" : raw_data_profile.FullName,
|
||||
Positionname = raw_data_profile == null ? "" : raw_data_profile.Positionname,
|
||||
Positionno = raw_data_profile == null ? "" : raw_data_profile.Positionno,
|
||||
Organizationname = raw_data_profile == null ? "" : raw_data_profile.Organizationname,
|
||||
Salary = raw_data_profile == null ? "" : raw_data_profile.Salary,
|
||||
};
|
||||
|
||||
return command;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region " C-PM-01 คำสั่งบรรจุและแต่งตั้ง: สำหรับผู้สอบแข่งขันได้ "
|
||||
|
|
@ -4013,6 +4066,463 @@ namespace BMA.EHR.Report.Service.Controllers
|
|||
|
||||
#endregion
|
||||
|
||||
#region " C-PM-25 คำสั่งพักจากราชการxxxx "
|
||||
|
||||
/// <summary>
|
||||
/// คำสั่ง C-PM-25 คำสั่งพักจากราชการ
|
||||
/// </summary>
|
||||
/// <param name="id">Record Id ของคำสั่ง</param>
|
||||
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet("c-pm-25/cover/{exportType}/{id}")]
|
||||
[AllowAnonymous]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> GetCommandType25CoverReport(Guid id, string exportType = "pdf")
|
||||
{
|
||||
try
|
||||
{
|
||||
var mimeType = "";
|
||||
switch (exportType.Trim().ToLower())
|
||||
{
|
||||
case "pdf": mimeType = "application/pdf"; break;
|
||||
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
||||
}
|
||||
|
||||
var cmd = await _repository.GetByIdAsync(id);
|
||||
if (cmd == null)
|
||||
throw new Exception(GlobalMessages.CommandNotFound);
|
||||
|
||||
var contentData = await GenerateCommandReportType25_Cover(id, exportType);
|
||||
var data = new
|
||||
{
|
||||
template = "DP6_006",
|
||||
reportName = "docx-report",
|
||||
data = contentData
|
||||
};
|
||||
// var apiUrl = "https://report-server.frappet.synology.me/api/v1/report-template/docx";
|
||||
// using (var client = new HttpClient())
|
||||
// {
|
||||
// // client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||
// var req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
||||
// // var res = await client.SendAsync(req);
|
||||
// var res = await client.PostAsJsonAsync(apiUrl, data);
|
||||
// var result = await res.Content.ReadAsStringAsync();
|
||||
// return Success(res);
|
||||
|
||||
// }
|
||||
return Success(contentData);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region " C-PM-26 คำสั่งให้ออกจากราชการไว้ก่อนxxxx "
|
||||
|
||||
/// <summary>
|
||||
/// คำสั่ง C-PM-26 คำสั่งให้ออกจากราชการไว้ก่อน
|
||||
/// </summary>
|
||||
/// <param name="id">Record Id ของคำสั่ง</param>
|
||||
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet("c-pm-26/cover/{exportType}/{id}")]
|
||||
[AllowAnonymous]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> GetCommandType26CoverReport(Guid id, string exportType = "pdf")
|
||||
{
|
||||
try
|
||||
{
|
||||
var mimeType = "";
|
||||
switch (exportType.Trim().ToLower())
|
||||
{
|
||||
case "pdf": mimeType = "application/pdf"; break;
|
||||
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
||||
}
|
||||
|
||||
var cmd = await _repository.GetByIdAsync(id);
|
||||
if (cmd == null)
|
||||
throw new Exception(GlobalMessages.CommandNotFound);
|
||||
|
||||
var contentData = await GenerateCommandReportType25_Cover(id, exportType);
|
||||
var data = new
|
||||
{
|
||||
template = "DP6_006",
|
||||
reportName = "docx-report",
|
||||
data = contentData
|
||||
};
|
||||
// var apiUrl = "https://report-server.frappet.synology.me/api/v1/report-template/docx";
|
||||
// using (var client = new HttpClient())
|
||||
// {
|
||||
// // client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||
// var req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
||||
// // var res = await client.SendAsync(req);
|
||||
// var res = await client.PostAsJsonAsync(apiUrl, data);
|
||||
// var result = await res.Content.ReadAsStringAsync();
|
||||
// return Success(res);
|
||||
|
||||
// }
|
||||
return Success(contentData);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region " C-PM-27 คำสั่งลงโทษ ภาคทัณฑ์ "
|
||||
|
||||
/// <summary>
|
||||
/// คำสั่ง C-PM-27 คำสั่งลงโทษ ภาคทัณฑ์
|
||||
/// </summary>
|
||||
/// <param name="id">Record Id ของคำสั่ง</param>
|
||||
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet("c-pm-27/cover/{exportType}/{id}")]
|
||||
[AllowAnonymous]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> GetCommandType27CoverReport(Guid id, string exportType = "pdf")
|
||||
{
|
||||
try
|
||||
{
|
||||
var mimeType = "";
|
||||
switch (exportType.Trim().ToLower())
|
||||
{
|
||||
case "pdf": mimeType = "application/pdf"; break;
|
||||
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
||||
}
|
||||
|
||||
var cmd = await _repository.GetByIdAsync(id);
|
||||
if (cmd == null)
|
||||
throw new Exception(GlobalMessages.CommandNotFound);
|
||||
|
||||
var contentData = await GenerateCommandReportType25_Cover(id, exportType);
|
||||
var data = new
|
||||
{
|
||||
template = "DP6_006",
|
||||
reportName = "docx-report",
|
||||
data = contentData
|
||||
};
|
||||
// var apiUrl = "https://report-server.frappet.synology.me/api/v1/report-template/docx";
|
||||
// using (var client = new HttpClient())
|
||||
// {
|
||||
// // client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||
// var req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
||||
// // var res = await client.SendAsync(req);
|
||||
// var res = await client.PostAsJsonAsync(apiUrl, data);
|
||||
// var result = await res.Content.ReadAsStringAsync();
|
||||
// return Success(res);
|
||||
|
||||
// }
|
||||
return Success(contentData);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region " C-PM-28 คำสั่งลงโทษ ตัดเงินเดือน "
|
||||
|
||||
/// <summary>
|
||||
/// คำสั่ง C-PM-28 คำสั่งลงโทษ ตัดเงินเดือน
|
||||
/// </summary>
|
||||
/// <param name="id">Record Id ของคำสั่ง</param>
|
||||
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet("c-pm-28/cover/{exportType}/{id}")]
|
||||
[AllowAnonymous]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> GetCommandType28CoverReport(Guid id, string exportType = "pdf")
|
||||
{
|
||||
try
|
||||
{
|
||||
var mimeType = "";
|
||||
switch (exportType.Trim().ToLower())
|
||||
{
|
||||
case "pdf": mimeType = "application/pdf"; break;
|
||||
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
||||
}
|
||||
|
||||
var cmd = await _repository.GetByIdAsync(id);
|
||||
if (cmd == null)
|
||||
throw new Exception(GlobalMessages.CommandNotFound);
|
||||
|
||||
var contentData = await GenerateCommandReportType25_Cover(id, exportType);
|
||||
var data = new
|
||||
{
|
||||
template = "DP6_004",
|
||||
reportName = "docx-report",
|
||||
data = contentData
|
||||
};
|
||||
// var apiUrl = "https://report-server.frappet.synology.me/api/v1/report-template/docx";
|
||||
// using (var client = new HttpClient())
|
||||
// {
|
||||
// // client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||
// var req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
||||
// // var res = await client.SendAsync(req);
|
||||
// var res = await client.PostAsJsonAsync(apiUrl, data);
|
||||
// var result = await res.Content.ReadAsStringAsync();
|
||||
// return Success(res);
|
||||
|
||||
// }
|
||||
return Success(contentData);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region " C-PM-29 คำสั่งลงโทษ ลดขั้นเงินเดือน "
|
||||
|
||||
/// <summary>
|
||||
/// คำสั่ง C-PM-29 คำสั่งลงโทษ ลดขั้นเงินเดือน
|
||||
/// </summary>
|
||||
/// <param name="id">Record Id ของคำสั่ง</param>
|
||||
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet("c-pm-29/cover/{exportType}/{id}")]
|
||||
[AllowAnonymous]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> GetCommandType29CoverReport(Guid id, string exportType = "pdf")
|
||||
{
|
||||
try
|
||||
{
|
||||
var mimeType = "";
|
||||
switch (exportType.Trim().ToLower())
|
||||
{
|
||||
case "pdf": mimeType = "application/pdf"; break;
|
||||
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
||||
}
|
||||
|
||||
var cmd = await _repository.GetByIdAsync(id);
|
||||
if (cmd == null)
|
||||
throw new Exception(GlobalMessages.CommandNotFound);
|
||||
|
||||
var contentData = await GenerateCommandReportType25_Cover(id, exportType);
|
||||
var data = new
|
||||
{
|
||||
template = "DP6_007",
|
||||
reportName = "docx-report",
|
||||
data = contentData
|
||||
};
|
||||
// var apiUrl = "https://report-server.frappet.synology.me/api/v1/report-template/docx";
|
||||
// using (var client = new HttpClient())
|
||||
// {
|
||||
// // client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||
// var req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
||||
// // var res = await client.SendAsync(req);
|
||||
// var res = await client.PostAsJsonAsync(apiUrl, data);
|
||||
// var result = await res.Content.ReadAsStringAsync();
|
||||
// return Success(res);
|
||||
|
||||
// }
|
||||
return Success(contentData);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region " C-PM-30 คำสั่งเพิ่มโทษ "
|
||||
|
||||
/// <summary>
|
||||
/// คำสั่ง C-PM-30 คำสั่งเพิ่มโทษ
|
||||
/// </summary>
|
||||
/// <param name="id">Record Id ของคำสั่ง</param>
|
||||
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet("c-pm-30/cover/{exportType}/{id}")]
|
||||
[AllowAnonymous]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> GetCommandType30CoverReport(Guid id, string exportType = "pdf")
|
||||
{
|
||||
try
|
||||
{
|
||||
var mimeType = "";
|
||||
switch (exportType.Trim().ToLower())
|
||||
{
|
||||
case "pdf": mimeType = "application/pdf"; break;
|
||||
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
||||
}
|
||||
|
||||
var cmd = await _repository.GetByIdAsync(id);
|
||||
if (cmd == null)
|
||||
throw new Exception(GlobalMessages.CommandNotFound);
|
||||
|
||||
var contentData = await GenerateCommandReportType25_Cover(id, exportType);
|
||||
var data = new
|
||||
{
|
||||
template = "DP6_002",
|
||||
reportName = "docx-report",
|
||||
data = contentData
|
||||
};
|
||||
// var apiUrl = "https://report-server.frappet.synology.me/api/v1/report-template/docx";
|
||||
// using (var client = new HttpClient())
|
||||
// {
|
||||
// // client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||
// var req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
||||
// // var res = await client.SendAsync(req);
|
||||
// var res = await client.PostAsJsonAsync(apiUrl, data);
|
||||
// var result = await res.Content.ReadAsStringAsync();
|
||||
// return Success(res);
|
||||
|
||||
// }
|
||||
return Success(contentData);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region " C-PM-31 คำสั่งงดโทษ "
|
||||
|
||||
/// <summary>
|
||||
/// คำสั่ง C-PM-31 คำสั่งงดโทษ
|
||||
/// </summary>
|
||||
/// <param name="id">Record Id ของคำสั่ง</param>
|
||||
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet("c-pm-31/cover/{exportType}/{id}")]
|
||||
[AllowAnonymous]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> GetCommandType31CoverReport(Guid id, string exportType = "pdf")
|
||||
{
|
||||
try
|
||||
{
|
||||
var mimeType = "";
|
||||
switch (exportType.Trim().ToLower())
|
||||
{
|
||||
case "pdf": mimeType = "application/pdf"; break;
|
||||
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
||||
}
|
||||
|
||||
var cmd = await _repository.GetByIdAsync(id);
|
||||
if (cmd == null)
|
||||
throw new Exception(GlobalMessages.CommandNotFound);
|
||||
|
||||
var contentData = await GenerateCommandReportType25_Cover(id, exportType);
|
||||
var data = new
|
||||
{
|
||||
template = "DP6_001",
|
||||
reportName = "docx-report",
|
||||
data = contentData
|
||||
};
|
||||
// var apiUrl = "https://report-server.frappet.synology.me/api/v1/report-template/docx";
|
||||
// using (var client = new HttpClient())
|
||||
// {
|
||||
// // client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||
// var req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
||||
// // var res = await client.SendAsync(req);
|
||||
// var res = await client.PostAsJsonAsync(apiUrl, data);
|
||||
// var result = await res.Content.ReadAsStringAsync();
|
||||
// return Success(res);
|
||||
|
||||
// }
|
||||
return Success(contentData);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region " C-PM-32 คำสั่งยุติเรื่อง "
|
||||
|
||||
/// <summary>
|
||||
/// คำสั่ง C-PM-32 คำสั่งยุติเรื่อง
|
||||
/// </summary>
|
||||
/// <param name="id">Record Id ของคำสั่ง</param>
|
||||
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet("c-pm-32/cover/{exportType}/{id}")]
|
||||
[AllowAnonymous]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> GetCommandType32CoverReport(Guid id, string exportType = "pdf")
|
||||
{
|
||||
try
|
||||
{
|
||||
var mimeType = "";
|
||||
switch (exportType.Trim().ToLower())
|
||||
{
|
||||
case "pdf": mimeType = "application/pdf"; break;
|
||||
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
||||
}
|
||||
|
||||
var cmd = await _repository.GetByIdAsync(id);
|
||||
if (cmd == null)
|
||||
throw new Exception(GlobalMessages.CommandNotFound);
|
||||
|
||||
var contentData = await GenerateCommandReportType25_Cover(id, exportType);
|
||||
var data = new
|
||||
{
|
||||
template = "DP6_003",
|
||||
reportName = "docx-report",
|
||||
data = contentData
|
||||
};
|
||||
// var apiUrl = "https://report-server.frappet.synology.me/api/v1/report-template/docx";
|
||||
// using (var client = new HttpClient())
|
||||
// {
|
||||
// // client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||
// var req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
||||
// // var res = await client.SendAsync(req);
|
||||
// var res = await client.PostAsJsonAsync(apiUrl, data);
|
||||
// var result = await res.Content.ReadAsStringAsync();
|
||||
// return Success(res);
|
||||
|
||||
// }
|
||||
return Success(contentData);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue