Update asanServiceSerialChecker.js
This commit is contained in:
@@ -14,10 +14,12 @@ const serialChecker = async (serial, type = 'guaranteeSerial', g = 1) => {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const serialFiles = await fs.readdirSync(exelsPath);
|
const serialFiles = await fs.readdirSync(exelsPath);
|
||||||
|
if((serialFiles?.length) <= 1){
|
||||||
|
rej("این کد در سامانه موجود نیست")
|
||||||
|
}
|
||||||
serialFiles.forEach(async(file, i)=>{
|
serialFiles.forEach(async(file, i)=>{
|
||||||
const exelFile = await readXlsxFile(`${exelsPath}/${file}`);
|
const exelFile = await readXlsxFile(`${exelsPath}/${file}`);
|
||||||
|
|
||||||
for (const row of exelFile) {
|
for (const row of exelFile) {
|
||||||
for (const col of row) {
|
for (const col of row) {
|
||||||
if (col == lowerSerial) {
|
if (col == lowerSerial) {
|
||||||
@@ -33,7 +35,7 @@ const serialChecker = async (serial, type = 'guaranteeSerial', g = 1) => {
|
|||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
rej(new Error(e));
|
rej(e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user