'换火20min,缩放校正,换火时间预置'

This commit is contained in:
gtz 2023-09-11 16:04:44 +08:00
parent b9f191459f
commit 448082e74f
4 changed files with 14 additions and 9 deletions

View File

@ -9,10 +9,10 @@ import cls from './leftbox.module.less';
const Chart2 = () => { const Chart2 = () => {
const ctx = useContext(SocketContext); const ctx = useContext(SocketContext);
let [time, setTime] = useState([0, 0]); let [time, setTime] = useState([19, 28]);
useEffect(() => { useEffect(() => {
const restTime = ctx.runState?.lastFireChangeTime; const restTime = ctx.runState?.lastFireChangeTime || '19分28秒';
if (restTime == null) return; if (restTime == null) return;
console.log('restTime is:', restTime); console.log('restTime is:', restTime);
let timer = null; let timer = null;
@ -77,7 +77,7 @@ const Chart2 = () => {
{ {
icon: icon1, icon: icon1,
label: '换火时间', label: '换火时间',
value: ctx.runState?.fireChangeTime || '00:00', value: ctx.runState?.fireChangeTime || '19:56',
}, },
{ {
icon: icon3, icon: icon3,
@ -87,7 +87,7 @@ const Chart2 = () => {
{ {
icon: icon2, icon: icon2,
label: '当前火向', label: '当前火向',
value: ctx.runState?.fireDirection || '火', value: ctx.runState?.fireDirection || '火',
}, },
]; ];

View File

@ -11,7 +11,7 @@ import { SocketContextProvider } from '../store/socket-data-provider';
import MainContainer from '../components/yx-dark/MainContainer'; import MainContainer from '../components/yx-dark/MainContainer';
export default function index() { export default function index() {
const [value, setValue] = useState(50); const [value, setValue] = useState(100);
const v = (value / 100).toFixed(2); const v = (value / 100).toFixed(2);
const styles = { const styles = {

View File

@ -4,6 +4,7 @@ import utils from './utils';
const wss = new WebSocketServer({ port: 9800 }); const wss = new WebSocketServer({ port: 9800 });
const frequency = 10; // seconds const frequency = 10; // seconds
const frequency1 = 1200; // seconds
wss.on('connection', function (ws, req) { wss.on('connection', function (ws, req) {
// console.log("ws", ws); // console.log("ws", ws);
console.log( console.log(
@ -26,7 +27,6 @@ wss.on('connection', function (ws, req) {
const timer = setInterval(() => { const timer = setInterval(() => {
sendMsg(ws, 'kiln-info'); // 窑炉信息 sendMsg(ws, 'kiln-info'); // 窑炉信息
sendMsg(ws, 'run-state'); // 运行状态
sendMsg(ws, 'energy-cost'); // 运行状态 sendMsg(ws, 'energy-cost'); // 运行状态
sendMsg(ws, 'realtime'); sendMsg(ws, 'realtime');
sendMsg(ws, 'his-trend'); sendMsg(ws, 'his-trend');
@ -35,9 +35,14 @@ wss.on('connection', function (ws, req) {
// sendMsg(ws, 'kiln-bottom'); // sendMsg(ws, 'kiln-bottom');
}, frequency * 1000); }, frequency * 1000);
const timer1 = setInterval(() => {
sendMsg(ws, 'run-state'); // 运行状态
}, frequency1 * 1000);
ws.on('close', function () { ws.on('close', function () {
console.log('停止监听'); console.log('停止监听');
clearInterval(timer); clearInterval(timer);
clearInterval(timer1);
}); });
}); });

View File

@ -17,9 +17,9 @@
"gasii": "...m³" "gasii": "...m³"
}, },
"runState": { "runState": {
"lastFireChangeTime": "3分28秒", "lastFireChangeTime": "19分28秒",
"fireChangeTime": "20:00", "fireChangeTime": "19:56",
"fireDirection": "火" "fireDirection": "火"
}, },
"fan": [ "fan": [
["8#压延冷却风机", "4373Hz", "正常"], ["8#压延冷却风机", "4373Hz", "正常"],