diff --git a/BMA.EHR.Application/Repositories/Commands/CommandRepository.cs b/BMA.EHR.Application/Repositories/Commands/CommandRepository.cs index b2593d11..a3aa5c79 100644 --- a/BMA.EHR.Application/Repositories/Commands/CommandRepository.cs +++ b/BMA.EHR.Application/Repositories/Commands/CommandRepository.cs @@ -1845,6 +1845,7 @@ namespace BMA.EHR.Application.Repositories.Commands OrganizationShortNameId = placementProfile.OrganizationPosition!.Organization!.OrganizationShortName!.Id, OrganizationShortName = placementProfile.OrganizationPosition!.Organization!.OrganizationShortName!.Name, OrganizationOrganizationId = placementProfile.OrganizationPosition!.Organization!.OrganizationOrganization!.Id, + OrganizationOrganization = placementProfile.OrganizationPosition!.Organization!.OrganizationOrganization!.Name, OcId = placementProfile.OrganizationPosition!.Organization!.Id, Oc = _organizationCommonRepository.GetOrganizationNameFullPath(placementProfile.OrganizationPosition!.Organization!.Id, false, false, "/"), @@ -1949,6 +1950,7 @@ namespace BMA.EHR.Application.Repositories.Commands PosNoId = positionNumber!.Id, CommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}", + RefCommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}", CommandTypeName = command.CommandType.Name, @@ -2186,6 +2188,7 @@ namespace BMA.EHR.Application.Repositories.Commands profile.OrganizationShortNameId = placementProfile.OrganizationPosition!.Organization!.OrganizationShortName!.Id; profile.OrganizationShortName = placementProfile.OrganizationPosition!.Organization!.OrganizationShortName!.Name; profile.OrganizationOrganizationId = placementProfile.OrganizationPosition!.Organization!.OrganizationOrganization!.Id; + profile.OrganizationOrganization = placementProfile.OrganizationPosition!.Organization!.OrganizationOrganization!.Name; profile.OcId = placementProfile.OrganizationPosition!.Organization!.Id; profile.Oc = _organizationCommonRepository.GetOrganizationNameFullPath(placementProfile.OrganizationPosition!.Organization!.Id, false, false, "/"); } @@ -2226,6 +2229,7 @@ namespace BMA.EHR.Application.Repositories.Commands PosNoId = positionNumber!.Id, CommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}", + RefCommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}", CommandTypeName = command.CommandType.Name, PositionEmployeeGroupId = null, @@ -2437,6 +2441,7 @@ namespace BMA.EHR.Application.Repositories.Commands profile.OrganizationShortNameId = placementProfile.OrganizationPosition!.Organization!.OrganizationShortName!.Id; profile.OrganizationShortName = placementProfile.OrganizationPosition!.Organization!.OrganizationShortName!.Name; profile.OrganizationOrganizationId = placementProfile.OrganizationPosition!.Organization!.OrganizationOrganization!.Id; + profile.OrganizationOrganization = placementProfile.OrganizationPosition!.Organization!.OrganizationOrganization!.Name; profile.OcId = placementProfile.OrganizationPosition!.Organization!.Id; profile.Oc = _organizationCommonRepository.GetOrganizationNameFullPath(placementProfile.OrganizationPosition!.Organization!.Id, false, false, "/"); } @@ -2477,6 +2482,7 @@ namespace BMA.EHR.Application.Repositories.Commands PosNoId = positionNumber!.Id, CommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}", + RefCommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}", CommandTypeName = command.CommandType.Name, PositionEmployeeGroupId = null, @@ -2665,6 +2671,7 @@ namespace BMA.EHR.Application.Repositories.Commands profile.OrganizationShortNameId = placementProfile.OrganizationPosition!.Organization!.OrganizationShortName!.Id; profile.OrganizationShortName = placementProfile.OrganizationPosition!.Organization!.OrganizationShortName!.Name; profile.OrganizationOrganizationId = placementProfile.OrganizationPosition!.Organization!.OrganizationOrganization!.Id; + profile.OrganizationOrganization = placementProfile.OrganizationPosition!.Organization!.OrganizationOrganization!.Name; profile.OcId = placementProfile.OrganizationPosition!.Organization!.Id; profile.Oc = _organizationCommonRepository.GetOrganizationNameFullPath(placementProfile.OrganizationPosition!.Organization!.Id, false, false, "/"); } @@ -2705,6 +2712,7 @@ namespace BMA.EHR.Application.Repositories.Commands PosNoId = positionNumber!.Id, CommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}", + RefCommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}", CommandTypeName = command.CommandType.Name, PositionEmployeeGroupId = null, @@ -2893,6 +2901,7 @@ namespace BMA.EHR.Application.Repositories.Commands profile.OrganizationShortNameId = placementProfile.OrganizationPosition!.Organization!.OrganizationShortName!.Id; profile.OrganizationShortName = placementProfile.OrganizationPosition!.Organization!.OrganizationShortName!.Name; profile.OrganizationOrganizationId = placementProfile.OrganizationPosition!.Organization!.OrganizationOrganization!.Id; + profile.OrganizationOrganization = placementProfile.OrganizationPosition!.Organization!.OrganizationOrganization!.Name; profile.OcId = placementProfile.OrganizationPosition!.Organization!.Id; profile.Oc = _organizationCommonRepository.GetOrganizationNameFullPath(placementProfile.OrganizationPosition!.Organization!.Id, false, false, "/"); } @@ -2933,6 +2942,7 @@ namespace BMA.EHR.Application.Repositories.Commands PosNoId = positionNumber!.Id, CommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}", + RefCommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}", CommandTypeName = command.CommandType.Name, PositionEmployeeGroupId = null, @@ -3121,6 +3131,7 @@ namespace BMA.EHR.Application.Repositories.Commands profile.OrganizationShortNameId = placementProfile.OrganizationPosition!.Organization!.OrganizationShortName!.Id; profile.OrganizationShortName = placementProfile.OrganizationPosition!.Organization!.OrganizationShortName!.Name; profile.OrganizationOrganizationId = placementProfile.OrganizationPosition!.Organization!.OrganizationOrganization!.Id; + profile.OrganizationOrganization = placementProfile.OrganizationPosition!.Organization!.OrganizationOrganization!.Name; profile.OcId = placementProfile.OrganizationPosition!.Organization!.Id; profile.Oc = _organizationCommonRepository.GetOrganizationNameFullPath(placementProfile.OrganizationPosition!.Organization!.Id, false, false, "/"); } @@ -3161,6 +3172,7 @@ namespace BMA.EHR.Application.Repositories.Commands PosNoId = positionNumber!.Id, CommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}", + RefCommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}", CommandTypeName = command.CommandType.Name, PositionEmployeeGroupId = null, @@ -3398,6 +3410,7 @@ namespace BMA.EHR.Application.Repositories.Commands PosNoId = lastSarary.PosNoId, CommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}", + RefCommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}", CommandTypeName = command.CommandType.Name, PositionEmployeeGroupId = null, @@ -3644,6 +3657,7 @@ namespace BMA.EHR.Application.Repositories.Commands PosNoId = lastSarary.PosNoId, CommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}", + RefCommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}", CommandTypeName = command.CommandType.Name, PositionEmployeeGroupId = null, @@ -3816,6 +3830,7 @@ namespace BMA.EHR.Application.Repositories.Commands PosNoId = lastSarary.PosNoId, CommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}", + RefCommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}", CommandTypeName = command.CommandType.Name, @@ -3990,6 +4005,7 @@ namespace BMA.EHR.Application.Repositories.Commands PosNoId = lastSarary.PosNoId, CommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}", + RefCommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}", CommandTypeName = command.CommandType.Name, @@ -4167,6 +4183,7 @@ namespace BMA.EHR.Application.Repositories.Commands PosNoId = lastSarary.PosNoId, CommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}", + RefCommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}", CommandTypeName = command.CommandType.Name, @@ -4346,6 +4363,7 @@ namespace BMA.EHR.Application.Repositories.Commands PosNoId = lastSarary.PosNoId, CommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}", + RefCommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}", CommandTypeName = command.CommandType.Name, @@ -4627,6 +4645,7 @@ namespace BMA.EHR.Application.Repositories.Commands OrganizationShortNameId = placementProfile.OrganizationPosition!.Organization!.OrganizationShortName!.Id, OrganizationShortName = placementProfile.OrganizationPosition!.Organization!.OrganizationShortName!.Name, OrganizationOrganizationId = placementProfile.OrganizationPosition!.Organization!.OrganizationOrganization!.Id, + OrganizationOrganization = placementProfile.OrganizationPosition!.Organization!.OrganizationOrganization!.Name, OcId = placementProfile.OrganizationPosition!.Organization!.Id, Oc = _organizationCommonRepository.GetOrganizationNameFullPath(placementProfile.OrganizationPosition!.Organization!.Id, false, false, "/"), @@ -4666,6 +4685,7 @@ namespace BMA.EHR.Application.Repositories.Commands PosNoId = positionNumber!.Id, CommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}", + RefCommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}", CommandTypeName = command.CommandType.Name, @@ -4871,6 +4891,7 @@ namespace BMA.EHR.Application.Repositories.Commands PosNoId = lastSarary.PosNoId, CommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}", + RefCommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}", CommandTypeName = command.CommandType.Name, @@ -5049,6 +5070,7 @@ namespace BMA.EHR.Application.Repositories.Commands PosNoId = lastSarary.PosNoId, CommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}", + RefCommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}", CommandTypeName = command.CommandType.Name, @@ -5228,6 +5250,7 @@ namespace BMA.EHR.Application.Repositories.Commands PosNoId = lastSarary.PosNoId, CommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}", + RefCommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}", CommandTypeName = command.CommandType.Name, @@ -5407,6 +5430,7 @@ namespace BMA.EHR.Application.Repositories.Commands PosNoId = lastSarary.PosNoId, CommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}", + RefCommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}", CommandTypeName = command.CommandType.Name, @@ -5586,6 +5610,7 @@ namespace BMA.EHR.Application.Repositories.Commands PosNoId = lastSarary.PosNoId, CommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}", + RefCommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}", CommandTypeName = command.CommandType.Name, @@ -5765,6 +5790,7 @@ namespace BMA.EHR.Application.Repositories.Commands PosNoId = lastSarary.PosNoId, CommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}", + RefCommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}", CommandTypeName = command.CommandType.Name, @@ -5954,6 +5980,7 @@ namespace BMA.EHR.Application.Repositories.Commands //PosNoId = lastSarary.PosNoId, CommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}", + RefCommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}", CommandTypeName = command.CommandType.Name, @@ -6108,6 +6135,8 @@ namespace BMA.EHR.Application.Repositories.Commands .ThenInclude(x => x.OrganizationShortName) .Include(x => x.OrgEmployee) .ThenInclude(x => x.OrganizationOrganization) + .Include(x => x.OrgEmployee) + .ThenInclude(x => x.Organization) .FirstOrDefaultAsync(x => x.Id == recv.RefPlacementProfileId); if (data == null) @@ -6144,6 +6173,7 @@ namespace BMA.EHR.Application.Repositories.Commands //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 = null, @@ -6313,6 +6343,7 @@ namespace BMA.EHR.Application.Repositories.Commands PosNoId = lastSarary.PosNoId, CommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}", + RefCommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}", CommandTypeName = command.CommandType.Name, diff --git a/BMA.EHR.Application/Repositories/OrganizationCommonRepository.cs b/BMA.EHR.Application/Repositories/OrganizationCommonRepository.cs index 30db98e7..091cd5d7 100644 --- a/BMA.EHR.Application/Repositories/OrganizationCommonRepository.cs +++ b/BMA.EHR.Application/Repositories/OrganizationCommonRepository.cs @@ -62,6 +62,7 @@ namespace BMA.EHR.Application.Repositories var ocData = _dbContext.Set() .Include(x => x.OrganizationOrganization) .Include(x => x.Parent) + .Where(x => x.Parent != null) .Select(x => new { Id = x.Id, diff --git a/BMA.EHR.Domain/Models/HR/ProfileSalary.cs b/BMA.EHR.Domain/Models/HR/ProfileSalary.cs index 30922c82..1bdad17a 100644 --- a/BMA.EHR.Domain/Models/HR/ProfileSalary.cs +++ b/BMA.EHR.Domain/Models/HR/ProfileSalary.cs @@ -64,5 +64,7 @@ namespace BMA.EHR.Domain.Models.HR [Comment("ประเภทตำแหน่งกรณีพิเศษ")] public string? SalaryStatus { get; set; } public bool IsActive { get; set; } = true; + [Comment("เอกสารอ้างอิง (เลขที่คำสั่ง)")] + public string? RefCommandNo { get; set; } } } diff --git a/BMA.EHR.Placement.Service/Controllers/PlacementAppointmentController.cs b/BMA.EHR.Placement.Service/Controllers/PlacementAppointmentController.cs index 48811ec2..70842de2 100644 --- a/BMA.EHR.Placement.Service/Controllers/PlacementAppointmentController.cs +++ b/BMA.EHR.Placement.Service/Controllers/PlacementAppointmentController.cs @@ -63,7 +63,7 @@ namespace BMA.EHR.Placement.Service.Controllers { var placementAppointments = await _context.PlacementAppointments.AsQueryable() - .Where(x => (x.Profile.ProfileType == "employee" && x.Profile.EmployeeClass == "perm") || (x.Profile.ProfileType == "officer")) + .Where(x => x.Profile.ProfileType == "officer") .OrderByDescending(x => x.CreatedAt) .Select(p => new { @@ -124,7 +124,7 @@ namespace BMA.EHR.Placement.Service.Controllers public async Task> GetDetailByUser(Guid id) { var data = await _context.PlacementAppointments.AsQueryable() - .Where(x => (x.Profile.ProfileType == "employee" && x.Profile.EmployeeClass == "perm") || (x.Profile.ProfileType == "officer")) + .Where(x => x.Profile.ProfileType == "officer") .Where(x => x.Id == id) .Select(p => new { @@ -244,7 +244,7 @@ namespace BMA.EHR.Placement.Service.Controllers .Include(x => x.Position) .Include(x => x.Gender) .Include(x => x.Prefix) - .Where(x => (x.ProfileType == "employee" && x.EmployeeClass == "perm") || (x.ProfileType == "officer")) + .Where(x => x.ProfileType == "officer") .FirstOrDefaultAsync(x => x.Id == req.Id); if (profile == null) return Error(GlobalMessages.DataNotFound, 404); @@ -326,7 +326,7 @@ namespace BMA.EHR.Placement.Service.Controllers public async Task> UpdatePositionPlacementAppointment([FromBody] PersonSelectPositionAppointmentRequest req, Guid id) { var uppdated = await _context.PlacementAppointments - .Where(x => (x.Profile.ProfileType == "employee" && x.Profile.EmployeeClass == "perm") || (x.Profile.ProfileType == "officer")) + .Where(x => x.Profile.ProfileType == "officer") .FirstOrDefaultAsync(x => x.Id == id); if (uppdated == null) return Error(GlobalMessages.PlacementAppointmentNotFound, 404); @@ -406,7 +406,7 @@ namespace BMA.EHR.Placement.Service.Controllers public async Task> Put([FromBody] PlacementAppointmentEditRequest req, Guid id) { var uppdated = await _context.PlacementAppointments - .Where(x => (x.Profile.ProfileType == "employee" && x.Profile.EmployeeClass == "perm") || (x.Profile.ProfileType == "officer")) + .Where(x => x.Profile.ProfileType == "officer") .FirstOrDefaultAsync(x => x.Id == id); if (uppdated == null) return Error(GlobalMessages.PlacementAppointmentNotFound, 404); @@ -489,7 +489,7 @@ namespace BMA.EHR.Placement.Service.Controllers var deleted = await _context.PlacementAppointments.AsQueryable() .Include(x => x.PlacementAppointmentDocs) .ThenInclude(x => x.Document) - .Where(x => (x.Profile.ProfileType == "employee" && x.Profile.EmployeeClass == "perm") || (x.Profile.ProfileType == "officer")) + .Where(x => x.Profile.ProfileType == "officer") .FirstOrDefaultAsync(x => x.Id == id); if (deleted == null) return NotFound(); @@ -526,7 +526,7 @@ namespace BMA.EHR.Placement.Service.Controllers foreach (var item in req.Id) { var uppdated = await _context.PlacementAppointments - .Where(x => (x.Profile.ProfileType == "employee" && x.Profile.EmployeeClass == "perm") || (x.Profile.ProfileType == "officer")) + .Where(x => x.Profile.ProfileType == "officer") .FirstOrDefaultAsync(x => x.Id == item); if (uppdated == null) continue; @@ -556,7 +556,7 @@ namespace BMA.EHR.Placement.Service.Controllers { var appointments = await _context.PlacementAppointments .Where(x => x.PositionNumber != null) - .Where(x => (x.Profile.ProfileType == "employee" && x.Profile.EmployeeClass == "perm") || (x.Profile.ProfileType == "officer")) + .Where(x => x.Profile.ProfileType == "officer") .Select(x => x.PositionNumber.Id) .ToListAsync();