feat(ocp): completly moved ocp to lst

This commit is contained in:
2025-04-06 07:48:05 -05:00
parent 95bebbde2b
commit 51cc4aa370
13 changed files with 448 additions and 96 deletions

View File

@@ -13,6 +13,9 @@ import { dycoConnect } from "./controller/specialProcesses/dyco/plcConnection.js
import dycoCon from "./routes/specialProcesses/dyco/connection.js";
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";
const app = new OpenAPIHono();
@@ -43,14 +46,34 @@ app.all("/ocp/*", (c) => {
});
});
/**
* Get the settings so we only run items when they are truly active
*/
const dycoActive = setting.filter((n) => n.name == "dycoConnect");
const ocpActive = setting.filter((n) => n.name === "ocpActive");
// run the printer update on restart just to keep everything good
setTimeout(() => {
updatePrinters();
}, 3 * 1000);
// do the intnal connection to the dyco
setTimeout(() => {
dycoConnect();
if (dycoActive[0].value === "1") {
dycoConnect();
}
}, 3 * 1000);
// check for printers being assigned
setInterval(() => {
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") {
await updatePrinters();
await assignedPrinters();
printerCycle();
}
}, 10 * 1000);
export default app;