fix(dyco): correction to disable the camera if ocme is off

This commit is contained in:
2025-08-04 12:44:03 -05:00
parent 98a5ca7bb8
commit c7bb12822b

View File

@@ -1,6 +1,7 @@
import { createLog } from "../../../../../logger/logger.js"; import { createLog } from "../../../../../logger/logger.js";
import { pickedup } from "../../../../../ocme/controller/pickedup.js"; import { pickedup } from "../../../../../ocme/controller/pickedup.js";
import { triggerScanner } from "../../../../../ocme/controller/triggerCamera.js"; import { triggerScanner } from "../../../../../ocme/controller/triggerCamera.js";
import { serverSettings } from "../../../../../server/controller/settings/getSettings.js";
let lastProcessedTimestamp = 0; let lastProcessedTimestamp = 0;
@@ -10,13 +11,16 @@ export const palletSendTag = async (tagData: any) => {
* We will only trigger the camera and removal of pending tags * We will only trigger the camera and removal of pending tags
*/ */
const ocmeActive = serverSettings.filter((n) => n.name === "ocmeService");
const tagTime = new Date(tagData.state.timestamp).getTime(); const tagTime = new Date(tagData.state.timestamp).getTime();
// Only process if this is a new timestamp within the last 5 seconds // Only process if this is a new timestamp within the last 5 seconds
if ( if (
tagTime !== lastProcessedTimestamp && tagTime !== lastProcessedTimestamp &&
Date.now() - tagTime <= 5000 && Date.now() - tagTime <= 5000 &&
tagData.value tagData.value &&
ocmeActive[0].value === "1"
) { ) {
lastProcessedTimestamp = tagTime; lastProcessedTimestamp = tagTime;
//console.log(tagData.state.timestamp); //console.log(tagData.state.timestamp);
@@ -47,7 +51,8 @@ export const palletSendTag = async (tagData: any) => {
if ( if (
tagTime !== lastProcessedTimestamp && tagTime !== lastProcessedTimestamp &&
Date.now() - tagTime <= 5000 && Date.now() - tagTime <= 5000 &&
!tagData.value !tagData.value &&
ocmeActive[0].value === "1"
) { ) {
await pickedup({ runningNr: 1234, all: true, areaFrom: "wrapper_1" }); await pickedup({ runningNr: 1234, all: true, areaFrom: "wrapper_1" });
} }