Files
lst/lstV2/server/services/logistics/logisticsService.ts

85 lines
2.4 KiB
TypeScript

import { OpenAPIHono } from "@hono/zod-openapi";
import { migrateAdjustments } from "./controller/siloAdjustments/migrateAdjustments.js";
import { getLanesToCycleCount } from "./controller/warehouse/cycleCountChecks/cyclecountCheck.js";
import attachSilo from "./route/attachSilo.js";
import comsumeMaterial from "./route/consumeMaterial.js";
import detachSilo from "./route/detachSilo.js";
import postBulkOrders from "./route/dm/bulkOrdersIn.js";
import postForecast from "./route/dm/forecastIn.js";
import standardForcasttemplate from "./route/dm/getStandardForecastTemplate.js";
import standardTemplate from "./route/dm/getStandardTemplate.js";
import getActiveLanes from "./route/getActiveLanes.js";
import intervalChecks from "./route/getActiveLogistics.js";
import getCycleCountCheck from "./route/getCycleCountChecks.js";
import getcyclecount from "./route/getCycleCountLanes.js";
import outbound from "./route/getOutbound.js";
import getPPOO from "./route/getPPOO.js";
import getConnectionType from "./route/getSiloConnectionData.js";
import getSSCC from "./route/getSSCCNumber.js";
import removeAsNonReable from "./route/removeAsNonReusable.js";
import returnMat from "./route/returnMaterial.js";
import createSiloAdjustment from "./route/siloAdjustments/createSiloAdjustment.js";
import getSiloAdjustments from "./route/siloAdjustments/getSiloAdjustments.js";
import getStockSilo from "./route/siloAdjustments/getStockData.js";
import postComment from "./route/siloAdjustments/postComment.js";
const app = new OpenAPIHono();
const routes = [
comsumeMaterial,
returnMat,
// silo
createSiloAdjustment,
postComment,
getStockSilo,
getSiloAdjustments,
getConnectionType,
detachSilo,
attachSilo,
//lanes
getCycleCountCheck,
//warehouse
getPPOO,
getcyclecount,
getActiveLanes,
//DM
postBulkOrders,
standardTemplate,
postForecast,
standardForcasttemplate,
// outbound deliveries
outbound,
intervalChecks,
// logisitcs
removeAsNonReable,
getSSCC,
] 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;