update send SN to ERP (regex ASCII)

This commit is contained in:
joseph le 2023-10-28 08:36:56 +07:00
parent 64d25d3b17
commit 27005b3405
2 changed files with 7 additions and 3 deletions

View File

@ -167,7 +167,8 @@ export const checkIndexSN = async (content, beginLine, nameF) => {
}
}
// console.log(nameF+" output\n", output);
if (output.filter((i) => i.PID !== "" && i.PID.includes("\\")===false).length > 0) {
let pattern = /[\x00-\x20\x7F]/g;
if (output.filter((i) => i.PID !== "" && i.PID.match(pattern)==null).length > 0) {
let token =
"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL2FwaS5uc3d0ZWFtLm5ldC9hcGkvbG9naW4iLCJpYXQiOjE2ODkxNTM4MTQsImV4cCI6MTY4OTI0MDIxNCwibmJmIjoxNjg5MTUzODE0LCJqdGkiOiJrazZKZVlzRGlONkZ5cnBFIiwic3ViIjoxLCJwcnYiOiJjOGVlMWZjODllNzc1ZWM0YzczODY2N2U1YmUxN2E1OTBiNmQ0MGZjIn0.tL2aK-7q63__ZocA6sY0TMgnv_OHjk78d7FT_a7CHzE";
@ -175,7 +176,7 @@ export const checkIndexSN = async (content, beginLine, nameF) => {
"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL2ludC5pcHN1cHBseS5jb20uYXUvYXBpL2xvZ2luIiwiaWF0IjoxNjg5ODYyNjAxLCJleHAiOjE3MjEzOTg2MDEsIm5iZiI6MTY4OTg2MjYwMSwianRpIjoiUElZVjNBM3ZPQVlMQ081SyIsInN1YiI6MSwicHJ2IjoiYzhlZTFmYzg5ZTc3NWVjNGM3Mzg2NjdlNWJlMTdhNTkwYjZkNDBmYyJ9.UcybIKMBjTAY9i0PfIDQMtqHyN72Ul0jC03ZDGLGpMI";
let data = {
data: output.filter((i) => i.PID !== "" && i.PID.includes("\\")===false),
data: output.filter((i) => i.PID !== "" && i.PID.match(pattern)==null),
urlAPI: "/api/test-log-serial-number/save-data",
};

View File

@ -301,7 +301,10 @@ Route.post("/api/sendMailInforDevice", async () => {
// Route.post("/api/test", async () => {
// try {
// let abc = await InfoDevice.findBy('SN', 'FHK0935F0Z3')
// console.log(abc)
// let pattern = /[\x00-\x20\x7F]/g;
// if(abc?.$extras.PID.match(pattern)){
// return "Loại"
// }
// } catch (error) {
// console.log(error)
// }