no message

This commit is contained in:
Kittapath 2024-06-07 03:06:11 +07:00
parent 94980d9157
commit d47df139ed
9 changed files with 532 additions and 195 deletions

View file

@ -2588,22 +2588,22 @@ namespace BMA.EHR.Application.Repositories.Commands
await ExecuteCommand12Async(command);
break;
case "C-PM-13":
await ExecuteCommand13Async(command);
await ExecuteCommand13Async(command, token);
break;
case "C-PM-14":
await ExecuteCommand14Async(command);
await ExecuteCommand14Async(command, token);
break;
case "C-PM-15":
await ExecuteCommand15Async(command);
await ExecuteCommand15Async(command, token);
break;
case "C-PM-16":
await ExecuteCommand16Async(command);
await ExecuteCommand16Async(command, token);
break;
case "C-PM-17":
await ExecuteCommand17Async(command);
await ExecuteCommand17Async(command, token);
break;
case "C-PM-18":
await ExecuteCommand18Async(command);
await ExecuteCommand18Async(command, token);
break;
case "C-PM-19":
await ExecuteCommand19Async(command, token);
@ -3785,7 +3785,7 @@ namespace BMA.EHR.Application.Repositories.Commands
/// </summary>
/// <param name="command">object ของรายการคำสั่ง</param>
/// <returns></returns>
private async Task ExecuteCommand05Async(Command command)
private async Task ExecuteCommand05Async(Command command, string token = "")
{
try
{
@ -3842,6 +3842,31 @@ namespace BMA.EHR.Application.Repositories.Commands
if (placementProfile == null)
throw new Exception(GlobalMessages.DataNotFound);
var baseAPI = _configuration["API"];
var apiUrlSalary = $"{baseAPI}/org/profile/salary";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlSalary);
var _res = await client.PostAsJsonAsync(apiUrlSalary, new
{
profileId = placementProfile.profileId,
date = command.CommandAffectDate,
amount = placementProfile.Amount,
positionSalaryAmount = 0,
mouthSalaryAmount = 0,
posNo = placementProfile.posMasterNo,
position = placementProfile.position,
positionLine = "",
positionPathSide = "",
positionExecutive = "",
positionType = placementProfile.posTypeName,
positionLevel = placementProfile.posLevelName,
refCommandNo = command.CommandNo,
templateDoc = "คำสั่งแต่งตั้ง คำสั่ง" + command.IssuerOrganizationName + "ที่ " + $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate!.Value.ToThaiFullDate3()}",
});
var _result = await _res.Content.ReadAsStringAsync();
}
// var profile = placementProfile.Profile;
// if (profile != null)
// {
@ -4041,7 +4066,7 @@ namespace BMA.EHR.Application.Repositories.Commands
/// </summary>
/// <param name="command">object ของรายการคำสั่ง</param>
/// <returns></returns>
private async Task ExecuteCommand06Async(Command command)
private async Task ExecuteCommand06Async(Command command, string token = "")
{
try
{
@ -4098,6 +4123,31 @@ namespace BMA.EHR.Application.Repositories.Commands
if (placementProfile == null)
throw new Exception(GlobalMessages.DataNotFound);
var baseAPI = _configuration["API"];
var apiUrlSalary = $"{baseAPI}/org/profile/salary";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlSalary);
var _res = await client.PostAsJsonAsync(apiUrlSalary, new
{
profileId = placementProfile.profileId,
date = command.CommandAffectDate,
amount = placementProfile.Amount,
positionSalaryAmount = 0,
mouthSalaryAmount = 0,
posNo = placementProfile.posMasterNo,
position = placementProfile.position,
positionLine = "",
positionPathSide = "",
positionExecutive = "",
positionType = placementProfile.posTypeName,
positionLevel = placementProfile.posLevelName,
refCommandNo = command.CommandNo,
templateDoc = "คำสั่งเลื่อน คำสั่ง" + command.IssuerOrganizationName + "ที่ " + $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate!.Value.ToThaiFullDate3()}",
});
var _result = await _res.Content.ReadAsStringAsync();
}
// var profile = placementProfile.Profile;
// if (profile != null)
// {
@ -4297,7 +4347,7 @@ namespace BMA.EHR.Application.Repositories.Commands
/// </summary>
/// <param name="command">object ของรายการคำสั่ง</param>
/// <returns></returns>
private async Task ExecuteCommand07Async(Command command)
private async Task ExecuteCommand07Async(Command command, string token = "")
{
try
{
@ -4354,6 +4404,31 @@ namespace BMA.EHR.Application.Repositories.Commands
if (placementProfile == null)
throw new Exception(GlobalMessages.DataNotFound);
var baseAPI = _configuration["API"];
var apiUrlSalary = $"{baseAPI}/org/profile/salary";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlSalary);
var _res = await client.PostAsJsonAsync(apiUrlSalary, new
{
profileId = placementProfile.profileId,
date = command.CommandAffectDate,
amount = placementProfile.Amount,
positionSalaryAmount = 0,
mouthSalaryAmount = 0,
posNo = placementProfile.posMasterNo,
position = placementProfile.position,
positionLine = "",
positionPathSide = "",
positionExecutive = "",
positionType = placementProfile.posTypeName,
positionLevel = placementProfile.posLevelName,
refCommandNo = command.CommandNo,
templateDoc = "คำสั่งย้าย คำสั่ง" + command.IssuerOrganizationName + "ที่ " + $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate!.Value.ToThaiFullDate3()}",
});
var _result = await _res.Content.ReadAsStringAsync();
}
// var profile = placementProfile.Profile;
// if (profile != null)
// {
@ -4553,7 +4628,7 @@ namespace BMA.EHR.Application.Repositories.Commands
/// </summary>
/// <param name="command">object ของรายการคำสั่ง</param>
/// <returns></returns>
private async Task ExecuteCommand08Async(Command command)
private async Task ExecuteCommand08Async(Command command, string token = "")
{
try
{
@ -4623,6 +4698,31 @@ namespace BMA.EHR.Application.Repositories.Commands
if (placementProfile == null)
throw new Exception(GlobalMessages.DataNotFound);
var baseAPI = _configuration["API"];
var apiUrlSalary = $"{baseAPI}/org/profile/salary";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlSalary);
var _res = await client.PostAsJsonAsync(apiUrlSalary, new
{
profileId = placementProfile.profileId,
date = command.CommandAffectDate,
amount = placementProfile.Amount,
positionSalaryAmount = 0,
mouthSalaryAmount = 0,
posNo = placementProfile.posMasterNoOld,
position = placementProfile.PositionOld,
positionLine = "",
positionPathSide = "",
positionExecutive = "",
positionType = placementProfile.posTypeNameOld,
positionLevel = placementProfile.posLevelNameOld,
refCommandNo = command.CommandNo,
templateDoc = "คำสั่งบรรจุและแต่งตั้งข้าราชการฯ กลับเข้ารับราชการ คำสั่ง" + command.IssuerOrganizationName + "ที่ " + $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate!.Value.ToThaiFullDate3()}",
});
var _result = await _res.Content.ReadAsStringAsync();
}
// var profile = placementProfile.Profile;
// if (profile != null)
// {
@ -4808,7 +4908,7 @@ namespace BMA.EHR.Application.Repositories.Commands
/// </summary>
/// <param name="command">object ของรายการคำสั่ง</param>
/// <returns></returns>
private async Task ExecuteCommand09Async(Command command)
private async Task ExecuteCommand09Async(Command command, string token = "")
{
try
{
@ -4878,6 +4978,31 @@ namespace BMA.EHR.Application.Repositories.Commands
if (placementProfile == null)
throw new Exception(GlobalMessages.DataNotFound);
var baseAPI = _configuration["API"];
var apiUrlSalary = $"{baseAPI}/org/profile/salary";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlSalary);
var _res = await client.PostAsJsonAsync(apiUrlSalary, new
{
profileId = placementProfile.profileId,
date = command.CommandAffectDate,
amount = placementProfile.Amount,
positionSalaryAmount = 0,
mouthSalaryAmount = 0,
posNo = placementProfile.posMasterNoOld,
position = placementProfile.PositionOld,
positionLine = "",
positionPathSide = "",
positionExecutive = "",
positionType = placementProfile.posTypeNameOld,
positionLevel = placementProfile.posLevelNameOld,
refCommandNo = command.CommandNo,
templateDoc = "คำสั่งบรรจุและแต่งตั้งผู้ออกไปรับราชการทหารกลับเข้ารับราชการ คำสั่ง" + command.IssuerOrganizationName + "ที่ " + $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate!.Value.ToThaiFullDate3()}",
});
var _result = await _res.Content.ReadAsStringAsync();
}
// var profile = placementProfile.Profile;
// if (profile != null)
// {
@ -5608,7 +5733,7 @@ namespace BMA.EHR.Application.Repositories.Commands
/// </summary>
/// <param name="command">object ของรายการคำสั่ง</param>
/// <returns></returns>
private async Task ExecuteCommand13Async(Command command)
private async Task ExecuteCommand13Async(Command command, string token = "")
{
try
{
@ -5636,74 +5761,45 @@ namespace BMA.EHR.Application.Repositories.Commands
if (data == null)
throw new Exception(GlobalMessages.DataNotFound);
//data.Profile.IsActive = false;
//data.Profile.IsLeave = true;
//data.Profile.LeaveReason = "คำสั่งให้โอนข้าราชการกรุงเทพมหานครสามัญ";
//data.Profile.LeaveDate = command.CommandAffectDate;
var baseAPI = _configuration["API"];
var apiUrl = $"{baseAPI}/org/profile/leave/{data.profileId}";
//var lastSarary = data.Profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault();
//var order = 1;
//if (lastSarary != null && lastSarary.Order != null)
//order = lastSarary.Order.Value + 1;
// var salary = new ProfileSalary
// {
// Order = order,
// Date = command.CommandAffectDate,
// Amount = lastSarary == null ? null : lastSarary.Amount,
// PositionSalaryAmount = lastSarary == null ? null : lastSarary.PositionSalaryAmount,
// MouthSalaryAmount = lastSarary == null ? null : lastSarary.MouthSalaryAmount,
// SalaryClass = "",
// SalaryRef = "คำสั่งให้โอนข้าราชการกรุงเทพมหานครสามัญ คำสั่ง" + command.IssuerOrganizationName + "ที่ " + $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate!.Value.ToThaiFullDate3()}",
// OcId = lastSarary == null ? null : lastSarary.OcId,
// PositionId = lastSarary == null ? null : lastSarary.PositionId,
// PositionLevel = lastSarary == null ? null : lastSarary.PositionLevel,
// PositionLineId = lastSarary == null ? null : lastSarary.PositionLineId,
// PositionTypeId = lastSarary == null ? null : lastSarary.PositionTypeId,
// OrganizationShortNameId = lastSarary == null ? null : lastSarary.OrganizationShortNameId,
// PosNoId = lastSarary == null ? null : lastSarary.PosNoId,
// CommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}",
// RefCommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}",
// CommandTypeName = command.CommandType.Name,
// PositionEmployeeGroupId = null,
// PositionEmployeeLevelId = null,
// PositionEmployeePositionId = null,
// PositionEmployeePositionSideId = null,
// PosNoEmployee = "",
// //PositionPathSideId = lastSarary == null ? null : lastSarary.PositionPathSideId == null,
// PositionExecutiveId = lastSarary == null ? null : lastSarary.PositionExecutiveId,
// //PositionExecutiveSideId = lastSarary == null ? null : lastSarary.PositionExecutiveSideId,
// IsActive = true,
// CreatedAt = DateTime.Now,
// CreatedFullName = FullName ?? "System Administrator",
// CreatedUserId = UserId ?? "",
// LastUpdatedAt = DateTime.Now,
// LastUpdateFullName = FullName ?? "System Administrator",
// LastUpdateUserId = UserId ?? "",
// };
// if (lastSarary != null && lastSarary.PositionPathSideId != null) salary.PositionPathSideId = lastSarary.PositionPathSideId;
// if (lastSarary != null && lastSarary.PositionExecutiveSideId != null) salary.PositionExecutiveSideId = lastSarary.PositionExecutiveSideId;
// data.Profile.Salaries.Add(salary);
// // remove profile position
// var profilePosition = await _dbContext.Set<ProfilePosition>()
// .Include(x => x.Profile)
// .Include(x => x.OrganizationPosition)
// .FirstOrDefaultAsync(x => x.Profile!.Id == data.Id);
// if (profilePosition != null)
// _dbContext.Set<ProfilePosition>().Remove(profilePosition);
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
var _res = await client.PostAsJsonAsync(apiUrl, new
{
isLeave = true,
leaveReason = "คำสั่งให้โอนข้าราชการกรุงเทพมหานครสามัญ",
leaveDate = command.CommandAffectDate,
});
var _result = await _res.Content.ReadAsStringAsync();
}
var apiUrlSalary = $"{baseAPI}/org/profile/salary";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlSalary);
var _res = await client.PostAsJsonAsync(apiUrlSalary, new
{
profileId = data.profileId,
date = command.CommandAffectDate,
amount = data.AmountOld,
positionSalaryAmount = 0,
mouthSalaryAmount = 0,
posNo = data.PositionNumberOld,
position = data.PositionOld,
positionLine = "",
positionPathSide = "",
positionExecutive = "",
positionType = data.PositionLevelOld,
positionLevel = data.PositionLevelOld,
refCommandNo = command.CommandNo,
templateDoc = "คำสั่งให้โอนข้าราชการกรุงเทพมหานครสามัญ คำสั่ง" + command.IssuerOrganizationName + "ที่ " + $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate!.Value.ToThaiFullDate3()}",
});
var _result = await _res.Content.ReadAsStringAsync();
}
// // update placementstatus
data.Status = "DONE";
@ -5793,7 +5889,7 @@ namespace BMA.EHR.Application.Repositories.Commands
/// </summary>
/// <param name="command">object ของรายการคำสั่ง</param>
/// <returns></returns>
private async Task ExecuteCommand14Async(Command command)
private async Task ExecuteCommand14Async(Command command, string token = "")
{
try
{
@ -5870,6 +5966,32 @@ namespace BMA.EHR.Application.Repositories.Commands
if (placementProfile == null)
throw new Exception("Invalid placement profile: " + recv.RefPlacementProfileId);
var baseAPI = _configuration["API"];
var apiUrlSalary = $"{baseAPI}/org/profile/salary";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlSalary);
var _res = await client.PostAsJsonAsync(apiUrlSalary, new
{
profileId = placementProfile.profileId,
date = command.CommandAffectDate,
amount = placementProfile.Amount,
positionSalaryAmount = 0,
mouthSalaryAmount = 0,
posNo = placementProfile.posMasterNo,
position = placementProfile.position,
positionLine = "",
positionPathSide = "",
positionExecutive = "",
positionType = placementProfile.posTypeName,
positionLevel = placementProfile.posLevelName,
refCommandNo = command.CommandNo,
templateDoc = "รับโอนข้าราชการกรุงเทพมหานครสามัญ คำสั่ง" + command.IssuerOrganizationName + "ที่ " + $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate!.Value.ToThaiFullDate3()}",
});
var _result = await _res.Content.ReadAsStringAsync();
}
// // ใส่ฟีลจากข้อมูล
// var profile = new Profile
// {
@ -6143,7 +6265,7 @@ namespace BMA.EHR.Application.Repositories.Commands
/// </summary>
/// <param name="command">object ของรายการคำสั่ง</param>
/// <returns></returns>
private async Task ExecuteCommand15Async(Command command)
private async Task ExecuteCommand15Async(Command command, string token = "")
{
try
{
@ -6174,15 +6296,31 @@ namespace BMA.EHR.Application.Repositories.Commands
if (data == null)
throw new Exception(GlobalMessages.DataNotFound);
//data.Profile.IsActive = false;
//data.Profile.IsLeave = true;
//data.Profile.LeaveReason = "ลาออกจากราชการ";
//data.Profile.LeaveDate = command.CommandAffectDate;
//var lastSarary = data.Profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault();
// var order = 1;
// if (lastSarary != null && lastSarary.Order != null)
// order = lastSarary.Order.Value + 1;
var baseAPI = _configuration["API"];
var apiUrlSalary = $"{baseAPI}/org/profile/salary";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlSalary);
var _res = await client.PostAsJsonAsync(apiUrlSalary, new
{
profileId = data.profileId,
date = command.CommandAffectDate,
amount = data.AmountOld,
positionSalaryAmount = 0,
mouthSalaryAmount = 0,
posNo = data.PositionNumberOld,
position = data.PositionOld,
positionLine = "",
positionPathSide = "",
positionExecutive = "",
positionType = data.PositionLevelOld,
positionLevel = data.PositionLevelOld,
refCommandNo = command.CommandNo,
templateDoc = "คำสั่งให้ช่วยราชการ คำสั่ง" + command.IssuerOrganizationName + "ที่ " + $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate!.Value.ToThaiFullDate3()}",
});
var _result = await _res.Content.ReadAsStringAsync();
}
// var salary = new ProfileSalary
// {
@ -6323,7 +6461,7 @@ namespace BMA.EHR.Application.Repositories.Commands
/// </summary>
/// <param name="command">object ของรายการคำสั่ง</param>
/// <returns></returns>
private async Task ExecuteCommand16Async(Command command)
private async Task ExecuteCommand16Async(Command command, string token = "")
{
try
{
@ -6354,66 +6492,31 @@ namespace BMA.EHR.Application.Repositories.Commands
if (data == null)
throw new Exception(GlobalMessages.DataNotFound);
//data.Profile.IsActive = false;
//data.Profile.IsLeave = true;
//data.Profile.LeaveReason = "ลาออกจากราชการ";
//data.Profile.LeaveDate = command.CommandAffectDate;
// var lastSarary = data.Profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault();
// var order = 1;
// if (lastSarary != null && lastSarary.Order != null)
// order = lastSarary.Order.Value + 1;
// var salary = new ProfileSalary
// {
// Order = order,
// Date = command.CommandAffectDate,
// Amount = lastSarary == null ? null : lastSarary.Amount,
// PositionSalaryAmount = lastSarary == null ? null : lastSarary.PositionSalaryAmount,
// MouthSalaryAmount = lastSarary == null ? null : lastSarary.MouthSalaryAmount,
// SalaryClass = "",
// SalaryRef = "คำสั่งส่งตัวกลับ คำสั่ง" + command.IssuerOrganizationName + "ที่ " + $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate!.Value.ToThaiFullDate3()}",
// OcId = lastSarary == null ? null : lastSarary.OcId,
// PositionId = lastSarary == null ? null : lastSarary.PositionId,
// PositionLevel = lastSarary == null ? null : lastSarary.PositionLevel,
// PositionLineId = lastSarary == null ? null : lastSarary.PositionLineId,
// PositionTypeId = lastSarary == null ? null : lastSarary.PositionTypeId,
// OrganizationShortNameId = lastSarary == null ? null : lastSarary.OrganizationShortNameId,
// PosNoId = lastSarary == null ? null : lastSarary.PosNoId,
// CommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}",
// RefCommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}",
// CommandTypeName = command.CommandType.Name,
// PositionEmployeeGroupId = null,
// PositionEmployeeLevelId = null,
// PositionEmployeePositionId = null,
// PositionEmployeePositionSideId = null,
// PosNoEmployee = "",
// //PositionPathSideId = lastSarary == null ? null : lastSarary.PositionPathSideId == null,
// PositionExecutiveId = lastSarary == null ? null : lastSarary.PositionExecutiveId,
// //PositionExecutiveSideId = lastSarary == null ? null : lastSarary.PositionExecutiveSideId,
// IsActive = true,
// CreatedAt = DateTime.Now,
// CreatedFullName = FullName ?? "System Administrator",
// CreatedUserId = UserId ?? "",
// LastUpdatedAt = DateTime.Now,
// LastUpdateFullName = FullName ?? "System Administrator",
// LastUpdateUserId = UserId ?? "",
// };
// if (lastSarary != null && lastSarary.PositionPathSideId != null) salary.PositionPathSideId = lastSarary.PositionPathSideId;
// if (lastSarary != null && lastSarary.PositionExecutiveSideId != null) salary.PositionExecutiveSideId = lastSarary.PositionExecutiveSideId;
// data.Profile.Salaries.Add(salary);
var baseAPI = _configuration["API"];
var apiUrlSalary = $"{baseAPI}/org/profile/salary";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlSalary);
var _res = await client.PostAsJsonAsync(apiUrlSalary, new
{
profileId = data.profileId,
date = command.CommandAffectDate,
amount = data.AmountOld,
positionSalaryAmount = 0,
mouthSalaryAmount = 0,
posNo = data.PositionNumberOld,
position = data.PositionOld,
positionLine = "",
positionPathSide = "",
positionExecutive = "",
positionType = data.PositionLevelOld,
positionLevel = data.PositionLevelOld,
refCommandNo = command.CommandNo,
templateDoc = "คำสั่งส่งตัวกลับ คำสั่ง" + command.IssuerOrganizationName + "ที่ " + $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate!.Value.ToThaiFullDate3()}",
});
var _result = await _res.Content.ReadAsStringAsync();
}
// update placementstatus
data.Status = "DONE";
@ -6503,7 +6606,7 @@ namespace BMA.EHR.Application.Repositories.Commands
/// </summary>
/// <param name="command">object ของรายการคำสั่ง</param>
/// <returns></returns>
private async Task ExecuteCommand17Async(Command command)
private async Task ExecuteCommand17Async(Command command, string token = "")
{
try
{
@ -6535,11 +6638,50 @@ namespace BMA.EHR.Application.Repositories.Commands
if (data == null)
throw new Exception(GlobalMessages.DataNotFound);
// data.Profile.IsActive = false;
// data.Profile.IsLeave = true;
// data.Profile.LeaveReason = "ลาออกจากราชการ";
// data.Profile.LeaveDate = command.CommandAffectDate;
//// data.Profile.IsActive = false;
//// data.Profile.IsLeave = true;
//// data.Profile.LeaveReason = "ลาออกจากราชการ";
//// data.Profile.LeaveDate = command.CommandAffectDate;
var baseAPI = _configuration["API"];
var apiUrl = $"{baseAPI}/org/profile/leave/{data.profileId}";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
var _res = await client.PostAsJsonAsync(apiUrl, new
{
isLeave = true,
leaveReason = "ลาออกจากราชการ",
leaveDate = command.CommandAffectDate,
});
var _result = await _res.Content.ReadAsStringAsync();
}
var apiUrlSalary = $"{baseAPI}/org/profile/salary";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlSalary);
var _res = await client.PostAsJsonAsync(apiUrlSalary, new
{
profileId = data.profileId,
date = command.CommandAffectDate,
amount = data.AmountOld,
positionSalaryAmount = 0,
mouthSalaryAmount = 0,
posNo = data.PositionNumberOld,
position = data.PositionOld,
positionLine = "",
positionPathSide = "",
positionExecutive = "",
positionType = data.PositionTypeOld,
positionLevel = data.PositionLevelOld,
refCommandNo = command.CommandNo,
templateDoc = "คำสั่งอนุญาตให้ข้าราชการลาออกจากราชการ คำสั่ง" + command.IssuerOrganizationName + "ที่ " + $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate!.Value.ToThaiFullDate3()}",
});
var _result = await _res.Content.ReadAsStringAsync();
}
// var lastSarary = data.Profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault();
// var order = 1;
// if (lastSarary != null && lastSarary.Order != null)
@ -6692,7 +6834,7 @@ namespace BMA.EHR.Application.Repositories.Commands
/// </summary>
/// <param name="command">object ของรายการคำสั่ง</param>
/// <returns></returns>
private async Task ExecuteCommand18Async(Command command)
private async Task ExecuteCommand18Async(Command command, string token = "")
{
try
{
@ -6723,11 +6865,50 @@ namespace BMA.EHR.Application.Repositories.Commands
if (data == null)
throw new Exception(GlobalMessages.DataNotFound);
// data.Profile.IsActive = false;
// data.Profile.IsLeave = true;
// data.Profile.LeaveReason = "ได้รับโทษทางวินัย ให้ออกจากราชการ";
// data.Profile.LeaveDate = command.CommandAffectDate;
//// data.Profile.IsActive = false;
//// data.Profile.IsLeave = true;
//// data.Profile.LeaveReason = "ได้รับโทษทางวินัย ให้ออกจากราชการ";
//// data.Profile.LeaveDate = command.CommandAffectDate;
var baseAPI = _configuration["API"];
var apiUrl = $"{baseAPI}/org/profile/leave/{data.profileId}";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
var _res = await client.PostAsJsonAsync(apiUrl, new
{
isLeave = true,
leaveReason = "ได้รับโทษทางวินัย ให้ออกจากราชการ",
leaveDate = command.CommandAffectDate,
});
var _result = await _res.Content.ReadAsStringAsync();
}
var apiUrlSalary = $"{baseAPI}/org/profile/salary";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlSalary);
var _res = await client.PostAsJsonAsync(apiUrlSalary, new
{
profileId = data.profileId,
date = command.CommandAffectDate,
amount = data.AmountOld,
positionSalaryAmount = 0,
mouthSalaryAmount = 0,
posNo = data.PositionNumberOld,
position = data.PositionOld,
positionLine = "",
positionPathSide = "",
positionExecutive = "",
positionType = data.PositionTypeOld,
positionLevel = data.PositionLevelOld,
refCommandNo = command.CommandNo,
templateDoc = "คำสั่งให้ออกจากราชการ คำสั่ง" + command.IssuerOrganizationName + "ที่ " + $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate!.Value.ToThaiFullDate3()}",
});
var _result = await _res.Content.ReadAsStringAsync();
}
// var lastSarary = data.Profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault();
// var order = 1;
// if (lastSarary != null && lastSarary.Order != null)
@ -7471,7 +7652,7 @@ namespace BMA.EHR.Application.Repositories.Commands
/// </summary>
/// <param name="command">object ของรายการคำสั่ง</param>
/// <returns></returns>
private async Task ExecuteCommand22Async(Command command)
private async Task ExecuteCommand22Async(Command command, string token = "")
{
try
{
@ -7522,6 +7703,28 @@ namespace BMA.EHR.Application.Repositories.Commands
if (data == null)
throw new Exception(GlobalMessages.DataNotFound);
var baseAPI = _configuration["API"];
var apiUrlSalary = $"{baseAPI}/org/profile-employee/salary";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlSalary);
var _res = await client.PostAsJsonAsync(apiUrlSalary, new
{
profileEmployeeId = data.profileId,
date = command.CommandAffectDate,
amount = data.Amount,
positionSalaryAmount = 0,
mouthSalaryAmount = 0,
posNo = data.posMasterNo,
position = data.position,
positionType = data.posTypeName,
positionLevel = data.posLevelName,
refCommandNo = command.CommandNo,
templateDoc = "คำสั่งแต่งตั้งลูกจ้างประจำ(ปรับระดับชั้นงาน) คำสั่ง" + command.IssuerOrganizationName + "ที่ " + $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate!.Value.ToThaiFullDate3()}",
});
var _result = await _res.Content.ReadAsStringAsync();
}
// // data.Profile.PositionEmployeeLine = data.PositionEmployeeLine;
// // data.Profile.PositionEmployeePosition = data.PositionEmployeePosition;
// data.Profile.PositionEmployeePosition = data.OrgEmployee == null ? null : data.OrgEmployee!.PositionEmployeePosition;
@ -7666,7 +7869,7 @@ namespace BMA.EHR.Application.Repositories.Commands
/// </summary>
/// <param name="command">object ของรายการคำสั่ง</param>
/// <returns></returns>
private async Task ExecuteCommand23Async(Command command)
private async Task ExecuteCommand23Async(Command command, string token = "")
{
try
{
@ -7698,10 +7901,25 @@ namespace BMA.EHR.Application.Repositories.Commands
if (data == null)
throw new Exception(GlobalMessages.DataNotFound);
// data.Profile.IsActive = false;
// data.Profile.IsLeave = true;
// data.Profile.LeaveReason = "ลาออกจากราชการ";
// data.Profile.LeaveDate = command.CommandAffectDate;
//// data.Profile.IsActive = false;
//// data.Profile.IsLeave = true;
//// data.Profile.LeaveReason = "ลาออกจากราชการ";
//// data.Profile.LeaveDate = command.CommandAffectDate;
var baseAPI = _configuration["API"];
var apiUrl = $"{baseAPI}/org/profile-employee/salary/{data.profileId}";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
var _req = new HttpRequestMessage(HttpMethod.Put, apiUrl);
var _res = await client.PostAsJsonAsync(apiUrl, new
{
isLeave = true,
leaveReason = "ลาออกจากราชการ",
leaveDate = command.CommandAffectDate,
});
var _result = await _res.Content.ReadAsStringAsync();
}
// var lastSarary = data.Profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault();
// var order = 1;
@ -7846,7 +8064,7 @@ namespace BMA.EHR.Application.Repositories.Commands
/// </summary>
/// <param name="command">object ของรายการคำสั่ง</param>
/// <returns></returns>
private async Task ExecuteCommand24Async(Command command)
private async Task ExecuteCommand24Async(Command command, string token = "")
{
try
{
@ -7897,6 +8115,28 @@ namespace BMA.EHR.Application.Repositories.Commands
if (data == null)
throw new Exception(GlobalMessages.DataNotFound);
var baseAPI = _configuration["API"];
var apiUrlSalary = $"{baseAPI}/org/profile-employee/salary";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlSalary);
var _res = await client.PostAsJsonAsync(apiUrlSalary, new
{
profileEmployeeId = data.profileId,
date = command.CommandAffectDate,
amount = data.Amount,
positionSalaryAmount = 0,
mouthSalaryAmount = 0,
posNo = data.posMasterNo,
position = data.position,
positionType = data.posTypeName,
positionLevel = data.posLevelName,
refCommandNo = command.CommandNo,
templateDoc = "คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย) คำสั่ง" + command.IssuerOrganizationName + "ที่ " + $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate!.Value.ToThaiFullDate3()}",
});
var _result = await _res.Content.ReadAsStringAsync();
}
// // data.Profile.PositionEmployeeLine = data.PositionEmployeeLine;
// // data.Profile.PositionEmployeePosition = data.PositionEmployeePosition;
// data.Profile.PositionEmployeePosition = data.OrgEmployee == null ? null : data.OrgEmployee!.PositionEmployeePosition;

View file

@ -241,6 +241,7 @@ namespace BMA.EHR.Application.Repositories.Reports
// p.Profile.PositionExecutiveId,
// Organization = p.Profile.Oc,
// OrganizationId = p.Profile.OcId,
p.position,
p.Number,
p.Date,
p.Location,
@ -282,6 +283,7 @@ namespace BMA.EHR.Application.Repositories.Reports
data.Number,
data.Location,
data.Reason,
Position = data.position,
};
}
#endregion

View file

@ -6,19 +6,55 @@
public Guid id { get; set; }
public string reason { get; set; }
public string remove { get; set; }
public Guid profileId { get; set; }
public string? citizenId { get; set; }
// public Guid profileId { get; set; }
// public string? citizenId { get; set; }
// public string? prefix { get; set; }
// public string? fullName { get; set; }
// public string? organizationOrganization { get; set; }
// public string? oc { get; set; }
// public string? position { get; set; }
// public string? positionType { get; set; }
// public string? positionExecutive { get; set; }
// public string? posNo { get; set; }
// public string? positionEmployeePosition { get; set; }
// public string? positionEmployeeLevel { get; set; }
// public string? positionEmployeeGroup { get; set; }
// public string? posNoEmployee { get; set; }
// public string? organizationAgency { get; set; }
// public string? organizationGovernmentAgency { get; set; }
public string? profileId { get; set; }
public string? prefix { get; set; }
public string? fullName { get; set; }
public string? organizationOrganization { get; set; }
public string? oc { get; set; }
public string? firstName { get; set; }
public string? lastName { get; set; }
public string? citizenId { get; set; }
public string? root { get; set; }
public string? rootId { get; set; }
public string? rootShortName { get; set; }
public string? child1 { get; set; }
public string? child1Id { get; set; }
public string? child1ShortName { get; set; }
public string? child2 { get; set; }
public string? child2Id { get; set; }
public string? child2ShortName { get; set; }
public string? child3 { get; set; }
public string? child3Id { get; set; }
public string? child3ShortName { get; set; }
public string? child4 { get; set; }
public string? child4Id { get; set; }
public string? child4ShortName { get; set; }
// public string? node { get; set; }
// public string? nodeId { get; set; }
// public string? nodeShortName { get; set; }
public int? posMasterNo { get; set; }
public string? position { get; set; }
public string? positionType { get; set; }
public string? positionExecutive { get; set; }
public string? posTypeId { get; set; }
public string? posTypeName { get; set; }
public int? posTypeRank { get; set; }
public string? posLevelId { get; set; }
public string? posLevelName { get; set; }
public int? posLevelRank { get; set; }
public string? posExecutiveId { get; set; }
public string? posExecutiveName { get; set; }
public string? posNo { get; set; }
public string? positionEmployeePosition { get; set; }
public string? positionEmployeeLevel { get; set; }
public string? positionEmployeeGroup { get; set; }
public string? posNoEmployee { get; set; }
}
}

View file

@ -1065,6 +1065,31 @@ namespace BMA.EHR.Placement.Service.Controllers
.FirstOrDefaultAsync(x => x.Id == personalId);
if (profile == null)
return Error(GlobalMessages.DataNotFound, 404);
profile.root = null;
profile.rootId = null;
profile.rootShortName = null;
profile.child1 = null;
profile.child1Id = null;
profile.child1ShortName = null;
profile.child2 = null;
profile.child2Id = null;
profile.child2ShortName = null;
profile.child3 = null;
profile.child3Id = null;
profile.child3ShortName = null;
profile.child4 = null;
profile.child4Id = null;
profile.child4ShortName = null;
profile.orgRevisionId = null;
profile.posMasterNo = null;
profile.positionName = null;
profile.positionField = null;
profile.posTypeId = null;
profile.posTypeName = null;
profile.posLevelId = null;
profile.posLevelName = null;
profile.OrganizationPosition = null;
profile.PositionNumber = null;
profile.PositionPath = null;
@ -1087,6 +1112,20 @@ namespace BMA.EHR.Placement.Service.Controllers
return Success();
}
[HttpPut("date/update/{personalId:length(36)}")]
public async Task<ActionResult<ResponseObject>> UpdateDateDraft([FromBody] PersonDateRequest req, Guid personalId)
{
var profile = await _context.PlacementProfiles
.FirstOrDefaultAsync(x => x.Id == personalId);
if (profile == null)
return Error(GlobalMessages.DataNotFound, 404);
profile.ReportingDate = req.Date;
_context.SaveChanges();
return Success();
}
[HttpGet("user/{personalId:length(36)}")]
public async Task<ActionResult<ResponseObject>> GetUserByOrganization(Guid personalId)
{

View file

@ -0,0 +1,11 @@
using BMA.EHR.Domain.Models.MetaData;
using Microsoft.EntityFrameworkCore;
namespace BMA.EHR.Placement.Service.Requests
{
public class PersonDateRequest
{
public DateTime? Date { get; set; }
}
}

View file

@ -108,7 +108,7 @@ namespace BMA.EHR.Report.Service.Controllers
var tmpOc1 = string.Empty;
foreach (var profile in retire.GetType().GetProperty("profile").GetValue(retire))
{
var tmpOc2 = profile.GetType().GetProperty("oc").GetValue(profile);
var tmpOc2 = profile.GetType().GetProperty("root").GetValue(profile);
if (tmpOc1 != tmpOc2)
{
_count = 1;
@ -125,23 +125,31 @@ namespace BMA.EHR.Report.Service.Controllers
count = $"{_count.ToString().ToThaiNumber()}.",
no = $"{(_profileList.Count() + 1).ToString().ToThaiNumber()}.",
order = thaiOrder,
oc = string.IsNullOrEmpty(profile.GetType().GetProperty("oc").GetValue(profile)) ? string.Empty : profile.GetType().GetProperty("oc").GetValue(profile),
fullName = string.IsNullOrEmpty(profile.GetType().GetProperty("fullName").GetValue(profile)) ? string.Empty : profile.GetType().GetProperty("fullName").GetValue(profile),
position = string.IsNullOrEmpty(profile.GetType().GetProperty("position").GetValue(profile)) ? string.Empty : profile.GetType().GetProperty("position").GetValue(profile),
posNo = string.IsNullOrEmpty(profile.GetType().GetProperty("posNo").GetValue(profile)) ? string.Empty : profile.GetType().GetProperty("posNo").GetValue(profile),
organizationOrganization = string.IsNullOrEmpty(profile.GetType().GetProperty("organizationOrganization").GetValue(profile)) ? string.Empty : profile.GetType().GetProperty("organizationOrganization").GetValue(profile),
positionEmployeePosition = string.IsNullOrEmpty(profile.GetType().GetProperty("positionEmployeePosition").GetValue(profile)) ? string.Empty : profile.GetType().GetProperty("positionEmployeePosition").GetValue(profile),
posNoEmployee = string.IsNullOrEmpty(profile.GetType().GetProperty("posNoEmployee").GetValue(profile)) ? string.Empty : profile.GetType().GetProperty("posNoEmployee").GetValue(profile),
reason = string.IsNullOrEmpty(profile.GetType().GetProperty("reason").GetValue(profile)) ? string.Empty : profile.GetType().GetProperty("reason").GetValue(profile),
organizationOrganization = (profile.GetType().GetProperty("child4").GetValue(profile) == null ? "" : profile.GetType().GetProperty("child4").GetValue(profile) + "/") +
(profile.GetType().GetProperty("child3").GetValue(profile) == null ? "" : profile.GetType().GetProperty("child3").GetValue(profile) + "/") +
(profile.GetType().GetProperty("child2").GetValue(profile) == null ? "" : profile.GetType().GetProperty("child2").GetValue(profile) + "/") +
(profile.GetType().GetProperty("child1").GetValue(profile) == null ? "" : profile.GetType().GetProperty("child1").GetValue(profile) + "/") +
(profile.GetType().GetProperty("root").GetValue(profile) == null ? "" : profile.GetType().GetProperty("root").GetValue(profile)),
fullName = $"{profile.GetType().GetProperty("prefix").GetValue(profile)}{profile.GetType().GetProperty("firstName").GetValue(profile)} {profile.GetType().GetProperty("lastName").GetValue(profile)}",
position = profile.GetType().GetProperty("position").GetValue(profile),
posNo = profile.GetType().GetProperty("posMasterNo").GetValue(profile),
oc = profile.GetType().GetProperty("root").GetValue(profile),
positionEmployeePosition = profile.GetType().GetProperty("position").GetValue(profile),
posNoEmployee = profile.GetType().GetProperty("posMasterNo").GetValue(profile),
reason = profile.GetType().GetProperty("reason").GetValue(profile),
});
}
//Binding Data
if (report.ReportParameters["Type"].Value == "1")
{
report.ReportParameters["Year"].Value = string.IsNullOrEmpty(retire.GetType().GetProperty("Year").GetValue(retire)) ? string.Empty : retire.GetType().GetProperty("Year").GetValue(retire);
report.ReportParameters["Total"].Value = string.IsNullOrEmpty(retire.GetType().GetProperty("Total").GetValue(retire)) ? string.Empty : retire.GetType().GetProperty("Total").GetValue(retire);
report.ReportParameters["Detail"].Value = string.IsNullOrEmpty(retire.GetType().GetProperty("Detail").GetValue(retire)) ? string.Empty : retire.GetType().GetProperty("Detail").GetValue(retire);
report.DataSource = _profileList;
// report.ReportParameters["Year"].Value = retire.GetType().GetProperty("year").GetValue(retire);
// report.ReportParameters["Total"].Value = retire.GetType().GetProperty("total").GetValue(retire);
// report.ReportParameters["Detail"].Value = retire.GetType().GetProperty("detail").GetValue(retire);
// report.DataSource = _profileList;
report.DataSource = retire;
var tblProfile = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["table1"];
tblProfile.DataSource = _profileList;
}
else
{
@ -149,6 +157,7 @@ namespace BMA.EHR.Report.Service.Controllers
var tblProfile = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["table1"];
tblProfile.DataSource = _profileList;
}
// return Success(retire);
System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
InstanceReportSource instanceReportSource = new InstanceReportSource()
{

View file

@ -14,12 +14,12 @@
"AllowedHosts": "*",
"ConnectionStrings": {
//"DefaultConnection": "User Id=sys;Password=P@ssw0rd;DBA Privilege=SYSDBA;Data Source=localhost:1521/ORCLCDB",
"DefaultConnection": "server=192.168.1.9;user=root;password=adminVM123;port=3306;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
"ExamConnection": "server=192.168.1.9;user=root;password=adminVM123;port=3306;database=bma_ehr_exam_demo;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;",
"ExamConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=bma_ehr_exam_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
},
"Jwt": {
"Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI",
"Issuer": "https://identity.frappet.com/realms/bma-ehr"
"Issuer": "https://id.frappet.synology.me/realms/bma-ehr"
},
"EPPlus": {
"ExcelPackage": {