feat(barcode gen): added in lane exports both single and multiple intial release

This commit is contained in:
2025-05-31 02:17:00 -05:00
parent a6844d9455
commit 2672e89005
15 changed files with 1112 additions and 3 deletions

View File

@@ -0,0 +1,24 @@
import { tryCatch } from "../../../../globalUtils/tryCatch.js";
import { query } from "../../../sqlServer/prodSqlServer.js";
import { activeWarehouseLanes } from "../../../sqlServer/querys/warehouse/activeWarehouseLanes.js";
export const getActiveWarehouseLanes = async () => {
const { data, error } = await tryCatch(
query(activeWarehouseLanes, "Get active warehouse lanes")
);
if (error) {
return {
success: false,
message: "Error getting active warehouse lanes",
data: error,
};
}
const lanes: any = data as any;
return {
success: true,
message: "Current active warehouse lanes.",
data: lanes.data,
};
};

View File

@@ -17,6 +17,8 @@ import standardForcasttemplate from "./route/dm/getStandardForecastTemplate.js";
import postForecast from "./route/dm/forecastIn.js";
import outbound from "./route/getOutbound.js";
import { runHistoricalData } from "./controller/eom/historicalInv.js";
import intervalChecks from "./route/getActiveLogistics.js";
import getActiveLanes from "./route/getActiveLanes.js";
const app = new OpenAPIHono();
@@ -34,6 +36,7 @@ const routes = [
//warehouse
getPPOO,
getcyclecount,
getActiveLanes,
//DM
postBulkOrders,
standardTemplate,
@@ -41,6 +44,7 @@ const routes = [
standardForcasttemplate,
// outbound deliveries
outbound,
intervalChecks,
] as const;
// app.route("/server", modules);

View File

@@ -0,0 +1,57 @@
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";
import { apiHit } from "../../../globalUtils/apiHits.js";
import { getActiveWarehouseLanes } from "../controller/warehouse/activeWarehouseLanes.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 current active lanes",
method: "get",
path: "/getactivelanes",
// request: {
// body: {
// content: {
// "application/json": { schema: Body },
// },
// },
// },
// description:
// "Provided a running number and lot number you can consume material.",
responses: responses(),
}),
async (c: any) => {
apiHit(c, { endpoint: "/getactivelanes" });
const { data: lanes, error } = await tryCatch(
getActiveWarehouseLanes()
);
if (error) {
return c.json({
success: false,
message: "Error getting lane data.",
data: error,
});
}
return c.json({
success: lanes.success,
message: lanes.message,
data: lanes.data,
});
}
);
export default app;

View File

@@ -0,0 +1,32 @@
// an external way to creating logs
import { createRoute, OpenAPIHono, z } from "@hono/zod-openapi";
import { responses } from "../../../globalUtils/routeDefs/responses.js";
import { apiHit } from "../../../globalUtils/apiHits.js";
import { getAllLogisticsJobs } from "../utils/logisticsIntervals.js";
const app = new OpenAPIHono({ strict: false });
app.openapi(
createRoute({
tags: ["logistics"],
summary: "Returns current active logistics intervals.",
method: "get",
path: "/activelogistics",
//middleware: authMiddleware,
responses: responses(),
}),
async (c) => {
apiHit(c, { endpoint: "/activelogistics" });
const jobs = getAllLogisticsJobs();
return c.json({
success: true,
message:
jobs.length === 0
? "There are no active logistics intervals Currently."
: "Current Active logistics intervals",
data: jobs,
});
}
);
export default app;

View File

@@ -75,6 +75,23 @@ const newSubModules = [
active: false,
subSubModule: [],
},
{
name: "Barcodes",
moduleName: "logistics",
description: "Barcodes, lanes and scanable",
link: "/barcodegen",
icon: "Barcode",
roles: [
"viewer",
"technician",
"supervisor",
"manager",
"admin",
"systemAdmin",
],
active: true,
subSubModule: [],
},
// admin module
{

View File

@@ -0,0 +1,15 @@
export const activeWarehouseLanes = `
select
w.IdWarenLager as warehouseId,
w.Bezeichnung as warehouseDescription,
IdLagerAbteilung as laneId,
b.Bezeichnung as laneDescription
--,*
from [AlplaPROD_test1].[dbo].[T_LagerAbteilungen] (nolock) b
left join
AlplaPROD_test1.dbo.T_WarenLager (nolock) as w
on b.IdWarenLager = w.IdWarenLager
where b.aktiv = 1 and w.idwarenlager not in (5,6)
`;