Files
lstV2/server/services/logistics/controller/warehouse/cycleCountChecks/getCycleCountCheck.ts
Blake Matthes 6665b77e09 feat(cyclecountcheck): added i cycle count check this is in mem right now
if this becomes a resource hog we will move it to the db. no need for it to really be presitant
2025-04-09 17:50:06 -05:00

29 lines
842 B
TypeScript

import { lanes } from "./cyclecountCheck.js";
export const getCycleCountCheck = async (
age: number = 1000,
type: string = ""
) => {
/**
* Get the lane data based on the age and type
*/
let filteredLanes = lanes.filter((t: any) => t.DaysSinceLast >= age);
if (type != "") {
return {
sucess: true,
message: `${filteredLanes.length} lanes that are of type ${type} and have not been cycle counted in the last ${age} days.`,
data: filteredLanes.filter(
(t: any) => t.rowType === type.toUpperCase()
),
};
} else {
return {
success: true,
message: `${filteredLanes.length} lanes grabed that have not been cycle counted in the last ${age} days.`,
data: filteredLanes,
};
}
};