This commit is contained in:
Joseph Le 2025-04-09 18:05:30 +10:00
parent d12177873d
commit 324cb52741
1 changed files with 16 additions and 3 deletions

View File

@ -5,8 +5,7 @@ import Env from "@ioc:Adonis/Core/Env";
const path = require("path");
const BASE_URL = Env.get("BASE_URL_LOG");
const BASE_URL_AUTO = Env.get(`${BASE_URL}/AUTOlog/`);
const BASE_URL_AUTO = `${BASE_URL}/AUTOlog/`;
export default class ErpsController {
/**
* Controller do tim cac serial number trong cac log trong khoang thoi gian xac dinh
@ -20,10 +19,10 @@ export default class ErpsController {
const { from, to } = request.all();
const getListLog = async (from, to) => {
try {
// console.log("check!")
const listLog: string[] = [];
const response = await axios.get(BASE_URL);
const responseAUTO = await axios.get(BASE_URL_AUTO);
console.log("check!!!!!!!!!!!!!!!!!!!!!")
let data1 = response.data
.split("\n")
@ -140,6 +139,20 @@ export default class ErpsController {
}
}
if (cleanedLine.includes("System serial num")) {
const PCB_SN = extractSN(cleanedLine.split(":")[1]);
if (PCB_SN) {
results.push({
PID: "",
VID: "",
SN: PCB_SN,
line: [index + 1],
fileName: fName,
warehouse: getWarehouse(fName),
});
}
}
// Processor board ID
if (cleanedLine.includes("Processor board ID")) {
const PBID = extractSN(cleanedLine.split(" ").pop());