fix(dyco): correction to disable the camera if ocme is off
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { createLog } from "../../../../../logger/logger.js";
|
||||
import { pickedup } from "../../../../../ocme/controller/pickedup.js";
|
||||
import { triggerScanner } from "../../../../../ocme/controller/triggerCamera.js";
|
||||
import { serverSettings } from "../../../../../server/controller/settings/getSettings.js";
|
||||
|
||||
let lastProcessedTimestamp = 0;
|
||||
|
||||
@@ -10,13 +11,16 @@ export const palletSendTag = async (tagData: any) => {
|
||||
* 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();
|
||||
|
||||
// Only process if this is a new timestamp within the last 5 seconds
|
||||
if (
|
||||
tagTime !== lastProcessedTimestamp &&
|
||||
Date.now() - tagTime <= 5000 &&
|
||||
tagData.value
|
||||
tagData.value &&
|
||||
ocmeActive[0].value === "1"
|
||||
) {
|
||||
lastProcessedTimestamp = tagTime;
|
||||
//console.log(tagData.state.timestamp);
|
||||
@@ -47,7 +51,8 @@ export const palletSendTag = async (tagData: any) => {
|
||||
if (
|
||||
tagTime !== lastProcessedTimestamp &&
|
||||
Date.now() - tagTime <= 5000 &&
|
||||
!tagData.value
|
||||
!tagData.value &&
|
||||
ocmeActive[0].value === "1"
|
||||
) {
|
||||
await pickedup({ runningNr: 1234, all: true, areaFrom: "wrapper_1" });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user