Update send report Load IOS

This commit is contained in:
nguyentrungthat 2026-01-05 09:28:00 +07:00
parent 5e22f4ea25
commit f160cd2905
1 changed files with 30 additions and 6 deletions

View File

@ -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<br/>
<br/>
Station : <b>${this.config.stationName}</b><br/>
Line : <b>${this.config.lineNumber}</b><br/>
IOS : <b>${nameIos}</b> <br/>
Started At : ${startTime}<br/>
Finished At : ${dataFormat}<br/>
<br/>
`.trim()
await sendMessageToMail(
`[ATC] - [${this.config.stationName} - Line: ${this.config.lineNumber}] - Load IOS Report`,
body
)
}
}