refactor(ocme): added new error in posting where we know when the pallet is not instock

This commit is contained in:
2025-03-27 21:11:42 -05:00
parent 2c8d1fb710
commit 27d6b6e884

View File

@@ -38,6 +38,13 @@ export const postLabelData = async (data: any) => {
"There was an error getting the labelData"
);
}
if (label.length === 0) {
return {
success: false,
message: "The label you scanned dose not exist in stock.",
};
}
const newPost = {
sscc: newData.sscc ? newData.sscc : await createSSCC(newData.runningNr),
runningNr: newData.runningNr,
@@ -50,6 +57,7 @@ export const postLabelData = async (data: any) => {
const enterNewData = await db
.insert(ocmeData)
.values(newPost)
.onConflictDoUpdate({ target: ocmeData.runningNr, set: newPost })
.returning({
sscc: ocmeData.sscc,
runningNr: ocmeData.runningNr,
@@ -69,8 +77,8 @@ export const postLabelData = async (data: any) => {
//console.log(error);
return {
success: false,
message: "Data was posted to ocme info",
data: [],
message: "Was not posted",
data: [error],
};
}
};