diff --git a/frontend/src/components/ocme/WrapperCard.tsx b/frontend/src/components/ocme/WrapperCard.tsx
index 2bcd9c5..6b4cb0e 100644
--- a/frontend/src/components/ocme/WrapperCard.tsx
+++ b/frontend/src/components/ocme/WrapperCard.tsx
@@ -12,23 +12,28 @@ import {
TableRow,
} from "../ui/table";
import { toast } from "sonner";
+import { getOcmeInfo } from "@/utils/querys/production/getOcmeInfo";
+import { useQuery } from "@tanstack/react-query";
+import { format } from "date-fns";
+import { Trash } from "lucide-react";
const currentPallets = [
{ key: "line", label: "Line" },
- { key: "runningNr", label: "Running #" },
+ { key: "runningNumber", label: "Running #" },
{ key: "upd_date", label: "Date Scanned" },
{ key: "waitingfor", label: "Waiting For" },
{ key: "clear", label: "Clear" },
];
-const currentTags = [
- { key: "line", label: "Line" },
- { key: "printerName", label: "Printer" },
- { key: "runningNr", label: "Running #" },
- { key: "upd_date", label: "Label date" },
- { key: "status", label: "Label Status" },
-];
+// const currentTags = [
+// { key: "line", label: "Line" },
+// { key: "printerName", label: "Printer" },
+// { key: "runningNr", label: "Running #" },
+// { key: "upd_date", label: "Label date" },
+// { key: "status", label: "Label Status" },
+// ];
export default function WrapperManualTrigger() {
+ const { data, isError, isLoading } = useQuery(getOcmeInfo());
const cameraTrigger = async () => {
try {
const res = await axios.get("/ocme/api/v1/manualCameraTrigger");
@@ -46,6 +51,42 @@ export default function WrapperManualTrigger() {
//stoast.success(error.data.message);
}
};
+
+ const clearLabel = async (d: any) => {
+ const data = {
+ runningNr: d.runningNr,
+ };
+
+ try {
+ const res = await axios.patch("/ocme/api/v1/pickedUp", data);
+
+ if (res.data.success) {
+ toast.success(
+ `${d.runningNr} was just removed from being picked up.`
+ );
+ return;
+ }
+
+ if (!res.data.success) {
+ toast.error(res.data.message);
+ }
+ } catch (error) {
+ console.log(error);
+ //stoast.success(error.data.message);
+ }
+ };
+
+ if (isError) {
+ return (
+
+
+ There was an error getting wrapper scans
+
+
+ );
+ }
+
+ const info = data?.filter((r: any) => r.areaFrom === "wrapper_1");
return (
@@ -59,71 +100,66 @@ export default function WrapperManualTrigger() {
))}
-
- {Array(3)
- .fill(0)
- .map((_, i) => (
-
+ {isLoading ? (
+
+ {Array(3)
+ .fill(0)
+ .map((_, i) => (
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ))}
+
+ ) : (
+
+ {info.map((i: any) => (
+
-
+ {i.lineNum}
+ {i.runningNr}
-
+ {format(
+ i?.upd_date.replace("Z", ""),
+ "M/d/yyyy hh:mm"
+ )}
+ {i.waitingFor}
-
-
-
-
-
-
-
+
))}
-
-
-
-
-
-
-
- {currentTags.map((l) => (
- {l.label}
- ))}
-
-
-
- {Array(3)
- .fill(0)
- .map((_, i) => (
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ))}
-
+
+ )}
+
-
Manual Triggers
+
Manual Trigger
-
diff --git a/frontend/src/components/ocme/ocmeCycleCount.tsx b/frontend/src/components/ocme/ocmeCycleCount.tsx
index c1c7ce2..f2cf7db 100644
--- a/frontend/src/components/ocme/ocmeCycleCount.tsx
+++ b/frontend/src/components/ocme/ocmeCycleCount.tsx
@@ -184,7 +184,7 @@ export default function OcmeCycleCount() {
{data.map((i: any) => {
let classname = ``;
if (
- i.info === "Quality Check Required"
+ i.info === "Validate pallet is ok."
) {
classname = `bg-red-500`;
}
diff --git a/frontend/src/components/production/ocp/LabelLog.tsx b/frontend/src/components/production/ocp/LabelLog.tsx
index d38e3e2..ed972e3 100644
--- a/frontend/src/components/production/ocp/LabelLog.tsx
+++ b/frontend/src/components/production/ocp/LabelLog.tsx
@@ -5,7 +5,6 @@ import {
Table,
TableBody,
TableCell,
- TableFooter,
TableHead,
TableHeader,
TableRow,
@@ -26,17 +25,13 @@ const labelLogs = [
];
export default function LabelLog() {
const { data, isError, isLoading } = useQuery(getlabels("4"));
- //const {user} = useSessionStore();
- //const {settings} = useSettingStore();
- //const server = settings.filter((n) => n.name === "server")[0]?.value || "";
-
- //const roles = ["admin", "manager", "operator"];
if (isError) {
return (
Labels for the last 2 hours
+
@@ -77,7 +72,13 @@ export default function LabelLog() {
const labelData = data ? data : [];
return (
- Labels for the last 2 hours
+
+ {labelData.length === 0 ? (
+ No labels have been printed in the last 2 hours
+ ) : (
+ Labels for the last 2 hours
+ )}
+
@@ -115,7 +116,7 @@ export default function LabelLog() {
) : (
{labelData.map((label: any) => (
-
+
{label.line}
@@ -139,15 +140,15 @@ export default function LabelLog() {
)}
-
+ {/*
{labelData.length === 0 && (
-
+
No labels have been printed in the last 2 hours
)}
-
+ */}
);
diff --git a/frontend/src/components/production/ocp/ManualPrinting/ManualPrint.tsx b/frontend/src/components/production/ocp/ManualPrinting/ManualPrint.tsx
index 59daf69..8cff539 100644
--- a/frontend/src/components/production/ocp/ManualPrinting/ManualPrint.tsx
+++ b/frontend/src/components/production/ocp/ManualPrinting/ManualPrint.tsx
@@ -1,31 +1,43 @@
-import {Button} from "@/components/ui/button";
-import {useSessionStore} from "@/lib/store/sessionStore";
+import { Button } from "@/components/ui/button";
+import { useSessionStore } from "@/lib/store/sessionStore";
//import {useSettingStore} from "@/lib/store/useSettings";
-import {LotType} from "@/types/lots";
-import {Tag} from "lucide-react";
-import {toast} from "sonner";
-import {manualPrintLabels} from "./ManualPrintLabel";
+import { LotType } from "@/types/lots";
+import { Tag } from "lucide-react";
+import { toast } from "sonner";
+import { manualPrintLabels } from "./ManualPrintLabel";
+import { useState } from "react";
-export default function ManualPrint({lot}: {lot: LotType}) {
- const {user} = useSessionStore();
+export default function ManualPrint({ lot }: { lot: LotType }) {
+ const { user } = useSessionStore();
+ const [printing, setPrinting] = useState(false);
//const {settings} = useSettingStore();
//const server = settings.filter((n) => n.name === "server")[0]?.value;
//const serverPort = settings.filter((n) => n.name === "serverPort")[0]?.value;
//const serverUrl = `http://${server}:${serverPort}`;
const handlePrintLabel = async (lot: LotType) => {
- //console.log(lot);
-
const labels: any = await manualPrintLabels(lot, user);
if (labels.success) {
toast.success(labels.message);
+ setTimeout(() => {
+ setPrinting(false);
+ }, 5 * 1000);
+ setPrinting(true);
} else {
toast.error(labels.message);
+ setTimeout(() => {
+ setPrinting(false);
+ }, 5 * 1000);
}
};
return (
-