Compare commits
26 Commits
46bb695840
...
a68a3ba640
| Author | SHA1 | Date | |
|---|---|---|---|
| a68a3ba640 | |||
| af8d53cac1 | |||
| 5cdca0a41f | |||
| 9cb8ca6813 | |||
| d5114ba243 | |||
| e7e35336f8 | |||
| fae1f36555 | |||
| 69031a7f0e | |||
| fc621c8ca6 | |||
| be1074d142 | |||
| 365a24ce5f | |||
| 94f5906299 | |||
| 35652e3735 | |||
| 84e0c46be9 | |||
| f5fd1c0890 | |||
| 7dab5f36ec | |||
| 1b69edfef0 | |||
| 4c799c70ab | |||
| fbd63e6da2 | |||
| be31ae2c04 | |||
| 5f486bf6cd | |||
| 8cf4e3e31c | |||
| 558673d8c4 | |||
| 9add660249 | |||
| 02912825de | |||
| 0793c5f7d6 |
@@ -34,6 +34,7 @@ export function AddCards() {
|
|||||||
<Cards name={"inv-materials"} rowType={"materials"} />
|
<Cards name={"inv-materials"} rowType={"materials"} />
|
||||||
<Cards name={"inv-packaging"} rowType={"packaging"} />
|
<Cards name={"inv-packaging"} rowType={"packaging"} />
|
||||||
<Cards name={"inv-waste"} rowType={"waste"} />
|
<Cards name={"inv-waste"} rowType={"waste"} />
|
||||||
|
<Cards name={"openOrder"} inventory />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
import { useCardStore } from "@/lib/store/useCardStore";
|
import { useCardStore } from "@/lib/store/useCardStore";
|
||||||
import INVCheckCard from "../logistics/warehouse/InventoryCard";
|
import INVCheckCard from "../logistics/warehouse/InventoryCard";
|
||||||
import PPOO from "../logistics/warehouse/PPOOCard";
|
import PPOO from "../logistics/warehouse/PPOOCard";
|
||||||
|
import OpenOrders from "../logistics/warehouse/openOrders";
|
||||||
|
|
||||||
const componentsMap: any = {
|
const componentsMap: any = {
|
||||||
ppoo: PPOO,
|
ppoo: PPOO,
|
||||||
inv: INVCheckCard,
|
inv: INVCheckCard,
|
||||||
|
openOrder: OpenOrders,
|
||||||
//QualityRequest,
|
//QualityRequest,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -18,12 +20,19 @@ export default function DashBoard() {
|
|||||||
const name = a.name; //.filter((c) => c.i === card.i)[0].i || "name";
|
const name = a.name; //.filter((c) => c.i === card.i)[0].i || "name";
|
||||||
|
|
||||||
const Component = componentsMap[name.split("-")[0]];
|
const Component = componentsMap[name.split("-")[0]];
|
||||||
|
if (name === "openOrder") {
|
||||||
return (
|
return (
|
||||||
<div key={a.name} className="col-span-3">
|
<div key={a.name} className="col-span-6">
|
||||||
<Component age={a.age} type={a.rowType} />{" "}
|
<Component age={a.age} type={a.rowType} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
return (
|
||||||
|
<div key={a.name} className="col-span-3">
|
||||||
|
<Component age={a.age} type={a.rowType} />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -25,6 +25,9 @@ export default function INVCheckCard(props: any) {
|
|||||||
laneData = laneData.filter(
|
laneData = laneData.filter(
|
||||||
(l: any) => l.rowType === props.type.toUpperCase()
|
(l: any) => l.rowType === props.type.toUpperCase()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// age
|
||||||
|
laneData = laneData.filter((l: any) => l.DaysSinceLast >= props.age);
|
||||||
}
|
}
|
||||||
|
|
||||||
// const handleCloseCard = () => {
|
// const handleCloseCard = () => {
|
||||||
|
|||||||
33
frontend/src/components/logistics/warehouse/openOrders.tsx
Normal file
33
frontend/src/components/logistics/warehouse/openOrders.tsx
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
//import { LstCard } from "@/components/extendedUI/LstCard";
|
||||||
|
|
||||||
|
import { getOpenOrders } from "@/utils/querys/logistics/getOpenOrders";
|
||||||
|
import { openOrderColumns } from "@/utils/tableData/openorders/ooColumns";
|
||||||
|
import { OpenOrderTable } from "@/utils/tableData/openorders/ooData";
|
||||||
|
|
||||||
|
import { useQuery } from "@tanstack/react-query";
|
||||||
|
//import { CircleX } from "lucide-react";
|
||||||
|
//import { Suspense } from "react";
|
||||||
|
//import { toast } from "sonner";
|
||||||
|
|
||||||
|
export default function OpenOrders() {
|
||||||
|
//{ style = {} }
|
||||||
|
const { data, isError, isLoading } = useQuery(getOpenOrders());
|
||||||
|
|
||||||
|
if (isLoading) return <div>Loading openOrder data...</div>;
|
||||||
|
if (isError) {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<p>There was an error getting the openorders.</p>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
let openOrders: any = data;
|
||||||
|
|
||||||
|
// const handleCloseCard = () => {
|
||||||
|
// //removeCard("PPOO");
|
||||||
|
|
||||||
|
// toast.success("card removed");
|
||||||
|
// };
|
||||||
|
|
||||||
|
return <OpenOrderTable columns={openOrderColumns} data={openOrders} />;
|
||||||
|
}
|
||||||
@@ -30,6 +30,7 @@ import { toast } from "sonner";
|
|||||||
const printReason = [
|
const printReason = [
|
||||||
{ key: "printerIssue", label: "Printer Related" },
|
{ key: "printerIssue", label: "Printer Related" },
|
||||||
{ key: "missingRfidTag", label: "Missing or incorrect tag" },
|
{ key: "missingRfidTag", label: "Missing or incorrect tag" },
|
||||||
|
{ key: "rfidMissScan", label: "Missed Scan from RFID reader" },
|
||||||
{ key: "strapper", label: "Strapper Error" },
|
{ key: "strapper", label: "Strapper Error" },
|
||||||
{ key: "manualCheck", label: "20th pallet check" },
|
{ key: "manualCheck", label: "20th pallet check" },
|
||||||
{ key: "outOfSync", label: "Labeler Out of Sync" },
|
{ key: "outOfSync", label: "Labeler Out of Sync" },
|
||||||
@@ -39,6 +40,7 @@ export default function ManualPrintForm() {
|
|||||||
const token = localStorage.getItem("auth_token");
|
const token = localStorage.getItem("auth_token");
|
||||||
const { settings } = useSettingStore();
|
const { settings } = useSettingStore();
|
||||||
const [open, setOpen] = useState(false);
|
const [open, setOpen] = useState(false);
|
||||||
|
const [isSubmitting, setIsSubmitting] = useState(false);
|
||||||
const server = settings.filter((n) => n.name === "server")[0]?.value;
|
const server = settings.filter((n) => n.name === "server")[0]?.value;
|
||||||
// const serverPort = settings.filter((n) => n.name === "serverPort")[0]?.value;
|
// const serverPort = settings.filter((n) => n.name === "serverPort")[0]?.value;
|
||||||
// const serverUrl = `http://${server}:${serverPort}`;
|
// const serverUrl = `http://${server}:${serverPort}`;
|
||||||
@@ -57,6 +59,7 @@ export default function ManualPrintForm() {
|
|||||||
const handleManualPrintLog = async (logData: any) => {
|
const handleManualPrintLog = async (logData: any) => {
|
||||||
// toast.success(`A new label was sent to printer: ${lot.PrinterName} for line ${lot.MachineDescription} `);
|
// toast.success(`A new label was sent to printer: ${lot.PrinterName} for line ${lot.MachineDescription} `);
|
||||||
const logdataUrl = `/api/ocp/manuallabellog`;
|
const logdataUrl = `/api/ocp/manuallabellog`;
|
||||||
|
setIsSubmitting(true);
|
||||||
axios
|
axios
|
||||||
.post(logdataUrl, logData, {
|
.post(logdataUrl, logData, {
|
||||||
headers: { Authorization: `Bearer ${token}` },
|
headers: { Authorization: `Bearer ${token}` },
|
||||||
@@ -70,16 +73,19 @@ export default function ManualPrintForm() {
|
|||||||
}
|
}
|
||||||
reset();
|
reset();
|
||||||
setOpen(false);
|
setOpen(false);
|
||||||
|
setIsSubmitting(false);
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
if (e.response.status === 500) {
|
if (e.response.status === 500) {
|
||||||
toast.error(`Internal Server error please try again.`);
|
toast.error(`Internal Server error please try again.`);
|
||||||
|
setIsSubmitting(false);
|
||||||
return { sucess: false };
|
return { sucess: false };
|
||||||
}
|
}
|
||||||
|
|
||||||
if (e.response.status === 401) {
|
if (e.response.status === 401) {
|
||||||
//console.log(e.response);
|
//console.log(e.response);
|
||||||
toast.error(`You are not authorized to do this.`);
|
toast.error(`You are not authorized to do this.`);
|
||||||
|
setIsSubmitting(false);
|
||||||
return { sucess: false };
|
return { sucess: false };
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -250,7 +256,11 @@ export default function ManualPrintForm() {
|
|||||||
>
|
>
|
||||||
Close
|
Close
|
||||||
</Button>
|
</Button>
|
||||||
<Button color="primary" type="submit">
|
<Button
|
||||||
|
color="primary"
|
||||||
|
type="submit"
|
||||||
|
disabled={isSubmitting}
|
||||||
|
>
|
||||||
Print
|
Print
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import { Route as AdminNotificationMGTImport } from './routes/_admin/notificatio
|
|||||||
import { Route as AdminModulesImport } from './routes/_admin/modules'
|
import { Route as AdminModulesImport } from './routes/_admin/modules'
|
||||||
import { Route as ocmeCyclecountIndexImport } from './routes/(ocme)/cyclecount/index'
|
import { Route as ocmeCyclecountIndexImport } from './routes/(ocme)/cyclecount/index'
|
||||||
import { Route as logisticsSiloAdjustmentsIndexImport } from './routes/(logistics)/siloAdjustments/index'
|
import { Route as logisticsSiloAdjustmentsIndexImport } from './routes/(logistics)/siloAdjustments/index'
|
||||||
|
import { Route as logisticsOpenOrdersIndexImport } from './routes/(logistics)/openOrders/index'
|
||||||
import { Route as logisticsMaterialHelperIndexImport } from './routes/(logistics)/materialHelper/index'
|
import { Route as logisticsMaterialHelperIndexImport } from './routes/(logistics)/materialHelper/index'
|
||||||
import { Route as EomArticleAvImport } from './routes/_eom/article/$av'
|
import { Route as EomArticleAvImport } from './routes/_eom/article/$av'
|
||||||
import { Route as logisticsSiloAdjustmentsHistImport } from './routes/(logistics)/siloAdjustments/$hist'
|
import { Route as logisticsSiloAdjustmentsHistImport } from './routes/(logistics)/siloAdjustments/$hist'
|
||||||
@@ -144,6 +145,12 @@ const logisticsSiloAdjustmentsIndexRoute =
|
|||||||
getParentRoute: () => rootRoute,
|
getParentRoute: () => rootRoute,
|
||||||
} as any)
|
} as any)
|
||||||
|
|
||||||
|
const logisticsOpenOrdersIndexRoute = logisticsOpenOrdersIndexImport.update({
|
||||||
|
id: '/(logistics)/openOrders/',
|
||||||
|
path: '/openOrders/',
|
||||||
|
getParentRoute: () => rootRoute,
|
||||||
|
} as any)
|
||||||
|
|
||||||
const logisticsMaterialHelperIndexRoute =
|
const logisticsMaterialHelperIndexRoute =
|
||||||
logisticsMaterialHelperIndexImport.update({
|
logisticsMaterialHelperIndexImport.update({
|
||||||
id: '/(logistics)/materialHelper/',
|
id: '/(logistics)/materialHelper/',
|
||||||
@@ -322,6 +329,13 @@ declare module '@tanstack/react-router' {
|
|||||||
preLoaderRoute: typeof logisticsMaterialHelperIndexImport
|
preLoaderRoute: typeof logisticsMaterialHelperIndexImport
|
||||||
parentRoute: typeof rootRoute
|
parentRoute: typeof rootRoute
|
||||||
}
|
}
|
||||||
|
'/(logistics)/openOrders/': {
|
||||||
|
id: '/(logistics)/openOrders/'
|
||||||
|
path: '/openOrders'
|
||||||
|
fullPath: '/openOrders'
|
||||||
|
preLoaderRoute: typeof logisticsOpenOrdersIndexImport
|
||||||
|
parentRoute: typeof rootRoute
|
||||||
|
}
|
||||||
'/(logistics)/siloAdjustments/': {
|
'/(logistics)/siloAdjustments/': {
|
||||||
id: '/(logistics)/siloAdjustments/'
|
id: '/(logistics)/siloAdjustments/'
|
||||||
path: '/siloAdjustments'
|
path: '/siloAdjustments'
|
||||||
@@ -422,6 +436,7 @@ export interface FileRoutesByFullPath {
|
|||||||
'/siloAdjustments/$hist': typeof logisticsSiloAdjustmentsHistRoute
|
'/siloAdjustments/$hist': typeof logisticsSiloAdjustmentsHistRoute
|
||||||
'/article/$av': typeof EomArticleAvRoute
|
'/article/$av': typeof EomArticleAvRoute
|
||||||
'/materialHelper': typeof logisticsMaterialHelperIndexRoute
|
'/materialHelper': typeof logisticsMaterialHelperIndexRoute
|
||||||
|
'/openOrders': typeof logisticsOpenOrdersIndexRoute
|
||||||
'/siloAdjustments': typeof logisticsSiloAdjustmentsIndexRoute
|
'/siloAdjustments': typeof logisticsSiloAdjustmentsIndexRoute
|
||||||
'/cyclecount': typeof ocmeCyclecountIndexRoute
|
'/cyclecount': typeof ocmeCyclecountIndexRoute
|
||||||
'/siloAdjustments/comment/$comment': typeof logisticsSiloAdjustmentsCommentCommentRoute
|
'/siloAdjustments/comment/$comment': typeof logisticsSiloAdjustmentsCommentCommentRoute
|
||||||
@@ -447,6 +462,7 @@ export interface FileRoutesByTo {
|
|||||||
'/siloAdjustments/$hist': typeof logisticsSiloAdjustmentsHistRoute
|
'/siloAdjustments/$hist': typeof logisticsSiloAdjustmentsHistRoute
|
||||||
'/article/$av': typeof EomArticleAvRoute
|
'/article/$av': typeof EomArticleAvRoute
|
||||||
'/materialHelper': typeof logisticsMaterialHelperIndexRoute
|
'/materialHelper': typeof logisticsMaterialHelperIndexRoute
|
||||||
|
'/openOrders': typeof logisticsOpenOrdersIndexRoute
|
||||||
'/siloAdjustments': typeof logisticsSiloAdjustmentsIndexRoute
|
'/siloAdjustments': typeof logisticsSiloAdjustmentsIndexRoute
|
||||||
'/cyclecount': typeof ocmeCyclecountIndexRoute
|
'/cyclecount': typeof ocmeCyclecountIndexRoute
|
||||||
'/siloAdjustments/comment/$comment': typeof logisticsSiloAdjustmentsCommentCommentRoute
|
'/siloAdjustments/comment/$comment': typeof logisticsSiloAdjustmentsCommentCommentRoute
|
||||||
@@ -475,6 +491,7 @@ export interface FileRoutesById {
|
|||||||
'/(logistics)/siloAdjustments/$hist': typeof logisticsSiloAdjustmentsHistRoute
|
'/(logistics)/siloAdjustments/$hist': typeof logisticsSiloAdjustmentsHistRoute
|
||||||
'/_eom/article/$av': typeof EomArticleAvRoute
|
'/_eom/article/$av': typeof EomArticleAvRoute
|
||||||
'/(logistics)/materialHelper/': typeof logisticsMaterialHelperIndexRoute
|
'/(logistics)/materialHelper/': typeof logisticsMaterialHelperIndexRoute
|
||||||
|
'/(logistics)/openOrders/': typeof logisticsOpenOrdersIndexRoute
|
||||||
'/(logistics)/siloAdjustments/': typeof logisticsSiloAdjustmentsIndexRoute
|
'/(logistics)/siloAdjustments/': typeof logisticsSiloAdjustmentsIndexRoute
|
||||||
'/(ocme)/cyclecount/': typeof ocmeCyclecountIndexRoute
|
'/(ocme)/cyclecount/': typeof ocmeCyclecountIndexRoute
|
||||||
'/(logistics)/siloAdjustments/comment/$comment': typeof logisticsSiloAdjustmentsCommentCommentRoute
|
'/(logistics)/siloAdjustments/comment/$comment': typeof logisticsSiloAdjustmentsCommentCommentRoute
|
||||||
@@ -502,6 +519,7 @@ export interface FileRouteTypes {
|
|||||||
| '/siloAdjustments/$hist'
|
| '/siloAdjustments/$hist'
|
||||||
| '/article/$av'
|
| '/article/$av'
|
||||||
| '/materialHelper'
|
| '/materialHelper'
|
||||||
|
| '/openOrders'
|
||||||
| '/siloAdjustments'
|
| '/siloAdjustments'
|
||||||
| '/cyclecount'
|
| '/cyclecount'
|
||||||
| '/siloAdjustments/comment/$comment'
|
| '/siloAdjustments/comment/$comment'
|
||||||
@@ -526,6 +544,7 @@ export interface FileRouteTypes {
|
|||||||
| '/siloAdjustments/$hist'
|
| '/siloAdjustments/$hist'
|
||||||
| '/article/$av'
|
| '/article/$av'
|
||||||
| '/materialHelper'
|
| '/materialHelper'
|
||||||
|
| '/openOrders'
|
||||||
| '/siloAdjustments'
|
| '/siloAdjustments'
|
||||||
| '/cyclecount'
|
| '/cyclecount'
|
||||||
| '/siloAdjustments/comment/$comment'
|
| '/siloAdjustments/comment/$comment'
|
||||||
@@ -552,6 +571,7 @@ export interface FileRouteTypes {
|
|||||||
| '/(logistics)/siloAdjustments/$hist'
|
| '/(logistics)/siloAdjustments/$hist'
|
||||||
| '/_eom/article/$av'
|
| '/_eom/article/$av'
|
||||||
| '/(logistics)/materialHelper/'
|
| '/(logistics)/materialHelper/'
|
||||||
|
| '/(logistics)/openOrders/'
|
||||||
| '/(logistics)/siloAdjustments/'
|
| '/(logistics)/siloAdjustments/'
|
||||||
| '/(ocme)/cyclecount/'
|
| '/(ocme)/cyclecount/'
|
||||||
| '/(logistics)/siloAdjustments/comment/$comment'
|
| '/(logistics)/siloAdjustments/comment/$comment'
|
||||||
@@ -571,6 +591,7 @@ export interface RootRouteChildren {
|
|||||||
OcpIndexRoute: typeof OcpIndexRoute
|
OcpIndexRoute: typeof OcpIndexRoute
|
||||||
logisticsSiloAdjustmentsHistRoute: typeof logisticsSiloAdjustmentsHistRoute
|
logisticsSiloAdjustmentsHistRoute: typeof logisticsSiloAdjustmentsHistRoute
|
||||||
logisticsMaterialHelperIndexRoute: typeof logisticsMaterialHelperIndexRoute
|
logisticsMaterialHelperIndexRoute: typeof logisticsMaterialHelperIndexRoute
|
||||||
|
logisticsOpenOrdersIndexRoute: typeof logisticsOpenOrdersIndexRoute
|
||||||
logisticsSiloAdjustmentsIndexRoute: typeof logisticsSiloAdjustmentsIndexRoute
|
logisticsSiloAdjustmentsIndexRoute: typeof logisticsSiloAdjustmentsIndexRoute
|
||||||
ocmeCyclecountIndexRoute: typeof ocmeCyclecountIndexRoute
|
ocmeCyclecountIndexRoute: typeof ocmeCyclecountIndexRoute
|
||||||
logisticsSiloAdjustmentsCommentCommentRoute: typeof logisticsSiloAdjustmentsCommentCommentRoute
|
logisticsSiloAdjustmentsCommentCommentRoute: typeof logisticsSiloAdjustmentsCommentCommentRoute
|
||||||
@@ -589,6 +610,7 @@ const rootRouteChildren: RootRouteChildren = {
|
|||||||
OcpIndexRoute: OcpIndexRoute,
|
OcpIndexRoute: OcpIndexRoute,
|
||||||
logisticsSiloAdjustmentsHistRoute: logisticsSiloAdjustmentsHistRoute,
|
logisticsSiloAdjustmentsHistRoute: logisticsSiloAdjustmentsHistRoute,
|
||||||
logisticsMaterialHelperIndexRoute: logisticsMaterialHelperIndexRoute,
|
logisticsMaterialHelperIndexRoute: logisticsMaterialHelperIndexRoute,
|
||||||
|
logisticsOpenOrdersIndexRoute: logisticsOpenOrdersIndexRoute,
|
||||||
logisticsSiloAdjustmentsIndexRoute: logisticsSiloAdjustmentsIndexRoute,
|
logisticsSiloAdjustmentsIndexRoute: logisticsSiloAdjustmentsIndexRoute,
|
||||||
ocmeCyclecountIndexRoute: ocmeCyclecountIndexRoute,
|
ocmeCyclecountIndexRoute: ocmeCyclecountIndexRoute,
|
||||||
logisticsSiloAdjustmentsCommentCommentRoute:
|
logisticsSiloAdjustmentsCommentCommentRoute:
|
||||||
@@ -619,6 +641,7 @@ export const routeTree = rootRoute
|
|||||||
"/ocp/",
|
"/ocp/",
|
||||||
"/(logistics)/siloAdjustments/$hist",
|
"/(logistics)/siloAdjustments/$hist",
|
||||||
"/(logistics)/materialHelper/",
|
"/(logistics)/materialHelper/",
|
||||||
|
"/(logistics)/openOrders/",
|
||||||
"/(logistics)/siloAdjustments/",
|
"/(logistics)/siloAdjustments/",
|
||||||
"/(ocme)/cyclecount/",
|
"/(ocme)/cyclecount/",
|
||||||
"/(logistics)/siloAdjustments/comment/$comment",
|
"/(logistics)/siloAdjustments/comment/$comment",
|
||||||
@@ -707,6 +730,9 @@ export const routeTree = rootRoute
|
|||||||
"/(logistics)/materialHelper/": {
|
"/(logistics)/materialHelper/": {
|
||||||
"filePath": "(logistics)/materialHelper/index.tsx"
|
"filePath": "(logistics)/materialHelper/index.tsx"
|
||||||
},
|
},
|
||||||
|
"/(logistics)/openOrders/": {
|
||||||
|
"filePath": "(logistics)/openOrders/index.tsx"
|
||||||
|
},
|
||||||
"/(logistics)/siloAdjustments/": {
|
"/(logistics)/siloAdjustments/": {
|
||||||
"filePath": "(logistics)/siloAdjustments/index.tsx"
|
"filePath": "(logistics)/siloAdjustments/index.tsx"
|
||||||
},
|
},
|
||||||
|
|||||||
14
frontend/src/routes/(logistics)/openOrders/index.tsx
Normal file
14
frontend/src/routes/(logistics)/openOrders/index.tsx
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
import OpenOrders from "@/components/logistics/warehouse/openOrders";
|
||||||
|
import { createFileRoute } from "@tanstack/react-router";
|
||||||
|
|
||||||
|
export const Route = createFileRoute("/(logistics)/openOrders/")({
|
||||||
|
component: RouteComponent,
|
||||||
|
});
|
||||||
|
|
||||||
|
function RouteComponent() {
|
||||||
|
return (
|
||||||
|
<div className="m-5 w-11/12 h-9/10">
|
||||||
|
<OpenOrders />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,6 +1,17 @@
|
|||||||
import { format } from "date-fns";
|
import { addHours, format } from "date-fns";
|
||||||
|
|
||||||
export const fixTime = (date: any) => {
|
export const fixTime = (date: any) => {
|
||||||
const strippedDate = date.replace("Z", ""); // Remove Z
|
if (!date) return;
|
||||||
return format(strippedDate, "MM/dd/yyyy hh:mm a");
|
// const strippedDate = date?.replace("Z", ""); // Remove Z
|
||||||
|
//return format(strippedDate, "MM/dd/yyyy hh:mm a");
|
||||||
|
|
||||||
|
const rawDate = new Date(date).toISOString();
|
||||||
|
const offsetMinutes = new Date().getTimezoneOffset(); // in minutes
|
||||||
|
const offsetHours =
|
||||||
|
-offsetMinutes / 60 >= 0 ? offsetMinutes / 60 : -offsetMinutes / 60;
|
||||||
|
|
||||||
|
return format(
|
||||||
|
addHours(rawDate, offsetHours).toISOString(),
|
||||||
|
"MM/dd/yyyy hh:mm a"
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
22
frontend/src/utils/querys/logistics/getOpenOrders.tsx
Normal file
22
frontend/src/utils/querys/logistics/getOpenOrders.tsx
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
import { queryOptions } from "@tanstack/react-query";
|
||||||
|
import axios from "axios";
|
||||||
|
|
||||||
|
export function getOpenOrders() {
|
||||||
|
return queryOptions({
|
||||||
|
queryKey: ["getOpenOrders"],
|
||||||
|
queryFn: () => fetchStockSilo(),
|
||||||
|
//enabled:
|
||||||
|
staleTime: 1000,
|
||||||
|
refetchInterval: 1000 * 60 * 15,
|
||||||
|
refetchOnWindowFocus: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const fetchStockSilo = async () => {
|
||||||
|
const { data } = await axios.get(
|
||||||
|
`/api/datamart/getopenorders?sDay=15&eDay=45`
|
||||||
|
);
|
||||||
|
// if we are not localhost ignore the devDir setting.
|
||||||
|
//const url: string = window.location.host.split(":")[0];
|
||||||
|
return data.data ?? [];
|
||||||
|
};
|
||||||
61
frontend/src/utils/tableData/openorders/ooColumns.tsx
Normal file
61
frontend/src/utils/tableData/openorders/ooColumns.tsx
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
import { ColumnDef } from "@tanstack/react-table";
|
||||||
|
import { format } from "date-fns";
|
||||||
|
|
||||||
|
// This type is used to define the shape of our data.
|
||||||
|
// You can use a Zod schema here if you want.
|
||||||
|
export type Adjustmnets = {
|
||||||
|
siloAdjust_id: string;
|
||||||
|
currentStockLevel: string;
|
||||||
|
newLevel: number;
|
||||||
|
dateAdjusted: string;
|
||||||
|
lastDateAdjusted: string;
|
||||||
|
comment: string;
|
||||||
|
commentAddedBy: string;
|
||||||
|
commentDate: string;
|
||||||
|
add_user: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const openOrderColumns: ColumnDef<Adjustmnets>[] = [
|
||||||
|
{
|
||||||
|
accessorKey: "Remark",
|
||||||
|
header: () => <div className="text-left">Carrier/Remark</div>,
|
||||||
|
cell: ({ row }) => {
|
||||||
|
const remark: any = row.getValue("Remark");
|
||||||
|
if (!remark) {
|
||||||
|
return <p className="text-gray-700/35">No remark</p>;
|
||||||
|
}
|
||||||
|
return <p>{remark}</p>;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorKey: "DeliveryAddressDescription",
|
||||||
|
header: "Delivery Address",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorKey: "header",
|
||||||
|
header: "PO",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorKey: "releaseNumber",
|
||||||
|
header: "Release #",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorKey: "deliveryDate",
|
||||||
|
header: "DeliveryDate",
|
||||||
|
cell: ({ row }) => {
|
||||||
|
if (row.getValue("deliveryDate")) {
|
||||||
|
const correctDate = format(
|
||||||
|
row.getValue("deliveryDate"),
|
||||||
|
"M/d/yyyy hh:mm"
|
||||||
|
);
|
||||||
|
return (
|
||||||
|
<div className="text-left font-medium">{correctDate}</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorKey: "customerItemNumber",
|
||||||
|
header: "Material #",
|
||||||
|
},
|
||||||
|
];
|
||||||
251
frontend/src/utils/tableData/openorders/ooData.tsx
Normal file
251
frontend/src/utils/tableData/openorders/ooData.tsx
Normal file
@@ -0,0 +1,251 @@
|
|||||||
|
import {
|
||||||
|
ColumnDef,
|
||||||
|
flexRender,
|
||||||
|
getCoreRowModel,
|
||||||
|
useReactTable,
|
||||||
|
getPaginationRowModel,
|
||||||
|
} from "@tanstack/react-table";
|
||||||
|
import {
|
||||||
|
Table,
|
||||||
|
TableBody,
|
||||||
|
TableCell,
|
||||||
|
TableHead,
|
||||||
|
TableHeader,
|
||||||
|
TableRow,
|
||||||
|
} from "@/components/ui/table";
|
||||||
|
import { Button } from "@/components/ui/button";
|
||||||
|
import { useState } from "react";
|
||||||
|
import {
|
||||||
|
Select,
|
||||||
|
SelectContent,
|
||||||
|
SelectGroup,
|
||||||
|
SelectItem,
|
||||||
|
SelectLabel,
|
||||||
|
SelectTrigger,
|
||||||
|
SelectValue,
|
||||||
|
} from "@/components/ui/select";
|
||||||
|
import { ScrollArea } from "@/components/ui/scroll-area";
|
||||||
|
import { LstCard } from "@/components/extendedUI/LstCard";
|
||||||
|
import { useLocation } from "@tanstack/react-router";
|
||||||
|
|
||||||
|
interface DataTableProps<TData, TValue> {
|
||||||
|
columns: ColumnDef<TData, TValue>[];
|
||||||
|
data: TData[];
|
||||||
|
//style: any;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function OpenOrderTable<TData, TValue>({
|
||||||
|
columns,
|
||||||
|
data,
|
||||||
|
//style,
|
||||||
|
}: DataTableProps<TData, TValue>) {
|
||||||
|
const [pagination, setPagination] = useState({
|
||||||
|
pageIndex: 0, //initial page index
|
||||||
|
pageSize: 5, //default page size
|
||||||
|
});
|
||||||
|
const location = useLocation();
|
||||||
|
const table = useReactTable({
|
||||||
|
data,
|
||||||
|
columns,
|
||||||
|
getCoreRowModel: getCoreRowModel(),
|
||||||
|
getPaginationRowModel: getPaginationRowModel(),
|
||||||
|
onPaginationChange: setPagination,
|
||||||
|
state: {
|
||||||
|
//...
|
||||||
|
pagination,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
//console.log(parseInt(style.height.replace("px", "")) - 50);
|
||||||
|
return (
|
||||||
|
<LstCard
|
||||||
|
className="p-3"
|
||||||
|
// style={{
|
||||||
|
// width: `${parseInt(style.width.replace("px", "")) - 50}px`,
|
||||||
|
// height: `${parseInt(style.height.replace("px", "")) - 150}px`,
|
||||||
|
// cursor: "move",
|
||||||
|
// }}
|
||||||
|
//style={{ overflow: "auto" }}
|
||||||
|
>
|
||||||
|
<div>
|
||||||
|
<div className="flex flex-row justify-between">
|
||||||
|
<p className="text-center">Open orders </p>
|
||||||
|
<Select
|
||||||
|
value={pagination.pageSize.toString()}
|
||||||
|
onValueChange={(e) =>
|
||||||
|
setPagination({
|
||||||
|
...pagination,
|
||||||
|
pageSize: parseInt(e),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<SelectTrigger className="w-[180px]">
|
||||||
|
<SelectValue
|
||||||
|
//id={field.name}
|
||||||
|
placeholder="Select Page"
|
||||||
|
/>
|
||||||
|
</SelectTrigger>
|
||||||
|
<SelectContent>
|
||||||
|
<SelectGroup>
|
||||||
|
<SelectLabel>Page Size</SelectLabel>
|
||||||
|
<SelectItem value="5">5</SelectItem>
|
||||||
|
<SelectItem value="10">10</SelectItem>
|
||||||
|
<SelectItem value="50">50</SelectItem>
|
||||||
|
<SelectItem value="100">100</SelectItem>
|
||||||
|
</SelectGroup>
|
||||||
|
</SelectContent>
|
||||||
|
</Select>
|
||||||
|
</div>
|
||||||
|
{location.pathname === "/" ? (
|
||||||
|
<ScrollArea className="h-72 rounded-md border m-2">
|
||||||
|
<Table
|
||||||
|
// style={{
|
||||||
|
// width: `${parseInt(style.width.replace("px", "")) - 50}px`,
|
||||||
|
// height: `${parseInt(style.height.replace("px", "")) - 200}px`,
|
||||||
|
// cursor: "move",
|
||||||
|
// }}
|
||||||
|
>
|
||||||
|
<TableHeader>
|
||||||
|
{table.getHeaderGroups().map((headerGroup) => (
|
||||||
|
<TableRow key={headerGroup.id}>
|
||||||
|
{headerGroup.headers.map((header) => {
|
||||||
|
return (
|
||||||
|
<TableHead key={header.id}>
|
||||||
|
{header.isPlaceholder
|
||||||
|
? null
|
||||||
|
: flexRender(
|
||||||
|
header.column
|
||||||
|
.columnDef
|
||||||
|
.header,
|
||||||
|
header.getContext()
|
||||||
|
)}
|
||||||
|
</TableHead>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</TableRow>
|
||||||
|
))}
|
||||||
|
</TableHeader>
|
||||||
|
<TableBody>
|
||||||
|
{table.getRowModel().rows?.length ? (
|
||||||
|
table.getRowModel().rows.map((row) => (
|
||||||
|
<TableRow
|
||||||
|
key={row.id}
|
||||||
|
data-state={
|
||||||
|
row.getIsSelected() &&
|
||||||
|
"selected"
|
||||||
|
}
|
||||||
|
>
|
||||||
|
{row
|
||||||
|
.getVisibleCells()
|
||||||
|
.map((cell) => (
|
||||||
|
<TableCell key={cell.id}>
|
||||||
|
{flexRender(
|
||||||
|
cell.column
|
||||||
|
.columnDef.cell,
|
||||||
|
cell.getContext()
|
||||||
|
)}
|
||||||
|
</TableCell>
|
||||||
|
))}
|
||||||
|
</TableRow>
|
||||||
|
))
|
||||||
|
) : (
|
||||||
|
<TableRow>
|
||||||
|
<TableCell
|
||||||
|
colSpan={columns.length}
|
||||||
|
className="h-24 text-center"
|
||||||
|
>
|
||||||
|
No results.
|
||||||
|
</TableCell>
|
||||||
|
</TableRow>
|
||||||
|
)}
|
||||||
|
</TableBody>
|
||||||
|
</Table>
|
||||||
|
</ScrollArea>
|
||||||
|
) : (
|
||||||
|
<ScrollArea className={`h-[725px] rounded-md border m-2`}>
|
||||||
|
<Table
|
||||||
|
// style={{
|
||||||
|
// width: `${parseInt(style.width.replace("px", "")) - 50}px`,
|
||||||
|
// height: `${parseInt(style.height.replace("px", "")) - 200}px`,
|
||||||
|
// cursor: "move",
|
||||||
|
// }}
|
||||||
|
>
|
||||||
|
<TableHeader>
|
||||||
|
{table.getHeaderGroups().map((headerGroup) => (
|
||||||
|
<TableRow key={headerGroup.id}>
|
||||||
|
{headerGroup.headers.map((header) => {
|
||||||
|
return (
|
||||||
|
<TableHead key={header.id}>
|
||||||
|
{header.isPlaceholder
|
||||||
|
? null
|
||||||
|
: flexRender(
|
||||||
|
header.column
|
||||||
|
.columnDef
|
||||||
|
.header,
|
||||||
|
header.getContext()
|
||||||
|
)}
|
||||||
|
</TableHead>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</TableRow>
|
||||||
|
))}
|
||||||
|
</TableHeader>
|
||||||
|
<TableBody>
|
||||||
|
{table.getRowModel().rows?.length ? (
|
||||||
|
table.getRowModel().rows.map((row) => (
|
||||||
|
<TableRow
|
||||||
|
key={row.id}
|
||||||
|
data-state={
|
||||||
|
row.getIsSelected() &&
|
||||||
|
"selected"
|
||||||
|
}
|
||||||
|
>
|
||||||
|
{row
|
||||||
|
.getVisibleCells()
|
||||||
|
.map((cell) => (
|
||||||
|
<TableCell key={cell.id}>
|
||||||
|
{flexRender(
|
||||||
|
cell.column
|
||||||
|
.columnDef.cell,
|
||||||
|
cell.getContext()
|
||||||
|
)}
|
||||||
|
</TableCell>
|
||||||
|
))}
|
||||||
|
</TableRow>
|
||||||
|
))
|
||||||
|
) : (
|
||||||
|
<TableRow>
|
||||||
|
<TableCell
|
||||||
|
colSpan={columns.length}
|
||||||
|
className="h-24 text-center"
|
||||||
|
>
|
||||||
|
No results.
|
||||||
|
</TableCell>
|
||||||
|
</TableRow>
|
||||||
|
)}
|
||||||
|
</TableBody>
|
||||||
|
</Table>
|
||||||
|
</ScrollArea>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
<div className="flex items-center justify-end space-x-2">
|
||||||
|
<Button
|
||||||
|
variant="outline"
|
||||||
|
size="sm"
|
||||||
|
onClick={() => table.previousPage()}
|
||||||
|
disabled={!table.getCanPreviousPage()}
|
||||||
|
>
|
||||||
|
Previous
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
variant="outline"
|
||||||
|
size="sm"
|
||||||
|
onClick={() => table.nextPage()}
|
||||||
|
disabled={!table.getCanNextPage()}
|
||||||
|
>
|
||||||
|
Next
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</LstCard>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -26,7 +26,7 @@ export const columns: ColumnDef<Adjustmnets>[] = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
accessorKey: "RunningNumber",
|
accessorKey: "RunningNumber",
|
||||||
header: "Running Number",
|
header: "Label",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
accessorKey: "ProductionDate",
|
accessorKey: "ProductionDate",
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ export const labelolumns: ColumnDef<Adjustmnets>[] = [
|
|||||||
header: "Label Date",
|
header: "Label Date",
|
||||||
cell: ({ row }) => {
|
cell: ({ row }) => {
|
||||||
if (row.getValue("upd_date")) {
|
if (row.getValue("upd_date")) {
|
||||||
const correctDate = fixTime(row.getValue("created_at"));
|
const correctDate = fixTime(row.getValue("upd_date"));
|
||||||
return (
|
return (
|
||||||
<div className="text-left font-medium">{correctDate}</div>
|
<div className="text-left font-medium">{correctDate}</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"admConfig": {
|
"admConfig": {
|
||||||
"build": 231,
|
"build": 252,
|
||||||
"oldBuild": "backend-0.1.3.zip"
|
"oldBuild": "backend-0.1.3.zip"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
@@ -11,18 +11,10 @@ export const getLots = async () => {
|
|||||||
return {
|
return {
|
||||||
success: false,
|
success: false,
|
||||||
message: "There was an error getting the lots",
|
message: "There was an error getting the lots",
|
||||||
data: lotError,
|
data: [],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (!lotInfo.data.success) {
|
|
||||||
// return {
|
|
||||||
// success: false,
|
|
||||||
// message: "There was an error getting the lots",
|
|
||||||
// data: lotInfo.data.message,
|
|
||||||
// };
|
|
||||||
// }
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
success: true,
|
success: true,
|
||||||
message: "Current active lots that are technically released.",
|
message: "Current active lots that are technically released.",
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ export const updatePrinters = async () => {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
if (prodError) {
|
if (prodError || prodPrinters?.data.length > 10000) {
|
||||||
//console.log(prodError);
|
//console.log(prodError);
|
||||||
return {
|
return {
|
||||||
success: false,
|
success: false,
|
||||||
@@ -35,7 +35,7 @@ export const updatePrinters = async () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// do the printer update into our db
|
// do the printer update into our db
|
||||||
const prodPrinterInfo = prodPrinters.data;
|
const prodPrinterInfo = prodPrinters?.data;
|
||||||
|
|
||||||
for (let i = 0; i < prodPrinterInfo.length; i++) {
|
for (let i = 0; i < prodPrinterInfo.length; i++) {
|
||||||
const printerStuff: any = {
|
const printerStuff: any = {
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
import { createRoute, OpenAPIHono, z } from "@hono/zod-openapi";
|
import { createRoute, OpenAPIHono, z } from "@hono/zod-openapi";
|
||||||
import { responses } from "../../../../globalUtils/routeDefs/responses.js";
|
import { responses } from "../../../../globalUtils/routeDefs/responses.js";
|
||||||
import { tryCatch } from "../../../../globalUtils/tryCatch.js";
|
import { tryCatch } from "../../../../globalUtils/tryCatch.js";
|
||||||
import { getPrinters } from "../../controller/printers/getPrinters.js";
|
|
||||||
import { getLots } from "../../controller/lots/lots.js";
|
import { getLots } from "../../controller/lots/lots.js";
|
||||||
|
|
||||||
const app = new OpenAPIHono({ strict: false });
|
const app = new OpenAPIHono({ strict: false });
|
||||||
@@ -15,7 +14,7 @@ app.openapi(
|
|||||||
path: "/getlots",
|
path: "/getlots",
|
||||||
responses: responses(),
|
responses: responses(),
|
||||||
}),
|
}),
|
||||||
async (c) => {
|
async (c: any) => {
|
||||||
const { data: lotData, error: lotError } = await tryCatch(getLots());
|
const { data: lotData, error: lotError } = await tryCatch(getLots());
|
||||||
|
|
||||||
if (lotError) {
|
if (lotError) {
|
||||||
@@ -26,9 +25,9 @@ app.openapi(
|
|||||||
}
|
}
|
||||||
|
|
||||||
return c.json({
|
return c.json({
|
||||||
success: lotData.success,
|
success: lotData?.success,
|
||||||
message: lotData.message,
|
message: lotData?.message,
|
||||||
data: lotData.data,
|
data: lotData?.data,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -18,6 +18,20 @@ export const assignedPrinters = async () => {
|
|||||||
data: lotError,
|
data: lotError,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (l.data.length === 0 && !l.data.sucess) {
|
||||||
|
createLog(
|
||||||
|
"error",
|
||||||
|
"lst",
|
||||||
|
"ocp",
|
||||||
|
`There was an error getting the lots: ${l?.message}`
|
||||||
|
);
|
||||||
|
return {
|
||||||
|
success: false,
|
||||||
|
message: "Error getting lots",
|
||||||
|
data: [],
|
||||||
|
};
|
||||||
|
}
|
||||||
const { data: print, error: printerError } = await tryCatch(getPrinters());
|
const { data: print, error: printerError } = await tryCatch(getPrinters());
|
||||||
|
|
||||||
if (printerError) {
|
if (printerError) {
|
||||||
@@ -29,17 +43,11 @@ export const assignedPrinters = async () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const printers: any = print.data ?? [];
|
const printers: any = print.data ?? [];
|
||||||
const lots: any = l.data.length === 0 ? [] : l.data;
|
const lots: any = l?.data.length === 0 ? null : l?.data;
|
||||||
|
|
||||||
|
//console.log(lots);
|
||||||
|
|
||||||
if (!lots) {
|
|
||||||
createLog(
|
|
||||||
"error",
|
|
||||||
"lst",
|
|
||||||
"ocp",
|
|
||||||
`There was an error getting the lots: ${lots.message}`
|
|
||||||
);
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
for (let i = 0; i < printers.length; i++) {
|
for (let i = 0; i < printers.length; i++) {
|
||||||
// is the printer assinged in alplalabel online?
|
// is the printer assinged in alplalabel online?
|
||||||
const assigned = lots?.filter(
|
const assigned = lots?.filter(
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import { eq } from "drizzle-orm";
|
|||||||
const authData = btoa("admin:Zebra123!");
|
const authData = btoa("admin:Zebra123!");
|
||||||
let token: string;
|
let token: string;
|
||||||
let ip: string;
|
let ip: string;
|
||||||
|
|
||||||
export const readTags = async (reader: string) => {
|
export const readTags = async (reader: string) => {
|
||||||
/**
|
/**
|
||||||
* Start the read for x seconds then auto stop it
|
* Start the read for x seconds then auto stop it
|
||||||
@@ -30,7 +29,7 @@ export const readTags = async (reader: string) => {
|
|||||||
ip = readers.find((r) => r.reader === reader)?.readerIP as string;
|
ip = readers.find((r) => r.reader === reader)?.readerIP as string;
|
||||||
|
|
||||||
// start the read
|
// start the read
|
||||||
startRead();
|
startRead(reader, ip);
|
||||||
|
|
||||||
// start the read
|
// start the read
|
||||||
};
|
};
|
||||||
@@ -50,7 +49,7 @@ const getReaderToken = async () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const startRead = async () => {
|
const startRead = async (reader: string, ip: string) => {
|
||||||
await getReaderToken();
|
await getReaderToken();
|
||||||
try {
|
try {
|
||||||
const res = await axios.put(
|
const res = await axios.put(
|
||||||
@@ -65,17 +64,17 @@ const startRead = async () => {
|
|||||||
|
|
||||||
if (res.status === 200) {
|
if (res.status === 200) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
stopRead();
|
stopRead(reader, ip);
|
||||||
}, 2 * 1000);
|
}, 5 * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
// stop after 5 seconds
|
// stop after 5 seconds
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
if (error.response?.data.code === 3) {
|
if (error.response?.data.code === 3) {
|
||||||
stopRead();
|
stopRead(reader, ip);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
startRead();
|
startRead(reader, ip);
|
||||||
}, 1000);
|
}, 2 * 1000);
|
||||||
}
|
}
|
||||||
createLog(
|
createLog(
|
||||||
"error",
|
"error",
|
||||||
@@ -86,7 +85,7 @@ const startRead = async () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const stopRead = async () => {
|
export const stopRead = async (reader: string, ip: string) => {
|
||||||
await getReaderToken();
|
await getReaderToken();
|
||||||
try {
|
try {
|
||||||
const res = await axios.put(
|
const res = await axios.put(
|
||||||
@@ -101,7 +100,7 @@ export const stopRead = async () => {
|
|||||||
"error",
|
"error",
|
||||||
"rfid",
|
"rfid",
|
||||||
"rfid",
|
"rfid",
|
||||||
`There was an error Stopping the read: ${JSON.stringify(error)}`
|
`There was an error Stopping the read on ${reader}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -3,11 +3,32 @@
|
|||||||
* Phase 2 we will generate a label to be reprinted at staion 4
|
* Phase 2 we will generate a label to be reprinted at staion 4
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { eq } from "drizzle-orm";
|
||||||
|
import { db } from "../../../../../database/dbclient.js";
|
||||||
|
import { rfidReaders } from "../../../../../database/schema/rfidReaders.js";
|
||||||
|
import { tryCatch } from "../../../../globalUtils/tryCatch.js";
|
||||||
import { createLog } from "../../../logger/logger.js";
|
import { createLog } from "../../../logger/logger.js";
|
||||||
import type { TagData } from "../tagData.js";
|
import type { TagData } from "../tagData.js";
|
||||||
import { tagStuff } from "../tags/crudTag.js";
|
import { tagStuff } from "../tags/crudTag.js";
|
||||||
|
|
||||||
export const station3Tags = async (tagData: TagData[]) => {
|
export const station3Tags = async (tagData: TagData[]) => {
|
||||||
|
/**
|
||||||
|
* Add the new tag to the reader so we know waht was really here
|
||||||
|
*/
|
||||||
|
const { error } = await tryCatch(
|
||||||
|
db
|
||||||
|
.update(rfidReaders)
|
||||||
|
.set({ lastTagScanned: tagData[0].tag })
|
||||||
|
.where(eq(rfidReaders.reader, tagData[0].reader))
|
||||||
|
);
|
||||||
|
if (error) {
|
||||||
|
createLog(
|
||||||
|
"error",
|
||||||
|
"rfid",
|
||||||
|
"rfid",
|
||||||
|
`${tagData[0].reader} encountered and error addeding ${tagData[0].tag}.`
|
||||||
|
);
|
||||||
|
}
|
||||||
createLog(
|
createLog(
|
||||||
"info",
|
"info",
|
||||||
"rfid",
|
"rfid",
|
||||||
|
|||||||
@@ -67,18 +67,19 @@ export const wrapperStuff = async (tagData: any) => {
|
|||||||
"rfid",
|
"rfid",
|
||||||
`${tagData[0].tag}, Did not come from a line please check the pallet and manually print the label.`
|
`${tagData[0].tag}, Did not come from a line please check the pallet and manually print the label.`
|
||||||
);
|
);
|
||||||
|
tagStuff(tagData);
|
||||||
monitorChecks();
|
monitorChecks();
|
||||||
return {
|
return {
|
||||||
success: false,
|
success: false,
|
||||||
message: `${tagData[0].tag}, Did not come from a line please check the pallet and manually print the label.`,
|
message: `${tagData[0].tag}, Did not come from a line please check the pallet and manually print the label.`,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if (lines[0].runningNumber) {
|
if (lines[0]?.runningNumber) {
|
||||||
createLog(
|
createLog(
|
||||||
"info",
|
"info",
|
||||||
"rfid",
|
"rfid",
|
||||||
"rfid",
|
"rfid",
|
||||||
`Reprint label ${lines[0].runningNumber}`
|
`Reprint label ${lines[0]?.runningNumber}`
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
createLog(
|
createLog(
|
||||||
@@ -88,7 +89,7 @@ export const wrapperStuff = async (tagData: any) => {
|
|||||||
`A new label will be created and linked to this ${tagData[0].tag} tag`
|
`A new label will be created and linked to this ${tagData[0].tag} tag`
|
||||||
);
|
);
|
||||||
const lineNum = parseInt(
|
const lineNum = parseInt(
|
||||||
checkTag[0]?.lastareaIn.repalceAll("line3", "")
|
checkTag[0]?.lastareaIn.replace("line3.", "")
|
||||||
);
|
);
|
||||||
createLog(
|
createLog(
|
||||||
"info",
|
"info",
|
||||||
|
|||||||
@@ -58,6 +58,23 @@ const newSubModules = [
|
|||||||
active: false,
|
active: false,
|
||||||
subSubModule: [],
|
subSubModule: [],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "Open Orders",
|
||||||
|
moduleName: "logistics",
|
||||||
|
description: "Open orders",
|
||||||
|
link: "/openOrders",
|
||||||
|
icon: "Truck",
|
||||||
|
role: [
|
||||||
|
"viewer",
|
||||||
|
"technician",
|
||||||
|
"supervisor",
|
||||||
|
"manager",
|
||||||
|
"admin",
|
||||||
|
"systemAdmin",
|
||||||
|
],
|
||||||
|
active: false,
|
||||||
|
subSubModule: [],
|
||||||
|
},
|
||||||
|
|
||||||
// admin module
|
// admin module
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ export const initializeProdPool = async () => {
|
|||||||
return {
|
return {
|
||||||
success: false,
|
success: false,
|
||||||
message: `The sql ${dbServer[0].value} is not reachable`,
|
message: `The sql ${dbServer[0].value} is not reachable`,
|
||||||
|
data: [],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -61,6 +62,7 @@ export const initializeProdPool = async () => {
|
|||||||
success: false,
|
success: false,
|
||||||
message:
|
message:
|
||||||
"The server is set to localhost, and you are not in development mode.",
|
"The server is set to localhost, and you are not in development mode.",
|
||||||
|
data: [],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,7 +91,9 @@ export const initializeProdPool = async () => {
|
|||||||
"error",
|
"error",
|
||||||
"lst",
|
"lst",
|
||||||
"sqlProd",
|
"sqlProd",
|
||||||
`${JSON.stringify(error)}, "There was an error connecting to the pool."`
|
`${JSON.stringify(
|
||||||
|
error
|
||||||
|
)}, "There was an error connecting to the pool."`
|
||||||
);
|
);
|
||||||
throw new Error("There was an error closing the sql connection");
|
throw new Error("There was an error closing the sql connection");
|
||||||
}
|
}
|
||||||
@@ -146,6 +150,7 @@ export async function query(queryToRun: string, name: string) {
|
|||||||
return {
|
return {
|
||||||
success: false,
|
success: false,
|
||||||
message: `The sql ${dbServer[0].value} is not reachable`,
|
message: `The sql ${dbServer[0].value} is not reachable`,
|
||||||
|
data: [],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -180,7 +185,9 @@ export async function query(queryToRun: string, name: string) {
|
|||||||
"error",
|
"error",
|
||||||
"lst",
|
"lst",
|
||||||
"sqlProd",
|
"sqlProd",
|
||||||
`${JSON.stringify(error)}, ${name} did not run due to a timeout.`
|
`${JSON.stringify(
|
||||||
|
error
|
||||||
|
)}, ${name} did not run due to a timeout.`
|
||||||
);
|
);
|
||||||
throw new Error(`${name} query did not run due to a timeout.`);
|
throw new Error(`${name} query did not run due to a timeout.`);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ IdAdresse AS customerID,
|
|||||||
LieferAdressBez as DeliveryAddressDescription,
|
LieferAdressBez as DeliveryAddressDescription,
|
||||||
AbrufLadeDatum AS loadingDate,
|
AbrufLadeDatum AS loadingDate,
|
||||||
AbrufLiefertermin AS deliveryDate
|
AbrufLiefertermin AS deliveryDate
|
||||||
|
,Remark
|
||||||
--,OrderStatus = 'loading'
|
--,OrderStatus = 'loading'
|
||||||
--,*
|
--,*
|
||||||
FROM alplaprod_test1.dbo.V_TrackerAuftragsAbrufe (nolock) x
|
FROM alplaprod_test1.dbo.V_TrackerAuftragsAbrufe (nolock) x
|
||||||
|
|||||||
Reference in New Issue
Block a user