แก้ออกคำสั่ง

This commit is contained in:
kittapath 2025-01-05 21:57:27 +07:00
parent ad70e8164c
commit 564a23988d
17 changed files with 77109 additions and 252 deletions

View file

@ -217,7 +217,7 @@ namespace BMA.EHR.Placement.Service.Controllers
IsRelief = x.IsRelief,
posLevelCandidate = x.PositionLevel,
posTypeCandidate = x.PositionType,
positionCandidate = x.positionName,
positionCandidate = x.PositionCandidate,
}).OrderBy(x => x.ExamNumber).ToListAsync();
var result1 = new List<dynamic>();
@ -329,7 +329,7 @@ namespace BMA.EHR.Placement.Service.Controllers
IsRelief = x.IsRelief,
posLevelCandidate = x.PositionLevel,
posTypeCandidate = x.PositionType,
positionCandidate = x.positionName,
positionCandidate = x.PositionCandidate,
}).OrderBy(x => x.ExamNumber).ToListAsync();
var result = new List<dynamic>();
@ -432,7 +432,7 @@ namespace BMA.EHR.Placement.Service.Controllers
DateOfBirth = x.DateOfBirth,
Age = x.DateOfBirth == null ? null : x.DateOfBirth.Value.CalculateAgeStrV2(0, 0),
Telephone = x.Telephone,
PositionCandidate = x.positionName,
PositionCandidate = x.PositionCandidate,
Gender = x.Gender,
Relationship = x.Relationship,
BloodGroup = x.BloodGroup,
@ -445,8 +445,8 @@ namespace BMA.EHR.Placement.Service.Controllers
Education = x.PlacementEducations.Select(p => new
{
Id = p.Id,
EducationLevel = p.EducationLevel == null ? null : p.EducationLevel.Name,
EducationLevelId = p.EducationLevel == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.EducationLevel.Id,
EducationLevel = p.EducationLevelId,
EducationLevelId = p.EducationLevelName,
Institute = p.Institute,
Degree = p.Degree,
Field = p.Field,
@ -717,23 +717,11 @@ namespace BMA.EHR.Placement.Service.Controllers
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
}
var person = await _context.PlacementProfiles
.Include(x => x.OrganizationPosition)
.Include(x => x.PositionNumber)
.Include(x => x.PositionPath)
// .Include(x => x.PositionLevel)
.Include(x => x.PositionLine)
.Include(x => x.PositionPathSide)
// .Include(x => x.PositionType)
.FirstOrDefaultAsync(x => x.Id == req.PersonalId);
if (person == null)
return Error(GlobalMessages.DataNotFound, 404);
bool? _nullBool = null;
person.OrganizationPosition = null;
person.PositionNumber = null;
person.PositionPath = null;
person.PositionLevel = null;
person.PositionLine = null;
person.PositionPathSide = null;
person.PositionType = null;
person.Amount = null;
person.MouthSalaryAmount = null;
@ -762,7 +750,7 @@ namespace BMA.EHR.Placement.Service.Controllers
person.child4ShortName = null;
person.orgRevisionId = null;
person.posMasterNo = null;
//person.positionName = null;
//person.positionName = null;
person.positionField = null;
person.posTypeId = null;
person.posTypeName = null;
@ -837,19 +825,6 @@ namespace BMA.EHR.Placement.Service.Controllers
if (person.Draft == true)
return Error("ไม่สามารถแก้ไขข้อมูลนี้ได้เนื่องจากเผยแพร่ไปแล้ว");
// person.organizationName = req.organizationName;
// person.orgTreeShortName = req.orgTreeShortName;
// person.PosPath = req.posPath;
// person.PosNumber = req.posNumber;
// person.node = req.node;
// person.nodeId = req.nodeId;
// person.posmasterId = req.posmasterId;
// person.positionId = req.positionId;
// person.Amount = req.SalaryAmount;
// person.MouthSalaryAmount = req.MouthSalaryAmount;
// person.PositionSalaryAmount = req.PositionSalaryAmount;
// person.RecruitDate = req.ReportingDate;
var apiUrl = $"{_configuration["API"]}/org/find/all";
using (var client = new HttpClient())
@ -1135,10 +1110,6 @@ namespace BMA.EHR.Placement.Service.Controllers
if (profile == null)
return Error(GlobalMessages.DataNotFound, 404);
var educationLevel = await _context.EducationLevels.FirstOrDefaultAsync(x => x.Id == req.EducationLevelId);
if (educationLevel == null && req.EducationLevelId != null)
return Error(GlobalMessages.DataNotFound, 404);
var positionPath = await _context.PositionPaths.FirstOrDefaultAsync(x => x.Id == req.PositionPathId);
if (positionPath == null && req.PositionPathId != null)
return Error(GlobalMessages.DataNotFound, 404);
@ -1146,7 +1117,7 @@ namespace BMA.EHR.Placement.Service.Controllers
var data = new PlacementEducation
{
PlacementProfile = profile,
EducationLevel = educationLevel,
EducationLevelId = req.EducationLevelId,
PositionPath = positionPath,
Institute = req.Institute,
Degree = req.Degree,
@ -1180,10 +1151,6 @@ namespace BMA.EHR.Placement.Service.Controllers
if (profile == null)
return Error(GlobalMessages.DataNotFound, 404);
var educationLevel = await _context.EducationLevels.FirstOrDefaultAsync(x => x.Id == req.EducationLevelId);
if (educationLevel == null && req.EducationLevelId != null)
return Error(GlobalMessages.DataNotFound, 404);
var positionPath = await _context.PositionPaths.FirstOrDefaultAsync(x => x.Id == req.PositionPathId);
if (positionPath == null && req.PositionPathId != null)
return Error(GlobalMessages.DataNotFound, 404);
@ -1192,7 +1159,7 @@ namespace BMA.EHR.Placement.Service.Controllers
if (education == null)
return Error(GlobalMessages.EducationNotFound, 404);
education.EducationLevel = educationLevel;
education.EducationLevelId = req.EducationLevelId;
education.PositionPath = positionPath;
education.Institute = req.Institute;
education.Degree = req.Degree;
@ -1256,13 +1223,6 @@ namespace BMA.EHR.Placement.Service.Controllers
public async Task<ActionResult<ResponseObject>> UpdatePositionDraft(Guid personalId)
{
var profile = await _context.PlacementProfiles
.Include(x => x.OrganizationPosition)
.Include(x => x.PositionNumber)
.Include(x => x.PositionPath)
// .Include(x => x.PositionLevel)
.Include(x => x.PositionLine)
.Include(x => x.PositionPathSide)
// .Include(x => x.PositionType)
.FirstOrDefaultAsync(x => x.Id == personalId);
if (profile == null)
return Error(GlobalMessages.DataNotFound, 404);
@ -1301,16 +1261,11 @@ namespace BMA.EHR.Placement.Service.Controllers
profile.posLevelId = null;
profile.posLevelName = null;
profile.OrganizationPosition = null;
profile.PositionNumber = null;
profile.PositionPath = null;
profile.PositionLevel = null;
profile.PositionLine = null;
profile.PositionPathSide = null;
profile.PositionType = null;
profile.Amount = null;
profile.MouthSalaryAmount = null;
profile.PositionSalaryAmount = null;
// profile.PositionLevel = null;
// profile.PositionType = null;
// profile.Amount = null;
// profile.MouthSalaryAmount = null;
// profile.PositionSalaryAmount = null;
profile.RecruitDate = null;
profile.ReportingDate = null;
@ -1601,8 +1556,8 @@ namespace BMA.EHR.Placement.Service.Controllers
AppointDate = p.ReportingDate == null ? "-" : p.ReportingDate.Value.ToThaiShortDate2().ToThaiNumber(),
CommandExcecuteDate = string.IsNullOrEmpty(r.CommandExcecuteDate.ToString()) ? "-" : r.CommandExcecuteDate.Value.ToThaiShortDate2().ToThaiNumber(),
OccupationPosition = p.OccupationPosition == null ? "-" : p.OccupationPosition, //ตำแหน่งเก่าก่อนสอบ
PositionCandidate = p.positionName, //ตำแหน่งที่สอบแข่งขัน
OcCandidate = p.root == null ? p.PositionCandidate == null ? "-" : $"{p.PositionCandidate}/-" :
PositionCandidate = p.PositionCandidate, //ตำแหน่งที่สอบแข่งขัน
OcCandidate = p.root == null ? p.positionName == null ? "-" : $"{p.positionName}/-" :
p.node == 4
? p.positionName == null ? $"{p.child4}/{p.child3}/{p.child2}/{p.child1}/{p.root}" : $"{p.positionName}/{p.child4}/{p.child3}/{p.child2}/{p.child1}/{p.root}" :
p.node == 3
@ -1672,7 +1627,6 @@ namespace BMA.EHR.Placement.Service.Controllers
var placementProfile = await _context.PlacementProfiles
.Include(x => x.PlacementCertificates)
.Include(x => x.PlacementEducations)
.ThenInclude(x => x.EducationLevel)
.Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString()))
.ToListAsync();
@ -1741,8 +1695,8 @@ namespace BMA.EHR.Placement.Service.Controllers
other = e.Other ?? string.Empty,
startDate = e.StartDate ?? null,
endDate = e.EndDate ?? null,
educationLevel = e.EducationLevel?.Name ?? string.Empty,
educationLevelId = e.EducationLevel?.Id.ToString() ?? string.Empty,
educationLevel = e.EducationLevelName,
educationLevelId = e.EducationLevelId,
positionPath = e.PositionPath?.Name ?? string.Empty,
positionPathId = e.PositionPath?.Id.ToString() ?? string.Empty,
isDate = e.IsDate ?? false,
@ -1919,7 +1873,7 @@ namespace BMA.EHR.Placement.Service.Controllers
Salary = r.Amount == null ? "-" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber().ToThaiNumber(),
AppointDate = p.ReportingDate == null ? "-" : p.ReportingDate.Value.ToThaiShortDate2().ToThaiNumber(),
CommandExcecuteDate = string.IsNullOrEmpty(r.CommandExcecuteDate.ToString()) ? "-" : r.CommandExcecuteDate.Value.ToThaiShortDate2().ToThaiNumber(),
PositionCandidate = p.positionName,
PositionCandidate = p.PositionCandidate,
RemarkHorizontal = r.RemarkHorizontal,
RemarkVertical = r.RemarkVertical,
}).ToList();
@ -1930,7 +1884,8 @@ namespace BMA.EHR.Placement.Service.Controllers
{
result.Add(r);
string? _null = null;
if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") {
if (r.RemarkHorizontal != null && r.RemarkHorizontal != "")
{
result.Add(new
{
No = _null,
@ -1977,7 +1932,6 @@ namespace BMA.EHR.Placement.Service.Controllers
var placementProfile = await _context.PlacementProfiles
.Include(x => x.PlacementCertificates)
.Include(x => x.PlacementEducations)
.ThenInclude(x => x.EducationLevel)
.Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString()))
.ToListAsync();
@ -2017,16 +1971,16 @@ namespace BMA.EHR.Placement.Service.Controllers
gender = p.Gender == null ? string.Empty : p.Gender,
relationship = p.Relationship == null ? string.Empty : p.Relationship,
religion = p.Religion == null ? string.Empty : p.Religion,
bloodGroup = string.Empty,
bloodGroup = p.BloodGroup,
registrationAddress = p.RegistAddress == null ? string.Empty : p.RegistAddress,
registrationProvinceId = (String?)null,
registrationDistrictId = (String?)null,
registrationSubDistrictId = (String?)null,
registrationProvinceId = p.RegistProvinceId,
registrationDistrictId = p.RegistDistrictId,
registrationSubDistrictId = p.RegistSubDistrictId,
registrationZipCode = p.RegistZipCode == null ? string.Empty : p.RegistZipCode,
currentAddress = p.CurrentAddress == null ? string.Empty : p.CurrentAddress,
currentProvinceId = (String?)null,
currentDistrictId = (String?)null,
currentSubDistrictId = (String?)null,
currentProvinceId = p.CurrentProvinceId,
currentDistrictId = p.CurrentDistrictId,
currentSubDistrictId = p.CurrentSubDistrictId,
currentZipCode = p.CurrentZipCode == null ? string.Empty : p.CurrentZipCode,
amount = r.amount,
amountSpecial = r.amountSpecial,
@ -2046,8 +2000,8 @@ namespace BMA.EHR.Placement.Service.Controllers
other = e.Other ?? string.Empty,
startDate = e.StartDate ?? null,
endDate = e.EndDate ?? null,
educationLevel = e.EducationLevel?.Name ?? string.Empty,
educationLevelId = e.EducationLevel?.Id.ToString() ?? string.Empty,
educationLevel = e.EducationLevelName,
educationLevelId = e.EducationLevelId,
positionPath = e.PositionPath?.Name ?? string.Empty,
positionPathId = e.PositionPath?.Id.ToString() ?? string.Empty,
isDate = e.IsDate ?? false,
@ -2255,7 +2209,8 @@ namespace BMA.EHR.Placement.Service.Controllers
{
result.Add(r);
string? _null = null;
if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") {
if (r.RemarkHorizontal != null && r.RemarkHorizontal != "")
{
result.Add(new
{
No = _null,
@ -2483,7 +2438,8 @@ namespace BMA.EHR.Placement.Service.Controllers
{
result.Add(r);
string? _null = null;
if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") {
if (r.RemarkHorizontal != null && r.RemarkHorizontal != "")
{
result.Add(new
{
No = _null,
@ -2702,7 +2658,8 @@ namespace BMA.EHR.Placement.Service.Controllers
{
result.Add(r);
string? _null = null;
if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") {
if (r.RemarkHorizontal != null && r.RemarkHorizontal != "")
{
result.Add(new
{
No = _null,
@ -2722,7 +2679,7 @@ namespace BMA.EHR.Placement.Service.Controllers
AppointDate = _null,
RemarkHorizontal = _null,
RemarkVertical = _null,
});
});
}
}
return Success(result);