Update
This commit is contained in:
parent
086c440386
commit
a363883329
|
|
@ -625,7 +625,7 @@ export class WebSocketIo {
|
|||
// 👉 Bước 1: clear line trước khi connect
|
||||
if (line.lineClear && line.lineClear > 0)
|
||||
await this.clearLineBeforeConnect(station.id, line.lineClear)
|
||||
|
||||
await sleep(500)
|
||||
this.lineMap.set(line.id, lineConn)
|
||||
await lineConn.connect()
|
||||
lineConn.writeCommand('\r\n\r\n')
|
||||
|
|
|
|||
|
|
@ -64,6 +64,28 @@ export const DrawerAPCControl: React.FC<DrawerProps> = ({
|
|||
>([]);
|
||||
const [isSubmit, setIsSubmit] = useState(true);
|
||||
|
||||
useEffect(() => {
|
||||
setListOutletSelected([]);
|
||||
setListOutlet(
|
||||
Array.from({ length: 16 })
|
||||
.map((_, index) => ({
|
||||
number: index / 8 < 1 ? index + 1 : index - 7, // Outlet numbers 1-8 for APC 1, 1-8 for APC 2
|
||||
name: `Outlet ${(index % 8) + 1}`,
|
||||
status: "OFF",
|
||||
apc: index / 8 < 1 ? 1 : 2, // Assuming two APCs, alternating outlets
|
||||
}))
|
||||
.map((el) => {
|
||||
const line = findLineByOutlet(el);
|
||||
if (!line) return el;
|
||||
return {
|
||||
...el,
|
||||
name: "Line " + line.lineNumber || el.name,
|
||||
};
|
||||
})
|
||||
);
|
||||
setIsSubmit(true);
|
||||
}, [stationId]);
|
||||
|
||||
const detectOutlet = (
|
||||
apc: APCProps,
|
||||
lines: string[],
|
||||
|
|
|
|||
Loading…
Reference in New Issue