fix ออกคำสั่ง

This commit is contained in:
Bright 2024-10-16 16:31:40 +07:00
parent 38259fdea5
commit 111b638d9e
3 changed files with 185 additions and 184 deletions

View file

@ -2329,7 +2329,7 @@ namespace BMA.EHR.Placement.Service.Controllers
}
/// <summary>
/// ส่งรายชื่อออกคำสั่ง C-PM-39
/// ส่งรายชื่อออกคำสั่ง C-PM-06
/// </summary>
/// <returns></returns>
/// <response code="200"></response>
@ -2340,11 +2340,7 @@ namespace BMA.EHR.Placement.Service.Controllers
public async Task<ActionResult<ResponseObject>> PostReportSlip([FromBody] ReportPersonRequest req)
{
var placementProfiles = await _context.PlacementProfiles
// .Include(x => x.Placement)
// .ThenInclude(x => x.PlacementType)
.Where(x => req.refIds.Contains(x.Id.ToString()))
// .Where(x => x.Placement!.PlacementType!.Name == "เลื่อนข้าราชการ")
// .Where(x => x.typeCommand.Trim().ToUpper() == "SLIP")
.ToListAsync();
placementProfiles.ForEach(profile => profile.PlacementStatus = "REPORT");
await _context.SaveChangesAsync();
@ -2352,7 +2348,7 @@ namespace BMA.EHR.Placement.Service.Controllers
}
/// <summary>
/// ลบรายชื่อออกคำสั่ง C-PM-39
/// ลบรายชื่อออกคำสั่ง C-PM-06
/// </summary>
/// <returns></returns>
/// <response code="200"></response>
@ -2364,15 +2360,15 @@ namespace BMA.EHR.Placement.Service.Controllers
{
var placementProfiles = await _context.PlacementProfiles
.Where(x => req.refIds.Contains(x.Id.ToString()))
// .Where(x => x.PlacementStatus.ToUpper() == "REPORT")
// .Where(x => x.Status.ToUpper() == "REPORT")
.ToListAsync();
placementProfiles.ForEach(profile => profile.PlacementStatus = "PREPARE-CONTAIN");
placementProfiles.ForEach(profile => profile.PlacementStatus = "PENDING");
await _context.SaveChangesAsync();
return Success();
}
/// <summary>
/// เอกสารแนบท้าย C-PM-39
/// เอกสารแนบท้าย C-PM-06
/// </summary>
/// <param name="id">Record Id ของคำสั่ง</param>
/// <param name="exportType">pdf, docx หรือ xlsx</param>
@ -2385,16 +2381,13 @@ namespace BMA.EHR.Placement.Service.Controllers
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> PostReportSlipAttachment([FromBody] ReportAttachmentRequest req)
public async Task<ActionResult<ResponseObject>> PostReporSlipAttachment([FromBody] ReportAttachmentRequest req)
{
try
{
var report_data = (from p in _context.PlacementProfiles
.Include(x => x.PlacementEducations)
// .ThenInclude(x => x.PlacementType)
.Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString()))
// .Where(x => x.Placement!.PlacementType!.Name == "เลื่อนข้าราชการ")
// .Where(x => x.typeCommand.Trim().ToUpper() == "SLIP")
.ToList()
join r in req.refIds
on p.Id.ToString() equals r.refId
@ -2404,26 +2397,27 @@ namespace BMA.EHR.Placement.Service.Controllers
No = r.Sequence.ToString().ToThaiNumber(),
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
Education = p.PlacementEducations == null || p.PlacementEducations.Count == 0 ? "" :
p.PlacementEducations.FirstOrDefault().Degree,
p.PlacementEducations.FirstOrDefault().Degree,
OldOc = (p.positionNameOld == null ? "" : p.positionNameOld) + "/" + (p.rootOld == null ? "" : p.rootOld),
OldPositionType = p.posTypeNameOld == null ? "" : p.posTypeNameOld,
OldPositionLevel = p.posLevelNameOld == null ? "" : p.posLevelNameOld,
OldPositionNumber = p.posMasterNoOld == null ? "" :
p.nodeOld == "4" ? $"{p.child4ShortNameOld}{p.posMasterNoOld}".ToThaiNumber() :
p.nodeOld == "3" ? $"{p.child3ShortNameOld}{p.posMasterNoOld}".ToThaiNumber() :
p.nodeOld == "2" ? $"{p.child2ShortNameOld}{p.posMasterNoOld}".ToThaiNumber() :
p.nodeOld == "1" ? $"{p.child1ShortNameOld}{p.posMasterNoOld}".ToThaiNumber() :
p.nodeOld == "0" ? $"{p.rootShortNameOld}{p.posMasterNoOld}".ToThaiNumber() : "",
p.nodeOld == "4" ? $"{p.child4ShortNameOld}{p.posMasterNoOld}".ToThaiNumber() :
p.nodeOld == "3" ? $"{p.child3ShortNameOld}{p.posMasterNoOld}".ToThaiNumber() :
p.nodeOld == "2" ? $"{p.child2ShortNameOld}{p.posMasterNoOld}".ToThaiNumber() :
p.nodeOld == "1" ? $"{p.child1ShortNameOld}{p.posMasterNoOld}".ToThaiNumber() :
p.nodeOld == "0" ? $"{p.rootShortNameOld}{p.posMasterNoOld}".ToThaiNumber() : "",
OldSalary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
LeaveDate = "",
NewOc = (p.positionName == null ? "" : p.positionName) + "/" + (p.root == null ? "" : p.root),
NewPositionType = p.posTypeName == null ? "" : p.posTypeName,
NewPositionLevel = p.posLevelName == null ? "" : p.posLevelName,
NewPositionNumber = p.posMasterNo == null ? "" :
p.node == 4 ? $"{p.child4ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 3 ? $"{p.child3ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 2 ? $"{p.child2ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 1 ? $"{p.child1ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 0 ? $"{p.rootShortName}{p.posMasterNo}".ToThaiNumber() : "",
p.node == 4 ? $"{p.child4ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 3 ? $"{p.child3ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 2 ? $"{p.child2ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 1 ? $"{p.child1ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 0 ? $"{p.rootShortName}{p.posMasterNo}".ToThaiNumber() : "",
NewSalary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
AppointDate = p.ReportingDate == null ? "" : p.ReportingDate.Value.ToThaiShortDate2().ToThaiNumber(),
RemarkHorizontal = r.RemarkHorizontal,
@ -2438,7 +2432,7 @@ namespace BMA.EHR.Placement.Service.Controllers
}
/// <summary>
/// ออกคำสั่ง C-PM-39 เลื่อนข้าราชการ
/// ออกคำสั่ง C-PM-06 เลื่อนข้าราชการ
/// </summary>
/// <returns></returns>
/// <response code="200"></response>