|
@@ -1,4 +1,4 @@
|
|
|
-#include "db_syncthread.h"
|
|
|
+#include "db_syncthread.h"
|
|
|
#include "ytservicecore.h"
|
|
|
#include <time.h>
|
|
|
#include <openssl/md5.h>
|
|
@@ -652,124 +652,133 @@ bool DB_SyncThread::rtuInfoSync(QString devid, QString deviceCode, uint sync_id,
|
|
|
updated = true;
|
|
|
if(qry2.value(1).toString().compare("44")==0)
|
|
|
{
|
|
|
- if(count==0)
|
|
|
- sql = QString("insert into sp_owner_sync_data (id, native_id, device_id, point_code, point_data, data_time, content) values (NULL,%1,'%2','%3','%4','%5','%6 %7')")
|
|
|
- .arg(qry2.value(0).toUInt()).arg(devid).arg(0).arg(1).arg(qry2.value(7).isNull()?"1970-01-01 00:00:00":qry2.value(7).toDateTime().toString("yyyy-MM-dd HH:mm:ss"))
|
|
|
- .arg(qry2.value(5).toString()).arg(qry2.value(6).toString());
|
|
|
- else
|
|
|
- sql += QString(", (NULL,%1,'%2','%3','%4','%5','%6 %7')")
|
|
|
- .arg(qry2.value(0).toUInt()).arg(devid).arg(0).arg(1).arg(qry2.value(7).isNull()?"1970-01-01 00:00:00":qry2.value(7).toDateTime().toString("yyyy-MM-dd HH:mm:ss"))
|
|
|
- .arg(qry2.value(5).toString()).arg(qry2.value(6).toString());
|
|
|
- upsql = QString::fromUtf8("update sp_owner_status set point_data='%1', data_time='%2', content='%3 %4', point_name='通信报警',dwtype=%5 where device_id='%6' and point_code='%7';")
|
|
|
- .arg(0).arg(qry2.value(7).isNull()?"1970-01-01 00:00:00":qry2.value(7).toDateTime().toString("yyyy-MM-dd HH:mm:ss"))
|
|
|
- .arg(qry2.value(5).toString()).arg(qry2.value(6).toString()).arg(6).arg(devid).arg(0);
|
|
|
- mdb.exec(upsql);
|
|
|
+// if(count==0)
|
|
|
+// sql = QString("insert into sp_owner_sync_data (id, native_id, device_id, point_code, point_data, data_time, content) values (NULL,%1,'%2','%3','%4','%5','%6 %7')")
|
|
|
+// .arg(qry2.value(0).toUInt()).arg(devid).arg(0).arg(1).arg(qry2.value(7).isNull()?"1970-01-01 00:00:00":qry2.value(7).toDateTime().toString("yyyy-MM-dd HH:mm:ss"))
|
|
|
+// .arg(qry2.value(5).toString()).arg(qry2.value(6).toString());
|
|
|
+// else
|
|
|
+// sql += QString(", (NULL,%1,'%2','%3','%4','%5','%6 %7')")
|
|
|
+// .arg(qry2.value(0).toUInt()).arg(devid).arg(0).arg(1).arg(qry2.value(7).isNull()?"1970-01-01 00:00:00":qry2.value(7).toDateTime().toString("yyyy-MM-dd HH:mm:ss"))
|
|
|
+// .arg(qry2.value(5).toString()).arg(qry2.value(6).toString());
|
|
|
+// upsql = QString::fromUtf8("update sp_owner_status set point_data='%1', data_time='%2', content='%3 %4', point_name='通信报警',dwtype=%5 where device_id='%6' and point_code='%7';")
|
|
|
+// .arg(0).arg(qry2.value(7).isNull()?"1970-01-01 00:00:00":qry2.value(7).toDateTime().toString("yyyy-MM-dd HH:mm:ss"))
|
|
|
+// .arg(qry2.value(5).toString()).arg(qry2.value(6).toString()).arg(6).arg(devid).arg(0);
|
|
|
+// mdb.exec(upsql);
|
|
|
}else{
|
|
|
setCompanyAlarmSet(deviceCode, AlarmSet(0xffffffff,"",QString::fromUtf8("%1,%2").arg(qry2.value(5).toString()).arg(qry2.value(6).toString()),6,qry2.value(7).toDateTime().toTime_t(),1));
|
|
|
- upsql = QString::fromUtf8("update sp_owner_status set point_data='',content='' where device_id='%1' and point_code='0'").arg(devid);
|
|
|
- mdb.exec(upsql);
|
|
|
- if(!qry2.value(2).isNull()){
|
|
|
- if(qry2.value(2).toString().compare("E3")==0){
|
|
|
- int tmpIdx = qry2.value(3).toString().toInt(nullptr,16);
|
|
|
- if(tmpIdx>0){
|
|
|
- QString pv = "0";
|
|
|
- QString pname = "", vname="";
|
|
|
- for(int Idx=0;Idx<vonameList.length();Idx++){
|
|
|
- if((typeList.at(Idx)==1)&&(portList.at(Idx)==tmpIdx)){
|
|
|
- pname = nameList.at(Idx);
|
|
|
- vname = vonameList.at(Idx);
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- if((vname.compare(QString::fromUtf8("故障"))==0)
|
|
|
- ||(vname.compare(QString::fromUtf8("手动"))==0)
|
|
|
- ||(vname.compare(QString::fromUtf8("运行"))==0)
|
|
|
- ||(vname.compare(QString::fromUtf8("接线"))==0)
|
|
|
- ||(vname.compare(QString::fromUtf8("正常"))==0)){
|
|
|
- if(qry2.value(1).toInt()==0)
|
|
|
- pv="0";
|
|
|
- else
|
|
|
- pv="1";
|
|
|
- }else{
|
|
|
- if(qry2.value(1).toInt()==0)
|
|
|
- pv="1";
|
|
|
- else
|
|
|
- pv="0";
|
|
|
- }
|
|
|
- if(count==0)
|
|
|
- sql = QString("insert into sp_owner_sync_data (id, native_id, device_id, point_code, point_data, data_time, content) values (NULL,%1,'%2','%3','%4','%5','%6 %7')")
|
|
|
- .arg(qry2.value(0).toUInt()).arg(devid).arg(qry2.value(3).toInt()).arg(pv)
|
|
|
- .arg(qry2.value(7).isNull()?"1970-01-01 00:00:00":qry2.value(7).toDateTime().toString("yyyy-MM-dd HH:mm:ss"))
|
|
|
- .arg(qry2.value(5).toString()).arg(qry2.value(6).toString());
|
|
|
- else
|
|
|
- sql += QString(", (NULL,%1,'%2','%3','%4','%5','%6 %7')")
|
|
|
- .arg(qry2.value(0).toUInt()).arg(devid).arg(qry2.value(3).toInt()).arg(pv)
|
|
|
- .arg(qry2.value(7).isNull()?"1970-01-01 00:00:00":qry2.value(7).toDateTime().toString("yyyy-MM-dd HH:mm:ss"))
|
|
|
- .arg(qry2.value(5).toString()).arg(qry2.value(6).toString());
|
|
|
- upsql = QString::fromUtf8("update sp_owner_status set point_data='%1', data_time='%2', content='%3 %4', point_name='%5',dwtype=%6 where device_id='%7' and point_code='%8';")
|
|
|
- .arg(pv)
|
|
|
- .arg(qry2.value(7).isNull()?"1970-01-01 00:00:00":qry2.value(7).toDateTime().toString("yyyy-MM-dd HH:mm:ss"))
|
|
|
- .arg(qry2.value(5).toString()).arg(qry2.value(6).toString()).arg(pname)
|
|
|
- .arg(6).arg(devid).arg(tmpIdx);
|
|
|
- mdb.exec(upsql);
|
|
|
- }
|
|
|
- }else if(qry2.value(2).toString().compare("E6")==0){
|
|
|
- if(count==0)
|
|
|
- sql = QString("insert into sp_owner_sync_data (id, native_id, device_id, point_code, point_data, data_time, content) values (NULL,%1,'%2','%3','%4','%5','%6 %7')")
|
|
|
- .arg(qry2.value(0).toUInt()).arg(devid).arg(qry2.value(3).toInt()+64).arg(qry2.value(8).toString())
|
|
|
- .arg(qry2.value(7).isNull()?"1970-01-01 00:00:00":qry2.value(7).toDateTime().toString("yyyy-MM-dd HH:mm:ss"))
|
|
|
- .arg(qry2.value(5).toString()).arg(qry2.value(6).toString());
|
|
|
- else
|
|
|
- sql += QString(", (NULL,%1,'%2','%3','%4','%5','%6 %7')")
|
|
|
- .arg(qry2.value(0).toUInt()).arg(devid).arg(qry2.value(3).toInt()+64).arg(qry2.value(8).toString())
|
|
|
- .arg(qry2.value(7).isNull()?"1970-01-01 00:00:00":qry2.value(7).toDateTime().toString("yyyy-MM-dd HH:mm:ss"))
|
|
|
- .arg(qry2.value(5).toString()).arg(qry2.value(6).toString());
|
|
|
- int tmpIdx = qry2.value(3).toInt();
|
|
|
- if(tmpIdx>0){
|
|
|
- QString pname = "";
|
|
|
- for(int Idx=0;Idx<nameList.length();Idx++){
|
|
|
- if((typeList.at(Idx)==2)&&(portList.at(Idx)==tmpIdx)){
|
|
|
- pname = nameList.at(Idx);
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- upsql = QString::fromUtf8("update sp_owner_status set point_data='%1', data_time='%2', content='%3 %4 %5',dwtype=%6 where device_id='%7' and point_code='%8';")
|
|
|
- .arg(qry2.value(8).toString())
|
|
|
- .arg(qry2.value(7).isNull()?"1970-01-01 00:00:00":qry2.value(7).toDateTime().toString("yyyy-MM-dd HH:mm:ss"))
|
|
|
- .arg(pname).arg(qry2.value(5).toString())
|
|
|
- .arg(qry2.value(6).toString())
|
|
|
- .arg(6)
|
|
|
- .arg(devid)
|
|
|
- .arg(tmpIdx+64);
|
|
|
- mdb.exec(upsql);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+// upsql = QString::fromUtf8("update sp_owner_status set point_data='',content='' where device_id='%1' and point_code='0'").arg(devid);
|
|
|
+// mdb.exec(upsql);
|
|
|
+// if(!qry2.value(2).isNull()){
|
|
|
+// if(qry2.value(2).toString().compare("E3")==0){
|
|
|
+// int tmpIdx = qry2.value(3).toString().toInt(nullptr,16);
|
|
|
+// if(tmpIdx>0){
|
|
|
+// QString pv = "0";
|
|
|
+// QString pname = "", vname="";
|
|
|
+// for(int Idx=0;Idx<vonameList.length();Idx++){
|
|
|
+// if((typeList.at(Idx)==1)&&(portList.at(Idx)==tmpIdx)){
|
|
|
+// pname = nameList.at(Idx);
|
|
|
+// vname = vonameList.at(Idx);
|
|
|
+// break;
|
|
|
+// }
|
|
|
+// }
|
|
|
+// if((vname.compare(QString::fromUtf8("故障"))==0)
|
|
|
+// ||(vname.compare(QString::fromUtf8("手动"))==0)
|
|
|
+// ||(vname.compare(QString::fromUtf8("运行"))==0)
|
|
|
+// ||(vname.compare(QString::fromUtf8("接线"))==0)
|
|
|
+// ||(vname.compare(QString::fromUtf8("正常"))==0)){
|
|
|
+// if(qry2.value(1).toInt()==0)
|
|
|
+// pv="0";
|
|
|
+// else
|
|
|
+// pv="1";
|
|
|
+// }else{
|
|
|
+// if(qry2.value(1).toInt()==0)
|
|
|
+// pv="1";
|
|
|
+// else
|
|
|
+// pv="0";
|
|
|
+// }
|
|
|
+// if(count==0)
|
|
|
+// sql = QString("insert into sp_owner_sync_data (id, native_id, device_id, point_code, point_data, data_time, content) values (NULL,%1,'%2','%3','%4','%5','%6 %7')")
|
|
|
+// .arg(qry2.value(0).toUInt()).arg(devid).arg(qry2.value(3).toInt()).arg(pv)
|
|
|
+// .arg(qry2.value(7).isNull()?"1970-01-01 00:00:00":qry2.value(7).toDateTime().toString("yyyy-MM-dd HH:mm:ss"))
|
|
|
+// .arg(qry2.value(5).toString()).arg(qry2.value(6).toString());
|
|
|
+// else
|
|
|
+// sql += QString(", (NULL,%1,'%2','%3','%4','%5','%6 %7')")
|
|
|
+// .arg(qry2.value(0).toUInt()).arg(devid).arg(qry2.value(3).toInt()).arg(pv)
|
|
|
+// .arg(qry2.value(7).isNull()?"1970-01-01 00:00:00":qry2.value(7).toDateTime().toString("yyyy-MM-dd HH:mm:ss"))
|
|
|
+// .arg(qry2.value(5).toString()).arg(qry2.value(6).toString());
|
|
|
+// upsql = QString::fromUtf8("update sp_owner_status set point_data='%1', data_time='%2', content='%3 %4', point_name='%5',dwtype=%6 where device_id='%7' and point_code='%8';")
|
|
|
+// .arg(pv)
|
|
|
+// .arg(qry2.value(7).isNull()?"1970-01-01 00:00:00":qry2.value(7).toDateTime().toString("yyyy-MM-dd HH:mm:ss"))
|
|
|
+// .arg(qry2.value(5).toString()).arg(qry2.value(6).toString()).arg(pname)
|
|
|
+// .arg(6).arg(devid).arg(tmpIdx);
|
|
|
+// mdb.exec(upsql);
|
|
|
+// }
|
|
|
+// }else if(qry2.value(2).toString().compare("E6")==0){
|
|
|
+// if(count==0)
|
|
|
+// sql = QString("insert into sp_owner_sync_data (id, native_id, device_id, point_code, point_data, data_time, content) values (NULL,%1,'%2','%3','%4','%5','%6 %7')")
|
|
|
+// .arg(qry2.value(0).toUInt()).arg(devid).arg(qry2.value(3).toInt()+64).arg(qry2.value(8).toString())
|
|
|
+// .arg(qry2.value(7).isNull()?"1970-01-01 00:00:00":qry2.value(7).toDateTime().toString("yyyy-MM-dd HH:mm:ss"))
|
|
|
+// .arg(qry2.value(5).toString()).arg(qry2.value(6).toString());
|
|
|
+// else
|
|
|
+// sql += QString(", (NULL,%1,'%2','%3','%4','%5','%6 %7')")
|
|
|
+// .arg(qry2.value(0).toUInt()).arg(devid).arg(qry2.value(3).toInt()+64).arg(qry2.value(8).toString())
|
|
|
+// .arg(qry2.value(7).isNull()?"1970-01-01 00:00:00":qry2.value(7).toDateTime().toString("yyyy-MM-dd HH:mm:ss"))
|
|
|
+// .arg(qry2.value(5).toString()).arg(qry2.value(6).toString());
|
|
|
+// int tmpIdx = qry2.value(3).toInt();
|
|
|
+// if(tmpIdx>0){
|
|
|
+// QString pname = "";
|
|
|
+// for(int Idx=0;Idx<nameList.length();Idx++){
|
|
|
+// if((typeList.at(Idx)==2)&&(portList.at(Idx)==tmpIdx)){
|
|
|
+// pname = nameList.at(Idx);
|
|
|
+// break;
|
|
|
+// }
|
|
|
+// }
|
|
|
+// upsql = QString::fromUtf8("update sp_owner_status set point_data='%1', data_time='%2', content='%3 %4 %5',dwtype=%6 where device_id='%7' and point_code='%8';")
|
|
|
+// .arg(qry2.value(8).toString())
|
|
|
+// .arg(qry2.value(7).isNull()?"1970-01-01 00:00:00":qry2.value(7).toDateTime().toString("yyyy-MM-dd HH:mm:ss"))
|
|
|
+// .arg(pname).arg(qry2.value(5).toString())
|
|
|
+// .arg(qry2.value(6).toString())
|
|
|
+// .arg(6)
|
|
|
+// .arg(devid)
|
|
|
+// .arg(tmpIdx+64);
|
|
|
+// mdb.exec(upsql);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
count++;
|
|
|
sync_id = qry2.value(0).toUInt();
|
|
|
if(count>=100){
|
|
|
time_t tmp_time = time(static_cast<time_t *>(Q_NULLPTR));
|
|
|
ytShm->updatetime[DB_THREAD] = tmp_time;
|
|
|
- sql.append(";");
|
|
|
- mdb.exec(sql);
|
|
|
+// sql.append(";");
|
|
|
+// mdb.exec(sql);
|
|
|
mdb.exec(QString("update sp_owner_sync set sync_id=%1 where id=%2").arg(sync_id).arg(ID));
|
|
|
// mdb.exec(upsql);
|
|
|
count=0;
|
|
|
- sql="";
|
|
|
- upsql="";
|
|
|
+// sql="";
|
|
|
+// upsql="";
|
|
|
}
|
|
|
}
|
|
|
if(count>0){
|
|
|
time_t tmp_time = time(static_cast<time_t *>(Q_NULLPTR));
|
|
|
ytShm->updatetime[DB_THREAD] = tmp_time;
|
|
|
- sql.append(";");
|
|
|
- mdb.exec(sql);
|
|
|
+// sql.append(";");
|
|
|
+// mdb.exec(sql);
|
|
|
mdb.exec(QString("update sp_owner_sync set sync_id=%1 where id=%2").arg(sync_id).arg(ID));
|
|
|
// mdb.exec(upsql);
|
|
|
count=0;
|
|
|
- sql="";
|
|
|
- upsql="";
|
|
|
+// sql="";
|
|
|
+// upsql="";
|
|
|
}
|
|
|
return updated;
|
|
|
}
|
|
@@ -862,7 +871,7 @@ bool DB_SyncThread::videoalarmSync(QString devid, QString deviceCode, uint sync_
|
|
|
return updated;
|
|
|
}
|
|
|
|
|
|
-bool DB_SyncThread::efireInfoSync(QString devid, QString deviceCode, uint sync_id, QString tbname, QDate chkday, uint ID, QString companyCode)
|
|
|
+bool DB_SyncThread::efireInfoSync(QString devid, QString deviceCode, uint sync_id, QString tbname, QDate chkday, uint ID, QString companyCode, QString owner_xh)
|
|
|
{
|
|
|
QString upsql1, upsql2, upsql3, upsql4,upsql5,upsql6,sql;
|
|
|
int count=0;
|
|
@@ -887,41 +896,52 @@ bool DB_SyncThread::efireInfoSync(QString devid, QString deviceCode, uint sync_i
|
|
|
qry2.clear();
|
|
|
qry2 =mdb.exec(QString("select count(*) from sp_owner_status where device_id='%1'").arg(devid));
|
|
|
if(qry2.next()){
|
|
|
- if(qry2.value(0).toInt()==0){
|
|
|
- mdb.exec(QString::fromUtf8("insert into sp_owner_status (id, device_id, dwtype, point_name, point_code, point_data, data_time, content) values (NULL,'%1',7,'供电过压',1,0,'1970-01-01 08:00:00','')").arg(devid));
|
|
|
- mdb.exec(QString::fromUtf8("insert into sp_owner_status (id, device_id, dwtype, point_name, point_code, point_data, data_time, content) values (NULL,'%1',7,'供电低压',2,0,'1970-01-01 08:00:00','')").arg(devid));
|
|
|
- mdb.exec(QString::fromUtf8("insert into sp_owner_status (id, device_id, dwtype, point_name, point_code, point_data, data_time, content) values (NULL,'%1',7,'供电过流',3,0,'1970-01-01 08:00:00','')").arg(devid));
|
|
|
- mdb.exec(QString::fromUtf8("insert into sp_owner_status (id, device_id, dwtype, point_name, point_code, point_data, data_time, content) values (NULL,'%1',7,'漏电报警',4,0,'1970-01-01 08:00:00','')").arg(devid));
|
|
|
- mdb.exec(QString::fromUtf8("insert into sp_owner_status (id, device_id, dwtype, point_name, point_code, point_data, data_time, content) values (NULL,'%1',7,'A相线缆温度超高',5,0,'1970-01-01 08:00:00','')").arg(devid));
|
|
|
- mdb.exec(QString::fromUtf8("insert into sp_owner_status (id, device_id, dwtype, point_name, point_code, point_data, data_time, content) values (NULL,'%1',7,'B相线缆温度超高',6,0,'1970-01-01 08:00:00','')").arg(devid));
|
|
|
- mdb.exec(QString::fromUtf8("insert into sp_owner_status (id, device_id, dwtype, point_name, point_code, point_data, data_time, content) values (NULL,'%1',7,'C相线缆温度超高',7,0,'1970-01-01 08:00:00','')").arg(devid));
|
|
|
- mdb.exec(QString::fromUtf8("insert into sp_owner_status (id, device_id, dwtype, point_name, point_code, point_data, data_time, content) values (NULL,'%1',7,'A相电压',65,0,'1970-01-01 08:00:00','')").arg(devid));
|
|
|
- mdb.exec(QString::fromUtf8("insert into sp_owner_status (id, device_id, dwtype, point_name, point_code, point_data, data_time, content) values (NULL,'%1',7,'B相电压',66,0,'1970-01-01 08:00:00','')").arg(devid));
|
|
|
- mdb.exec(QString::fromUtf8("insert into sp_owner_status (id, device_id, dwtype, point_name, point_code, point_data, data_time, content) values (NULL,'%1',7,'C相电压',67,0,'1970-01-01 08:00:00','')").arg(devid));
|
|
|
- mdb.exec(QString::fromUtf8("insert into sp_owner_status (id, device_id, dwtype, point_name, point_code, point_data, data_time, content) values (NULL,'%1',7,'A相电流',68,0,'1970-01-01 08:00:00','')").arg(devid));
|
|
|
- mdb.exec(QString::fromUtf8("insert into sp_owner_status (id, device_id, dwtype, point_name, point_code, point_data, data_time, content) values (NULL,'%1',7,'B相电流',69,0,'1970-01-01 08:00:00','')").arg(devid));
|
|
|
- mdb.exec(QString::fromUtf8("insert into sp_owner_status (id, device_id, dwtype, point_name, point_code, point_data, data_time, content) values (NULL,'%1',7,'C相电流',70,0,'1970-01-01 08:00:00','')").arg(devid));
|
|
|
- mdb.exec(QString::fromUtf8("insert into sp_owner_status (id, device_id, dwtype, point_name, point_code, point_data, data_time, content) values (NULL,'%1',7,'A相线缆温度',71,0,'1970-01-01 08:00:00','')").arg(devid));
|
|
|
- mdb.exec(QString::fromUtf8("insert into sp_owner_status (id, device_id, dwtype, point_name, point_code, point_data, data_time, content) values (NULL,'%1',7,'B相线缆温度',72,0,'1970-01-01 08:00:00','')").arg(devid));
|
|
|
- mdb.exec(QString::fromUtf8("insert into sp_owner_status (id, device_id, dwtype, point_name, point_code, point_data, data_time, content) values (NULL,'%1',7,'C相线缆温度',73,0,'1970-01-01 08:00:00','')").arg(devid));
|
|
|
- }else if(qry2.value(0).toInt()==6){
|
|
|
- mdb.exec(QString::fromUtf8("delete from sp_owner_status where device_id='%1'").arg(devid));
|
|
|
- mdb.exec(QString::fromUtf8("insert into sp_owner_status (id, device_id, dwtype, point_name, point_code, point_data, data_time, content) values (NULL,'%1',7,'供电过压',1,0,'1970-01-01 08:00:00','')").arg(devid));
|
|
|
- mdb.exec(QString::fromUtf8("insert into sp_owner_status (id, device_id, dwtype, point_name, point_code, point_data, data_time, content) values (NULL,'%1',7,'供电低压',2,0,'1970-01-01 08:00:00','')").arg(devid));
|
|
|
- mdb.exec(QString::fromUtf8("insert into sp_owner_status (id, device_id, dwtype, point_name, point_code, point_data, data_time, content) values (NULL,'%1',7,'供电过流',3,0,'1970-01-01 08:00:00','')").arg(devid));
|
|
|
- mdb.exec(QString::fromUtf8("insert into sp_owner_status (id, device_id, dwtype, point_name, point_code, point_data, data_time, content) values (NULL,'%1',7,'漏电报警',4,0,'1970-01-01 08:00:00','')").arg(devid));
|
|
|
- mdb.exec(QString::fromUtf8("insert into sp_owner_status (id, device_id, dwtype, point_name, point_code, point_data, data_time, content) values (NULL,'%1',7,'A相线缆温度超高',5,0,'1970-01-01 08:00:00','')").arg(devid));
|
|
|
- mdb.exec(QString::fromUtf8("insert into sp_owner_status (id, device_id, dwtype, point_name, point_code, point_data, data_time, content) values (NULL,'%1',7,'B相线缆温度超高',6,0,'1970-01-01 08:00:00','')").arg(devid));
|
|
|
- mdb.exec(QString::fromUtf8("insert into sp_owner_status (id, device_id, dwtype, point_name, point_code, point_data, data_time, content) values (NULL,'%1',7,'C相线缆温度超高',7,0,'1970-01-01 08:00:00','')").arg(devid));
|
|
|
- mdb.exec(QString::fromUtf8("insert into sp_owner_status (id, device_id, dwtype, point_name, point_code, point_data, data_time, content) values (NULL,'%1',7,'A相电压',65,0,'1970-01-01 08:00:00','')").arg(devid));
|
|
|
- mdb.exec(QString::fromUtf8("insert into sp_owner_status (id, device_id, dwtype, point_name, point_code, point_data, data_time, content) values (NULL,'%1',7,'B相电压',66,0,'1970-01-01 08:00:00','')").arg(devid));
|
|
|
- mdb.exec(QString::fromUtf8("insert into sp_owner_status (id, device_id, dwtype, point_name, point_code, point_data, data_time, content) values (NULL,'%1',7,'C相电压',67,0,'1970-01-01 08:00:00','')").arg(devid));
|
|
|
- mdb.exec(QString::fromUtf8("insert into sp_owner_status (id, device_id, dwtype, point_name, point_code, point_data, data_time, content) values (NULL,'%1',7,'A相电流',68,0,'1970-01-01 08:00:00','')").arg(devid));
|
|
|
- mdb.exec(QString::fromUtf8("insert into sp_owner_status (id, device_id, dwtype, point_name, point_code, point_data, data_time, content) values (NULL,'%1',7,'B相电流',69,0,'1970-01-01 08:00:00','')").arg(devid));
|
|
|
- mdb.exec(QString::fromUtf8("insert into sp_owner_status (id, device_id, dwtype, point_name, point_code, point_data, data_time, content) values (NULL,'%1',7,'C相电流',70,0,'1970-01-01 08:00:00','')").arg(devid));
|
|
|
- mdb.exec(QString::fromUtf8("insert into sp_owner_status (id, device_id, dwtype, point_name, point_code, point_data, data_time, content) values (NULL,'%1',7,'A相线缆温度',71,0,'1970-01-01 08:00:00','')").arg(devid));
|
|
|
- mdb.exec(QString::fromUtf8("insert into sp_owner_status (id, device_id, dwtype, point_name, point_code, point_data, data_time, content) values (NULL,'%1',7,'B相线缆温度',72,0,'1970-01-01 08:00:00','')").arg(devid));
|
|
|
- mdb.exec(QString::fromUtf8("insert into sp_owner_status (id, device_id, dwtype, point_name, point_code, point_data, data_time, content) values (NULL,'%1',7,'C相线缆温度',73,0,'1970-01-01 08:00:00','')").arg(devid));
|
|
|
+
|
|
|
+ if(owner_xh.compare("ARCM300D")==0){
|
|
|
+ mdb.exec(QString::fromUtf8("delete from sp_owner_status where device_id='%1'").arg(devid));
|
|
|
+ mdb.exec(QString::fromUtf8("insert into sp_owner_status (id, device_id, dwtype, point_name, point_code, point_data, data_time, content) values (NULL,'%1',7,'供电过压',1,0,'1970-01-01 08:00:00','')").arg(devid));
|
|
|
+ mdb.exec(QString::fromUtf8("insert into sp_owner_status (id, device_id, dwtype, point_name, point_code, point_data, data_time, content) values (NULL,'%1',7,'供电低压',2,0,'1970-01-01 08:00:00','')").arg(devid));
|
|
|
+ mdb.exec(QString::fromUtf8("insert into sp_owner_status (id, device_id, dwtype, point_name, point_code, point_data, data_time, content) values (NULL,'%1',7,'供电过流',3,0,'1970-01-01 08:00:00','')").arg(devid));
|
|
|
+ mdb.exec(QString::fromUtf8("insert into sp_owner_status (id, device_id, dwtype, point_name, point_code, point_data, data_time, content) values (NULL,'%1',7,'电压',65,0,'1970-01-01 08:00:00','')").arg(devid));
|
|
|
+ mdb.exec(QString::fromUtf8("insert into sp_owner_status (id, device_id, dwtype, point_name, point_code, point_data, data_time, content) values (NULL,'%1',7,'电流',68,0,'1970-01-01 08:00:00','')").arg(devid));
|
|
|
+ mdb.exec(QString::fromUtf8("insert into sp_owner_status (id, device_id, dwtype, point_name, point_code, point_data, data_time, content) values (NULL,'%1',7,'电能',71,0,'1970-01-01 08:00:00','')").arg(devid));
|
|
|
+ }else{
|
|
|
+ if(qry2.value(0).toInt()==0){
|
|
|
+ mdb.exec(QString::fromUtf8("insert into sp_owner_status (id, device_id, dwtype, point_name, point_code, point_data, data_time, content) values (NULL,'%1',7,'供电过压',1,0,'1970-01-01 08:00:00','')").arg(devid));
|
|
|
+ mdb.exec(QString::fromUtf8("insert into sp_owner_status (id, device_id, dwtype, point_name, point_code, point_data, data_time, content) values (NULL,'%1',7,'供电低压',2,0,'1970-01-01 08:00:00','')").arg(devid));
|
|
|
+ mdb.exec(QString::fromUtf8("insert into sp_owner_status (id, device_id, dwtype, point_name, point_code, point_data, data_time, content) values (NULL,'%1',7,'供电过流',3,0,'1970-01-01 08:00:00','')").arg(devid));
|
|
|
+ mdb.exec(QString::fromUtf8("insert into sp_owner_status (id, device_id, dwtype, point_name, point_code, point_data, data_time, content) values (NULL,'%1',7,'漏电报警',4,0,'1970-01-01 08:00:00','')").arg(devid));
|
|
|
+ mdb.exec(QString::fromUtf8("insert into sp_owner_status (id, device_id, dwtype, point_name, point_code, point_data, data_time, content) values (NULL,'%1',7,'A相线缆温度超高',5,0,'1970-01-01 08:00:00','')").arg(devid));
|
|
|
+ mdb.exec(QString::fromUtf8("insert into sp_owner_status (id, device_id, dwtype, point_name, point_code, point_data, data_time, content) values (NULL,'%1',7,'B相线缆温度超高',6,0,'1970-01-01 08:00:00','')").arg(devid));
|
|
|
+ mdb.exec(QString::fromUtf8("insert into sp_owner_status (id, device_id, dwtype, point_name, point_code, point_data, data_time, content) values (NULL,'%1',7,'C相线缆温度超高',7,0,'1970-01-01 08:00:00','')").arg(devid));
|
|
|
+ mdb.exec(QString::fromUtf8("insert into sp_owner_status (id, device_id, dwtype, point_name, point_code, point_data, data_time, content) values (NULL,'%1',7,'A相电压',65,0,'1970-01-01 08:00:00','')").arg(devid));
|
|
|
+ mdb.exec(QString::fromUtf8("insert into sp_owner_status (id, device_id, dwtype, point_name, point_code, point_data, data_time, content) values (NULL,'%1',7,'B相电压',66,0,'1970-01-01 08:00:00','')").arg(devid));
|
|
|
+ mdb.exec(QString::fromUtf8("insert into sp_owner_status (id, device_id, dwtype, point_name, point_code, point_data, data_time, content) values (NULL,'%1',7,'C相电压',67,0,'1970-01-01 08:00:00','')").arg(devid));
|
|
|
+ mdb.exec(QString::fromUtf8("insert into sp_owner_status (id, device_id, dwtype, point_name, point_code, point_data, data_time, content) values (NULL,'%1',7,'A相电流',68,0,'1970-01-01 08:00:00','')").arg(devid));
|
|
|
+ mdb.exec(QString::fromUtf8("insert into sp_owner_status (id, device_id, dwtype, point_name, point_code, point_data, data_time, content) values (NULL,'%1',7,'B相电流',69,0,'1970-01-01 08:00:00','')").arg(devid));
|
|
|
+ mdb.exec(QString::fromUtf8("insert into sp_owner_status (id, device_id, dwtype, point_name, point_code, point_data, data_time, content) values (NULL,'%1',7,'C相电流',70,0,'1970-01-01 08:00:00','')").arg(devid));
|
|
|
+ mdb.exec(QString::fromUtf8("insert into sp_owner_status (id, device_id, dwtype, point_name, point_code, point_data, data_time, content) values (NULL,'%1',7,'A相线缆温度',71,0,'1970-01-01 08:00:00','')").arg(devid));
|
|
|
+ mdb.exec(QString::fromUtf8("insert into sp_owner_status (id, device_id, dwtype, point_name, point_code, point_data, data_time, content) values (NULL,'%1',7,'B相线缆温度',72,0,'1970-01-01 08:00:00','')").arg(devid));
|
|
|
+ mdb.exec(QString::fromUtf8("insert into sp_owner_status (id, device_id, dwtype, point_name, point_code, point_data, data_time, content) values (NULL,'%1',7,'C相线缆温度',73,0,'1970-01-01 08:00:00','')").arg(devid));
|
|
|
+ }else if(qry2.value(0).toInt()==6){
|
|
|
+ mdb.exec(QString::fromUtf8("delete from sp_owner_status where device_id='%1'").arg(devid));
|
|
|
+ mdb.exec(QString::fromUtf8("insert into sp_owner_status (id, device_id, dwtype, point_name, point_code, point_data, data_time, content) values (NULL,'%1',7,'供电过压',1,0,'1970-01-01 08:00:00','')").arg(devid));
|
|
|
+ mdb.exec(QString::fromUtf8("insert into sp_owner_status (id, device_id, dwtype, point_name, point_code, point_data, data_time, content) values (NULL,'%1',7,'供电低压',2,0,'1970-01-01 08:00:00','')").arg(devid));
|
|
|
+ mdb.exec(QString::fromUtf8("insert into sp_owner_status (id, device_id, dwtype, point_name, point_code, point_data, data_time, content) values (NULL,'%1',7,'供电过流',3,0,'1970-01-01 08:00:00','')").arg(devid));
|
|
|
+ mdb.exec(QString::fromUtf8("insert into sp_owner_status (id, device_id, dwtype, point_name, point_code, point_data, data_time, content) values (NULL,'%1',7,'漏电报警',4,0,'1970-01-01 08:00:00','')").arg(devid));
|
|
|
+ mdb.exec(QString::fromUtf8("insert into sp_owner_status (id, device_id, dwtype, point_name, point_code, point_data, data_time, content) values (NULL,'%1',7,'A相线缆温度超高',5,0,'1970-01-01 08:00:00','')").arg(devid));
|
|
|
+ mdb.exec(QString::fromUtf8("insert into sp_owner_status (id, device_id, dwtype, point_name, point_code, point_data, data_time, content) values (NULL,'%1',7,'B相线缆温度超高',6,0,'1970-01-01 08:00:00','')").arg(devid));
|
|
|
+ mdb.exec(QString::fromUtf8("insert into sp_owner_status (id, device_id, dwtype, point_name, point_code, point_data, data_time, content) values (NULL,'%1',7,'C相线缆温度超高',7,0,'1970-01-01 08:00:00','')").arg(devid));
|
|
|
+ mdb.exec(QString::fromUtf8("insert into sp_owner_status (id, device_id, dwtype, point_name, point_code, point_data, data_time, content) values (NULL,'%1',7,'A相电压',65,0,'1970-01-01 08:00:00','')").arg(devid));
|
|
|
+ mdb.exec(QString::fromUtf8("insert into sp_owner_status (id, device_id, dwtype, point_name, point_code, point_data, data_time, content) values (NULL,'%1',7,'B相电压',66,0,'1970-01-01 08:00:00','')").arg(devid));
|
|
|
+ mdb.exec(QString::fromUtf8("insert into sp_owner_status (id, device_id, dwtype, point_name, point_code, point_data, data_time, content) values (NULL,'%1',7,'C相电压',67,0,'1970-01-01 08:00:00','')").arg(devid));
|
|
|
+ mdb.exec(QString::fromUtf8("insert into sp_owner_status (id, device_id, dwtype, point_name, point_code, point_data, data_time, content) values (NULL,'%1',7,'A相电流',68,0,'1970-01-01 08:00:00','')").arg(devid));
|
|
|
+ mdb.exec(QString::fromUtf8("insert into sp_owner_status (id, device_id, dwtype, point_name, point_code, point_data, data_time, content) values (NULL,'%1',7,'B相电流',69,0,'1970-01-01 08:00:00','')").arg(devid));
|
|
|
+ mdb.exec(QString::fromUtf8("insert into sp_owner_status (id, device_id, dwtype, point_name, point_code, point_data, data_time, content) values (NULL,'%1',7,'C相电流',70,0,'1970-01-01 08:00:00','')").arg(devid));
|
|
|
+ mdb.exec(QString::fromUtf8("insert into sp_owner_status (id, device_id, dwtype, point_name, point_code, point_data, data_time, content) values (NULL,'%1',7,'A相线缆温度',71,0,'1970-01-01 08:00:00','')").arg(devid));
|
|
|
+ mdb.exec(QString::fromUtf8("insert into sp_owner_status (id, device_id, dwtype, point_name, point_code, point_data, data_time, content) values (NULL,'%1',7,'B相线缆温度',72,0,'1970-01-01 08:00:00','')").arg(devid));
|
|
|
+ mdb.exec(QString::fromUtf8("insert into sp_owner_status (id, device_id, dwtype, point_name, point_code, point_data, data_time, content) values (NULL,'%1',7,'C相线缆温度',73,0,'1970-01-01 08:00:00','')").arg(devid));
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
qry2.clear();
|
|
@@ -1564,7 +1584,7 @@ void DB_SyncThread::time_out()
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- if(((times++)&0x0f)==0x0f){
|
|
|
+ if(((times++)&0x0f)==0x0f){//智慧大屏
|
|
|
UpdateTime = QDateTime::currentDateTime().toTime_t();
|
|
|
checkUsers();
|
|
|
checkCompany();
|
|
@@ -1607,7 +1627,7 @@ void DB_SyncThread::time_out()
|
|
|
pcList.append(qry2.value(1).toInt());
|
|
|
}
|
|
|
qry2.clear();
|
|
|
- qry = mdb.exec("select id, owner_code, owner_name, unitinfo, install_time, dwtype, company, rtmp from sp_owner");
|
|
|
+ qry = mdb.exec("select id, owner_code, owner_name, unitinfo, install_time, dwtype, company, rtmp, owner_xh from sp_owner");
|
|
|
while(qry.next())
|
|
|
{
|
|
|
time_t tmp_time = time(static_cast<time_t *>(Q_NULLPTR));
|
|
@@ -1659,7 +1679,7 @@ void DB_SyncThread::time_out()
|
|
|
need_sync = rtuInfoSync(qry.value(1).toString(),deviceCode,sync_id,tbname,chkday,ID,companyCode);
|
|
|
break;
|
|
|
case 7:
|
|
|
- need_sync = efireInfoSync(qry.value(1).toString(),deviceCode,sync_id,tbname,chkday,ID,companyCode);
|
|
|
+ need_sync = efireInfoSync(qry.value(1).toString(),deviceCode,sync_id,tbname,chkday,ID,companyCode,qry.value(8).toString());
|
|
|
break;
|
|
|
case 16:
|
|
|
need_sync = videoalarmSync(qry.value(1).toString(),deviceCode,sync_id,tbname,chkday,ID,companyCode);
|