ส่งวินัยไปออกคำสั่ง
This commit is contained in:
parent
e8a288b4b2
commit
f644654384
21 changed files with 24913 additions and 84 deletions
|
|
@ -459,6 +459,7 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers
|
|||
PosNo = p.PosNo,
|
||||
Organization = p.Organization,
|
||||
IsSend = p.IsReport,
|
||||
IsSuspend = p.IsSuspend,
|
||||
Status = p.Status,
|
||||
StatusDiscard = p.StatusDiscard,
|
||||
Report = p.DisciplineReport_Profiles.Count() > 0 ? true : false,
|
||||
|
|
@ -680,7 +681,8 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers
|
|||
PosNo = item.posNo,
|
||||
Status = isReport == null ? "NEW" : isReport.Status,
|
||||
StatusDiscard = isReport == null ? "NEW" : isReport.StatusDiscard,
|
||||
IsReport = isReport == null ? false : isReport.IsReport,
|
||||
IsReport = isReport == null ? "NEW" : isReport.IsReport,
|
||||
IsSuspend = isReport == null ? "NEW" : isReport.IsSuspend,
|
||||
CreatedFullName = FullName ?? "System Administrator",
|
||||
CreatedUserId = UserId ?? "",
|
||||
CreatedAt = DateTime.Now,
|
||||
|
|
@ -1480,29 +1482,29 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers
|
|||
var personIdDupicate = data.DisciplineDisciplinary_ProfileComplaintInvestigates.Where(x => x.PersonId == item.PersonId && x.Status == "NEW").FirstOrDefault();
|
||||
if (personIdDupicate == null)
|
||||
continue;
|
||||
if (personIdDupicate.DisciplineReport_Profiles.Count() > 0)
|
||||
continue;
|
||||
personIdDupicate.DisciplineReport_Profiles.Add(
|
||||
new DisciplineReport_Profile
|
||||
{
|
||||
PersonId = item.PersonId,
|
||||
CitizenId = item.CitizenId,
|
||||
Prefix = item.Prefix,
|
||||
FirstName = item.FirstName,
|
||||
LastName = item.LastName,
|
||||
Organization = item.Organization,
|
||||
Salary = item.Salary,
|
||||
PosNo = item.PosNo,
|
||||
Position = item.Position,
|
||||
PositionLevel = item.PositionLevel,
|
||||
Status = "PENDING",
|
||||
CreatedFullName = FullName ?? "System Administrator",
|
||||
CreatedUserId = UserId ?? "",
|
||||
CreatedAt = DateTime.Now,
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
});
|
||||
// if (personIdDupicate.DisciplineReport_Profiles.Count() > 0)
|
||||
// continue;
|
||||
// personIdDupicate.DisciplineReport_Profiles.Add(
|
||||
// new DisciplineReport_Profile
|
||||
// {
|
||||
// PersonId = item.PersonId,
|
||||
// CitizenId = item.CitizenId,
|
||||
// Prefix = item.Prefix,
|
||||
// FirstName = item.FirstName,
|
||||
// LastName = item.LastName,
|
||||
// Organization = item.Organization,
|
||||
// Salary = item.Salary,
|
||||
// PosNo = item.PosNo,
|
||||
// Position = item.Position,
|
||||
// PositionLevel = item.PositionLevel,
|
||||
// Status = "PENDING",
|
||||
// CreatedFullName = FullName ?? "System Administrator",
|
||||
// CreatedUserId = UserId ?? "",
|
||||
// CreatedAt = DateTime.Now,
|
||||
// LastUpdateFullName = FullName ?? "System Administrator",
|
||||
// LastUpdateUserId = UserId ?? "",
|
||||
// LastUpdatedAt = DateTime.Now,
|
||||
// });
|
||||
item.CommandTypeId = commandTypeId;
|
||||
item.Status = "REPORT";
|
||||
item.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
|
|
@ -1537,6 +1539,65 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers
|
|||
foreach (var item in persons)
|
||||
{
|
||||
var personIdDupicate = data.DisciplineDisciplinary_ProfileComplaintInvestigates.Where(x => x.PersonId == item.PersonId && x.Status == "REPORT" && x.StatusDiscard == "NEW").FirstOrDefault();
|
||||
if (personIdDupicate == null)
|
||||
continue;
|
||||
// if (personIdDupicate.DisciplineReport_Profiles.Count() > 0)
|
||||
// continue;
|
||||
// personIdDupicate.DisciplineReport_Profiles.Add(
|
||||
// new DisciplineReport_Profile
|
||||
// {
|
||||
// PersonId = item.PersonId,
|
||||
// CitizenId = item.CitizenId,
|
||||
// Prefix = item.Prefix,
|
||||
// FirstName = item.FirstName,
|
||||
// LastName = item.LastName,
|
||||
// Organization = item.Organization,
|
||||
// Salary = item.Salary,
|
||||
// PosNo = item.PosNo,
|
||||
// Position = item.Position,
|
||||
// PositionLevel = item.PositionLevel,
|
||||
// Status = "PENDING",
|
||||
// CreatedFullName = FullName ?? "System Administrator",
|
||||
// CreatedUserId = UserId ?? "",
|
||||
// CreatedAt = DateTime.Now,
|
||||
// LastUpdateFullName = FullName ?? "System Administrator",
|
||||
// LastUpdateUserId = UserId ?? "",
|
||||
// LastUpdatedAt = DateTime.Now,
|
||||
// });
|
||||
item.CommandTypeDiscardId = commandTypeId;
|
||||
item.StatusDiscard = "REPORT";
|
||||
item.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
item.LastUpdateUserId = UserId ?? "";
|
||||
item.LastUpdatedAt = DateTime.Now;
|
||||
}
|
||||
|
||||
await _context.SaveChangesAsync();
|
||||
return Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// สั่งรายชื่อไปพักราชการ
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPut("suspend/{id:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> PostToSuspendGovernment([FromBody] DisciplinePersonIdRequest req, Guid id)
|
||||
{
|
||||
var data = await _context.DisciplineDisciplinarys
|
||||
.Include(x => x.DisciplineDisciplinary_ProfileComplaintInvestigates)
|
||||
.ThenInclude(x => x.DisciplineReport_Profiles)
|
||||
.Where(x => x.Id == id)
|
||||
.FirstOrDefaultAsync();
|
||||
if (data == null)
|
||||
return Error(new Exception(GlobalMessages.DataNotFound), StatusCodes.Status404NotFound);
|
||||
|
||||
var persons = data.DisciplineDisciplinary_ProfileComplaintInvestigates.Where(x => req.persons.Contains(x.Id)).ToList();
|
||||
foreach (var item in persons)
|
||||
{
|
||||
var personIdDupicate = data.DisciplineDisciplinary_ProfileComplaintInvestigates.Where(x => x.PersonId == item.PersonId && x.Status == "NEW").FirstOrDefault();
|
||||
if (personIdDupicate == null)
|
||||
continue;
|
||||
if (personIdDupicate.DisciplineReport_Profiles.Count() > 0)
|
||||
|
|
@ -1562,8 +1623,7 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers
|
|||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
});
|
||||
item.CommandTypeDiscardId = commandTypeId;
|
||||
item.StatusDiscard = "REPORT";
|
||||
item.IsSuspend = "REPORT";
|
||||
item.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
item.LastUpdateUserId = UserId ?? "";
|
||||
item.LastUpdatedAt = DateTime.Now;
|
||||
|
|
@ -1620,7 +1680,7 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers
|
|||
continue;
|
||||
|
||||
// uppdated.CommandTypeId = commandTypeId;
|
||||
uppdated.IsReport = true;
|
||||
uppdated.IsReport = "REPORT";
|
||||
uppdated.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
uppdated.LastUpdateUserId = UserId ?? "";
|
||||
uppdated.LastUpdatedAt = DateTime.Now;
|
||||
|
|
@ -1629,5 +1689,33 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers
|
|||
await _context.SaveChangesAsync();
|
||||
return Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ระบุหน้าที่กรรมการ
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPut("director/{disciplineId:guid}/{id:guid}")]
|
||||
public async Task<ActionResult<ResponseObject>> AddDutyDisciplineDisciplinary([FromBody] DisciplineDutyRequest req, Guid disciplineId, Guid id)
|
||||
{
|
||||
var data = await _context.DisciplineDisciplinarys
|
||||
.Include(x => x.DisciplineDisciplinary_DirectorInvestigates)
|
||||
.Where(x => x.Id == disciplineId)
|
||||
.FirstOrDefaultAsync();
|
||||
if (data == null)
|
||||
return Error(new Exception(GlobalMessages.DataNotFound), StatusCodes.Status404NotFound);
|
||||
var director = data.DisciplineDisciplinary_DirectorInvestigates.FirstOrDefault(x => x.Id == id);
|
||||
if (director == null)
|
||||
return Error(new Exception(GlobalMessages.DataNotFound), StatusCodes.Status404NotFound);
|
||||
director.Duty = req.duty;
|
||||
director.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
director.LastUpdateUserId = UserId ?? "";
|
||||
director.LastUpdatedAt = DateTime.Now;
|
||||
await _context.SaveChangesAsync();
|
||||
return Success();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue