fix(ocp): zechetti type correction to include the printer name
This commit is contained in:
@@ -19,11 +19,18 @@ interface Printer {
|
||||
// Add any other expected properties
|
||||
}
|
||||
|
||||
interface Zechetti {
|
||||
line: string;
|
||||
printer: number;
|
||||
printerName: string;
|
||||
}
|
||||
|
||||
export const labelingProcess = async ({
|
||||
line = null as string | null,
|
||||
printer = null as Printer | null,
|
||||
userPrinted = null,
|
||||
rfidTag = null,
|
||||
zechette = null as Zechetti | null,
|
||||
} = {}) => {
|
||||
/**
|
||||
* Creates a label once all logic is passed
|
||||
@@ -69,6 +76,34 @@ export const labelingProcess = async ({
|
||||
}
|
||||
}
|
||||
|
||||
// if we are running the zechettii
|
||||
if (zechette) {
|
||||
const macId = await getMac(zechette.line);
|
||||
// filter out the lot for the line
|
||||
filteredLot = lots.data.filter(
|
||||
(l: any) => l.MachineID === macId[0]?.HumanReadableId
|
||||
);
|
||||
|
||||
if (filteredLot.length === 0) {
|
||||
createLog(
|
||||
"error",
|
||||
"labeling",
|
||||
"ocp",
|
||||
`There is not a lot assigned to ${line}.`
|
||||
);
|
||||
return {
|
||||
success: false,
|
||||
message: `There is not a lot assigned to ${line}.`,
|
||||
};
|
||||
}
|
||||
|
||||
// remap the printer so its the zechetti one
|
||||
filteredLot = filteredLot.map((p: any) => ({
|
||||
...p,
|
||||
printerID: zechette.printer,
|
||||
PrinterName: zechette.printerName,
|
||||
}));
|
||||
}
|
||||
// if we came from a printer
|
||||
if (printer) {
|
||||
// filter the lot based on the printerID
|
||||
|
||||
Reference in New Issue
Block a user