From 2b07acf6565e9df18d459da84b56798bc3a34e8c Mon Sep 17 00:00:00 2001 From: kittapath Date: Fri, 1 Nov 2024 14:14:13 +0700 Subject: [PATCH] add command code --- src/controllers/CommandController.ts | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/controllers/CommandController.ts b/src/controllers/CommandController.ts index d63f83c0..f780fb12 100644 --- a/src/controllers/CommandController.ts +++ b/src/controllers/CommandController.ts @@ -348,6 +348,7 @@ export class CommandController extends Controller { commandAffectDate: command.commandAffectDate, commandExcecuteDate: command.commandExcecuteDate, commandTypeName: command.commandType?.name || null, + commandCode: command.commandType?.code || null, commandSysId: command.commandType?.commandSysId || null, }; return new HttpSuccess(_command); @@ -2664,7 +2665,7 @@ export class CommandController extends Controller { await this.posMasterRepository.save(data); return new HttpSuccess(); } - + @Post("command40/officer/report") public async command40SalaryOfficer( @Request() req: RequestWithUser, @@ -3019,10 +3020,9 @@ export class CommandController extends Controller { if (!posMaster) { throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบตำแหน่งดังกล่าว"); } - if(posMaster.next_holderId != null) { - + if (posMaster.next_holderId != null) { const shortName = - posMaster != null && posMaster.orgChild4 != null + posMaster != null && posMaster.orgChild4 != null ? `${posMaster.orgChild4.orgChild4ShortName}${posMaster.posMasterNo}` : posMaster != null && posMaster.orgChild3 != null ? `${posMaster.orgChild3.orgChild3ShortName}${posMaster.posMasterNo}` @@ -3034,13 +3034,13 @@ export class CommandController extends Controller { ? `${posMaster.orgRoot.orgRootShortName}${posMaster.posMasterNo}` : null; const profile = await this.profileRepository.findOne({ - where: { id: posMaster.next_holderId } + where: { id: posMaster.next_holderId }, }); const position = await this.positionRepository.findOne({ - where: { + where: { posMasterId: posMaster.id, - positionIsSelected: true - } + positionIsSelected: true, + }, }); const dest_item = await this.salaryRepo.findOne({ where: { profileId: profile?.id }, @@ -3121,7 +3121,9 @@ export class CommandController extends Controller { }[]; }, ) { - const posMasters = await this.posMasterRepository.find({ where: { id: In(body.refIds.map(x => x.refId)) } }); + const posMasters = await this.posMasterRepository.find({ + where: { id: In(body.refIds.map((x) => x.refId)) }, + }); const data = posMasters.map((_data) => ({ ..._data, statusReport: "PENDING",