diff --git a/BACKEND/app/services/line_connection.ts b/BACKEND/app/services/line_connection.ts index 7347ab6..27dd03d 100644 --- a/BACKEND/app/services/line_connection.ts +++ b/BACKEND/app/services/line_connection.ts @@ -237,6 +237,10 @@ export default class LineConnection { return } + console.log( + `Write command "${cmd}" to line ${this.config.lineNumber} of ${this.config.stationName}` + ) + this.client.write(cmd) if (userName) { // appendLog( @@ -286,6 +290,10 @@ export default class LineConnection { return } + console.log( + `Run scenario "${script?.title}" to line ${this.config.lineNumber} of ${this.config.stationName}` + ) + this.isRunningScript = true const now = Date.now() this.outputScenario += `\n\n---start-scenarios---${now}---${userName}---${script?.title}---\n---scenario---${script?.title}---${now}---\n` diff --git a/BACKEND/providers/socket_io_provider.ts b/BACKEND/providers/socket_io_provider.ts index 77f09fe..0ef6530 100644 --- a/BACKEND/providers/socket_io_provider.ts +++ b/BACKEND/providers/socket_io_provider.ts @@ -537,8 +537,8 @@ export class WebSocketIo { console.log(`Socket server is running on port ${SOCKET_IO_PORT}`) }) - // 🔹 Tự động lưu dữ liệu định kỳ mỗi 60 giây - setInterval(async () => await this.saveState(), 60000) + // 🔹 Tự động lưu dữ liệu định kỳ mỗi 10 giây + setInterval(async () => await this.saveState(), 10000) return io } diff --git a/FRONTEND/src/components/DrawerControl.tsx b/FRONTEND/src/components/DrawerControl.tsx index d6c87a6..5392d98 100644 --- a/FRONTEND/src/components/DrawerControl.tsx +++ b/FRONTEND/src/components/DrawerControl.tsx @@ -125,7 +125,7 @@ export const DrawerAPCControl: React.FC = ({ } }); - if (result.length > 0) apc.outlets = result; + if (result.length > 0 && apc?.status === "CONNECTED") apc.outlets = result; else { Array.from({ length: 8 }).forEach((_, index) => { result.push({ @@ -245,12 +245,18 @@ export const DrawerAPCControl: React.FC = ({ APC 1 - {RenderAPCStatus(dataStation?.apc1)} + {dataStation?.apc_1_ip ? ( + RenderAPCStatus(dataStation?.apc1) + ) : ( + + APC not available + + )} {dataStation?.apc1?.status !== "CONNECTED" ? (