fix(lots errors): fixes to prevent crashes when sql server not connected

This commit is contained in:
2025-04-17 18:40:35 -05:00
parent e7e35336f8
commit d5114ba243
5 changed files with 201 additions and 195 deletions

View File

@@ -18,6 +18,20 @@ export const assignedPrinters = async () => {
data: lotError,
};
}
if (l.data.length === 0 && !l.data.sucess) {
createLog(
"error",
"lst",
"ocp",
`There was an error getting the lots: ${l?.message}`
);
return {
success: false,
message: "Error getting lots",
data: [],
};
}
const { data: print, error: printerError } = await tryCatch(getPrinters());
if (printerError) {
@@ -29,17 +43,11 @@ export const assignedPrinters = async () => {
}
const printers: any = print.data ?? [];
const lots: any = l.data.length === 0 ? [] : l.data;
const lots: any = l?.data.length === 0 ? null : l?.data;
if (!lots) {
createLog(
"error",
"lst",
"ocp",
`There was an error getting the lots: ${lots.message}`
);
return;
}
//console.log(lots);
return;
for (let i = 0; i < printers.length; i++) {
// is the printer assinged in alplalabel online?
const assigned = lots?.filter(