เพิ่มคำสั่งยกเลิกลา

This commit is contained in:
Kittapath 2024-07-18 20:37:17 +07:00
parent bcf0c0bfdb
commit 033fc915d0
12 changed files with 19309 additions and 88 deletions

View file

@ -482,6 +482,30 @@ namespace BMA.EHR.Command.Service.Controllers
else
return Success(new { result = "N" });
}
case "C-PM-40":
{
if (command.CommandNo != "" &&
command.CommandYear != null &&
command.CommandExcecuteDate != null &&
cover != null)
{
return Success(new { result = "Y" });
}
else
return Success(new { result = "N" });
}
// case "C-PM-41":
// {
// if (command.CommandNo != "" &&
// command.CommandYear != null &&
// command.CommandExcecuteDate != null &&
// cover != null)
// {
// return Success(new { result = "Y" });
// }
// else
// return Success(new { result = "N" });
// }
default:
{
if (command.CommandNo != "" &&
@ -726,6 +750,9 @@ namespace BMA.EHR.Command.Service.Controllers
SalaryPeriodId = data.SalaryPeriodId,
SalaryPeriod = data.SalaryPeriod,
Year = data.Year,
ActStartDate = data.ActStartDate,
ActEndDate = data.ActEndDate,
};
return Success(result);
@ -4715,6 +4742,207 @@ namespace BMA.EHR.Command.Service.Controllers
#endregion
#region " C-PM-40 "
/// <summary>
/// PM7-22 : สร้างข้อมูลรายละเอียดการออกคำสั่ง C-PM-40
/// </summary>
/// <returns></returns>
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("c-pm-40/detail")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> PostType40Async([FromBody] CreateCommandGroup16Request 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,
CaseFault = req.caseFault,
FaultLevel = req.faultLevel,
RefRaw = req.refRaw,
Result = req.result,
SalaryPeriodId = req.salaryPeriodId,
SalaryPeriod = req.salaryPeriod,
Year = req.year,
ActStartDate = req.actStartDate,
ActEndDate = req.actEndDate,
};
var result = await _repository.AddAsync(inserted);
return Success(result);
}
catch
{
throw;
}
}
/// <summary>
/// PM7-23 : แก้ไขข้อมูลรายละเอียดการออกคำสั่ง C-PM-40
/// </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-40/detail/{orderId}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> PutType40Async(Guid orderId, [FromBody] CreateCommandGroup16Request 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.CaseFault = req.caseFault;
order.FaultLevel = req.faultLevel;
order.RefRaw = req.refRaw;
order.Result = req.result;
order.SalaryPeriodId = req.salaryPeriodId;
order.SalaryPeriod = req.salaryPeriod;
order.Year = req.year;
order.ActStartDate = req.actStartDate;
order.ActEndDate = req.actEndDate;
var result = await _repository.UpdateAsync(order);
return Success(result);
}
catch
{
throw;
}
}
#endregion
#region " C-PM-41 "
/// <summary>
/// PM7-22 : สร้างข้อมูลรายละเอียดการออกคำสั่ง C-PM-41
/// </summary>
/// <returns></returns>
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("c-pm-41/detail")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> PostType41Async([FromBody] CreateCommandGroup0Request 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-41
/// </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-41/detail/{orderId}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> PutType41Async(Guid orderId, [FromBody] CreateCommandGroup0Request 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;
var result = await _repository.UpdateAsync(order);
return Success(result);
}
catch
{
throw;
}
}
#endregion
#endregion
/// <summary>