แก้ไขบั้ก api คำสั่ง เลือกรายชื่อเพื่อทำคำสั่ง

This commit is contained in:
Suphonchai Phoonsawat 2023-08-31 10:26:53 +07:00
parent 52d80eebb4
commit 89c7b6e239
2 changed files with 49 additions and 19 deletions

View file

@ -289,7 +289,6 @@ namespace BMA.EHR.Application.Repositories.Commands
.Where(x => !otherCommandReceivers.Contains(x.CitizenId!))
.Where(x => x.PlacementStatus.Trim().ToUpper() == "PREPARE-CONTAIN")
.Where(x => x.Draft! == true)
// .Where(x => x.Placement!.PlacementType!.Name != "สอบแข่งขัน")
.OrderBy(x => x.ExamNumber)
.ToListAsync();
@ -298,7 +297,7 @@ namespace BMA.EHR.Application.Repositories.Commands
foreach (var item in appointPeople)
{
var profile_oc = await GetProfileOrganizationAsync(item.CitizenId!);
if ((await CheckIsActiveOfficerAsync(item.CitizenId!)) && item.OrganizationPosition!.Organization!.Id == profile_oc)
if (await CheckIsActiveOfficerAsync(item.CitizenId!))
{
var receiver = new CommandReceiver
{
@ -351,11 +350,9 @@ namespace BMA.EHR.Application.Repositories.Commands
.Include(x => x.Prefix)
.Include(x => x.OrganizationPosition)
.ThenInclude(x => x!.Organization)
//.Where(x => x.OrganizationPosition!.Organization!.Id == command.OwnerGovId)
.Where(x => !otherCommandReceivers.Contains(x.CitizenId!))
.Where(x => x.PlacementStatus.Trim().ToUpper() == "PREPARE-CONTAIN")
.Where(x => x.Draft! == true)
// .Where(x => x.Placement!.PlacementType!.Name != "สอบแข่งขัน")
.OrderBy(x => x.ExamNumber)
.ToListAsync();
@ -364,7 +361,7 @@ namespace BMA.EHR.Application.Repositories.Commands
foreach (var item in appointPeople)
{
var profile_oc = await GetProfileOrganizationAsync(item.CitizenId!);
if ((await CheckIsActiveOfficerAsync(item.CitizenId!)) && item.OrganizationPosition!.Organization!.Id != profile_oc)
if (await CheckIsActiveOfficerAsync(item.CitizenId!))
{
var receiver = new CommandReceiver
{
@ -531,13 +528,15 @@ namespace BMA.EHR.Application.Repositories.Commands
.ToListAsync();
// 2. Query
var appointPeople = await _dbContext.Set<PlacementRelocation>()
var appointPeople = await _dbContext.Set<PlacementAppointment>()
.Include(x => x.CommandType)
.Include(x => x.Prefix)
.Include(x => x.OrganizationPosition)
.ThenInclude(x => x!.Organization)
//.Where(x => x.OrganizationPosition!.Organization!.Id == command.OwnerGovId)
.Where(x => !otherCommandReceivers.Contains(x.CitizenId!))
.Where(x => x.Status.Trim().ToUpper() == "REPORT")
.Where(x => x.CommandType!.Id == command.CommandType!.Id)
.OrderBy(x => x.CitizenId)
.ToListAsync();