From b27629a1d1d09f8f22f236a8ab1af3174c65b6f4 Mon Sep 17 00:00:00 2001 From: Bright Date: Fri, 1 Nov 2024 16:57:18 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=80=E0=B8=9E=E0=B8=B4=E0=B9=88=E0=B8=A1?= =?UTF-8?q?=20body=20=E0=B8=AB=E0=B8=99=E0=B9=89=E0=B8=B2=E0=B8=AD?= =?UTF-8?q?=E0=B8=AD=E0=B8=81=E0=B8=84=E0=B8=B3=E0=B8=AA=E0=B8=B1=E0=B9=88?= =?UTF-8?q?=E0=B8=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/CommandController.ts | 29 ++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/src/controllers/CommandController.ts b/src/controllers/CommandController.ts index f780fb12..7977ebcd 100644 --- a/src/controllers/CommandController.ts +++ b/src/controllers/CommandController.ts @@ -1187,7 +1187,7 @@ export class CommandController extends Controller { await new permission().PermissionGet(request, "COMMAND"); const command = await this.commandRepository.findOne({ where: { id }, - relations: ["commandType"], + relations: ["commandType", "commandRecives"], }); if (!command) { throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลคำสั่งนี้"); @@ -1217,7 +1217,19 @@ export class CommandController extends Controller { } } if (issue == null) issue = "..................................."; - const _command = { + + let res: any[] = []; + if(command.commandRecives.length > 0) { + await new CallAPI() + .GetData(request, `/probation/report/command10/appoints/${command.commandRecives[0].refId}`) + .then((x) => { + res = x.data + }) + .catch((x) => { + }); + } + + let _command = { issue: issue, commandNo: command.commandNo == null ? "" : Extension.ToThaiNumber(command.commandNo), commandYear: @@ -1241,7 +1253,20 @@ export class CommandController extends Controller { authorizedUserFullName: "...................................", authorizedPosition: "...................................", commandAffectDate: "...................................", + name1: res && res.length > 0 + ? `${res[0].name}..........................${res[0].role}` + : "", + name2: res && res.length > 1 + ? `${res[1].name}..........................${res[1].role}` + : "", + name3: res && res.length > 2 + ? `${res[2].name}..........................${res[2].role}` + : "", + name4: res && res.length > 3 + ? `${res[3].name}..........................${res[3].role}` + : "", }; + return new HttpSuccess({ template: command.commandType.fileCover, reportName: "docx-report",