fix(historicalinv): removed the second running one that caused duplicates

This commit is contained in:
2025-11-01 06:54:28 -05:00
parent ebe5c0bd5a
commit a6cc17ccb1
4 changed files with 143 additions and 132 deletions

View File

@@ -1,72 +1,70 @@
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 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";
import intervalChecks from "./route/getActiveLogistics.js";
import getActiveLanes from "./route/getActiveLanes.js";
import removeAsNonReable from "./route/removeAsNonReusable.js";
import getSSCC from "./route/getSSCCNumber.js";
import getConnectionType from "./route/getSiloConnectionData.js";
import detachSilo from "./route/detachSilo.js";
import attachSilo from "./route/attachSilo.js";
import getStockSilo from "./route/siloAdjustments/getStockData.js";
import postComment from "./route/siloAdjustments/postComment.js";
const app = new OpenAPIHono();
const routes = [
comsumeMaterial,
returnMat,
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,
// 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,
// logisitcs
removeAsNonReable,
getSSCC,
] as const;
// app.route("/server", modules);
const appRoutes = routes.forEach((route) => {
app.route("/logistics", route);
app.route("/logistics", route);
});
setTimeout(() => {
migrateAdjustments();
runHistoricalData();
migrateAdjustments();
//runHistoricalData();
}, 120 * 1000); // starts 2 min after a server restart or crash.
/**
@@ -74,10 +72,13 @@ setTimeout(() => {
*/
setTimeout(() => {
getLanesToCycleCount();
getLanesToCycleCount();
}, 5 * 1000);
setInterval(async () => {
getLanesToCycleCount();
}, 15 * 60 * 1000);
setInterval(
async () => {
getLanesToCycleCount();
},
15 * 60 * 1000,
);
export default app;