Merge branch 'develop'
All checks were successful
Build & Deploy Retirement Service / build (push) Successful in 1m9s
All checks were successful
Build & Deploy Retirement Service / build (push) Successful in 1m9s
* develop: sort retire update order add order retirement update สิทธิ์
This commit is contained in:
commit
2295aedc3a
2 changed files with 30 additions and 32 deletions
|
|
@ -230,12 +230,14 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
else if (role == "NORMAL")
|
else if (role == "NORMAL")
|
||||||
{
|
{
|
||||||
placementAppointments = placementAppointments
|
placementAppointments = placementAppointments
|
||||||
.Where(
|
.Where(x =>
|
||||||
x => node == 0 ? x.child1DnaId == null
|
(node == 0 && x.child1DnaId == null && x.rootDnaId == nodeId) ||
|
||||||
: (node == 1 ? x.child1DnaId != null && x.child2DnaId == null
|
(node == 1 && x.child1DnaId != null && x.child2DnaId == null && x.child1DnaId == nodeId) ||
|
||||||
: (node == 2 ? x.child2DnaId != null && x.child3DnaId == null
|
(node == 2 && x.child2DnaId != null && x.child3DnaId == null && x.child2DnaId == nodeId) ||
|
||||||
: (node == 3 ? x.child3DnaId != null && x.child4DnaId == null : true)))
|
(node == 3 && x.child3DnaId != null && x.child4DnaId == null && x.child3DnaId == nodeId) ||
|
||||||
).ToList();
|
(node == 4 && x.child4DnaId == nodeId)
|
||||||
|
)
|
||||||
|
.ToList();
|
||||||
}
|
}
|
||||||
return Success(placementAppointments);
|
return Success(placementAppointments);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -487,6 +487,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
positionArea = x.positionArea,
|
positionArea = x.positionArea,
|
||||||
posNo = x.posNo,
|
posNo = x.posNo,
|
||||||
})
|
})
|
||||||
|
.OrderBy(x => x.order)
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
var file_name = $"retire_tmp_{DateTime.Now.ToString("yyyyMMddTHHmmss")}";
|
var file_name = $"retire_tmp_{DateTime.Now.ToString("yyyyMMddTHHmmss")}";
|
||||||
var profile = Newtonsoft.Json.JsonConvert.SerializeObject(profile_old);
|
var profile = Newtonsoft.Json.JsonConvert.SerializeObject(profile_old);
|
||||||
|
|
@ -603,6 +604,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
return Error(GlobalMessages.RetirementNotFound, 404);
|
return Error(GlobalMessages.RetirementNotFound, 404);
|
||||||
var profileOlds = await _context.RetirementProfiles.AsQueryable()
|
var profileOlds = await _context.RetirementProfiles.AsQueryable()
|
||||||
.Where(x => x.RetirementPeriod == retireOld)
|
.Where(x => x.RetirementPeriod == retireOld)
|
||||||
|
.OrderBy(x => x.Order)
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
if (profileOlds != null)
|
if (profileOlds != null)
|
||||||
{
|
{
|
||||||
|
|
@ -695,6 +697,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
positionArea = x.positionArea,
|
positionArea = x.positionArea,
|
||||||
posNo = x.posNo,
|
posNo = x.posNo,
|
||||||
})
|
})
|
||||||
|
.OrderBy(x => x.order)
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
// var profile_news = new List<ProfileJsonRequest>();
|
// var profile_news = new List<ProfileJsonRequest>();
|
||||||
// foreach (var r in profile_new)
|
// foreach (var r in profile_new)
|
||||||
|
|
@ -811,6 +814,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
// positionEmployeeGroup = x.Profile.PositionEmployeeGroup == null ? null : x.Profile.PositionEmployeeGroup.Name,
|
// positionEmployeeGroup = x.Profile.PositionEmployeeGroup == null ? null : x.Profile.PositionEmployeeGroup.Name,
|
||||||
// posNoEmployee = x.Profile.PosNoEmployee,
|
// posNoEmployee = x.Profile.PosNoEmployee,
|
||||||
})
|
})
|
||||||
|
.OrderBy(x => x.order)
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
// var profile_news = new List<ProfileJsonRequest>();
|
// var profile_news = new List<ProfileJsonRequest>();
|
||||||
// foreach (var r in profile_new)
|
// foreach (var r in profile_new)
|
||||||
|
|
@ -891,35 +895,27 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
|
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
|
||||||
}
|
}
|
||||||
|
|
||||||
// var profile = await _context.Profiles
|
|
||||||
// .FirstOrDefaultAsync(x => x.Id == req.ProfileId);
|
|
||||||
// if (profile == null)
|
|
||||||
// return Error(GlobalMessages.DataNotFound, 404);
|
|
||||||
|
|
||||||
var retire = await _context.RetirementPeriods
|
var retire = await _context.RetirementPeriods
|
||||||
.Include(x => x.RetirementPeriodHistorys)
|
|
||||||
.Include(x => x.RetirementProfiles)
|
|
||||||
// .ThenInclude(x => x.Profile)
|
|
||||||
.FirstOrDefaultAsync(x => x.Id == retireId);
|
.FirstOrDefaultAsync(x => x.Id == retireId);
|
||||||
if (retire == null)
|
if (retire == null)
|
||||||
return Error(GlobalMessages.RetirementNotFound, 404);
|
return Error(GlobalMessages.RetirementNotFound, 404);
|
||||||
if (retire.RetirementProfiles.Where(x => x.profileId == req.ProfileId).Count() > 0)
|
|
||||||
|
var retireProfile = await _context.RetirementProfiles
|
||||||
|
.FirstOrDefaultAsync(x => x.profileId == req.ProfileId && x.RetirementPeriod.Id == retireId);
|
||||||
|
if (retireProfile != null)
|
||||||
return Error("บุคคลนี้ได้ทำการเลือกไว้อยู่แล้ว");
|
return Error("บุคคลนี้ได้ทำการเลือกไว้อยู่แล้ว");
|
||||||
foreach (var retire_profile in retire.RetirementProfiles)
|
var numRaw = 0;
|
||||||
|
|
||||||
|
if (retire.TypeReport != null)
|
||||||
{
|
{
|
||||||
retire_profile.Order++;
|
numRaw = 1;
|
||||||
retire_profile.LastUpdateFullName = FullName ?? "System Administrator";
|
var profileRawCount = await _context.RetirementRawProfiles
|
||||||
retire_profile.LastUpdateUserId = UserId ?? "";
|
.Where(x => x.RetirementPeriod.Id == retireId)
|
||||||
retire_profile.LastUpdatedAt = DateTime.Now;
|
.OrderByDescending(x => x.Order)
|
||||||
|
.FirstOrDefaultAsync();
|
||||||
|
if (profileRawCount != null)
|
||||||
|
numRaw = profileRawCount.Order + 1;
|
||||||
}
|
}
|
||||||
var num = 0;
|
|
||||||
|
|
||||||
var profileRawCount = await _context.RetirementRawProfiles
|
|
||||||
.CountAsync(x => x.RetirementPeriod.Id == retireId);
|
|
||||||
|
|
||||||
// var old_retire = retire.RetirementProfiles.OrderByDescending(x => x.Order).FirstOrDefault();
|
|
||||||
// if (old_retire != null)
|
|
||||||
// num = old_retire.Order + 1;
|
|
||||||
|
|
||||||
if (retire.Type == "OFFICER")
|
if (retire.Type == "OFFICER")
|
||||||
{
|
{
|
||||||
|
|
@ -928,7 +924,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
{
|
{
|
||||||
var data = new RetirementProfile
|
var data = new RetirementProfile
|
||||||
{
|
{
|
||||||
Order = num,
|
Order = numRaw,
|
||||||
Remove = "ADD",
|
Remove = "ADD",
|
||||||
RetirementPeriod = retire,
|
RetirementPeriod = retire,
|
||||||
CreatedFullName = FullName ?? "System Administrator",
|
CreatedFullName = FullName ?? "System Administrator",
|
||||||
|
|
@ -940,7 +936,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
};
|
};
|
||||||
var dataRaw = new RetirementRawProfile
|
var dataRaw = new RetirementRawProfile
|
||||||
{
|
{
|
||||||
Order = profileRawCount + 1,
|
Order = numRaw,
|
||||||
Remove = "ADD",
|
Remove = "ADD",
|
||||||
RetirementPeriod = retire,
|
RetirementPeriod = retire,
|
||||||
CreatedFullName = FullName ?? "System Administrator",
|
CreatedFullName = FullName ?? "System Administrator",
|
||||||
|
|
@ -1045,7 +1041,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
{
|
{
|
||||||
var data = new RetirementProfile
|
var data = new RetirementProfile
|
||||||
{
|
{
|
||||||
Order = num,
|
Order = numRaw,
|
||||||
Remove = "ADD",
|
Remove = "ADD",
|
||||||
RetirementPeriod = retire,
|
RetirementPeriod = retire,
|
||||||
CreatedFullName = FullName ?? "System Administrator",
|
CreatedFullName = FullName ?? "System Administrator",
|
||||||
|
|
@ -1057,7 +1053,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
};
|
};
|
||||||
var dataRaw = new RetirementRawProfile
|
var dataRaw = new RetirementRawProfile
|
||||||
{
|
{
|
||||||
Order = profileRawCount + 1,
|
Order = numRaw,
|
||||||
Remove = "ADD",
|
Remove = "ADD",
|
||||||
RetirementPeriod = retire,
|
RetirementPeriod = retire,
|
||||||
CreatedFullName = FullName ?? "System Administrator",
|
CreatedFullName = FullName ?? "System Administrator",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue