From 1345be0701f4dee56385aabbbbd31cc6516c6c7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=B7=E6=88=90=E4=BC=9F?= Date: Thu, 5 Dec 2024 13:33:59 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BF=83=E8=B7=B3?= =?UTF-8?q?=E6=8A=A5=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/datacollect/README.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/docs/datacollect/README.md b/docs/datacollect/README.md index 4be4ba9a..591cb3b0 100644 --- a/docs/datacollect/README.md +++ b/docs/datacollect/README.md @@ -349,7 +349,15 @@ PS: 同一节点只允许建立一条连接。 "linkId": "123", "online": false } - ] + ], + //设备监控信息 + "devices": [ + { + //设备ID + "deviceId": "1123451235464", + //设备状态 + "online": true + }] } ``` From 68c15b469ab210165457804af80581b83308be23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=B7=E6=88=90=E4=BC=9F?= Date: Thu, 5 Dec 2024 14:01:54 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E5=BF=83=E8=B7=B3?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E9=A3=8E=E6=9C=BA=E9=80=9A=E8=AE=AF=E7=8A=B6?= =?UTF-8?q?=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../node/command/HeartbeatCommand.java | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/das/src/main/java/com/das/modules/node/command/HeartbeatCommand.java b/das/src/main/java/com/das/modules/node/command/HeartbeatCommand.java index cbafa444..5c13d899 100644 --- a/das/src/main/java/com/das/modules/node/command/HeartbeatCommand.java +++ b/das/src/main/java/com/das/modules/node/command/HeartbeatCommand.java @@ -1,7 +1,10 @@ package com.das.modules.node.command; +import com.das.common.constant.EquipmentTypeIds; import com.das.common.utils.AdminRedisTemplate; import com.das.common.utils.StringUtils; +import com.das.modules.cache.domain.DeviceInfoCache; +import com.das.modules.cache.service.CacheService; import com.das.modules.node.constant.NodeConstant; import com.das.modules.node.domain.bo.TerminalMessage; import com.fasterxml.jackson.databind.JsonNode; @@ -17,6 +20,9 @@ public class HeartbeatCommand implements BaseCommand{ @Autowired AdminRedisTemplate adminRedisTemplate; + + @Autowired + CacheService cacheService; @Override public void doCommand(TerminalMessage data) { JsonNode dataInfo = data.getData(); @@ -39,6 +45,27 @@ public class HeartbeatCommand implements BaseCommand{ adminRedisTemplate.expire(key, 300L); } } + JsonNode devices = data.getData().get("devices"); + if (devices != null && devices.isArray()) { + for (JsonNode device : devices) { + Long deviceId = device.get("deviceId").asLong(); + Boolean online = device.get("online").asBoolean(); + DeviceInfoCache deviceInfoCacheById = cacheService.getEquipmentCache().getDeviceInfoCacheById(deviceId); + if (deviceInfoCacheById == null || !deviceInfoCacheById.getObjectType().equals(EquipmentTypeIds.EQUIPMENT_TYPE_STATION_WTG)) { + continue; + } + //判断是不是风机 + String keyPLCDeviceStatus = String.format("RT:%d:iturbineoperationmode", deviceId); + String keyDeviceStatus = String.format("RT:%d:commfaultstate"); + Integer plcDeviceStatus = adminRedisTemplate.get(keyPLCDeviceStatus); + if (plcDeviceStatus == null){ + adminRedisTemplate.set(keyDeviceStatus, online ? 1 : 0); + } + else{ + adminRedisTemplate.set(keyDeviceStatus, online && plcDeviceStatus == 1 ? 1 : 0); + } + } + } } } } From 5261921899a9026178323eeaa42eb377e6c46d52 Mon Sep 17 00:00:00 2001 From: zhouhuang Date: Thu, 5 Dec 2024 14:03:07 +0800 Subject: [PATCH 3/5] add deviceId state --- das-dn/cmg/main.cpp | 1 + das-dn/cmg/ry.cpp | 32 ++++++++++++++++--- das-dn/hostadsbf/hostadsbf.cpp | 16 +++++----- das-dn/hostmodbustcpbf/host_modbus_tcp_bf.cpp | 2 +- 4 files changed, 37 insertions(+), 14 deletions(-) diff --git a/das-dn/cmg/main.cpp b/das-dn/cmg/main.cpp index 8c02b89c..89ab9c54 100644 --- a/das-dn/cmg/main.cpp +++ b/das-dn/cmg/main.cpp @@ -247,6 +247,7 @@ int main(int argc, char** argv) i++; uid++; #endif snprintf(config.processes[i].name, sizeof(config.processes[i].name), "%s", "本地调试"); + config.processes[i].irn = 0; config.processes[i].state = TRUE; config.processes[i].time_accept = FALSE; config.processes[i].proto = PROTOCOL_LOCAL_DEBUG; diff --git a/das-dn/cmg/ry.cpp b/das-dn/cmg/ry.cpp index a7992816..fbcc194f 100644 --- a/das-dn/cmg/ry.cpp +++ b/das-dn/cmg/ry.cpp @@ -2249,6 +2249,7 @@ bool CRYDevice::dealConfigFile(const Json::Value jsonRoot) } } + config_config.units[uid].irn = strtoll(id.c_str(), NULL, 10); config_config.units[uid].value = SPI_ON; config_config.units[uid].softdog = UNIT_WATCHDOG_TIME; config_config.units[uid].state = TRUE; @@ -2756,11 +2757,13 @@ void CRYDevice::heart_beat(int status) payload["status"] = status; if (status == 1) { - Json::Value jsonItem; + Json::Value jsonLink; + Json::Value jsonDevice; Json::Value jsonValue; - for (int i = 0; i < PROCESSES_NUM - 1; i++) { + for (int i = 0; i < PROCESSES_NUM; i++) { if (config.processes[i].state == TRUE) { char linkId[32]; + if (config.processes[i].irn == 0) continue; #ifdef NOPOLL_64BIT_PLATFORM snprintf(linkId, sizeof(linkId), "%ld", config.processes[i].irn); #else @@ -2768,11 +2771,30 @@ void CRYDevice::heart_beat(int status) #endif jsonValue["linkId"] = linkId; jsonValue["online"] = (config.processes[i].softdog >= PROCESS_WATCHDOG_TIME) ? false : true; - jsonItem.append(jsonValue); + jsonLink.append(jsonValue); } } - if (jsonItem.size() > 0) { - payload["links"] = jsonItem; + if (jsonLink.size() > 0) { + vLog(LOG_DEBUG, "link is: %d\n", jsonLink.size()); + payload["links"] = jsonLink; + } + for (int i = 0; i < UNIT_NUM; i++) { + if (config.units[i].state == TRUE) { + char deviceId[32]; + if (config.units[i].irn == 0) continue; +#ifdef NOPOLL_64BIT_PLATFORM + snprintf(deviceId, sizeof(deviceId), "%ld", config.units[i].irn); +#else + snprintf(deviceId, sizeof(deviceId), "%lld", config.units[i].irn); +#endif + jsonValue["deviceId"] = deviceId; + jsonValue["online"] = (config.units[i].softdog >= PROCESS_WATCHDOG_TIME) ? false : true; + jsonDevice.append(jsonValue); + } + } + if (jsonLink.size() > 0) { + vLog(LOG_DEBUG, "device is: %d\n", jsonDevice.size()); + payload["devices"] = jsonDevice; } } diff --git a/das-dn/hostadsbf/hostadsbf.cpp b/das-dn/hostadsbf/hostadsbf.cpp index af96387e..c33bc213 100644 --- a/das-dn/hostadsbf/hostadsbf.cpp +++ b/das-dn/hostadsbf/hostadsbf.cpp @@ -701,7 +701,7 @@ BOOLEAN CHostADSBFProcess::calc(void) ymcount = GetUnitYMCount(uid); yxcount = GetUnitYXCount(uid); - vLog(LOG_DEBUG, "unit %d, yc count is: %d, and yx count is: %d\n", uid, yccount, yxcount); + //vLog(LOG_DEBUG, "unit %d, yc count is: %d, and yx count is: %d\n", uid, yccount, yxcount); BYTE params[MAX_UNIT_POINT_PARAM_SIZE]; BYTE* pData = params; @@ -720,7 +720,7 @@ BOOLEAN CHostADSBFProcess::calc(void) if (m_adsDatas[0].adsDataBlocks.find(registerAddr) == m_adsDatas[0].adsDataBlocks.end()) { m_adsDatas[0].adsDataBlocks.insert(register2typemap::value_type(registerAddr, REGISTER_DATA_TYPE_YC)); } else { - vLog(LOG_WARN, "遥测测点配置了相同的寄存器地址\n"); + //vLog(LOG_WARN, "遥测测点配置了相同的寄存器地址\n"); } } else @@ -730,7 +730,7 @@ BOOLEAN CHostADSBFProcess::calc(void) if (m_adsDatas[1].adsDataBlocks.find(registerAddr) == m_adsDatas[1].adsDataBlocks.end()) { m_adsDatas[1].adsDataBlocks.insert(register2typemap::value_type(registerAddr, REGISTER_DATA_TYPE_YC)); } else { - vLog(LOG_WARN, "遥测测点配置了相同的寄存器地址\n"); + //vLog(LOG_WARN, "遥测测点配置了相同的寄存器地址\n"); } } } @@ -747,7 +747,7 @@ BOOLEAN CHostADSBFProcess::calc(void) if (m_adsDatas[0].adsDataBlocks.find(registerAddr) == m_adsDatas[0].adsDataBlocks.end()) { m_adsDatas[0].adsDataBlocks.insert(register2typemap::value_type(registerAddr, REGISTER_DATA_TYPE_YM)); } else { - vLog(LOG_WARN, "遥脉测点配置了相同的寄存器地址\n"); + //vLog(LOG_WARN, "遥脉测点配置了相同的寄存器地址\n"); } } else @@ -757,7 +757,7 @@ BOOLEAN CHostADSBFProcess::calc(void) if (m_adsDatas[1].adsDataBlocks.find(registerAddr) == m_adsDatas[1].adsDataBlocks.end()) { m_adsDatas[1].adsDataBlocks.insert(register2typemap::value_type(registerAddr, REGISTER_DATA_TYPE_YM)); } else { - vLog(LOG_WARN, "遥脉测点配置了相同的寄存器地址\n"); + //vLog(LOG_WARN, "遥脉测点配置了相同的寄存器地址\n"); } } } @@ -827,8 +827,8 @@ BOOLEAN CHostADSBFProcess::OnPreCreate(int id) try { SetLocalAddress(AmsNetId(m_localNetId)); m_turbine = new AdsDevice{m_remoteIp, AmsNetId(m_remoteNetId), m_remotePort}; + //readDeviceState(*m_turbine); } catch (const AdsException& ex) { - vLog(LOG_ERROR, "Error: %d\n", ex.errorCode); vLog(LOG_ERROR, "AdsException message: %s\n", ex.what()); vLog(LOG_DEBUG, "try to add a route to remote device.\n"); AddRemoteRoute(m_remoteIp, m_localNetId, m_localIp, std::string("isoftstone"), std::string("guest"), std::string("1")); @@ -917,8 +917,8 @@ BOOLEAN CHostADSBFProcess::OnTimer(void) } readRealData(); } catch (const AdsException& ex) { - vLog(LOG_ERROR, "Error: %d\n", ex.errorCode); - vLog(LOG_ERROR, "AdsException message: %s\n", ex.what()); + //vLog(LOG_ERROR, "Error: %d\n", ex.errorCode); + vLog(LOG_ERROR, "%s AdsException message: %s\n", GetCurProcessName(), ex.what()); } catch (const std::runtime_error& ex) { vLog(LOG_ERROR, "%s\n", ex.what()); } diff --git a/das-dn/hostmodbustcpbf/host_modbus_tcp_bf.cpp b/das-dn/hostmodbustcpbf/host_modbus_tcp_bf.cpp index 0e5f3300..659a24cf 100644 --- a/das-dn/hostmodbustcpbf/host_modbus_tcp_bf.cpp +++ b/das-dn/hostmodbustcpbf/host_modbus_tcp_bf.cpp @@ -941,7 +941,7 @@ void CHostModbusTcpBFProcess::calc2(void) ymcount = GetUnitYMCount(uid); yxcount = GetUnitYXCount(uid); - vLog(LOG_DEBUG, "unit %d, yc count is: %d, and yx count is: %d\n", uid, yccount, yxcount); + //vLog(LOG_DEBUG, "unit %d, yc count is: %d, and yx count is: %d\n", uid, yccount, yxcount); STRUCT_PARAM *ycparam = NULL, *ymparam = NULL, *yxparam = NULL; if (yccount) ycparam = new STRUCT_PARAM[yccount]; From e0542740f98686e0ce13c216c967874d605c5afe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=B7=E6=88=90=E4=BC=9F?= Date: Thu, 5 Dec 2024 14:31:45 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E5=BF=83=E8=B7=B3?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E9=A3=8E=E6=9C=BA=E9=80=9A=E8=AE=AF=E7=8A=B6?= =?UTF-8?q?=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/das/modules/node/command/HeartbeatCommand.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/das/src/main/java/com/das/modules/node/command/HeartbeatCommand.java b/das/src/main/java/com/das/modules/node/command/HeartbeatCommand.java index 5c13d899..e29915c9 100644 --- a/das/src/main/java/com/das/modules/node/command/HeartbeatCommand.java +++ b/das/src/main/java/com/das/modules/node/command/HeartbeatCommand.java @@ -56,13 +56,13 @@ public class HeartbeatCommand implements BaseCommand{ } //判断是不是风机 String keyPLCDeviceStatus = String.format("RT:%d:iturbineoperationmode", deviceId); - String keyDeviceStatus = String.format("RT:%d:commfaultstate"); + String keyCommFaultState = String.format("RT:%d:commfaultstate"); Integer plcDeviceStatus = adminRedisTemplate.get(keyPLCDeviceStatus); if (plcDeviceStatus == null){ - adminRedisTemplate.set(keyDeviceStatus, online ? 1 : 0); + adminRedisTemplate.set(keyCommFaultState, online ? 0 : 1); } else{ - adminRedisTemplate.set(keyDeviceStatus, online && plcDeviceStatus == 1 ? 1 : 0); + adminRedisTemplate.set(keyCommFaultState, online && plcDeviceStatus != 0 ? 0 : 1); } } } From 70b34b409d879d1f00ff5e38fe7a091de37e0cdb Mon Sep 17 00:00:00 2001 From: fengrong Date: Thu, 5 Dec 2024 14:33:13 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E9=A6=96=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/dasadmin/src/views/backend/dashboard.vue | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/ui/dasadmin/src/views/backend/dashboard.vue b/ui/dasadmin/src/views/backend/dashboard.vue index b73c4296..b54cfca2 100644 --- a/ui/dasadmin/src/views/backend/dashboard.vue +++ b/ui/dasadmin/src/views/backend/dashboard.vue @@ -422,10 +422,6 @@ const createScroll = () => { if (scrollRef.value.clientWidth + scrollRef.value.scrollLeft == scrollRef.value.scrollWidth) { scrollRef.value.scrollLeft = 0 } - //scrollRef.value.scrollTop += 1 - /* if (scrollRef.value.clientHeight + scrollRef.value.scrollTop == scrollRef.value.scrollHeight) { - scrollRef.value.scrollTop = 0 - }*/ }, 30); } @@ -520,7 +516,7 @@ $labelHeight: 30px; } .content-number { color: #333333; - font-size: 28px; + font-size: 24px; } .homelabel { font-family: PingFangSC-Semibold;