From f160cd2905d7f0ed690e92b2ddcdf52011e0358e Mon Sep 17 00:00:00 2001
From: nguyentrungthat <80239428+nguentrungthat@users.noreply.github.com>
Date: Mon, 5 Jan 2026 09:28:00 +0700
Subject: [PATCH] Update send report Load IOS
---
BACKEND/app/services/line_connection.ts | 36 ++++++++++++++++++++-----
1 file changed, 30 insertions(+), 6 deletions(-)
diff --git a/BACKEND/app/services/line_connection.ts b/BACKEND/app/services/line_connection.ts
index 8569d16..a4db2c0 100644
--- a/BACKEND/app/services/line_connection.ts
+++ b/BACKEND/app/services/line_connection.ts
@@ -1066,7 +1066,8 @@ export default class LineConnection {
if (!station) return
const network = station?.gateway || '172.25.1.1'
const [a, b] = network.split('.').map(Number)
-
+ const timeZone = process.env.TIME_ZONE || 'Australia/Sydney'
+ const startTime = momentTZ().tz(timeZone).format('YYYY/MM/DD, HH:mm:ss')
const body = [
{
expect: '',
@@ -1188,11 +1189,12 @@ export default class LineConnection {
sendResult: false,
send_result: false,
title: 'Load IOS Router',
- timeout: 1000000,
+ timeout: 1000,
body: JSON.stringify(body),
}
- this.runScript(script as any, userName)
+ await this.runScript(script as any, userName)
+ await this.endEmailLoadIos(nameIos, startTime)
}
async loadIosSwitch(nameIos: string, userName: string) {
@@ -1200,7 +1202,8 @@ export default class LineConnection {
if (!station) return
const network = station?.gateway || '172.25.1.1'
const [a, b] = network.split('.').map(Number)
-
+ const timeZone = process.env.TIME_ZONE || 'Australia/Sydney'
+ const startTime = momentTZ().tz(timeZone).format('YYYY/MM/DD, HH:mm:ss')
const body = [
{
expect: '',
@@ -1329,10 +1332,31 @@ export default class LineConnection {
sendResult: false,
send_result: false,
title: 'Load IOS Switch',
- timeout: 1000000,
+ timeout: 1000,
body: JSON.stringify(body),
}
- this.runScript(script as any, userName)
+ await this.runScript(script as any, userName)
+ await this.endEmailLoadIos(nameIos, startTime)
+ }
+
+ async endEmailLoadIos(nameIos: string, startTime: string) {
+ const timeZone = process.env.TIME_ZONE || 'Australia/Sydney'
+ const dataFormat = momentTZ().tz(timeZone).format('YYYY/MM/DD, HH:mm:ss')
+ const body = `
+ Load IOS Report
+ ────────────────────────────────
+ Station : ${this.config.stationName}
+ Line : ${this.config.lineNumber}
+ IOS : ${nameIos}
+ Started At : ${startTime}
+ Finished At : ${dataFormat}
+ ────────────────────────────────
+ `.trim()
+
+ await sendMessageToMail(
+ `[ATC] - [${this.config.stationName} - Line: ${this.config.lineNumber}] - Load IOS Report`,
+ body
+ )
}
}