feat(silo): adjustments completed :D

This commit is contained in:
2025-04-07 07:01:50 -05:00
parent 31fbfa4eb3
commit 75f94eae14
5 changed files with 232 additions and 30 deletions

View File

@@ -58,6 +58,17 @@ export const createSiloAdjustment = async (
* Checking to see the difference, and send email if +/- 5% will change later if needed
*/
const sa: any = a;
if (!sa.success) {
console.log(`insde error`);
return {
success: sa.success,
message: sa.message,
data: sa.data,
};
}
const stockNummy = stock.filter((s: any) => s.LocationID === data.laneId);
const theDiff =
((data.quantity - stockNummy[0].Stock_Total) /
@@ -91,7 +102,7 @@ export const createSiloAdjustment = async (
data: postAdjError,
};
}
let adj: any = a;
if (Math.abs(theDiff) > 5) {
// console.log(`Send for comment due to being: ${theDiff.toFixed(2)}%`);
const server = set.filter((n: any) => n.name === "server");
@@ -123,8 +134,14 @@ export const createSiloAdjustment = async (
//console.log(emailSetup);
await sendEmail(emailSetup);
return {
success: adj.success,
message: `Silo adjustmnet was completed you will also receive and email due to the adjustment having a variation of ${Math.abs(
theDiff
).toFixed(2)}%`,
data: adj.data,
};
} else {
return { success: adj.success, message: adj.message, data: adj.data };
}
let adj: any = a;
return { success: adj.success, message: adj.message, data: adj.data };
};