feat(ocp): added zechettis stuff in

This commit is contained in:
2025-09-22 22:39:57 -05:00
parent bc6485ca9a
commit 4ab43d91b9
5 changed files with 244 additions and 225 deletions

View File

@@ -78,6 +78,7 @@ export const labelingProcess = async ({
// if we are running the zechettii
if (zechette) {
if (zechette.line === "0") return;
const macId = await getMac(zechette.line);
// filter out the lot for the line
filteredLot = lots.data.filter(
@@ -163,7 +164,11 @@ export const labelingProcess = async ({
}
// if there are more than 2 lots it might be an auto labeler, autolabeler will be defined by its id for now only dayton
if (filteredLot?.length > 2 && plantToken[0].value !== "usday1") {
const plantsCanHaveMultiLots = ["usday1", "usmcd1"];
if (
filteredLot?.length > 2 &&
!plantsCanHaveMultiLots.includes(plantToken[0].value)
) {
createLog(
"error",
"labeling",
@@ -205,59 +210,65 @@ export const labelingProcess = async ({
};
}
// check the material... mm,color (auto and manual combined), pkg
const mmStaged = await isMainMatStaged(filteredLot[0]);
// as we want to allow zechetti to print no matter what if we zechettii is true skip all this and just print the label
if (!zechette) {
// check the material... mm,color (auto and manual combined), pkg
const mmStaged = await isMainMatStaged(filteredLot[0]);
if (!mmStaged.success) {
createLog("error", "labeling", "ocp", mmStaged.message);
if (!mmStaged.success) {
createLog("error", "labeling", "ocp", mmStaged.message);
return {
success: false,
message: mmStaged.message,
};
}
return {
success: false,
message: mmStaged.message,
};
}
// comment only but will check for color
createLog(
"info",
"labeling",
"ocp",
`Remaining pallets for: ${filteredLot[0].MachineDescription} is ${filteredLot[0].Remaining}`
);
// do we want to over run
if (filteredLot[0].overPrinting === "no" && filteredLot[0].Remaining <= 0) {
// comment only but will check for color
createLog(
"error",
"info",
"labeling",
"ocp",
`Over Printing on ${filteredLot[0].MachineDescription} is not allowed please change the lot`
`Remaining pallets for: ${filteredLot[0].MachineDescription} is ${filteredLot[0].Remaining}`
);
// for slc we want to run the first label for henkel
firstLotLabel(filteredLot[0]);
return {
success: false,
message: `Over Printing on ${filteredLot[0].MachineDescription} is not allowed please change the lot`,
};
}
// prolink check by lot
const prolink = await prolinkCheck(filteredLot[0].lot);
// do we want to over run
if (
filteredLot[0].overPrinting === "no" &&
filteredLot[0].Remaining <= 0
) {
createLog(
"error",
"labeling",
"ocp",
`Over Printing on ${filteredLot[0].MachineDescription} is not allowed please change the lot`
);
// for slc we want to run the first label for henkel
firstLotLabel(filteredLot[0]);
return {
success: false,
message: `Over Printing on ${filteredLot[0].MachineDescription} is not allowed please change the lot`,
};
}
if (!prolink) {
//console.error(`Prolink does not match for ${filteredLot[0].MachineDescription}`);
createLog(
"error",
"labeling",
"ocp",
`Prolink does not match for ${filteredLot[0].MachineDescription}`
);
return {
success: false,
message: `Prolink does not match for ${filteredLot[0].MachineDescription}`,
};
// prolink check by lot
const prolink = await prolinkCheck(filteredLot[0].lot);
if (!prolink) {
//console.error(`Prolink does not match for ${filteredLot[0].MachineDescription}`);
createLog(
"error",
"labeling",
"ocp",
`Prolink does not match for ${filteredLot[0].MachineDescription}`
);
return {
success: false,
message: `Prolink does not match for ${filteredLot[0].MachineDescription}`,
};
}
createLog("info", "labeling", "ocp", `Is prolink good? ${prolink}`);
}
createLog("info", "labeling", "ocp", `Is prolink good? ${prolink}`);
// create the label
const label = await createLabel(filteredLot[0], userPrinted);
@@ -273,9 +284,12 @@ export const labelingProcess = async ({
}
// send over to be booked in if we can do it.
// same here if we are passing zechettii dont try to book in
const bookin = settingData.filter((s) => s.name === "bookin");
let book: any = [];
if (bookin[0].value === "1") {
if (bookin[0].value === "1" && !zechette) {
book = await bookInLabel(label.data);
if (!book.success) {