Change API Put and Post CommandType 01-09
This commit is contained in:
parent
0aa0aedba9
commit
eba4e23bea
13 changed files with 17000 additions and 37 deletions
|
|
@ -364,22 +364,27 @@ namespace BMA.EHR.Command.Service.Controllers
|
|||
}
|
||||
}
|
||||
|
||||
#region " Put and Post "
|
||||
|
||||
#region " C-PM-01 "
|
||||
|
||||
/// <summary>
|
||||
/// PM7-22 : สร้างข้อมูลรายละเอียดการออกคำสั่ง
|
||||
/// PM7-22 : สร้างข้อมูลรายละเอียดการออกคำสั่ง C-PM-01
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPost("detail")]
|
||||
[HttpPost("c-pm-01/detail")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> PostAsync([FromBody] CreateCommandRequest req)
|
||||
public async Task<ActionResult<ResponseObject>> PostType01Async([FromBody] CreateCommandRequest req)
|
||||
{
|
||||
try
|
||||
{
|
||||
var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue);
|
||||
|
||||
var inserted = new Domain.Models.Commands.Core.Command
|
||||
{
|
||||
CommandNo = req.orderNo,
|
||||
|
|
@ -391,13 +396,16 @@ namespace BMA.EHR.Command.Service.Controllers
|
|||
IssuerOrganizationName = req.orderByOrganizationName,
|
||||
AuthorizedUserFullName = req.signatoryBy,
|
||||
AuthorizedPosition = req.signatoryPosition,
|
||||
|
||||
CommandAffectDate = req.orderDate,
|
||||
OwnerGovId = OcId,
|
||||
|
||||
// c-pm-01 ถึง c-pm-04
|
||||
PlacementId = req.examRound,
|
||||
ConclusionRegisterNo = req.conclusionRegisterNo,
|
||||
ConclusionRegisterNo = req.conclusionRegisterNo ?? "",
|
||||
ConclusionRegisterDate = req.conclusionRegisterDate,
|
||||
ConclusionResultNo = req.conclusionResultNo,
|
||||
ConclusionResultDate = req.conclusionResultDate,
|
||||
CommandAffectDate = req.orderDate,
|
||||
OwnerGovId = OcId
|
||||
|
||||
};
|
||||
|
||||
|
|
@ -412,18 +420,18 @@ namespace BMA.EHR.Command.Service.Controllers
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// PM7-23 : แก้ไขข้อมูลรายละเอียดการออกคำสั่ง
|
||||
/// PM7-23 : แก้ไขข้อมูลรายละเอียดการออกคำสั่ง C-PM-01
|
||||
/// </summary>
|
||||
/// <param name="orderId">Record Id ของคำสั่ง</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPut("detail/{orderId}")]
|
||||
[HttpPut("c-pm-01/detail/{orderId}")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> PutAsync(Guid orderId, [FromBody] CreateCommandRequest req)
|
||||
public async Task<ActionResult<ResponseObject>> PutType01Async(Guid orderId, [FromBody] CreateCommandRequest req)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
@ -431,7 +439,7 @@ namespace BMA.EHR.Command.Service.Controllers
|
|||
if (order == null)
|
||||
throw new Exception(GlobalMessages.CommandNotFound);
|
||||
|
||||
var placement = await _placementRepository.GetByIdAsync(req.examRound);
|
||||
|
||||
var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue);
|
||||
var status = await _commandStatusRepository.GetByIdAsync(order.CommandStatusId);
|
||||
|
||||
|
|
@ -444,11 +452,632 @@ namespace BMA.EHR.Command.Service.Controllers
|
|||
order.IssuerOrganizationName = req.orderByOrganizationName;
|
||||
order.AuthorizedUserFullName = req.signatoryBy;
|
||||
order.AuthorizedPosition = req.signatoryPosition;
|
||||
order.CommandStatus = status!;
|
||||
order.CommandAffectDate = req.orderDate;
|
||||
|
||||
// c-pm-01 ถึง c-pm-04
|
||||
|
||||
var placement = await _placementRepository.GetByIdAsync(req.examRound);
|
||||
order.Placement = placement!;
|
||||
order.ConclusionRegisterNo = req.conclusionRegisterNo;
|
||||
order.ConclusionRegisterDate = req.conclusionRegisterDate;
|
||||
order.ConclusionResultNo = req.conclusionResultNo;
|
||||
order.ConclusionResultDate = req.conclusionResultDate;
|
||||
|
||||
var result = await _repository.UpdateAsync(order);
|
||||
|
||||
return Success(result);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region " C-PM-02 "
|
||||
|
||||
/// <summary>
|
||||
/// PM7-22 : สร้างข้อมูลรายละเอียดการออกคำสั่ง C-PM-02
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPost("c-pm-02/detail")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> PostType02Async([FromBody] CreateCommandRequest req)
|
||||
{
|
||||
try
|
||||
{
|
||||
var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue);
|
||||
|
||||
var inserted = new Domain.Models.Commands.Core.Command
|
||||
{
|
||||
CommandNo = req.orderNo,
|
||||
CommandYear = req.orderYear.ToString(),
|
||||
CommandSubject = req.orderTitle,
|
||||
PositionName = req.registerPosition,
|
||||
CommandTypeId = req.orderTypeValue,
|
||||
IssuerOrganizationId = req.orderBy,
|
||||
IssuerOrganizationName = req.orderByOrganizationName,
|
||||
AuthorizedUserFullName = req.signatoryBy,
|
||||
AuthorizedPosition = req.signatoryPosition,
|
||||
|
||||
CommandAffectDate = req.orderDate,
|
||||
OwnerGovId = OcId,
|
||||
|
||||
// c-pm-01 ถึง c-pm-04
|
||||
PlacementId = req.examRound,
|
||||
ConclusionRegisterNo = req.conclusionRegisterNo ?? "",
|
||||
ConclusionRegisterDate = req.conclusionRegisterDate,
|
||||
ConclusionResultNo = req.conclusionResultNo,
|
||||
ConclusionResultDate = req.conclusionResultDate,
|
||||
|
||||
};
|
||||
|
||||
var result = await _repository.AddAsync(inserted);
|
||||
|
||||
return Success(result);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// PM7-23 : แก้ไขข้อมูลรายละเอียดการออกคำสั่ง C-PM-02
|
||||
/// </summary>
|
||||
/// <param name="orderId">Record Id ของคำสั่ง</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPut("c-pm-02/detail/{orderId}")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> PutType02Async(Guid orderId, [FromBody] CreateCommandRequest req)
|
||||
{
|
||||
try
|
||||
{
|
||||
var order = await _repository.GetByIdAsync(orderId);
|
||||
if (order == null)
|
||||
throw new Exception(GlobalMessages.CommandNotFound);
|
||||
|
||||
|
||||
var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue);
|
||||
var status = await _commandStatusRepository.GetByIdAsync(order.CommandStatusId);
|
||||
|
||||
order.CommandNo = req.orderNo;
|
||||
order.CommandYear = req.orderYear.ToString();
|
||||
order.CommandSubject = req.orderTitle;
|
||||
order.PositionName = req.registerPosition;
|
||||
order.CommandType = commandType!;
|
||||
order.IssuerOrganizationId = req.orderBy;
|
||||
order.IssuerOrganizationName = req.orderByOrganizationName;
|
||||
order.AuthorizedUserFullName = req.signatoryBy;
|
||||
order.AuthorizedPosition = req.signatoryPosition;
|
||||
order.CommandStatus = status!;
|
||||
order.CommandAffectDate = req.orderDate;
|
||||
|
||||
// c-pm-01 ถึง c-pm-04
|
||||
|
||||
var placement = await _placementRepository.GetByIdAsync(req.examRound);
|
||||
order.Placement = placement!;
|
||||
order.ConclusionRegisterNo = req.conclusionRegisterNo;
|
||||
order.ConclusionRegisterDate = req.conclusionRegisterDate;
|
||||
order.ConclusionResultNo = req.conclusionResultNo;
|
||||
order.ConclusionResultDate = req.conclusionResultDate;
|
||||
|
||||
var result = await _repository.UpdateAsync(order);
|
||||
|
||||
return Success(result);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region " C-PM-03 "
|
||||
|
||||
/// <summary>
|
||||
/// PM7-22 : สร้างข้อมูลรายละเอียดการออกคำสั่ง C-PM-03
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPost("c-pm-03/detail")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> PostType03Async([FromBody] CreateCommandRequest req)
|
||||
{
|
||||
try
|
||||
{
|
||||
var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue);
|
||||
|
||||
var inserted = new Domain.Models.Commands.Core.Command
|
||||
{
|
||||
CommandNo = req.orderNo,
|
||||
CommandYear = req.orderYear.ToString(),
|
||||
CommandSubject = req.orderTitle,
|
||||
PositionName = req.registerPosition,
|
||||
CommandTypeId = req.orderTypeValue,
|
||||
IssuerOrganizationId = req.orderBy,
|
||||
IssuerOrganizationName = req.orderByOrganizationName,
|
||||
AuthorizedUserFullName = req.signatoryBy,
|
||||
AuthorizedPosition = req.signatoryPosition,
|
||||
|
||||
CommandAffectDate = req.orderDate,
|
||||
OwnerGovId = OcId,
|
||||
|
||||
// c-pm-01 ถึง c-pm-04
|
||||
PlacementId = req.examRound,
|
||||
ConclusionRegisterNo = req.conclusionRegisterNo ?? "",
|
||||
ConclusionRegisterDate = req.conclusionRegisterDate,
|
||||
ConclusionResultNo = req.conclusionResultNo,
|
||||
ConclusionResultDate = req.conclusionResultDate,
|
||||
|
||||
};
|
||||
|
||||
var result = await _repository.AddAsync(inserted);
|
||||
|
||||
return Success(result);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// PM7-23 : แก้ไขข้อมูลรายละเอียดการออกคำสั่ง C-PM-04
|
||||
/// </summary>
|
||||
/// <param name="orderId">Record Id ของคำสั่ง</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPut("c-pm-03/detail/{orderId}")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> PutType03Async(Guid orderId, [FromBody] CreateCommandRequest req)
|
||||
{
|
||||
try
|
||||
{
|
||||
var order = await _repository.GetByIdAsync(orderId);
|
||||
if (order == null)
|
||||
throw new Exception(GlobalMessages.CommandNotFound);
|
||||
|
||||
|
||||
var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue);
|
||||
var status = await _commandStatusRepository.GetByIdAsync(order.CommandStatusId);
|
||||
|
||||
order.CommandNo = req.orderNo;
|
||||
order.CommandYear = req.orderYear.ToString();
|
||||
order.CommandSubject = req.orderTitle;
|
||||
order.PositionName = req.registerPosition;
|
||||
order.CommandType = commandType!;
|
||||
order.IssuerOrganizationId = req.orderBy;
|
||||
order.IssuerOrganizationName = req.orderByOrganizationName;
|
||||
order.AuthorizedUserFullName = req.signatoryBy;
|
||||
order.AuthorizedPosition = req.signatoryPosition;
|
||||
order.CommandStatus = status!;
|
||||
order.CommandAffectDate = req.orderDate;
|
||||
|
||||
// c-pm-01 ถึง c-pm-04
|
||||
|
||||
var placement = await _placementRepository.GetByIdAsync(req.examRound);
|
||||
order.Placement = placement!;
|
||||
order.ConclusionRegisterNo = req.conclusionRegisterNo;
|
||||
order.ConclusionRegisterDate = req.conclusionRegisterDate;
|
||||
order.ConclusionResultNo = req.conclusionResultNo;
|
||||
order.ConclusionResultDate = req.conclusionResultDate;
|
||||
|
||||
var result = await _repository.UpdateAsync(order);
|
||||
|
||||
return Success(result);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region " C-PM-04 "
|
||||
|
||||
/// <summary>
|
||||
/// PM7-22 : สร้างข้อมูลรายละเอียดการออกคำสั่ง C-PM-04
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPost("c-pm-04/detail")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> PostType04Async([FromBody] CreateCommandRequest req)
|
||||
{
|
||||
try
|
||||
{
|
||||
var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue);
|
||||
|
||||
var inserted = new Domain.Models.Commands.Core.Command
|
||||
{
|
||||
CommandNo = req.orderNo,
|
||||
CommandYear = req.orderYear.ToString(),
|
||||
CommandSubject = req.orderTitle,
|
||||
PositionName = req.registerPosition,
|
||||
CommandTypeId = req.orderTypeValue,
|
||||
IssuerOrganizationId = req.orderBy,
|
||||
IssuerOrganizationName = req.orderByOrganizationName,
|
||||
AuthorizedUserFullName = req.signatoryBy,
|
||||
AuthorizedPosition = req.signatoryPosition,
|
||||
|
||||
CommandAffectDate = req.orderDate,
|
||||
OwnerGovId = OcId,
|
||||
|
||||
// c-pm-01 ถึง c-pm-04
|
||||
PlacementId = req.examRound,
|
||||
ConclusionRegisterNo = req.conclusionRegisterNo ?? "",
|
||||
ConclusionRegisterDate = req.conclusionRegisterDate,
|
||||
ConclusionResultNo = req.conclusionResultNo,
|
||||
ConclusionResultDate = req.conclusionResultDate,
|
||||
|
||||
};
|
||||
|
||||
var result = await _repository.AddAsync(inserted);
|
||||
|
||||
return Success(result);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// PM7-23 : แก้ไขข้อมูลรายละเอียดการออกคำสั่ง C-PM-04
|
||||
/// </summary>
|
||||
/// <param name="orderId">Record Id ของคำสั่ง</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPut("c-pm-04/detail/{orderId}")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> PutType04Async(Guid orderId, [FromBody] CreateCommandRequest req)
|
||||
{
|
||||
try
|
||||
{
|
||||
var order = await _repository.GetByIdAsync(orderId);
|
||||
if (order == null)
|
||||
throw new Exception(GlobalMessages.CommandNotFound);
|
||||
|
||||
|
||||
var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue);
|
||||
var status = await _commandStatusRepository.GetByIdAsync(order.CommandStatusId);
|
||||
|
||||
order.CommandNo = req.orderNo;
|
||||
order.CommandYear = req.orderYear.ToString();
|
||||
order.CommandSubject = req.orderTitle;
|
||||
order.PositionName = req.registerPosition;
|
||||
order.CommandType = commandType!;
|
||||
order.IssuerOrganizationId = req.orderBy;
|
||||
order.IssuerOrganizationName = req.orderByOrganizationName;
|
||||
order.AuthorizedUserFullName = req.signatoryBy;
|
||||
order.AuthorizedPosition = req.signatoryPosition;
|
||||
order.CommandStatus = status!;
|
||||
order.CommandAffectDate = req.orderDate;
|
||||
|
||||
// c-pm-01 ถึง c-pm-04
|
||||
|
||||
var placement = await _placementRepository.GetByIdAsync(req.examRound);
|
||||
order.Placement = placement!;
|
||||
order.ConclusionRegisterNo = req.conclusionRegisterNo;
|
||||
order.ConclusionRegisterDate = req.conclusionRegisterDate;
|
||||
order.ConclusionResultNo = req.conclusionResultNo;
|
||||
order.ConclusionResultDate = req.conclusionResultDate;
|
||||
|
||||
var result = await _repository.UpdateAsync(order);
|
||||
|
||||
return Success(result);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region " C-PM-05 "
|
||||
|
||||
/// <summary>
|
||||
/// PM7-22 : สร้างข้อมูลรายละเอียดการออกคำสั่ง C-PM-05
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPost("c-pm-05/detail")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> PostType05Async([FromBody] CreateCommandGroup2Request req)
|
||||
{
|
||||
try
|
||||
{
|
||||
var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue);
|
||||
|
||||
var inserted = new Domain.Models.Commands.Core.Command
|
||||
{
|
||||
CommandNo = req.orderNo,
|
||||
CommandYear = req.orderYear.ToString(),
|
||||
CommandSubject = req.orderTitle,
|
||||
CommandTypeId = req.orderTypeValue,
|
||||
IssuerOrganizationId = req.orderBy,
|
||||
IssuerOrganizationName = req.orderByOrganizationName,
|
||||
AuthorizedUserFullName = req.signatoryBy,
|
||||
AuthorizedPosition = req.signatoryPosition,
|
||||
|
||||
CommandAffectDate = req.orderDate,
|
||||
OwnerGovId = OcId,
|
||||
|
||||
ConclusionMeetingNo = req.conclusionMeetingNo,
|
||||
ConclusionMeetingDate = req.conclusionMeetingDate,
|
||||
|
||||
};
|
||||
|
||||
var result = await _repository.AddAsync(inserted);
|
||||
|
||||
return Success(result);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// PM7-23 : แก้ไขข้อมูลรายละเอียดการออกคำสั่ง C-PM-05
|
||||
/// </summary>
|
||||
/// <param name="orderId">Record Id ของคำสั่ง</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPut("c-pm-05/detail/{orderId}")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> PutType05Async(Guid orderId, [FromBody] CreateCommandGroup2Request req)
|
||||
{
|
||||
try
|
||||
{
|
||||
var order = await _repository.GetByIdAsync(orderId);
|
||||
if (order == null)
|
||||
throw new Exception(GlobalMessages.CommandNotFound);
|
||||
|
||||
|
||||
var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue);
|
||||
var status = await _commandStatusRepository.GetByIdAsync(order.CommandStatusId);
|
||||
|
||||
order.CommandNo = req.orderNo;
|
||||
order.CommandYear = req.orderYear.ToString();
|
||||
order.CommandSubject = req.orderTitle;
|
||||
order.CommandType = commandType!;
|
||||
order.IssuerOrganizationId = req.orderBy;
|
||||
order.IssuerOrganizationName = req.orderByOrganizationName;
|
||||
order.AuthorizedUserFullName = req.signatoryBy;
|
||||
order.AuthorizedPosition = req.signatoryPosition;
|
||||
order.CommandStatus = status!;
|
||||
order.CommandAffectDate = req.orderDate;
|
||||
|
||||
order.ConclusionMeetingNo = req.conclusionMeetingNo;
|
||||
order.ConclusionMeetingDate = req.conclusionMeetingDate;
|
||||
|
||||
var result = await _repository.UpdateAsync(order);
|
||||
|
||||
return Success(result);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region " C-PM-06 "
|
||||
|
||||
/// <summary>
|
||||
/// PM7-22 : สร้างข้อมูลรายละเอียดการออกคำสั่ง C-PM-06
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPost("c-pm-06/detail")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> PostType06Async([FromBody] CreateCommandGroup2Request req)
|
||||
{
|
||||
try
|
||||
{
|
||||
var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue);
|
||||
|
||||
var inserted = new Domain.Models.Commands.Core.Command
|
||||
{
|
||||
CommandNo = req.orderNo,
|
||||
CommandYear = req.orderYear.ToString(),
|
||||
CommandSubject = req.orderTitle,
|
||||
CommandTypeId = req.orderTypeValue,
|
||||
IssuerOrganizationId = req.orderBy,
|
||||
IssuerOrganizationName = req.orderByOrganizationName,
|
||||
AuthorizedUserFullName = req.signatoryBy,
|
||||
AuthorizedPosition = req.signatoryPosition,
|
||||
|
||||
CommandAffectDate = req.orderDate,
|
||||
OwnerGovId = OcId,
|
||||
|
||||
ConclusionMeetingNo = req.conclusionMeetingNo,
|
||||
ConclusionMeetingDate = req.conclusionMeetingDate,
|
||||
|
||||
};
|
||||
|
||||
var result = await _repository.AddAsync(inserted);
|
||||
|
||||
return Success(result);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// PM7-23 : แก้ไขข้อมูลรายละเอียดการออกคำสั่ง C-PM-06
|
||||
/// </summary>
|
||||
/// <param name="orderId">Record Id ของคำสั่ง</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPut("c-pm-06/detail/{orderId}")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> PutType06Async(Guid orderId, [FromBody] CreateCommandGroup2Request req)
|
||||
{
|
||||
try
|
||||
{
|
||||
var order = await _repository.GetByIdAsync(orderId);
|
||||
if (order == null)
|
||||
throw new Exception(GlobalMessages.CommandNotFound);
|
||||
|
||||
|
||||
var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue);
|
||||
var status = await _commandStatusRepository.GetByIdAsync(order.CommandStatusId);
|
||||
|
||||
order.CommandNo = req.orderNo;
|
||||
order.CommandYear = req.orderYear.ToString();
|
||||
order.CommandSubject = req.orderTitle;
|
||||
order.CommandType = commandType!;
|
||||
order.IssuerOrganizationId = req.orderBy;
|
||||
order.IssuerOrganizationName = req.orderByOrganizationName;
|
||||
order.AuthorizedUserFullName = req.signatoryBy;
|
||||
order.AuthorizedPosition = req.signatoryPosition;
|
||||
order.CommandStatus = status!;
|
||||
order.CommandAffectDate = req.orderDate;
|
||||
|
||||
order.ConclusionMeetingNo = req.conclusionMeetingNo;
|
||||
order.ConclusionMeetingDate = req.conclusionMeetingDate;
|
||||
|
||||
var result = await _repository.UpdateAsync(order);
|
||||
|
||||
return Success(result);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region " C-PM-07 "
|
||||
|
||||
/// <summary>
|
||||
/// PM7-22 : สร้างข้อมูลรายละเอียดการออกคำสั่ง C-PM-07
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPost("c-pm-07/detail")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> PostType07Async([FromBody] CreateCommandGroup3Request req)
|
||||
{
|
||||
try
|
||||
{
|
||||
var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue);
|
||||
|
||||
var inserted = new Domain.Models.Commands.Core.Command
|
||||
{
|
||||
CommandNo = req.orderNo,
|
||||
CommandYear = req.orderYear.ToString(),
|
||||
CommandSubject = req.orderTitle,
|
||||
CommandTypeId = req.orderTypeValue,
|
||||
IssuerOrganizationId = req.orderBy,
|
||||
IssuerOrganizationName = req.orderByOrganizationName,
|
||||
AuthorizedUserFullName = req.signatoryBy,
|
||||
AuthorizedPosition = req.signatoryPosition,
|
||||
|
||||
CommandAffectDate = req.orderDate,
|
||||
OwnerGovId = OcId,
|
||||
};
|
||||
|
||||
var result = await _repository.AddAsync(inserted);
|
||||
|
||||
return Success(result);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// PM7-23 : แก้ไขข้อมูลรายละเอียดการออกคำสั่ง C-PM-07
|
||||
/// </summary>
|
||||
/// <param name="orderId">Record Id ของคำสั่ง</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPut("c-pm-07/detail/{orderId}")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> PutType07Async(Guid orderId, [FromBody] CreateCommandGroup3Request req)
|
||||
{
|
||||
try
|
||||
{
|
||||
var order = await _repository.GetByIdAsync(orderId);
|
||||
if (order == null)
|
||||
throw new Exception(GlobalMessages.CommandNotFound);
|
||||
|
||||
|
||||
var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue);
|
||||
var status = await _commandStatusRepository.GetByIdAsync(order.CommandStatusId);
|
||||
|
||||
order.CommandNo = req.orderNo;
|
||||
order.CommandYear = req.orderYear.ToString();
|
||||
order.CommandSubject = req.orderTitle;
|
||||
order.CommandType = commandType!;
|
||||
order.IssuerOrganizationId = req.orderBy;
|
||||
order.IssuerOrganizationName = req.orderByOrganizationName;
|
||||
order.AuthorizedUserFullName = req.signatoryBy;
|
||||
order.AuthorizedPosition = req.signatoryPosition;
|
||||
order.CommandStatus = status!;
|
||||
order.CommandAffectDate = req.orderDate;
|
||||
|
||||
|
|
@ -462,6 +1091,211 @@ namespace BMA.EHR.Command.Service.Controllers
|
|||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region " C-PM-08 "
|
||||
|
||||
/// <summary>
|
||||
/// PM7-22 : สร้างข้อมูลรายละเอียดการออกคำสั่ง C-PM-08
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPost("c-pm-08/detail")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> PostType08Async([FromBody] CreateCommandGroup4Request req)
|
||||
{
|
||||
try
|
||||
{
|
||||
var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue);
|
||||
|
||||
var inserted = new Domain.Models.Commands.Core.Command
|
||||
{
|
||||
CommandNo = req.orderNo,
|
||||
CommandYear = req.orderYear.ToString(),
|
||||
CommandSubject = req.orderTitle,
|
||||
CommandTypeId = req.orderTypeValue,
|
||||
IssuerOrganizationId = req.orderBy,
|
||||
IssuerOrganizationName = req.orderByOrganizationName,
|
||||
AuthorizedUserFullName = req.signatoryBy,
|
||||
AuthorizedPosition = req.signatoryPosition,
|
||||
|
||||
CommandAffectDate = req.orderDate,
|
||||
OwnerGovId = OcId,
|
||||
|
||||
ConclusionReturnNo = req.conclusionReturnNo,
|
||||
ConclusionReturnDate = req.conclusionReturnDate,
|
||||
};
|
||||
|
||||
var result = await _repository.AddAsync(inserted);
|
||||
|
||||
return Success(result);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// PM7-23 : แก้ไขข้อมูลรายละเอียดการออกคำสั่ง C-PM-08
|
||||
/// </summary>
|
||||
/// <param name="orderId">Record Id ของคำสั่ง</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPut("c-pm-08/detail/{orderId}")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> PutType08Async(Guid orderId, [FromBody] CreateCommandGroup4Request req)
|
||||
{
|
||||
try
|
||||
{
|
||||
var order = await _repository.GetByIdAsync(orderId);
|
||||
if (order == null)
|
||||
throw new Exception(GlobalMessages.CommandNotFound);
|
||||
|
||||
|
||||
var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue);
|
||||
var status = await _commandStatusRepository.GetByIdAsync(order.CommandStatusId);
|
||||
|
||||
order.CommandNo = req.orderNo;
|
||||
order.CommandYear = req.orderYear.ToString();
|
||||
order.CommandSubject = req.orderTitle;
|
||||
order.CommandType = commandType!;
|
||||
order.IssuerOrganizationId = req.orderBy;
|
||||
order.IssuerOrganizationName = req.orderByOrganizationName;
|
||||
order.AuthorizedUserFullName = req.signatoryBy;
|
||||
order.AuthorizedPosition = req.signatoryPosition;
|
||||
order.CommandStatus = status!;
|
||||
order.CommandAffectDate = req.orderDate;
|
||||
|
||||
|
||||
order.ConclusionReturnNo = req.conclusionReturnNo;
|
||||
order.ConclusionReturnDate = req.conclusionReturnDate;
|
||||
|
||||
var result = await _repository.UpdateAsync(order);
|
||||
|
||||
return Success(result);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region " C-PM-09 "
|
||||
|
||||
/// <summary>
|
||||
/// PM7-22 : สร้างข้อมูลรายละเอียดการออกคำสั่ง C-PM-09
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPost("c-pm-09/detail")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> PostType09Async([FromBody] CreateCommandGroup5Request req)
|
||||
{
|
||||
try
|
||||
{
|
||||
var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue);
|
||||
|
||||
var inserted = new Domain.Models.Commands.Core.Command
|
||||
{
|
||||
CommandNo = req.orderNo,
|
||||
CommandYear = req.orderYear.ToString(),
|
||||
CommandSubject = req.orderTitle,
|
||||
CommandTypeId = req.orderTypeValue,
|
||||
IssuerOrganizationId = req.orderBy,
|
||||
IssuerOrganizationName = req.orderByOrganizationName,
|
||||
AuthorizedUserFullName = req.signatoryBy,
|
||||
AuthorizedPosition = req.signatoryPosition,
|
||||
|
||||
CommandAffectDate = req.orderDate,
|
||||
OwnerGovId = OcId,
|
||||
|
||||
ConclusionReturnNo = req.conclusionReturnNo,
|
||||
ConclusionReturnDate = req.conclusionReturnDate,
|
||||
SourceOrganizationName = req.sourceOrganizationName,
|
||||
MilitaryCommandNo = req.militaryCommandNo,
|
||||
MilitaryCommanDate = req.militaryCommandDate
|
||||
};
|
||||
|
||||
var result = await _repository.AddAsync(inserted);
|
||||
|
||||
return Success(result);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// PM7-23 : แก้ไขข้อมูลรายละเอียดการออกคำสั่ง C-PM-09
|
||||
/// </summary>
|
||||
/// <param name="orderId">Record Id ของคำสั่ง</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPut("c-pm-09/detail/{orderId}")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> PutType09Async(Guid orderId, [FromBody] CreateCommandGroup5Request req)
|
||||
{
|
||||
try
|
||||
{
|
||||
var order = await _repository.GetByIdAsync(orderId);
|
||||
if (order == null)
|
||||
throw new Exception(GlobalMessages.CommandNotFound);
|
||||
|
||||
|
||||
var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue);
|
||||
var status = await _commandStatusRepository.GetByIdAsync(order.CommandStatusId);
|
||||
|
||||
order.CommandNo = req.orderNo;
|
||||
order.CommandYear = req.orderYear.ToString();
|
||||
order.CommandSubject = req.orderTitle;
|
||||
order.CommandType = commandType!;
|
||||
order.IssuerOrganizationId = req.orderBy;
|
||||
order.IssuerOrganizationName = req.orderByOrganizationName;
|
||||
order.AuthorizedUserFullName = req.signatoryBy;
|
||||
order.AuthorizedPosition = req.signatoryPosition;
|
||||
order.CommandStatus = status!;
|
||||
order.CommandAffectDate = req.orderDate;
|
||||
|
||||
|
||||
order.ConclusionReturnNo = req.conclusionReturnNo;
|
||||
order.ConclusionReturnDate = req.conclusionReturnDate;
|
||||
order.SourceOrganizationName = req.sourceOrganizationName;
|
||||
order.MilitaryCommandNo = req.militaryCommandNo;
|
||||
order.MilitaryCommanDate = req.militaryCommandDate;
|
||||
|
||||
var result = await _repository.UpdateAsync(order);
|
||||
|
||||
return Success(result);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// PM7-24 : dropdown รอบการสอบ หน้ารายละเอียดการออกคำสั่ง
|
||||
|
|
@ -483,11 +1317,11 @@ namespace BMA.EHR.Command.Service.Controllers
|
|||
|
||||
|
||||
var data = rawData.Select(x => new
|
||||
{
|
||||
examRoundValue = x.Id,
|
||||
examRoundName = $"{x.Name} ครั้งที่ {x.Round}/{x.Year.ToThaiYear()}"
|
||||
{
|
||||
examRoundValue = x.Id,
|
||||
examRoundName = $"{x.Name} ครั้งที่ {x.Round}/{x.Year.ToThaiYear()}"
|
||||
|
||||
})
|
||||
})
|
||||
.ToList();
|
||||
|
||||
return Success(data);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue