refactor(datamart): changes to customer inventory to include specific whse

This commit is contained in:
2025-06-20 11:16:19 -05:00
parent b9ff0a4138
commit 3073df342f
4 changed files with 17 additions and 7 deletions

View File

@@ -1,14 +1,23 @@
import { query } from "../../sqlServer/prodSqlServer.js";
import { customerInvNoHold } from "../../sqlServer/querys/dataMart/customerInventoryQuerys.js";
export const getCurrentCustomerInv = async (customer: any | null) => {
export const getCurrentCustomerInv = async (data: any | null) => {
//console.log(data.customer[0]);
let updatedQuery = customerInvNoHold;
if (customer) {
if (data.customer) {
//console.log(data.customer);
updatedQuery = customerInvNoHold.replaceAll(
"--and IdAdressen",
`and IdAdressen = ${customer}`
`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 {