Merge branch 'main' of https://git.jsspisoft.com/ry-das
This commit is contained in:
commit
0a07aa94e3
@ -2849,13 +2849,6 @@ bool CRYDevice::publishinitDeviceData(int uid)
|
||||
{
|
||||
if (uid < 0 || uid >= UNIT_NUM) return false;
|
||||
|
||||
if ((config.units[uid].state & 0x80) != 0x80) {
|
||||
return false;
|
||||
}
|
||||
if ((config.units[uid].state & 0x40) == 0x40) { //该设备已经发送过初始化
|
||||
return false;
|
||||
}
|
||||
|
||||
Json::Value root;
|
||||
Json::Value values;
|
||||
|
||||
@ -2882,7 +2875,6 @@ bool CRYDevice::publishinitDeviceData(int uid)
|
||||
root["deviceId"] = static_units[uid].deviceId;
|
||||
root["values"] = values;
|
||||
|
||||
config.units[uid].state |= 0x40;
|
||||
return publish_sensor_data("", "initDeviceData", root);
|
||||
}
|
||||
return false;
|
||||
@ -2919,7 +2911,6 @@ bool CRYDevice::publishAnalogData(int uid)
|
||||
datatime *= 1000;
|
||||
root["dataTime"] = datatime;
|
||||
root["deviceId"] = static_units[uid].deviceId;
|
||||
// root["isStore"] = config.units[uid].state & 0x20 ? false : true;
|
||||
|
||||
if (values.size()) {
|
||||
root["values"] = values;
|
||||
@ -2927,6 +2918,7 @@ bool CRYDevice::publishAnalogData(int uid)
|
||||
if (archiveValues.size()) {
|
||||
root["archiveValues"] = archiveValues;
|
||||
}
|
||||
|
||||
return publish_sensor_data("", "analogData", root);
|
||||
}
|
||||
|
||||
@ -3019,12 +3011,26 @@ bool CRYDevice::publishdeviceEventData(void)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void CRYDevice::releaseAllUnits(void)
|
||||
int CRYDevice::sendMsg(std::string sMessage)
|
||||
{
|
||||
for (int i = 0; i < UNIT_NUM; i++) {
|
||||
if ((config.units[i].state & 0x01) != 0x01) continue;
|
||||
config.units[i].state &= 0xBF; //0x40取反
|
||||
if (NULL != m_ws && m_ws->getReadyState() == easywsclient::WebSocket::OPEN)
|
||||
{
|
||||
pthread_mutex_lock(&m_SendQueueMutex);
|
||||
m_SendQueue.push(sMessage);
|
||||
pthread_mutex_unlock(&m_SendQueueMutex);
|
||||
|
||||
return (int)sMessage.length();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CRYDevice::recvMsg(std::string sMessage)
|
||||
{
|
||||
pthread_mutex_lock(&m_RecvQueueMutex);
|
||||
m_recvMsgQueue.push(sMessage);
|
||||
pthread_mutex_unlock(&m_RecvQueueMutex);
|
||||
|
||||
return (int)sMessage.length();
|
||||
}
|
||||
|
||||
BOOLEAN CRYDevice::ry_init(const char *host, const int port, const char *nodeId, const char *version)
|
||||
@ -3034,7 +3040,8 @@ BOOLEAN CRYDevice::ry_init(const char *host, const int port, const char *nodeId,
|
||||
snprintf(m_version, sizeof(m_version), "%s", version);
|
||||
m_port = port;
|
||||
|
||||
status = 2; //0 - 离线, 1 - 在线, 2 - 未配置
|
||||
m_nCurUnit = 0;
|
||||
m_status = 2; //0 - 离线, 1 - 在线, 2 - 未配置
|
||||
m_dataAcquisitionReload = false;
|
||||
|
||||
unitname2service_map.clear();
|
||||
@ -3075,7 +3082,7 @@ BOOLEAN CRYDevice::ry_init(const char *host, const int port, const char *nodeId,
|
||||
vLog(LOG_WARN, "系统配置了两个相同的设备ID<%s>,请检查。\n", unit_id.c_str());
|
||||
}
|
||||
}
|
||||
status = 1;
|
||||
m_status = 1;
|
||||
|
||||
#ifndef USE_NOPOLL_WEBSOCKET
|
||||
char url[560];
|
||||
@ -3093,7 +3100,6 @@ BOOLEAN CRYDevice::ry_init(const char *host, const int port, const char *nodeId,
|
||||
snprintf(url, sizeof(url), "/node/%s/%s", m_nodeId, m_version);
|
||||
snprintf(cPort, sizeof(cPort), "%d", m_port);
|
||||
vLog(LOG_DEBUG, "%d here to connect:%s:%s.\n", __LINE__, m_host, cPort);
|
||||
releaseAllUnits();
|
||||
conn = nopoll_conn_new(ctx, m_host, cPort, NULL, url, NULL, NULL);
|
||||
g_conn = conn;
|
||||
}
|
||||
@ -3101,28 +3107,6 @@ BOOLEAN CRYDevice::ry_init(const char *host, const int port, const char *nodeId,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int CRYDevice::sendMsg(std::string sMessage)
|
||||
{
|
||||
if (NULL != m_ws && m_ws->getReadyState() == easywsclient::WebSocket::OPEN)
|
||||
{
|
||||
pthread_mutex_lock(&m_SendQueueMutex);
|
||||
m_SendQueue.push(sMessage);
|
||||
pthread_mutex_unlock(&m_SendQueueMutex);
|
||||
|
||||
return (int)sMessage.length();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CRYDevice::recvMsg(std::string sMessage)
|
||||
{
|
||||
pthread_mutex_lock(&m_RecvQueueMutex);
|
||||
m_recvMsgQueue.push(sMessage);
|
||||
pthread_mutex_unlock(&m_RecvQueueMutex);
|
||||
|
||||
return (int)sMessage.length();
|
||||
}
|
||||
|
||||
bool CRYDevice::ry_run(void)
|
||||
{
|
||||
#ifndef USE_NOPOLL_WEBSOCKET
|
||||
@ -3220,7 +3204,6 @@ bool CRYDevice::ry_run(void)
|
||||
snprintf(url, sizeof(url), "/node/%s/%s", m_nodeId, m_version);
|
||||
snprintf(cPort, sizeof(cPort), "%d", m_port);
|
||||
vLog(LOG_DEBUG, "%d here to connect:%s:%s.\n", __LINE__, m_host, cPort);
|
||||
releaseAllUnits();
|
||||
conn = nopoll_conn_new(ctx, m_host, cPort, NULL, url, NULL, NULL);
|
||||
g_conn = conn;
|
||||
last_connect_sec = system32.timers;
|
||||
@ -3234,19 +3217,30 @@ bool CRYDevice::ry_run(void)
|
||||
}
|
||||
if (sec_changed) {
|
||||
if ((last_sec % 20) == 0) {
|
||||
heart_beat(status);
|
||||
heart_beat(m_status);
|
||||
}
|
||||
}
|
||||
publishdeviceEventData();
|
||||
for (int i = 0; i < UNIT_NUM; i++) {
|
||||
// int i = 0;
|
||||
#if 1
|
||||
for (int i = 0; i < UNIT_NUM; i++)
|
||||
{
|
||||
#else
|
||||
i = m_nCurUnit;
|
||||
m_nCurUnit++;
|
||||
if (m_nCurUnit >= UNIT_NUM) m_nCurUnit = 0;
|
||||
#endif
|
||||
if ((config.units[i].state & 0x01) != TRUE) continue;
|
||||
if (config.units[i].type != MASTER_UNIT) continue;
|
||||
MakeYKFrame(i);
|
||||
MakeYTFrame(i);
|
||||
if (sec_changed) {
|
||||
publishAnalogData(i);
|
||||
publishStateData(i);
|
||||
}
|
||||
#if 1
|
||||
}
|
||||
#endif
|
||||
return m_dataAcquisitionReload;
|
||||
}
|
||||
|
||||
|
@ -119,8 +119,9 @@ private:
|
||||
int msg_count = 0;
|
||||
#endif
|
||||
|
||||
DWORD last_connect_sec = 0;
|
||||
int status;
|
||||
DWORD last_connect_sec = 0;
|
||||
int m_status;
|
||||
int m_nCurUnit;
|
||||
|
||||
bool m_dataAcquisitionReload = false;
|
||||
|
||||
|
@ -2315,25 +2315,11 @@ void* idle_process(void* param)
|
||||
config.units[i].softdog++;
|
||||
if (config.units[i].softdog > UNIT_WATCHDOG_TIME) {
|
||||
config.units[i].softdog = UNIT_WATCHDOG_TIME;
|
||||
config.units[i].value = SPI_ON;
|
||||
//config.units[i].value = SPI_ON;
|
||||
config.units[i].value |= SPI_ON;
|
||||
} else {
|
||||
config.units[i].value = SPI_OFF;
|
||||
if ((config.units[i].state & 0x80) != 0x80) {
|
||||
int j = 0;
|
||||
for (j = 0; j < config.units[i].yxcount; j++) {
|
||||
if ((config.units[i].yxs[j].qds & 0x80) == 0x80) break;
|
||||
}
|
||||
if (j < config.units[i].yxcount) {
|
||||
continue;
|
||||
}
|
||||
for (j = 0; j < config.units[i].yccount; j++) {
|
||||
if ((config.units[i].ycs[j].qds & 0x80) == 0x80) break;
|
||||
}
|
||||
if (j < config.units[i].yccount) {
|
||||
continue;
|
||||
}
|
||||
config.units[i].state |= 0x80;
|
||||
}
|
||||
//config.units[i].value = SPI_OFF;
|
||||
config.units[i].value &= ~SPI_ON;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -408,10 +408,9 @@ static void* ryftp_process(void* param)
|
||||
m_datalen2mbaddr_map.insert(datalen2mbaddrmap::value_type(m_datalen_mbaddr[i].address, i + 1));
|
||||
}
|
||||
|
||||
int len = 0;
|
||||
//struRYDeviceData t_data;
|
||||
FIELDDES fields[1024];
|
||||
len = calcFields(fields);
|
||||
calcFields(fields);
|
||||
|
||||
//判断是否链接单元
|
||||
int uid = mbt->GetUnitID(0); //默认只接一个设备
|
||||
@ -486,6 +485,7 @@ static void* ryftp_process(void* param)
|
||||
if (result == CURLE_OK) {
|
||||
//成功,处理文件
|
||||
vLog(LOG_DEBUG, "%s get %s to local memory, with name: %s, and password: %s okay, and file length is: %d.\n", processName, remote, user, password, chunk.size);
|
||||
config.units[uid].value &= ~0x02;
|
||||
ftpget_retry_count = 0;
|
||||
if (chunk.size <= (int)(sizeof(struRYDeviceData) << 5)) {
|
||||
vLog(LOG_DEBUG, "%s PLC文件生成未完成!\n", processName);
|
||||
@ -602,6 +602,7 @@ static void* ryftp_process(void* param)
|
||||
mbt->m_iv = 0;
|
||||
mbt->m_currentDirNo = -1;
|
||||
mbt->m_currentFileNo = -1;
|
||||
config.units[uid].value |= 0x02; //
|
||||
}
|
||||
//此处空闲读取未读的文件
|
||||
if (mbt->m_bHaveUnReadFile) {
|
||||
@ -842,6 +843,7 @@ BOOLEAN CHostADSBFProcess::OnPreCreate(int id)
|
||||
//vLog(LOG_DEBUG, "%s local ip is: %s, netid is: %s, remote ip is: %s, and netid is: %s\n", m_pidName.c_str(), m_localIp.c_str(), m_localNetId.c_str(), m_remoteIp.c_str(), m_remoteNetId.c_str());
|
||||
|
||||
m_turbine = NULL;
|
||||
m_bRouteAdded = FALSE;
|
||||
SetLocalAmsNetId(AmsNetId(m_localNetId));
|
||||
#if 0
|
||||
m_threadRun = TRUE;
|
||||
@ -930,15 +932,20 @@ BOOLEAN CHostADSBFProcess::OnTimer(void)
|
||||
}
|
||||
#else
|
||||
//先添加一条路由
|
||||
long ret = AddRemoteRoute(m_remoteIp, m_localNetId, m_localIp, std::string("isoftstone"), std::string("admin"), std::string("admin"));
|
||||
vLog(LOG_DEBUG, "bbb %s add route return value is: %d\n", m_pidName.c_str(), ret);
|
||||
if (ret != 0) return TRUE;
|
||||
if (m_bRouteAdded == FALSE)
|
||||
{
|
||||
long ret = AddRemoteRoute(m_remoteIp, m_localNetId, m_localIp, std::string("isoftstone"), std::string("admin"), std::string("admin"));
|
||||
vLog(LOG_DEBUG, "%s add route(%s to %s) return value is: %d\n", m_localIp.c_str(), m_remoteIp.c_str(), m_pidName.c_str(), ret);
|
||||
if (ret != 0) return TRUE;
|
||||
}
|
||||
m_bRouteAdded = TRUE;
|
||||
//添加成功
|
||||
vLog(LOG_DEBUG, "%s start to connect(%s:%d)\n", m_pidName.c_str(), m_remoteIp.c_str(), m_remotePort);
|
||||
m_turbine = new AdsDevice{m_remoteIp, AmsNetId(m_remoteNetId), m_remotePort};
|
||||
const auto state = m_turbine->GetState();
|
||||
if ((uint16_t)state.ads >= ADSSTATE::ADSSTATE_MAXSTATES || (uint16_t)state.device >= ADSSTATE::ADSSTATE_MAXSTATES)
|
||||
{
|
||||
vLog(LOG_DEBUG, "read device state error.\n");
|
||||
vLog(LOG_DEBUG, "%s read device state error.\n", m_pidName.c_str());
|
||||
delete m_turbine;
|
||||
m_turbine = NULL;
|
||||
}
|
||||
@ -955,6 +962,7 @@ BOOLEAN CHostADSBFProcess::OnTimer(void)
|
||||
}
|
||||
}
|
||||
readRealData();
|
||||
FeedDog();
|
||||
// } catch (const AdsException& ex) {
|
||||
// vLog(LOG_ERROR, "%s AdsException message: %s, remote is: %s:%d\n", m_pidName.c_str(), ex.what(), m_remoteIp.c_str(), m_remotePort);
|
||||
// } catch (const std::runtime_error& ex) {
|
||||
@ -1061,6 +1069,7 @@ BOOLEAN CHostADSBFProcess::readRealData()
|
||||
DWORD nValue = 0;
|
||||
int point;
|
||||
|
||||
UnitFeedDog(uid);
|
||||
for (int i = 0; i < MAX_BLOCKF_SIZE;)
|
||||
{
|
||||
//vLog(LOG_DEBUG, "registerAddr is: %d\n", registerAddr);
|
||||
|
@ -45,6 +45,7 @@ private:
|
||||
std::string m_remoteNetId;
|
||||
|
||||
AdsDevice *m_turbine;
|
||||
BOOLEAN m_bRouteAdded; //路由是否添加成功
|
||||
|
||||
int m_total_length;
|
||||
DWORD last_sec;
|
||||
|
@ -447,11 +447,10 @@ static void* ryftp_process(void* param)
|
||||
m_datalen2mbaddr_map.insert(datalen2mbaddrmap::value_type(m_datalen_mbaddr[i].address, i + 1));
|
||||
}
|
||||
|
||||
int len = 0;
|
||||
//struRYDeviceData t_data;
|
||||
FIELDDES fields[1024];
|
||||
|
||||
len = calcFields(fields);
|
||||
calcFields(fields);
|
||||
|
||||
//判断是否链接单元
|
||||
int uid = mbt->GetUnitID(0); //默认只接一个设备
|
||||
@ -525,6 +524,7 @@ static void* ryftp_process(void* param)
|
||||
if (result == CURLE_OK) {
|
||||
//成功,处理文件
|
||||
vLog(LOG_DEBUG, "%s get %s to local memory, with name: %s, and password: %s okay, and file length is: %d.\n", processName, remote, user, password, chunk.size);
|
||||
config.units[uid].value &= ~0x02;
|
||||
ftpget_retry_count = 0;
|
||||
if (chunk.size <= (int)(sizeof(struRYDeviceData) << 5)) {
|
||||
vLog(LOG_DEBUG, "%s PLC文件生成未完成!\n", processName);
|
||||
@ -641,6 +641,7 @@ static void* ryftp_process(void* param)
|
||||
mbt->m_iv = 0;
|
||||
mbt->m_currentDirNo = -1;
|
||||
mbt->m_currentFileNo = -1;
|
||||
config.units[uid].value |= 0x02; //
|
||||
}
|
||||
//此处空闲读取未读的文件
|
||||
if (mbt->m_bHaveUnReadFile) {
|
||||
|
@ -52,11 +52,11 @@ BOOLEAN CRTUStatusProcess::OnTimer(void)
|
||||
for (i = 0; i < UNIT_NUM; i++)
|
||||
{
|
||||
//单元状态在idle_process中计算,此处刷新单元状态
|
||||
if (GetUnitYX(uid, i + PROCESSES_NUM) != config.units[i].value)
|
||||
if (GetUnitYX(uid, i + PROCESSES_NUM) != (config.units[i].value & 0x01))
|
||||
{
|
||||
SetUnitSOE(uid, i + PROCESSES_NUM, config.units[i].value, system32.now);
|
||||
SetUnitSOE(uid, i + PROCESSES_NUM, (config.units[i].value & 0x01), system32.now);
|
||||
}
|
||||
SetUnitYX(uid, i + PROCESSES_NUM, config.units[i].value); //单元通讯中断,设置单元数据无效
|
||||
SetUnitYX(uid, i + PROCESSES_NUM, (config.units[i].value & 0x01)); //单元通讯中断,设置单元数据无效
|
||||
}
|
||||
}
|
||||
UnitFeedDog(uid);
|
||||
|
14
das-dn/third_party/AdsLib/AdsDevice.cpp
vendored
14
das-dn/third_party/AdsLib/AdsDevice.cpp
vendored
@ -33,7 +33,7 @@ AdsDevice::AdsDevice(const std::string& ipV4, AmsNetId amsNetId, uint16_t port)
|
||||
m_LocalPort(new long { OpenLocalPort() }, { CloseLocalPort }),
|
||||
m_Connected(false)
|
||||
{
|
||||
if(*m_NetId.get() == amsNetId) {
|
||||
if (*m_NetId.get() == amsNetId) {
|
||||
m_Connected = true;
|
||||
}
|
||||
}
|
||||
@ -47,6 +47,15 @@ AdsDevice::~AdsDevice()
|
||||
}
|
||||
}
|
||||
|
||||
void AdsDevice::DisconnectDevice()
|
||||
{
|
||||
if (m_Connected == true)
|
||||
{
|
||||
DisconnectTarget(*m_NetId.get());
|
||||
m_Connected = false;
|
||||
}
|
||||
}
|
||||
|
||||
long AdsDevice::DeleteNotificationHandle(uint32_t handle) const
|
||||
{
|
||||
if (handle) {
|
||||
@ -239,8 +248,7 @@ AdsHandle AdsDevice::OpenFile(const std::string& filename, const uint32_t flags)
|
||||
|
||||
long AdsDevice::ReadReqEx2(uint32_t group, uint32_t offset, size_t length, void* buffer, uint32_t* bytesRead) const
|
||||
{
|
||||
if(m_Connected == false)
|
||||
return ROUTERERR_HOSTDENY;
|
||||
if (m_Connected == false) return ROUTERERR_HOSTDENY;
|
||||
|
||||
if (length > std::numeric_limits<uint32_t>::max()) {
|
||||
return ADSERR_DEVICE_INVALIDSIZE;
|
||||
|
1
das-dn/third_party/AdsLib/AdsDevice.h
vendored
1
das-dn/third_party/AdsLib/AdsDevice.h
vendored
@ -100,6 +100,7 @@ struct AdsDevice {
|
||||
const AmsAddr m_Addr;
|
||||
|
||||
bool IsConnected() const { return m_Connected; }
|
||||
void DisconnectDevice();
|
||||
private:
|
||||
AdsResource<const long> m_LocalPort;
|
||||
long CloseFile(uint32_t handle) const;
|
||||
|
2
das-dn/third_party/AdsLib/AdsVariable.h
vendored
2
das-dn/third_party/AdsLib/AdsVariable.h
vendored
@ -63,6 +63,7 @@ struct AdsVariable {
|
||||
|
||||
if (error || (size != bytesRead)) {
|
||||
LOG_ERROR("AdsVariable read failed: "<< std::dec << error);
|
||||
((AdsDevice&)m_Route).DisconnectDevice();
|
||||
//throw AdsException(error);
|
||||
}
|
||||
}
|
||||
@ -73,6 +74,7 @@ struct AdsVariable {
|
||||
auto error = m_Route.WriteReqEx(m_IndexGroup, *m_Handle, size, data);
|
||||
if (error) {
|
||||
LOG_ERROR("AdsVariable write failed:" << std::dec << error);
|
||||
((AdsDevice&)m_Route).DisconnectDevice();
|
||||
//throw AdsException(error);
|
||||
}
|
||||
}
|
||||
|
4
das-dn/third_party/AdsLib/Sockets.cpp
vendored
4
das-dn/third_party/AdsLib/Sockets.cpp
vendored
@ -111,8 +111,8 @@ bool IpV4::operator==(const IpV4& ref) const
|
||||
return value == ref.value;
|
||||
}
|
||||
|
||||
Socket::Socket(const struct addrinfo* const host, const int type)
|
||||
: m_WSAInitialized(!InitSocketLibrary()),
|
||||
Socket::Socket(const struct addrinfo* const host, const int type) :
|
||||
m_WSAInitialized(!InitSocketLibrary()),
|
||||
m_DestAddr(SOCK_DGRAM == type ? reinterpret_cast<const struct sockaddr*>(&m_SockAddress) : nullptr),
|
||||
m_DestAddrLen(0),
|
||||
m_LastError(0),
|
||||
|
2
das-dn/third_party/AdsLib/Sockets.h
vendored
2
das-dn/third_party/AdsLib/Sockets.h
vendored
@ -50,7 +50,7 @@ struct Socket {
|
||||
bool IsConnectedTo(const struct addrinfo* targetAddresses) const;
|
||||
|
||||
protected:
|
||||
bool m_Connected;
|
||||
bool m_Connected;
|
||||
int m_WSAInitialized;
|
||||
int m_LastError;
|
||||
SOCKET m_Socket;
|
||||
|
@ -153,8 +153,7 @@ AmsResponse* AmsConnection::Write(AmsRequest& request, const AmsAddr srcAddr)
|
||||
|
||||
long AmsConnection::SendRequest(AmsRequest& request, const uint32_t timeout)
|
||||
{
|
||||
if(IsConnected() == false)
|
||||
return -1;
|
||||
if (IsConnected() == false) return -1;
|
||||
|
||||
AmsAddr srcAddr;
|
||||
const auto status = router.GetAmsAddr(request.srcPort, &srcAddr);
|
||||
|
@ -238,6 +238,7 @@ public class NodeMessageServiceImpl extends TextWebSocketHandler implements Node
|
||||
@Override
|
||||
public void handleData(TerminalMessage data) {
|
||||
JsonNode jsonNode = data.getData();
|
||||
log.info("收到消息:{}",data.getData());
|
||||
String deviceId = jsonNode.get("deviceId").asText();
|
||||
JsonNode values = jsonNode.get("values");
|
||||
JsonNode archiveValues = jsonNode.get("archiveValues");
|
||||
@ -250,23 +251,30 @@ public class NodeMessageServiceImpl extends TextWebSocketHandler implements Node
|
||||
Map<String, Object> lowSpeedValueMap = new HashMap<>();
|
||||
|
||||
//数据入redis
|
||||
Iterator<String> keysHigh = values.fieldNames();
|
||||
while (keysHigh.hasNext()) {
|
||||
String fieldName = keysHigh.next();
|
||||
String key = String.format("RT:%s:%s", deviceId, fieldName.toLowerCase());
|
||||
keyValueMap.put(key, values.get(fieldName));
|
||||
if (values != null){
|
||||
Iterator<String> keysHigh = values.fieldNames();
|
||||
while (keysHigh.hasNext()) {
|
||||
String fieldName = keysHigh.next();
|
||||
String key = String.format("RT:%s:%s", deviceId, fieldName.toLowerCase());
|
||||
keyValueMap.put(key, values.get(fieldName));
|
||||
}
|
||||
log.info("values解析成功");
|
||||
}
|
||||
Iterator<String> archiveKeys = archiveValues.fieldNames();
|
||||
while (archiveKeys.hasNext()) {
|
||||
String fieldName = archiveKeys.next();
|
||||
String key = String.format("RT:%s:%s", deviceId, fieldName.toLowerCase());
|
||||
keyValueMap.put(key, values.get(fieldName));
|
||||
if (highKey.contains(fieldName)) {
|
||||
highSpeedValueMap.put(fieldName, values.get(fieldName));
|
||||
}
|
||||
if (lowKey.contains(fieldName)) {
|
||||
lowSpeedValueMap.put(fieldName, values.get(fieldName));
|
||||
|
||||
if (archiveValues != null){
|
||||
Iterator<String> archiveKeys = archiveValues.fieldNames();
|
||||
while (archiveKeys.hasNext()) {
|
||||
String fieldName = archiveKeys.next();
|
||||
String key = String.format("RT:%s:%s", deviceId, fieldName.toLowerCase());
|
||||
keyValueMap.put(key, archiveValues.get(fieldName));
|
||||
if (highKey.contains(fieldName)) {
|
||||
highSpeedValueMap.put(fieldName, archiveValues.get(fieldName));
|
||||
}
|
||||
if (lowKey.contains(fieldName)) {
|
||||
lowSpeedValueMap.put(fieldName, archiveValues.get(fieldName));
|
||||
}
|
||||
}
|
||||
log.info("archive解析成功");
|
||||
}
|
||||
//更新td
|
||||
if (!highSpeedValueMap.isEmpty()) {
|
||||
|
@ -341,6 +341,23 @@ const currentDayStatus = ref({
|
||||
})
|
||||
const deviceCode = ref([])
|
||||
const FanList = ref([])
|
||||
const getRealTimeState = (data: any) => {
|
||||
if (data.iturbineoperationmode) {
|
||||
if (data.iturbineoperationmode > 1 && data.iturbineoperationmode < 6) {
|
||||
return 2
|
||||
}
|
||||
if (data.iturbineoperationmode === 21) {
|
||||
return 20
|
||||
}
|
||||
return data.iturbineoperationmode
|
||||
} else if (data.iyplevel === 10) {
|
||||
return 1110
|
||||
} else if (data.gridlostdetected === 1) {
|
||||
return 1111
|
||||
} else if (data.ibplevel === 200) {
|
||||
return 1112
|
||||
}
|
||||
}
|
||||
const StatusListData = () => {
|
||||
getWindTurbineMatrixData().then((res) => {
|
||||
if (res.code == 200) {
|
||||
@ -437,6 +454,7 @@ const StatusListData = () => {
|
||||
igenpower: item.attributeMap.igenpower,
|
||||
ikwhthisday: item.attributeMap.ikwhthisday,
|
||||
iturbineoperationmode: state,
|
||||
processedoperationmode: state,
|
||||
locked: item.attributeMap.locked,
|
||||
irotorspeed: item.attributeMap.irotorspeed,
|
||||
},
|
||||
|
@ -12,24 +12,24 @@
|
||||
<img :class="item.standard == true ? '' : 'wind-picture'" src="~assets/dashboard/biaogan.png" alt="" />
|
||||
</span>
|
||||
<span class="fanlist-name"> {{ item.name }}</span>
|
||||
<el-tag v-if="item.attributeMap.iturbineoperationmode === 20" class="tag-panel is-primary" type="primary">并网</el-tag>
|
||||
<el-tag v-if="item.attributeMap.iturbineoperationmode === 11" class="tag-panel is-warning" type="primary">待机</el-tag>
|
||||
<el-tag v-if="item.attributeMap.iturbineoperationmode === 16" class="tag-panel is-success" type="primary">启动</el-tag>
|
||||
<el-tag v-if="item.attributeMap.iturbineoperationmode === 10" class="tag-panel is-maintenance" type="primary"
|
||||
<el-tag v-if="item.attributeMap.processedoperationmode === 20" class="tag-panel is-primary" type="primary">并网</el-tag>
|
||||
<el-tag v-if="item.attributeMap.processedoperationmode === 11" class="tag-panel is-warning" type="primary">待机</el-tag>
|
||||
<el-tag v-if="item.attributeMap.processedoperationmode === 16" class="tag-panel is-success" type="primary">启动</el-tag>
|
||||
<el-tag v-if="item.attributeMap.processedoperationmode === 10" class="tag-panel is-maintenance" type="primary"
|
||||
>维护</el-tag
|
||||
>
|
||||
<el-tag v-if="item.attributeMap.iturbineoperationmode === 0" class="tag-panel is-offline" type="primary">离线</el-tag>
|
||||
<el-tag v-if="item.attributeMap.iturbineoperationmode === 8" class="tag-panel info" type="primary">限功率运行</el-tag>
|
||||
<el-tag v-if="item.attributeMap.iturbineoperationmode === 6" class="tag-panel is-danger" type="primary">正常停机</el-tag>
|
||||
<el-tag v-if="item.attributeMap.iturbineoperationmode === 1" class="tag-panel is-danger" type="primary"
|
||||
<el-tag v-if="item.attributeMap.processedoperationmode === 0" class="tag-panel is-offline" type="primary">离线</el-tag>
|
||||
<el-tag v-if="item.attributeMap.processedoperationmode === 8" class="tag-panel info" type="primary">限功率运行</el-tag>
|
||||
<el-tag v-if="item.attributeMap.processedoperationmode === 6" class="tag-panel is-danger" type="primary">正常停机</el-tag>
|
||||
<el-tag v-if="item.attributeMap.processedoperationmode === 1" class="tag-panel is-danger" type="primary"
|
||||
>外部因素导致停机</el-tag
|
||||
>
|
||||
<el-tag v-if="item.attributeMap.iturbineoperationmode === 2" class="tag-panel is-danger" type="primary">停机</el-tag>
|
||||
<el-tag v-if="item.attributeMap.iturbineoperationmode === 1110" class="tag-panel is-info" type="primary">解缆状态</el-tag>
|
||||
<el-tag v-if="item.attributeMap.iturbineoperationmode === 1111" class="tag-panel is-danger" type="primary"
|
||||
<el-tag v-if="item.attributeMap.processedoperationmode === 2" class="tag-panel is-danger" type="primary">停机</el-tag>
|
||||
<el-tag v-if="item.attributeMap.processedoperationmode === 1110" class="tag-panel is-info" type="primary">解缆状态</el-tag>
|
||||
<el-tag v-if="item.attributeMap.processedoperationmode === 1111" class="tag-panel is-danger" type="primary"
|
||||
>电网故障停机</el-tag
|
||||
>
|
||||
<el-tag v-if="item.attributeMap.iturbineoperationmode === 1112" class="tag-panel is-danger" type="primary"
|
||||
<el-tag v-if="item.attributeMap.processedoperationmode === 1112" class="tag-panel is-danger" type="primary"
|
||||
>安全链停机</el-tag
|
||||
>
|
||||
</div>
|
||||
@ -82,7 +82,7 @@
|
||||
class="control-btn"
|
||||
type="primary"
|
||||
@click="sendCommand('setTurbineFastStart')"
|
||||
v-if="realTimeData.iturbineoperationmode !== 16"
|
||||
v-if="realTimeData.processedoperationmode !== 16"
|
||||
>启动</el-button>
|
||||
<el-button @click="sendCommand('setTurbineStop')" v-else class="control-btn" type="primary">停机</el-button>
|
||||
<el-button @click="sendCommand('setTurbineResetStatusCode')" class="control-btn" type="primary">复位</el-button>
|
||||
@ -160,7 +160,7 @@ const contextMenuPos = ref({
|
||||
y: 0,
|
||||
})
|
||||
const realTimeData = ref<any>({
|
||||
iturbineoperationmode: 1111,
|
||||
processedoperationmode: 1111,
|
||||
locked: 0,
|
||||
deviceId: '',
|
||||
name:''
|
||||
@ -168,7 +168,7 @@ const realTimeData = ref<any>({
|
||||
const windContextMenu = (event: any,curnodeData) => {
|
||||
contextMenuPos.value.x = event.pageX
|
||||
contextMenuPos.value.y = event.pageY
|
||||
realTimeData.value.iturbineoperationmode=curnodeData.attributeMap.iturbineoperationmode
|
||||
realTimeData.value.processedoperationmode=curnodeData.attributeMap.processedoperationmode
|
||||
realTimeData.value.locked=curnodeData.attributeMap.locked
|
||||
realTimeData.value.deviceId=curnodeData.irn
|
||||
realTimeData.value.name=curnodeData.name
|
||||
|
Loading…
Reference in New Issue
Block a user