feat(exports): added in a button to export the lanes to cycle count
This commit is contained in:
@@ -9,14 +9,14 @@ import { cycleCountCheck } from "../../../../sqlServer/querys/warehouse/cycleCou
|
||||
// setting timer for updating stockCheck on a restart will always check.
|
||||
let lastCheck = 0;
|
||||
|
||||
export const lanes: any = [];
|
||||
export let lanes: any = [];
|
||||
|
||||
export const getLanesToCycleCount = async () => {
|
||||
const currentTime: any = timeZoneFix();
|
||||
// store the lanes in memeory
|
||||
createLog("info", "warehouse", "logistics", "Lane triggered update.");
|
||||
lastCheck = currentTime;
|
||||
const ageQuery = cycleCountCheck.replaceAll("[ageOfRow]", `1000`);
|
||||
const ageQuery = cycleCountCheck.replaceAll("[ageOfRow]", "90");
|
||||
const { data: prodLanes, error: pl } = await tryCatch(
|
||||
query(ageQuery, "Get Stock lane date.")
|
||||
);
|
||||
@@ -39,23 +39,25 @@ export const getLanesToCycleCount = async () => {
|
||||
warehouseName: prodLanes[i]?.warehouseName || "na",
|
||||
Description: prodLanes[i]?.Description,
|
||||
LastMoveDate: prodLanes[i]?.LastMoveDate
|
||||
? format(prodLanes[i]?.LastInv, "M/d/yyyy")
|
||||
? format(prodLanes[i]?.LastMoveDate, "M/d/yyyy")
|
||||
: undefined,
|
||||
LastInv: format(prodLanes[i]?.LastInv, "M/d/yyyy"),
|
||||
rowType: prodLanes[i].rowType,
|
||||
DaysSinceLast:
|
||||
differenceInDays(
|
||||
new Date(prodLanes[i].LastInv),
|
||||
new Date(prodLanes[i].LastMoveDate)
|
||||
) <= 0
|
||||
? 0
|
||||
: differenceInDays(
|
||||
new Date(prodLanes[i].LastInv),
|
||||
new Date(prodLanes[i].LastMoveDate)
|
||||
),
|
||||
DaysSinceLast: differenceInDays(
|
||||
new Date(Date.now()),
|
||||
new Date(prodLanes[i].LastInv)
|
||||
),
|
||||
upd_date: format(new Date(Date.now()), "M/d/yyyy"),
|
||||
};
|
||||
|
||||
const existing = lanes.filter(
|
||||
(l: any) => l.laneID === prodLanes[i]?.laneID
|
||||
);
|
||||
|
||||
if (existing) {
|
||||
lanes = lanes.filter((l: any) => l.laneID !== prodLanes[i]?.laneID);
|
||||
}
|
||||
|
||||
lanes.push(createLane);
|
||||
createLog(
|
||||
"debug",
|
||||
|
||||
Reference in New Issue
Block a user