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

This commit is contained in:
kittapath 2024-10-07 22:35:34 +07:00
parent d128960111
commit 85d9754db6
8 changed files with 124 additions and 103 deletions

View file

@ -777,7 +777,7 @@ namespace BMA.EHR.Placement.Service.Controllers
.Where(x => req.refIds.Contains(x.Id.ToString()))
.Where(x => x.Status.ToUpper() == "REPORT")
.ToListAsync();
placementProfiles.ForEach(profile => profile.Status = "APPROVE");
placementProfiles.ForEach(profile => profile.Status = "PENDING");
await _context.SaveChangesAsync();
return Success();
}
@ -939,7 +939,7 @@ namespace BMA.EHR.Placement.Service.Controllers
.Where(x => req.refIds.Contains(x.Id.ToString()))
.Where(x => x.Status.ToUpper() == "REPORT")
.ToListAsync();
placementProfiles.ForEach(profile => profile.Status = "APPROVE");
placementProfiles.ForEach(profile => profile.Status = "PENDING");
await _context.SaveChangesAsync();
return Success();
}
@ -1101,7 +1101,7 @@ namespace BMA.EHR.Placement.Service.Controllers
.Where(x => req.refIds.Contains(x.Id.ToString()))
.Where(x => x.Status.ToUpper() == "REPORT")
.ToListAsync();
placementProfiles.ForEach(profile => profile.Status = "APPROVE");
placementProfiles.ForEach(profile => profile.Status = "PENDING");
await _context.SaveChangesAsync();
return Success();
}
@ -1265,7 +1265,7 @@ namespace BMA.EHR.Placement.Service.Controllers
.Where(x => x.type == "EMPLOYEE")
.Where(x => x.Status.ToUpper() == "REPORT")
.ToListAsync();
placementProfiles.ForEach(profile => profile.Status = "APPROVE");
placementProfiles.ForEach(profile => profile.Status = "PENDING");
await _context.SaveChangesAsync();
return Success();
}
@ -1422,7 +1422,7 @@ namespace BMA.EHR.Placement.Service.Controllers
.Where(x => x.type == "EMPLOYEE")
.Where(x => x.Status.ToUpper() == "REPORT")
.ToListAsync();
placementProfiles.ForEach(profile => profile.Status = "APPROVE");
placementProfiles.ForEach(profile => profile.Status = "PENDING");
await _context.SaveChangesAsync();
return Success();
}

View file

@ -614,7 +614,8 @@ namespace BMA.EHR.Placement.Service.Controllers
Total = x.PlacementProfiles.Count(),
UnContain = x.PlacementProfiles.Where(p => p.PlacementStatus.Trim().ToUpper() == "UN-CONTAIN").Count(),
PrepareContain = x.PlacementProfiles.Where(p => p.PlacementStatus.Trim().ToUpper() == "PREPARE-CONTAIN").Count(),
Contain = x.PlacementProfiles.Where(p => p.PlacementStatus.Trim().ToUpper() == "CONTAIN").Count(),
Report = x.PlacementProfiles.Where(p => p.PlacementStatus.Trim().ToUpper() == "REPORT").Count(),
Done = x.PlacementProfiles.Where(p => p.PlacementStatus.Trim().ToUpper() == "DONE").Count(),
Disclaim = x.PlacementProfiles.Where(p => p.PlacementStatus.Trim().ToUpper() == "DISCLAIM").Count(),
}).FirstOrDefaultAsync();
if (placement == null)
@ -658,7 +659,8 @@ namespace BMA.EHR.Placement.Service.Controllers
Total = x.PlacementProfiles.Where(x => x.Draft == true).Where(x => rootId == "" ? true : (child1Id == "" ? x.rootId == rootId : (child2Id == "" ? x.child1Id == child1Id : (child3Id == "" ? x.child2Id == child2Id : (child4Id == "" ? x.child3Id == child3Id : x.child4Id == child4Id))))).Count(),
UnContain = x.PlacementProfiles.Where(x => x.Draft == true).Where(x => rootId == "" ? true : (child1Id == "" ? x.rootId == rootId : (child2Id == "" ? x.child1Id == child1Id : (child3Id == "" ? x.child2Id == child2Id : (child4Id == "" ? x.child3Id == child3Id : x.child4Id == child4Id))))).Where(p => p.PlacementStatus.Trim().ToUpper() == "UN-CONTAIN").Count(),
PrepareContain = x.PlacementProfiles.Where(x => x.Draft == true).Where(x => rootId == "" ? true : (child1Id == "" ? x.rootId == rootId : (child2Id == "" ? x.child1Id == child1Id : (child3Id == "" ? x.child2Id == child2Id : (child4Id == "" ? x.child3Id == child3Id : x.child4Id == child4Id))))).Where(p => p.PlacementStatus.Trim().ToUpper() == "PREPARE-CONTAIN").Count(),
Contain = x.PlacementProfiles.Where(x => x.Draft == true).Where(x => rootId == "" ? true : (child1Id == "" ? x.rootId == rootId : (child2Id == "" ? x.child1Id == child1Id : (child3Id == "" ? x.child2Id == child2Id : (child4Id == "" ? x.child3Id == child3Id : x.child4Id == child4Id))))).Where(p => p.PlacementStatus.Trim().ToUpper() == "CONTAIN").Count(),
Report = x.PlacementProfiles.Where(x => x.Draft == true).Where(x => rootId == "" ? true : (child1Id == "" ? x.rootId == rootId : (child2Id == "" ? x.child1Id == child1Id : (child3Id == "" ? x.child2Id == child2Id : (child4Id == "" ? x.child3Id == child3Id : x.child4Id == child4Id))))).Where(p => p.PlacementStatus.Trim().ToUpper() == "REPORT").Count(),
Done = x.PlacementProfiles.Where(x => x.Draft == true).Where(x => rootId == "" ? true : (child1Id == "" ? x.rootId == rootId : (child2Id == "" ? x.child1Id == child1Id : (child3Id == "" ? x.child2Id == child2Id : (child4Id == "" ? x.child3Id == child3Id : x.child4Id == child4Id))))).Where(p => p.PlacementStatus.Trim().ToUpper() == "DONE").Count(),
Disclaim = x.PlacementProfiles.Where(x => x.Draft == true).Where(x => rootId == "" ? true : (child1Id == "" ? x.rootId == rootId : (child2Id == "" ? x.child1Id == child1Id : (child3Id == "" ? x.child2Id == child2Id : (child4Id == "" ? x.child3Id == child3Id : x.child4Id == child4Id))))).Where(p => p.PlacementStatus.Trim().ToUpper() == "DISCLAIM").Count(),
}).FirstOrDefaultAsync();
if (placement == null)
@ -1455,7 +1457,7 @@ namespace BMA.EHR.Placement.Service.Controllers
{
var position = await _context.PlacementProfiles
.Where(x => x.posmasterId != null)
.Where(x => x.PlacementStatus != "CONTAIN")
.Where(x => x.PlacementStatus != "DONE" && x.PlacementStatus != "REPORT")
.Select(x => x.posmasterId)
.ToListAsync();
return Success(position);
@ -1479,7 +1481,7 @@ namespace BMA.EHR.Placement.Service.Controllers
.Where(x => x.Placement!.PlacementType!.Name != "สอบแข่งขัน")
.Where(x => x.typeCommand.Trim().ToUpper() == "APPOINTED")
.ToListAsync();
placementProfiles.ForEach(profile => profile.PlacementStatus = "PREPARE-CONTAIN");
placementProfiles.ForEach(profile => profile.PlacementStatus = "REPORT");
await _context.SaveChangesAsync();
return Success();
}
@ -1497,7 +1499,7 @@ namespace BMA.EHR.Placement.Service.Controllers
{
var placementProfiles = await _context.PlacementProfiles
.Where(x => req.refIds.Contains(x.Id.ToString()))
.Where(x => x.PlacementStatus.ToUpper() == "PREPARE-CONTAIN")
.Where(x => x.PlacementStatus.ToUpper() == "REPORT")
.ToListAsync();
placementProfiles.ForEach(profile => profile.PlacementStatus = "PREPARE-CONTAIN");
await _context.SaveChangesAsync();
@ -1746,7 +1748,7 @@ namespace BMA.EHR.Placement.Service.Controllers
var _result = await _res.Content.ReadAsStringAsync();
}
// update placementstatus
placementProfile.PlacementStatus = "CONTAIN";//DONE
placementProfile.PlacementStatus = "DONE";//DONE
await _context.SaveChangesAsync();
}
@ -1772,7 +1774,7 @@ namespace BMA.EHR.Placement.Service.Controllers
.Where(x => x.Placement!.PlacementType!.Name != "สอบแข่งขัน")
.Where(x => x.typeCommand.Trim().ToUpper() == "APPOINTED")
.ToListAsync();
placementProfiles.ForEach(profile => profile.PlacementStatus = "PREPARE-CONTAIN");
placementProfiles.ForEach(profile => profile.PlacementStatus = "REPORT");
await _context.SaveChangesAsync();
return Success();
}
@ -1790,9 +1792,9 @@ namespace BMA.EHR.Placement.Service.Controllers
{
var placementProfiles = await _context.PlacementProfiles
.Where(x => req.refIds.Contains(x.Id.ToString()))
.Where(x => x.PlacementStatus.ToUpper() == "PREPARE-CONTAIN")
.Where(x => x.PlacementStatus.ToUpper() == "REPORT")
.ToListAsync();
placementProfiles.ForEach(profile => profile.PlacementStatus = "PREPARE-CONTAIN");
placementProfiles.ForEach(profile => profile.PlacementStatus = "PREPARE-CONTAI");
await _context.SaveChangesAsync();
return Success();
}
@ -2039,7 +2041,7 @@ namespace BMA.EHR.Placement.Service.Controllers
var _result = await _res.Content.ReadAsStringAsync();
}
// update placementstatus
placementProfile.PlacementStatus = "CONTAIN";//DONE
placementProfile.PlacementStatus = "DONE";//DONE
await _context.SaveChangesAsync();
}
@ -2064,7 +2066,7 @@ namespace BMA.EHR.Placement.Service.Controllers
.Where(x => x.Placement!.PlacementType!.Name == "แต่งตั้งข้าราชการ")
.Where(x => x.typeCommand.Trim().ToUpper() == "APPOIN")
.ToListAsync();
placementProfiles.ForEach(profile => profile.PlacementStatus = "PREPARE-CONTAIN");
placementProfiles.ForEach(profile => profile.PlacementStatus = "REPORT");
await _context.SaveChangesAsync();
return Success();
}
@ -2082,7 +2084,7 @@ namespace BMA.EHR.Placement.Service.Controllers
{
var placementProfiles = await _context.PlacementProfiles
.Where(x => req.refIds.Contains(x.Id.ToString()))
.Where(x => x.PlacementStatus.ToUpper() == "PREPARE-CONTAIN")
.Where(x => x.PlacementStatus.ToUpper() == "REPORT")
.ToListAsync();
placementProfiles.ForEach(profile => profile.PlacementStatus = "PREPARE-CONTAIN");
await _context.SaveChangesAsync();
@ -2215,7 +2217,7 @@ namespace BMA.EHR.Placement.Service.Controllers
var _result = await _res.Content.ReadAsStringAsync();
if (_res.IsSuccessStatusCode)
{
data.ForEach(profile => profile.PlacementStatus = "CONTAIN");
data.ForEach(profile => profile.PlacementStatus = "DONE");
await _context.SaveChangesAsync();
}
}
@ -2240,7 +2242,7 @@ namespace BMA.EHR.Placement.Service.Controllers
.Where(x => x.Placement!.PlacementType!.Name == "ย้ายข้าราชการ")
.Where(x => x.typeCommand.Trim().ToUpper() == "MOVE")
.ToListAsync();
placementProfiles.ForEach(profile => profile.PlacementStatus = "PREPARE-CONTAIN");
placementProfiles.ForEach(profile => profile.PlacementStatus = "REPORT");
await _context.SaveChangesAsync();
return Success();
}
@ -2258,7 +2260,7 @@ namespace BMA.EHR.Placement.Service.Controllers
{
var placementProfiles = await _context.PlacementProfiles
.Where(x => req.refIds.Contains(x.Id.ToString()))
.Where(x => x.PlacementStatus.ToUpper() == "PREPARE-CONTAIN")
.Where(x => x.PlacementStatus.ToUpper() == "REPORT")
.ToListAsync();
placementProfiles.ForEach(profile => profile.PlacementStatus = "PREPARE-CONTAIN");
await _context.SaveChangesAsync();
@ -2389,7 +2391,7 @@ namespace BMA.EHR.Placement.Service.Controllers
var _result = await _res.Content.ReadAsStringAsync();
if (_res.IsSuccessStatusCode)
{
data.ForEach(profile => profile.PlacementStatus = "CONTAIN");
data.ForEach(profile => profile.PlacementStatus = "DONE");
await _context.SaveChangesAsync();
}
}
@ -2414,7 +2416,7 @@ namespace BMA.EHR.Placement.Service.Controllers
.Where(x => x.Placement!.PlacementType!.Name == "เลื่อนข้าราชการ")
.Where(x => x.typeCommand.Trim().ToUpper() == "SLIP")
.ToListAsync();
placementProfiles.ForEach(profile => profile.PlacementStatus = "PREPARE-CONTAIN");
placementProfiles.ForEach(profile => profile.PlacementStatus = "REPORT");
await _context.SaveChangesAsync();
return Success();
}
@ -2432,7 +2434,7 @@ namespace BMA.EHR.Placement.Service.Controllers
{
var placementProfiles = await _context.PlacementProfiles
.Where(x => req.refIds.Contains(x.Id.ToString()))
.Where(x => x.PlacementStatus.ToUpper() == "PREPARE-CONTAIN")
.Where(x => x.PlacementStatus.ToUpper() == "REPORT")
.ToListAsync();
placementProfiles.ForEach(profile => profile.PlacementStatus = "PREPARE-CONTAIN");
await _context.SaveChangesAsync();
@ -2563,7 +2565,7 @@ namespace BMA.EHR.Placement.Service.Controllers
var _result = await _res.Content.ReadAsStringAsync();
if (_res.IsSuccessStatusCode)
{
data.ForEach(profile => profile.PlacementStatus = "CONTAIN");
data.ForEach(profile => profile.PlacementStatus = "DONE");
await _context.SaveChangesAsync();
}
}

View file

@ -914,7 +914,7 @@ namespace BMA.EHR.Placement.Service.Controllers
.Where(x => req.refIds.Contains(x.Id.ToString()))
.Where(x => x.Status.ToUpper() == "REPORT")
.ToListAsync();
placementProfiles.ForEach(profile => profile.Status = "APPROVE");
placementProfiles.ForEach(profile => profile.Status = "PENDING");
await _context.SaveChangesAsync();
return Success();
}

View file

@ -495,6 +495,25 @@ namespace BMA.EHR.Placement.Service.Controllers
return Success();
}
/// <summary>
/// ลบส่งรายชื่อออกคำสั่ง C-PM-16
/// </summary>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("command/report/delete")]
public async Task<ActionResult<ResponseObject>> PostReportDelete([FromBody] ReportPersonRequest req)
{
var placementProfiles = await _context.PlacementRepatriations
.Where(x => req.refIds.Contains(x.Id.ToString()))
.ToListAsync();
placementProfiles.ForEach(profile => profile.Status = "APPROVE");
await _context.SaveChangesAsync();
return Success();
}
/// <summary>
/// ออกคำสั่ง C-PM-16 คำสั่งส่งตัวกลับ
/// </summary>

View file

@ -793,7 +793,7 @@ namespace BMA.EHR.Placement.Service.Controllers
.Where(x => req.refIds.Contains(x.Id.ToString()))
.Where(x => x.Status.ToUpper() == "REPORT")
.ToListAsync();
placementProfiles.ForEach(profile => profile.Status = "REPORTREPORT");
placementProfiles.ForEach(profile => profile.Status = "APPROVE");
await _context.SaveChangesAsync();
return Success();
}