fix(scripts): changed the fake scanning to be more readable
This commit is contained in:
@@ -5,46 +5,51 @@ import net from "net";
|
||||
*/
|
||||
const scannerID = "98@";
|
||||
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 = [
|
||||
"1000000000000000000000000000000005106656",
|
||||
"1000000000000000000000000000000005106386",
|
||||
"1000000000000000000000000000000005106446",
|
||||
"1000000000000000000000000000000005106326",
|
||||
"1000000000000000000000000000000005105726",
|
||||
"1000000000000000000000000000000005106056",
|
||||
"1000000000000000000000000000000005106256",
|
||||
"1000000000000000000000000000000005105836",
|
||||
"1000000000000000000000000000000005105986",
|
||||
"1000000000000000000000000000000005105506",
|
||||
"1000000000000000000000000000000005106136",
|
||||
"1000000000000000000000000000000005105696",
|
||||
"1000000000000000000000000000000005105426",
|
||||
"1000000000000000000000000000000005105916",
|
||||
"1000000000000000000000000000000005105216",
|
||||
"1000000000000000000000000000000005105416",
|
||||
"1000000000000000000000000000000005105196",
|
||||
"1000000000000000000000000000000005105226",
|
||||
"1000000000000000000000000000000005105816",
|
||||
"1000000000000000000000000000000005110186",
|
||||
"1000000000000000000000000000000005110256",
|
||||
"1000000000000000000000000000000005109926",
|
||||
"1000000000000000000000000000000005110096",
|
||||
"1000000000000000000000000000000005110026",
|
||||
"1000000000000000000000000000000005110036",
|
||||
"1000000000000000000000000000000005109716",
|
||||
"1000000000000000000000000000000005110006",
|
||||
"1000000000000000000000000000000005109446",
|
||||
"1000000000000000000000000000000005109606",
|
||||
"1000000000000000000000000000000005109076",
|
||||
"1000000000000000000000000000000004551860",
|
||||
"1000000000000000000000000000000004551640",
|
||||
"1000000000000000000000000000000004551840",
|
||||
"1000000000000000000000000000000004551610",
|
||||
"1000000000000000000000000000000004551720",
|
||||
"1000000000000000000000000000000004551680",
|
||||
"1000000000000000000000000000000004551740",
|
||||
"1000000000000000000000000000000004551660",
|
||||
"1000000000000000000000000000000004551570",
|
||||
"1000000000000000000000000000000004551480",
|
||||
"1000000000000000000000000000000004551510",
|
||||
"1000000000000000000000000000000004551460",
|
||||
"1000000000000000000000000000000004551600",
|
||||
"1000000000000000000000000000000004551340",
|
||||
"1000000000000000000000000000000004551580",
|
||||
"1000000000000000000000000000000004551330",
|
||||
"1000000000000000000000000000000004551290",
|
||||
"1000000000000000000000000000000004551180",
|
||||
"1000000000000000000000000000000004551260",
|
||||
"1000000000000000000000000000000004551150",
|
||||
"1000000000000000000000000000000004551390",
|
||||
"1000000000000000000000000000000004551440",
|
||||
"1000000000000000000000000000000004551360",
|
||||
"1000000000000000000000000000000004551400",
|
||||
"1000000000000000000000000000000004544780",
|
||||
"1000000000000000000000000000000004551230",
|
||||
"1000000000000000000000000000000004544770",
|
||||
"1000000000000000000000000000000004551200",
|
||||
"1000000000000000000000000000000004544850",
|
||||
"1000000000000000000000000000000004548370",
|
||||
"1000000000000000000000000000000004544840",
|
||||
"1000000000000000000000000000000004548470",
|
||||
"1000000000000000000000000000000004611380",
|
||||
"1000000000000000000000000000000004611470",
|
||||
"1000000000000000000000000000000004611440",
|
||||
];
|
||||
const STX = "\x02";
|
||||
const ETX = "\x03";
|
||||
|
||||
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");
|
||||
|
||||
// change the scanner to the to 112
|
||||
@@ -76,7 +81,14 @@ scanner.connect(50000, "10.204.0.26", async () => {
|
||||
});
|
||||
|
||||
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", () => {
|
||||
|
||||
Reference in New Issue
Block a user