Update link ip and dns, update view AI
This commit is contained in:
parent
46f72decd3
commit
a356552d5b
|
|
@ -32,7 +32,7 @@ export default class AuthController {
|
|||
const user = await User.query().where('user_name', userName).first()
|
||||
|
||||
if (!user) {
|
||||
const remoteUrl = process.env.ERP_URL || 'https://stage.nswteam.net'
|
||||
const remoteUrl = process.env.ERP_URL_AUTH || 'https://stage.nswteam.net'
|
||||
const remoteResp = await axios.post(remoteUrl + '/api/login', {
|
||||
userEmail: userName,
|
||||
password: password,
|
||||
|
|
|
|||
|
|
@ -924,7 +924,7 @@ export default class LineConnection {
|
|||
},
|
||||
],
|
||||
}
|
||||
const remoteUrl = process.env.ERP_URL || 'https://stage.nswteam.net'
|
||||
const remoteUrl = process.env.ERP_URL_AUTH || 'https://stage.nswteam.net'
|
||||
const remoteResp = await axios.post(
|
||||
remoteUrl + '/api/transferPostData',
|
||||
{
|
||||
|
|
@ -937,7 +937,6 @@ export default class LineConnection {
|
|||
},
|
||||
}
|
||||
)
|
||||
console.log('AI detect log response:', remoteResp.data)
|
||||
return remoteResp.data?.Status === 'OK' ? remoteResp.data?.data : ''
|
||||
} catch (error: any) {
|
||||
console.log('[ERROR] Detect log from AI', error)
|
||||
|
|
@ -1767,7 +1766,7 @@ Ports Missing/Down: ${missing.length}\n\n`
|
|||
},
|
||||
],
|
||||
}
|
||||
const remoteUrl = process.env.ERP_URL || 'https://stage.nswteam.net'
|
||||
const remoteUrl = process.env.ERP_URL_AUTH || 'https://stage.nswteam.net'
|
||||
const remoteResp = await axios.post(
|
||||
remoteUrl + '/api/transferPostData',
|
||||
{
|
||||
|
|
@ -1891,8 +1890,7 @@ Ports Missing/Down: ${missing.length}\n\n`
|
|||
IOS: <b>${dataShowVersion?.SOFTWARE_IMAGE ?? ''}</b> <b>${dataShowVersion?.VERSION ?? ''}</b><br/>
|
||||
MEM: <b>${dataShowVersion?.MEMORY ? convertFromKilobytesString(dataShowVersion?.MEMORY) : ''}</b><br/>
|
||||
FLASH: <b>${dataShowVersion?.USB_FLASH ? convertFromKilobytesString(dataShowVersion?.USB_FLASH) : ''}</b><br/>
|
||||
Licenses: <b>${
|
||||
dataShowLic
|
||||
Licenses: <b>${dataShowLic
|
||||
? dataShowLic
|
||||
?.filter((el) => el.LICENSE_TYPE?.toLowerCase()?.includes('permanent'))
|
||||
?.map((v) => v.FEATURE)
|
||||
|
|
@ -1905,8 +1903,7 @@ Ports Missing/Down: ${missing.length}\n\n`
|
|||
Total Ports: ${portPhysical?.length}<br/>
|
||||
Ports Tested (Link UP): <b style="color: #008000;">${tested.length} (${testedPoE?.length} PoE, ${testedSFP?.length} SFP)</b><br/>
|
||||
Ports Missing/Down: <b style="color: #ff0000;">${missing.length}</b><br/>
|
||||
${
|
||||
missingPoE?.length
|
||||
${missingPoE?.length
|
||||
? `
|
||||
<br/><b style="color: #ff0000;">Ports Missing PoE</b><br/>
|
||||
────────────────────────────────<br/>
|
||||
|
|
@ -1914,8 +1911,7 @@ Ports Missing/Down: ${missing.length}\n\n`
|
|||
`
|
||||
: ''
|
||||
}
|
||||
${
|
||||
missingSFP?.length
|
||||
${missingSFP?.length
|
||||
? `
|
||||
<br/><b style="color: #ff0000;">Ports Missing SFP</b><br/>
|
||||
────────────────────────────────<br/>
|
||||
|
|
@ -2059,6 +2055,7 @@ Ports Missing/Down: ${missing.length}\n\n`
|
|||
// AI issue rows (one per real AI issue, fall back to file's hardcoded row when none)
|
||||
const aiIssueRowsHtml =
|
||||
issues.length > 0
|
||||
? issues.length > 1
|
||||
? issues
|
||||
.slice(0, 1)
|
||||
.map(
|
||||
|
|
@ -2066,6 +2063,7 @@ Ports Missing/Down: ${missing.length}\n\n`
|
|||
`<table cellpadding="0" cellspacing="0" border="0" width="100%" style="background:#f5f3ff;border:1px solid #c4b5fd;border-radius:6px;margin-bottom:5px;border-collapse:separate;"><tr><td style="padding:7px 12px;font-size:12px;color:#5f6978;font-weight:500;"><span style="display:inline-block;background:#7c3aed;color:#fff;font-size:9px;font-weight:700;letter-spacing:.5px;padding:2px 6px;border-radius:4px;vertical-align:middle;">★ AI</span><span style="margin-left:8px;vertical-align:middle;">${escapeHtml(issue)}</span></td><td align="right" style="padding:7px 12px;width:90px;"></td></tr></table>`
|
||||
)
|
||||
.join('')
|
||||
: `<table cellpadding="0" cellspacing="0" border="0" width="100%" style="background:#f5f3ff;border:1px solid #c4b5fd;border-radius:6px;margin-bottom:5px;border-collapse:separate;"><tr><td style="padding:7px 12px;font-size:12px;color:#5f6978;font-weight:500;"><span style="display:inline-block;background:#7c3aed;color:#fff;font-size:9px;font-weight:700;letter-spacing:.5px;padding:2px 6px;border-radius:4px;vertical-align:middle;">★ AI</span><span style="margin-left:8px;vertical-align:middle;">${escapeHtml(issues[0].split('\n')[0] || '')}</span></td><td align="right" style="padding:7px 12px;width:90px;"></td></tr></table>`
|
||||
: ``
|
||||
|
||||
// License boxes (real licenses if available, else file's hardcoded boxes)
|
||||
|
|
@ -2152,7 +2150,7 @@ Ports Missing/Down: ${missing.length}\n\n`
|
|||
const image = imageList[idx]
|
||||
const label = imageLabels[idx]
|
||||
return image && image.url
|
||||
? imageCellHtml(process.env.ERP_URL + image.url, label)
|
||||
? imageCellHtml(process.env.ERP_URL_AUTH + image.url, label)
|
||||
: photoCellHtml(label)
|
||||
}
|
||||
const photoGridRowsHtml = `
|
||||
|
|
@ -2460,8 +2458,7 @@ Ports Missing/Down: ${missing.length}\n\n`
|
|||
<td width="33%" valign="top" style="padding-right:8px;">
|
||||
<div style="font-size:10px;font-weight:700;text-transform:uppercase;color:#9ca3af;letter-spacing:.5px;margin-bottom:8px;">Hardware Inventory</div>
|
||||
<table cellpadding="0" cellspacing="0" border="0" width="100%" style="font-size:11px;">
|
||||
${
|
||||
this.config?.inventory?.listInventory
|
||||
${this.config?.inventory?.listInventory
|
||||
?.map(
|
||||
(item: any) => `
|
||||
<tr><td style="margin-top:4px;padding:4px 0;border-bottom:1px solid #f0f1f3;font-weight:600;color:#5f6978;">${item.pid}</td><td style="padding:2px 0;border-bottom:1px solid #f0f1f3;font-family:Consolas,monospace;color:#9ca3af;text-align:right;"><a href="#${item.sn}" style="text-decoration: underline;">${item.sn}</a></td></tr>`
|
||||
|
|
@ -2483,7 +2480,6 @@ Ports Missing/Down: ${missing.length}\n\n`
|
|||
</tr>
|
||||
<tr>
|
||||
<td width="50%" style="padding:0 3px 0 0;"><table cellpadding="0" cellspacing="0" border="0" width="100%" style="background:#f8fafc;border:1px solid #e2e8f0;border-radius:6px;border-collapse:separate;"><tr><td align="center" style="padding:6px;"><div style="font-weight:800;font-size:14px;color: ${missingSFP.length > 0 || missingPoE.length > 0 ? '#f59e0b' : '#10b981'};">${missingSFP.length > 0 || missingPoE.length > 0 ? 'WARN' : 'PASS'}</div><div style="font-size:9px;font-weight:600;color:#9ca3af;text-transform:uppercase;">PoE+ Test</div></td></tr></table></td>
|
||||
<td width="50%" style="padding:0 0 0 3px;"><table cellpadding="0" cellspacing="0" border="0" width="100%" style="background:#f8fafc;border:1px solid #e2e8f0;border-radius:6px;border-collapse:separate;"><tr><td align="center" style="padding:6px;"><div style="font-weight:800;font-size:14px;color: ${missingSFP.length > 0 || missingPoE.length > 0 ? '#f59e0b' : '#10b981'};">${totalPoE + totalSFP === 0 ? 100 : Math.round(((totalPoE + totalSFP - (missingPoE.length + missingSFP.length)) / (totalPoE + totalSFP)) * 100)}%</div><div style="font-size:9px;font-weight:600;color:#9ca3af;text-transform:uppercase;">Throughput</div></td></tr></table></td>
|
||||
</tr>
|
||||
</table>
|
||||
${missingDetailsHtml}
|
||||
|
|
|
|||
|
|
@ -681,13 +681,29 @@ export async function updateNoteToERP(sn: string, note: string) {
|
|||
const header = {
|
||||
Authorization: 'Bearer ' + process.env.ERP_TOKEN,
|
||||
}
|
||||
// const responseDataSN = await axios.post(
|
||||
// 'https://stage.nswteam.net/api/transferGetData',
|
||||
// {
|
||||
// urlAPI: '/api/stock-model-serial/get-list-for-test-log',
|
||||
// filter: {
|
||||
// where: {
|
||||
// _q: 'FOC1425Z3RN',
|
||||
// },
|
||||
// orgId: ['5fadc798f070e4b64b53ac9c', '5fadc7b0f070e4b64b53ac9d'],
|
||||
// },
|
||||
// },
|
||||
// {
|
||||
// headers: header,
|
||||
// }
|
||||
// )
|
||||
|
||||
const responseDataSN = await axios.get(
|
||||
remoteUrl + '/api/stock-model-serial/get-list-for-test-log',
|
||||
{
|
||||
params: {
|
||||
filter: {
|
||||
where: {
|
||||
_q: 'FOC1425Z3RN',
|
||||
_q: sn,
|
||||
},
|
||||
},
|
||||
orgId: ['5fadc798f070e4b64b53ac9c', '5fadc7b0f070e4b64b53ac9d'],
|
||||
|
|
@ -716,13 +732,9 @@ export async function updateNoteToERP(sn: string, note: string) {
|
|||
testNotes: note + (dataSN?.testNotes || ''),
|
||||
}
|
||||
// console.log(payload)
|
||||
await axios.post(
|
||||
remoteUrl + '/api/stock-model-serial/data-save-for-test-log',
|
||||
payload,
|
||||
{
|
||||
await axios.post(remoteUrl + '/api/stock-model-serial/data-save-for-test-log', payload, {
|
||||
headers: header,
|
||||
}
|
||||
)
|
||||
})
|
||||
} catch (error) {
|
||||
console.log('updateNoteToERP', error)
|
||||
}
|
||||
|
|
@ -1441,6 +1453,21 @@ export async function getIncomingInfoBySN(sn: string) {
|
|||
const header = {
|
||||
Authorization: 'Bearer ' + process.env.ERP_TOKEN,
|
||||
}
|
||||
// const responseDataSN = await axios.post(
|
||||
// 'https://stage.nswteam.net/api/transferGetData',
|
||||
// {
|
||||
// urlAPI: '/api/package-po/get-incoming-by-sn',
|
||||
// filter: {
|
||||
// where: {
|
||||
// serialNumber: sn,
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// {
|
||||
// headers: header,
|
||||
// }
|
||||
// )
|
||||
|
||||
const responseDataSN = await axios.get(
|
||||
remoteUrl + '/api/package-po/get-incoming-by-sn',
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue