/** * 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.` ); // when we manually run again we want to make sure we read from the 3rd antenna this way we do not get the wrong info. // more testing will need to be done on this. } // 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`); } } };