import { LstCard } from "@/components/extendedUI/LstCard"; import { Button } from "@/components/ui/button"; import { CardHeader } from "@/components/ui/card"; import { useAppForm } from "@/utils/formStuff"; import axios from "axios"; import { useState } from "react"; import { toast } from "sonner"; export default function TransferToNextLot() { const [gaylordFilled, setGaylordFilled] = useState([0]); const form = useAppForm({ defaultValues: { runnungNumber: "", lotNumber: "", originalAmount: "", }, onSubmit: async ({ value }) => { //console.log(transferData); //toast.success("603468: qty: 361, was transfered to lot:24897"); try { const res = await axios.post("/api/ocp/materiallottransfer", { runnungNumber: Number(value.runnungNumber), lotNumber: Number(value.lotNumber), originalAmount: Number(value.originalAmount), level: Number( gaylordFilled.length === 1 ? 0.25 : gaylordFilled.length === 2 ? 0.5 : gaylordFilled.length === 3 ? 0.75 : gaylordFilled.length === 4 && 0.95 ), }); if (res.data.success) { toast.success(`${res.data.message}`); form.reset(); } //console.log(res.data); if (!res.data.success) { toast.error(res.data.message); } } catch (error) { if (error) { console.log(error); //toast.error(error) } } }, }); return (
Material Transfer to Next lot
Moving material to the next lot.
* to reduce the time needed to get the lot going we will use an estimate of how full the gaylord is.
NOTE: This is not the return process, this process will just get the gaylord to the next lot.