แก้ env

This commit is contained in:
Kittapath 2024-07-09 17:03:54 +07:00
parent 41d28c4d7f
commit b37ca083ba
13 changed files with 633 additions and 65 deletions

View file

@ -1178,6 +1178,116 @@ namespace BMA.EHR.Command.Service.Controllers
#endregion
#region " C-PM-39 "
/// <summary>
/// PM7-22 : สร้างข้อมูลรายละเอียดการออกคำสั่ง C-PM-39
/// </summary>
/// <returns></returns>
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("c-pm-39/detail")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> PostType39Async([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-39
/// </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-39/detail/{orderId}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> PutType39Async(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>
@ -4716,6 +4826,17 @@ namespace BMA.EHR.Command.Service.Controllers
}
}
break;
case "c-PM-39":
{
foreach (var r in receivers)
{
var salary = await _repository.GetPlacementSalaryAsync(r.RefRecordId);
r.SalaryAmount = salary.SalaryAmount;
r.PositionSalaryAmount = salary.PositionSalaryAmount;
r.MonthSalaryAmount = salary.MonthSalaryAmount;
}
}
break;
default:
{
foreach (var r in receivers)
@ -4788,6 +4909,17 @@ namespace BMA.EHR.Command.Service.Controllers
}
break;
}
case "C-PM-39":
{
foreach (var r in receivers)
{
var salary = await _repository.GetPlacementSalaryAsync(r.RefRecordId);
r.SalaryAmount = salary.SalaryAmount;
r.PositionSalaryAmount = salary.PositionSalaryAmount;
r.MonthSalaryAmount = salary.MonthSalaryAmount;
}
break;
}
default:
{
foreach (var r in receivers)
@ -5369,6 +5501,9 @@ namespace BMA.EHR.Command.Service.Controllers
case "C-PM-04":
data = await _repository.GetPlacementSalaryAsync(record!.RefPlacementProfileId!.Value);
break;
case "C-PM-39":
data = await _repository.GetPlacementSalaryAsync(record!.RefPlacementProfileId!.Value);
break;
default:
data = await _repository.GetCommandReceiverSalary(personalId, record.Amount, record.MouthSalaryAmount, record.PositionSalaryAmount);
break;
@ -5411,6 +5546,9 @@ namespace BMA.EHR.Command.Service.Controllers
case "C-PM-04":
await _repository.UpdatePlacementSalaryAsync(personalId, req);
return Success();
case "C-PM-39":
await _repository.UpdatePlacementSalaryAsync(personalId, req);
return Success();
default:
await _repository.UpdateCommandReceiverSalaryAsync(personalId, req);
return Success();