ออกคำสั่ง 22 24
This commit is contained in:
parent
cbabad68a9
commit
cc711146c5
9 changed files with 634 additions and 42 deletions
|
|
@ -1089,7 +1089,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<List<CommandType21Response>> GetCommandType22AttachmentAsync(Guid id)
|
public async Task<List<CommandType22Response>> GetCommandType22AttachmentAsync(Guid id)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
@ -1124,19 +1124,21 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
.ThenInclude(x => x.PositionEmployeeLevel)
|
.ThenInclude(x => x.PositionEmployeeLevel)
|
||||||
on r.RefPlacementProfileId equals p.Id
|
on r.RefPlacementProfileId equals p.Id
|
||||||
orderby r.Sequence
|
orderby r.Sequence
|
||||||
select new CommandType21Response
|
select new CommandType22Response
|
||||||
{
|
{
|
||||||
Seq = r.Sequence.ToString().ToThaiNumber(),
|
Seq = r.Sequence.ToString().ToThaiNumber(),
|
||||||
CitizenId = r.CitizenId.ToThaiNumber(),
|
|
||||||
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
|
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
|
||||||
Organization = p.OrgEmployee == null || p.OrgEmployee!.OrganizationAgency == null || p.OrgEmployee!.OrganizationAgency!.OrganizationOrganization == null ? "" : p.OrgEmployee!.OrganizationAgency!.OrganizationOrganization!.Name,
|
Organization = p.OrganizationPositionOld,
|
||||||
PositionName = p.OrgEmployee.PositionEmployeePosition == null ? "" : p.OrgEmployee.PositionEmployeePosition.Name.ToThaiNumber(),
|
OldPositionName = p.OrganizationPositionOld,
|
||||||
PositionLevel = p.OrgEmployee.OrganizationPositionEmployeeLevels == null ? "" : p.OrgEmployee.OrganizationPositionEmployeeLevels.First().PositionEmployeeLevel.Name.ToThaiNumber(),
|
OldPositionLevel = p.PositionLevelOld,
|
||||||
PositionType = p.Profile.PositionType == null ? "" : p.Profile.PositionType.Name.ToThaiNumber(),
|
OldPositionNumber = p.PositionNumberOld == null ? null : p.PositionNumberOld.ToThaiNumber(),
|
||||||
PositionNumber = p.OrgEmployee.PosNo == null ? "" : p.OrgEmployee.PosNo.ToThaiNumber(),
|
OldSalary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
||||||
Salary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
// NewOc = p.OrganizationPosition == null || p.OrganizationPosition!.Organization == null ? "" : _organizationCommonRepository.GetOrganizationNameFullPath(p.OrganizationPosition!.Organization!.Id, false, false, "/"),
|
||||||
RetireDate = p.Profile.BirthDate.CalculateRetireDate().ToThaiFullDate3().ToThaiNumber(),
|
NewPositionName = p.OrgEmployee == null || p.OrgEmployee.PositionEmployeePosition == null ? "" : p.OrgEmployee.PositionEmployeePosition.Name,
|
||||||
CommandYear = r.Command.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber()
|
NewPositionLevel = p.OrgEmployee == null || p.OrgEmployee.OrganizationPositionEmployeeLevels == null || p.OrgEmployee.OrganizationPositionEmployeeLevels.Count() == 0 ? "" : p.OrgEmployee.OrganizationPositionEmployeeLevels.FirstOrDefault().PositionEmployeeLevel.Name,
|
||||||
|
NewPositionNumber = p.OrgEmployee == null || p.OrgEmployee.PosNo == null ? "" : p.OrgEmployee.PosNo.ToThaiNumber(),
|
||||||
|
NewSalary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
||||||
|
Reason = p.Reason == null ? "-" : p.Reason,
|
||||||
})
|
})
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
|
|
@ -1196,7 +1198,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
|
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
|
||||||
Organization = p.OrganizationPositionOld ?? "",
|
Organization = p.OrganizationPositionOld ?? "",
|
||||||
PositionName = p.Profile.PositionEmployeePosition == null ? "" : p.Profile.PositionEmployeePosition.Name.ToThaiNumber(),
|
PositionName = p.Profile.PositionEmployeePosition == null ? "" : p.Profile.PositionEmployeePosition.Name.ToThaiNumber(),
|
||||||
PositionLevel = p.PositionLevelOld == null ? "" :p.PositionLevelOld.ToThaiNumber(),
|
PositionLevel = p.PositionLevelOld == null ? "" : p.PositionLevelOld.ToThaiNumber(),
|
||||||
PositionType = p.PositionTypeOld == null ? "" : p.PositionTypeOld.ToThaiNumber(),
|
PositionType = p.PositionTypeOld == null ? "" : p.PositionTypeOld.ToThaiNumber(),
|
||||||
PositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld.ToThaiNumber(),
|
PositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld.ToThaiNumber(),
|
||||||
Salary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
Salary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
||||||
|
|
@ -1214,6 +1216,67 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<List<CommandType22Response>> GetCommandType24AttachmentAsync(Guid id)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var raw_data = await _dbContext.Set<CommandReceiver>()
|
||||||
|
.Include(c => c.Command)
|
||||||
|
.Where(c => c.Command.Id == id)
|
||||||
|
.ToListAsync();
|
||||||
|
if (raw_data == null)
|
||||||
|
{
|
||||||
|
throw new Exception(GlobalMessages.CommandNotFound);
|
||||||
|
}
|
||||||
|
|
||||||
|
var report_data = (from r in raw_data
|
||||||
|
join p in _dbContext.Set<PlacementAppointment>()
|
||||||
|
.Include(x => x.Profile)
|
||||||
|
.ThenInclude(x => x.Position)
|
||||||
|
.Include(x => x.Profile)
|
||||||
|
.ThenInclude(x => x.PositionLevel)
|
||||||
|
.Include(x => x.Profile)
|
||||||
|
.ThenInclude(x => x.PositionType)
|
||||||
|
.Include(x => x.Profile)
|
||||||
|
.ThenInclude(x => x.PosNo)
|
||||||
|
.Include(x => x.OrgEmployee)
|
||||||
|
.ThenInclude(x => x.OrganizationAgency)
|
||||||
|
.ThenInclude(x => x.OrganizationOrganization)
|
||||||
|
//.Include(x => x.OrgEmployee)
|
||||||
|
//.ThenInclude(x => x.PosNo)
|
||||||
|
.Include(x => x.OrgEmployee)
|
||||||
|
.ThenInclude(x => x.PositionEmployeePosition)
|
||||||
|
.Include(x => x.OrgEmployee)
|
||||||
|
.ThenInclude(x => x.OrganizationPositionEmployeeLevels)
|
||||||
|
.ThenInclude(x => x.PositionEmployeeLevel)
|
||||||
|
on r.RefPlacementProfileId equals p.Id
|
||||||
|
orderby r.Sequence
|
||||||
|
select new CommandType22Response
|
||||||
|
{
|
||||||
|
Seq = r.Sequence.ToString().ToThaiNumber(),
|
||||||
|
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
|
||||||
|
Organization = p.OrganizationPositionOld,
|
||||||
|
OldPositionName = p.OrganizationPositionOld,
|
||||||
|
OldPositionLevel = p.PositionLevelOld,
|
||||||
|
OldPositionNumber = p.PositionNumberOld == null ? null : p.PositionNumberOld.ToThaiNumber(),
|
||||||
|
OldSalary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
||||||
|
// NewOc = p.OrganizationPosition == null || p.OrganizationPosition!.Organization == null ? "" : _organizationCommonRepository.GetOrganizationNameFullPath(p.OrganizationPosition!.Organization!.Id, false, false, "/"),
|
||||||
|
NewPositionName = p.OrgEmployee == null || p.OrgEmployee.PositionEmployeePosition == null ? "" : p.OrgEmployee.PositionEmployeePosition.Name,
|
||||||
|
NewPositionLevel = p.OrgEmployee == null || p.OrgEmployee.OrganizationPositionEmployeeLevels == null || p.OrgEmployee.OrganizationPositionEmployeeLevels.Count() == 0 ? "" : p.OrgEmployee.OrganizationPositionEmployeeLevels.FirstOrDefault().PositionEmployeeLevel.Name,
|
||||||
|
NewPositionNumber = p.OrgEmployee == null || p.OrgEmployee.PosNo == null ? "" : p.OrgEmployee.PosNo.ToThaiNumber(),
|
||||||
|
NewSalary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
||||||
|
Reason = p.Reason == null ? "-" : p.Reason,
|
||||||
|
})
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
return report_data;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1734,6 +1734,9 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
case "C-PM-23":
|
case "C-PM-23":
|
||||||
await ExecuteCommand23Async(command);
|
await ExecuteCommand23Async(command);
|
||||||
break;
|
break;
|
||||||
|
case "C-PM-24":
|
||||||
|
await ExecuteCommand24Async(command);
|
||||||
|
break;
|
||||||
default: throw new Exception(GlobalMessages.MethodForCommandTypeNotImplement);
|
default: throw new Exception(GlobalMessages.MethodForCommandTypeNotImplement);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -6378,7 +6381,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// C-PM-22 - คำสั่งจ้างและแต่งตั้งลูกจ้างประจำ
|
/// C-PM-22 - คำสั่งแต่งตั้งลูกจ้างประจำ(ปรับระดับชั้นงาน)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="command">object ของรายการคำสั่ง</param>
|
/// <param name="command">object ของรายการคำสั่ง</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
|
|
@ -6404,7 +6407,6 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
|
|
||||||
foreach (var recv in command.Receivers)
|
foreach (var recv in command.Receivers)
|
||||||
{
|
{
|
||||||
// TODO: รอมอสเข้ามา Query แล้วแก้ไขข้อมูลทะเบียนประวัติ
|
|
||||||
var data = await _dbContext.Set<PlacementAppointment>()
|
var data = await _dbContext.Set<PlacementAppointment>()
|
||||||
.Include(x => x.PositionEmployeeLine)
|
.Include(x => x.PositionEmployeeLine)
|
||||||
.Include(x => x.PositionEmployeePosition)
|
.Include(x => x.PositionEmployeePosition)
|
||||||
|
|
@ -6415,19 +6417,32 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
.ThenInclude(x => x.PositionEmployeeLine)
|
.ThenInclude(x => x.PositionEmployeeLine)
|
||||||
.Include(x => x.Profile)
|
.Include(x => x.Profile)
|
||||||
.ThenInclude(x => x.PositionEmployeePosition)
|
.ThenInclude(x => x.PositionEmployeePosition)
|
||||||
|
.Include(x => x.Profile)
|
||||||
|
.ThenInclude(x => x.PositionEmployeeLevel)
|
||||||
.Include(x => x.OrgEmployee)
|
.Include(x => x.OrgEmployee)
|
||||||
.ThenInclude(x => x.OrganizationShortName)
|
.ThenInclude(x => x.OrganizationShortName)
|
||||||
.Include(x => x.OrgEmployee)
|
.Include(x => x.OrgEmployee)
|
||||||
.ThenInclude(x => x.OrganizationOrganization)
|
.ThenInclude(x => x.OrganizationOrganization)
|
||||||
.Include(x => x.OrgEmployee)
|
.Include(x => x.OrgEmployee)
|
||||||
.ThenInclude(x => x.Organization)
|
.ThenInclude(x => x.Organization)
|
||||||
|
.Include(x => x.OrgEmployee)
|
||||||
|
.ThenInclude(x => x.PositionEmployeePosition)
|
||||||
|
.Include(x => x.OrgEmployee)
|
||||||
|
.ThenInclude(x => x.OrganizationPositionEmployeeLevels)
|
||||||
|
.ThenInclude(x => x.PositionEmployeeLevel)
|
||||||
|
.Include(x => x.OrgEmployee)
|
||||||
|
.ThenInclude(x => x.PositionEmployeeLine)
|
||||||
.FirstOrDefaultAsync(x => x.Id == recv.RefPlacementProfileId);
|
.FirstOrDefaultAsync(x => x.Id == recv.RefPlacementProfileId);
|
||||||
|
|
||||||
if (data == null)
|
if (data == null)
|
||||||
throw new Exception(GlobalMessages.DataNotFound);
|
throw new Exception(GlobalMessages.DataNotFound);
|
||||||
data.Profile.EmployeeClass = "perm"; // ลจ ประจำ
|
// data.Profile.PositionEmployeeLine = data.PositionEmployeeLine;
|
||||||
data.Profile.PositionEmployeeLine = data.PositionEmployeeLine;
|
// data.Profile.PositionEmployeePosition = data.PositionEmployeePosition;
|
||||||
data.Profile.PositionEmployeePosition = data.PositionEmployeePosition;
|
data.Profile.PositionEmployeePosition = data.OrgEmployee == null ? null : data.OrgEmployee!.PositionEmployeePosition;
|
||||||
|
// data.Profile.PositionEmployeePositionSide = data.OrgEmployee == null ? null : data.OrgEmployee!.po;
|
||||||
|
data.Profile.PositionEmployeeLevel = data.OrgEmployee == null || data.OrgEmployee.OrganizationPositionEmployeeLevels == null || data.OrgEmployee.OrganizationPositionEmployeeLevels.Count() == 0 ? null : data.OrgEmployee!.OrganizationPositionEmployeeLevels.FirstOrDefault().PositionEmployeeLevel;
|
||||||
|
// data.Profile.PositionEmployeeGroup = data.OrgEmployee == null ? null : data.OrgEmployee!.gr;
|
||||||
|
data.Profile.PositionEmployeeLine = data.OrgEmployee == null ? null : data.OrgEmployee!.PositionEmployeeLine;
|
||||||
data.Profile.OrganizationShortNameId = data.OrgEmployee == null || data.OrgEmployee!.OrganizationShortName == null ? null : data.OrgEmployee!.OrganizationShortName!.Id;
|
data.Profile.OrganizationShortNameId = data.OrgEmployee == null || data.OrgEmployee!.OrganizationShortName == null ? null : data.OrgEmployee!.OrganizationShortName!.Id;
|
||||||
data.Profile.OrganizationShortName = data.OrgEmployee == null || data.OrgEmployee!.OrganizationShortName == null ? null : data.OrgEmployee!.OrganizationShortName!.Name;
|
data.Profile.OrganizationShortName = data.OrgEmployee == null || data.OrgEmployee!.OrganizationShortName == null ? null : data.OrgEmployee!.OrganizationShortName!.Name;
|
||||||
data.Profile.OrganizationOrganizationId = data.OrgEmployee == null || data.OrgEmployee!.OrganizationOrganization == null ? null : data.OrgEmployee!.OrganizationOrganization!.Id;
|
data.Profile.OrganizationOrganizationId = data.OrgEmployee == null || data.OrgEmployee!.OrganizationOrganization == null ? null : data.OrgEmployee!.OrganizationOrganization!.Id;
|
||||||
|
|
@ -6449,7 +6464,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
PositionSalaryAmount = recv.PositionSalaryAmount,
|
PositionSalaryAmount = recv.PositionSalaryAmount,
|
||||||
MouthSalaryAmount = recv.MouthSalaryAmount,
|
MouthSalaryAmount = recv.MouthSalaryAmount,
|
||||||
SalaryClass = "",
|
SalaryClass = "",
|
||||||
SalaryRef = "คำสั่งจ้างและแต่งตั้งลูกจ้างประจำ คำสั่ง" + command.IssuerOrganizationName + "ที่ " + $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate!.Value.ToThaiFullDate3()}",
|
SalaryRef = "คำสั่งแต่งตั้งลูกจ้างประจำ(ปรับระดับชั้นงาน) คำสั่ง" + command.IssuerOrganizationName + "ที่ " + $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate!.Value.ToThaiFullDate3()}",
|
||||||
//OcId = lastSarary.OcId,
|
//OcId = lastSarary.OcId,
|
||||||
//PositionLevel = lastSarary.PositionLevel,
|
//PositionLevel = lastSarary.PositionLevel,
|
||||||
//PositionLineId = lastSarary.PositionLineId,
|
//PositionLineId = lastSarary.PositionLineId,
|
||||||
|
|
@ -6460,10 +6475,10 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
RefCommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}",
|
RefCommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}",
|
||||||
CommandTypeName = command.CommandType.Name,
|
CommandTypeName = command.CommandType.Name,
|
||||||
//PositionEmployeeGroupId = null,
|
//PositionEmployeeGroupId = null,
|
||||||
//PositionEmployeeLevelId = null,
|
PositionEmployeeLevelId = data.Profile.PositionEmployeeLevel == null ? null : data.Profile.PositionEmployeeLevel.Id,
|
||||||
//PositionEmployeePositionId = null,
|
PositionEmployeePositionId = data.Profile.PositionEmployeePosition == null ? null : data.Profile.PositionEmployeePosition.Id,
|
||||||
//PositionEmployeePositionSideId = null,
|
//PositionEmployeePositionSideId = null,
|
||||||
//PosNoEmployee = "",
|
PosNoEmployee = data.Profile.PosNoEmployee,
|
||||||
////PositionPathSideId = lastSarary.PositionPathSideId == null,
|
////PositionPathSideId = lastSarary.PositionPathSideId == null,
|
||||||
//PositionExecutiveId = lastSarary.PositionExecutiveId,
|
//PositionExecutiveId = lastSarary.PositionExecutiveId,
|
||||||
////PositionExecutiveSideId = lastSarary.PositionExecutiveSideId,
|
////PositionExecutiveSideId = lastSarary.PositionExecutiveSideId,
|
||||||
|
|
@ -6483,7 +6498,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
// TODO: ต้องเปลี่ยนเป็น Email จริงนะ ตอนนี้ Hardcode อยู่
|
// TODO: ต้องเปลี่ยนเป็น Email จริงนะ ตอนนี้ Hardcode อยู่
|
||||||
// Send noti inbox and email
|
// Send noti inbox and email
|
||||||
var subject = $"คุณได้รับคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}";
|
var subject = $"คุณได้รับคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}";
|
||||||
var body = $"คำสั่งจ้างและแต่งตั้งลูกจ้างประจำ เลขที่ {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");
|
_emailSenderService.SendMail(subject, body, "dev@frappet.com");
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -6520,7 +6535,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
var inbox = new Inbox
|
var inbox = new Inbox
|
||||||
{
|
{
|
||||||
Subject = $"คุณได้รับสำเนาคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
Subject = $"คุณได้รับสำเนาคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||||
Body = $"คำสั่งแต่งตั้งลูกจ้างชั่วคราวเป็นลูกจ้างประจำ คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
Body = $"คำสั่งแต่งตั้งลูกจ้างประจำ(ปรับระดับชั้นงาน) คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||||
ReceiverUserId = pf.Id,
|
ReceiverUserId = pf.Id,
|
||||||
Payload = payload_str,
|
Payload = payload_str,
|
||||||
};
|
};
|
||||||
|
|
@ -6532,14 +6547,14 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
// TODO: ต้องเปลี่ยนเป็น Email จริงนะ ตอนนี้ Hardcode อยู่
|
// TODO: ต้องเปลี่ยนเป็น Email จริงนะ ตอนนี้ Hardcode อยู่
|
||||||
// Send noti inbox and email
|
// Send noti inbox and email
|
||||||
var subject = $"คุณได้รับสำเนาคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}";
|
var subject = $"คุณได้รับสำเนาคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}";
|
||||||
var body = $"คำสั่งแต่งตั้งลูกจ้างชั่วคราวเป็นลูกจ้างประจำ คำสั่งเลขที่ {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");
|
_emailSenderService.SendMail(subject, body, "dev@frappet.com");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var noti = new Notification
|
var noti = new Notification
|
||||||
{
|
{
|
||||||
Body = $"คำสั่งแต่งตั้งลูกจ้างชั่วคราวเป็นลูกจ้างประจำ คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
Body = $"คำสั่งแต่งตั้งลูกจ้างประจำ(ปรับระดับชั้นงาน) คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||||
ReceiverUserId = pf.Id,
|
ReceiverUserId = pf.Id,
|
||||||
Type = "LINK",
|
Type = "LINK",
|
||||||
Payload = payload_str,
|
Payload = payload_str,
|
||||||
|
|
@ -6740,6 +6755,201 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// C-PM-24 - คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="command">object ของรายการคำสั่ง</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
private async Task ExecuteCommand24Async(Command command)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 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)
|
||||||
|
{
|
||||||
|
var data = await _dbContext.Set<PlacementAppointment>()
|
||||||
|
.Include(x => x.PositionEmployeeLine)
|
||||||
|
.Include(x => x.PositionEmployeePosition)
|
||||||
|
.Include(x => x.Profile)
|
||||||
|
.ThenInclude(x => x.Salaries)
|
||||||
|
.ThenInclude(x => x.PositionLevel)
|
||||||
|
.Include(x => x.Profile)
|
||||||
|
.ThenInclude(x => x.PositionEmployeeLine)
|
||||||
|
.Include(x => x.Profile)
|
||||||
|
.ThenInclude(x => x.PositionEmployeePosition)
|
||||||
|
.Include(x => x.Profile)
|
||||||
|
.ThenInclude(x => x.PositionEmployeeLevel)
|
||||||
|
.Include(x => x.OrgEmployee)
|
||||||
|
.ThenInclude(x => x.OrganizationShortName)
|
||||||
|
.Include(x => x.OrgEmployee)
|
||||||
|
.ThenInclude(x => x.OrganizationOrganization)
|
||||||
|
.Include(x => x.OrgEmployee)
|
||||||
|
.ThenInclude(x => x.Organization)
|
||||||
|
.Include(x => x.OrgEmployee)
|
||||||
|
.ThenInclude(x => x.PositionEmployeePosition)
|
||||||
|
.Include(x => x.OrgEmployee)
|
||||||
|
.ThenInclude(x => x.OrganizationPositionEmployeeLevels)
|
||||||
|
.ThenInclude(x => x.PositionEmployeeLevel)
|
||||||
|
.Include(x => x.OrgEmployee)
|
||||||
|
.ThenInclude(x => x.PositionEmployeeLine)
|
||||||
|
.FirstOrDefaultAsync(x => x.Id == recv.RefPlacementProfileId);
|
||||||
|
|
||||||
|
if (data == null)
|
||||||
|
throw new Exception(GlobalMessages.DataNotFound);
|
||||||
|
// data.Profile.PositionEmployeeLine = data.PositionEmployeeLine;
|
||||||
|
// data.Profile.PositionEmployeePosition = data.PositionEmployeePosition;
|
||||||
|
data.Profile.PositionEmployeePosition = data.OrgEmployee == null ? null : data.OrgEmployee!.PositionEmployeePosition;
|
||||||
|
// data.Profile.PositionEmployeePositionSide = data.OrgEmployee == null ? null : data.OrgEmployee!.po;
|
||||||
|
data.Profile.PositionEmployeeLevel = data.OrgEmployee == null || data.OrgEmployee.OrganizationPositionEmployeeLevels == null || data.OrgEmployee.OrganizationPositionEmployeeLevels.Count() == 0 ? null : data.OrgEmployee!.OrganizationPositionEmployeeLevels.FirstOrDefault().PositionEmployeeLevel;
|
||||||
|
// data.Profile.PositionEmployeeGroup = data.OrgEmployee == null ? null : data.OrgEmployee!.gr;
|
||||||
|
data.Profile.PositionEmployeeLine = data.OrgEmployee == null ? null : data.OrgEmployee!.PositionEmployeeLine;
|
||||||
|
data.Profile.OrganizationShortNameId = data.OrgEmployee == null || data.OrgEmployee!.OrganizationShortName == null ? null : data.OrgEmployee!.OrganizationShortName!.Id;
|
||||||
|
data.Profile.OrganizationShortName = data.OrgEmployee == null || data.OrgEmployee!.OrganizationShortName == null ? null : data.OrgEmployee!.OrganizationShortName!.Name;
|
||||||
|
data.Profile.OrganizationOrganizationId = data.OrgEmployee == null || data.OrgEmployee!.OrganizationOrganization == null ? null : data.OrgEmployee!.OrganizationOrganization!.Id;
|
||||||
|
data.Profile.OrganizationOrganization = data.OrgEmployee == null || data.OrgEmployee!.OrganizationOrganization == null ? null : data.OrgEmployee!.OrganizationOrganization!.Name;
|
||||||
|
data.Profile.PosNoEmployee = data.OrgEmployee == null ? null : data.OrgEmployee!.PosNo;
|
||||||
|
data.Profile.OcId = data.OrgEmployee == null || data.OrgEmployee!.Organization == null ? null : data.OrgEmployee!.Organization!.Id;
|
||||||
|
data.Profile.Oc = data.OrgEmployee == null || data.OrgEmployee!.Organization == null ? null : _organizationCommonRepository.GetOrganizationNameFullPath(data.OrgEmployee!.Organization!.Id, false, false, "/");
|
||||||
|
|
||||||
|
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 = recv.Amount,
|
||||||
|
PositionSalaryAmount = recv.PositionSalaryAmount,
|
||||||
|
MouthSalaryAmount = recv.MouthSalaryAmount,
|
||||||
|
SalaryClass = "",
|
||||||
|
SalaryRef = "คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย) คำสั่ง" + command.IssuerOrganizationName + "ที่ " + $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate!.Value.ToThaiFullDate3()}",
|
||||||
|
//OcId = lastSarary.OcId,
|
||||||
|
//PositionLevel = lastSarary.PositionLevel,
|
||||||
|
//PositionLineId = lastSarary.PositionLineId,
|
||||||
|
//PositionTypeId = lastSarary.PositionTypeId,
|
||||||
|
//OrganizationShortNameId = lastSarary.OrganizationShortNameId,
|
||||||
|
//PosNoId = lastSarary.PosNoId,
|
||||||
|
CommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}",
|
||||||
|
RefCommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}",
|
||||||
|
CommandTypeName = command.CommandType.Name,
|
||||||
|
//PositionEmployeeGroupId = null,
|
||||||
|
PositionEmployeeLevelId = data.Profile.PositionEmployeeLevel == null ? null : data.Profile.PositionEmployeeLevel.Id,
|
||||||
|
PositionEmployeePositionId = data.Profile.PositionEmployeePosition == null ? null : data.Profile.PositionEmployeePosition.Id,
|
||||||
|
//PositionEmployeePositionSideId = null,
|
||||||
|
PosNoEmployee = data.Profile.PosNoEmployee,
|
||||||
|
////PositionPathSideId = lastSarary.PositionPathSideId == null,
|
||||||
|
//PositionExecutiveId = lastSarary.PositionExecutiveId,
|
||||||
|
////PositionExecutiveSideId = lastSarary.PositionExecutiveSideId,
|
||||||
|
IsActive = true,
|
||||||
|
CreatedAt = DateTime.Now,
|
||||||
|
CreatedFullName = FullName ?? "System Administrator",
|
||||||
|
CreatedUserId = UserId ?? "",
|
||||||
|
LastUpdatedAt = DateTime.Now,
|
||||||
|
LastUpdateFullName = FullName ?? "System Administrator",
|
||||||
|
LastUpdateUserId = UserId ?? "",
|
||||||
|
};
|
||||||
|
data.Profile.Salaries.Add(salary);
|
||||||
|
// update placementstatus
|
||||||
|
data.Status = "DONE";
|
||||||
|
await _dbContext.SaveChangesAsync();
|
||||||
|
|
||||||
|
// 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");
|
||||||
|
|
||||||
|
|
||||||
|
// รอเอาข้อมูลที่ได้มาส่ง inbox noti ให้ผู้รับคำสั่ง
|
||||||
|
|
||||||
|
//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 = data.Profile.Id,
|
||||||
|
// Payload = payload_str,
|
||||||
|
//};
|
||||||
|
//_dbContext.Set<Inbox>().Add(inbox);
|
||||||
|
|
||||||
|
//var noti = new Notification
|
||||||
|
//{
|
||||||
|
// Body = $"คุณได้รับคำสั่งจ้างและแต่งตั้งลูกจ้างประจำ เลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||||
|
// ReceiverUserId = data.Profile.Id,
|
||||||
|
// Type = "LINK",
|
||||||
|
// Payload = payload_str,
|
||||||
|
//};
|
||||||
|
//_dbContext.Set<Notification>().Add(noti);
|
||||||
|
//await _dbContext.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
// send cc noti inbox
|
||||||
|
foreach (var cc in command.Deployments)
|
||||||
|
{
|
||||||
|
var pf = await _dbContext.Set<Profile>().FirstOrDefaultAsync(x => x.CitizenId == cc.CitizenId);
|
||||||
|
if (pf != null)
|
||||||
|
{
|
||||||
|
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 = pf.Id,
|
||||||
|
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 = pf.Id,
|
||||||
|
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 "
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
namespace BMA.EHR.Application.Responses.Reports
|
||||||
|
{
|
||||||
|
public class CommandType22Response
|
||||||
|
{
|
||||||
|
public string? Seq { get; set; } = string.Empty;
|
||||||
|
// public string CitizenId { get; set; } = string.Empty;
|
||||||
|
public string? FullName { get; set; } = string.Empty;
|
||||||
|
public string? Organization { get; set; } = string.Empty;
|
||||||
|
public string? OldPositionName { get; set; } = string.Empty;
|
||||||
|
public string? OldPositionLevel { get; set; } = string.Empty;
|
||||||
|
public string? OldPositionNumber { get; set; } = string.Empty;
|
||||||
|
public string? OldSalary { get; set; } = "";
|
||||||
|
// public string NewOc { get; set; } = string.Empty;
|
||||||
|
public string? NewPositionName { get; set; } = string.Empty;
|
||||||
|
public string? NewPositionLevel { get; set; } = string.Empty;
|
||||||
|
public string? NewPositionNumber { get; set; } = string.Empty;
|
||||||
|
public string? NewSalary { get; set; } = "";
|
||||||
|
public string? Reason { get; set; } = string.Empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -116,7 +116,7 @@ namespace BMA.EHR.Command.Service.Controllers
|
||||||
|
|
||||||
return Success();
|
return Success();
|
||||||
}
|
}
|
||||||
catch(Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
return Error(ex);
|
return Error(ex);
|
||||||
}
|
}
|
||||||
|
|
@ -289,6 +289,7 @@ namespace BMA.EHR.Command.Service.Controllers
|
||||||
else
|
else
|
||||||
return Success(new { result = "N" });
|
return Success(new { result = "N" });
|
||||||
}
|
}
|
||||||
|
case "C-PM-24":
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
if (command.CommandNo != "" &&
|
if (command.CommandNo != "" &&
|
||||||
|
|
|
||||||
|
|
@ -664,6 +664,18 @@
|
||||||
<None Update="Reports\ผลสอบคัดเลือกรายบุคคล.trdp">
|
<None Update="Reports\ผลสอบคัดเลือกรายบุคคล.trdp">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
|
<None Update="Reports\คำสั่งแต่งตั้งลูกจ้างประจำ(ปรับระดับชั้นงาน).trdp">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Update="Reports\คำสั่งแต่งตั้งลูกจ้างประจำ(ปรับระดับชั้นงาน)-แนบท้าย.trdp">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Update="Reports\คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย).trdp">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Update="Reports\คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย)-แนบท้าย.trdp">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
||||||
|
|
@ -2091,22 +2091,21 @@ namespace BMA.EHR.Report.Service.Controllers
|
||||||
CommandNo = raw_data.CommandNo.ToThaiNumber(),
|
CommandNo = raw_data.CommandNo.ToThaiNumber(),
|
||||||
CommandYear = raw_data.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(),
|
CommandYear = raw_data.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(),
|
||||||
IssuerOrganizationName = raw_data.IssuerOrganizationName,
|
IssuerOrganizationName = raw_data.IssuerOrganizationName,
|
||||||
ConclusionRegisterNo = raw_data.ConclusionRegisterNo.ToThaiNumber(),
|
// ConclusionRegisterNo = raw_data.ConclusionRegisterNo.ToThaiNumber(),
|
||||||
ConclusionRegisterDate = raw_data.ConclusionRegisterDate == null ? "" : raw_data.ConclusionRegisterDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
ConclusionRegisterDate = raw_data.ConclusionRegisterDate == null ? "" : raw_data.ConclusionRegisterDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
||||||
ConclusionResultNo = raw_data.ConclusionResultNo.ToThaiNumber(),
|
// ConclusionResultNo = raw_data.ConclusionResultNo.ToThaiNumber(),
|
||||||
ConclusionResultDate = raw_data.ConclusionResultDate == null ? "" : raw_data.ConclusionResultDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
// ConclusionResultDate = raw_data.ConclusionResultDate == null ? "" : raw_data.ConclusionResultDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
||||||
PositionList = "",
|
// PositionList = "",
|
||||||
Count = raw_data.Receivers.Count.ToString().ToThaiNumber(),
|
Count = raw_data.Receivers.Count.ToString().ToThaiNumber(),
|
||||||
CommandAffectDate = raw_data.CommandAffectDate == null ? "" : raw_data.CommandAffectDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
CommandAffectDate = raw_data.CommandAffectDate == null ? "" : raw_data.CommandAffectDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
||||||
AuthorizedUserFullName = raw_data.AuthorizedUserFullName,
|
AuthorizedUserFullName = raw_data.AuthorizedUserFullName,
|
||||||
AuthorizedPosition = raw_data.AuthorizedPosition,
|
AuthorizedPosition = raw_data.AuthorizedPosition,
|
||||||
|
// ConclusionReturnNo = raw_data.ConclusionReturnNo.ToThaiNumber(),
|
||||||
|
// ConclusionReturnDate = raw_data.ConclusionReturnDate == null ? "" : raw_data.ConclusionReturnDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
||||||
Subject = $"เรื่อง {raw_data.CommandSubject}",
|
Subject = $"เรื่อง {raw_data.CommandSubject}",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"คำสั่งแต่งตั้งลูกจ้างประจำ(ปรับระดับชั้นงาน).trdp");
|
||||||
var receiver = await _commandReportRepository.GetCommandType22AttachmentAsync(commandId);
|
|
||||||
|
|
||||||
var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"20-คำสั่งจ้างและแต่งตั้งลูกจ้างประจำ.trdp");
|
|
||||||
|
|
||||||
ReportPackager reportPackager = new ReportPackager();
|
ReportPackager reportPackager = new ReportPackager();
|
||||||
Telerik.Reporting.Report? report = null;
|
Telerik.Reporting.Report? report = null;
|
||||||
|
|
@ -2117,10 +2116,6 @@ namespace BMA.EHR.Report.Service.Controllers
|
||||||
|
|
||||||
report.DataSource = command;
|
report.DataSource = command;
|
||||||
|
|
||||||
var tblData = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["table1"];
|
|
||||||
|
|
||||||
tblData.DataSource = receiver;
|
|
||||||
|
|
||||||
System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
||||||
if (exportType == "docx")
|
if (exportType == "docx")
|
||||||
deviceInfo["OutputFormat"] = "DOCX";
|
deviceInfo["OutputFormat"] = "DOCX";
|
||||||
|
|
@ -2144,6 +2139,56 @@ namespace BMA.EHR.Report.Service.Controllers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task<byte[]> GenerateCommandReportType22_Attachment(Guid commandId, string exportType)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var command = await _repository.GetByIdAsync(commandId);
|
||||||
|
if (command == null)
|
||||||
|
{
|
||||||
|
throw new Exception(GlobalMessages.CommandNotFound);
|
||||||
|
}
|
||||||
|
|
||||||
|
var data = await _commandReportRepository.GetCommandType22AttachmentAsync(commandId);
|
||||||
|
|
||||||
|
var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"คำสั่งแต่งตั้งลูกจ้างประจำ(ปรับระดับชั้นงาน)-แนบท้าย.trdp");
|
||||||
|
|
||||||
|
ReportPackager reportPackager = new ReportPackager();
|
||||||
|
Telerik.Reporting.Report? report = null;
|
||||||
|
using (var sourceStream = System.IO.File.OpenRead(rptFile))
|
||||||
|
{
|
||||||
|
report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
|
||||||
|
}
|
||||||
|
|
||||||
|
var tblData = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["tblData"];
|
||||||
|
|
||||||
|
tblData.DataSource = data;
|
||||||
|
|
||||||
|
report.ReportParameters["IssuerOrganizationName"].Value = command.IssuerOrganizationName;
|
||||||
|
report.ReportParameters["CommandNo"].Value = command.CommandNo.ToThaiNumber();
|
||||||
|
report.ReportParameters["CommandYear"].Value = command.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber();
|
||||||
|
report.ReportParameters["CommandExecuteDate"].Value = command.CommandExcecuteDate == null ? "" : command.CommandExcecuteDate.Value.ToThaiFullDate2().ToThaiNumber();
|
||||||
|
|
||||||
|
System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
||||||
|
|
||||||
|
InstanceReportSource instanceReportSource = new InstanceReportSource()
|
||||||
|
{
|
||||||
|
ReportDocument = report
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
ReportProcessor reportProcessor = new ReportProcessor(_configuration);
|
||||||
|
RenderingResult result = reportProcessor.RenderReport(exportType, instanceReportSource, deviceInfo);
|
||||||
|
|
||||||
|
var content = result.DocumentBytes;
|
||||||
|
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region " C-PM-23 "
|
#region " C-PM-23 "
|
||||||
|
|
@ -2221,6 +2266,126 @@ namespace BMA.EHR.Report.Service.Controllers
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region " C-PM-24 "
|
||||||
|
|
||||||
|
private async Task<byte[]> GenerateCommandReportType24_Cover(Guid commandId, string exportType)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var raw_data = await _repository.GetByIdAsync(commandId);
|
||||||
|
if (raw_data == null)
|
||||||
|
{
|
||||||
|
throw new Exception(GlobalMessages.CommandNotFound);
|
||||||
|
}
|
||||||
|
|
||||||
|
//var recvId = raw_data.Receivers.Select(x => x.RefPlacementProfileId).ToList();
|
||||||
|
//var positionList = string.Empty;
|
||||||
|
|
||||||
|
var command = new
|
||||||
|
{
|
||||||
|
CommandNo = raw_data.CommandNo.ToThaiNumber(),
|
||||||
|
CommandYear = raw_data.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(),
|
||||||
|
IssuerOrganizationName = raw_data.IssuerOrganizationName,
|
||||||
|
ConclusionRegisterNo = raw_data.ConclusionRegisterNo.ToThaiNumber(),
|
||||||
|
ConclusionRegisterDate = raw_data.ConclusionRegisterDate == null ? "" : raw_data.ConclusionRegisterDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
||||||
|
// ConclusionResultNo = raw_data.ConclusionResultNo.ToThaiNumber(),
|
||||||
|
// ConclusionResultDate = raw_data.ConclusionResultDate == null ? "" : raw_data.ConclusionResultDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
||||||
|
// PositionList = "",
|
||||||
|
Count = raw_data.Receivers.Count.ToString().ToThaiNumber(),
|
||||||
|
CommandAffectDate = raw_data.CommandAffectDate == null ? "" : raw_data.CommandAffectDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
||||||
|
AuthorizedUserFullName = raw_data.AuthorizedUserFullName,
|
||||||
|
AuthorizedPosition = raw_data.AuthorizedPosition,
|
||||||
|
// ConclusionReturnNo = raw_data.ConclusionReturnNo.ToThaiNumber(),
|
||||||
|
// ConclusionReturnDate = raw_data.ConclusionReturnDate == null ? "" : raw_data.ConclusionReturnDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
||||||
|
Subject = $"เรื่อง {raw_data.CommandSubject}",
|
||||||
|
};
|
||||||
|
|
||||||
|
var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย).trdp");
|
||||||
|
|
||||||
|
ReportPackager reportPackager = new ReportPackager();
|
||||||
|
Telerik.Reporting.Report? report = null;
|
||||||
|
using (var sourceStream = System.IO.File.OpenRead(rptFile))
|
||||||
|
{
|
||||||
|
report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
|
||||||
|
}
|
||||||
|
|
||||||
|
report.DataSource = command;
|
||||||
|
|
||||||
|
System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
||||||
|
if (exportType == "docx")
|
||||||
|
deviceInfo["OutputFormat"] = "DOCX";
|
||||||
|
|
||||||
|
InstanceReportSource instanceReportSource = new InstanceReportSource()
|
||||||
|
{
|
||||||
|
ReportDocument = report
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
ReportProcessor reportProcessor = new ReportProcessor(_configuration);
|
||||||
|
RenderingResult result = reportProcessor.RenderReport(exportType.ToUpper(), instanceReportSource, deviceInfo);
|
||||||
|
|
||||||
|
var content = result.DocumentBytes;
|
||||||
|
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task<byte[]> GenerateCommandReportType24_Attachment(Guid commandId, string exportType)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var command = await _repository.GetByIdAsync(commandId);
|
||||||
|
if (command == null)
|
||||||
|
{
|
||||||
|
throw new Exception(GlobalMessages.CommandNotFound);
|
||||||
|
}
|
||||||
|
|
||||||
|
var data = await _commandReportRepository.GetCommandType24AttachmentAsync(commandId);
|
||||||
|
|
||||||
|
var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย)-แนบท้าย.trdp");
|
||||||
|
|
||||||
|
ReportPackager reportPackager = new ReportPackager();
|
||||||
|
Telerik.Reporting.Report? report = null;
|
||||||
|
using (var sourceStream = System.IO.File.OpenRead(rptFile))
|
||||||
|
{
|
||||||
|
report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
|
||||||
|
}
|
||||||
|
|
||||||
|
var tblData = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["tblData"];
|
||||||
|
|
||||||
|
tblData.DataSource = data;
|
||||||
|
|
||||||
|
report.ReportParameters["IssuerOrganizationName"].Value = command.IssuerOrganizationName;
|
||||||
|
report.ReportParameters["CommandNo"].Value = command.CommandNo.ToThaiNumber();
|
||||||
|
report.ReportParameters["CommandYear"].Value = command.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber();
|
||||||
|
report.ReportParameters["CommandExecuteDate"].Value = command.CommandExcecuteDate == null ? "" : command.CommandExcecuteDate.Value.ToThaiFullDate2().ToThaiNumber();
|
||||||
|
|
||||||
|
System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
||||||
|
|
||||||
|
InstanceReportSource instanceReportSource = new InstanceReportSource()
|
||||||
|
{
|
||||||
|
ReportDocument = report
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
ReportProcessor reportProcessor = new ReportProcessor(_configuration);
|
||||||
|
RenderingResult result = reportProcessor.RenderReport(exportType, instanceReportSource, deviceInfo);
|
||||||
|
|
||||||
|
var content = result.DocumentBytes;
|
||||||
|
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region " C-PM-01 คำสั่งบรรจุและแต่งตั้ง: สำหรับผู้สอบแข่งขันได้ "
|
#region " C-PM-01 คำสั่งบรรจุและแต่งตั้ง: สำหรับผู้สอบแข่งขันได้ "
|
||||||
|
|
@ -3639,10 +3804,10 @@ namespace BMA.EHR.Report.Service.Controllers
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region " C-PM-22 คำสั่งจ้างและแต่งตั้งลูกจ้างประจำ "
|
#region " C-PM-22 คำสั่งแต่งตั้งลูกจ้างประจำ(ปรับระดับชั้นงาน) "
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// คำสั่ง C-PM-22 คำสั่งจ้างและแต่งตั้งลูกจ้างประจำ
|
/// คำสั่ง C-PM-22 คำสั่งแต่งตั้งลูกจ้างประจำ(ปรับระดับชั้นงาน)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="id">Record Id ของคำสั่ง</param>
|
/// <param name="id">Record Id ของคำสั่ง</param>
|
||||||
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
||||||
|
|
@ -3655,7 +3820,7 @@ namespace BMA.EHR.Report.Service.Controllers
|
||||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||||
public async Task<ActionResult<ResponseObject>> GetCommandType22CoverReportAsync(Guid id, string exportType = "pdf")
|
public async Task<ActionResult<ResponseObject>> GetCommandType22CoverReport(Guid id, string exportType = "pdf")
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
@ -3680,6 +3845,45 @@ namespace BMA.EHR.Report.Service.Controllers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// เอกสารแนบท้าย C-PM-22 คำสั่งแต่งตั้งลูกจ้างประจำ(ปรับระดับชั้นงาน)
|
||||||
|
/// </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-22/attachment/{exportType}/{id}")]
|
||||||
|
[AllowAnonymous]
|
||||||
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||||
|
public async Task<ActionResult<ResponseObject>> GetCommandType22AttachmentReport(Guid id, string exportType = "pdf")
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var cmd = await _repository.GetByIdAsync(id);
|
||||||
|
if (cmd == null)
|
||||||
|
throw new Exception(GlobalMessages.CommandNotFound);
|
||||||
|
|
||||||
|
var mimeType = "";
|
||||||
|
switch (exportType.Trim().ToLower())
|
||||||
|
{
|
||||||
|
case "pdf": mimeType = "application/pdf"; break;
|
||||||
|
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
||||||
|
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
||||||
|
}
|
||||||
|
|
||||||
|
var contentData = await GenerateCommandReportType22_Attachment(id, exportType);
|
||||||
|
return File(contentData, mimeType, $"command-attachment-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}");
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region " C-PM-23 คำสั่งให้ลูกจ้างออกจากราชการ "
|
#region " C-PM-23 คำสั่งให้ลูกจ้างออกจากราชการ "
|
||||||
|
|
@ -3725,6 +3929,88 @@ namespace BMA.EHR.Report.Service.Controllers
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region " C-PM-24 คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย) "
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// คำสั่ง C-PM-24 คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย)
|
||||||
|
/// </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-24/cover/{exportType}/{id}")]
|
||||||
|
[AllowAnonymous]
|
||||||
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||||
|
public async Task<ActionResult<ResponseObject>> GetCommandType24CoverReport(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;
|
||||||
|
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
||||||
|
}
|
||||||
|
|
||||||
|
var cmd = await _repository.GetByIdAsync(id);
|
||||||
|
if (cmd == null)
|
||||||
|
throw new Exception(GlobalMessages.CommandNotFound);
|
||||||
|
|
||||||
|
var contentData = await GenerateCommandReportType24_Cover(id, exportType);
|
||||||
|
return File(contentData, mimeType, $"command-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}");
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// เอกสารแนบท้าย C-PM-24 คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย)
|
||||||
|
/// </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-24/attachment/{exportType}/{id}")]
|
||||||
|
[AllowAnonymous]
|
||||||
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||||
|
public async Task<ActionResult<ResponseObject>> GetCommandType24AttachmentReport(Guid id, string exportType = "pdf")
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var cmd = await _repository.GetByIdAsync(id);
|
||||||
|
if (cmd == null)
|
||||||
|
throw new Exception(GlobalMessages.CommandNotFound);
|
||||||
|
|
||||||
|
var mimeType = "";
|
||||||
|
switch (exportType.Trim().ToLower())
|
||||||
|
{
|
||||||
|
case "pdf": mimeType = "application/pdf"; break;
|
||||||
|
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
||||||
|
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
||||||
|
}
|
||||||
|
|
||||||
|
var contentData = await GenerateCommandReportType24_Attachment(id, exportType);
|
||||||
|
return File(contentData, mimeType, $"command-attachment-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}");
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue