Compare commits
6 Commits
d3c6444491
...
8ac92888ad
| Author | SHA1 | Date | |
|---|---|---|---|
| 8ac92888ad | |||
| 567579ef35 | |||
| 8d90f27514 | |||
| 722b23a321 | |||
| ba48c5307f | |||
| 30d2ec0477 |
@@ -19,7 +19,7 @@ import { LstCard } from "../../../extendedUi/LstCard";
|
||||
export default function TransferToNextLot() {
|
||||
const [gaylordFilled, setGaylordFilled] = useState([0]);
|
||||
const [actualAmount, setActualAmount] = useState(0);
|
||||
const [tab, setTab] = useState("esitmate");
|
||||
const [tab, setTab] = useState("estimate");
|
||||
const [typeSwitch, setTypeSwitch] = useState(false);
|
||||
const { settings } = useSettingStore();
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ export const readerColumns: ColumnDef<Readers>[] = [
|
||||
const resetReads = async () => {
|
||||
setReaderReset(true);
|
||||
try {
|
||||
const res = await axios.post("/api/rfid/resetRatio", {
|
||||
const res = await axios.post("/lst/old/api/rfid/resetRatio", {
|
||||
reader: name,
|
||||
});
|
||||
|
||||
|
||||
@@ -236,7 +236,8 @@ export const lotMaterialTransfer = async (data: NewLotData) => {
|
||||
const newQty =
|
||||
data.amount > 0
|
||||
? data.amount
|
||||
: (data.originalAmount * data.level).toFixed(0);
|
||||
: // : (data.originalAmount * data.level).toFixed(0);
|
||||
Math.floor(data.originalAmount * data.level);
|
||||
|
||||
//console.log(data.amount);
|
||||
|
||||
|
||||
@@ -20,6 +20,12 @@ export const isMainMatStaged = async (lot: any) => {
|
||||
const machine = data.data.filter(
|
||||
(m: any) => m.HumanReadableId === lot.machineID,
|
||||
);
|
||||
|
||||
// just in case we encounter an issue with the machines
|
||||
if (machine.length === 0) {
|
||||
createLog("error", "mainMaterial", "ocp", "Invalid machine passed over.");
|
||||
return false;
|
||||
}
|
||||
// we have a check on ksc side to ignore the tetra machine for now as its not updating in 2.0
|
||||
if (!machine[0].StagingMainMaterialMandatory) {
|
||||
createLog(
|
||||
|
||||
@@ -1,98 +1,93 @@
|
||||
//http://usday1vms006:4000/api/v1/zebra/wrapper1
|
||||
import { z, createRoute, OpenAPIHono } from "@hono/zod-openapi";
|
||||
import { createRoute, OpenAPIHono, z } from "@hono/zod-openapi";
|
||||
import { ConsoleLogWriter } from "drizzle-orm";
|
||||
import { tagData } from "../controller/tagData.js";
|
||||
import { apiHit } from "../../../globalUtils/apiHits.js";
|
||||
import { responses } from "../../../globalUtils/routeDefs/responses.js";
|
||||
import { tryCatch } from "../../../globalUtils/tryCatch.js";
|
||||
import { createLog } from "../../logger/logger.js";
|
||||
import { clearNoReadTimer, noRead } from "../controller/noRead.js";
|
||||
import { badRead, goodRead } from "../controller/readerControl.js";
|
||||
import { createLog } from "../../logger/logger.js";
|
||||
import { tryCatch } from "../../../globalUtils/tryCatch.js";
|
||||
import { stopRead } from "../controller/readTags.js";
|
||||
import { apiHit } from "../../../globalUtils/apiHits.js";
|
||||
import { tagData } from "../controller/tagData.js";
|
||||
|
||||
const app = new OpenAPIHono();
|
||||
|
||||
const ParamsSchema = z.object({
|
||||
reader: z
|
||||
.string()
|
||||
.min(3)
|
||||
.openapi({
|
||||
param: {
|
||||
name: "reader",
|
||||
in: "path",
|
||||
},
|
||||
example: "1212121",
|
||||
}),
|
||||
reader: z
|
||||
.string()
|
||||
.min(3)
|
||||
.openapi({
|
||||
param: {
|
||||
name: "reader",
|
||||
in: "path",
|
||||
},
|
||||
example: "1212121",
|
||||
}),
|
||||
});
|
||||
|
||||
app.openapi(
|
||||
createRoute({
|
||||
tags: ["rfid"],
|
||||
summary: "Tag info posted from the reader.",
|
||||
method: "post",
|
||||
path: "/taginfo/{reader}",
|
||||
request: {
|
||||
params: ParamsSchema,
|
||||
},
|
||||
responses: responses(),
|
||||
}),
|
||||
async (c) => {
|
||||
const { reader } = c.req.valid("param");
|
||||
createLog("info", "rfid", "rfid", `${reader} is sending us data.`);
|
||||
let tagdata: any = [];
|
||||
const { data: body, error: bodyError } = await tryCatch(c.req.json());
|
||||
apiHit(c, { endpoint: `/taginfo/${reader}`, lastBody: body });
|
||||
if (bodyError) {
|
||||
return c.json({ success: false, message: "missing data" }, 400);
|
||||
}
|
||||
//console.log(`Tag: ${Buffer.from(body.idHex, "hex").toString("utf-8")}, ${body[key].data.idHex}`);
|
||||
createRoute({
|
||||
tags: ["rfid"],
|
||||
summary: "Tag info posted from the reader.",
|
||||
method: "post",
|
||||
path: "/taginfo/{reader}",
|
||||
request: {
|
||||
params: ParamsSchema,
|
||||
},
|
||||
responses: responses(),
|
||||
}),
|
||||
async (c) => {
|
||||
const { reader } = c.req.valid("param");
|
||||
createLog("info", "rfid", "rfid", `${reader} is sending us data.`);
|
||||
let tagdata: any = [];
|
||||
const { data: body, error: bodyError } = await tryCatch(c.req.json());
|
||||
apiHit(c, { endpoint: `/taginfo/${reader}`, lastBody: body });
|
||||
if (bodyError) {
|
||||
return c.json({ success: false, message: "missing data" }, 400);
|
||||
}
|
||||
//console.log(`Tag: ${Buffer.from(body.idHex, "hex").toString("utf-8")}, ${body[key].data.idHex}`);
|
||||
|
||||
for (let i = 0; i < body.length; i++) {
|
||||
const tag = Buffer.from(body[i].data.idHex, "hex").toString(
|
||||
"utf-8"
|
||||
);
|
||||
// console.log(
|
||||
// "Raw value:",
|
||||
// body[i].data.peakRssi,
|
||||
// "Parsed:",
|
||||
// parseInt(body[i].data.peakRssi)
|
||||
// );
|
||||
if (
|
||||
tag.includes("ALPLA") &&
|
||||
parseInt(body[i].data.peakRssi) < -30
|
||||
) {
|
||||
tagdata = [
|
||||
...tagdata,
|
||||
{
|
||||
tagHex: body[i].data.idHex,
|
||||
reader: reader,
|
||||
tag: tag,
|
||||
timeStamp: body[i].timestamp,
|
||||
antenna: body[i].data.antenna,
|
||||
tagStrength: body[i].data.peakRssi,
|
||||
},
|
||||
];
|
||||
}
|
||||
}
|
||||
for (let i = 0; i < body.length; i++) {
|
||||
const tag = Buffer.from(body[i].data.idHex, "hex").toString("utf-8");
|
||||
// console.log(
|
||||
// "Raw value:",
|
||||
// body[i].data.peakRssi,
|
||||
// "Parsed:",
|
||||
// parseInt(body[i].data.peakRssi)
|
||||
// );
|
||||
if (
|
||||
tag.includes("ALPLA") &&
|
||||
parseInt(body[i].data.peakRssi) >= -80 // anything strong than this go ahead and read it
|
||||
) {
|
||||
tagdata = [
|
||||
...tagdata,
|
||||
{
|
||||
tagHex: body[i].data.idHex,
|
||||
reader: reader,
|
||||
tag: tag,
|
||||
timeStamp: body[i].timestamp,
|
||||
antenna: body[i].data.antenna,
|
||||
tagStrength: body[i].data.peakRssi,
|
||||
},
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
if (tagdata.length === 0) {
|
||||
// noRead(reader);
|
||||
// badRead(reader);
|
||||
return c.json(
|
||||
{ success: false, message: `There were no tags scanned.` },
|
||||
200
|
||||
);
|
||||
} else {
|
||||
tagData(tagdata);
|
||||
goodRead(reader);
|
||||
clearNoReadTimer();
|
||||
if (tagdata.length === 0) {
|
||||
// noRead(reader);
|
||||
// badRead(reader);
|
||||
return c.json(
|
||||
{ success: false, message: `There were no tags scanned.` },
|
||||
200,
|
||||
);
|
||||
} else {
|
||||
tagData(tagdata);
|
||||
goodRead(reader);
|
||||
clearNoReadTimer();
|
||||
|
||||
return c.json(
|
||||
{ success: true, message: `New info from ${reader}` },
|
||||
200
|
||||
);
|
||||
}
|
||||
}
|
||||
return c.json({ success: true, message: `New info from ${reader}` }, 200);
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
export default app;
|
||||
|
||||
@@ -3,6 +3,7 @@ import React, { useState } from "react";
|
||||
import {
|
||||
Button,
|
||||
FlatList,
|
||||
NativeModules,
|
||||
Pressable,
|
||||
StyleSheet,
|
||||
Text,
|
||||
@@ -10,7 +11,10 @@ import {
|
||||
View,
|
||||
} from "react-native";
|
||||
|
||||
const { KeyenceModule } = NativeModules;
|
||||
|
||||
export default function App() {
|
||||
KeyenceModule.hello().then(console.log).catch(console.error);
|
||||
const [buffer, setBuffer] = useState("");
|
||||
const [items, setItems] = useState<string[]>([]);
|
||||
const [status, setStatus] = useState("");
|
||||
@@ -94,7 +98,7 @@ export default function App() {
|
||||
setItems([]);
|
||||
}}
|
||||
/>
|
||||
<Text style={styles.title}>Scan Barcodes</Text>
|
||||
<Text style={styles.title}>Scan Barcode</Text>
|
||||
|
||||
{/* The working input you already have */}
|
||||
<TextInput
|
||||
|
||||
Reference in New Issue
Block a user