ออกคำสี่ง สรุปผลวินัย
This commit is contained in:
parent
d5a78f2d0f
commit
36395c20f2
9 changed files with 10493 additions and 8953 deletions
|
|
@ -194,38 +194,38 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers
|
|||
data.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
data.LastUpdateUserId = UserId ?? "";
|
||||
data.LastUpdatedAt = DateTime.Now;
|
||||
var hisprofile = data.DisciplineDisciplinary_ProfileComplaintInvestigates;
|
||||
_context.DisciplineDisciplinary_ProfileComplaintInvestigates.RemoveRange(data.DisciplineDisciplinary_ProfileComplaintInvestigates);
|
||||
if (data.RespondentType.Trim().ToUpper() == "PERSON")
|
||||
{
|
||||
foreach (var item in req.persons)
|
||||
{
|
||||
var isReport = hisprofile.Where(x => x.PersonId == item.personId).FirstOrDefault();
|
||||
data.DisciplineDisciplinary_ProfileComplaintInvestigates.Add(
|
||||
new DisciplineDisciplinary_ProfileComplaintInvestigate
|
||||
{
|
||||
CitizenId = item.idcard,
|
||||
Prefix = item.prefix,
|
||||
FirstName = item.firstName,
|
||||
LastName = item.lastName,
|
||||
Organization = item.organization,
|
||||
Position = item.position,
|
||||
PositionLevel = item.positionLevel,
|
||||
Salary = item.salary,
|
||||
PersonId = item.personId,
|
||||
PosNo = item.posNo,
|
||||
Status = "NEW",
|
||||
IsReport = isReport == null ? false : isReport.IsReport,
|
||||
CreatedFullName = FullName ?? "System Administrator",
|
||||
CreatedUserId = UserId ?? "",
|
||||
CreatedAt = DateTime.Now,
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
// var hisprofile = data.DisciplineDisciplinary_ProfileComplaintInvestigates;
|
||||
// _context.DisciplineDisciplinary_ProfileComplaintInvestigates.RemoveRange(data.DisciplineDisciplinary_ProfileComplaintInvestigates);
|
||||
// if (data.RespondentType.Trim().ToUpper() == "PERSON")
|
||||
// {
|
||||
// foreach (var item in req.persons)
|
||||
// {
|
||||
// var isReport = hisprofile.Where(x => x.PersonId == item.personId).FirstOrDefault();
|
||||
// data.DisciplineDisciplinary_ProfileComplaintInvestigates.Add(
|
||||
// new DisciplineDisciplinary_ProfileComplaintInvestigate
|
||||
// {
|
||||
// CitizenId = item.idcard,
|
||||
// Prefix = item.prefix,
|
||||
// FirstName = item.firstName,
|
||||
// LastName = item.lastName,
|
||||
// Organization = item.organization,
|
||||
// Position = item.position,
|
||||
// PositionLevel = item.positionLevel,
|
||||
// Salary = item.salary,
|
||||
// PersonId = item.personId,
|
||||
// PosNo = item.posNo,
|
||||
// Status = "NEW",
|
||||
// IsReport = isReport == null ? false : isReport.IsReport,
|
||||
// CreatedFullName = FullName ?? "System Administrator",
|
||||
// CreatedUserId = UserId ?? "",
|
||||
// CreatedAt = DateTime.Now,
|
||||
// LastUpdateFullName = FullName ?? "System Administrator",
|
||||
// LastUpdateUserId = UserId ?? "",
|
||||
// LastUpdatedAt = DateTime.Now,
|
||||
// }
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
await _context.SaveChangesAsync();
|
||||
return Success(data.Id);
|
||||
}
|
||||
|
|
@ -459,6 +459,8 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers
|
|||
PosNo = p.PosNo,
|
||||
Organization = p.Organization,
|
||||
IsSend = p.IsReport,
|
||||
Status = p.Status,
|
||||
StatusDiscard = p.StatusDiscard,
|
||||
Report = p.DisciplineReport_Profiles.Count() > 0 ? true : false,
|
||||
}),//รายการข้อมูลบุคลผู้ถูกสืบสวน
|
||||
OrganizationId = x.Organization,//id หน่วยงานกรณี type เป็นหน่วยงาน
|
||||
|
|
@ -676,7 +678,8 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers
|
|||
Salary = item.salary,
|
||||
PersonId = item.personId,
|
||||
PosNo = item.posNo,
|
||||
Status = "NEW",
|
||||
Status = isReport == null ? "NEW" : isReport.Status,
|
||||
StatusDiscard = isReport == null ? "NEW" : isReport.StatusDiscard,
|
||||
IsReport = isReport == null ? false : isReport.IsReport,
|
||||
CreatedFullName = FullName ?? "System Administrator",
|
||||
CreatedUserId = UserId ?? "",
|
||||
|
|
@ -1460,8 +1463,8 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers
|
|||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPut("suspend/{id:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> PostToSuspend([FromBody] DisciplinePersonIdRequest req, Guid id)
|
||||
[HttpPut("suspend/{id:length(36)}/{commandTypeId:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> PostToSuspend([FromBody] DisciplinePersonIdRequest req, Guid id, Guid commandTypeId)
|
||||
{
|
||||
var data = await _context.DisciplineDisciplinarys
|
||||
.Include(x => x.DisciplineDisciplinary_ProfileComplaintInvestigates)
|
||||
|
|
@ -1474,7 +1477,7 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers
|
|||
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).FirstOrDefault();
|
||||
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)
|
||||
|
|
@ -1500,7 +1503,43 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers
|
|||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
});
|
||||
item.Status = "SUSPEND";
|
||||
item.CommandTypeId = commandTypeId;
|
||||
item.Status = "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("discard/{id:length(36)}/{commandTypeId:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> PostToDiscard([FromBody] DisciplinePersonIdRequest req, Guid id, Guid commandTypeId)
|
||||
{
|
||||
var data = await _context.DisciplineDisciplinarys
|
||||
.Include(x => x.DisciplineDisciplinary_ProfileComplaintInvestigates)
|
||||
.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 == "REPORT" && x.StatusDiscard == "NEW").FirstOrDefault();
|
||||
if (personIdDupicate == null)
|
||||
continue;
|
||||
item.CommandTypeDiscardId = commandTypeId;
|
||||
item.StatusDiscard = "REPORT";
|
||||
item.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
item.LastUpdateUserId = UserId ?? "";
|
||||
item.LastUpdatedAt = DateTime.Now;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue