feat(tag reading): more tag reading updates, with more contorl now

station 1 and 2 are still pending but didnt have enough tags at the office trial it
This commit is contained in:
2025-03-16 15:37:40 -05:00
parent 1a79a97929
commit cb59f58926
12 changed files with 277 additions and 107 deletions

View File

@@ -0,0 +1,3 @@
/**
* we will monitor shipped out pallets every hour if they get shipped out
*/

View File

@@ -0,0 +1,3 @@
/**
* station 1 will just check for 10 tags
*/

View File

@@ -0,0 +1,4 @@
/**
* we will have 3 reader points here station2.1 will require 10 tags, 2.2 and 2.3 will require 1
*
*/

View File

@@ -0,0 +1,27 @@
/**
* Phase 1 we link the tag to the line only the line3.x where x is the line number
* Phase 2 we will generate a label to be reprinted at staion 4
*/
import {createLog} from "../../../logger/logger.js";
import type {TagData} from "../tagData.js";
import {tagStuff} from "../tags/crudTag.js";
export const station3Tags = async (tagData: TagData[]) => {
// make sure we only have one tag or dont update
if (tagData.length != 1) {
createLog(
"error",
"rfid",
"rfid",
`There are ${tagData.length} tags, and ${tagData[0].reader} only allows 1 tag to create a label.`
);
// get tag data
tagStuff(tagData);
} else {
//console.log("Generate the label and link it to the tag.");
const tagdata = await tagStuff(tagData);
createLog("info", "rfid", "rfid", "Generate a label and link it to this tag.");
}
};

View File

@@ -0,0 +1,43 @@
/**
* Phase 1 we will just follow the logic of printing a label when we are told requested to based on this tag.
* Phase 2 we will just reprint the tag that was generated at the line
*/
import {createLog} from "../../../logger/logger.js";
import type {TagData} from "../tagData.js";
import {tagStuff} from "../tags/crudTag.js";
export const wrapperStuff = async (tagData: TagData[]) => {
if (tagData.length != 1) {
createLog(
"error",
"rfid",
"rfid",
`There are ${tagData.length} tags and this ${tagData[0].reader} only allows 1 tag to create a label.`
);
tagStuff(tagData);
} else {
const tagdata = await tagStuff(tagData);
/**
* we want to make sure this pallet came from a line as its last spot if not we need to have a manual check.
*/
const station3 = tagdata.some((n: any) => n.lastareaIn.includes("line3"));
if (!station3) {
createLog(
"error",
"rfid",
"rfid",
`${tagdata.tag}, Did not come from a line please check the pallet and manually print the label.`
);
}
// check if a running number exists
if (station3.runningNumber) {
createLog("info", "rfid", "rfid", `Reprint label ${station3.runningNumber}`);
} else {
createLog("info", "rfid", "rfid", `A new labels will be created and linked to this ${tagdata.tag} tag`);
}
}
};