From 4ca20a085efcb795bc312abff649a53132deac05 Mon Sep 17 00:00:00 2001 From: Blake Matthes Date: Sun, 26 Oct 2025 10:35:06 -0500 Subject: [PATCH] feat(migration): moved ocp, ocme, wrapper stuff --- frontend/package-lock.json | 28 ++ frontend/package.json | 2 + frontend/src/components/ui/resizable.tsx | 54 ++++ frontend/src/routeTree.gen.ts | 43 +++ .../_old/old/(ocme)/cyclecount/index.tsx | 14 + .../old/-components}/ocme/CycleCountLog.tsx | 0 .../old/-components/ocme/ManuallyEnterRn.tsx | 101 +++++++ .../_old/old/-components/ocme/WrapperCard.tsx | 165 +++++++++++ .../old/-components/ocme/ocmeCycleCount.tsx | 229 +++++++++++++++ .../_old/old/-components/ocp/LabelLog.tsx | 24 ++ .../_old/old/-components/ocp/LabelRatio.tsx | 27 ++ .../routes/_old/old/-components}/ocp/Lots.tsx | 36 +-- .../ocp/ManualPrinting/ManualPrint.tsx | 46 +++ .../ocp/ManualPrinting/ManualPrintForm.tsx | 256 ++++++++++++++++ .../ocp/ManualPrinting/ManualPrintLabel.ts | 44 +++ .../_old/old/-components/ocp/OcpLogs.tsx | 46 +++ .../_old/old/-components/ocp/OcpPage.tsx | 134 +++++++++ .../old/-components/ocp/PrinterStatus.tsx | 114 ++++++++ .../old/-components/rfid/ManualTrigger.tsx | 30 ++ .../old/-utils/querys/ocp/getOcmeInfo.tsx | 19 ++ .../_old/old/-utils/querys/ocp/labelRatio.tsx | 20 ++ .../_old/old/-utils/querys/ocp/labels.tsx | 20 ++ .../_old/old/-utils/querys/ocp/lots.tsx | 21 ++ .../_old/old/-utils/querys/ocp/ocpLogs.tsx | 22 ++ .../_old/old/-utils/querys/ocp/printers.tsx | 20 ++ .../-utils/querys/production/getOcmeInfo.tsx | 19 -- .../-utils/querys/production/labelRatio.tsx | 20 -- .../old/-utils/querys/production/labels.tsx | 20 -- .../old/-utils/querys/production/lots.tsx | 21 -- .../old/-utils/querys/production/ocpLogs.tsx | 22 -- .../old/-utils/querys/production/printers.tsx | 20 -- .../old/-utils/querys/rfid/getReaders.tsx | 24 +- frontend/src/routes/_old/old/ocp/index.tsx | 14 + frontend/src/routes/_old/old/route.tsx | 2 +- frontend/tsconfig.json | 1 - .../logistics/rfid/ManualTrigger.tsx | 31 -- .../src/components/ocme/ManuallyEnterRn.tsx | 106 ------- .../src/components/ocme/WrapperCard.tsx | 172 ----------- .../src/components/ocme/ocmeCycleCount.tsx | 260 ----------------- .../components/production/ocp/LabelLog.tsx | 25 -- .../components/production/ocp/LabelRatio.tsx | 27 -- .../ocp/ManualPrinting/ManualPrint.tsx | 44 --- .../ocp/ManualPrinting/ManualPrintForm.tsx | 275 ------------------ .../ocp/ManualPrinting/ManualPrintLabel.ts | 44 --- .../src/components/production/ocp/OcpLogs.tsx | 46 --- .../src/components/production/ocp/OcpPage.tsx | 153 ---------- .../production/ocp/PrinterStatus.tsx | 114 -------- .../src/routes/(ocme)/cyclecount/index.tsx | 14 - lstV2/frontend/src/routes/about.tsx | 13 - lstV2/frontend/src/routes/changelog.tsx | 14 - lstV2/frontend/src/routes/index.tsx | 17 -- lstV2/frontend/src/routes/ocp/index.tsx | 14 - 52 files changed, 1522 insertions(+), 1525 deletions(-) create mode 100644 frontend/src/components/ui/resizable.tsx create mode 100644 frontend/src/routes/_old/old/(ocme)/cyclecount/index.tsx rename {lstV2/frontend/src/components => frontend/src/routes/_old/old/-components}/ocme/CycleCountLog.tsx (100%) create mode 100644 frontend/src/routes/_old/old/-components/ocme/ManuallyEnterRn.tsx create mode 100644 frontend/src/routes/_old/old/-components/ocme/WrapperCard.tsx create mode 100644 frontend/src/routes/_old/old/-components/ocme/ocmeCycleCount.tsx create mode 100644 frontend/src/routes/_old/old/-components/ocp/LabelLog.tsx create mode 100644 frontend/src/routes/_old/old/-components/ocp/LabelRatio.tsx rename {lstV2/frontend/src/components/production => frontend/src/routes/_old/old/-components}/ocp/Lots.tsx (85%) create mode 100644 frontend/src/routes/_old/old/-components/ocp/ManualPrinting/ManualPrint.tsx create mode 100644 frontend/src/routes/_old/old/-components/ocp/ManualPrinting/ManualPrintForm.tsx create mode 100644 frontend/src/routes/_old/old/-components/ocp/ManualPrinting/ManualPrintLabel.ts create mode 100644 frontend/src/routes/_old/old/-components/ocp/OcpLogs.tsx create mode 100644 frontend/src/routes/_old/old/-components/ocp/OcpPage.tsx create mode 100644 frontend/src/routes/_old/old/-components/ocp/PrinterStatus.tsx create mode 100644 frontend/src/routes/_old/old/-components/rfid/ManualTrigger.tsx create mode 100644 frontend/src/routes/_old/old/-utils/querys/ocp/getOcmeInfo.tsx create mode 100644 frontend/src/routes/_old/old/-utils/querys/ocp/labelRatio.tsx create mode 100644 frontend/src/routes/_old/old/-utils/querys/ocp/labels.tsx create mode 100644 frontend/src/routes/_old/old/-utils/querys/ocp/lots.tsx create mode 100644 frontend/src/routes/_old/old/-utils/querys/ocp/ocpLogs.tsx create mode 100644 frontend/src/routes/_old/old/-utils/querys/ocp/printers.tsx delete mode 100644 frontend/src/routes/_old/old/-utils/querys/production/getOcmeInfo.tsx delete mode 100644 frontend/src/routes/_old/old/-utils/querys/production/labelRatio.tsx delete mode 100644 frontend/src/routes/_old/old/-utils/querys/production/labels.tsx delete mode 100644 frontend/src/routes/_old/old/-utils/querys/production/lots.tsx delete mode 100644 frontend/src/routes/_old/old/-utils/querys/production/ocpLogs.tsx delete mode 100644 frontend/src/routes/_old/old/-utils/querys/production/printers.tsx create mode 100644 frontend/src/routes/_old/old/ocp/index.tsx delete mode 100644 lstV2/frontend/src/components/logistics/rfid/ManualTrigger.tsx delete mode 100644 lstV2/frontend/src/components/ocme/ManuallyEnterRn.tsx delete mode 100644 lstV2/frontend/src/components/ocme/WrapperCard.tsx delete mode 100644 lstV2/frontend/src/components/ocme/ocmeCycleCount.tsx delete mode 100644 lstV2/frontend/src/components/production/ocp/LabelLog.tsx delete mode 100644 lstV2/frontend/src/components/production/ocp/LabelRatio.tsx delete mode 100644 lstV2/frontend/src/components/production/ocp/ManualPrinting/ManualPrint.tsx delete mode 100644 lstV2/frontend/src/components/production/ocp/ManualPrinting/ManualPrintForm.tsx delete mode 100644 lstV2/frontend/src/components/production/ocp/ManualPrinting/ManualPrintLabel.ts delete mode 100644 lstV2/frontend/src/components/production/ocp/OcpLogs.tsx delete mode 100644 lstV2/frontend/src/components/production/ocp/OcpPage.tsx delete mode 100644 lstV2/frontend/src/components/production/ocp/PrinterStatus.tsx delete mode 100644 lstV2/frontend/src/routes/(ocme)/cyclecount/index.tsx delete mode 100644 lstV2/frontend/src/routes/about.tsx delete mode 100644 lstV2/frontend/src/routes/changelog.tsx delete mode 100644 lstV2/frontend/src/routes/index.tsx delete mode 100644 lstV2/frontend/src/routes/ocp/index.tsx diff --git a/frontend/package-lock.json b/frontend/package-lock.json index a102580..b2240a8 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -43,6 +43,8 @@ "react-calendar-timeline": "^0.30.0-beta.3", "react-day-picker": "^9.11.1", "react-dom": "^19.1.1", + "react-hook-form": "^7.65.0", + "react-resizable-panels": "^3.0.6", "recharts": "^2.15.4", "socket.io-client": "^4.8.1", "sonner": "^2.0.7", @@ -6598,6 +6600,22 @@ "react": "^19.1.1" } }, + "node_modules/react-hook-form": { + "version": "7.65.0", + "resolved": "https://registry.npmjs.org/react-hook-form/-/react-hook-form-7.65.0.tgz", + "integrity": "sha512-xtOzDz063WcXvGWaHgLNrNzlsdFgtUWcb32E6WFaGTd7kPZG3EeDusjdZfUsPwKCKVXy1ZlntifaHZ4l8pAsmw==", + "license": "MIT", + "engines": { + "node": ">=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/react-hook-form" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17 || ^18 || ^19" + } + }, "node_modules/react-is": { "version": "18.3.1", "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.3.1.tgz", @@ -6651,6 +6669,16 @@ } } }, + "node_modules/react-resizable-panels": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/react-resizable-panels/-/react-resizable-panels-3.0.6.tgz", + "integrity": "sha512-b3qKHQ3MLqOgSS+FRYKapNkJZf5EQzuf6+RLiq1/IlTHw99YrZ2NJZLk4hQIzTnnIkRg2LUqyVinu6YWWpUYew==", + "license": "MIT", + "peerDependencies": { + "react": "^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc", + "react-dom": "^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc" + } + }, "node_modules/react-smooth": { "version": "4.0.4", "resolved": "https://registry.npmjs.org/react-smooth/-/react-smooth-4.0.4.tgz", diff --git a/frontend/package.json b/frontend/package.json index bc94db3..e54730c 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -45,6 +45,8 @@ "react-calendar-timeline": "^0.30.0-beta.3", "react-day-picker": "^9.11.1", "react-dom": "^19.1.1", + "react-hook-form": "^7.65.0", + "react-resizable-panels": "^3.0.6", "recharts": "^2.15.4", "socket.io-client": "^4.8.1", "sonner": "^2.0.7", diff --git a/frontend/src/components/ui/resizable.tsx b/frontend/src/components/ui/resizable.tsx new file mode 100644 index 0000000..fe0ebbd --- /dev/null +++ b/frontend/src/components/ui/resizable.tsx @@ -0,0 +1,54 @@ +import * as React from "react" +import { GripVerticalIcon } from "lucide-react" +import * as ResizablePrimitive from "react-resizable-panels" + +import { cn } from "@/lib/utils" + +function ResizablePanelGroup({ + className, + ...props +}: React.ComponentProps) { + return ( + + ) +} + +function ResizablePanel({ + ...props +}: React.ComponentProps) { + return +} + +function ResizableHandle({ + withHandle, + className, + ...props +}: React.ComponentProps & { + withHandle?: boolean +}) { + return ( + div]:rotate-90", + className + )} + {...props} + > + {withHandle && ( +
+ +
+ )} +
+ ) +} + +export { ResizablePanelGroup, ResizablePanel, ResizableHandle } diff --git a/frontend/src/routeTree.gen.ts b/frontend/src/routeTree.gen.ts index 725c1b2..19d70bf 100644 --- a/frontend/src/routeTree.gen.ts +++ b/frontend/src/routeTree.gen.ts @@ -19,6 +19,7 @@ import { Route as MobileMobileLayoutRouteRouteImport } from './routes/_mobile/_m import { Route as AppAdminLayoutRouteRouteImport } from './routes/_app/_adminLayout/route' import { Route as OldOldIndexRouteImport } from './routes/_old/old/index' import { Route as AppauthLoginRouteImport } from './routes/_app/(auth)/login' +import { Route as OldOldOcpIndexRouteImport } from './routes/_old/old/ocp/index' import { Route as MobileMobileLayoutMIndexRouteImport } from './routes/_mobile/_mobileLayout/m/index' import { Route as AppauthUserIndexRouteImport } from './routes/_app/(auth)/user/index' import { Route as MobileMobileLayoutMRelocateRouteImport } from './routes/_mobile/_mobileLayout/m/relocate' @@ -31,6 +32,7 @@ import { Route as AppauthUserSignupRouteImport } from './routes/_app/(auth)/user import { Route as AppauthUserResetpasswordRouteImport } from './routes/_app/(auth)/user/resetpassword' import { Route as AppauthUserProfileRouteImport } from './routes/_app/(auth)/user/profile' import { Route as AppAdminLayoutAdminUsersRouteRouteImport } from './routes/_app/_adminLayout/admin/_users/route' +import { Route as OldOldocmeCyclecountIndexRouteImport } from './routes/_old/old/(ocme)/cyclecount/index' import { Route as OldOldlogisticsSiloAdjustmentsIndexRouteImport } from './routes/_old/old/(logistics)/siloAdjustments/index' import { Route as OldOldlogisticsSiloAdjustmentsHistRouteImport } from './routes/_old/old/(logistics)/siloAdjustments/$hist' import { Route as AppAdminLayoutAdminUsersUsersRouteImport } from './routes/_app/_adminLayout/admin/_users/users' @@ -83,6 +85,11 @@ const AppauthLoginRoute = AppauthLoginRouteImport.update({ path: '/login', getParentRoute: () => AppRouteRoute, } as any) +const OldOldOcpIndexRoute = OldOldOcpIndexRouteImport.update({ + id: '/ocp/', + path: '/ocp/', + getParentRoute: () => OldOldRouteRoute, +} as any) const MobileMobileLayoutMIndexRoute = MobileMobileLayoutMIndexRouteImport.update({ id: '/m/', @@ -151,6 +158,12 @@ const AppAdminLayoutAdminUsersRouteRoute = id: '/_users', getParentRoute: () => AppAdminLayoutAdminRoute, } as any) +const OldOldocmeCyclecountIndexRoute = + OldOldocmeCyclecountIndexRouteImport.update({ + id: '/(ocme)/cyclecount/', + path: '/cyclecount/', + getParentRoute: () => OldOldRouteRoute, + } as any) const OldOldlogisticsSiloAdjustmentsIndexRoute = OldOldlogisticsSiloAdjustmentsIndexRouteImport.update({ id: '/(logistics)/siloAdjustments/', @@ -200,10 +213,12 @@ export interface FileRoutesByFullPath { '/m/relocate': typeof MobileMobileLayoutMRelocateRoute '/user': typeof AppauthUserIndexRoute '/m': typeof MobileMobileLayoutMIndexRoute + '/old/ocp': typeof OldOldOcpIndexRoute '/admin/prodUsers': typeof AppAdminLayoutAdminUsersProdUsersRoute '/admin/users': typeof AppAdminLayoutAdminUsersUsersRoute '/old/siloAdjustments/$hist': typeof OldOldlogisticsSiloAdjustmentsHistRoute '/old/siloAdjustments': typeof OldOldlogisticsSiloAdjustmentsIndexRoute + '/old/cyclecount': typeof OldOldocmeCyclecountIndexRoute '/old/siloAdjustments/comment/$comment': typeof OldOldlogisticsSiloAdjustmentsCommentCommentRoute } export interface FileRoutesByTo { @@ -223,10 +238,12 @@ export interface FileRoutesByTo { '/m/relocate': typeof MobileMobileLayoutMRelocateRoute '/user': typeof AppauthUserIndexRoute '/m': typeof MobileMobileLayoutMIndexRoute + '/old/ocp': typeof OldOldOcpIndexRoute '/admin/prodUsers': typeof AppAdminLayoutAdminUsersProdUsersRoute '/admin/users': typeof AppAdminLayoutAdminUsersUsersRoute '/old/siloAdjustments/$hist': typeof OldOldlogisticsSiloAdjustmentsHistRoute '/old/siloAdjustments': typeof OldOldlogisticsSiloAdjustmentsIndexRoute + '/old/cyclecount': typeof OldOldocmeCyclecountIndexRoute '/old/siloAdjustments/comment/$comment': typeof OldOldlogisticsSiloAdjustmentsCommentCommentRoute } export interface FileRoutesById { @@ -252,10 +269,12 @@ export interface FileRoutesById { '/_mobile/_mobileLayout/m/relocate': typeof MobileMobileLayoutMRelocateRoute '/_app/(auth)/user/': typeof AppauthUserIndexRoute '/_mobile/_mobileLayout/m/': typeof MobileMobileLayoutMIndexRoute + '/_old/old/ocp/': typeof OldOldOcpIndexRoute '/_app/_adminLayout/admin/_users/prodUsers': typeof AppAdminLayoutAdminUsersProdUsersRoute '/_app/_adminLayout/admin/_users/users': typeof AppAdminLayoutAdminUsersUsersRoute '/_old/old/(logistics)/siloAdjustments/$hist': typeof OldOldlogisticsSiloAdjustmentsHistRoute '/_old/old/(logistics)/siloAdjustments/': typeof OldOldlogisticsSiloAdjustmentsIndexRoute + '/_old/old/(ocme)/cyclecount/': typeof OldOldocmeCyclecountIndexRoute '/_old/old/(logistics)/siloAdjustments/comment/$comment': typeof OldOldlogisticsSiloAdjustmentsCommentCommentRoute } export interface FileRouteTypes { @@ -278,10 +297,12 @@ export interface FileRouteTypes { | '/m/relocate' | '/user' | '/m' + | '/old/ocp' | '/admin/prodUsers' | '/admin/users' | '/old/siloAdjustments/$hist' | '/old/siloAdjustments' + | '/old/cyclecount' | '/old/siloAdjustments/comment/$comment' fileRoutesByTo: FileRoutesByTo to: @@ -301,10 +322,12 @@ export interface FileRouteTypes { | '/m/relocate' | '/user' | '/m' + | '/old/ocp' | '/admin/prodUsers' | '/admin/users' | '/old/siloAdjustments/$hist' | '/old/siloAdjustments' + | '/old/cyclecount' | '/old/siloAdjustments/comment/$comment' id: | '__root__' @@ -329,10 +352,12 @@ export interface FileRouteTypes { | '/_mobile/_mobileLayout/m/relocate' | '/_app/(auth)/user/' | '/_mobile/_mobileLayout/m/' + | '/_old/old/ocp/' | '/_app/_adminLayout/admin/_users/prodUsers' | '/_app/_adminLayout/admin/_users/users' | '/_old/old/(logistics)/siloAdjustments/$hist' | '/_old/old/(logistics)/siloAdjustments/' + | '/_old/old/(ocme)/cyclecount/' | '/_old/old/(logistics)/siloAdjustments/comment/$comment' fileRoutesById: FileRoutesById } @@ -407,6 +432,13 @@ declare module '@tanstack/react-router' { preLoaderRoute: typeof AppauthLoginRouteImport parentRoute: typeof AppRouteRoute } + '/_old/old/ocp/': { + id: '/_old/old/ocp/' + path: '/ocp' + fullPath: '/old/ocp' + preLoaderRoute: typeof OldOldOcpIndexRouteImport + parentRoute: typeof OldOldRouteRoute + } '/_mobile/_mobileLayout/m/': { id: '/_mobile/_mobileLayout/m/' path: '/m' @@ -491,6 +523,13 @@ declare module '@tanstack/react-router' { preLoaderRoute: typeof AppAdminLayoutAdminUsersRouteRouteImport parentRoute: typeof AppAdminLayoutAdminRoute } + '/_old/old/(ocme)/cyclecount/': { + id: '/_old/old/(ocme)/cyclecount/' + path: '/cyclecount' + fullPath: '/old/cyclecount' + preLoaderRoute: typeof OldOldocmeCyclecountIndexRouteImport + parentRoute: typeof OldOldRouteRoute + } '/_old/old/(logistics)/siloAdjustments/': { id: '/_old/old/(logistics)/siloAdjustments/' path: '/siloAdjustments' @@ -624,17 +663,21 @@ const MobileMobileLayoutRouteRouteWithChildren = interface OldOldRouteRouteChildren { OldOldIndexRoute: typeof OldOldIndexRoute + OldOldOcpIndexRoute: typeof OldOldOcpIndexRoute OldOldlogisticsSiloAdjustmentsHistRoute: typeof OldOldlogisticsSiloAdjustmentsHistRoute OldOldlogisticsSiloAdjustmentsIndexRoute: typeof OldOldlogisticsSiloAdjustmentsIndexRoute + OldOldocmeCyclecountIndexRoute: typeof OldOldocmeCyclecountIndexRoute OldOldlogisticsSiloAdjustmentsCommentCommentRoute: typeof OldOldlogisticsSiloAdjustmentsCommentCommentRoute } const OldOldRouteRouteChildren: OldOldRouteRouteChildren = { OldOldIndexRoute: OldOldIndexRoute, + OldOldOcpIndexRoute: OldOldOcpIndexRoute, OldOldlogisticsSiloAdjustmentsHistRoute: OldOldlogisticsSiloAdjustmentsHistRoute, OldOldlogisticsSiloAdjustmentsIndexRoute: OldOldlogisticsSiloAdjustmentsIndexRoute, + OldOldocmeCyclecountIndexRoute: OldOldocmeCyclecountIndexRoute, OldOldlogisticsSiloAdjustmentsCommentCommentRoute: OldOldlogisticsSiloAdjustmentsCommentCommentRoute, } diff --git a/frontend/src/routes/_old/old/(ocme)/cyclecount/index.tsx b/frontend/src/routes/_old/old/(ocme)/cyclecount/index.tsx new file mode 100644 index 0000000..2996d8d --- /dev/null +++ b/frontend/src/routes/_old/old/(ocme)/cyclecount/index.tsx @@ -0,0 +1,14 @@ +import { createFileRoute } from "@tanstack/react-router"; +import OcmeCycleCount from "../../-components/ocme/ocmeCycleCount"; + +export const Route = createFileRoute("/_old/old/(ocme)/cyclecount/")({ + component: RouteComponent, +}); + +function RouteComponent() { + return ( +
+ +
+ ); +} diff --git a/lstV2/frontend/src/components/ocme/CycleCountLog.tsx b/frontend/src/routes/_old/old/-components/ocme/CycleCountLog.tsx similarity index 100% rename from lstV2/frontend/src/components/ocme/CycleCountLog.tsx rename to frontend/src/routes/_old/old/-components/ocme/CycleCountLog.tsx diff --git a/frontend/src/routes/_old/old/-components/ocme/ManuallyEnterRn.tsx b/frontend/src/routes/_old/old/-components/ocme/ManuallyEnterRn.tsx new file mode 100644 index 0000000..3bea30e --- /dev/null +++ b/frontend/src/routes/_old/old/-components/ocme/ManuallyEnterRn.tsx @@ -0,0 +1,101 @@ +import { useForm } from "@tanstack/react-form"; + +import axios from "axios"; +import { useState } from "react"; +import { toast } from "sonner"; +import { Button } from "@/components/ui/button"; +import { Input } from "@/components/ui/input"; +import { Label } from "@/components/ui/label"; + +export default function ManuallyEnterRn() { + const [sending, setSendingRn] = useState(false); + const form = useForm({ + defaultValues: { + runningNr: "", + }, + onSubmit: async ({ value }) => { + console.log(value); + setSendingRn(true); + try { + const res = await axios.post("/ocme/api/v1/postRunningNumber", { + runningNr: value.runningNr, + areaFrom: "wrapper_1", + completed: true, + }); + + if (res.data.success) { + form.reset(); + toast.success(`${value.runningNr} was just created please login`); + setTimeout(() => { + setSendingRn(false); + }, 3 * 1000); + } + + if (!res.data.success) { + toast.error(res.data.message); + setTimeout(() => { + setSendingRn(false); + }, 3 * 1000); + } + } catch (error) { + //console.log(error); + toast.error("There was an error registering"); + setTimeout(() => { + setSendingRn(false); + }, 3 * 1000); + } + }, + }); + return ( +
+
{ + e.preventDefault(); + //e.stopPropagation(); + }} + > + + value.length > 3 + ? undefined + : "pallet number must be greater than 4 numbers", + }} + children={(field) => { + return ( +
+
+ + field.handleChange(e.target.value)} + /> + {field.state.meta.errors.length ? ( + {field.state.meta.errors.join(",")} + ) : null} +
+
+ +
+
+ ); + }} + /> + +
+ ); +} diff --git a/frontend/src/routes/_old/old/-components/ocme/WrapperCard.tsx b/frontend/src/routes/_old/old/-components/ocme/WrapperCard.tsx new file mode 100644 index 0000000..ebd52ee --- /dev/null +++ b/frontend/src/routes/_old/old/-components/ocme/WrapperCard.tsx @@ -0,0 +1,165 @@ +import { useQuery } from "@tanstack/react-query"; +import axios from "axios"; +import { format } from "date-fns"; +import { Trash } from "lucide-react"; +import { toast } from "sonner"; +import { Button } from "@/components/ui/button"; +import { ScrollArea } from "@/components/ui/scroll-area"; +import { Skeleton } from "@/components/ui/skeleton"; +import { + Table, + TableBody, + TableCell, + TableHead, + TableHeader, + TableRow, +} from "@/components/ui/table"; +import { getOcmeInfo } from "../../-utils/querys/ocp/getOcmeInfo"; +import { LstCard } from "../extendedUi/LstCard"; +import ManualTrigger from "../rfid/ManualTrigger"; + +const currentPallets = [ + { key: "line", label: "Line" }, + { 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" }, +// ]; +export default function WrapperManualTrigger() { + const { data, isError, isLoading } = useQuery(getOcmeInfo()); + const cameraTrigger = async () => { + try { + const res = await axios.get("/ocme/api/v1/manualCameraTrigger"); + + if (res.data.success) { + toast.success(res.data.message); + return; + } + + if (!res.data.success) { + toast.error(res.data.message); + } + } catch (error) { + console.log(error); + //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 ( + + + Wrapper Pallet Info +
+ + + + {currentPallets.map((l) => ( + {l.label} + ))} + + + {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} + + + + + ))} + + )} +
+
+
+ +
+
+ {/*

Manual Trigger

+ + */} +
+ + +
+
+
+ ); +} diff --git a/frontend/src/routes/_old/old/-components/ocme/ocmeCycleCount.tsx b/frontend/src/routes/_old/old/-components/ocme/ocmeCycleCount.tsx new file mode 100644 index 0000000..c6ba681 --- /dev/null +++ b/frontend/src/routes/_old/old/-components/ocme/ocmeCycleCount.tsx @@ -0,0 +1,229 @@ +import axios from "axios"; +import { useState } from "react"; +import { Controller, useForm } from "react-hook-form"; +import { toast } from "sonner"; +import { Button } from "@/components/ui/button"; +import { Input } from "@/components/ui/input"; +import { LstCard } from "@/components/ui/lstCard"; +//import CycleCountLog from "./CycleCountLog"; +import { + Select, + SelectContent, + SelectItem, + SelectTrigger, + SelectValue, +} from "@/components/ui/select"; +import { Skeleton } from "@/components/ui/skeleton"; +import { + Table, + TableBody, + TableCell, + TableHead, + TableHeader, + TableRow, +} from "@/components/ui/table"; + +export default function OcmeCycleCount() { + const token = localStorage.getItem("auth_token"); + const [data, setData] = useState([]); + const [counting, setCounting] = useState(false); + const { + register, + handleSubmit, + //watch, + formState: { errors }, + reset, + control, + } = useForm({ + defaultValues: { + lane: "", + laneType: "name", + }, + }); + + const onSubmit = async (data: any) => { + setData([]); + setCounting(true); + + if (data.laneType === "") { + toast.error("Please select a type"); + setCounting(false); + return; + } + toast.success(`Cycle count started`); + try { + const res = await axios.post("/ocme/api/v1/cycleCount", data, { + headers: { Authorization: `Bearer ${token}` }, + }); + + if (res.data.success) { + toast.success(res.data.message); + setData(res.data.data); + setCounting(false); + reset(); + } + + if (!res.data.success) { + toast.success(res.data.message); + + setCounting(false); + } + } catch (error) { + toast.error("There was an error cycle counting"); + setCounting(false); + reset(); + } + }; + return ( +
+
+ +

+ Please enter the name or laneID you want to cycle count. +

+
+
+
+
+ +
+ ( + + )} + /> +
+
+ +
+
+
+
+ + + + LaneID + Lane + AV + Description + Running Number + In Ocme + In Stock + Result + + + {data?.length === 0 ? ( + + {Array(10) + .fill(0) + .map((_, i) => ( + + + + + + + + + + + + + + + + + + + + + + + + + + + ))} + + ) : ( + <> + {data.map((i: any) => { + let classname = ``; + if (i.info === "Validate pallet is ok.") { + classname = `bg-red-500`; + } + if (i.info === "Sent to Inv") { + classname = `bg-amber-700`; + } + return ( + + + {i.alpla_laneID} + + + {i.alpla_laneDescription} + + + {i.Article} + + + {i.alpla_laneDescription} + + + {i.runningNumber} + + + {i.ocme} + + + {i.stock} + + + {i.info} + + + ); + })} + + )} +
+
+
+
+ {/*
+ +
*/} +
+ ); +} diff --git a/frontend/src/routes/_old/old/-components/ocp/LabelLog.tsx b/frontend/src/routes/_old/old/-components/ocp/LabelLog.tsx new file mode 100644 index 0000000..ebe9d1f --- /dev/null +++ b/frontend/src/routes/_old/old/-components/ocp/LabelLog.tsx @@ -0,0 +1,24 @@ +// import {useSessionStore} from "@/lib/store/sessionStore"; +// import {useSettingStore} from "@/lib/store/useSettings"; +import { useQuery } from "@tanstack/react-query"; +import { getlabels } from "../../-utils/querys/ocp/labels"; +import { labelolumns } from "../../-utils/tableData/production/labels/labelColumns"; +import { LabelTable } from "../../-utils/tableData/production/labels/labelData"; + +export default function LabelLog() { + const { data, isError, isLoading } = useQuery(getlabels("4")); + + if (isError) return
Error
; + + if (isLoading) return
Loading
; + const labelData = data ? data : []; + return ( +
+ +
+ ); +} diff --git a/frontend/src/routes/_old/old/-components/ocp/LabelRatio.tsx b/frontend/src/routes/_old/old/-components/ocp/LabelRatio.tsx new file mode 100644 index 0000000..550baba --- /dev/null +++ b/frontend/src/routes/_old/old/-components/ocp/LabelRatio.tsx @@ -0,0 +1,27 @@ +import { useQuery } from "@tanstack/react-query"; +import { getlabelRatio } from "../../-utils/querys/ocp/labelRatio"; +import { labelRatioColumns } from "../../-utils/tableData/production/labelRatio/labelRatioColumns"; +import { LabelRatioTable } from "../../-utils/tableData/production/labelRatio/labelRatioData"; + +export default function LabelRatio() { + const { data, isError, isLoading } = useQuery(getlabelRatio()); + + const ratioData = data ? data : []; + if (isError) { + return
Error
; + } + + if (isLoading) { + return
Loading
; + } + + return ( +
+ +
+ ); +} diff --git a/lstV2/frontend/src/components/production/ocp/Lots.tsx b/frontend/src/routes/_old/old/-components/ocp/Lots.tsx similarity index 85% rename from lstV2/frontend/src/components/production/ocp/Lots.tsx rename to frontend/src/routes/_old/old/-components/ocp/Lots.tsx index 588d209..dea3079 100644 --- a/lstV2/frontend/src/components/production/ocp/Lots.tsx +++ b/frontend/src/routes/_old/old/-components/ocp/Lots.tsx @@ -1,5 +1,5 @@ import { useQuery } from "@tanstack/react-query"; -import { LstCard } from "@/components/extendedUI/LstCard"; + import { ScrollArea } from "@/components/ui/scroll-area"; import { Skeleton } from "@/components/ui/skeleton"; import { @@ -10,12 +10,11 @@ import { TableHeader, TableRow, } from "@/components/ui/table"; -import { useSessionStore } from "@/lib/store/sessionStore"; -import { useGetUserRoles } from "@/lib/store/useGetRoles"; -import { useModuleStore } from "@/lib/store/useModuleStore"; -import { useSettingStore } from "@/lib/store/useSettings"; -import { LotType } from "@/types/lots"; -import { getlots } from "@/utils/querys/production/lots"; +import { useAuth, userAccess } from "@/lib/authClient"; +import { useSettingStore } from "../../-lib/store/useSettings"; +import type { LotType } from "../../-types/lots"; +import { getlots } from "../../-utils/querys/ocp/lots"; +import { LstCard } from "../extendedUi/LstCard"; import ManualPrint from "./ManualPrinting/ManualPrint"; import ManualPrintForm from "./ManualPrinting/ManualPrintForm"; @@ -67,23 +66,20 @@ let lotColumns = [ ]; export default function Lots() { const { data, isError, isLoading } = useQuery(getlots()); - const { user } = useSessionStore(); + const { session } = useAuth(); const { settings } = useSettingStore(); - const { userRoles } = useGetUserRoles(); - const { modules } = useModuleStore(); - const server = settings.filter((n) => n.name === "server")[0]?.value || ""; - - const roles = ["systemAdmin", "technician", "admin", "manager", "operator"]; + const server = settings.filter((n) => n.name === "dbServer")[0]?.value || ""; const lotdata = data ? data : []; - const module = modules.filter((n) => n.name === "logistics"); + const accessRoles = userAccess("ocp", [ + "systemAdmin", + "technician", + "admin", + "manager", + ]); - const accessRoles = userRoles.filter( - (n: any) => n.module === module[0]?.name, - ) as any; - - if (user && roles.includes(accessRoles[0]?.role)) { + if (session?.user && accessRoles) { //width = 1280; const checkCol = lotColumns.some((l) => l.key === "printLabel"); if (!checkCol) { @@ -230,7 +226,7 @@ export default function Lots() { {lot.overPrinting} - {user && roles.includes(accessRoles[0]?.role) && ( + {session?.user && accessRoles && ( <> {server === "usday1vms006" || server === "localhost" ? ( <> diff --git a/frontend/src/routes/_old/old/-components/ocp/ManualPrinting/ManualPrint.tsx b/frontend/src/routes/_old/old/-components/ocp/ManualPrinting/ManualPrint.tsx new file mode 100644 index 0000000..e83543f --- /dev/null +++ b/frontend/src/routes/_old/old/-components/ocp/ManualPrinting/ManualPrint.tsx @@ -0,0 +1,46 @@ +import { Button } from "@/components/ui/button"; + +//import {useSettingStore} from "@/lib/store/useSettings"; + +import { Tag } from "lucide-react"; +import { useState } from "react"; +import { toast } from "sonner"; +import { useAuth } from "@/lib/authClient"; +import type { LotType } from "../../../-types/lots"; +import { manualPrintLabels } from "./ManualPrintLabel"; + +export default function ManualPrint({ lot }: { lot: LotType }) { + const { session } = useAuth(); + 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) => { + const labels: any = await manualPrintLabels(lot, session?.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 ( + + ); +} diff --git a/frontend/src/routes/_old/old/-components/ocp/ManualPrinting/ManualPrintForm.tsx b/frontend/src/routes/_old/old/-components/ocp/ManualPrinting/ManualPrintForm.tsx new file mode 100644 index 0000000..2b2b4a9 --- /dev/null +++ b/frontend/src/routes/_old/old/-components/ocp/ManualPrinting/ManualPrintForm.tsx @@ -0,0 +1,256 @@ +import axios from "axios"; +import { Tag } from "lucide-react"; +import { useState } from "react"; +import { Controller, useForm } from "react-hook-form"; +import { toast } from "sonner"; +import { Button } from "@/components/ui/button"; +import { + Dialog, + DialogContent, + // DialogDescription, + DialogFooter, + DialogHeader, + DialogTitle, + DialogTrigger, +} from "@/components/ui/dialog"; +import { Input } from "@/components/ui/input"; +import { Label } from "@/components/ui/label"; +import { + Select, + SelectContent, + SelectGroup, + SelectItem, + SelectLabel, + SelectTrigger, + SelectValue, +} from "@/components/ui/select"; +import { Textarea } from "@/components/ui/textarea"; +import { useSettingStore } from "../../../-lib/store/useSettings"; + +const printReason = [ + { key: "printerIssue", label: "Printer Related" }, + { key: "missingRfidTag", label: "Missing or incorrect tag" }, + { key: "rfidMissScan", label: "Missed Scan from RFID reader" }, + { key: "strapper", label: "Strapper Error" }, + { key: "manualCheck", label: "20th pallet check" }, + { key: "outOfSync", label: "Labeler Out of Sync" }, +]; + +export default function ManualPrintForm() { + const token = localStorage.getItem("auth_token"); + const { settings } = useSettingStore(); + const [open, setOpen] = useState(false); + const [isSubmitting, setIsSubmitting] = useState(false); + 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}`; + + // what is the dyco set to? rfid or dyco + const dyco = settings.filter((n) => n.name === "dycoPrint"); + const { + register, + handleSubmit, + //watch, + formState: { errors }, + reset, + control, + } = useForm(); + + const handleManualPrintLog = async (logData: any) => { + // toast.success(`A new label was sent to printer: ${lot.PrinterName} for line ${lot.MachineDescription} `); + const logdataUrl = `/lst/old/api/ocp/manuallabellog`; + setIsSubmitting(true); + axios + .post(logdataUrl, logData, { + headers: { Authorization: `Bearer ${token}` }, + }) + .then((d) => { + console.log(d); + if (d.data.success) { + toast.success(d.data.message); + } else { + toast.error(d.data.message); + } + reset(); + setOpen(false); + setIsSubmitting(false); + }) + .catch((e) => { + if (e.response.status === 500) { + toast.error(`Internal Server error please try again.`); + setIsSubmitting(false); + return { sucess: false }; + } + + if (e.response.status === 401) { + //console.log(e.response); + toast.error(`You are not authorized to do this.`); + setIsSubmitting(false); + return { sucess: false }; + } + }); + }; + + const onSubmit = (data: any) => { + console.log(data); + + handleManualPrintLog(data); + }; + + const closeForm = () => { + reset(); + setOpen(false); + }; + return ( + { + if (!open) { + reset(); + } + setOpen(isOpen); + // toast.message("Model was something", { + // description: isOpen ? "Modal is open" : "Modal is closed", + // }); + }} + > + + + + + + Manual Print form + {/* + Make changes to your profile here. Click save when + you're done. + */} + +
+

+ To manually print a label you must complete all the required fields + below. +
+ If you clicked this in error just click close +

+
+ {server == "usday1vms006" ? ( + ( + + )} + /> + ) : ( +
+ + +
+ )} +
+ + +
+ +
+ + +
+
+ {dyco[0].value === "0" && ( +
+

Enter the missing tag number.

+
+ + +
+ )} +
+