fix(inventory): changes to accruatly adjust the query and check the feature set

This commit is contained in:
2026-04-20 07:25:33 -05:00
parent 82f8369640
commit 32517d0c98

View File

@@ -117,7 +117,7 @@ export const runDatamartQuery = async (data: Data) => {
// for queries that will need to be ran on legacy until we get the plant updated need to go in here // for queries that will need to be ran on legacy until we get the plant updated need to go in here
const doubleQueries = ["inventory"]; const doubleQueries = ["inventory"];
const sqlQuery = sqlQuerySelector( const sqlQuery = sqlQuerySelector(
`datamart.${fd.data[0].activated > 0 && !doubleQueries.includes(data.name) ? data.name : `legacy.${data.name}`}`, `datamart.${fd.data[0].activated > 0 && doubleQueries.includes(data.name) ? data.name : `legacy.${data.name}`}`,
) as SqlQuery; ) as SqlQuery;
// checking if warehousing is as it will start to effect a lot of queries for plants that are not on 2. // checking if warehousing is as it will start to effect a lot of queries for plants that are not on 2.
@@ -201,10 +201,15 @@ export const runDatamartQuery = async (data: Data) => {
"--,l.MachineLocation,l.MachineName,l.ProductionLotRunningNumber as lot", "--,l.MachineLocation,l.MachineName,l.ProductionLotRunningNumber as lot",
`${data.options.lots ? `,l.MachineLocation,l.MachineName,l.ProductionLotRunningNumber as lot` : `--,l.MachineLocation,l.MachineName,l.ProductionLotRunningNumber as lot`}`, `${data.options.lots ? `,l.MachineLocation,l.MachineName,l.ProductionLotRunningNumber as lot` : `--,l.MachineLocation,l.MachineName,l.ProductionLotRunningNumber as lot`}`,
) )
.replaceAll(
"--,l.MachineLocation,l.MachineName,l.ProductionLotRunningNumber",
`${data.options.lots ? `,l.MachineLocation,l.MachineName,l.ProductionLotRunningNumber` : `--,l.MachineLocation,l.MachineName,l.ProductionLotRunningNumber`}`,
)
.replaceAll( .replaceAll(
"--,l.WarehouseDescription,l.LaneDescription", "--,l.WarehouseDescription,l.LaneDescription",
`${data.options.locations ? `,l.WarehouseDescription,l.LaneDescription` : `--,l.WarehouseDescription,l.LaneDescription`}`, `${data.options.locations ? `,l.WarehouseDescription,l.LaneDescription` : `--,l.WarehouseDescription,l.LaneDescription`}`,
); );
break; break;
case "fakeEDIUpdate": case "fakeEDIUpdate":
datamartQuery = datamartQuery.replace( datamartQuery = datamartQuery.replace(