คำสั่ง38
This commit is contained in:
parent
def2b8f7fe
commit
d7677ac2a5
5 changed files with 391 additions and 43 deletions
|
|
@ -200,6 +200,9 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
case "C-PM-37":
|
case "C-PM-37":
|
||||||
result = await GetReceiver37Async(command, token);
|
result = await GetReceiver37Async(command, token);
|
||||||
break;
|
break;
|
||||||
|
case "C-PM-38":
|
||||||
|
result = await GetReceiver38Async(command, token);
|
||||||
|
break;
|
||||||
default: throw new Exception(GlobalMessages.MethodForCommandTypeNotImplement);
|
default: throw new Exception(GlobalMessages.MethodForCommandTypeNotImplement);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2550,6 +2553,57 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// C-PM-38
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="command">object ของรายการคำสั่ง</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
private async Task<List<CommandReceiver>> GetReceiver38Async(Command command, string token)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var resultData = new List<CommandReceiver>();
|
||||||
|
|
||||||
|
var baseAPI = _configuration["API"];
|
||||||
|
var apiUrl = $"{baseAPI}/salary/report/command/38/{command.SalaryPeriodId}";
|
||||||
|
|
||||||
|
var response = new PassSalaryResponse();
|
||||||
|
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<PassSalaryResponse>(result);
|
||||||
|
|
||||||
|
var seq = 1;
|
||||||
|
foreach (var d in response!.result)
|
||||||
|
{
|
||||||
|
var receiver = new CommandReceiver
|
||||||
|
{
|
||||||
|
Sequence = seq,
|
||||||
|
CitizenId = d.citizenId,
|
||||||
|
Prefix = d.prefix == null ? "" : d.prefix,
|
||||||
|
FirstName = d.firstName,
|
||||||
|
LastName = d.lastName,
|
||||||
|
RefPlacementProfileId = d.profileId == null ? null : Guid.Parse(d.profileId),
|
||||||
|
RefDisciplineId = d.id,
|
||||||
|
};
|
||||||
|
seq++;
|
||||||
|
|
||||||
|
resultData.Add(receiver);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return resultData;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region " Execute and Deploy "
|
#region " Execute and Deploy "
|
||||||
|
|
@ -2667,6 +2721,9 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
case "C-PM-37":
|
case "C-PM-37":
|
||||||
await ExecuteCommand37Async(command, token);
|
await ExecuteCommand37Async(command, token);
|
||||||
break;
|
break;
|
||||||
|
case "C-PM-38":
|
||||||
|
await ExecuteCommand38Async(command, token);
|
||||||
|
break;
|
||||||
default: throw new Exception(GlobalMessages.MethodForCommandTypeNotImplement);
|
default: throw new Exception(GlobalMessages.MethodForCommandTypeNotImplement);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -7991,6 +8048,121 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// C-PM-38 - คำสั่งปรับโครงสร้าง
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="command">object ของรายการคำสั่ง</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
private async Task ExecuteCommand38Async(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}/salary/report/command/38/resume";
|
||||||
|
// using (var client = new HttpClient())
|
||||||
|
// {
|
||||||
|
// client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||||
|
// var req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
||||||
|
// var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
|
||||||
|
// var result = await res.Content.ReadAsStringAsync();
|
||||||
|
// }
|
||||||
|
// create command payload
|
||||||
|
var payload_attach = command.Documents
|
||||||
|
.Select(x => new PayloadAttachment
|
||||||
|
{
|
||||||
|
name = x.Category == "cover" ? "สำเนาคำสั่ง" : "สำเนาเอกสารแนบท้าย",
|
||||||
|
url = $"{_configuration["API"]}/order/download/attachment/{x.Document.Id}"
|
||||||
|
})
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
var payload = new CommandPayload()
|
||||||
|
{
|
||||||
|
attachments = payload_attach
|
||||||
|
};
|
||||||
|
|
||||||
|
var payload_str = JsonConvert.SerializeObject(payload);
|
||||||
|
// foreach (var recv in command.Receivers)
|
||||||
|
// {
|
||||||
|
// // TODO: ต้องเปลี่ยนเป็น Email จริงนะ ตอนนี้ Hardcode อยู่
|
||||||
|
// // Send noti inbox and email
|
||||||
|
// var subject = $"คุณได้รับคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}";
|
||||||
|
// var body = $"คุณได้รับคำสั่งยุติเรื่อง เลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}";
|
||||||
|
// _emailSenderService.SendMail(subject, body, "dev@frappet.com");
|
||||||
|
|
||||||
|
|
||||||
|
// var inbox = new Inbox
|
||||||
|
// {
|
||||||
|
// Subject = $"คุณได้รับคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||||
|
// Body = $"คุณได้รับคำสั่งยุติเรื่อง เลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||||
|
// ReceiverUserId = recv.RefPlacementProfileId.Value,
|
||||||
|
// Payload = payload_str,
|
||||||
|
// };
|
||||||
|
// _dbContext.Set<Inbox>().Add(inbox);
|
||||||
|
|
||||||
|
// var noti = new Notification
|
||||||
|
// {
|
||||||
|
// Body = $"คุณได้รับคำสั่งยุติเรื่อง เลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||||
|
// ReceiverUserId = recv.RefPlacementProfileId.Value,
|
||||||
|
// Type = "LINK",
|
||||||
|
// Payload = payload_str,
|
||||||
|
// };
|
||||||
|
// _dbContext.Set<Notification>().Add(noti);
|
||||||
|
// await _dbContext.SaveChangesAsync();
|
||||||
|
// }
|
||||||
|
// send cc noti inbox
|
||||||
|
foreach (var cc in command.Deployments)
|
||||||
|
{
|
||||||
|
if (cc.IsSendInbox)
|
||||||
|
{
|
||||||
|
var inbox = new Inbox
|
||||||
|
{
|
||||||
|
Subject = $"คุณได้รับสำเนาคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||||
|
Body = $"คำสั่งยุติเรื่อง คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||||
|
ReceiverUserId = Guid.Parse(cc.ReceiveUserId),
|
||||||
|
Payload = payload_str,
|
||||||
|
};
|
||||||
|
_dbContext.Set<Inbox>().Add(inbox);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cc.IsSendMail)
|
||||||
|
{
|
||||||
|
// TODO: ต้องเปลี่ยนเป็น Email จริงนะ ตอนนี้ Hardcode อยู่
|
||||||
|
// Send noti inbox and email
|
||||||
|
var subject = $"คุณได้รับสำเนาคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}";
|
||||||
|
var body = $"คำสั่งยุติเรื่อง คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}";
|
||||||
|
_emailSenderService.SendMail(subject, body, "dev@frappet.com");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var noti = new Notification
|
||||||
|
{
|
||||||
|
Body = $"คำสั่งยุติเรื่อง คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||||
|
ReceiverUserId = Guid.Parse(cc.ReceiveUserId),
|
||||||
|
Type = "LINK",
|
||||||
|
Payload = payload_str,
|
||||||
|
};
|
||||||
|
_dbContext.Set<Notification>().Add(noti);
|
||||||
|
}
|
||||||
|
|
||||||
|
// change command status
|
||||||
|
var cmdStatus = await _dbContext.Set<CommandStatus>().FirstOrDefaultAsync(x => x.Sequence == 5);
|
||||||
|
command.CommandStatusId = cmdStatus!.Id;
|
||||||
|
|
||||||
|
await _dbContext.SaveChangesAsync();
|
||||||
|
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region " Regenerate Json File "
|
#region " Regenerate Json File "
|
||||||
|
|
@ -8681,7 +8853,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var command = await _dbContext.Set<Command>().Include(c => c.CommandStatus).FirstOrDefaultAsync(x => x.Id == id);
|
var command = await _dbContext.Set<Command>().Include(c => c.CommandType).Include(c => c.CommandStatus).FirstOrDefaultAsync(x => x.Id == id);
|
||||||
if (command == null)
|
if (command == null)
|
||||||
throw new Exception(GlobalMessages.CommandNotFound);
|
throw new Exception(GlobalMessages.CommandNotFound);
|
||||||
|
|
||||||
|
|
@ -8689,7 +8861,13 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
|
|
||||||
if (!notProcess.Contains(command.CommandStatus.Sequence))
|
if (!notProcess.Contains(command.CommandStatus.Sequence))
|
||||||
{
|
{
|
||||||
var nextStatus = await _dbContext.Set<CommandStatus>().FirstOrDefaultAsync(c => c.Sequence == command.CommandStatus.Sequence + 1);
|
var num = command.CommandStatus.Sequence + 1;
|
||||||
|
if (command.CommandType.CommandCode == "C-PM-38" && command.CommandStatus.Sequence == 1)
|
||||||
|
{
|
||||||
|
num = num + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
var nextStatus = await _dbContext.Set<CommandStatus>().FirstOrDefaultAsync(c => c.Sequence == num);
|
||||||
command.CommandStatus = nextStatus!;
|
command.CommandStatus = nextStatus!;
|
||||||
_dbContext.Attatch(nextStatus!);
|
_dbContext.Attatch(nextStatus!);
|
||||||
await _dbContext.SaveChangesAsync();
|
await _dbContext.SaveChangesAsync();
|
||||||
|
|
@ -9151,6 +9329,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
var orgIdSend = new List<Guid>() { Guid.Parse("08dc4c9f-ca39-44dd-8f93-04024aedccbe"), Guid.Parse("08dc4c9f-b4e7-47ae-8cb9-87b615151ada"), Guid.Parse("08dc4c9f-9da6-443e-8a72-30b8be40d954"), Guid.Parse("08dc4c9f-8487-4966-8ca6-11ba71d91971"), Guid.Parse("08dc4c9f-6e7e-4c75-8996-a48295978eca"), Guid.Parse("08dc4c9f-4166-4146-8460-f8af7cc8a4f1"), Guid.Parse("08dc4c9f-2710-4e98-8340-c9f2a65467db"), Guid.Parse("08dc4c9f-0ef3-4e51-805f-74766c67c1df"), Guid.Parse("08dc4c9e-f8be-4dae-89ed-30d662a29eed"), Guid.Parse("08dc4c9e-dd93-4072-8f37-482e7b91da28"), Guid.Parse("08dc4c9e-30c6-4674-8a35-4275eb70038f"), Guid.Parse("08dc4c9e-060b-4ae1-8068-bcf59b1d4642"), Guid.Parse("08dc4c9d-e7a2-4a26-84b8-655fac120ceb"), Guid.Parse("08dc4c9d-d0fe-4393-8948-d1ef0dece9e3"), Guid.Parse("08dc4c9d-b930-4be9-8428-82f802f28d99"), Guid.Parse("08dc4c9d-a10d-49ea-8484-a9646be5f6da"), Guid.Parse("08dc4c9d-8937-4432-865f-ffd3992feb25"), Guid.Parse("08dc4c9d-72f7-4f8a-8916-4b1791ca24c8"), Guid.Parse("08dc4c9d-5993-46b9-8ae8-96c4edbc163d"), Guid.Parse("08dc4c9d-291b-4761-8013-81027aac3b3d"), Guid.Parse("08dc4c9d-147d-4117-83fa-5211ca38f639"), Guid.Parse("08dc4c9b-277f-4b4e-8a60-08581ec7a2cc"), Guid.Parse("08dc4c9b-1148-4b92-8589-a94f4870102e"), Guid.Parse("08dc4c9a-f6d7-4ca3-80b0-0609375e1c76"), Guid.Parse("08dc4c9a-c587-4754-87ad-430a0e10b072"), Guid.Parse("08dc4c9a-9d74-4436-8709-33bd7aa5d5f7"), Guid.Parse("08dc4c9a-65c9-4306-80bf-f279e011f2a8"), Guid.Parse("08dc4c9a-2588-4766-8f6e-5051eb3423f5"), Guid.Parse("08dc4c99-d3f1-4640-8307-ddaaa6c3a541"), Guid.Parse("08dc4c99-bc91-41e9-87fd-9c29def6618d"), Guid.Parse("08dc4c99-9c44-4e4a-876c-59688334acd5"), Guid.Parse("08dc4c99-8170-4a65-8e20-c08845d3ea86"), Guid.Parse("08dc4c99-31b4-4027-8509-b322a173d7d3"), Guid.Parse("08dc4c99-12ca-46d7-813c-c35acc6ec7ae"), Guid.Parse("08dc4c98-f71d-472e-89a7-c9a6cb731650"), Guid.Parse("08dc4c98-dc64-4a8f-846d-342f05a49d02"), Guid.Parse("08dc4c98-c01c-47cf-83c9-7974df162e55"), Guid.Parse("08dc4c98-a219-4402-8624-00a9ad3a65cb"), Guid.Parse("08dc4c98-8739-401f-8180-65a982ee4237"), Guid.Parse("08dc4966-b6ac-4b49-85d4-2e5319d9b009"), Guid.Parse("08dc432c-2bc5-4b81-8089-9c057c51192c"), Guid.Parse("08dc4307-0adc-4bcd-8213-5479bb010236"), Guid.Parse("08dc4271-7bf5-4600-839c-6c93a35d33a6"), Guid.Parse("08dc4261-8aa8-4a85-8991-fb2ac9bcb132"), Guid.Parse("08dc3f36-8af2-4fd4-83bf-6f25126eec13"), Guid.Parse("08dc3f1a-ed56-469f-8b1e-c4fe6b30442a"), Guid.Parse("08dc3e6c-4b50-4b2e-8584-a3a0462c1b29"), Guid.Parse("08dc3e51-df19-47d9-8dd4-063fe6011eb3"), Guid.Parse("08dc3db9-257d-470d-8256-3dc24f6fa332"), Guid.Parse("08dc7bcd-7248-42ba-8f0e-d50b2f7faed7") };
|
||||||
var profiles = await _dbContext.Set<Profile>()
|
var profiles = await _dbContext.Set<Profile>()
|
||||||
.Include(x => x.Prefix)
|
.Include(x => x.Prefix)
|
||||||
.Include(x => x.Gender)
|
.Include(x => x.Gender)
|
||||||
|
|
@ -9175,6 +9354,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
// .Include(x => x.Assessments)
|
// .Include(x => x.Assessments)
|
||||||
// .Include(x => x.Others)
|
// .Include(x => x.Others)
|
||||||
// .Take(10)
|
// .Take(10)
|
||||||
|
.Where(x => orgIdSend.Contains(x.Id))
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
|
|
||||||
var _baseAPI = _configuration["API"];
|
var _baseAPI = _configuration["API"];
|
||||||
|
|
@ -9182,7 +9362,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
// create new profile
|
// create new profile
|
||||||
foreach (var profile in profiles)
|
foreach (var profile in profiles)
|
||||||
{
|
{
|
||||||
// var apiUrl = $"{_baseAPI}/org/profile/all/dump-db";
|
var apiUrl = $"{_baseAPI}/org/profile/all/dump-db";
|
||||||
// var profileId = string.Empty;
|
// var profileId = string.Empty;
|
||||||
// using (var client = new HttpClient())
|
// using (var client = new HttpClient())
|
||||||
// {
|
// {
|
||||||
|
|
@ -9508,38 +9688,38 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
var Salaries = await _dbContext.Set<ProfileSalary>()
|
// var Salaries = await _dbContext.Set<ProfileSalary>()
|
||||||
.Where(x => x.Profile.Id == profile.Id)
|
// .Where(x => x.Profile.Id == profile.Id)
|
||||||
.ToListAsync();
|
// .ToListAsync();
|
||||||
if (Salaries.Count > 0)
|
// if (Salaries.Count > 0)
|
||||||
{
|
// {
|
||||||
var apiUrlSalary = $"{_baseAPI}/org/profile/salary";
|
// var apiUrlSalary = $"{_baseAPI}/org/profile/salary";
|
||||||
using (var client = new HttpClient())
|
// using (var client = new HttpClient())
|
||||||
{
|
// {
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
// client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
foreach (var salary in Salaries)
|
// foreach (var salary in Salaries)
|
||||||
{
|
// {
|
||||||
var _res = await client.PostAsJsonAsync(apiUrlSalary, new
|
// var _res = await client.PostAsJsonAsync(apiUrlSalary, new
|
||||||
{
|
// {
|
||||||
profileId = profile.Id,
|
// profileId = profile.Id,
|
||||||
date = salary.Date,
|
// date = salary.Date,
|
||||||
amount = salary.Amount,
|
// amount = salary.Amount,
|
||||||
positionSalaryAmount = salary.PositionSalaryAmount,
|
// positionSalaryAmount = salary.PositionSalaryAmount,
|
||||||
mouthSalaryAmount = salary.MouthSalaryAmount,
|
// mouthSalaryAmount = salary.MouthSalaryAmount,
|
||||||
posNo = salary.PosNoName,
|
// posNo = salary.PosNoName,
|
||||||
position = salary.PositionName,
|
// position = salary.PositionName,
|
||||||
positionLine = salary.PositionLineName,
|
// positionLine = salary.PositionLineName,
|
||||||
positionPathSide = salary.PositionPathSideName,
|
// positionPathSide = salary.PositionPathSideName,
|
||||||
positionExecutive = salary.PositionExecutiveName,
|
// positionExecutive = salary.PositionExecutiveName,
|
||||||
positionType = salary.PositionTypeName,
|
// positionType = salary.PositionTypeName,
|
||||||
positionLevel = salary.PositionLevelName,
|
// positionLevel = salary.PositionLevelName,
|
||||||
refCommandNo = salary.RefCommandNo,
|
// refCommandNo = salary.RefCommandNo,
|
||||||
templateDoc = salary.SalaryRef,
|
// templateDoc = salary.SalaryRef,
|
||||||
});
|
// });
|
||||||
var _result = await _res.Content.ReadAsStringAsync();
|
// var _result = await _res.Content.ReadAsStringAsync();
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
// if (profile.Nopaids.Count > 0)
|
// if (profile.Nopaids.Count > 0)
|
||||||
// {
|
// {
|
||||||
|
|
@ -9616,7 +9796,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
|
|
||||||
// var Insignias = await _dbContext.Set<ProfileInsignia>()
|
// var Insignias = await _dbContext.Set<ProfileInsignia>()
|
||||||
// .Include(x => x.Insignia)
|
// .Include(x => x.Insignia)
|
||||||
// .Where(x => x.Profile.Id == profile.Id)
|
// .Where(x => orgIdSend.Contains(x.ProfileId))
|
||||||
// .ToListAsync();
|
// .ToListAsync();
|
||||||
// if (Insignias.Count > 0)
|
// if (Insignias.Count > 0)
|
||||||
// {
|
// {
|
||||||
|
|
@ -9648,7 +9828,10 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// if (profile.Honors.Count > 0)
|
// var Honor = await _dbContext.Set<ProfileHonor>()
|
||||||
|
// .Where(x => orgIdSend.Contains(x.ProfileId))
|
||||||
|
// .ToListAsync();
|
||||||
|
// if (Honor.Count > 0)
|
||||||
// {
|
// {
|
||||||
// var apiUrlHonor = $"{_baseAPI}/org/profile/honor";
|
// var apiUrlHonor = $"{_baseAPI}/org/profile/honor";
|
||||||
// using (var client = new HttpClient())
|
// using (var client = new HttpClient())
|
||||||
|
|
|
||||||
|
|
@ -470,6 +470,18 @@ namespace BMA.EHR.Command.Service.Controllers
|
||||||
else
|
else
|
||||||
return Success(new { result = "N" });
|
return Success(new { result = "N" });
|
||||||
}
|
}
|
||||||
|
case "C-PM-38":
|
||||||
|
{
|
||||||
|
if (command.CommandNo != "" &&
|
||||||
|
command.CommandYear != null &&
|
||||||
|
command.CommandExcecuteDate != null &&
|
||||||
|
cover != null)
|
||||||
|
{
|
||||||
|
return Success(new { result = "Y" });
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return Success(new { result = "N" });
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
if (command.CommandNo != "" &&
|
if (command.CommandNo != "" &&
|
||||||
|
|
@ -4488,6 +4500,111 @@ namespace BMA.EHR.Command.Service.Controllers
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region " C-PM-38 "
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// PM7-22 : สร้างข้อมูลรายละเอียดการออกคำสั่ง C-PM-38
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||||
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
|
[HttpPost("c-pm-38/detail")]
|
||||||
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||||
|
public async Task<ActionResult<ResponseObject>> PostType38Async([FromBody] CreateCommandGroup15Request req)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue);
|
||||||
|
|
||||||
|
var inserted = new Domain.Models.Commands.Core.Command
|
||||||
|
{
|
||||||
|
CommandNo = req.orderNo,
|
||||||
|
CommandYear = req.orderYear.ToString(),
|
||||||
|
CommandSubject = req.orderTitle,
|
||||||
|
CommandTypeId = req.orderTypeValue,
|
||||||
|
IssuerOrganizationId = req.orderBy,
|
||||||
|
IssuerOrganizationName = req.orderByOrganizationName,
|
||||||
|
AuthorizedUserFullName = req.signatoryBy,
|
||||||
|
AuthorizedPosition = req.signatoryPosition,
|
||||||
|
CommandAffectDate = req.orderDate,
|
||||||
|
OwnerGovId = OcId,
|
||||||
|
|
||||||
|
CaseFault = req.caseFault,
|
||||||
|
FaultLevel = req.faultLevel,
|
||||||
|
RefRaw = req.refRaw,
|
||||||
|
Result = req.result,
|
||||||
|
SalaryPeriodId = req.salaryPeriodId,
|
||||||
|
SalaryPeriod = req.salaryPeriod,
|
||||||
|
Year = req.year,
|
||||||
|
};
|
||||||
|
|
||||||
|
var result = await _repository.AddAsync(inserted);
|
||||||
|
|
||||||
|
return Success(result);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// PM7-23 : แก้ไขข้อมูลรายละเอียดการออกคำสั่ง C-PM-38
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="orderId">Record Id ของคำสั่ง</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||||
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
|
[HttpPut("c-pm-38/detail/{orderId}")]
|
||||||
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||||
|
public async Task<ActionResult<ResponseObject>> PutType38Async(Guid orderId, [FromBody] CreateCommandGroup15Request req)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var order = await _repository.GetByIdAsync(orderId);
|
||||||
|
if (order == null)
|
||||||
|
throw new Exception(GlobalMessages.CommandNotFound);
|
||||||
|
|
||||||
|
|
||||||
|
var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue);
|
||||||
|
var status = await _commandStatusRepository.GetByIdAsync(order.CommandStatusId);
|
||||||
|
|
||||||
|
order.CommandNo = req.orderNo;
|
||||||
|
order.CommandYear = req.orderYear.ToString();
|
||||||
|
order.CommandSubject = req.orderTitle;
|
||||||
|
order.CommandType = commandType!;
|
||||||
|
order.IssuerOrganizationId = req.orderBy;
|
||||||
|
order.IssuerOrganizationName = req.orderByOrganizationName;
|
||||||
|
order.AuthorizedUserFullName = req.signatoryBy;
|
||||||
|
order.AuthorizedPosition = req.signatoryPosition;
|
||||||
|
order.CommandStatus = status!;
|
||||||
|
order.CommandAffectDate = req.orderDate;
|
||||||
|
order.CaseFault = req.caseFault;
|
||||||
|
order.FaultLevel = req.faultLevel;
|
||||||
|
order.RefRaw = req.refRaw;
|
||||||
|
order.Result = req.result;
|
||||||
|
order.SalaryPeriodId = req.salaryPeriodId;
|
||||||
|
order.SalaryPeriod = req.salaryPeriod;
|
||||||
|
order.Year = req.year;
|
||||||
|
|
||||||
|
var result = await _repository.UpdateAsync(order);
|
||||||
|
|
||||||
|
return Success(result);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,8 @@
|
||||||
public int orderYear { get; set; }
|
public int orderYear { get; set; }
|
||||||
public string signatoryBy { get; set; } = string.Empty;
|
public string signatoryBy { get; set; } = string.Empty;
|
||||||
public string signatoryPosition { get; set; } = string.Empty;
|
public string signatoryPosition { get; set; } = string.Empty;
|
||||||
public Guid salaryPeriodId { get; set; }
|
public Guid? salaryPeriodId { get; set; }
|
||||||
public string year { get; set; }
|
public string? year { get; set; }
|
||||||
public string salaryPeriod { get; set; }
|
public string? salaryPeriod { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
"AllowedHosts": "*",
|
"AllowedHosts": "*",
|
||||||
"ConnectionStrings": {
|
"ConnectionStrings": {
|
||||||
//"DefaultConnection": "User Id=sys;Password=P@ssw0rd;DBA Privilege=SYSDBA;Data Source=localhost:1521/ORCLCDB",
|
//"DefaultConnection": "User Id=sys;Password=P@ssw0rd;DBA Privilege=SYSDBA;Data Source=localhost:1521/ORCLCDB",
|
||||||
"DefaultConnection": "server=192.168.1.61;user=root;password=adminVM123;port=4061;database=bma_ehr;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
|
"DefaultConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
|
||||||
},
|
},
|
||||||
"Jwt": {
|
"Jwt": {
|
||||||
"Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI",
|
"Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI",
|
||||||
|
|
@ -42,5 +42,5 @@
|
||||||
"MailFrom": "saraban.csc.rd@bangkok.go.th",
|
"MailFrom": "saraban.csc.rd@bangkok.go.th",
|
||||||
"Port": "25"
|
"Port": "25"
|
||||||
},
|
},
|
||||||
"API": "https://bma-ehr.frappet.com/api/v1"
|
"API": "https://bma-ehr.frappet.synology.me/api/v1"
|
||||||
}
|
}
|
||||||
|
|
@ -1035,7 +1035,8 @@ namespace BMA.EHR.Report.Service.Controllers
|
||||||
CommandExcecuteDate = raw_data.CommandExcecuteDate != null ? raw_data.CommandExcecuteDate.Value.ToThaiFullDate3().ToThaiNumber() : "-",
|
CommandExcecuteDate = raw_data.CommandExcecuteDate != null ? raw_data.CommandExcecuteDate.Value.ToThaiFullDate3().ToThaiNumber() : "-",
|
||||||
};
|
};
|
||||||
var data = await _commandReportRepository.GetCommandType08AttachmentAsync(commandId);
|
var data = await _commandReportRepository.GetCommandType08AttachmentAsync(commandId);
|
||||||
return new {
|
return new
|
||||||
|
{
|
||||||
CommandNo = command.CommandNo,
|
CommandNo = command.CommandNo,
|
||||||
CommandYear = command.CommandYear,
|
CommandYear = command.CommandYear,
|
||||||
IssuerOrganizationName = command.IssuerOrganizationName,
|
IssuerOrganizationName = command.IssuerOrganizationName,
|
||||||
|
|
@ -5432,6 +5433,53 @@ namespace BMA.EHR.Report.Service.Controllers
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region " C-PM-38 คำสั่งปรับโครงสร้าง "
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// คำสั่ง C-PM-38 คำสั่งปรับโครงสร้าง
|
||||||
|
/// </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-38/cover/{exportType}/{id}")]
|
||||||
|
[AllowAnonymous]
|
||||||
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||||
|
public async Task<ActionResult<ResponseObject>> GetCommandType38CoverReport(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 GenerateCommandReportType33_Cover(id, exportType);
|
||||||
|
var data = new
|
||||||
|
{
|
||||||
|
template = "C-PM-38",
|
||||||
|
reportName = "docx-report",
|
||||||
|
data = contentData
|
||||||
|
};
|
||||||
|
return Success(data);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue