Compare commits
16 Commits
c914e43cea
...
894a563ff8
| Author | SHA1 | Date | |
|---|---|---|---|
| 894a563ff8 | |||
| edc5e4d793 | |||
| 6263b93ee9 | |||
| 892f43fb29 | |||
| 9bd0dc64e9 | |||
| 113acbdb29 | |||
| d3f7ad5615 | |||
| 51cd80cda1 | |||
| e67a50b489 | |||
| 540fa39190 | |||
| 4cd084a0ce | |||
| f9db725e20 | |||
| a40664a57b | |||
| 39de80586d | |||
| d76ec6e50b | |||
| 8085a2875b |
1
.gitignore
vendored
1
.gitignore
vendored
@ -55,3 +55,4 @@ deploy/
|
||||
|
||||
|
||||
realtimeform - 副本.cpp
|
||||
realtimeform22.cpp
|
||||
|
||||
@ -76,7 +76,7 @@ void CAddChannel::on_comboBox_channel_currentTextChanged(const QString &arg1)
|
||||
ui->comboBox_charac->addItem("推导峰值");
|
||||
ui->comboBox_charac->addItem("峰值");
|
||||
ui->comboBox_charac->addItem("速度峰值");
|
||||
ui->comboBox_charac->addItem("速度有效值");
|
||||
ui->comboBox_charac->addItem("积分有效值");
|
||||
ui->comboBox_charac->addItem("峰值因子");
|
||||
}else if(g_ChannelBaseInfo[i].channelType == "VELOCITY"){
|
||||
|
||||
|
||||
@ -63,7 +63,7 @@ CChannelSetting::CChannelSetting(QWidget *parent) :
|
||||
ui->channelTypeCombox->addItems(ChannelTypeList);
|
||||
m_itemList << "是" << "否" ;
|
||||
|
||||
m_DisPlayerList << "峰峰值" << "有效值" << "峰值" <<"平均值";
|
||||
m_DisPlayerList << "峰峰值" << "有效值" << "峰值" <<"平均值" << "诊断峰峰值" << "积分有效值";
|
||||
ui->comboBox_sensorICP->addItems(m_itemList);
|
||||
ui->comboBox_defaultDisplay->clear();
|
||||
ui->comboBox_defaultDisplay->addItems(m_DisPlayerList);
|
||||
|
||||
@ -72,15 +72,27 @@ void CCharacteristicList::DisPlayCharacteristic()
|
||||
model->setData(model->index(j,0,QModelIndex()),g_Charateristic[j].ChannelName);
|
||||
model->setData(model->index(j,1,QModelIndex()),g_Charateristic[j].SensorEngineeringUnit);
|
||||
if(g_ChannelBaseInfo[i].defaultDisplay == "峰峰值"){
|
||||
if(g_ChannelBaseInfo[i].channelType == "PULSE_CURRENT" && g_Charateristic[j].DiagnosisPk2Pk < 0.9 && g_Charateristic[j].DiagnosisPk2Pk > 0.4){
|
||||
model->setData(model->index(j,2,QModelIndex()),"0.0");
|
||||
}else{
|
||||
model->setData(model->index(j,2,QModelIndex()),QString::number(g_Charateristic[j].DiagnosisPk2Pk,'f',g_Charateristic[j].ChUnitDot));
|
||||
}
|
||||
}else if(g_ChannelBaseInfo[i].defaultDisplay == "有效值"){
|
||||
model->setData(model->index(j,2,QModelIndex()),QString::number(g_Charateristic[j].RMSValues,'f',g_Charateristic[j].ChUnitDot));
|
||||
}else if(g_ChannelBaseInfo[i].defaultDisplay == "峰值"){
|
||||
model->setData(model->index(j,2,QModelIndex()),QString::number(g_Charateristic[j].DiagnosisPeak,'f',g_Charateristic[j].ChUnitDot));
|
||||
}else if(g_ChannelBaseInfo[i].defaultDisplay == "平均值"){
|
||||
if(g_ChannelBaseInfo[i].channelType == "PULSE_CURRENT" && g_Charateristic[j].DCValues < 0.9 && g_Charateristic[j].DCValues > 0.4){
|
||||
model->setData(model->index(j,2,QModelIndex()),"0.0");
|
||||
}else{
|
||||
model->setData(model->index(j,2,QModelIndex()),QString::number(g_Charateristic[j].DCValues,'f',g_Charateristic[j].ChUnitDot));
|
||||
}
|
||||
}else if(g_ChannelBaseInfo[i].defaultDisplay == "转速"){
|
||||
model->setData(model->index(j,2,QModelIndex()),QString::number(g_Charateristic[j].speedRPM,'f',g_Charateristic[j].ChUnitDot));
|
||||
}else if(g_ChannelBaseInfo[i].defaultDisplay == "诊断峰峰值"){
|
||||
model->setData(model->index(j,2,QModelIndex()),QString::number(g_Charateristic[j].DiagnosisPk2Pk,'f',g_Charateristic[j].ChUnitDot));
|
||||
}else if(g_ChannelBaseInfo[i].defaultDisplay == "积分有效值"){
|
||||
model->setData(model->index(j,2,QModelIndex()),QString::number(g_Charateristic[j].IntegratRMS,'f',g_Charateristic[j].ChUnitDot));
|
||||
}
|
||||
if(g_ChannelBaseInfo[i].boardType == "5"){
|
||||
model->setData(model->index(j,2,QModelIndex()),QString::number(g_Charateristic[j].DCValues,'f',g_Charateristic[j].ChUnitDot));
|
||||
@ -88,7 +100,14 @@ void CCharacteristicList::DisPlayCharacteristic()
|
||||
model->setData(model->index(j,3,QModelIndex()),QString::number(g_Charateristic[j].DiagnosisPk2Pk,'f',g_Charateristic[j].ChUnitDot));
|
||||
model->setData(model->index(j,4,QModelIndex()),g_Charateristic[j].InvertDanger);
|
||||
model->setData(model->index(j,5,QModelIndex()),g_Charateristic[j].InvertAlarm);
|
||||
if(g_ChannelBaseInfo[i].channelType == "PULSE_CURRENT" && g_Charateristic[j].xFullScalePosition < 0.9 && g_Charateristic[j].xFullScalePosition > 0.4){
|
||||
model->setData(model->index(j,6,QModelIndex()),g_Charateristic[j].xFullScalePosition);
|
||||
model->setData(model->index(j,6,QModelIndex()),"0.0");
|
||||
|
||||
}else{
|
||||
model->setData(model->index(j,6,QModelIndex()),g_Charateristic[j].xFullScalePosition);
|
||||
}
|
||||
|
||||
model->setData(model->index(j,7,QModelIndex()),QString::number(g_Charateristic[j].Gap,'f',g_Charateristic[j].ChUnitDot));
|
||||
model->setData(model->index(j,8,QModelIndex()),g_Charateristic[j].ZeroScalePosition);
|
||||
model->setData(model->index(j,9,QModelIndex()),g_Charateristic[j].SensorStatus);
|
||||
|
||||
@ -31,6 +31,7 @@ CConfiguration::CConfiguration(QWidget *parent) :
|
||||
pHeader2->setSectionResizeMode(QHeaderView::ResizeToContents);
|
||||
pHeader2->setStretchLastSection(false);
|
||||
|
||||
|
||||
ui->treeView_Available->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
||||
ui->treeView_Relay->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
||||
connect(ui->comboBox_WC,SIGNAL(currentTextChanged(const QString &)),this,SLOT(on_comboBox_WC_currentTextChanged2(const QString&)));
|
||||
@ -291,7 +292,6 @@ void CConfiguration::slotDeleteItem()
|
||||
}
|
||||
}
|
||||
jsonObj["channelOperate"] = 3;
|
||||
|
||||
QJsonDocument doc(jsonObj);
|
||||
QString strJson(doc.toJson(QJsonDocument::Compact));
|
||||
QString strSql = QString(" values('%1','%2','%3','%4','%5',3)").arg(SN).arg(ChannelId).arg(BoardNo).arg(ChannelNoInBoard).arg(strJson);
|
||||
@ -349,23 +349,116 @@ void CConfiguration::on_treeView_Relay_customContextMenuRequested(const QPoint &
|
||||
menu.exec(QCursor::pos()); //显示菜单
|
||||
}
|
||||
|
||||
// 递归遍历 QTreeView 的节点,构建 JSON 结构
|
||||
QJsonObject CConfiguration::createJsonFromTreeNode(QStandardItem *item) {
|
||||
QJsonObject nodeObject,inputNodeObj;
|
||||
QJsonArray inputNodeArray;
|
||||
|
||||
// 根据节点的类型判断是 logicOR、logicAND 还是叶子节点
|
||||
QString nodeType = item->text();
|
||||
if (nodeType.contains("logicOR") || nodeType.contains("logicAND")){
|
||||
QJsonArray childrenArray;
|
||||
|
||||
// 遍历子节点
|
||||
for (int i = 0; i < item->rowCount(); ++i) {
|
||||
QStandardItem *childItem = item->child(i);
|
||||
childrenArray.append(createJsonFromTreeNode(childItem));
|
||||
}
|
||||
// 添加 Combination 节点
|
||||
QJsonObject combination;
|
||||
int MinimumNumber = item->data(Qt::UserRole + 1).toInt();
|
||||
if(nodeType.contains("logicOR"))
|
||||
combination["MinimumNumber"] = 1;
|
||||
else if(nodeType.contains("logicAND"))
|
||||
combination["MinimumNumber"] = MinimumNumber;
|
||||
inputNodeObj["Combination"] = combination;
|
||||
// 将子节点数组存储在当前逻辑运算符节点下
|
||||
inputNodeObj["Inputs"] = childrenArray;
|
||||
inputNodeArray.append(inputNodeObj);
|
||||
if(nodeType.contains("logicOR"))
|
||||
nodeObject[nodeType] = inputNodeArray;
|
||||
else if(nodeType.contains("logicAND"))
|
||||
nodeObject[nodeType.left(nodeType.length()-3)] = inputNodeArray;
|
||||
|
||||
} else {
|
||||
if(item->text().contains("警报")){
|
||||
nodeObject["alarm"] = 1;
|
||||
nodeObject["danger"] = 0;
|
||||
}else if (item->text().contains("危险")) {
|
||||
nodeObject["danger"] = 1;
|
||||
nodeObject["alarm"] = 0;
|
||||
}
|
||||
nodeObject["triggerFeatureName"] = item->text();
|
||||
nodeObject["nodeType"] = 1;
|
||||
nodeObject["displayTitle"] = item->text();
|
||||
for (int k = 0;k < g_ChannelBaseInfo.size(); k++) {
|
||||
if(g_ChannelBaseInfo[k].channelName == item->text().split("-")[0]){
|
||||
nodeObject["channelId"] = g_ChannelBaseInfo[k].channelID;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nodeObject;
|
||||
}
|
||||
// 将生成的 JSON 保存到文件
|
||||
void CConfiguration::saveJsonToFile(const QJsonObject &jsonObject, const QString &filePath) {
|
||||
QJsonDocument jsonDoc(jsonObject);
|
||||
QFile file(filePath);
|
||||
if (file.open(QIODevice::WriteOnly)) {
|
||||
file.write(jsonDoc.toJson(QJsonDocument::Indented));
|
||||
file.close();
|
||||
qDebug() << "JSON 文件已生成:" << filePath;
|
||||
} else {
|
||||
qDebug() << "无法打开文件以保存 JSON 数据";
|
||||
}
|
||||
}
|
||||
// 从 QTreeView 中生成 JSON 数据
|
||||
QJsonObject CConfiguration::generateJsonFromTreeView(QTreeView *treeView) {
|
||||
QStandardItemModel *model = qobject_cast<QStandardItemModel *>(treeView->model());
|
||||
if (!model) return QJsonObject();
|
||||
|
||||
QJsonArray rootArray;
|
||||
|
||||
// 遍历模型的每个根节点
|
||||
for (int i = 0; i < model->rowCount(); ++i) {
|
||||
QStandardItem *rootItem = model->item(i);
|
||||
rootArray.append(createJsonFromTreeNode(rootItem));
|
||||
}
|
||||
|
||||
QJsonObject root;
|
||||
root["logicTree"] = rootArray; // 顶层使用 "logicTree" 作为键
|
||||
return root;
|
||||
}
|
||||
QJsonArray CConfiguration::GetItem(QStandardItem *item,int MinimumNumber)
|
||||
{
|
||||
QJsonArray arrayAll,arrayAll2;
|
||||
QJsonObject jsonObj,inputObj,inputObj2,MinimumNumberObj;
|
||||
QJsonArray arrjsonObjLogic,arrjsonObjLogic2;
|
||||
QString strLogic;
|
||||
QJsonArray ret;
|
||||
QJsonArray arrItem;
|
||||
QJsonObject logicObj,logicInputs;
|
||||
QJsonArray tmplogic ;
|
||||
if(item->hasChildren())
|
||||
{
|
||||
for(int i = 0;i < item->rowCount() ;i++)
|
||||
{
|
||||
QJsonArray array;
|
||||
QStandardItem * childitem = item->child(i);
|
||||
strLogic = childitem->text();
|
||||
if(childitem->text().contains("logicOR") || childitem->text().contains("logicAND")){
|
||||
QJsonObject inputObj,logic_inputObj,inputObj2,jsonObj,MinimumNumberObj;
|
||||
QJsonObject jsonObjLogic,jsonObjLogic2;
|
||||
QJsonArray array,arrayAll,logic_arrayAll,arrayAll2;
|
||||
QJsonArray inputArray,inputArray2;
|
||||
QStandardItem * childitem = item->child(i);
|
||||
strLogic = item->text();
|
||||
if(childitem->text().contains("logicOR") || childitem->text().contains("logicAND")){
|
||||
if(childitem->hasChildren()){
|
||||
for(int i = 0;i < childitem->rowCount() ;i++){
|
||||
QStandardItem * childitem2 = childitem->child(i);
|
||||
arrItem = GetItem(childitem, MinimumNumber);
|
||||
qDebug() << "m_array0" << arrItem << endl;
|
||||
}else{
|
||||
QMessageBox::question(this, QStringLiteral("提示"), QStringLiteral("请选择正确的逻辑!"));
|
||||
return arrayAll;
|
||||
}
|
||||
}else{
|
||||
for(int i = 0;i < item->rowCount() ;i++){
|
||||
QStandardItem * childitem2 = item->child(i);
|
||||
if(childitem2->text().contains("警报")){
|
||||
jsonObj["alarm"] = 1;
|
||||
jsonObj["danger"] = 0;
|
||||
@ -382,15 +475,9 @@ QJsonArray CConfiguration::GetItem(QStandardItem *item,int MinimumNumber)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
inputArray.append(jsonObj);
|
||||
inputArray2.append(jsonObj);
|
||||
}
|
||||
}else{
|
||||
QMessageBox::question(this, QStringLiteral("提示"), QStringLiteral("请选择正确的逻辑!"));
|
||||
return arrayAll;
|
||||
}
|
||||
|
||||
QString strTableName = " t_UnitConfiguration ";
|
||||
QVector<UnitConfiguration_t> vecUnitConfiguration = g_SqliteDB->GetUnitConfigurationInfo(strTableName);
|
||||
for (int i = 0; i < vecUnitConfiguration.size(); i++) {
|
||||
@ -410,19 +497,43 @@ QJsonArray CConfiguration::GetItem(QStandardItem *item,int MinimumNumber)
|
||||
inputObj2["Combination"] = MinimumNumberObj;
|
||||
arrayAll.append(inputObj);
|
||||
arrayAll2.append(inputObj2);
|
||||
qDebug() << "arrayAll==========" << arrayAll << endl;
|
||||
qDebug() << "strLogic" << strLogic.left(strLogic.length()-3) << endl;
|
||||
jsonObjLogic[strLogic.left(strLogic.length()-3)] = arrayAll;
|
||||
jsonObjLogic2[strLogic.left(strLogic.length()-3)] = arrayAll2;
|
||||
arrjsonObjLogic.append(jsonObjLogic);
|
||||
arrjsonObjLogic2.append(jsonObjLogic2);
|
||||
}
|
||||
if((childitem->text().contains("logicOR") || childitem->text().contains("logicAND")) && item->parent()){
|
||||
logicObj[strLogic] = arrItem;
|
||||
qDebug() << "logicObj123" << logicObj << endl;
|
||||
tmplogic.append(logicObj);
|
||||
qDebug() << "tmplogic123" << tmplogic << endl;
|
||||
}
|
||||
if(!item->parent() && i + 1 == item->rowCount())
|
||||
{
|
||||
qDebug() << "No parent" << item->text() << endl;
|
||||
qDebug() << "m_array1" << arrItem << endl;
|
||||
return arrItem;
|
||||
}else if(item->parent() && i + 1 == item->rowCount()){
|
||||
qDebug() << "parent" << item->text() << endl;
|
||||
MinimumNumberObj["MinimumNumber"] = 1;
|
||||
logic_inputObj["Combination"] = MinimumNumberObj;
|
||||
if(childitem->text().contains("logicOR") || childitem->text().contains("logicAND")){
|
||||
logic_inputObj["Inputs"] = tmplogic;
|
||||
}else{
|
||||
logic_inputObj["Inputs"] = arrjsonObjLogic;
|
||||
}
|
||||
logic_arrayAll.append(logic_inputObj);
|
||||
qDebug() << "arrayAll111" << logic_arrayAll << endl;
|
||||
return logic_arrayAll;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
QJsonObject jsonObjLogic,jsonObjLogic2;
|
||||
qDebug() << "strLogic" << strLogic.left(strLogic.length()-3) << endl;
|
||||
jsonObjLogic[strLogic.left(strLogic.length()-3)] = arrayAll;
|
||||
jsonObjLogic2[strLogic.left(strLogic.length()-3)] = arrayAll2;
|
||||
QJsonArray ret;
|
||||
ret.append(jsonObjLogic);
|
||||
m_deleteInputArray.append(jsonObjLogic2);
|
||||
qDebug() << "m_array" << ret << endl;
|
||||
return ret;
|
||||
m_deleteInputArray.append(arrjsonObjLogic2);
|
||||
qDebug() << "m_array2" << arrItem << endl;
|
||||
return arrItem;
|
||||
|
||||
|
||||
// QJsonArray arrayAll,inputArray;
|
||||
@ -574,22 +685,36 @@ void CConfiguration::on_pushButton_confirm_clicked()
|
||||
QMessageBox::information(this, QStringLiteral("提示"), QStringLiteral("请选择正确的组态逻辑"));
|
||||
return;
|
||||
}
|
||||
for(int i = 0;i < model_Relay->rowCount() ;i++)
|
||||
{
|
||||
QStandardItem *item = model_Relay->item(i);
|
||||
qDebug() <<"item = " << item->text();
|
||||
QJsonArray arrayAll = GetItem(model_Relay->item(i));
|
||||
if(arrayAll.size() < 1)
|
||||
return;
|
||||
logicObj[item->text().left(7)] = arrayAll;
|
||||
logicObj2[item->text().left(7)] = m_deleteInputArray;
|
||||
logicExpressArray.append(logicObj);
|
||||
logicExpressArray2.append(logicObj2);
|
||||
}
|
||||
ConfiguraitonsObj2 = ConfiguraitonsObj;
|
||||
ConfiguraitonsObj["logicExpress"] = logicExpressArray;
|
||||
ConfiguraitonsObj2["logicExpress"] = logicExpressArray2;
|
||||
// for(int i = 0;i < model_Relay->rowCount() ;i++)
|
||||
// {
|
||||
// QStandardItem *item = model_Relay->item(i);
|
||||
// qDebug() <<"item = " << item->text();
|
||||
// QJsonArray arrayAll = GetItem(model_Relay->item(i));
|
||||
// QJsonObject json = generateJsonFromTreeView(ui->treeView_Relay);
|
||||
// saveJsonToFile(json, "TreeViewToJSON.json");
|
||||
// if(arrayAll.size() < 1)
|
||||
// return;
|
||||
// logicObj[item->text().left(7)] = arrayAll;
|
||||
// logicObj2[item->text().left(7)] = m_deleteInputArray;
|
||||
// logicExpressArray.append(logicObj);
|
||||
// logicExpressArray2.append(logicObj2);
|
||||
// }
|
||||
QJsonArray rootArray;
|
||||
|
||||
// 遍历模型的每个根节点
|
||||
for (int i = 0; i < model_Relay->rowCount(); ++i) {
|
||||
QStandardItem *rootItem = model_Relay->item(i);
|
||||
rootArray.append(createJsonFromTreeNode(rootItem));
|
||||
// logicObj[rootItem->text().left(7)] = rootArray;
|
||||
// logicObj2[rootItem->text().left(7)] = m_deleteInputArray;
|
||||
// logicExpressArray.append(logicObj);
|
||||
// logicExpressArray2.append(logicObj2);
|
||||
}
|
||||
|
||||
ConfiguraitonsObj2 = ConfiguraitonsObj;
|
||||
ConfiguraitonsObj["logicExpress"] = rootArray;
|
||||
ConfiguraitonsObj2["logicExpress"] = logicExpressArray2;
|
||||
//saveJsonToFile(ConfiguraitonsObj, "TreeViewToJSON.json");
|
||||
QString strTableName = " t_UnitConfiguration ";
|
||||
QVector<UnitConfiguration_t> vecUnitConfiguration = g_SqliteDB->GetUnitConfigurationInfo(strTableName);
|
||||
for (int i = 0; i < vecUnitConfiguration.size(); i++) {
|
||||
@ -924,10 +1049,62 @@ void CConfiguration::on_comboBox_WC_currentIndexChanged(const QString &arg1)
|
||||
}
|
||||
}
|
||||
}
|
||||
// 递归解析 JSON 并构建树模型
|
||||
void CConfiguration::populateTree(QStandardItem *parentItem, const QJsonObject &jsonObject) {
|
||||
for (auto it = jsonObject.begin(); it != jsonObject.end(); ++it) {
|
||||
QString key = it.key();
|
||||
QJsonValue value = it.value();
|
||||
|
||||
if (key == "Combination") {
|
||||
// // 添加 Combination 节点
|
||||
// QJsonObject combination = value.toObject();
|
||||
// int minNumber = combination["MinimumNumber"].toInt();
|
||||
// QString combinationText = QString("Combination (MinimumNumber: %1)").arg(minNumber);
|
||||
// QStandardItem *combinationItem = new QStandardItem(combinationText);
|
||||
// parentItem->appendRow(combinationItem);
|
||||
} else if (key == "Inputs" && value.isArray()) {
|
||||
// 解析 Inputs 数组
|
||||
QJsonArray inputsArray = value.toArray();
|
||||
// QStandardItem *inputsItem = new QStandardItem("Inputs");
|
||||
// parentItem->appendRow(inputsItem);
|
||||
|
||||
void CConfiguration::ViewRelay(int ChannelNoInBoard)
|
||||
{
|
||||
for (const QJsonValue &inputValue : inputsArray) {
|
||||
if (inputValue.isObject()) {
|
||||
populateTree(parentItem, inputValue.toObject());
|
||||
}
|
||||
}
|
||||
} else if (key.startsWith("logic")) {
|
||||
// 处理 logicAND 或 logicOR 节点
|
||||
QStandardItem *logicItem = new QStandardItem(key);
|
||||
parentItem->appendRow(logicItem);
|
||||
|
||||
if (value.isArray()) {
|
||||
QJsonArray logicArray = value.toArray();
|
||||
for (const QJsonValue &logicValue : logicArray) {
|
||||
if (logicValue.isObject()) {
|
||||
QJsonObject logicCombination = logicValue["Combination"].toObject();
|
||||
int MinimumNumber =logicCombination["MinimumNumber"].toInt();
|
||||
qDebug() << "MinimumNumber" << MinimumNumber << endl;
|
||||
logicItem->setData(MinimumNumber,Qt::UserRole+1);
|
||||
if(key.contains("logicAND"))
|
||||
logicItem->setText(QString("logicAND(%1)").arg(MinimumNumber));
|
||||
populateTree(logicItem, logicValue.toObject());
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (value.isObject()) {
|
||||
// 如果是嵌套对象
|
||||
QStandardItem *objectItem = new QStandardItem(key);
|
||||
parentItem->appendRow(objectItem);
|
||||
populateTree(objectItem, value.toObject());
|
||||
} else if (key == "displayTitle") {
|
||||
// 叶子节点:展示 displayTitle
|
||||
QStandardItem *leafItem = new QStandardItem(value.toString());
|
||||
parentItem->appendRow(leafItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
void CConfiguration::ViewRelay(int ChannelNoInBoard){
|
||||
model_Relay->clear();
|
||||
ui->lineEdit_2->setText("");
|
||||
QString strWorkConditonName = ui->comboBox_WC->currentText();
|
||||
@ -941,100 +1118,134 @@ void CConfiguration::ViewRelay(int ChannelNoInBoard)
|
||||
if(tempArray.at(j)["ChannelNoInBoard"] == ChannelNoInBoard){
|
||||
ui->lineEdit_delay->setText(tempArray.at(j)["DelaySeconds"].toString());
|
||||
QJsonArray tempArray2 = tempArray.at(j)["logicExpress"].toArray();
|
||||
// 递归解析 JSON 数据并填充到模型中
|
||||
for (int k = 0; k < tempArray2.size(); k++) {
|
||||
QJsonObject tempObj2 = tempArray2[k].toObject();
|
||||
if (tempObj2.contains(QStringLiteral("logicAND"))){
|
||||
QJsonValue arrayValue = tempObj2.value(QStringLiteral("logicAND"));
|
||||
QStandardItem *itemAnd = new QStandardItem(QString("logicAND"));
|
||||
model_Relay->appendRow(itemAnd);
|
||||
QJsonArray array = arrayValue.toArray();
|
||||
for (int kk = 0; kk < array.size(); kk++) {
|
||||
QJsonObject tempObj3 = array[kk].toObject();
|
||||
if (tempObj3.contains(QStringLiteral("logicAND"))){
|
||||
QJsonValue objValue = tempObj3.value(QStringLiteral("logicAND"));
|
||||
|
||||
QJsonObject Combination = objValue["Combination"].toObject();
|
||||
int MinimumNumber = Combination["MinimumNumber"].toInt();
|
||||
|
||||
QStandardItem *itemAnd2 = new QStandardItem(QString("logicAND(%1)").arg(MinimumNumber));
|
||||
itemAnd2->setData(MinimumNumber,Qt::UserRole+1);
|
||||
itemAnd->appendRow(itemAnd2);
|
||||
|
||||
QJsonArray inputsArray = objValue["Inputs"].toArray();
|
||||
for (int ii = 0; ii < inputsArray.size(); ii++) {
|
||||
QStandardItem *item = new QStandardItem(QString(inputsArray.at(ii)["displayTitle"].toString()));
|
||||
itemAnd2->appendRow(item);
|
||||
}
|
||||
}
|
||||
if (tempObj3.contains(QStringLiteral("logicOR"))){
|
||||
QJsonValue objValue = tempObj3.value(QStringLiteral("logicOR"));
|
||||
QJsonObject Combination = objValue["Combination"].toObject();
|
||||
int MinimumNumber = Combination["MinimumNumber"].toInt();
|
||||
QStandardItem *itemOr2 = new QStandardItem(QString("logicOR(%1)").arg(MinimumNumber));
|
||||
itemOr2->setData(MinimumNumber,Qt::UserRole+1);
|
||||
itemAnd->appendRow(itemOr2);
|
||||
|
||||
QJsonArray arrValue2 = objValue.toArray();
|
||||
for(int jj = 0; jj < arrValue2.size();jj++){
|
||||
QJsonArray inputsArray = arrValue2.at(jj)["Inputs"].toArray();
|
||||
for (int ii = 0; ii < inputsArray.size(); ii++) {
|
||||
QStandardItem *item = new QStandardItem(QString(inputsArray.at(ii)["displayTitle"].toString()));
|
||||
itemOr2->appendRow(item);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (tempObj2.contains(QStringLiteral("logicOR"))){
|
||||
QJsonValue arrayValue = tempObj2.value(QStringLiteral("logicOR"));
|
||||
QStandardItem *itemOr = new QStandardItem(QString("logicOR"));
|
||||
model_Relay->appendRow(itemOr);
|
||||
QJsonArray array = arrayValue.toArray();
|
||||
for (int kk = 0; kk < array.size(); kk++) {
|
||||
QJsonObject tempObj3 = array[k].toObject();
|
||||
if (tempObj3.contains(QStringLiteral("logicAND"))){
|
||||
QJsonValue objValue = tempObj3.value(QStringLiteral("logicAND"));
|
||||
QJsonArray array2 = objValue.toArray();
|
||||
for (int jj = 0; jj < array2.size(); jj++) {
|
||||
QJsonObject tempObj4 = array2[jj].toObject();
|
||||
QJsonObject Combination = tempObj4["Combination"].toObject();
|
||||
int MinimumNumber = Combination["MinimumNumber"].toInt();
|
||||
QStandardItem *itemAnd2 = new QStandardItem(QString("logicAND(%1)").arg(MinimumNumber));
|
||||
QJsonArray inputsArray = tempObj4["Inputs"].toArray();
|
||||
for (int ii = 0; ii < inputsArray.size(); ii++) {
|
||||
QStandardItem *item = new QStandardItem(QString(inputsArray.at(ii)["displayTitle"].toString()));
|
||||
itemAnd2->appendRow(item);
|
||||
populateTree(itemOr, tempObj3);
|
||||
}
|
||||
itemAnd2->setData(MinimumNumber,Qt::UserRole+1);
|
||||
itemOr->appendRow(itemAnd2);
|
||||
model_Relay->appendRow(itemOr);
|
||||
}
|
||||
}
|
||||
if (tempObj3.contains(QStringLiteral("logicOR"))){
|
||||
QJsonValue objValue = tempObj3.value(QStringLiteral("logicOR"));
|
||||
QJsonObject Combination = objValue["Combination"].toObject();
|
||||
int MinimumNumber = Combination["MinimumNumber"].toInt();
|
||||
QStandardItem *itemOr2 = new QStandardItem(QString("logicOR(%1)").arg(MinimumNumber));
|
||||
itemOr2->setData(MinimumNumber,Qt::UserRole+1);
|
||||
itemOr->appendRow(itemOr2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//void CConfiguration::ViewRelay(int ChannelNoInBoard)
|
||||
//{
|
||||
// model_Relay->clear();
|
||||
// ui->lineEdit_2->setText("");
|
||||
// QString strWorkConditonName = ui->comboBox_WC->currentText();
|
||||
// for (int i = 0; i < m_vecWorkConditionObj.size(); i++) {
|
||||
// QJsonObject tempObj = m_vecWorkConditionObj[i];
|
||||
// if(strWorkConditonName == tempObj["WorkConditionName"].toString()){
|
||||
// QJsonArray tempArray = tempObj["Configuraitons"].toArray();
|
||||
// QString strSecondDelaySeconds = tempObj["SecondDelaySeconds"].toString();
|
||||
// ui->lineEdit_2->setText(strSecondDelaySeconds);
|
||||
// for (int j = 0;j < tempArray.size() ;j++ ) {
|
||||
// if(tempArray.at(j)["ChannelNoInBoard"] == ChannelNoInBoard){
|
||||
// ui->lineEdit_delay->setText(tempArray.at(j)["DelaySeconds"].toString());
|
||||
// QJsonArray tempArray2 = tempArray.at(j)["logicExpress"].toArray();
|
||||
// for (int k = 0; k < tempArray2.size(); k++) {
|
||||
// QJsonObject tempObj2 = tempArray2[k].toObject();
|
||||
// if (tempObj2.contains(QStringLiteral("logicAND"))){
|
||||
// QJsonValue arrayValue = tempObj2.value(QStringLiteral("logicAND"));
|
||||
// QStandardItem *itemAnd = new QStandardItem(QString("logicAND"));
|
||||
// model_Relay->appendRow(itemAnd);
|
||||
// QJsonArray array = arrayValue.toArray();
|
||||
// for (int kk = 0; kk < array.size(); kk++) {
|
||||
// QJsonObject tempObj3 = array[kk].toObject();
|
||||
// if (tempObj3.contains(QStringLiteral("logicAND"))){
|
||||
// QJsonValue objValue = tempObj3.value(QStringLiteral("logicAND"));
|
||||
|
||||
QJsonArray arrValue2 = objValue.toArray();
|
||||
for(int jj = 0; jj < arrValue2.size();jj++){
|
||||
QJsonArray inputsArray = arrValue2.at(jj)["Inputs"].toArray();
|
||||
for (int ii = 0; ii < inputsArray.size(); ii++) {
|
||||
QStandardItem *item = new QStandardItem(QString(inputsArray.at(ii)["displayTitle"].toString()));
|
||||
itemOr2->appendRow(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// QJsonObject Combination = objValue["Combination"].toObject();
|
||||
// int MinimumNumber = Combination["MinimumNumber"].toInt();
|
||||
|
||||
// QStandardItem *itemAnd2 = new QStandardItem(QString("logicAND(%1)").arg(MinimumNumber));
|
||||
// itemAnd2->setData(MinimumNumber,Qt::UserRole+1);
|
||||
// itemAnd->appendRow(itemAnd2);
|
||||
|
||||
// QJsonArray inputsArray = objValue["Inputs"].toArray();
|
||||
// for (int ii = 0; ii < inputsArray.size(); ii++) {
|
||||
// QStandardItem *item = new QStandardItem(QString(inputsArray.at(ii)["displayTitle"].toString()));
|
||||
// itemAnd2->appendRow(item);
|
||||
// }
|
||||
// }
|
||||
// if (tempObj3.contains(QStringLiteral("logicOR"))){
|
||||
// QJsonValue objValue = tempObj3.value(QStringLiteral("logicOR"));
|
||||
// QJsonObject Combination = objValue["Combination"].toObject();
|
||||
// int MinimumNumber = Combination["MinimumNumber"].toInt();
|
||||
// QStandardItem *itemOr2 = new QStandardItem(QString("logicOR(%1)").arg(MinimumNumber));
|
||||
// itemOr2->setData(MinimumNumber,Qt::UserRole+1);
|
||||
// itemAnd->appendRow(itemOr2);
|
||||
|
||||
// QJsonArray arrValue2 = objValue.toArray();
|
||||
// for(int jj = 0; jj < arrValue2.size();jj++){
|
||||
// QJsonArray inputsArray = arrValue2.at(jj)["Inputs"].toArray();
|
||||
// for (int ii = 0; ii < inputsArray.size(); ii++) {
|
||||
// QStandardItem *item = new QStandardItem(QString(inputsArray.at(ii)["displayTitle"].toString()));
|
||||
// itemOr2->appendRow(item);
|
||||
// }
|
||||
// }
|
||||
|
||||
// }
|
||||
// }
|
||||
|
||||
// }
|
||||
// if (tempObj2.contains(QStringLiteral("logicOR"))){
|
||||
// QJsonValue arrayValue = tempObj2.value(QStringLiteral("logicOR"));
|
||||
// QStandardItem *itemOr = new QStandardItem(QString("logicOR"));
|
||||
// model_Relay->appendRow(itemOr);
|
||||
// QJsonArray array = arrayValue.toArray();
|
||||
// for (int kk = 0; kk < array.size(); kk++) {
|
||||
// QJsonObject tempObj3 = array[k].toObject();
|
||||
// if (tempObj3.contains(QStringLiteral("logicAND"))){
|
||||
// QJsonValue objValue = tempObj3.value(QStringLiteral("logicAND"));
|
||||
// QJsonArray array2 = objValue.toArray();
|
||||
// for (int jj = 0; jj < array2.size(); jj++) {
|
||||
// QJsonObject tempObj4 = array2[jj].toObject();
|
||||
// QJsonObject Combination = tempObj4["Combination"].toObject();
|
||||
// int MinimumNumber = Combination["MinimumNumber"].toInt();
|
||||
// QStandardItem *itemAnd2 = new QStandardItem(QString("logicAND(%1)").arg(MinimumNumber));
|
||||
// QJsonArray inputsArray = tempObj4["Inputs"].toArray();
|
||||
// for (int ii = 0; ii < inputsArray.size(); ii++) {
|
||||
// QStandardItem *item = new QStandardItem(QString(inputsArray.at(ii)["displayTitle"].toString()));
|
||||
// itemAnd2->appendRow(item);
|
||||
// }
|
||||
// itemAnd2->setData(MinimumNumber,Qt::UserRole+1);
|
||||
// itemOr->appendRow(itemAnd2);
|
||||
// }
|
||||
// }
|
||||
// if (tempObj3.contains(QStringLiteral("logicOR"))){
|
||||
// QJsonValue objValue = tempObj3.value(QStringLiteral("logicOR"));
|
||||
// QJsonObject Combination = objValue["Combination"].toObject();
|
||||
// int MinimumNumber = Combination["MinimumNumber"].toInt();
|
||||
// QStandardItem *itemOr2 = new QStandardItem(QString("logicOR(%1)").arg(MinimumNumber));
|
||||
// itemOr2->setData(MinimumNumber,Qt::UserRole+1);
|
||||
// itemOr->appendRow(itemOr2);
|
||||
|
||||
// QJsonArray arrValue2 = objValue.toArray();
|
||||
// for(int jj = 0; jj < arrValue2.size();jj++){
|
||||
// QJsonArray inputsArray = arrValue2.at(jj)["Inputs"].toArray();
|
||||
// for (int ii = 0; ii < inputsArray.size(); ii++) {
|
||||
// QStandardItem *item = new QStandardItem(QString(inputsArray.at(ii)["displayTitle"].toString()));
|
||||
// itemOr2->appendRow(item);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// for(int i = 0;i < model_Available->rowCount() ;i++){
|
||||
// model_Relay->removeRow(i);
|
||||
@ -1137,7 +1348,7 @@ void CConfiguration::ViewRelay(int ChannelNoInBoard)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
//}
|
||||
|
||||
void CConfiguration::on_radioButton_1_clicked()
|
||||
{
|
||||
@ -1225,7 +1436,6 @@ void CConfiguration::on_treeView_Available_pressed(const QModelIndex &index)
|
||||
|
||||
}
|
||||
|
||||
|
||||
void CConfiguration::on_radioButton_11_clicked()
|
||||
{
|
||||
m_curentRLY = 1;
|
||||
@ -1233,7 +1443,6 @@ void CConfiguration::on_radioButton_11_clicked()
|
||||
ViewRelay(1);
|
||||
}
|
||||
|
||||
|
||||
void CConfiguration::on_radioButton_12_clicked()
|
||||
{
|
||||
m_curentRLY = 2;
|
||||
|
||||
@ -58,10 +58,11 @@ private slots:
|
||||
|
||||
void on_treeView_Available_pressed(const QModelIndex &index);
|
||||
|
||||
void on_radioButton_11_clicked();
|
||||
|
||||
void on_radioButton_12_clicked();
|
||||
|
||||
void on_radioButton_11_clicked();
|
||||
|
||||
private:
|
||||
Ui::CConfiguration *ui;
|
||||
|
||||
@ -69,7 +70,9 @@ private:
|
||||
QStandardItemModel *model_Relay;
|
||||
|
||||
QVector<WorkCondition_t> m_WorkCondition;
|
||||
|
||||
QJsonObject createJsonFromTreeNode(QStandardItem *item);
|
||||
void saveJsonToFile(const QJsonObject &jsonObject, const QString &filePath);
|
||||
QJsonObject generateJsonFromTreeView(QTreeView *treeView);
|
||||
QJsonArray GetItem(QStandardItem *item,int MinimumNumber = -1);
|
||||
QJsonArray m_arrayAll;
|
||||
QJsonArray m_array;
|
||||
@ -89,6 +92,7 @@ private:
|
||||
QJsonObject SelectChannel(int channelNo);
|
||||
void ViewRelay(int ChannelNoInBoard);
|
||||
void PushData();
|
||||
void populateTree(QStandardItem *parentItem, const QJsonObject &jsonObject);
|
||||
int m_isConfirm;
|
||||
int m_curentRLY;
|
||||
};
|
||||
|
||||
@ -238,7 +238,7 @@ color: rgb(27, 30, 35);</string>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Available Logic Tags</string>
|
||||
<string>可用逻辑元素</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -279,7 +279,7 @@ color: rgb(27, 30, 35);</string>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>Relay Logic Editor</string>
|
||||
<string>继电器逻辑编辑器</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
@ -3,8 +3,8 @@
|
||||
|
||||
#include <QWidget>
|
||||
#include <QUrl>
|
||||
#include <qftp.h>
|
||||
#include <qurlinfo.h>
|
||||
#include <QtFtp/qftp.h>
|
||||
#include <QtFtp/qurlinfo.h>
|
||||
#include <QTreeWidgetItem>
|
||||
#include <QStandardItemModel>
|
||||
#include <QFile>
|
||||
|
||||
@ -73,10 +73,10 @@ void CustomFilter::on_pushButton_Submit_clicked()
|
||||
for(int i = 0; i < rowCount;i++){
|
||||
QModelIndex index = model->index(i,0);
|
||||
QString strData = model->data(index).toString();
|
||||
range.append(strData.toInt());
|
||||
range.append(strData.toFloat());
|
||||
index = model->index(i,1);
|
||||
strData = model->data(index).toString();
|
||||
range.append(strData.toInt());
|
||||
range.append(strData.toFloat());
|
||||
}
|
||||
sendData["range"] = range;
|
||||
QNetworkRequest req;
|
||||
@ -163,7 +163,7 @@ void CustomFilter::slotNetMgr(QString sAddr, const QVariant &msg)
|
||||
model->setRowCount(num);
|
||||
QJsonArray range = objec["range"].toArray();
|
||||
for (int i = 0; i < num; i++) {
|
||||
model->setData(model->index(i,0,QModelIndex()),range[j].toInt());
|
||||
model->setData(model->index(i,0,QModelIndex()),range[j].toDouble());
|
||||
j++;
|
||||
model->setData(model->index(i,1,QModelIndex()),range[j].toInt());
|
||||
j++;
|
||||
|
||||
60
CustomGraphicsItemGroup.h
Normal file
60
CustomGraphicsItemGroup.h
Normal file
@ -0,0 +1,60 @@
|
||||
#ifndef CUSTOMGRAPHICSITEMGROUP_H
|
||||
#define CUSTOMGRAPHICSITEMGROUP_H
|
||||
#include <QGraphicsItemGroup>
|
||||
#include <QPainter>
|
||||
|
||||
class RoundedGraphicsItemGroup : public QGraphicsItemGroup {
|
||||
public:
|
||||
RoundedGraphicsItemGroup(QGraphicsItem *parent = nullptr)
|
||||
: QGraphicsItemGroup(parent), selected(false) {
|
||||
//setFlag(QGraphicsItem::ItemIsSelectable, true); // 使该项可选中
|
||||
}
|
||||
|
||||
// 设置圆角半径
|
||||
void setCornerRadius(qreal radius) {
|
||||
cornerRadius = radius;
|
||||
prepareGeometryChange();
|
||||
}
|
||||
|
||||
QRectF boundingRect() const override {
|
||||
return QGraphicsItemGroup::boundingRect();
|
||||
}
|
||||
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = nullptr) override {
|
||||
Q_UNUSED(option)
|
||||
Q_UNUSED(widget)
|
||||
|
||||
// 启用抗锯齿
|
||||
painter->setRenderHint(QPainter::Antialiasing, true);
|
||||
|
||||
// 绘制圆角矩形背景
|
||||
painter->setBrush(QBrush(QColor(255, 255, 255)));
|
||||
painter->setPen(Qt::NoPen);
|
||||
painter->drawRoundedRect(boundingRect(), cornerRadius, cornerRadius);
|
||||
|
||||
// 绘制选中效果
|
||||
if (isSelected()) {
|
||||
QPen pen(QColor(36,93,155), 3); // 蓝色边框
|
||||
painter->setPen(pen);
|
||||
painter->setBrush(Qt::NoBrush);
|
||||
painter->drawRoundedRect(boundingRect().adjusted(1.5, 1.5, -1.5, -1.5), cornerRadius, cornerRadius);
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QGraphicsSceneMouseEvent *event) override {
|
||||
QGraphicsItemGroup::mousePressEvent(event);
|
||||
update(); // 更新选中效果
|
||||
}
|
||||
|
||||
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override {
|
||||
QGraphicsItemGroup::mouseReleaseEvent(event);
|
||||
update(); // 更新选中效果
|
||||
}
|
||||
|
||||
private:
|
||||
qreal cornerRadius = 10.0; // 默认圆角半径
|
||||
bool selected; // 是否被选中
|
||||
};
|
||||
|
||||
#endif // CUSTOMGRAPHICSITEMGROUP_H
|
||||
@ -87,6 +87,7 @@ HEADERS += \
|
||||
CopyChannelSetting.h \
|
||||
CopyDatFile.h \
|
||||
CustomFilter.h \
|
||||
CustomGraphicsItemGroup.h \
|
||||
DIO_Board.h \
|
||||
DataGraphView.h \
|
||||
FileServerConfig.h \
|
||||
@ -181,9 +182,7 @@ DISTFILES += \
|
||||
|
||||
INCLUDEPATH += $$PWD/include/mqtt
|
||||
INCLUDEPATH += $$PWD/include/fftw
|
||||
INCLUDEPATH += $$PWD/include/ftp
|
||||
|
||||
LIBS += -L$$PWD/lib/ftp/ -lQt5Ftp
|
||||
|
||||
win32:CONFIG(release, debug|release): LIBS += -L$$PWD/lib/fftw/ -llibfftw3-3 -llibfftw3f-3 -llibfftw3l-3
|
||||
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/lib/fftw/ -llibfftw3-3 -llibfftw3f-3 -llibfftw3l-3
|
||||
|
||||
@ -556,6 +556,7 @@ void CHistoryAlarm::downloadProcess_Slot(qint64 byteSend, qint64 byteTotal)
|
||||
downloadProgressDialog->setValue(byteSend);
|
||||
if(byteSend == byteTotal){
|
||||
disconnect(g_FtpClient,SIGNAL(sigDownloadProcess(qint64 , qint64 )),this,SLOT(downloadProcess_Slot(qint64 , qint64)));
|
||||
customLogMessageHandler(QtDebugMsg,"HistoryAlarm Open:" + g_LocalFile);
|
||||
OpenDatFile(g_LocalFile);
|
||||
}
|
||||
}
|
||||
|
||||
@ -100,9 +100,8 @@ void CImportConfig::on_pushButton_confirm_clicked()
|
||||
file.open(QIODevice::ReadWrite | QIODevice::Text);
|
||||
value = file.readAll();
|
||||
file.resize(0);
|
||||
file.write(value.toUtf8());
|
||||
value.replace(oldMAC,MAC);
|
||||
value = file.readAll();
|
||||
file.write(value.toUtf8());
|
||||
file.close();
|
||||
|
||||
|
||||
@ -182,12 +181,9 @@ void CImportConfig::on_pushButton_confirm_clicked()
|
||||
#endif
|
||||
|
||||
QString strURL = QString("ftp://%1/CIDW/qtconfig/%2").arg(IP).arg("UnitWorkConditionsInfo.json");
|
||||
// g_FtpClient->SetServerInfo(strURL);
|
||||
// g_FtpClient->SetUserInfo("root","@#cidw!@123456");
|
||||
// g_FtpClient->UpLoadFile(fileNameInfo,"UnitWorkConditionsInfo.json");
|
||||
|
||||
g_FtpClient->uploadFile(strURL,fileNameInfo,"UnitWorkConditionsInfo.json");
|
||||
// Uploader u;
|
||||
// u.start(strURL,fileNameInfo,"UnitWorkConditionsInfo.json");
|
||||
|
||||
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
@ -198,9 +194,7 @@ void CImportConfig::on_pushButton_confirm_clicked()
|
||||
#endif
|
||||
|
||||
QString str2 = QString("ftp://%1/CIDW/qtconfig/%2").arg(IP).arg("UnitConfigurations.json");
|
||||
// g_FtpClient->SetServerInfo(str2);
|
||||
// g_FtpClient->SetUserInfo("root","@#cidw!@123456");
|
||||
// g_FtpClient->UpLoadFile(fileNameUnit,"UnitConfigurations.json");
|
||||
|
||||
g_FtpClient->uploadFile(str2,fileNameUnit,"UnitConfigurations.json");
|
||||
#ifdef Q_OS_WIN32
|
||||
QString fileNameUnit2 = QCoreApplication::applicationDirPath() + "\\config\\UnitConfigurations2.json";
|
||||
@ -210,9 +204,7 @@ void CImportConfig::on_pushButton_confirm_clicked()
|
||||
#endif
|
||||
|
||||
QString str22 = QString("ftp://%1/CIDW/qtconfig/%2").arg(IP).arg("UnitConfigurations2.json");
|
||||
// g_FtpClient->SetServerInfo(str22);
|
||||
// g_FtpClient->SetUserInfo("root","@#cidw!@123456");
|
||||
// g_FtpClient->UpLoadFile(fileNameUnit2,"UnitConfigurations2.json");
|
||||
|
||||
g_FtpClient->uploadFile(str22,fileNameUnit2,"UnitConfigurations2.json");
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
@ -223,9 +215,7 @@ void CImportConfig::on_pushButton_confirm_clicked()
|
||||
#endif
|
||||
|
||||
QString str1 = QString("ftp://%1/CIDW/qtconfig/%2").arg(IP).arg("TriggerSettings.json");
|
||||
// g_FtpClient->SetServerInfo(str1);
|
||||
// g_FtpClient->SetUserInfo("root","@#cidw!@123456");
|
||||
// g_FtpClient->UpLoadFile(fileNameTri,"TriggerSettings.json");
|
||||
|
||||
g_FtpClient->uploadFile(str1,fileNameTri,"TriggerSettings.json");
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
@ -236,9 +226,7 @@ void CImportConfig::on_pushButton_confirm_clicked()
|
||||
#endif
|
||||
|
||||
QString strTri2 = QString("ftp://%1/CIDW/qtconfig/%2").arg(IP).arg("TriggerSettings2.json");
|
||||
// g_FtpClient->SetServerInfo(strTri2);
|
||||
// g_FtpClient->SetUserInfo("root","@#cidw!@123456");
|
||||
// g_FtpClient->UpLoadFile(fileNameTri2,"TriggerSettings2.json");
|
||||
|
||||
g_FtpClient->uploadFile(strTri2,fileNameTri2,"TriggerSettings2.json");
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
@ -248,9 +236,7 @@ void CImportConfig::on_pushButton_confirm_clicked()
|
||||
QString name = QCoreApplication::applicationDirPath() + "/config/UnitBoardsInfo.json";
|
||||
#endif
|
||||
QString str = QString("ftp://%1/CIDW/qtconfig/%2").arg(IP).arg("UnitBoardsInfo.json");
|
||||
// g_FtpClient->SetServerInfo(str);
|
||||
// g_FtpClient->SetUserInfo("root","@#cidw!@123456");
|
||||
// g_FtpClient->UpLoadFile(name,"UnitBoardsInfo.json");
|
||||
|
||||
g_FtpClient->uploadFile(str,name,"UnitBoardsInfo.json");
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
@ -260,10 +246,8 @@ void CImportConfig::on_pushButton_confirm_clicked()
|
||||
QString fileNameChannel = QCoreApplication::applicationDirPath() + "/config/ChannelSettings.json";
|
||||
#endif
|
||||
QString strChannelSettings = QString("ftp://%1/CIDW/qtconfig/%2").arg(IP).arg("ChannelSettings.json");
|
||||
// g_FtpClient->SetServerInfo(str);
|
||||
// g_FtpClient->SetUserInfo("root","@#cidw!@123456");
|
||||
// g_FtpClient->UpLoadFile(name,"UnitBoardsInfo.json");
|
||||
g_FtpClient->uploadFile(strChannelSettings,fileNameChannel,"UnitBoardsInfo.json");
|
||||
|
||||
g_FtpClient->uploadFile(strChannelSettings,fileNameChannel,"ChannelSettings.json");
|
||||
|
||||
qApp->exit(0);
|
||||
QProcess::startDetached(qApp->applicationFilePath(), QStringList());
|
||||
|
||||
@ -21,6 +21,7 @@ COtherConfig::COtherConfig(QWidget *parent) :
|
||||
|
||||
ui->radioButton_closeIO->setChecked(1);
|
||||
LoadWorkingConditionConfig();
|
||||
get_status = false;
|
||||
}
|
||||
|
||||
COtherConfig::~COtherConfig()
|
||||
@ -301,7 +302,20 @@ void COtherConfig::slotNetMgr(QString sAddr, const QVariant &msg)
|
||||
{
|
||||
QJsonValue arrays_value = objec.take("cmd");
|
||||
qDebug()<<"cmd ="<<arrays_value.toString();
|
||||
{
|
||||
if(arrays_value.toString() == "113" && get_status){
|
||||
ui->pushButton_open_close->setEnabled("true");
|
||||
bool enable = objec.take("enable").toBool();
|
||||
if(enable){
|
||||
ui->radioButton_open_2->setChecked(true);
|
||||
ui->radioButton_close_2->setChecked(false);
|
||||
ui->pushButton_open_close->setText("关闭");
|
||||
}else{
|
||||
ui->radioButton_open_2->setChecked(false);
|
||||
ui->radioButton_close_2->setChecked(true);
|
||||
ui->pushButton_open_close->setText("打开");
|
||||
}
|
||||
get_status = false;
|
||||
}else{
|
||||
bool Status = objec.take("success").toBool();
|
||||
QString strMessage = objec.take("message").toString();
|
||||
if(Status){
|
||||
@ -473,3 +487,64 @@ void COtherConfig::on_radioButton_closeIO_clicked()
|
||||
g_strIOControl = "0";
|
||||
}
|
||||
|
||||
|
||||
void COtherConfig::on_radioButton_open_2_clicked()
|
||||
{
|
||||
|
||||
}
|
||||
void COtherConfig::on_radioButton_close_2_clicked()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void COtherConfig::on_pushButton_get_clicked()
|
||||
{
|
||||
QJsonObject sendData;
|
||||
sendData["cmd"] = "113";
|
||||
sendData["subcmd"] = 0;
|
||||
QNetworkRequest req;
|
||||
QString sUrl = QString("http://%1/cgi-bin/General.cgi/").arg(IP);
|
||||
req.setUrl(sUrl);
|
||||
g_NetMgr->PostJson(req,sendData);
|
||||
connect(g_NetMgr,SIGNAL(sigNetMgr(QString, const QVariant&)), this, SLOT(slotNetMgr(QString,const QVariant&)));
|
||||
|
||||
get_status = true;
|
||||
}
|
||||
|
||||
void COtherConfig::on_pushButton_open_close_clicked()
|
||||
{
|
||||
QMessageBox::StandardButton ret = QMessageBox::question(nullptr, "确认", "是否继续?",
|
||||
QMessageBox::Yes | QMessageBox::No,
|
||||
QMessageBox::Yes);
|
||||
|
||||
if (ret == QMessageBox::No) {
|
||||
return;
|
||||
}
|
||||
QString btn_text = ui->pushButton_open_close->text();
|
||||
if(btn_text == "打开"){
|
||||
QJsonObject sendData;
|
||||
sendData["cmd"] = "113";
|
||||
sendData["subcmd"] = 1;
|
||||
sendData["enable"] = true;
|
||||
QNetworkRequest req;
|
||||
QString sUrl = QString("http://%1/cgi-bin/General.cgi/").arg(IP);
|
||||
req.setUrl(sUrl);
|
||||
g_NetMgr->PostJson(req,sendData);
|
||||
connect(g_NetMgr,SIGNAL(sigNetMgr(QString, const QVariant&)), this, SLOT(slotNetMgr(QString,const QVariant&)));
|
||||
ui->pushButton_open_close->setText("关闭");
|
||||
|
||||
}else if(btn_text == "关闭"){
|
||||
QJsonObject sendData;
|
||||
sendData["cmd"] = "113";
|
||||
sendData["subcmd"] = 1;
|
||||
sendData["enable"] = false;
|
||||
QNetworkRequest req;
|
||||
QString sUrl = QString("http://%1/cgi-bin/General.cgi/").arg(IP);
|
||||
req.setUrl(sUrl);
|
||||
g_NetMgr->PostJson(req,sendData);
|
||||
connect(g_NetMgr,SIGNAL(sigNetMgr(QString, const QVariant&)), this, SLOT(slotNetMgr(QString,const QVariant&)));
|
||||
ui->pushButton_open_close->setText("打开");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -32,13 +32,21 @@ private slots:
|
||||
|
||||
void on_radioButton_closeIO_clicked();
|
||||
|
||||
void on_radioButton_open_2_clicked();
|
||||
|
||||
void on_pushButton_get_clicked();
|
||||
|
||||
void on_radioButton_close_2_clicked();
|
||||
|
||||
void on_pushButton_open_close_clicked();
|
||||
|
||||
private:
|
||||
Ui::COtherConfig *ui;
|
||||
|
||||
QString m_strTriggerTime;
|
||||
QString m_strConfidence;
|
||||
QString m_strSegments;
|
||||
|
||||
bool get_status;
|
||||
void LoadWorkingConditionConfig();
|
||||
QString GBK2UTF8(QByteArray inStr);
|
||||
};
|
||||
|
||||
117
OtherConfig.ui
117
OtherConfig.ui
@ -6,7 +6,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>905</width>
|
||||
<width>921</width>
|
||||
<height>580</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -450,6 +450,118 @@
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QGroupBox" name="groupBox_6">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>290</y>
|
||||
<width>251</width>
|
||||
<height>131</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>128k配置</string>
|
||||
</property>
|
||||
<widget class="QPushButton" name="pushButton_open_close">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>80</y>
|
||||
<width>96</width>
|
||||
<height>28</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>96</width>
|
||||
<height>28</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">#pushButton_open_close { border-image: url(:/image/Btn/normal_Btn.png);
|
||||
color:#1f5188 }
|
||||
#pushButton_open_close:hover { border-image: url(:/image/Btn/normal_Btn_p.png);
|
||||
color:#ffffff}
|
||||
#pushButton_open_close:pressed { border-image: url(:/image/Btn/normal_Btn_p.png);
|
||||
color:#ffffff}
|
||||
#pushButton_open_close:checked { border-image: url(:/image/Btn/normal_Btn_p.png);
|
||||
color:#ffffff}</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QRadioButton" name="radioButton_open_2">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>120</x>
|
||||
<y>40</y>
|
||||
<width>37</width>
|
||||
<height>17</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>开</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">buttonGroup</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_get">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>40</y>
|
||||
<width>96</width>
|
||||
<height>28</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>96</width>
|
||||
<height>28</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">#pushButton_get { border-image: url(:/image/Btn/normal_Btn.png);
|
||||
color:#1f5188 }
|
||||
#pushButton_get:hover { border-image: url(:/image/Btn/normal_Btn_p.png);
|
||||
color:#ffffff}
|
||||
#pushButton_get:pressed { border-image: url(:/image/Btn/normal_Btn_p.png);
|
||||
color:#ffffff}
|
||||
#pushButton_get:checked { border-image: url(:/image/Btn/normal_Btn_p.png);
|
||||
color:#ffffff}</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>获取</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QRadioButton" name="radioButton_close_2">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>180</x>
|
||||
<y>40</y>
|
||||
<width>37</width>
|
||||
<height>17</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>关</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">buttonGroup</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
@ -462,4 +574,7 @@
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
<buttongroups>
|
||||
<buttongroup name="buttonGroup"/>
|
||||
</buttongroups>
|
||||
</ui>
|
||||
|
||||
@ -562,3 +562,70 @@ void CRealTimeAlarm::ItemCheckStateSlot(QString strID, bool bChecked)
|
||||
{
|
||||
DateViewdialog->ViewData(strID,mapWaveData[strID]);
|
||||
}
|
||||
|
||||
void CRealTimeAlarm::on_pushButton_refresh_clicked()
|
||||
{
|
||||
model->setRowCount(0);
|
||||
qDebug() << "initTable2" << endl;
|
||||
QString strTableName = "t_AlarmStatusInfo",strSql;
|
||||
strSql = QString(" timestamp <> '' order by timestamp DESC limit 0,100");
|
||||
m_vecTriggerAlarmStatusInfo = g_SqliteDB->GetTriggerAlarmStatusInfo(strTableName,strSql);
|
||||
|
||||
if(m_vecTriggerAlarmStatusInfo.size() > 0){
|
||||
for (int i = 0; i < m_vecTriggerAlarmStatusInfo.size(); i++) {
|
||||
QVariantList strRowItem ;
|
||||
QDateTime dateTime = QDateTime::fromSecsSinceEpoch(m_vecTriggerAlarmStatusInfo[i].timestamp);
|
||||
QTimeZone timeZone("Asia/Shanghai");
|
||||
dateTime = dateTime.toTimeZone(timeZone);
|
||||
QString TStr = dateTime.toString("yyyy-MM-dd hh:mm:ss");
|
||||
QString triggerLevel = "",triggerEventName = "";
|
||||
if(m_vecTriggerAlarmStatusInfo[i].triggerLevel == "1"){
|
||||
triggerLevel = "警报";
|
||||
}else if(m_vecTriggerAlarmStatusInfo[i].triggerLevel == "2"){
|
||||
triggerLevel = "危险";
|
||||
}
|
||||
QString strFeatureName = "";
|
||||
if(m_vecTriggerAlarmStatusInfo[i].triggerEventName.contains("MinValues"))
|
||||
strFeatureName = "最小值";
|
||||
else if(m_vecTriggerAlarmStatusInfo[i].triggerEventName.contains("MaxValues"))
|
||||
strFeatureName = "最大值";
|
||||
else if(m_vecTriggerAlarmStatusInfo[i].triggerEventName.contains("DCValues"))
|
||||
strFeatureName = "偏置电压/Gap";
|
||||
else if(m_vecTriggerAlarmStatusInfo[i].triggerEventName.contains("RMSValues"))
|
||||
strFeatureName = "有效值";
|
||||
else if(m_vecTriggerAlarmStatusInfo[i].triggerEventName.contains("DiagnosisPk2Pk"))
|
||||
strFeatureName = "诊断峰峰值";
|
||||
else if(m_vecTriggerAlarmStatusInfo[i].triggerEventName.contains("IntegratRMS"))
|
||||
strFeatureName = "有效值";
|
||||
else if(m_vecTriggerAlarmStatusInfo[i].triggerEventName.contains("IntegratPk2Pk"))
|
||||
strFeatureName = "积分峰峰值";
|
||||
else if(m_vecTriggerAlarmStatusInfo[i].triggerEventName.contains("SpeedProfileSpeed"))
|
||||
strFeatureName = "转速";
|
||||
else if(m_vecTriggerAlarmStatusInfo[i].triggerEventName.contains("IntegratPk2Pk/2"))
|
||||
strFeatureName = "峰值";
|
||||
else if(m_vecTriggerAlarmStatusInfo[i].triggerEventName.contains("DiagnosisPeak"))
|
||||
strFeatureName = "峰值";
|
||||
else if(m_vecTriggerAlarmStatusInfo[i].triggerEventName.contains("MonitorPk2Pk"))
|
||||
strFeatureName = "监测保护峰峰值";
|
||||
else if(m_vecTriggerAlarmStatusInfo[i].triggerEventName.contains("InvertDanger") )
|
||||
strFeatureName = "反时限危险值";
|
||||
else if(m_vecTriggerAlarmStatusInfo[i].triggerEventName.contains("InvertAlarm"))
|
||||
strFeatureName = "反时限警报值";
|
||||
if(m_vecTriggerAlarmStatusInfo[i].triggerEventName.contains("Over")){
|
||||
triggerEventName = m_vecTriggerAlarmStatusInfo[i].channelName + "-" + strFeatureName+ "-" + "高于" + triggerLevel + "值";
|
||||
}else if(m_vecTriggerAlarmStatusInfo[i].triggerEventName.contains("Under")){
|
||||
triggerEventName = m_vecTriggerAlarmStatusInfo[i].channelName + "-" + strFeatureName+ "-" + "低于" + triggerLevel + "值";
|
||||
}
|
||||
strRowItem << i + 1 << triggerLevel << triggerEventName << TStr;
|
||||
|
||||
createRowItem(i,strRowItem);
|
||||
}
|
||||
QMyTableViewBtnDelegate *m_btnDelegate = new QMyTableViewBtnDelegate(QStringList()<<"详情", this);
|
||||
ui->tableView->setItemDelegateForColumn(4, m_btnDelegate);
|
||||
connect(m_btnDelegate, SIGNAL(editData(const QModelIndex &)), this,SLOT(Details(const QModelIndex &)));
|
||||
|
||||
}else{
|
||||
QMessageBox::information(this, "提示", QString("未查询到数据!"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -25,6 +25,8 @@ public:
|
||||
private slots:
|
||||
void Details(const QModelIndex &index);
|
||||
void ItemCheckStateSlot(QString strID, bool bChecked);
|
||||
void on_pushButton_refresh_clicked();
|
||||
|
||||
public slots:
|
||||
void downloadProcess_Slot(qint64 byteSend, qint64 byteTotal);
|
||||
void DownloadStatus_Slot();
|
||||
|
||||
@ -18,7 +18,55 @@
|
||||
color: rgb(27, 30, 35);
|
||||
</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>488</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_refresh">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>96</width>
|
||||
<height>28</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>96</width>
|
||||
<height>28</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">#pushButton_refresh { border-image: url(:/image/Btn/normal_Btn.png);
|
||||
color:#1f5188 }
|
||||
#pushButton_refresh:hover { border-image: url(:/image/Btn/normal_Btn_p.png);
|
||||
color:#ffffff}
|
||||
#pushButton_refresh:pressed { border-image: url(:/image/Btn/normal_Btn_p.png);
|
||||
color:#ffffff}
|
||||
#pushButton_refresh:checked { border-image: url(:/image/Btn/normal_Btn_p.png);
|
||||
color:#ffffff}</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>刷新</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_alarm" native="true">
|
||||
<property name="styleSheet">
|
||||
|
||||
101
WaveDisplay.cpp
101
WaveDisplay.cpp
@ -24,44 +24,8 @@ CWaveDisPlay::CWaveDisPlay(QWidget *parent) :
|
||||
m_title = new QCPTextElement(ui->widget_wave, strTitle);
|
||||
ui->widget_wave->plotLayout()->addElement(0, 0, m_title);
|
||||
|
||||
// QAbstractItemView* view = ui->comboBox_channel_2->view();
|
||||
// QGraphicsDropShadowEffect* effect = new QGraphicsDropShadowEffect;
|
||||
// effect->setBlurRadius(6);
|
||||
// effect->setColor(Qt::black);
|
||||
// effect->setOffset(0, 0);
|
||||
// view->setGraphicsEffect(effect);
|
||||
// view->update();
|
||||
|
||||
// static_cast<QWidget*>(view->parent())
|
||||
// ->setStyleSheet(
|
||||
// "QWidget{border:none;background-color: rgb(255, 255, 255);}");
|
||||
|
||||
// QWidget* container = static_cast<QWidget*>(view->parent());
|
||||
// container->setAttribute(Qt::WA_TranslucentBackground);
|
||||
// container->setWindowFlag(Qt::FramelessWindowHint);
|
||||
// container->setWindowFlag(Qt::NoDropShadowWindowHint);
|
||||
|
||||
InitWindows();
|
||||
|
||||
// ui->widget_wave->xAxis->setRange(0, 1);
|
||||
// ui->widget_wave->xAxis->setLabel("Fs(Hz)");
|
||||
// ui->widget_wave->yAxis->setLabel(m_ChannelUnit);
|
||||
// QVector<double> ticks;
|
||||
// QVector<QString> labels;
|
||||
// ticks << 1 << 2 << 3 << 4 << 5 << 6 << 7;
|
||||
// labels << "USA" << "Japan" << "Germany" << "France" << "UK" << "Italy" << "Canada";
|
||||
// QVector<double> fossilData;
|
||||
// fossilData << 0.86*10.5 << 0.83*5.5 << 0.84*5.5 << 0.52*5.8 << 0.89*5.2 << 0.90*4.2 << 0.67*11.2;
|
||||
// QCPBars *bars = new QCPBars(ui->widget_wave->xAxis, ui->widget_wave->yAxis);
|
||||
// bars->setPen(QPen(QColor(31, 81, 136).lighter(130))); // 设置柱状图的边框颜色
|
||||
// bars->setBrush(QColor(31, 81, 136)); // 设置柱状图的画刷颜色
|
||||
// bars->setAntialiased(false);
|
||||
// bars->setWidth(0.02);
|
||||
// bars->setData(ticks, fossilData);
|
||||
// ui->widget_wave->xAxis->setRange(0, fossilData.size());
|
||||
// on_Btn_Scales_clicked();
|
||||
// ui->widget_wave->replot();
|
||||
|
||||
}
|
||||
|
||||
CWaveDisPlay::~CWaveDisPlay()
|
||||
@ -189,38 +153,6 @@ void CWaveDisPlay::ParseDataTimeWave(QJsonObject & objContent)
|
||||
|
||||
if(package + 1 == packageMax){
|
||||
|
||||
// if(!OneSecond){
|
||||
// m_Count ++;
|
||||
// m_WaveData = m_WaveData + data ;
|
||||
// qDebug() << "4S" <<"package" <<package << "packageMax" <<packageMax << endl;
|
||||
// m_PackgNum = 1;
|
||||
// QStringList waveData;
|
||||
// waveData = m_WaveData.split(",");
|
||||
// m_ListWaveData.append(waveData);
|
||||
// if(m_Count == 4){
|
||||
// ui->widget_wave->xAxis->setRange(0, 4);
|
||||
// ui->widget_wave->xAxis->setLabel("Time(s)");
|
||||
// double gap = (double)4/(double)m_ListWaveData.size();
|
||||
// QVector<double> x,y;
|
||||
// double f = 0.0;
|
||||
// QCPGraph* graph = ui->widget_wave->addGraph(ui->widget_wave->xAxis, ui->widget_wave->yAxis);
|
||||
// for(int i = 0; i < m_ListWaveData.size();i++){
|
||||
|
||||
// x.push_back(f);
|
||||
// y.push_back(m_ListWaveData[i].toDouble());
|
||||
// f += gap;
|
||||
// }
|
||||
// qDebug() << "x" <<x.size() << "y" << y.size() << endl;
|
||||
// graph->setData(x,y);
|
||||
// ui->widget_wave->xAxis->setRange(0, 1);
|
||||
// on_Btn_Scales_clicked();
|
||||
// ui->widget_wave->replot();
|
||||
// m_ListWaveData.clear();
|
||||
// m_Count = 0;
|
||||
// }
|
||||
// m_WaveData = "";
|
||||
// }else
|
||||
{
|
||||
m_WaveData = m_WaveData + data;
|
||||
qDebug() << "package" <<package << "packageMax" <<packageMax << endl;
|
||||
m_PackgNum = 1;
|
||||
@ -240,7 +172,7 @@ void CWaveDisPlay::ParseDataTimeWave(QJsonObject & objContent)
|
||||
}
|
||||
|
||||
double f = 0.0;
|
||||
QVector<double> x,y,x2,y2;
|
||||
QVector<double> x,y;
|
||||
QCPGraph* graph = ui->widget_wave->addGraph(ui->widget_wave->xAxis, ui->widget_wave->yAxis);
|
||||
for(int i = 0; i < m_ListWaveData.size();i++){
|
||||
x.push_back(f);
|
||||
@ -249,16 +181,26 @@ void CWaveDisPlay::ParseDataTimeWave(QJsonObject & objContent)
|
||||
}
|
||||
|
||||
QVector<double>::iterator max = std::max_element(std::begin(y), std::end(y));
|
||||
if(m_ChannelType == "PULSE_CURRENT"){
|
||||
QVector<double>::iterator min = std::min_element(std::begin(y), std::end(y));
|
||||
double min_y = *min;
|
||||
if(min_y < 1){
|
||||
double sum = std::accumulate(std::begin(y), std::end(y), 0.0);
|
||||
double size = y.size();
|
||||
double mean = sum/size;
|
||||
for(int i = 0; i < size;i++){
|
||||
y[i] = y[i] - mean;
|
||||
}
|
||||
}
|
||||
max = std::max_element(std::begin(y), std::end(y));
|
||||
}
|
||||
double biggest = *max;
|
||||
|
||||
qDebug() << "x" << x.size() << "y" << y.size() << endl;
|
||||
graph->setData(x,y);
|
||||
|
||||
|
||||
ui->widget_wave->yAxis->setRange(-1,biggest+2);
|
||||
on_Btn_Scales_clicked();
|
||||
ui->widget_wave->replot();
|
||||
}
|
||||
|
||||
if(ui->pushButton_1S->isChecked() && (m_ChannelType == "TACHOMETER" || (m_speedRefChannelId != "" && m_speedRefChannelId != "- -"))){
|
||||
QJsonObject allObj,cmdBody;
|
||||
@ -270,8 +212,6 @@ void CWaveDisPlay::ParseDataTimeWave(QJsonObject & objContent)
|
||||
QString sUrl = QString("http://%1/cgi-bin/General.cgi/").arg(IP);
|
||||
req.setUrl(sUrl);
|
||||
m_pNetMgr->PostJson(req,allObj);
|
||||
//ui->widget_wave->plotLayout()->clear();
|
||||
//
|
||||
}
|
||||
|
||||
}else{
|
||||
@ -319,7 +259,7 @@ void CWaveDisPlay::ParseDataFsWave(QJsonObject & objContent)
|
||||
float gap = 0;
|
||||
for(int i = 0; i < m_ListWaveData.size();i++){
|
||||
x.push_back(gap);
|
||||
y.push_back(m_ListWaveData[i].toDouble());
|
||||
y.push_back(qAbs(m_ListWaveData[i].toDouble()));
|
||||
if(g_strFre == "1")
|
||||
gap += 1;
|
||||
else if(g_strFre == "0.25")
|
||||
@ -536,16 +476,6 @@ void CWaveDisPlay::Cursor()
|
||||
|
||||
void CWaveDisPlay::on_pushButton_refresh_clicked()
|
||||
{
|
||||
// ui->comboBox_channel_2->clear();
|
||||
// ui->comboBox_channel_2->addItem("请选择通道...");
|
||||
// for (int i = 0; i < g_ChannelBaseInfo.size(); i++) {
|
||||
// ui->comboBox_channel_2->addItem(g_ChannelBaseInfo[i].channelName);
|
||||
// }
|
||||
|
||||
// ui->comboBox_channel_2->setView(new QListView());
|
||||
|
||||
|
||||
// //ui->comboBox_channel_2->setCurrentText("请选择通道...");
|
||||
on_comboBox_channel_2_currentTextChanged("");
|
||||
}
|
||||
|
||||
@ -578,7 +508,6 @@ void CWaveDisPlay::on_comboBox_channel_2_currentTextChanged(const QString &arg1)
|
||||
m_ChannelUnit = g_ChannelBaseInfo[i].sensorEngineeringUnit;
|
||||
if(ui->Btn_Timewave->isChecked())
|
||||
{
|
||||
|
||||
m_Times = 0;
|
||||
if(ui->pushButton_4S->isChecked()){
|
||||
OneSecond = false;
|
||||
|
||||
@ -1,44 +0,0 @@
|
||||
{
|
||||
"BoardType": {
|
||||
"Options": [
|
||||
"高速IEPE型采集板卡",
|
||||
"高速电流型采集板卡",
|
||||
"高速摆度采集板卡",
|
||||
"高速振动采集板卡",
|
||||
"低速电流采集板",
|
||||
"开入开出板"
|
||||
]
|
||||
},
|
||||
"UnitBoards": [
|
||||
{
|
||||
"BoardType": "高速IEPE型采集板卡",
|
||||
"BoardTypeNo": 0,
|
||||
"SN": "1"
|
||||
},
|
||||
{
|
||||
"BoardType": "高速电流型采集板卡",
|
||||
"BoardTypeNo": 1,
|
||||
"SN": "2"
|
||||
},
|
||||
{
|
||||
"BoardType": "高速摆度采集板卡",
|
||||
"BoardTypeNo": 2,
|
||||
"SN": "3"
|
||||
},
|
||||
{
|
||||
"BoardType": "高速电流型采集板卡",
|
||||
"BoardTypeNo": 3,
|
||||
"SN": "4"
|
||||
},
|
||||
{
|
||||
"BoardType": "低速电流采集板",
|
||||
"BoardTypeNo": 4,
|
||||
"SN": "5"
|
||||
},
|
||||
{
|
||||
"BoardType": "开入开出板",
|
||||
"BoardTypeNo": 5,
|
||||
"SN": "6"
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -1,67 +0,0 @@
|
||||
{
|
||||
"Configuraitons": [
|
||||
{
|
||||
"BoardNo": 3,
|
||||
"ChannelId": "50294D2080380301",
|
||||
"ChannelName": "继电器输出-1",
|
||||
"ChannelNoInBoard": 1,
|
||||
"logicExpress": [
|
||||
"logicOR",
|
||||
{
|
||||
"logicAND": {
|
||||
"Inputs": [
|
||||
{
|
||||
"alarm": 1,
|
||||
"channelId": "50294D208038011",
|
||||
"displayTitle": "第1板卡第1通道-DiagnosisPk2Pk-DELTA_EU-50294D208038011-警报阈值",
|
||||
"key": "wSBQDfNRYWeBT-oe1SvCB",
|
||||
"triggerFeatureName": "第1板卡第1通道-DiagnosisPk2Pk-DELTA_EU-50294D208038011-警报阈值"
|
||||
},
|
||||
{
|
||||
"alarm": 1,
|
||||
"channelId": "50294D208038021",
|
||||
"displayTitle": "第2板卡第1通道-DCValues-LEVEL-50294D208038021-警报阈值",
|
||||
"key": "po9n-tQIi5sh94ifJj1Hf",
|
||||
"triggerFeatureName": "第2板卡第1通道-DCValues-LEVEL-50294D208038021-警报阈值"
|
||||
}
|
||||
],
|
||||
"MinimumNumber": 2
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"BoardNo": 3,
|
||||
"ChannelId": "50294D2080380302",
|
||||
"ChannelName": "继电器输出-1",
|
||||
"ChannelNoInBoard": 2,
|
||||
"logicExpress": [
|
||||
"logicOR",
|
||||
{
|
||||
"logicAND": {
|
||||
"Inputs": [
|
||||
{
|
||||
"alarm": 1,
|
||||
"channelId": "50294D2080380101",
|
||||
"displayTitle": "第1板卡第1通道-DiagnosisPk2Pk-DELTA_EU-50294D208038011-警报阈值",
|
||||
"key": "wSBQDfNRYWeBT-oe1SvCB",
|
||||
"triggerFeatureName": "第1板卡第1通道-DiagnosisPk2Pk-DELTA_EU-50294D208038011-警报阈值"
|
||||
},
|
||||
{
|
||||
"alarm": 1,
|
||||
"channelId": "50294D2080380201",
|
||||
"displayTitle": "第2板卡第1通道-DCValues-LEVEL-50294D208038021-警报阈值",
|
||||
"key": "po9n-tQIi5sh94ifJj1Hf",
|
||||
"triggerFeatureName": "第2板卡第1通道-DCValues-LEVEL-50294D208038021-警报阈值"
|
||||
}
|
||||
],
|
||||
"MinimumNumber": 2
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"TheFirstDelayTime": "5",
|
||||
"TheSecondDelayTime": "10",
|
||||
"TheThirdDelayTime": "15"
|
||||
}
|
||||
@ -1,104 +0,0 @@
|
||||
{
|
||||
"BladesNumber": {
|
||||
"content": "4.0",
|
||||
"display": "叶片数"
|
||||
},
|
||||
"DesignHead": {
|
||||
"Unit": "m",
|
||||
"content": "9.7",
|
||||
"display": "设计水头"
|
||||
},
|
||||
"FlowCoefficient": {
|
||||
"content": "0.00000",
|
||||
"display": "流量系数"
|
||||
},
|
||||
"GeneratorManufacturer": {
|
||||
"content": "0.00",
|
||||
"display": "发电机制造厂家"
|
||||
},
|
||||
"GuideVanesNumber": {
|
||||
"content": "16.0",
|
||||
"display": "导叶数"
|
||||
},
|
||||
"LowerGuideVaneWattage": {
|
||||
"content": "12.00",
|
||||
"display": "下导瓦数"
|
||||
},
|
||||
"MaximumHead": {
|
||||
"Unit": "m",
|
||||
"content": "18.70",
|
||||
"display": "最大水头"
|
||||
},
|
||||
"MinimumHead": {
|
||||
"Unit": "m",
|
||||
"content": "3",
|
||||
"display": "最小水头"
|
||||
},
|
||||
"PlantID": {
|
||||
"content": "ZG",
|
||||
"display": "电厂编号"
|
||||
},
|
||||
"PlantName": {
|
||||
"content": "金沙水电站",
|
||||
"display": "电厂名称"
|
||||
},
|
||||
"PressurePulsationDisplayunit": {
|
||||
"Options": [
|
||||
"Kpa",
|
||||
"%"
|
||||
],
|
||||
"content": "Kpa",
|
||||
"display": "压力脉动显示"
|
||||
},
|
||||
"RatedExcitationCurrent": {
|
||||
"Unit": "A",
|
||||
"content": "864.00",
|
||||
"display": "额定励磁电流"
|
||||
},
|
||||
"RatedPower": {
|
||||
"Unit": "MW",
|
||||
"content": "160.0",
|
||||
"display": "额定功率"
|
||||
},
|
||||
"RatedSpeed": {
|
||||
"Unit": "rpm",
|
||||
"content": "57.7",
|
||||
"display": "额定转速"
|
||||
},
|
||||
"ThrustWattage": {
|
||||
"content": "24.00",
|
||||
"display": "推力瓦数"
|
||||
},
|
||||
"TurbineManufacturer": {
|
||||
"content": "0.00",
|
||||
"display": "水轮机制造厂家"
|
||||
},
|
||||
"UnitID": {
|
||||
"content": "1",
|
||||
"display": "机组编号"
|
||||
},
|
||||
"UnitName": {
|
||||
"content": "1号机组",
|
||||
"display": "机组名称"
|
||||
},
|
||||
"UnitStyle": {
|
||||
"Options": [
|
||||
"混流式机组",
|
||||
"轴流定桨式机组",
|
||||
"轴流转浆式机组",
|
||||
"可逆式机组",
|
||||
"灯泡式机组",
|
||||
"冲击式机组"
|
||||
],
|
||||
"content": "轴流转浆式机组",
|
||||
"display": "机组类型"
|
||||
},
|
||||
"UpperGuideVaneWattage": {
|
||||
"content": "12.00",
|
||||
"display": "上导瓦数"
|
||||
},
|
||||
"WaterGuideVaneWattage": {
|
||||
"content": "12.00",
|
||||
"display": "水导瓦数"
|
||||
}
|
||||
}
|
||||
@ -1,16 +0,0 @@
|
||||
{
|
||||
"DeviceIPAddress": [
|
||||
"192.168.1.191192.168.1.192"
|
||||
],
|
||||
"EnterpriseLOGO": "/CIDW/LOGO/logo.jpg",
|
||||
"FunctionMenu": [
|
||||
"实时监测",
|
||||
"事故追溯",
|
||||
"数据组态",
|
||||
"系统设置"
|
||||
],
|
||||
"ProjectName": "安徽绩溪抽水蓄能电站1号机组",
|
||||
"SoftwareName": "南瑞SJ90C状态监测装置状态监测软件V1.0",
|
||||
"Timestamp": "1663593331",
|
||||
"UnitSpeed": "0"
|
||||
}
|
||||
@ -1,425 +0,0 @@
|
||||
{
|
||||
"WorkConditionChannels": [
|
||||
{
|
||||
"BoardNo": 1,
|
||||
"ChannelDispalyName": "有功功率通道",
|
||||
"ChannelName": "有功功率",
|
||||
"ChannelNoInBoard": 1,
|
||||
"Enable": 1,
|
||||
"WorkConditionChannelType": 1
|
||||
},
|
||||
{
|
||||
"BoardNo": 1,
|
||||
"ChannelDispalyName": "无功功率通道",
|
||||
"ChannelName": "无功功率",
|
||||
"ChannelNoInBoard": 2,
|
||||
"Enable": 1,
|
||||
"WorkConditionChannelType": 2
|
||||
},
|
||||
{
|
||||
"BoardNo": 1,
|
||||
"ChannelDispalyName": "励磁电流通道",
|
||||
"ChannelName": "励磁电流",
|
||||
"ChannelNoInBoard": 3,
|
||||
"Enable": 1,
|
||||
"WorkConditionChannelType": 3
|
||||
},
|
||||
{
|
||||
"BoardNo": 1,
|
||||
"ChannelDispalyName": "导叶开度通道",
|
||||
"ChannelName": "导叶开度",
|
||||
"ChannelNoInBoard": 4,
|
||||
"Enable": 1,
|
||||
"WorkConditionChannelType": 4
|
||||
},
|
||||
{
|
||||
"BoardNo": 0,
|
||||
"ChannelDispalyName": "桨叶开度通道",
|
||||
"ChannelName": "桨叶开度",
|
||||
"ChannelNoInBoard": 0,
|
||||
"Enable": 0,
|
||||
"WorkConditionChannelType": 5
|
||||
},
|
||||
{
|
||||
"BoardNo": 2,
|
||||
"ChannelDispalyName": "工作水头通道",
|
||||
"ChannelName": "机组水头",
|
||||
"ChannelNoInBoard": 1,
|
||||
"Enable": 1,
|
||||
"WorkConditionChannelType": 6
|
||||
},
|
||||
{
|
||||
"BoardNo": 2,
|
||||
"ChannelDispalyName": "机组流量通道",
|
||||
"ChannelName": "机组流量",
|
||||
"ChannelNoInBoard": 2,
|
||||
"Enable": 1,
|
||||
"WorkConditionChannelType": 7
|
||||
},
|
||||
{
|
||||
"BoardNo": 0,
|
||||
"ChannelDispalyName": "蜗壳差压通道",
|
||||
"ChannelName": "蜗壳差压",
|
||||
"ChannelNoInBoard": 0,
|
||||
"Enable": 0,
|
||||
"WorkConditionChannelType": 8
|
||||
},
|
||||
{
|
||||
"BoardNo": 0,
|
||||
"ChannelDispalyName": "机组效率通道",
|
||||
"ChannelName": "机组效率",
|
||||
"ChannelNoInBoard": 0,
|
||||
"Enable": 0,
|
||||
"WorkConditionChannelType": 9
|
||||
},
|
||||
{
|
||||
"BoardNo": 0,
|
||||
"ChannelDispalyName": "发电机出口开关通道",
|
||||
"ChannelName": "发电机出口开关",
|
||||
"ChannelNoInBoard": 0,
|
||||
"Enable": 0,
|
||||
"WorkConditionChannelType": 10
|
||||
},
|
||||
{
|
||||
"BoardNo": 0,
|
||||
"ChannelDispalyName": "励磁开关通道",
|
||||
"ChannelName": "励磁开关",
|
||||
"ChannelNoInBoard": 0,
|
||||
"Enable": 0,
|
||||
"WorkConditionChannelType": 11
|
||||
},
|
||||
{
|
||||
"BoardNo": 0,
|
||||
"ChannelDispalyName": "发电/抽水工况通道",
|
||||
"ChannelName": "发电/抽水工况",
|
||||
"ChannelNoInBoard": 0,
|
||||
"Enable": 0,
|
||||
"WorkConditionChannelType": 12
|
||||
},
|
||||
{
|
||||
"BoardNo": 0,
|
||||
"ChannelDispalyName": "蜗壳进口压力通道",
|
||||
"ChannelName": "蜗壳进口压力",
|
||||
"ChannelNoInBoard": 0,
|
||||
"Enable": 0,
|
||||
"WorkConditionChannelType": 13
|
||||
},
|
||||
{
|
||||
"BoardNo": 0,
|
||||
"ChannelDispalyName": "尾水出口压力通道",
|
||||
"ChannelName": "尾水出口压力",
|
||||
"ChannelNoInBoard": 0,
|
||||
"Enable": 0,
|
||||
"WorkConditionChannelType": 14
|
||||
},
|
||||
{
|
||||
"BoardNo": 2,
|
||||
"ChannelDispalyName": "转速通道",
|
||||
"ChannelName": "转速",
|
||||
"ChannelNoInBoard": 1,
|
||||
"Enable": 1,
|
||||
"WorkConditionChannelType": 15
|
||||
}
|
||||
],
|
||||
"WorkConditionTemplates": [
|
||||
{
|
||||
"TemplatesName": "常规机组工况模板",
|
||||
"WorkConditions": [
|
||||
{
|
||||
"CheckWorkConditionInterval": 5,
|
||||
"Description": "稳态工况:机组工作在稳态",
|
||||
"Enable": 1,
|
||||
"SN": "1",
|
||||
"StartWorkCondition": false,
|
||||
"WorkConditionName": "稳态工况",
|
||||
"WorkConditionRules": [
|
||||
{
|
||||
"BoardNo": 2,
|
||||
"ChannelName": "转速",
|
||||
"ChannelNoInBoard": 1,
|
||||
"EnRangeLower": true,
|
||||
"EnableCheckVolatility": 0,
|
||||
"LowerSideOfRange": 95,
|
||||
"LowerSideOfRangePercent": true,
|
||||
"WorkConditionChannelType": 15
|
||||
},
|
||||
{
|
||||
"BoardNo": 7,
|
||||
"ChannelName": "有功功率",
|
||||
"ChannelNoInBoard": 1,
|
||||
"EnRangeLower": true,
|
||||
"EnVolatilityRangeUpper": true,
|
||||
"EnableCheckVolatility": 1,
|
||||
"LowerSideOfRange": 5,
|
||||
"LowerSideOfRangePercent": false,
|
||||
"UpperSideOfVolatilityRange": 5,
|
||||
"UpperSideOfVolatilityRangePercent": false,
|
||||
"WorkConditionChannelType": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"CheckWorkConditionInterval": 5,
|
||||
"Description": "停机工况:机组处于停机状态",
|
||||
"Enable": 1,
|
||||
"SN": "2",
|
||||
"StartWorkCondition": true,
|
||||
"WorkConditionName": "停机工况",
|
||||
"WorkConditionRules": [
|
||||
{
|
||||
"BoardNo": 2,
|
||||
"ChannelName": "转速",
|
||||
"ChannelNoInBoard": 1,
|
||||
"EnRangeUpper": true,
|
||||
"EnableCheckVolatility": 0,
|
||||
"UpperSideOfRange": 5,
|
||||
"UpperSideOfRangePercent": true,
|
||||
"WorkConditionChannelType": 15
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"CheckWorkConditionInterval": 5,
|
||||
"Description": "变负荷工况:机组处于负荷变化的过程,是稳态过程",
|
||||
"Enable": 1,
|
||||
"SN": "3",
|
||||
"StartWorkCondition": false,
|
||||
"WorkConditionName": "变负荷工况",
|
||||
"WorkConditionRules": [
|
||||
{
|
||||
"BoardNo": 2,
|
||||
"ChannelName": "转速",
|
||||
"ChannelNoInBoard": 1,
|
||||
"EnRangeLower": true,
|
||||
"EnableCheckVolatility": 0,
|
||||
"LowerSideOfRange": 95,
|
||||
"LowerSideOfRangePercent": true,
|
||||
"WorkConditionChannelType": 15
|
||||
},
|
||||
{
|
||||
"BoardNo": 7,
|
||||
"ChannelName": "有功功率",
|
||||
"ChannelNoInBoard": 1,
|
||||
"EnRangeLower": true,
|
||||
"EnVolatilityRangeLower": true,
|
||||
"EnableCheckVolatility": 1,
|
||||
"LowerSideOfRange": 5,
|
||||
"LowerSideOfRangePercent": false,
|
||||
"LowerSideOfVolatilityRange": 5,
|
||||
"LowerSideOfVolatilityRangePercent": false,
|
||||
"WorkConditionChannelType": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TemplatesName": "抽水蓄能机组工况模板",
|
||||
"WorkConditions": [
|
||||
{
|
||||
"CheckWorkConditionInterval": 5,
|
||||
"Description": "停机工况",
|
||||
"Enable": 1,
|
||||
"SN": "1",
|
||||
"StartWorkCondition": true,
|
||||
"WorkConditionName": "停机",
|
||||
"WorkConditionRules": [
|
||||
{
|
||||
"ChannelName": "停机",
|
||||
"EnableCheckVolatility": 0,
|
||||
"LowerSideOfRange": 1,
|
||||
"UpperSideOfRange": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"CheckWorkConditionInterval": 5,
|
||||
"Description": "发电工况",
|
||||
"Enable": 1,
|
||||
"SN": "2",
|
||||
"StartWorkCondition": false,
|
||||
"WorkConditionName": "发电",
|
||||
"WorkConditionRules": [
|
||||
{
|
||||
"ChannelName": "发电",
|
||||
"EnableCheckVolatility": 0,
|
||||
"LowerSideOfRange": 1,
|
||||
"UpperSideOfRange": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"CheckWorkConditionInterval": 5,
|
||||
"Description": "发电调相工况",
|
||||
"Enable": 1,
|
||||
"SN": "3",
|
||||
"StartWorkCondition": false,
|
||||
"WorkConditionName": "发电调相",
|
||||
"WorkConditionRules": [
|
||||
{
|
||||
"ChannelName": "发电调相",
|
||||
"EnableCheckVolatility": 0,
|
||||
"LowerSideOfRange": 1,
|
||||
"UpperSideOfRange": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"CheckWorkConditionInterval": 5,
|
||||
"Description": "抽水调相工况",
|
||||
"Enable": 1,
|
||||
"SN": "4",
|
||||
"StartWorkCondition": false,
|
||||
"WorkConditionName": "抽水调相",
|
||||
"WorkConditionRules": [
|
||||
{
|
||||
"ChannelName": "抽水调相",
|
||||
"EnableCheckVolatility": 0,
|
||||
"LowerSideOfRange": 1,
|
||||
"UpperSideOfRange": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"CheckWorkConditionInterval": 5,
|
||||
"Description": "水泵工况",
|
||||
"Enable": 1,
|
||||
"SN": "5",
|
||||
"StartWorkCondition": false,
|
||||
"WorkConditionName": "水泵",
|
||||
"WorkConditionRules": [
|
||||
{
|
||||
"ChannelName": "水泵",
|
||||
"EnableCheckVolatility": 0,
|
||||
"LowerSideOfRange": 1,
|
||||
"UpperSideOfRange": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"WorkConditionsInfo": [
|
||||
{
|
||||
"CheckWorkConditionInterval": 5,
|
||||
"Description": "稳态工况:机组工作在稳态",
|
||||
"Enable": 1,
|
||||
"SN": "1",
|
||||
"StartWorkCondition": false,
|
||||
"WorkConditionJudgeLogicRules": {
|
||||
"logicAND": [
|
||||
{
|
||||
"WC_NO": 1,
|
||||
"key": "wSBQDfNRYWeBT-oe1SvCB"
|
||||
},
|
||||
{
|
||||
"WC_NO": 2,
|
||||
"key": "wSBQDfNRYWeBT-oe1SvCc"
|
||||
}
|
||||
]
|
||||
},
|
||||
"WorkConditionName": "稳态工况",
|
||||
"WorkConditionRules": [
|
||||
{
|
||||
"BoardNo": 1,
|
||||
"ChannelName": "转速",
|
||||
"ChannelNoInBoard": 1,
|
||||
"EnLowerSideOfRangePercent": true,
|
||||
"EnRangeLower": true,
|
||||
"EnableCheckVolatility": 0,
|
||||
"LowerSideOfRange": 95,
|
||||
"WC_NO": 1,
|
||||
"WorkConditionChannelType": 15
|
||||
},
|
||||
{
|
||||
"BoardNo": 2,
|
||||
"ChannelName": "有功功率",
|
||||
"ChannelNoInBoard": 1,
|
||||
"EnLowerSideOfRangePercent": true,
|
||||
"EnRangeLower": true,
|
||||
"EnVolatilityRangeUpper": true,
|
||||
"EnableCheckVolatility": 1,
|
||||
"LowerSideOfRange": 5,
|
||||
"UpperSideOfVolatilityRange": 5,
|
||||
"WC_NO": 2,
|
||||
"WorkConditionChannelType": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"CheckWorkConditionInterval": 5,
|
||||
"Description": "停机工况:机组处于停机状态",
|
||||
"Enable": 1,
|
||||
"SN": "2",
|
||||
"StartWorkCondition": true,
|
||||
"WorkConditionJudgeLogicRules": {
|
||||
"logicAND": [
|
||||
{
|
||||
"WC_NO": 1,
|
||||
"key": "wSBQDfNRYWeBT-oe1SvCc"
|
||||
}
|
||||
]
|
||||
},
|
||||
"WorkConditionName": "停机工况",
|
||||
"WorkConditionRules": [
|
||||
{
|
||||
"BoardNo": 1,
|
||||
"ChannelName": "转速",
|
||||
"ChannelNoInBoard": 1,
|
||||
"EnRangeUpper": true,
|
||||
"EnUpperSideOfRangePercent": true,
|
||||
"EnableCheckVolatility": 0,
|
||||
"UpperSideOfRange": 5,
|
||||
"WC_NO": 1,
|
||||
"WorkConditionChannelType": 15
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"CheckWorkConditionInterval": 5,
|
||||
"Description": "变负荷工况:机组处于负荷变化的过程,是稳态过程",
|
||||
"Enable": 1,
|
||||
"SN": "3",
|
||||
"StartWorkCondition": false,
|
||||
"WorkConditionJudgeLogicRules": {
|
||||
"logicAND": [
|
||||
{
|
||||
"WC_NO": 1,
|
||||
"key": "wSBQDfNRYWeBT-oe1SvCB"
|
||||
},
|
||||
{
|
||||
"WC_NO": 2,
|
||||
"key": "wSBQDfNRYWeBT-oe1SvCc"
|
||||
}
|
||||
]
|
||||
},
|
||||
"WorkConditionName": "变负荷工况",
|
||||
"WorkConditionRules": [
|
||||
{
|
||||
"BoardNo": 1,
|
||||
"ChannelName": "转速",
|
||||
"ChannelNoInBoard": 1,
|
||||
"EnLowerSideOfRangePercent": true,
|
||||
"EnRangeLower": true,
|
||||
"EnableCheckVolatility": 0,
|
||||
"LowerSideOfRange": 95,
|
||||
"WC_NO": 1,
|
||||
"WorkConditionChannelType": 15
|
||||
},
|
||||
{
|
||||
"BoardNo": 2,
|
||||
"ChannelName": "有功功率",
|
||||
"ChannelNoInBoard": 1,
|
||||
"EnLowerSideOfRangePercent": true,
|
||||
"EnRangeLower": true,
|
||||
"EnVolatilityRangeLower": true,
|
||||
"EnableCheckVolatility": 1,
|
||||
"LowerSideOfRange": 5,
|
||||
"LowerSideOfVolatilityRange": 5,
|
||||
"WC_NO": 2,
|
||||
"WorkConditionChannelType": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
BIN
config/config.db
BIN
config/config.db
Binary file not shown.
BIN
image/unit/1.png
BIN
image/unit/1.png
Binary file not shown.
|
Before Width: | Height: | Size: 164 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 183 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 528 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 217 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 122 KiB |
@ -30,7 +30,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
QDate buildDate = QLocale( QLocale::English ).toDate( QString(__DATE__).replace(" ", " 0"), "MMM dd yyyy");
|
||||
QTime buildTime = QTime::fromString(__TIME__, "hh:mm:ss");
|
||||
|
||||
g_strVersion = "SJ90C V1.1.0_" + buildDate.toString("yyyyMMdd");
|
||||
g_strVersion = "SJ90C V1.2_" + buildDate.toString("yyyyMMdd");
|
||||
customLogMessageHandler(QtDebugMsg,g_strVersion + " " + buildTime.toString());
|
||||
g_strProject = settingsread.value("main/Project").toString();
|
||||
g_strFre = settingsread.value("main/Fre").toString();
|
||||
@ -566,7 +566,12 @@ void MainWindow::leftConfigClick4()
|
||||
pOtherConfig = NULL;
|
||||
}
|
||||
QProcess process(this);
|
||||
#ifdef Q_OS_WIN32
|
||||
process.startDetached(".\\Calibration\\NARI3500Calibration.exe");
|
||||
#endif
|
||||
#ifdef Q_OS_LINUX
|
||||
process.startDetached("./Calibration/NARI3500Calibration");
|
||||
#endif
|
||||
}else if(name == "其他配置"){
|
||||
|
||||
if(pDIOBoard){
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -566,12 +566,16 @@ color:#ffffff;
|
||||
background:#245d9b;
|
||||
}
|
||||
|
||||
QTableView::item,QListView::item,QTreeView::item{
|
||||
QTableView::item,QListView::item{
|
||||
padding:1px;
|
||||
margin:0px;
|
||||
border:0px;
|
||||
}
|
||||
|
||||
QTreeView::item{
|
||||
padding:1px;
|
||||
margin:3px;
|
||||
border:0px;
|
||||
}
|
||||
QHeaderView::verticalHeader{
|
||||
background:#ffffff;
|
||||
}
|
||||
|
||||
@ -17,6 +17,7 @@
|
||||
#include <algorithm>
|
||||
#include "customrectitem.h"
|
||||
#include "mygraphicrectitem.h"
|
||||
#include "CustomGraphicsItemGroup.h"
|
||||
|
||||
|
||||
CRealTimeForm::CRealTimeForm(QWidget *parent) :
|
||||
@ -27,10 +28,16 @@ CRealTimeForm::CRealTimeForm(QWidget *parent) :
|
||||
QObject::connect(ui->graphicsView, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(on_graphView_customContextMenuRequested(const QPoint &)));
|
||||
ui->graphicsView->setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
|
||||
m_pGraphicsScene = new QGraphicsScene();
|
||||
m_pGraphicsScene->setBackgroundBrush(Qt::transparent); // 设置场景背景透明
|
||||
m_pGraphicsScene->setSceneRect(0, 0, 600, 550);
|
||||
ui->graphicsView->setScene(m_pGraphicsScene);
|
||||
ui->graphicsView->setDragMode(QGraphicsView::RubberBandDrag);
|
||||
ui->graphicsView->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||
|
||||
ui->graphicsView->setRenderHint(QPainter::Antialiasing, true); // 启用视图抗锯齿
|
||||
ui->graphicsView->setBackgroundBrush(Qt::gray); // 设置视图背景为灰色
|
||||
ui->graphicsView->setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate);
|
||||
|
||||
ui->graphicsView_2->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
QObject::connect(ui->graphicsView_2, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(on_graphView_customContextMenuRequested(const QPoint &)));
|
||||
ui->graphicsView_2->setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
|
||||
@ -308,9 +315,9 @@ void CRealTimeForm::on_addchannel(channelBaseInfo channelbaseInfo, QString str)
|
||||
QPen pen; // 定义一个画笔,设置画笔颜色和宽度
|
||||
pen.setColor(QColor(0, 0, 0, 0));
|
||||
pen.setWidth(1);
|
||||
CMyCustomGraphicsItem *pItemGroup = new CMyCustomGraphicsItem();
|
||||
RoundedGraphicsItemGroup *pItemGroup = new RoundedGraphicsItemGroup();
|
||||
pItemGroup->setCornerRadius(15); // 设置圆角半径
|
||||
QGraphicsRectItem *pRect = new QGraphicsRectItem(0, 0, 290, 30);
|
||||
pRect->setBrush(QBrush(QColor(255, 255, 255)));
|
||||
pRect->setPen(pen);
|
||||
pRect->setPos(0, 0);
|
||||
pRect->setData(1, "Rect");
|
||||
@ -329,9 +336,9 @@ void CRealTimeForm::on_addchannel(channelBaseInfo channelbaseInfo, QString str)
|
||||
} else if (str == "最大正向峰值" || str == "最大负向峰值" ||
|
||||
str == "诊断峰峰值" || str == "平均值") {
|
||||
pTextUnits = new QGraphicsTextItem(channelbaseInfo.sensorEngineeringUnit);
|
||||
} else if (str == "速度峰值" || str == "速度有效值") {
|
||||
} else if (str == "速度峰值" || str == "速度有效值" || str == "积分有效值") {
|
||||
pTextUnits = new QGraphicsTextItem("mm/s");
|
||||
} else {
|
||||
}else {
|
||||
pTextUnits = new QGraphicsTextItem(channelbaseInfo.sensorEngineeringUnit);
|
||||
}
|
||||
} else if (channelbaseInfo.channelType == "PROXIMETER") {
|
||||
@ -387,7 +394,7 @@ void CRealTimeForm::on_addchannel(channelBaseInfo channelbaseInfo, QString str)
|
||||
pTextValue->setFont(font2);
|
||||
pTextValue->setPos(160, -2);
|
||||
pTextValue->setDefaultTextColor(QColor(31, 81, 136));
|
||||
pTextChannel->setPos(0, 2);
|
||||
pTextChannel->setPos(0, 5);
|
||||
pTextChannel->setDefaultTextColor(QColor(27, 30, 35));
|
||||
pTextUnits->setPos(240, 5);
|
||||
// 设置可移动、可选择
|
||||
@ -939,11 +946,13 @@ void CRealTimeForm::LoadGraphicsConfig(int type) {
|
||||
QJsonArray array = arrayValue.toArray();
|
||||
for (int i = 0; i < array.size(); i++) {
|
||||
channelBaseInfo temp;
|
||||
CMyCustomGraphicsItem *pItemGroup = new CMyCustomGraphicsItem();
|
||||
RoundedGraphicsItemGroup *pItemGroup = new RoundedGraphicsItemGroup();
|
||||
pItemGroup->setCornerRadius(15); // 设置圆角半径
|
||||
if (type == 1) {
|
||||
pItemGroup->setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
|
||||
pItemGroup->setFlag(QGraphicsItem::ItemIsSelectable, true);
|
||||
}
|
||||
connect(pItemGroup, SIGNAL(doubleclick(QGraphicsSceneMouseEvent *)), this, SLOT(slotDoubleClick(QGraphicsSceneMouseEvent *)));
|
||||
//connect(pItemGroup, SIGNAL(doubleclick(QGraphicsSceneMouseEvent *)), this, SLOT(slotDoubleClick(QGraphicsSceneMouseEvent *)));
|
||||
//qDebug() << array.at(i)["x"].toDouble() << array.at(i)["y"].toDouble() << endl;
|
||||
QJsonObject jsonObject = array.at(i).toObject();
|
||||
if (jsonObject.contains(QStringLiteral("Rect"))) {
|
||||
@ -961,7 +970,7 @@ void CRealTimeForm::LoadGraphicsConfig(int type) {
|
||||
if (type == 1) {
|
||||
pRect->setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
|
||||
}
|
||||
pRect->setBrush(QBrush(QColor(255, 255, 255)));
|
||||
//pRect->setBrush(QBrush(QColor(255, 255, 255)));
|
||||
pRect->setPen(pen);
|
||||
pItemGroup->addToGroup(pRect);
|
||||
}
|
||||
@ -1103,7 +1112,7 @@ void CRealTimeForm::UpdateCharacteristic(QVector<_Charateristic> &m_vecCharateri
|
||||
str = QString("%1").arg(QString::number(m_vecCharateristic[i].MonitorPk2Pk, 'f', m_vecCharateristic[i].ChUnitDot));
|
||||
} else if (itemData2 == "诊断峰峰值") {
|
||||
str = QString("%1").arg(QString::number(m_vecCharateristic[i].DiagnosisPk2Pk, 'f', m_vecCharateristic[i].ChUnitDot));
|
||||
} else if (itemData2 == "速度有效值" || itemData2 == "位移有效值") {
|
||||
} else if (itemData2 == "积分有效值" || itemData2 == "位移有效值") {
|
||||
str = QString("%1").arg(QString::number(m_vecCharateristic[i].IntegratRMS, 'f', m_vecCharateristic[i].ChUnitDot));
|
||||
} else if (itemData2 == "速度峰值" || itemData2 == "位移峰值") {
|
||||
str = QString("%1").arg(QString::number(m_vecCharateristic[i].IntegratPk2Pk2, 'f', m_vecCharateristic[i].ChUnitDot));
|
||||
@ -1150,6 +1159,7 @@ void CRealTimeForm::UpdateCharacteristic(QVector<_Charateristic> &m_vecCharateri
|
||||
}
|
||||
}
|
||||
sigRPM(RPM);
|
||||
m_RPM = RPM;
|
||||
pGraphicTextItem->setPlainText(str);
|
||||
}
|
||||
}
|
||||
@ -1266,7 +1276,7 @@ void CRealTimeForm::disConnect() {
|
||||
QString str = strTrgStatus + "," + strWCStatus + "," + strinvalid_ch;
|
||||
sigWCStatus(str);
|
||||
sigDOStatus(arrayValueDIs, arrayValueDOs);
|
||||
if (strWCStatus.contains("停机")) {
|
||||
if (m_RPM.toDouble() < 5) {
|
||||
if (m_MachineStatus == 1) {
|
||||
LoadGraphicsConfig(2);
|
||||
}
|
||||
@ -1277,6 +1287,17 @@ void CRealTimeForm::disConnect() {
|
||||
}
|
||||
m_MachineStatus = 1;
|
||||
}
|
||||
// if (strWCStatus.contains("停机")) {
|
||||
// if (m_MachineStatus == 1) {
|
||||
// LoadGraphicsConfig(2);
|
||||
// }
|
||||
// m_MachineStatus = 0;
|
||||
// } else {
|
||||
// if (m_MachineStatus == 0) {
|
||||
// LoadGraphicsConfig(0);
|
||||
// }
|
||||
// m_MachineStatus = 1;
|
||||
// }
|
||||
}
|
||||
}
|
||||
m_arrayReady = "";
|
||||
|
||||
@ -169,6 +169,7 @@ private:
|
||||
|
||||
NetMgr *m_pNetMgr; //HTTP消息类对象
|
||||
QVector<_Charateristic> m_vecCharateristic;
|
||||
QString m_RPM;
|
||||
//重写定时器的事件 虚函数 子类重写父类的虚函数
|
||||
virtual void timerEvent(QTimerEvent *);
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user