68 lines
2.0 KiB
TypeScript
68 lines
2.0 KiB
TypeScript
import { OpenAPIHono } from "@hono/zod-openapi";
|
|
|
|
import comsumeMaterial from "./route/consumeMaterial.js";
|
|
import returnMat from "./route/returnMaterial.js";
|
|
import createSiloAdjustment from "./route/siloAdjustments/createSiloAdjustment.js";
|
|
import postComment from "./route/siloAdjustments/postComment.js";
|
|
import getStockSilo from "./route/siloAdjustments/getStockData.js";
|
|
import { migrateAdjustments } from "./controller/siloAdjustments/migrateAdjustments.js";
|
|
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";
|
|
import getcyclecount from "./route/getCycleCountLanes.js";
|
|
import postBulkOrders from "./route/dm/bulkOrdersIn.js";
|
|
import standardTemplate from "./route/dm/getStandardTemplate.js";
|
|
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";
|
|
|
|
const app = new OpenAPIHono();
|
|
|
|
const routes = [
|
|
comsumeMaterial,
|
|
returnMat,
|
|
|
|
// silo
|
|
createSiloAdjustment,
|
|
postComment,
|
|
getStockSilo,
|
|
getSiloAdjustments,
|
|
//lanes
|
|
getCycleCountCheck,
|
|
//warehouse
|
|
getPPOO,
|
|
getcyclecount,
|
|
//DM
|
|
postBulkOrders,
|
|
standardTemplate,
|
|
postForecast,
|
|
standardForcasttemplate,
|
|
// outbound deliveries
|
|
outbound,
|
|
] as const;
|
|
|
|
// app.route("/server", modules);
|
|
const appRoutes = routes.forEach((route) => {
|
|
app.route("/logistics", route);
|
|
});
|
|
|
|
setTimeout(() => {
|
|
migrateAdjustments();
|
|
runHistoricalData();
|
|
}, 120 * 1000); // starts 2 min after a server restart or crash.
|
|
|
|
/**
|
|
* Start the cycle count check
|
|
*/
|
|
|
|
setTimeout(() => {
|
|
getLanesToCycleCount();
|
|
}, 5 * 1000);
|
|
setInterval(async () => {
|
|
getLanesToCycleCount();
|
|
}, 15 * 60 * 1000);
|
|
|
|
export default app;
|