Compare commits

...

5 Commits

7 changed files with 86 additions and 1 deletions

View File

@@ -55,6 +55,11 @@ export default function DMButtons() {
<ForecastImport fileType={"pg"} name={"P&G"} /> <ForecastImport fileType={"pg"} name={"P&G"} />
</div> </div>
)} )}
{plantToken[0]?.value === "usksc1" && (
<div className="flex flex-row gap-2">
<ForecastImport fileType={"pg"} name={"P&G"} />
</div>
)}
</div> </div>
); );
} }

View File

@@ -129,6 +129,10 @@ export default function DmPage() {
If you desire you can send up to 1000 orders at one If you desire you can send up to 1000 orders at one
time... time...
</li> </li>
<li>
The customer MUST be set as default address in order
for the system to validate the av.
</li>
</ul> </ul>
</div> </div>
<Separator className="my-4" /> <Separator className="my-4" />

View File

@@ -35,7 +35,7 @@
} }
}, },
"admConfig": { "admConfig": {
"build": 356, "build": 358,
"oldBuild": "backend-0.1.3.zip" "oldBuild": "backend-0.1.3.zip"
}, },
"devDependencies": { "devDependencies": {

View File

@@ -0,0 +1,18 @@
import { desc } from "drizzle-orm";
import { db } from "../../../../database/dbclient.js";
import { fifoIndex } from "../../../../database/schema/fifoIndex.js";
export const getFifoIndex = async () => {
let articles: any = [];
try {
const res = await db
.select()
.from(fifoIndex)
.orderBy(desc(fifoIndex.add_Date));
articles = res;
} catch (error) {
articles = error;
}
return articles;
};

View File

@@ -7,6 +7,7 @@ import getOpenOrders from "./route/getOpenOrders.js";
import getDeliveryByDate from "./route/getDeliveryDateByRange.js"; import getDeliveryByDate from "./route/getDeliveryDateByRange.js";
import fakeEDI from "./route/fakeEDI.js"; import fakeEDI from "./route/fakeEDI.js";
import addressCorrections from "./route/getCityStateData.js"; import addressCorrections from "./route/getCityStateData.js";
import fifoIndex from "./route/getFifoIndex.js";
const app = new OpenAPIHono(); const app = new OpenAPIHono();
@@ -19,6 +20,7 @@ const routes = [
getDeliveryByDate, getDeliveryByDate,
fakeEDI, fakeEDI,
addressCorrections, addressCorrections,
fifoIndex,
] as const; ] as const;
const appRoutes = routes.forEach((route) => { const appRoutes = routes.forEach((route) => {

View File

@@ -103,6 +103,14 @@ const current: any = [
"Returns all addresses that will not process correctly in tms due to incorrect city state setup.", "Returns all addresses that will not process correctly in tms due to incorrect city state setup.",
//criteria: "address", // uncomment this out once the improt process can be faster //criteria: "address", // uncomment this out once the improt process can be faster
}, },
{
name: "Fifo index",
endpoint: "/api/datamart/getfifoindex",
// description: "Returns all inventory, by default excludes running numebrs, also excludes inv locations.",
description:
"Returns fifo index for all pallets shipped within the last 90 days.",
//criteria: "address", // uncomment this out once the improt process can be faster
},
]; ];
app.openapi( app.openapi(

View File

@@ -0,0 +1,48 @@
import { createRoute, OpenAPIHono, z } from "@hono/zod-openapi";
import { apiHit } from "../../../globalUtils/apiHits.js";
import { responses } from "../../../globalUtils/routeDefs/responses.js";
import { getActiveAv } from "../controller/getActiveArticles.js";
import { getFifoIndex } from "../controller/getFifoIndex.js";
const app = new OpenAPIHono({ strict: false });
const EomStat = z.object({
plant: z.string().openapi({ example: "Salt Lake City" }),
userRan: z.string().openapi({ example: "smith034" }),
eomSheetVersion: z.string().openapi({ example: "0.0.223" }),
});
app.openapi(
createRoute({
tags: ["dataMart"],
summary: "Returns all the fifo data.",
method: "get",
path: "/getfifoindex",
responses: responses(),
}),
async (c) => {
//const body = await c.req.json();
// make sure we have a vaid user being accessed thats really logged in
apiHit(c, { endpoint: "/getfifoindex" });
try {
return c.json(
{
success: true,
message: "Fifo index data for the last 90days",
data: await getFifoIndex(),
},
200
);
} catch (error) {
return c.json(
{
success: false,
message: "There was an error getting fifo index data.",
data: error,
},
400
);
}
}
);
export default app;