feat(ocme): cycle count implemeneted
This commit is contained in:
@@ -1,8 +1,30 @@
|
||||
import {useEffect, useState} from "react";
|
||||
import {LstCard} from "../extendedUI/LstCard";
|
||||
import {CardContent, CardHeader} from "../ui/card";
|
||||
import {Skeleton} from "../ui/skeleton";
|
||||
import {Button} from "../ui/button";
|
||||
|
||||
export default function CycleCountLog() {
|
||||
const [logs, setLogs] = useState([]);
|
||||
const [streaming, setStreaming] = useState(false); // Track if streaming is active
|
||||
|
||||
useEffect(() => {
|
||||
// Start streaming when the button is clicked
|
||||
let es;
|
||||
|
||||
es = new EventSource("http://localhost:4000/api/logger/logs/stream?service=ocme-count&level=info");
|
||||
es.onopen = () => console.log(">>> Connection opened!");
|
||||
es.onerror = (e) => console.log("ERROR!", e);
|
||||
es.onmessage = (e) => {
|
||||
console.log(">>>", JSON.stringify(e));
|
||||
};
|
||||
|
||||
return () => es.close();
|
||||
}, []); // Effect runs when `streaming` state changes
|
||||
|
||||
const handleStartStreaming = () => {
|
||||
setStreaming(true); // Start streaming when button is clicked
|
||||
};
|
||||
return (
|
||||
<LstCard className="w-48">
|
||||
<CardHeader className="flex justify-center">
|
||||
@@ -17,6 +39,7 @@ export default function CycleCountLog() {
|
||||
</div>
|
||||
))}
|
||||
</CardContent>
|
||||
<Button onClick={handleStartStreaming}>Start Stream</Button>
|
||||
</LstCard>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -5,20 +5,88 @@ import {Input} from "../ui/input";
|
||||
import {Table, TableBody, TableCell, TableHead, TableHeader, TableRow} from "../ui/table";
|
||||
import {Skeleton} from "../ui/skeleton";
|
||||
import CycleCountLog from "./CycleCountLog";
|
||||
import {Select, SelectContent, SelectItem, SelectTrigger, SelectValue} from "../ui/select";
|
||||
import {Controller, useForm} from "react-hook-form";
|
||||
import axios from "axios";
|
||||
import {useState} from "react";
|
||||
|
||||
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();
|
||||
|
||||
const onSubmit = async (data: any) => {
|
||||
setData([]);
|
||||
setCounting(true);
|
||||
toast.success(`Cycle count started`);
|
||||
try {
|
||||
const res = await axios.post("/ocme/api/v1/cyclecount", data, {
|
||||
headers: {Authorization: `Bearer ${token}`},
|
||||
});
|
||||
toast.success(res.data.message);
|
||||
setData(res.data.data);
|
||||
setCounting(false);
|
||||
reset();
|
||||
} catch (error) {
|
||||
toast.error("There was an error cycle counting");
|
||||
setCounting(false);
|
||||
reset();
|
||||
}
|
||||
};
|
||||
return (
|
||||
<div className="flex flex-row w-fill">
|
||||
<div className="flex flex-row w-screen">
|
||||
<div className="m-2 w-5/6">
|
||||
<LstCard>
|
||||
<p className="ml-2">Please enter the name or laneID you want to cycle count.</p>
|
||||
<div>
|
||||
<form>
|
||||
<form onSubmit={handleSubmit(onSubmit)}>
|
||||
<div className="flex justify-between">
|
||||
<div className="m-2">
|
||||
<Input placeholder="enter lane: L064" />
|
||||
<div className="m-2 flex flex-row">
|
||||
<Input
|
||||
placeholder="enter lane: L064"
|
||||
className={errors.lane ? "border-red-500" : ""}
|
||||
aria-invalid={!!errors.lane}
|
||||
{...register("lane", {
|
||||
required: true,
|
||||
minLength: {
|
||||
value: 3,
|
||||
message: "The lane is too short!",
|
||||
},
|
||||
})}
|
||||
/>
|
||||
<div className="ml-2">
|
||||
<Controller
|
||||
control={control}
|
||||
name="laneType"
|
||||
defaultValue={""}
|
||||
render={({
|
||||
field: {onChange},
|
||||
fieldState: {},
|
||||
//formState,
|
||||
}) => (
|
||||
<Select onValueChange={onChange}>
|
||||
<SelectTrigger className="w-[180px]">
|
||||
<SelectValue placeholder="Select name or id" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="name">Name</SelectItem>
|
||||
<SelectItem value="laneId">Lane ID</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<Button className="m-2" onClick={() => toast.success("Cycle Count completed")}>
|
||||
CycleCount
|
||||
<Button className="m-2" type="submit" disabled={counting}>
|
||||
{counting ? <span>Counting...</span> : <span>CycleCount</span>}
|
||||
</Button>
|
||||
</div>
|
||||
</form>
|
||||
@@ -37,45 +105,81 @@ export default function OcmeCycleCount() {
|
||||
<TableHead>Result</TableHead>
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
{Array(10)
|
||||
.fill(0)
|
||||
.map((_, i) => (
|
||||
<TableRow key={i}>
|
||||
<TableCell className="font-medium">
|
||||
<Skeleton className="h-4" />
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<Skeleton className="h-4" />
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<Skeleton className="h-4" />
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<Skeleton className="h-4" />
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<Skeleton className="h-4" />
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<Skeleton className="h-4" />
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<Skeleton className="h-4" />
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<Skeleton className="h-4" />
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
))}
|
||||
</TableBody>
|
||||
{data.length === 0 ? (
|
||||
<TableBody>
|
||||
{Array(10)
|
||||
.fill(0)
|
||||
.map((_, i) => (
|
||||
<TableRow key={i}>
|
||||
<TableCell className="font-medium">
|
||||
<Skeleton className="h-4" />
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<Skeleton className="h-4" />
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<Skeleton className="h-4" />
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<Skeleton className="h-4" />
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<Skeleton className="h-4" />
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<Skeleton className="h-4" />
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<Skeleton className="h-4" />
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<Skeleton className="h-4" />
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
))}
|
||||
</TableBody>
|
||||
) : (
|
||||
<>
|
||||
{data.map((i: any) => {
|
||||
let classname = ``;
|
||||
if (i.info === "Quality Check Required") {
|
||||
classname = `bg-red-500`;
|
||||
}
|
||||
if (i.info === "Sent to Inv") {
|
||||
classname = `bg-amber-700`;
|
||||
}
|
||||
return (
|
||||
<TableRow key={i.runningNumber}>
|
||||
<TableCell className={`font-medium ${classname}`}>
|
||||
{i.alpla_laneID}
|
||||
</TableCell>
|
||||
<TableCell className={`font-medium ${classname}`}>
|
||||
{i.alpla_laneDescription}
|
||||
</TableCell>
|
||||
<TableCell className={`font-medium ${classname}`}>
|
||||
{i.Article}
|
||||
</TableCell>
|
||||
<TableCell className={`font-medium ${classname}`}>
|
||||
{i.alpla_laneDescription}
|
||||
</TableCell>
|
||||
<TableCell className={`font-medium ${classname}`}>
|
||||
{i.runningNumber}
|
||||
</TableCell>
|
||||
<TableCell className={`font-medium ${classname}`}>{i.ocme}</TableCell>
|
||||
<TableCell className={`font-medium ${classname}`}>{i.stock}</TableCell>
|
||||
<TableCell className={`font-medium ${classname}`}>{i.info}</TableCell>
|
||||
</TableRow>
|
||||
);
|
||||
})}
|
||||
</>
|
||||
)}
|
||||
</Table>
|
||||
</div>
|
||||
</LstCard>
|
||||
</div>
|
||||
<div className="m-2">
|
||||
{/* <div className="m-2">
|
||||
<CycleCountLog />
|
||||
</div>
|
||||
</div> */}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import type {User} from "../../../types/users.js";
|
||||
import {alplaStockInv} from "./cycleCount/alplaStockInventory.js";
|
||||
import {emptyCount} from "./cycleCount/emptyCycleCount.js";
|
||||
import {fullLaneCount} from "./cycleCount/fullLaneCycleCount.js";
|
||||
import {ocmeInv} from "./cycleCount/ocmeInventory.js";
|
||||
|
||||
export const prepareLane = "https://usday1prod.alpla.net/application/public/v1.1/Warehousing/PrepareLaneForInventory";
|
||||
@@ -8,7 +9,7 @@ export const openLane = "https://usday1prod.alpla.net/application/public/v1.0/Wa
|
||||
export const closeLane = "https://usday1prod.alpla.net/application/public/v1.0/Warehousing/InventoryClose";
|
||||
export const releaseLane = "https://usday1prod.alpla.net/application/public/v1.1/Warehousing/ReleaseLaneFromInventory";
|
||||
export const scannerID = 500;
|
||||
export const cycleCount = async (lane: string, user: User) => {
|
||||
export const cycleCount = async (lane: any, user: User) => {
|
||||
/**
|
||||
* We will get the inventory from both systems and merge them together, intert it into our db then do the cycle count and update each item
|
||||
* one it dose it.
|
||||
@@ -21,7 +22,7 @@ export const cycleCount = async (lane: string, user: User) => {
|
||||
const alplaStock = await alplaStockInv(ocme[0].alpla_laneID);
|
||||
|
||||
// create a new array that has the merge happen.
|
||||
const mergeOcmeData = ocme.map((d) => {
|
||||
const mergeOcmeData = ocme.map((d: any) => {
|
||||
// check if its in the ocme array we add it
|
||||
const inStock = alplaStock.filter((r: any) => r.runningNumber === d.runningNumber);
|
||||
//console.log(inStock);
|
||||
@@ -52,9 +53,10 @@ export const cycleCount = async (lane: string, user: User) => {
|
||||
// determine what type of count we are doing.
|
||||
if (ocme.length === 0) {
|
||||
// do empty count
|
||||
await emptyCount(user, lane);
|
||||
await emptyCount(user, ocme[0].alpla_laneID);
|
||||
} else {
|
||||
// do the full lane inv
|
||||
await fullLaneCount(user, ocme[0].alpla_laneID, ocme);
|
||||
}
|
||||
|
||||
// store in the db so we have a record.... for later when we fully randomize and automate this.
|
||||
|
||||
@@ -0,0 +1,126 @@
|
||||
// full lane count
|
||||
import axios from "axios";
|
||||
import {delay} from "../../../../globalUtils/delay.js";
|
||||
import {createLog} from "../../../logger/logger.js";
|
||||
import {openLane, prepareLane, scannerID} from "../cycleCount.js";
|
||||
import type {User} from "../../../../types/users.js";
|
||||
|
||||
let delayTime = 100;
|
||||
|
||||
export const fullLaneCount = async (user: User, lane: string, ocmeLanes: any) => {
|
||||
// prepare the lane.
|
||||
try {
|
||||
const openlane = await axios({
|
||||
method: "POST",
|
||||
url: prepareLane,
|
||||
headers: {
|
||||
Authorization: `Basic ${user.prod}`,
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
data: {
|
||||
scannerId: scannerID,
|
||||
laneId: lane,
|
||||
},
|
||||
});
|
||||
|
||||
createLog("info", user.username!, "ocme-count", openlane.data.message);
|
||||
try {
|
||||
const open = await axios({
|
||||
method: "POST",
|
||||
url: openLane,
|
||||
headers: {
|
||||
Authorization: `Basic ${user.prod}`,
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
data: {
|
||||
scannerId: scannerID,
|
||||
laneId: lane,
|
||||
},
|
||||
});
|
||||
|
||||
createLog("info", user.username!, "ocme-count", open.data.Message);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
|
||||
// do the inv
|
||||
|
||||
for (let i = 0; i < ocmeLanes.length; i++) {
|
||||
const count = {
|
||||
scannerId: scannerID,
|
||||
sscc: ocmeLanes[i].sscc,
|
||||
};
|
||||
//createLog("cyclecounting", "info", `Processing running: ${ocmeLanes[i].runningNumber}`);
|
||||
await delay(delayTime);
|
||||
|
||||
try {
|
||||
const openLane = await axios({
|
||||
method: "POST",
|
||||
url: "https://usday1prod.alpla.net/application/public/v1.0/Warehousing/InventoryCount",
|
||||
headers: {
|
||||
Authorization: `Basic ${user.prod}`,
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
data: count,
|
||||
});
|
||||
|
||||
createLog(
|
||||
"info",
|
||||
user.username!,
|
||||
"ocme-count",
|
||||
`${openLane.data.Message} on running: ${ocmeLanes[i].runningNumber}`
|
||||
);
|
||||
await delay(delayTime);
|
||||
} catch (error) {
|
||||
createLog("error", user.username!, "ocme-count", `${error}`);
|
||||
}
|
||||
}
|
||||
|
||||
// close the count
|
||||
// close the order
|
||||
try {
|
||||
const openLane = await axios({
|
||||
method: "POST",
|
||||
url: "https://usday1prod.alpla.net/application/public/v1.0/Warehousing/InventoryClose",
|
||||
headers: {
|
||||
Authorization: `Basic ${user.prod}`,
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
data: {
|
||||
scannerId: scannerID,
|
||||
laneId: lane,
|
||||
},
|
||||
});
|
||||
|
||||
createLog("info", user.username!, "ocme-count", openLane.data.Message);
|
||||
|
||||
if (openLane.data.Result === 0) {
|
||||
//release the lane
|
||||
//----------------------------------------------------
|
||||
try {
|
||||
const openLane = await axios({
|
||||
method: "POST",
|
||||
url: "https://usday1prod.alpla.net/application/public/v1.1/Warehousing/ReleaseLaneFromInventory",
|
||||
headers: {
|
||||
Authorization: `Basic ${user.prod}`,
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
data: {
|
||||
laneId: lane,
|
||||
},
|
||||
});
|
||||
|
||||
createLog("info", user.username!, "ocme-count", openLane.data.message);
|
||||
} catch (error) {
|
||||
createLog("error", user.username!, "ocme-count", `${error}`);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
createLog("error", user.username!, "ocme-count", `${error}`);
|
||||
}
|
||||
|
||||
return {success: true, message: `Lane completed`};
|
||||
};
|
||||
|
||||
@@ -1,284 +1,16 @@
|
||||
import axios from "axios";
|
||||
const data = [
|
||||
{
|
||||
ocme_laneLevelID: "P3F36PZ1PN1",
|
||||
alpla_laneID: "30285 ",
|
||||
alpla_laneDescription: "L064",
|
||||
Article: "146",
|
||||
description: "HDPE Trigger 16oz White",
|
||||
sscc: "090103830005256402",
|
||||
runningNumber: "525640",
|
||||
},
|
||||
{
|
||||
ocme_laneLevelID: "P3F36PZ1PN2",
|
||||
alpla_laneID: "30285 ",
|
||||
alpla_laneDescription: "L064",
|
||||
Article: "146",
|
||||
description: "HDPE Trigger 16oz White",
|
||||
sscc: "090103830005402649",
|
||||
runningNumber: "540264",
|
||||
},
|
||||
{
|
||||
ocme_laneLevelID: "P3F36PZ1PN3",
|
||||
alpla_laneID: "30285 ",
|
||||
alpla_laneDescription: "L064",
|
||||
Article: "146",
|
||||
description: "HDPE Trigger 16oz White",
|
||||
sscc: "090103830005312559",
|
||||
runningNumber: "531255",
|
||||
},
|
||||
{
|
||||
ocme_laneLevelID: "P3F36PZ1PN4",
|
||||
alpla_laneID: "30285 ",
|
||||
alpla_laneDescription: "L064",
|
||||
Article: "146",
|
||||
description: "HDPE Trigger 16oz White",
|
||||
sscc: "090103830005312658",
|
||||
runningNumber: "531265",
|
||||
},
|
||||
{
|
||||
ocme_laneLevelID: "P3F36PZ2PN1",
|
||||
alpla_laneID: "30285 ",
|
||||
alpla_laneDescription: "L064",
|
||||
Article: "146",
|
||||
description: "HDPE Trigger 16oz White",
|
||||
sscc: "090103830005404186",
|
||||
runningNumber: "540418",
|
||||
},
|
||||
{
|
||||
ocme_laneLevelID: "P3F36PZ2PN2",
|
||||
alpla_laneID: "30285 ",
|
||||
alpla_laneDescription: "L064",
|
||||
Article: "146",
|
||||
description: "HDPE Trigger 16oz White",
|
||||
sscc: "090103830005404193",
|
||||
runningNumber: "540419",
|
||||
},
|
||||
{
|
||||
ocme_laneLevelID: "P3F36PZ2PN3",
|
||||
alpla_laneID: "30285 ",
|
||||
alpla_laneDescription: "L064",
|
||||
Article: "146",
|
||||
description: "HDPE Trigger 16oz White",
|
||||
sscc: "090103830005404155",
|
||||
runningNumber: "540415",
|
||||
},
|
||||
{
|
||||
ocme_laneLevelID: "P3F36PZ2PN4",
|
||||
alpla_laneID: "30285 ",
|
||||
alpla_laneDescription: "L064",
|
||||
Article: "146",
|
||||
description: "HDPE Trigger 16oz White",
|
||||
sscc: "090103830005404230",
|
||||
runningNumber: "540423",
|
||||
},
|
||||
{
|
||||
ocme_laneLevelID: "P3F36PZ3PN1",
|
||||
alpla_laneID: "30285 ",
|
||||
alpla_laneDescription: "L064",
|
||||
Article: "146",
|
||||
description: "HDPE Trigger 16oz White",
|
||||
sscc: "090103830005306589",
|
||||
runningNumber: "530658",
|
||||
},
|
||||
{
|
||||
ocme_laneLevelID: "P3F36PZ3PN2",
|
||||
alpla_laneID: "30285 ",
|
||||
alpla_laneDescription: "L064",
|
||||
Article: "164",
|
||||
description: "HDPE Trigger 16oz Orange",
|
||||
sscc: "090103830005408634",
|
||||
runningNumber: "540841",
|
||||
},
|
||||
{
|
||||
ocme_laneLevelID: "P3F36PZ3PN3",
|
||||
alpla_laneID: "30285 ",
|
||||
alpla_laneDescription: "L064",
|
||||
Article: "164",
|
||||
description: "HDPE Trigger 16oz Orange",
|
||||
sscc: "090103830005836888",
|
||||
runningNumber: "583688",
|
||||
},
|
||||
{
|
||||
ocme_laneLevelID: "P3F36PZ3PN4",
|
||||
alpla_laneID: "30285 ",
|
||||
alpla_laneDescription: "L064",
|
||||
Article: "164",
|
||||
description: "HDPE Trigger 16oz Orange",
|
||||
sscc: "090103830005836871",
|
||||
runningNumber: "583687",
|
||||
},
|
||||
{
|
||||
ocme_laneLevelID: "P3F36PZ4PN1",
|
||||
alpla_laneID: "30285 ",
|
||||
alpla_laneDescription: "L064",
|
||||
Article: "164",
|
||||
description: "HDPE Trigger 16oz Orange",
|
||||
sscc: "090103830005845279",
|
||||
runningNumber: "584527",
|
||||
},
|
||||
{
|
||||
ocme_laneLevelID: "P3F36PZ4PN2",
|
||||
alpla_laneID: "30285 ",
|
||||
alpla_laneDescription: "L064",
|
||||
Article: "164",
|
||||
description: "HDPE Trigger 16oz Orange",
|
||||
sscc: "090103830005845231",
|
||||
runningNumber: "584523",
|
||||
},
|
||||
{
|
||||
ocme_laneLevelID: "P3F36PZ4PN3",
|
||||
alpla_laneID: "30285 ",
|
||||
alpla_laneDescription: "L064",
|
||||
Article: "164",
|
||||
description: "HDPE Trigger 16oz Orange",
|
||||
sscc: "090103830005845170",
|
||||
runningNumber: "584517",
|
||||
},
|
||||
{
|
||||
ocme_laneLevelID: "P3F36PZ4PN4",
|
||||
alpla_laneID: "30285 ",
|
||||
alpla_laneDescription: "L064",
|
||||
Article: "164",
|
||||
description: "HDPE Trigger 16oz Orange",
|
||||
sscc: "090103830005845156",
|
||||
runningNumber: "584515",
|
||||
},
|
||||
{
|
||||
ocme_laneLevelID: "P3F36PZ5PN1",
|
||||
alpla_laneID: "30285 ",
|
||||
alpla_laneDescription: "L064",
|
||||
Article: "164",
|
||||
description: "HDPE Trigger 16oz Orange",
|
||||
sscc: "090103830005870325",
|
||||
runningNumber: "587032",
|
||||
},
|
||||
{
|
||||
ocme_laneLevelID: "P3F36PZ5PN2",
|
||||
alpla_laneID: "30285 ",
|
||||
alpla_laneDescription: "L064",
|
||||
Article: "164",
|
||||
description: "HDPE Trigger 16oz Orange",
|
||||
sscc: "090103830005871490",
|
||||
runningNumber: "587149",
|
||||
},
|
||||
{
|
||||
ocme_laneLevelID: "P3F36PZ5PN3",
|
||||
alpla_laneID: "30285 ",
|
||||
alpla_laneDescription: "L064",
|
||||
Article: "164",
|
||||
description: "HDPE Trigger 16oz Orange",
|
||||
sscc: "090103830005851782",
|
||||
runningNumber: "585178",
|
||||
},
|
||||
{
|
||||
ocme_laneLevelID: "P3F36PZ5PN4",
|
||||
alpla_laneID: "30285 ",
|
||||
alpla_laneDescription: "L064",
|
||||
Article: "164",
|
||||
description: "HDPE Trigger 16oz Orange",
|
||||
sscc: "090103830005855339",
|
||||
runningNumber: "585533",
|
||||
},
|
||||
{
|
||||
ocme_laneLevelID: "P3F36PZ6PN1",
|
||||
alpla_laneID: "30285 ",
|
||||
alpla_laneDescription: "L064",
|
||||
Article: "164",
|
||||
description: "HDPE Trigger 16oz Orange",
|
||||
sscc: "090103830005867660",
|
||||
runningNumber: "586766",
|
||||
},
|
||||
{
|
||||
ocme_laneLevelID: "P3F36PZ6PN2",
|
||||
alpla_laneID: "30285 ",
|
||||
alpla_laneDescription: "L064",
|
||||
Article: "164",
|
||||
description: "HDPE Trigger 16oz Orange",
|
||||
sscc: "090103830005867622",
|
||||
runningNumber: "586762",
|
||||
},
|
||||
{
|
||||
ocme_laneLevelID: "P3F36PZ6PN3",
|
||||
alpla_laneID: "30285 ",
|
||||
alpla_laneDescription: "L064",
|
||||
Article: "164",
|
||||
description: "HDPE Trigger 16oz Orange",
|
||||
sscc: "090103830005865871",
|
||||
runningNumber: "586587",
|
||||
},
|
||||
{
|
||||
ocme_laneLevelID: "P3F36PZ6PN4",
|
||||
alpla_laneID: "30285 ",
|
||||
alpla_laneDescription: "L064",
|
||||
Article: "164",
|
||||
description: "HDPE Trigger 16oz Orange",
|
||||
sscc: "090103830005865895",
|
||||
runningNumber: "586589",
|
||||
},
|
||||
{
|
||||
ocme_laneLevelID: "P3F36PZ7PN1",
|
||||
alpla_laneID: "30285 ",
|
||||
alpla_laneDescription: "L064",
|
||||
Article: "164",
|
||||
description: "HDPE Trigger 16oz Orange",
|
||||
sscc: "090103830005866052",
|
||||
runningNumber: "586605",
|
||||
},
|
||||
{
|
||||
ocme_laneLevelID: "P3F36PZ7PN2",
|
||||
alpla_laneID: "30285 ",
|
||||
alpla_laneDescription: "L064",
|
||||
Article: "164",
|
||||
description: "HDPE Trigger 16oz Orange",
|
||||
sscc: "090103830005865970",
|
||||
runningNumber: "586597",
|
||||
},
|
||||
{
|
||||
ocme_laneLevelID: "P3F36PZ7PN3",
|
||||
alpla_laneID: "30285 ",
|
||||
alpla_laneDescription: "L064",
|
||||
Article: "164",
|
||||
description: "HDPE Trigger 16oz Orange",
|
||||
sscc: "090103830005877089",
|
||||
runningNumber: "587708",
|
||||
},
|
||||
{
|
||||
ocme_laneLevelID: "P3F36PZ8PN1",
|
||||
alpla_laneID: "30285 ",
|
||||
alpla_laneDescription: "L064",
|
||||
Article: "164",
|
||||
description: "HDPE Trigger 16oz Orange",
|
||||
sscc: "090103830005844975",
|
||||
runningNumber: "584497",
|
||||
},
|
||||
{
|
||||
ocme_laneLevelID: "P3F36PZ8PN2",
|
||||
alpla_laneID: "30285 ",
|
||||
alpla_laneDescription: "L064",
|
||||
Article: "164",
|
||||
description: "HDPE Trigger 16oz Orange",
|
||||
sscc: "090103830005844944",
|
||||
runningNumber: "584494",
|
||||
},
|
||||
{
|
||||
ocme_laneLevelID: "P3F36PZ8PN3",
|
||||
alpla_laneID: "30285 ",
|
||||
alpla_laneDescription: "L064",
|
||||
Article: "164",
|
||||
description: "HDPE Trigger 16oz Orange",
|
||||
sscc: "090103830005844890",
|
||||
runningNumber: "584489",
|
||||
},
|
||||
];
|
||||
export const ocmeInv = async (lane: string) => {
|
||||
try {
|
||||
const res = await axios.post("http://usday1vms010:3250/api/v1/getLaneData", {lane: lane});
|
||||
console.log(res.data);
|
||||
|
||||
return data;
|
||||
export const ocmeInv = async (data: any) => {
|
||||
try {
|
||||
const res = await axios.post(
|
||||
"http://usday1vms010:3250/api/v1/getLaneData",
|
||||
{lane: data.lane, laneType: data.laneType},
|
||||
{headers: {"Content-Type": "application/json", Connection: "keep-alive"}}
|
||||
);
|
||||
// console.log(res.data.data);
|
||||
|
||||
return res.data.data;
|
||||
} catch (error: any) {
|
||||
console.log(error.code);
|
||||
return data;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -12,7 +12,14 @@
|
||||
|
||||
// // add the lane in so we dont crash
|
||||
// if(req.body.lane){
|
||||
// filterdOCMELane = ocmeInventory.replaceAll('[lane]', data.lane)
|
||||
// if(data.laneType === "laneID"){
|
||||
// get the mapped lane id
|
||||
// where alpla_laneID = 30286
|
||||
// filterdOCMELane = ocmeInventory.replaceAll("where alpla_laneDescription = '[lane]'", `where alpla_laneID = ${data.lane}`)
|
||||
|
||||
// } else {
|
||||
// filterdOCMELane = ocmeInventory.replaceAll('[lane]', data.lane)
|
||||
// }
|
||||
// // get lanes
|
||||
// const laneData = await runQuery(filterdOCMELane, 'Getting current ocme lanes linked')
|
||||
// res.status(200).json({success: true,message: `All current lanes from the ocme system.`, totalpallets: laneData.length,data: laneData})
|
||||
|
||||
Reference in New Issue
Block a user