feat(lstv2 move): moved lstv2 into this app to keep them combined and easier to maintain

This commit is contained in:
2025-09-19 22:22:05 -05:00
parent caf2315191
commit e4477402ad
847 changed files with 165801 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
import { query } from "../../sqlServer/prodSqlServer.js";
import { customerInvNoHold } from "../../sqlServer/querys/dataMart/customerInventoryQuerys.js";
export const getCurrentCustomerInv = async (data: any | null) => {
//console.log(data.customer[0]);
let updatedQuery = customerInvNoHold;
if (data.customer) {
//console.log(data.customer);
updatedQuery = customerInvNoHold.replaceAll(
"--and IdAdressen",
`and IdAdressen = ${data.customer[0]}`
);
}
if (data.whseToInclude) {
updatedQuery = updatedQuery.replaceAll(
"--and x.IdWarenlager in (14,15)",
`and x.IdWarenlager in (${data.whseToInclude[0]})`
);
}
try {
const inventory: any = await query(
updatedQuery,
"Get active inventory"
);
return {
success: true,
message: "All customer inventory minus holds",
data: inventory.data,
};
} catch (error) {
return {
success: false,
message: "There was an error getting the inventory",
data: error,
};
}
};