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