Compare commits

...

7 Commits

7 changed files with 139 additions and 112 deletions

View File

@@ -8,7 +8,7 @@
{ "type": "refactor", "section": "🛠️ Code Refactor" }, { "type": "refactor", "section": "🛠️ Code Refactor" },
{ "type": "perf", "hidden": false, "section": "🚀 Performance" }, { "type": "perf", "hidden": false, "section": "🚀 Performance" },
{ "type": "test", "section": "📝 Testing Code" }, { "type": "test", "section": "📝 Testing Code" },
{ "type": "ci", "hidden": false, "section": "📈 Project changes" }, { "type": "ci", "hidden": true, "section": "📈 Project changes" },
{ "type": "build", "hidden": true, "section": "📈 Project Builds" } { "type": "build", "hidden": true, "section": "📈 Project Builds" }
], ],
"commitUrlFormat": "https://git.tuffraid.net/cowch/lstV2/commits/{{hash}}", "commitUrlFormat": "https://git.tuffraid.net/cowch/lstV2/commits/{{hash}}",

View File

@@ -35,7 +35,7 @@
} }
}, },
"admConfig": { "admConfig": {
"build": 148, "build": 152,
"oldBuild": "backend-0.1.3.zip" "oldBuild": "backend-0.1.3.zip"
}, },
"devDependencies": { "devDependencies": {

View File

@@ -103,7 +103,7 @@ const updateBuildNumber = (appLock: string) => {
// Auto-commit changes // Auto-commit changes
execSync("git add package.json"); execSync("git add package.json");
execSync( execSync(
`git commit -m "chore(release): bump build number to ${pkgJson.admConfig.build}"` `git commit -m "ci(release): bump build number to ${pkgJson.admConfig.build}"`
); );
} else { } else {
createLog( createLog(

View File

@@ -1,3 +1,6 @@
import { db } from "../../../../database/dbclient.js";
import { settings } from "../../../../database/schema/settings.js";
import { tryCatch } from "../../../globalUtils/tryCatch.js";
import type { User } from "../../../types/users.js"; import type { User } from "../../../types/users.js";
import { alplaStockInv } from "./cycleCount/alplaStockInventory.js"; import { alplaStockInv } from "./cycleCount/alplaStockInventory.js";
import { emptyCount } from "./cycleCount/emptyCycleCount.js"; import { emptyCount } from "./cycleCount/emptyCycleCount.js";

View File

@@ -6,7 +6,6 @@ import { query } from "../../sqlServer/prodSqlServer.js";
import { labelData } from "../../sqlServer/querys/materialHelpers/labelInfo.js"; import { labelData } from "../../sqlServer/querys/materialHelpers/labelInfo.js";
export const postLabelData = async (data: any) => { export const postLabelData = async (data: any) => {
console.log(data);
let newData = data; let newData = data;
if (Array.isArray(data)) { if (Array.isArray(data)) {
newData = { newData = {

View File

@@ -53,7 +53,10 @@ app.openapi(
.string() .string()
.optional() .optional()
.openapi({ example: "Internal Server error" }), .openapi({ example: "Internal Server error" }),
data: z.array(z.object({})).optional().openapi({ example: [] }), data: z
.array(z.object({}))
.optional()
.openapi({ example: [] }),
}), }),
}, },
}, },
@@ -81,8 +84,11 @@ app.openapi(
// make sure we have a vaid user being accessed thats really logged in // make sure we have a vaid user being accessed thats really logged in
try { try {
const data = await c.req.json(); const data = await c.req.json();
apiHit(c, { endpoint: "api/ocme/postRunningNumber", lastBody: data }); apiHit(c, {
const postPallet = await postLabelData(data); endpoint: "api/ocme/postRunningNumber",
lastBody: data,
});
const postPallet: any = await postLabelData(data);
return c.json( return c.json(
{ {
success: postPallet.success, success: postPallet.success,

View File

@@ -9,6 +9,7 @@ import { db } from "../../../database/dbclient.js";
import { settings } from "../../../database/schema/settings.js"; import { settings } from "../../../database/schema/settings.js";
import { eq } from "drizzle-orm"; import { eq } from "drizzle-orm";
import { postLabelData } from "../ocme/controller/postRunningNr.js"; import { postLabelData } from "../ocme/controller/postRunningNr.js";
import { tryCatch } from "../../globalUtils/tryCatch.js";
let tcpServer: net.Server; let tcpServer: net.Server;
let tcpSockets: Set<net.Socket> = new Set(); let tcpSockets: Set<net.Socket> = new Set();
@@ -27,8 +28,23 @@ export const startTCPServer = () => {
if (isServerRunning) if (isServerRunning)
return { success: false, message: "Server is already running" }; return { success: false, message: "Server is already running" };
tcpServer = net.createServer((socket) => { tcpServer = net.createServer(async (socket) => {
createLog("info", "tcp", "tcp", "Client connected"); createLog("debug", "tcp", "tcp", "Client connected");
const { data: setting, error: settingError } = await tryCatch(
db.select().from(settings)
);
if (settingError) {
return {
success: false,
message: "Error getting settings",
data: [],
};
}
const settingCheck = setting.filter(
(newData) => newData.name === "ocmeService"
);
tcpSockets.add(socket); tcpSockets.add(socket);
socket.on("data", (data: Buffer) => { socket.on("data", (data: Buffer) => {
@@ -50,11 +66,14 @@ export const startTCPServer = () => {
} }
// from the wrapper send the data // from the wrapper send the data
const ocmeSetting: any = settingCheck;
if (ocmeSetting[0]?.value === "1") {
postLabelData(parseData); postLabelData(parseData);
}
}); });
socket.on("end", () => { socket.on("end", () => {
createLog("info", "tcp", "tcp", "Client disconnected"); createLog("debug", "tcp", "tcp", "Client disconnected");
tcpSockets.delete(socket); tcpSockets.delete(socket);
}); });