Merge branch 'main' of https://git.jsspisoft.com/ry-das
This commit is contained in:
commit
ba36915dcd
@ -247,6 +247,7 @@ int main(int argc, char** argv)
|
|||||||
i++; uid++;
|
i++; uid++;
|
||||||
#endif
|
#endif
|
||||||
snprintf(config.processes[i].name, sizeof(config.processes[i].name), "%s", "本地调试");
|
snprintf(config.processes[i].name, sizeof(config.processes[i].name), "%s", "本地调试");
|
||||||
|
config.processes[i].irn = 0;
|
||||||
config.processes[i].state = TRUE;
|
config.processes[i].state = TRUE;
|
||||||
config.processes[i].time_accept = FALSE;
|
config.processes[i].time_accept = FALSE;
|
||||||
config.processes[i].proto = PROTOCOL_LOCAL_DEBUG;
|
config.processes[i].proto = PROTOCOL_LOCAL_DEBUG;
|
||||||
|
@ -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].value = SPI_ON;
|
||||||
config_config.units[uid].softdog = UNIT_WATCHDOG_TIME;
|
config_config.units[uid].softdog = UNIT_WATCHDOG_TIME;
|
||||||
config_config.units[uid].state = TRUE;
|
config_config.units[uid].state = TRUE;
|
||||||
@ -2756,11 +2757,13 @@ void CRYDevice::heart_beat(int status)
|
|||||||
payload["status"] = status;
|
payload["status"] = status;
|
||||||
|
|
||||||
if (status == 1) {
|
if (status == 1) {
|
||||||
Json::Value jsonItem;
|
Json::Value jsonLink;
|
||||||
|
Json::Value jsonDevice;
|
||||||
Json::Value jsonValue;
|
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) {
|
if (config.processes[i].state == TRUE) {
|
||||||
char linkId[32];
|
char linkId[32];
|
||||||
|
if (config.processes[i].irn == 0) continue;
|
||||||
#ifdef NOPOLL_64BIT_PLATFORM
|
#ifdef NOPOLL_64BIT_PLATFORM
|
||||||
snprintf(linkId, sizeof(linkId), "%ld", config.processes[i].irn);
|
snprintf(linkId, sizeof(linkId), "%ld", config.processes[i].irn);
|
||||||
#else
|
#else
|
||||||
@ -2768,11 +2771,30 @@ void CRYDevice::heart_beat(int status)
|
|||||||
#endif
|
#endif
|
||||||
jsonValue["linkId"] = linkId;
|
jsonValue["linkId"] = linkId;
|
||||||
jsonValue["online"] = (config.processes[i].softdog >= PROCESS_WATCHDOG_TIME) ? false : true;
|
jsonValue["online"] = (config.processes[i].softdog >= PROCESS_WATCHDOG_TIME) ? false : true;
|
||||||
jsonItem.append(jsonValue);
|
jsonLink.append(jsonValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (jsonItem.size() > 0) {
|
if (jsonLink.size() > 0) {
|
||||||
payload["links"] = jsonItem;
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -701,7 +701,7 @@ BOOLEAN CHostADSBFProcess::calc(void)
|
|||||||
ymcount = GetUnitYMCount(uid);
|
ymcount = GetUnitYMCount(uid);
|
||||||
yxcount = GetUnitYXCount(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 params[MAX_UNIT_POINT_PARAM_SIZE];
|
||||||
BYTE* pData = params;
|
BYTE* pData = params;
|
||||||
@ -720,7 +720,7 @@ BOOLEAN CHostADSBFProcess::calc(void)
|
|||||||
if (m_adsDatas[0].adsDataBlocks.find(registerAddr) == m_adsDatas[0].adsDataBlocks.end()) {
|
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));
|
m_adsDatas[0].adsDataBlocks.insert(register2typemap::value_type(registerAddr, REGISTER_DATA_TYPE_YC));
|
||||||
} else {
|
} else {
|
||||||
vLog(LOG_WARN, "遥测测点配置了相同的寄存器地址\n");
|
//vLog(LOG_WARN, "遥测测点配置了相同的寄存器地址\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -730,7 +730,7 @@ BOOLEAN CHostADSBFProcess::calc(void)
|
|||||||
if (m_adsDatas[1].adsDataBlocks.find(registerAddr) == m_adsDatas[1].adsDataBlocks.end()) {
|
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));
|
m_adsDatas[1].adsDataBlocks.insert(register2typemap::value_type(registerAddr, REGISTER_DATA_TYPE_YC));
|
||||||
} else {
|
} 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()) {
|
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));
|
m_adsDatas[0].adsDataBlocks.insert(register2typemap::value_type(registerAddr, REGISTER_DATA_TYPE_YM));
|
||||||
} else {
|
} else {
|
||||||
vLog(LOG_WARN, "遥脉测点配置了相同的寄存器地址\n");
|
//vLog(LOG_WARN, "遥脉测点配置了相同的寄存器地址\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -757,7 +757,7 @@ BOOLEAN CHostADSBFProcess::calc(void)
|
|||||||
if (m_adsDatas[1].adsDataBlocks.find(registerAddr) == m_adsDatas[1].adsDataBlocks.end()) {
|
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));
|
m_adsDatas[1].adsDataBlocks.insert(register2typemap::value_type(registerAddr, REGISTER_DATA_TYPE_YM));
|
||||||
} else {
|
} else {
|
||||||
vLog(LOG_WARN, "遥脉测点配置了相同的寄存器地址\n");
|
//vLog(LOG_WARN, "遥脉测点配置了相同的寄存器地址\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -827,8 +827,8 @@ BOOLEAN CHostADSBFProcess::OnPreCreate(int id)
|
|||||||
try {
|
try {
|
||||||
SetLocalAddress(AmsNetId(m_localNetId));
|
SetLocalAddress(AmsNetId(m_localNetId));
|
||||||
m_turbine = new AdsDevice{m_remoteIp, AmsNetId(m_remoteNetId), m_remotePort};
|
m_turbine = new AdsDevice{m_remoteIp, AmsNetId(m_remoteNetId), m_remotePort};
|
||||||
|
//readDeviceState(*m_turbine);
|
||||||
} catch (const AdsException& ex) {
|
} catch (const AdsException& ex) {
|
||||||
vLog(LOG_ERROR, "Error: %d\n", ex.errorCode);
|
|
||||||
vLog(LOG_ERROR, "AdsException message: %s\n", ex.what());
|
vLog(LOG_ERROR, "AdsException message: %s\n", ex.what());
|
||||||
vLog(LOG_DEBUG, "try to add a route to remote device.\n");
|
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"));
|
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();
|
readRealData();
|
||||||
} catch (const AdsException& ex) {
|
} catch (const AdsException& ex) {
|
||||||
vLog(LOG_ERROR, "Error: %d\n", ex.errorCode);
|
//vLog(LOG_ERROR, "Error: %d\n", ex.errorCode);
|
||||||
vLog(LOG_ERROR, "AdsException message: %s\n", ex.what());
|
vLog(LOG_ERROR, "%s AdsException message: %s\n", GetCurProcessName(), ex.what());
|
||||||
} catch (const std::runtime_error& ex) {
|
} catch (const std::runtime_error& ex) {
|
||||||
vLog(LOG_ERROR, "%s\n", ex.what());
|
vLog(LOG_ERROR, "%s\n", ex.what());
|
||||||
}
|
}
|
||||||
|
@ -941,7 +941,7 @@ void CHostModbusTcpBFProcess::calc2(void)
|
|||||||
ymcount = GetUnitYMCount(uid);
|
ymcount = GetUnitYMCount(uid);
|
||||||
yxcount = GetUnitYXCount(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;
|
STRUCT_PARAM *ycparam = NULL, *ymparam = NULL, *yxparam = NULL;
|
||||||
if (yccount) ycparam = new STRUCT_PARAM[yccount];
|
if (yccount) ycparam = new STRUCT_PARAM[yccount];
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
package com.das.modules.node.command;
|
package com.das.modules.node.command;
|
||||||
|
|
||||||
|
import com.das.common.constant.EquipmentTypeIds;
|
||||||
import com.das.common.utils.AdminRedisTemplate;
|
import com.das.common.utils.AdminRedisTemplate;
|
||||||
import com.das.common.utils.StringUtils;
|
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.constant.NodeConstant;
|
||||||
import com.das.modules.node.domain.bo.TerminalMessage;
|
import com.das.modules.node.domain.bo.TerminalMessage;
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
@ -17,6 +20,9 @@ public class HeartbeatCommand implements BaseCommand{
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
AdminRedisTemplate adminRedisTemplate;
|
AdminRedisTemplate adminRedisTemplate;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
CacheService cacheService;
|
||||||
@Override
|
@Override
|
||||||
public void doCommand(TerminalMessage data) {
|
public void doCommand(TerminalMessage data) {
|
||||||
JsonNode dataInfo = data.getData();
|
JsonNode dataInfo = data.getData();
|
||||||
@ -39,6 +45,27 @@ public class HeartbeatCommand implements BaseCommand{
|
|||||||
adminRedisTemplate.expire(key, 300L);
|
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 keyCommFaultState = String.format("RT:%d:commfaultstate");
|
||||||
|
Integer plcDeviceStatus = adminRedisTemplate.get(keyPLCDeviceStatus);
|
||||||
|
if (plcDeviceStatus == null){
|
||||||
|
adminRedisTemplate.set(keyCommFaultState, online ? 0 : 1);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
adminRedisTemplate.set(keyCommFaultState, online && plcDeviceStatus != 0 ? 0 : 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -349,7 +349,15 @@ PS: 同一节点只允许建立一条连接。
|
|||||||
"linkId": "123",
|
"linkId": "123",
|
||||||
"online": false
|
"online": false
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
//设备监控信息
|
||||||
|
"devices": [
|
||||||
|
{
|
||||||
|
//设备ID
|
||||||
|
"deviceId": "1123451235464",
|
||||||
|
//设备状态
|
||||||
|
"online": true
|
||||||
|
}]
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -422,10 +422,6 @@ const createScroll = () => {
|
|||||||
if (scrollRef.value.clientWidth + scrollRef.value.scrollLeft == scrollRef.value.scrollWidth) {
|
if (scrollRef.value.clientWidth + scrollRef.value.scrollLeft == scrollRef.value.scrollWidth) {
|
||||||
scrollRef.value.scrollLeft = 0
|
scrollRef.value.scrollLeft = 0
|
||||||
}
|
}
|
||||||
//scrollRef.value.scrollTop += 1
|
|
||||||
/* if (scrollRef.value.clientHeight + scrollRef.value.scrollTop == scrollRef.value.scrollHeight) {
|
|
||||||
scrollRef.value.scrollTop = 0
|
|
||||||
}*/
|
|
||||||
}, 30);
|
}, 30);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -520,7 +516,7 @@ $labelHeight: 30px;
|
|||||||
}
|
}
|
||||||
.content-number {
|
.content-number {
|
||||||
color: #333333;
|
color: #333333;
|
||||||
font-size: 28px;
|
font-size: 24px;
|
||||||
}
|
}
|
||||||
.homelabel {
|
.homelabel {
|
||||||
font-family: PingFangSC-Semibold;
|
font-family: PingFangSC-Semibold;
|
||||||
|
Loading…
Reference in New Issue
Block a user