แสดง status คำสั่ง

แก้ไขบั้กเลือกคนแล้วบันทึกไม่ลง
This commit is contained in:
Suphonchai Phoonsawat 2023-08-31 12:13:33 +07:00
parent 89c7b6e239
commit 0ca1a22ea6
2 changed files with 21 additions and 17 deletions

View file

@ -65,7 +65,7 @@ namespace BMA.EHR.Application.Repositories.Commands
#region " List Receiver "
private async Task<List<CommandReceiver>> GetReceiverForByCommndTypeAsync(Command command)
public async Task<List<CommandReceiver>> GetReceiverForByCommndTypeAsync(Command command)
{
var result = new List<CommandReceiver>();
@ -708,7 +708,7 @@ namespace BMA.EHR.Application.Repositories.Commands
.ToListAsync();
// 2. Query
var appointPeople = await _dbContext.Set<PlacementTransfer>()
var appointPeople = await _dbContext.Set<PlacementTransfer>()
.Include(x => x.Profile)
.ThenInclude(x => x.Prefix)
//.Where(x => x.OrganizationPosition!.Organization!.Id == command.OwnerGovId)
@ -1607,33 +1607,34 @@ namespace BMA.EHR.Application.Repositories.Commands
if (command == null)
throw new Exception(GlobalMessages.CommandNotFound);
var appointPeople = await _dbContext.Set<PlacementProfile>()
.Include(x => x.Prefix)
.Include(x => x.OrganizationPosition)
.ThenInclude(x => x!.Organization)
//.Where(x => x.OrganizationPosition!.Organization!.Id == command.OwnerGovId)
.Where(x => selected.Contains(x.Id))
.OrderBy(x => x.ExamNumber)
.ToListAsync();
var ap = (await GetReceiverForByCommndTypeAsync(command)).Where(x => selected.Contains(x.RefPlacementProfileId!.Value));
//var appointPeople = await _dbContext.Set<PlacementProfile>()
// .Include(x => x.Prefix)
// .Include(x => x.OrganizationPosition)
// .ThenInclude(x => x!.Organization)
// //.Where(x => x.OrganizationPosition!.Organization!.Id == command.OwnerGovId)
// .Where(x => selected.Contains(x.Id))
// .OrderBy(x => x.ExamNumber)
// .ToListAsync();
_dbContext.Set<CommandReceiver>().RemoveRange(command.Receivers);
await _dbContext.SaveChangesAsync();
var seq = 1;
foreach (var item in appointPeople)
foreach (var item in ap)
{
var receiver = new CommandReceiver
{
Sequence = seq,
CitizenId = item.CitizenId!,
Prefix = item.Prefix!.Name,
FirstName = item.Firstname!,
LastName = item.Lastname!,
RefPlacementProfileId = item.Id
Prefix = item.Prefix,
FirstName = item.FirstName!,
LastName = item.LastName!,
RefPlacementProfileId = item.RefPlacementProfileId
};
seq++;
seq++;
command.Receivers.Add(receiver);
}
await _dbContext.SaveChangesAsync();

View file

@ -393,6 +393,9 @@ namespace BMA.EHR.Command.Service.Controllers
conclusionFireDate = data.ConclusionFireDate,
conclusionFireResolution = data.ConclusionFireResolution,
OrderStatusValue = data.CommandStatusId,
OrderStatusName = data.CommandStatus.Name,
};
return Success(result);