test(reporting): more reporting tables for different reports
This commit is contained in:
@@ -14,13 +14,23 @@ export const lanes: any = [];
|
||||
export const getLanesToCycleCount = async () => {
|
||||
const currentTime: any = timeZoneFix();
|
||||
// store the lanes in memeory
|
||||
createLog("info", "warehouse", "logistics", "Empty lane triggered update.");
|
||||
createLog("info", "warehouse", "logistics", "Lane triggered update.");
|
||||
lastCheck = currentTime;
|
||||
const ageQuery = cycleCountCheck.replaceAll("[ageOfRow]", `1000`);
|
||||
const { data: prodLanes, error: pl } = await tryCatch(
|
||||
query(ageQuery, "Get Stock lane date.")
|
||||
);
|
||||
|
||||
if (pl) {
|
||||
createLog(
|
||||
"error",
|
||||
"warehouse",
|
||||
"logistics",
|
||||
`There was an error getting lanes: ${pl}`
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
// run the update on the lanes
|
||||
for (let i = 0; i < prodLanes.length; i++) {
|
||||
const createLane = {
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
import { tryCatch } from "../../../../../globalUtils/tryCatch.js";
|
||||
import { query } from "../../../../sqlServer/prodSqlServer.js";
|
||||
import { ppooQuery } from "../../../../sqlServer/querys/warehouse/ppooQuery.js";
|
||||
|
||||
export const getPPOO = async () => {
|
||||
const { data, error } = await tryCatch(query(ppooQuery, "Get PPOO"));
|
||||
|
||||
if (error) {
|
||||
return { success: false, message: "Error getting ppoo", data: error };
|
||||
}
|
||||
|
||||
return { success: true, message: "Current pallets in PPOO.", data: data };
|
||||
};
|
||||
@@ -9,6 +9,7 @@ import { migrateAdjustments } from "./controller/siloAdjustments/migrateAdjustme
|
||||
import getSiloAdjustments from "./route/siloAdjustments/getSiloAdjustments.js";
|
||||
import { getLanesToCycleCount } from "./controller/warehouse/cycleCountChecks/cyclecountCheck.js";
|
||||
import getCycleCountCheck from "./route/getCycleCountChecks.js";
|
||||
import getPPOO from "./route/getPPOO.js";
|
||||
|
||||
const app = new OpenAPIHono();
|
||||
|
||||
@@ -23,6 +24,8 @@ const routes = [
|
||||
getSiloAdjustments,
|
||||
//lanes
|
||||
getCycleCountCheck,
|
||||
//warehouse
|
||||
getPPOO,
|
||||
] as const;
|
||||
|
||||
// app.route("/server", modules);
|
||||
|
||||
53
server/services/logistics/route/getPPOO.ts
Normal file
53
server/services/logistics/route/getPPOO.ts
Normal file
@@ -0,0 +1,53 @@
|
||||
import { createRoute, OpenAPIHono, z } from "@hono/zod-openapi";
|
||||
import { responses } from "../../../globalUtils/routeDefs/responses.js";
|
||||
import { tryCatch } from "../../../globalUtils/tryCatch.js";
|
||||
import { getCycleCountCheck } from "../controller/warehouse/cycleCountChecks/getCycleCountCheck.js";
|
||||
import { getPPOO } from "../controller/warehouse/ppoo/getPPOO.js";
|
||||
|
||||
const app = new OpenAPIHono();
|
||||
|
||||
// const Body = z
|
||||
// .object({
|
||||
// age: z.number().optional().openapi({ example: 90 }),
|
||||
// //email: z.string().optional().openapi({example: "s.smith@example.com"}),
|
||||
// type: z.string().optional().openapi({ example: "fg" }),
|
||||
// })
|
||||
// .openapi("User");
|
||||
app.openapi(
|
||||
createRoute({
|
||||
tags: ["logistics"],
|
||||
summary: "Returns pallets currently in ppoo",
|
||||
method: "get",
|
||||
path: "/getppoo",
|
||||
// request: {
|
||||
// body: {
|
||||
// content: {
|
||||
// "application/json": { schema: Body },
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// description:
|
||||
// "Provided a running number and lot number you can consume material.",
|
||||
responses: responses(),
|
||||
}),
|
||||
async (c) => {
|
||||
//apiHit(c, { endpoint: "api/sqlProd/close" });
|
||||
|
||||
const { data: ppoo, error } = await tryCatch(getPPOO());
|
||||
|
||||
if (error) {
|
||||
return c.json({
|
||||
success: false,
|
||||
message: "Error getting lane data.",
|
||||
data: error,
|
||||
});
|
||||
}
|
||||
|
||||
return c.json({
|
||||
success: ppoo.success,
|
||||
message: ppoo.message,
|
||||
data: ppoo.data,
|
||||
});
|
||||
}
|
||||
);
|
||||
export default app;
|
||||
@@ -15,6 +15,14 @@ export const getLots = async () => {
|
||||
};
|
||||
}
|
||||
|
||||
// if (!lotInfo.data.success) {
|
||||
// return {
|
||||
// success: false,
|
||||
// message: "There was an error getting the lots",
|
||||
// data: lotInfo.data.message,
|
||||
// };
|
||||
// }
|
||||
|
||||
return {
|
||||
success: true,
|
||||
message: "Current active lots that are technically released.",
|
||||
|
||||
@@ -81,7 +81,7 @@ setTimeout(async () => {
|
||||
await updatePrinters();
|
||||
await assignedPrinters();
|
||||
printerCycle();
|
||||
printerCycleAutoLabelers();
|
||||
// printerCycleAutoLabelers();
|
||||
}
|
||||
}, 10 * 1000);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user