feat(ocp): printer cycling backend and frontend done :)

This commit is contained in:
2025-04-07 07:02:31 -05:00
parent 75f94eae14
commit dc5ee5b97a
14 changed files with 302 additions and 35 deletions

View File

@@ -15,7 +15,8 @@ import dycoClose from "./routes/specialProcesses/dyco/closeConnection.js";
import manualprint from "./routes/labeling/manualPrint.js";
import { assignedPrinters } from "./utils/checkAssignments.js";
import { printerCycle } from "./controller/printers/printerCycle.js";
import { tryCatch } from "../../globalUtils/tryCatch.js";
import stopPrinterCycle from "./routes/printers/stopCycle.js";
import startPrinterCycle from "./routes/printers/startCycle.js";
const app = new OpenAPIHono();
@@ -24,6 +25,8 @@ const routes = [
//printer
getPrinters,
updateprinters,
startPrinterCycle,
stopPrinterCycle,
// lots
getLots,
// labeling
@@ -55,21 +58,21 @@ const ocpActive = setting.filter((n) => n.name === "ocpActive");
// do the intnal connection to the dyco
setTimeout(() => {
if (dycoActive[0].value === "1") {
if (dycoActive[0]?.value === "1") {
dycoConnect();
}
}, 3 * 1000);
// check for printers being assigned
setInterval(() => {
if (ocpActive[0].value === "1") {
if (ocpActive[0]?.value === "1") {
assignedPrinters();
}
}, 60 * 1000);
// start the printer process after everything else is up ad running
setTimeout(async () => {
if (ocpActive[0].value === "1") {
if (ocpActive[0]?.value === "1") {
await updatePrinters();
await assignedPrinters();
printerCycle();