refactor(ocme): corrections to endpoints to work with ocnme as intneeded
This commit is contained in:
@@ -3,44 +3,64 @@
|
||||
* 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";
|
||||
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`);
|
||||
}
|
||||
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);
|
||||
if (!tagData) {
|
||||
createLog("error", "rfid", "rfid", `No tagData was grabbed.`);
|
||||
}
|
||||
|
||||
/**
|
||||
* we want to make sure this pallet came from a line as its last spot if not we need to have a manual check.
|
||||
*/
|
||||
if (
|
||||
!Array.isArray(tagdata) &&
|
||||
tagdata?.some((n: any) => n.lastareaIn.includes("line3"))
|
||||
) {
|
||||
createLog("error", "rfid", "rfid", `Data passed over is not an array.`);
|
||||
return;
|
||||
}
|
||||
const station3 = tagdata; //?.some((n: any) => n.lastareaIn.includes("line3"));
|
||||
|
||||
if (!station3) {
|
||||
createLog(
|
||||
"error",
|
||||
"rfid",
|
||||
"rfid",
|
||||
`${tagdata[0].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`
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user