fix(scripts): changed the fake scanning to be more readable

This commit is contained in:
2026-02-16 19:15:32 -06:00
parent 32f26a1725
commit a9759795c4
3 changed files with 183 additions and 95 deletions

View File

@@ -93,7 +93,14 @@ scanner.connect(50000, "10.204.0.26", async () => {
}); });
scanner.on("data", async (data) => { scanner.on("data", async (data) => {
console.log("Response:", data.toString("ascii")); console.log(
"Response:",
data
.toString("ascii")
.replace(/\x00/g, "") // remove null bytes
.replace(/\x1B\[[0-9;?]*[A-Za-z]/g, "") // remove ANSI escape codes
.trim(),
);
}); });
scanner.on("close", () => { scanner.on("close", () => {

View File

@@ -5,46 +5,51 @@ import net from "net";
*/ */
const scannerID = "98@"; const scannerID = "98@";
const scannerCommand = "Alplaprodcmd112"; // to consume all the pallets const scannerCommand = "Alplaprodcmd112"; // to consume all the pallets
const lot = "AlplaPRODchg#00000016706"; // to consume to the lot make sure its showing in 2.0 to be able to consume to it const lot = "AlplaPRODchg#11601"; // to consume to the lot make sure its showing in 2.0 to be able to consume to it
const labels = [ const labels = [
"1000000000000000000000000000000005106656", "1000000000000000000000000000000004551860",
"1000000000000000000000000000000005106386", "1000000000000000000000000000000004551640",
"1000000000000000000000000000000005106446", "1000000000000000000000000000000004551840",
"1000000000000000000000000000000005106326", "1000000000000000000000000000000004551610",
"1000000000000000000000000000000005105726", "1000000000000000000000000000000004551720",
"1000000000000000000000000000000005106056", "1000000000000000000000000000000004551680",
"1000000000000000000000000000000005106256", "1000000000000000000000000000000004551740",
"1000000000000000000000000000000005105836", "1000000000000000000000000000000004551660",
"1000000000000000000000000000000005105986", "1000000000000000000000000000000004551570",
"1000000000000000000000000000000005105506", "1000000000000000000000000000000004551480",
"1000000000000000000000000000000005106136", "1000000000000000000000000000000004551510",
"1000000000000000000000000000000005105696", "1000000000000000000000000000000004551460",
"1000000000000000000000000000000005105426", "1000000000000000000000000000000004551600",
"1000000000000000000000000000000005105916", "1000000000000000000000000000000004551340",
"1000000000000000000000000000000005105216", "1000000000000000000000000000000004551580",
"1000000000000000000000000000000005105416", "1000000000000000000000000000000004551330",
"1000000000000000000000000000000005105196", "1000000000000000000000000000000004551290",
"1000000000000000000000000000000005105226", "1000000000000000000000000000000004551180",
"1000000000000000000000000000000005105816", "1000000000000000000000000000000004551260",
"1000000000000000000000000000000005110186", "1000000000000000000000000000000004551150",
"1000000000000000000000000000000005110256", "1000000000000000000000000000000004551390",
"1000000000000000000000000000000005109926", "1000000000000000000000000000000004551440",
"1000000000000000000000000000000005110096", "1000000000000000000000000000000004551360",
"1000000000000000000000000000000005110026", "1000000000000000000000000000000004551400",
"1000000000000000000000000000000005110036", "1000000000000000000000000000000004544780",
"1000000000000000000000000000000005109716", "1000000000000000000000000000000004551230",
"1000000000000000000000000000000005110006", "1000000000000000000000000000000004544770",
"1000000000000000000000000000000005109446", "1000000000000000000000000000000004551200",
"1000000000000000000000000000000005109606", "1000000000000000000000000000000004544850",
"1000000000000000000000000000000005109076", "1000000000000000000000000000000004548370",
"1000000000000000000000000000000004544840",
"1000000000000000000000000000000004548470",
"1000000000000000000000000000000004611380",
"1000000000000000000000000000000004611470",
"1000000000000000000000000000000004611440",
]; ];
const STX = "\x02"; const STX = "\x02";
const ETX = "\x03"; const ETX = "\x03";
const scanner = new net.Socket(); const scanner = new net.Socket();
scanner.connect(50000, "10.204.0.26", async () => { scanner.connect(50001, "10.80.0.26", async () => {
console.log("Connected to scanner"); console.log("Connected to scanner");
// change the scanner to the to 112 // change the scanner to the to 112
@@ -76,7 +81,14 @@ scanner.connect(50000, "10.204.0.26", async () => {
}); });
scanner.on("data", async (data) => { scanner.on("data", async (data) => {
console.log("Response:", data.toString("ascii")); console.log(
"Response:",
data
.toString("ascii")
.replace(/\x00/g, "") // remove null bytes
.replace(/\x1B\[[0-9;?]*[A-Za-z]/g, "") // remove ANSI escape codes
.trim(),
);
}); });
scanner.on("close", () => { scanner.on("close", () => {

View File

@@ -6,69 +6,131 @@ import net from "net";
const prodIP = "10.204.0.26"; const prodIP = "10.204.0.26";
const prodPort = 50000; const prodPort = 50000;
const scannerID = "98@"; const scannerID = "98@";
const scannerCommand = "AlplaPRODcmd00000042#000028547"; // top of the picksheet const scannerCommand = "AlplaPRODcmd00000042#000028643"; // top of the picksheet
const scannerCommand2 = ""; // bottom of the pick sheet const scannerCommand2 = ""; // bottom of the pick sheet
const labels = [ const labels = [
"1000000000000000000000000000000005566030", "1000000000000000000000000000000005572620",
"1000000000000000000000000000000005544896", "1000000000000000000000000000000005572630",
"1000000000000000000000000000000005544906", "1000000000000000000000000000000005572640",
"1000000000000000000000000000000005544916", "1000000000000000000000000000000005572650",
"1000000000000000000000000000000005544926", "1000000000000000000000000000000005572660",
"1000000000000000000000000000000005544936", "1000000000000000000000000000000005572670",
"1000000000000000000000000000000005544946", "1000000000000000000000000000000005572680",
"1000000000000000000000000000000005544956", "1000000000000000000000000000000005572690",
"1000000000000000000000000000000005544966", "1000000000000000000000000000000005572700",
"1000000000000000000000000000000005544976", "1000000000000000000000000000000005572710",
"1000000000000000000000000000000005544986", "1000000000000000000000000000000005572720",
"1000000000000000000000000000000005544996", "1000000000000000000000000000000005572730",
"1000000000000000000000000000000005545006", "1000000000000000000000000000000005572740",
"1000000000000000000000000000000005545016", "1000000000000000000000000000000005572750",
"1000000000000000000000000000000005545026", "1000000000000000000000000000000005572760",
"1000000000000000000000000000000005545036", "1000000000000000000000000000000005572770",
"1000000000000000000000000000000005545046", "1000000000000000000000000000000005572780",
"1000000000000000000000000000000005545056", "1000000000000000000000000000000005572790",
"1000000000000000000000000000000005545066", "1000000000000000000000000000000005572800",
"1000000000000000000000000000000005545076", "1000000000000000000000000000000005572810",
"1000000000000000000000000000000005545086", "1000000000000000000000000000000005572820",
"1000000000000000000000000000000005545096", "1000000000000000000000000000000005572830",
"1000000000000000000000000000000005545106", "1000000000000000000000000000000005572840",
"1000000000000000000000000000000005545116", "1000000000000000000000000000000005572850",
"1000000000000000000000000000000005545126", "1000000000000000000000000000000005572860",
"1000000000000000000000000000000005545136", "1000000000000000000000000000000005572870",
"1000000000000000000000000000000005545146", "1000000000000000000000000000000005572880",
"1000000000000000000000000000000005545156", "1000000000000000000000000000000005572890",
"1000000000000000000000000000000005545166", "1000000000000000000000000000000005572900",
"1000000000000000000000000000000005545176", "1000000000000000000000000000000005572910",
"1000000000000000000000000000000005545186", "1000000000000000000000000000000005573226",
"1000000000000000000000000000000005544580", "1000000000000000000000000000000005573236",
"1000000000000000000000000000000005544590", "1000000000000000000000000000000005573246",
"1000000000000000000000000000000005544600", "1000000000000000000000000000000005573256",
"1000000000000000000000000000000005544610", "1000000000000000000000000000000005573266",
"1000000000000000000000000000000005544640", "1000000000000000000000000000000005573276",
"1000000000000000000000000000000005544650", "1000000000000000000000000000000005573286",
"1000000000000000000000000000000005544660", "1000000000000000000000000000000005573296",
"1000000000000000000000000000000005544670", "1000000000000000000000000000000005573306",
"1000000000000000000000000000000005544680", "1000000000000000000000000000000005573316",
"1000000000000000000000000000000005544690", "1000000000000000000000000000000005573326",
"1000000000000000000000000000000005544700", "1000000000000000000000000000000005573336",
"1000000000000000000000000000000005544710", "1000000000000000000000000000000005573346",
"1000000000000000000000000000000005544720", "1000000000000000000000000000000005573356",
"1000000000000000000000000000000005544730", "1000000000000000000000000000000005573366",
"1000000000000000000000000000000005544740", "1000000000000000000000000000000005573376",
"1000000000000000000000000000000005544750", "1000000000000000000000000000000005573386",
"1000000000000000000000000000000005544760", "1000000000000000000000000000000005573396",
"1000000000000000000000000000000005544770", "1000000000000000000000000000000005573406",
"1000000000000000000000000000000005544780", "1000000000000000000000000000000005573416",
"1000000000000000000000000000000005544790", "1000000000000000000000000000000005573426",
"1000000000000000000000000000000005544800", "1000000000000000000000000000000005573436",
"1000000000000000000000000000000005544810", "1000000000000000000000000000000005573446",
"1000000000000000000000000000000005544820", "1000000000000000000000000000000005573456",
"1000000000000000000000000000000005544830", "1000000000000000000000000000000005573466",
"1000000000000000000000000000000005544840", "1000000000000000000000000000000005573476",
"1000000000000000000000000000000005544850", "1000000000000000000000000000000005573486",
"1000000000000000000000000000000005544860", "1000000000000000000000000000000005573496",
"1000000000000000000000000000000005544870", "1000000000000000000000000000000005573506",
"1000000000000000000000000000000005573516",
"1000000000000000000000000000000005581616",
"1000000000000000000000000000000005581626",
"1000000000000000000000000000000005581636",
"1000000000000000000000000000000005581646",
"1000000000000000000000000000000005581656",
"1000000000000000000000000000000005581666",
"1000000000000000000000000000000005581676",
"1000000000000000000000000000000005581686",
"1000000000000000000000000000000005581696",
"1000000000000000000000000000000005581706",
"1000000000000000000000000000000005581716",
"1000000000000000000000000000000005581726",
"1000000000000000000000000000000005581736",
"1000000000000000000000000000000005581746",
"1000000000000000000000000000000005581756",
"1000000000000000000000000000000005581766",
"1000000000000000000000000000000005581776",
"1000000000000000000000000000000005581786",
"1000000000000000000000000000000005581796",
"1000000000000000000000000000000005581806",
"1000000000000000000000000000000005581816",
"1000000000000000000000000000000005581826",
"1000000000000000000000000000000005581836",
"1000000000000000000000000000000005581846",
"1000000000000000000000000000000005581856",
"1000000000000000000000000000000005582760",
"1000000000000000000000000000000005581866",
"1000000000000000000000000000000005581876",
"1000000000000000000000000000000005581886",
"1000000000000000000000000000000005581896",
"1000000000000000000000000000000005581906",
"1000000000000000000000000000000005581310",
"1000000000000000000000000000000005581320",
"1000000000000000000000000000000005581330",
"1000000000000000000000000000000005581340",
"1000000000000000000000000000000005581350",
"1000000000000000000000000000000005581360",
"1000000000000000000000000000000005581370",
"1000000000000000000000000000000005581380",
"1000000000000000000000000000000005581390",
"1000000000000000000000000000000005581400",
"1000000000000000000000000000000005581410",
"1000000000000000000000000000000005581420",
"1000000000000000000000000000000005581430",
"1000000000000000000000000000000005581440",
"1000000000000000000000000000000005581450",
"1000000000000000000000000000000005581460",
"1000000000000000000000000000000005581470",
"1000000000000000000000000000000005581480",
"1000000000000000000000000000000005581490",
"1000000000000000000000000000000005581500",
"1000000000000000000000000000000005581510",
"1000000000000000000000000000000005581520",
"1000000000000000000000000000000005581530",
"1000000000000000000000000000000005581540",
"1000000000000000000000000000000005581550",
"1000000000000000000000000000000005581560",
"1000000000000000000000000000000005581570",
"1000000000000000000000000000000005581580",
"1000000000000000000000000000000005581590",
"1000000000000000000000000000000005581600",
]; ];
const STX = "\x02"; const STX = "\x02";
const ETX = "\x03"; const ETX = "\x03";
@@ -106,7 +168,14 @@ scanner.connect(prodPort, prodIP, async () => {
}); });
scanner.on("data", async (data) => { scanner.on("data", async (data) => {
console.log("Response:", data.toString("ascii")); console.log(
"Response:",
data
.toString("ascii")
.replace(/\x00/g, "") // remove null bytes
.replace(/\x1B\[[0-9;?]*[A-Za-z]/g, "") // remove ANSI escape codes
.trim(),
);
}); });
scanner.on("close", () => { scanner.on("close", () => {