add project model ct/pt polarity

This commit is contained in:
baiYue 2026-01-16 18:40:46 +08:00
parent 73019c5a6d
commit 7c61e7d8e1
33 changed files with 1724 additions and 634 deletions

View File

@ -881,23 +881,23 @@ struct DiagramContent {
struct PtExtraInfo
{
int id;
QString minTransRatio; //最小变比
QString maxTransRatio; //最大变比
QString transRatio; //变比
QString accuracyClass; //精度等级
QString secondaryLoadCapacity; //二次负载容量
QString windingConnectionMethod; //绕组接法
int index = 0;
QString scope; //变比标签
QString accuracy; //精度等级标签
QString volume; //二次负载容量标签
QString star; //线圈接法
double ratio; //变比
int polarity = 1; //极性
};
struct CtExtraInfo
{
int id;
QString transRatio; //变比
QString minTransRatio; //最小变比
QString maxTransRatio; //最大变比
QString accuracyClass; //精度等级
QString secondaryLoadCapacity; //二次负载容量
int index = 0;
QString scope; //变比标签
QString accuracy; //精度等级标签
QString volume; //二次负载容量标签
double ratio; //变比
int polarity = 1; //极性
};
struct MeasurementInfo //量测
@ -922,6 +922,13 @@ struct MeasurementInfo //量测
QString sEdge; //遥信"cause:edge" raising, falling 字符串单选
QString sCommand; //"action:command" info, warning, error, critical, exception 字符串单选
QStringList lstParameter; //"action:parameters" 字符串数组
QString sWindType; //绕组类型 ctpt
int nRatio; //变比
int nPolarity; //极性
int nIndex; //对应绕组序号
QString sSymmetry; //对称量测的tag
};
//属性其他参数与层级关系
@ -950,6 +957,7 @@ struct ExtraProperty
QString page_tag;
QString bay_tag;
QUuid component_uuid;
QString component_tag;
QString group_tag;
QString type_tag;
@ -957,6 +965,7 @@ struct ExtraProperty
QString sourceType; // "property", "measurement"
QVariantMap sourceConfig;
bool bDataChanged = false; //数据改变标志(临时)
// 获取完整路径
QString getFullName() const {
QStringList parts = {grid_name, zone_name, station_name, currentLevel, bay_name, component_name, group_name, name};

View File

@ -5,5 +5,5 @@ const QMap<AbstractItemType,GraphicsItemType> linkType = {
};
//类型转换
const QMap<int,GraphicsItemType> typeToProGraphic = {
{0,GIT_node},{1,GIT_bus},{3,GIT_itemRect},{4,GIT_ctGroup},{6,GIT_ES},{7,GIT_FES},{8,GIT_link},{9,GIT_DS},{10,GIT_DTEDS},{11,GIT_PI},{12,GIT_LA},{13,GIT_cableTer},{14,GIT_cableEnd},{15,GIT_2wTransformer},{16,GIT_3wTransformer}
{0,GIT_node},{1,GIT_bus},{3,GIT_itemRect},{4,GIT_ctGroup},{5,GIT_ptGroup},{6,GIT_ES},{7,GIT_FES},{8,GIT_link},{9,GIT_DS},{10,GIT_DTEDS},{11,GIT_PI},{12,GIT_LA},{13,GIT_cableTer},{14,GIT_cableEnd},{15,GIT_2wTransformer},{16,GIT_3wTransformer}
};

View File

@ -48,6 +48,8 @@ set(DIAGRAMCAVAS_HEADER_FILES
include/structDataPropertyModel.h
include/structDataMeasurementDelegate.h
include/structDataPropertyDelegate.h
include/structDataCauseEditDlg.h
include/structDataActionParaDlg.h
include/diagramEditor/editPanel.h
include/diagramEditor/editView.h
include/diagramEditor/editScene.h
@ -178,6 +180,8 @@ set(DIAGRAMCAVAS_SOURCE_FILES
source/structDataPropertyModel.cpp
source/structDataMeasurementDelegate.cpp
source/structDataPropertyDelegate.cpp
source/structDataCauseEditDlg.cpp
source/structDataActionParaDlg.cpp
source/diagramEditor/editPanel.cpp
source/diagramEditor/editView.cpp
source/diagramEditor/editScene.cpp

View File

@ -26,10 +26,12 @@ public:
virtual void setPropertyValue(QVariant) = 0;
void setModelController(FixedPortsModel* p){_curModelController = p;}
auto getModelController() {return _curModelController;}
void setExtendProperty(propertyStateInfo info) {_extendInfo = info;} //设置跨组别使用的公共变量(ct,pt使用extend绕组信息)
protected:
QMap<QString,propertyContentInfo> _mapPro;
QFormLayout* createFormLayout(QWidget* parent);
FixedPortsModel* _curModelController;
propertyStateInfo _extendInfo;
};
#endif

View File

@ -44,6 +44,7 @@ private:
MeasureSettingDlg* _measureDlg;
QList<measureAttributeType> _validType; //可用的属性列表
QMap<QString,MeasurementInfo> _mapMeasure; //量测列表
bool bShowDouble = false; //显示double界面
};
#endif

View File

@ -26,14 +26,20 @@ public:
virtual void setPropertyValue(QVariant);
public slots:
void onAddClicked();
void onDeleteClicked();
void onTableCustomContextMenuRequested(const QPoint &pos);
protected:
void addTableRow(QString,QString,QString,QString,QString,int id = -1);
void addTableRow(QString sRatioRange,QString sAccuracy,QString sVolume,double dRatio,bool bPolarity,int index = -1);
private:
void updateShowLabel(QStringList lst);
void updateLables();
void deleteRowWithReindex(int row);
void reorderMapAndUpdateIndices(int startRow);
private:
Ui::ctExtraInfoDlg *ui;
QMap<QString,CtExtraInfo> _mapCT;
QButtonGroup* _stateGroup_ct;
int _count;
QStringList _curLabels;
};
#endif

View File

@ -13,6 +13,9 @@ QT_END_NAMESPACE
class BayInfoDlg;
struct MeasurementInfo;
struct HttpRecommandInfo;
struct propertyStateInfo;
struct CtExtraInfo;
struct PtExtraInfo;
class MeasureSettingDlg : public QDialog
{
@ -23,8 +26,8 @@ public:
void initial();
void setBay(BayInfoDlg* p) {_pBay = p;}
void showDlg();
void showDlg(MeasurementInfo); //修改
void showDlg(int type,propertyStateInfo,bool isDouble = false);
void showDlg(MeasurementInfo,propertyStateInfo,bool isDouble = false); //修改
public slots:
void onOkClicked();
void onCancelClicked();
@ -41,6 +44,9 @@ public slots:
void onHttpDataUpdated(HttpRecommandInfo); //更新推荐对象列表(若有)
private:
void clearData();
//void setDbCheckVisible(bool); //设置double勾选可见性
void setDbTagVisible(bool); //设置double tag可见性
QJsonObject safeToJsonObject(const QVariant& var); //var转json
private:
Ui::measureSettingDlg *ui;
BayInfoDlg* _pBay;
@ -48,6 +54,11 @@ private:
QButtonGroup* _pEventStrategy; //事件策略组
QButtonGroup* _pEventYXGroup; //遥信事件组
bool _curMode; //0新增1修改
QMap<int,CtExtraInfo> _tempCtMap;
QMap<int,PtExtraInfo> _tempPtMap;
int _curComponentType;
bool _isDouble = false;
};
#endif

View File

@ -26,9 +26,12 @@ public:
virtual void setPropertyValue(QVariant);
public slots:
void onAddClicked();
void onDeleteClicked();
void onTableCustomContextMenuRequested(const QPoint &pos);
protected:
void addTableRow(QString,QString,QString,QString,QString,QString,int id = -1);
void addTableRow(QString sRatioRange,QString sAccuracy,QString sVolume,QString sStar,double dRatio,bool bPolarity,int index = -1);
private:
void deleteRowWithReindex(int row);
void reorderMapAndUpdateIndices(int startRow);
private:
Ui::ptExtraInfoDlg *ui;
QMap<QString,PtExtraInfo> _mapPT;

View File

@ -0,0 +1,29 @@
#ifndef STRUCTDATAACTIONPARADLG_H
#define STRUCTDATAACTIONPARADLG_H
/**
* action_para配置界面
* */
#include <QDialog>
#include <QListWidget>
class StructDataActionParaDlg : public QDialog {
Q_OBJECT
public:
StructDataActionParaDlg(QWidget* parent = nullptr);
void setAlarms(const QStringList &alarms);
QStringList alarms() const;
private slots:
void onAddClicked();
void onDeleteClicked();
private:
QListWidget *m_listWidget;
QLineEdit *m_editLine;
QPushButton *m_btnAdd;
QPushButton *m_btnDelete;
QPushButton *m_btnClear;
QPushButton *m_btnOk;
QPushButton *m_btnCancel;
};
#endif

View File

@ -0,0 +1,30 @@
#ifndef STRUCTDATACAUSEEDITDLG_H
#define STRUCTDATACAUSEEDITDLG_H
/**
* cause配置界面
* */
#include <QDialog>
#include <QCheckBox>
#include <QDoubleSpinBox>
#include <QDialogButtonBox>
class StructDataCauseEditDlg : public QDialog {
Q_OBJECT
public:
explicit StructDataCauseEditDlg(const QMap<QString, double>& initialData,QWidget* parent = nullptr);
QMap<QString, double> getData() const;
void setData(const QMap<QString, double>& data);
void setupUI();
void updateUIFromData();
void updateTotal();
private:
QStringList m_availableKeys;
QMap<QString, QCheckBox*> m_checkBoxes;
QMap<QString, QDoubleSpinBox*> m_spinBoxes;
QDialogButtonBox* m_buttonBox;
QMap<QString, double> m_data;
};
#endif

View File

@ -48,6 +48,11 @@ private:
QWidget* createNumberEditor(QWidget* parent) const;
QWidget* createEnableEditor(QWidget* parent) const;
QWidget* createCauseYCEditor(QWidget* parent, const QModelIndex& index) const; //创建遥测cause输入对话框
QWidget* createCauseYXEditor(QWidget* parent) const; //遥信cause
QWidget* createCommandEditor(QWidget* parent) const; //事件command
QWidget* createActionParaEditor(QWidget* parent) const; //事件actionpara
QString getParaType(const QModelIndex& index) const; //获取当前的协议方式
private:
QCompleter* _connectCompleter = nullptr; //自动补全的completer
};

View File

@ -28,7 +28,10 @@ public:
ColChannel = 10,
ColPacket = 11,
ColOffset = 12,
ColEnable = 13,
ColEnable = 13, //事件
ColCause = 14, //原因
ColCommand = 15, //动作
ColParameters = 16, //参数
ColumnCount
};
@ -65,8 +68,8 @@ signals:
void propertyModified(int row, const ExtraProperty& prop);
private:
ExtraProperty* getProperty(int displayRow) const;
QVariant getMeasurementData(const ExtraProperty& prop, int col) const;
bool updateMeasurementData(MeasurementInfo* data, int col, const QVariant& value);
QVariant getMeasurementData(const ExtraProperty& prop, int col, int role) const;
bool updateMeasurementData(MeasurementInfo* data, int col, const QVariant& value,int role);
QString getTypeText(int type) const;
QString getSourceText(int source) const;
int getSourceInt(QString) const;

View File

@ -48,6 +48,8 @@ public:
QStandardItem* root,
QStandardItem* pItem);
void updateRecommandLst(QStringList); //更新当前推荐列表
void addLog(const QString &message);
public slots:
void onExitClicked();
void onSaveClicked();

View File

@ -78,7 +78,7 @@ signals:
public:
QMap<QString, ExtraProperty> allProperties;
private:
QMap<QString, modelDataInfo> m_propertyData;
QMap<QString, MeasurementInfo> m_measurementData;
QMap<QString, modelDataInfo> m_propertyData; //参量
QMap<QString, MeasurementInfo> m_measurementData; //量测
};
#endif

View File

@ -9,7 +9,6 @@
#include "measureSettingDlg.h"
#include "graphicsItem/electricBayItem.h"
#include "graphicsDataModel/fixedPortsModel.h"
#include "basePropertyManager.h"
#include "dataBase.h"
BayInfoDlg::BayInfoDlg(QWidget *parent)
@ -292,13 +291,6 @@ void BayInfoDlg::addMeasure(MeasurementInfo info,int mode)
info.componentUuid = itemId;
_mapMeasure.insert(info.name,info);
}
/*for(int i = 0;i < _validType.size();++i){
if(_validType.at(i).name == info.name){ //可用类型中移除该类型
_validType.removeAt(i);
break;
}
}*/
}
else if(mode == 1){ //修改
QModelIndexList selectedIndexes = ui->tableWidget_local->selectionModel()->selectedRows();
@ -362,7 +354,32 @@ void BayInfoDlg::onAddClicked()
_measureDlg = new MeasureSettingDlg(this);
_measureDlg->setBay(this);
}
_measureDlg->showDlg();
int curType = 0; //当前对象类型
if(_itemProperty)
curType = _itemProperty->type();
bool isDouble = false;
if(_bayProperty){ //判断double
QString sBayType = _bayProperty->getType();
if(sBayType == "分段间隔" || sBayType == "母联间隔"){
if(_curModelController){
int ctCount = 0;
auto lstUuid = _bayProperty->getLstComponent(); //获取间隔下的所有设备
for(auto& uid:lstUuid){
BaseProperty* pPro = BasePropertyManager::instance().findEntityData(uid);
if(pPro){
if(pPro->type() == 4){ //该设备是ct
ctCount += 1;
}
}
}
if(ctCount == 1) //只有1个ct时置为double
isDouble = true;
}
}
}
_measureDlg->showDlg(curType,_extendInfo,isDouble);
}
void BayInfoDlg::onDeleteClicked()
@ -419,7 +436,7 @@ void BayInfoDlg::onModifyClicked()
_measureDlg = new MeasureSettingDlg(this);
_measureDlg->setBay(this);
}
_measureDlg->showDlg(info);
_measureDlg->showDlg(info,_extendInfo);
}
}

View File

@ -5,6 +5,7 @@
#include <QButtonGroup>
#include <QJsonArray>
#include <QJsonDocument>
#include <QMenu>
CtExtraInfoDlg::CtExtraInfoDlg(QWidget *parent)
: BaseContentDlg(parent)
@ -16,7 +17,12 @@ CtExtraInfoDlg::CtExtraInfoDlg(QWidget *parent)
_stateGroup_ct->addButton(ui->rb_zst_ct,0);
connect(ui->btn_add_ct,&QPushButton::clicked,this,&CtExtraInfoDlg::onAddClicked);
_count = 0;
ui->tb_ct->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
_count = 1;
ui->tb_ct->setContextMenuPolicy(Qt::CustomContextMenu);
connect(ui->tb_ct, &QTableWidget::customContextMenuRequested, this, &CtExtraInfoDlg::onTableCustomContextMenuRequested);
}
CtExtraInfoDlg::~CtExtraInfoDlg()
@ -84,15 +90,15 @@ QMap<QString,propertyStateInfo> CtExtraInfoDlg::getPropertyValue(BaseProperty* p
{
QJsonObject object;
QJsonArray arr;
for(auto info:_mapCT)
for(auto &info:_mapCT)
{
QJsonObject obj;
obj["id"] = info.id;
obj["minTransformationRatio"] = info.minTransRatio;
obj["maxTransformationRatio"] = info.maxTransRatio;
obj["transformationRatio"] = info.transRatio;
obj["accuracyClass"] = info.accuracyClass;
obj["secondaryLoadCapacity"] = info.secondaryLoadCapacity;
obj["index"] = info.index;
obj["scope"] = info.scope;
obj["accuracy"] = info.accuracy;
obj["volume"] = info.volume;
obj["ratio"] = info.ratio;
obj["polarity"] = info.polarity;
arr.push_back(obj);
}
object["winding"] = arr;
@ -157,14 +163,14 @@ void CtExtraInfoDlg::setPropertyValue(QVariant var)
for (QJsonValueRef jsonObj : arr)
{
QJsonObject node = jsonObj.toObject();
int id = node["id"].toInt();
QString sTr = node["transformationRatio"].toString();
QString sMinTr = node["minTransformationRatio"].toString();
QString sMaxTr = node["maxTransformationRatio"].toString();
QString sAr = node["accuracyClass"].toString();
QString sSlc = node["secondaryLoadCapacity"].toString();
int index = node["index"].toInt();
QString sRatioRange = node["scope"].toString();
QString sAccuracy = node["accuracy"].toString();
QString sVolume = node["volume"].toString();
double dRatio = node["ratio"].toDouble();
bool bPolarity = node["polarity"].toBool();
addTableRow(sTr,sMinTr,sMaxTr,sAr,sSlc,id);
addTableRow(sRatioRange,sAccuracy,sVolume,dRatio,bPolarity,index);
}
}
}
@ -172,75 +178,152 @@ void CtExtraInfoDlg::setPropertyValue(QVariant var)
void CtExtraInfoDlg::onAddClicked()
{
QString sTr = ui->le_tr_ct->text();
QString sMinTr = ui->le_trMin_ct->text();
QString sMaxTr = ui->le_trMax_ct->text();
QString sAr = ui->le_ac_ct->text();
QString sSlc = ui->le_slc_ct->text();
addTableRow(sTr,sMinTr,sMaxTr,sAr,sSlc);
QString sRatioRange = ui->le_tr_range_ct->text();
QString sAccuracy= ui->le_ac_ct->text();
QString sVolume = ui->le_slc_ct->text();
double dRatio = ui->le_tr_ct->text().toDouble();
bool bPolarity = ui->cb_polarity->checkState();
int index = -1;
if(ui->rb_zst_ct->isChecked())
index = 0;
addTableRow(sRatioRange,sAccuracy,sVolume,dRatio,bPolarity,index);
}
void CtExtraInfoDlg::onDeleteClicked()
{
QPushButton *btn = qobject_cast<QPushButton*>(sender());
if (btn) {
// 获取按钮在表格中的位置
QModelIndex index = ui->tb_ct->indexAt(btn->pos());
if (index.isValid()) {
QTableWidgetItem* pFirstItem = ui->tb_ct->item(index.row(),0);
int id = pFirstItem->data(Qt::UserRole).toInt();
_mapCT.remove(QString::number(id));
ui->tb_ct->removeRow(index.row());
}
void CtExtraInfoDlg::onTableCustomContextMenuRequested(const QPoint &pos) {
QModelIndex index = ui->tb_ct->indexAt(pos);
if (!index.isValid()) {
return;
}
}
void CtExtraInfoDlg::addTableRow(QString sTr,QString sMinTr,QString sMaxTr,QString sAr,QString sSlc,int id)
int row = index.row();
// 创建右键菜单
QMenu menu(this);
QAction *deleteAction = menu.addAction("删除此行");
// 连接删除操作
connect(deleteAction, &QAction::triggered, this, [this, row]() {
deleteRowWithReindex(row);
updateLables();
});
menu.exec(ui->tb_ct->viewport()->mapToGlobal(pos));
}
void CtExtraInfoDlg::addTableRow(QString sRatioRange,QString sAccuracy,QString sVolume,double dRatio,bool bPolarity,int index)
{
if(_mapCT.contains(QString::number(id)))
if(_mapCT.contains(QString::number(index)))
{
return;
}
CtExtraInfo info;
if(id == -1){ //缺省id时新建否则加载
info.id = _count;
if(index == -1){ //缺省id时新建否则加载
info.index = _count;
_count += 1;
}
else{
info.id = id;
info.index = index;
}
int row = ui->tb_ct->rowCount();
ui->tb_ct->insertRow(row);
// 变比(输入框)
QTableWidgetItem *item = new QTableWidgetItem(sTr);
item->setData(Qt::UserRole,info.id);
//index
QTableWidgetItem *item = new QTableWidgetItem(QString::number(info.index));
item->setData(Qt::UserRole,info.index);
ui->tb_ct->setItem(row, 0, item);
//最小变比
ui->tb_ct->setItem(row, 1, new QTableWidgetItem(sMinTr));
//变比范围
ui->tb_ct->setItem(row, 1, new QTableWidgetItem(sRatioRange));
//最大变比
ui->tb_ct->setItem(row, 2, new QTableWidgetItem(sMaxTr));
//精度等级
ui->tb_ct->setItem(row, 2, new QTableWidgetItem(sAccuracy));
// 精度等级(下拉框)
ui->tb_ct->setItem(row, 3, new QTableWidgetItem(sAr));
//二次负载容量
ui->tb_ct->setItem(row, 3, new QTableWidgetItem(sVolume));
// 二次负载容量(输入框)
ui->tb_ct->setItem(row, 4, new QTableWidgetItem(sSlc));
//变比
ui->tb_ct->setItem(row, 4, new QTableWidgetItem(QString::number(dRatio)));
//极性
ui->tb_ct->setItem(row, 5, new QTableWidgetItem(QString::number(bPolarity? 1 : -1)));
// 删除按钮
QPushButton *deleteBtn = new QPushButton("删除");
connect(deleteBtn, &QPushButton::clicked, this, &CtExtraInfoDlg::onDeleteClicked);
ui->tb_ct->setCellWidget(row, 5, deleteBtn);
info.scope = sRatioRange;
info.accuracy = sAccuracy;
info.volume = sVolume;
info.ratio = dRatio;
info.polarity = bPolarity? 1 : -1;
_mapCT.insert(QString::number(info.index),info);
info.transRatio = sTr;
info.minTransRatio = sMinTr;
info.maxTransRatio = sMaxTr;
info.accuracyClass = sAr;
info.secondaryLoadCapacity = sSlc;
_mapCT.insert(QString::number(info.id),info);
updateLables();
}
void CtExtraInfoDlg::updateShowLabel(QStringList lst)
{
_curLabels = lst;
ui->label_title_ct->setText(_curLabels.join(" "));
}
void CtExtraInfoDlg::updateLables()
{
QStringList lst; //更新显示标签
for(auto& info:_mapCT){
QString sLabel = info.scope+" "+info.accuracy+" "+info.volume;
lst.append(sLabel);
}
updateShowLabel(lst);
}
void CtExtraInfoDlg::deleteRowWithReindex(int row) {
// 1. 获取要删除的ID
QTableWidgetItem* pFirstItem = ui->tb_ct->item(row, 0);
if (!pFirstItem) return;
int deletedId = pFirstItem->data(Qt::UserRole).toInt();
QString deletedKey = QString::number(deletedId);
// 2. 从表格中删除行
ui->tb_ct->removeRow(row);
// 3. 从_mapCT中删除对应项
if (_mapCT.contains(deletedKey)) {
_mapCT.remove(deletedKey);
}
// 4. 重新排序和更新index
reorderMapAndUpdateIndices(row);
}
void CtExtraInfoDlg::reorderMapAndUpdateIndices(int startRow) {
int totalRows = ui->tb_ct->rowCount();
// 遍历从startRow开始的所有行
for (int row = startRow; row < totalRows; ++row) {
QTableWidgetItem* idItem = ui->tb_ct->item(row, 0);
if (!idItem) continue;
int currentId = idItem->data(Qt::UserRole).toInt();
QString currentKey = QString::number(currentId);
// 计算新的ID和索引
int newId = row + 1; // 新的ID
int newIndex = row + 1; // 新的索引
if (_mapCT.contains(currentKey)) {
// 获取并更新数据
CtExtraInfo info = _mapCT[currentKey];
info.index = newIndex;
// 从旧位置移除
_mapCT.remove(currentKey);
// 添加到新位置
QString newKey = QString::number(newId);
_mapCT[newKey] = info;
// 更新表格显示
idItem->setText(QString::number(newId));
idItem->setData(Qt::UserRole, newId);
}
}
}

View File

@ -42,8 +42,8 @@ QMap<int,QList<DiagramEditorBlockInfo>> DiagramEditorStructContainer::getMapBloc
void DiagramEditorStructContainer::clearData()
{
for(auto &lstCon:_mapBlocks){
/*for(auto &lstCon:_mapBlocks){
qDeleteAll(lstCon);
}
}*/
_mapBlocks.clear();
}

View File

@ -1067,6 +1067,7 @@ void FixedPortsModel::saveNode(int nPageId)
}
extraPro.component_name = pData->name();
extraPro.component_uuid = pData->uuid();
extraPro.component_tag = tempTag;
extraPro.group_tag = val.groupName;
for(auto& groupInfo:groupMap){
@ -1081,6 +1082,7 @@ void FixedPortsModel::saveNode(int nPageId)
extraPro.code = extraPro.getFullName();
extraPro.sourceType = "property";
extraPro.sourceConfig.insert("modelName",pData->modelName());
extraPro.connect_para = sGridTag+"."+sZoneTag+"."+sStationTag+"."+extraPro.bay_tag+"."+tempTag+"."+extraPro.group_tag+"."+extraPro.tag;
//取data:模型.属性组.id.属性名
bool exist = DataBase::GetInstance()->ifExtraPropertyExist(extraPro.code);
@ -1145,14 +1147,23 @@ void FixedPortsModel::saveNode(int nPageId)
objAction["parameters"] = arrPara;
objEventPlan["action"] = objAction;
QString tempTag = info.tag+"_"+_pageName; //tag后加工程名保持全局唯一
QJsonObject objBinding;
if(!info.sWindType.isEmpty()){
QJsonObject objWind;
objWind["ratio"] = info.nRatio;
objWind["polarity"] = info.nPolarity;
objWind["index"] = info.nIndex;
objBinding[info.sWindType] = objWind;
}
QString tempMeasure = info.tag+"_"+_pageName; //tag后加工程名保持全局唯一
bool val = DataBase::GetInstance()->ifMeasureExist(info.name,pData->uuid());
if(val){
DataBase::GetInstance()->updateMeasurement(info.name,tpe,objDataSource,objEventPlan,info.size,pData->uuid());
DataBase::GetInstance()->updateMeasurement(info.name,tpe,objDataSource,objEventPlan,objBinding,info.size,pData->uuid());
}
else{
DataBase::GetInstance()->insertMeasurement(info.name,tempTag,tpe,objDataSource,objEventPlan,info.size,info.bayUuid,info.componentUuid);
DataBase::GetInstance()->insertMeasurement(info.name,tempMeasure,tpe,objDataSource,objEventPlan,objBinding,info.size,info.bayUuid,info.componentUuid);
}
for(int i = 0;i < lstDataBase.size();++i) //从数据库记录中移除操作过的对象
@ -1172,7 +1183,7 @@ void FixedPortsModel::saveNode(int nPageId)
ExtraProperty extraPro; //层级信息
extraPro.name = info.name;
extraPro.tag = tempTag;
extraPro.tag = tempMeasure;
extraPro.grid_tag = sGridTag;
extraPro.grid_name = sGridName;
extraPro.zone_tag = sZoneTag;
@ -1188,6 +1199,7 @@ void FixedPortsModel::saveNode(int nPageId)
}
extraPro.component_name = pData->name();
extraPro.component_uuid = pData->uuid();
extraPro.component_tag = tempTag;
extraPro.group_tag = "bay";
for(auto& groupInfo:groupMap){
@ -1211,6 +1223,7 @@ void FixedPortsModel::saveNode(int nPageId)
}
extraPro.code = extraPro.getFullName();
extraPro.sourceType = "measurement";
extraPro.connect_para = sGridTag+"."+sZoneTag+"."+sStationTag+"."+extraPro.bay_tag+"."+tempTag+"."+extraPro.group_tag+"."+extraPro.tag;
//取data 量测tag
bool exist = DataBase::GetInstance()->ifExtraPropertyExist(extraPro.code);

View File

@ -117,8 +117,8 @@ void ItemPropertyDlg::onOkClicked()
for (QJsonValueRef jsonObj : arr)
{
QJsonObject node = jsonObj.toObject();
QString sWinding = node["windingConnectionMethod"].toString();
if(sWinding == "Y"){
QString sWinding = node["star"].toString();
if(sWinding == "Yn"){
lst.append(1);
}
else{
@ -165,6 +165,48 @@ void ItemPropertyDlg::onGroupSelected(const QString& str)
}
else{
pDlg->setPropertyValue(QVariant::fromValue(static_cast<void*>(pPro)));
bool bWindExist = false;
if(pPro->type() == 4 || pPro->type() == 5){ //ct和pt情况bay组需要跨界面使用extend信息
if(groupValue_.contains("base_extend")){ //实时数据中已包含(已设置)
if(groupValue_["base_extend"].mapInfo.contains(curUuid_)){
QMap<QString,propertyStateInfo> extendMap = groupValue_["base_extend"].mapInfo.value(curUuid_);
if(pPro->type() == 4){
if(extendMap.contains("ct_winding")){
propertyStateInfo val = extendMap.value("ct_winding");
pDlg->setExtendProperty(val);
bWindExist = true;
}
}
else if(pPro->type() == 5){
if(extendMap.contains("pt_sec_winding")){
propertyStateInfo val = extendMap.value("pt_sec_winding");
pDlg->setExtendProperty(val);
bWindExist = true;
}
}
}
}
if(!bWindExist){
if(groupViews_.contains("base_extend")){ //实时数据未包含从extend界面读取
BaseContentDlg* pExtendDlg = qobject_cast<BaseContentDlg*>(groupViews_.value("base_extend"));
QMap<QString,propertyStateInfo> mapPro = pExtendDlg->getPropertyValue(pPro);
if(pPro->type() == 4 ){ //ct
if(mapPro.contains("ct_winding")){
propertyStateInfo val = mapPro.value("ct_winding");
pDlg->setExtendProperty(val);
}
}
else if(pPro->type() == 5){ //pt
if(mapPro.contains("pt_sec_winding")){
propertyStateInfo val = mapPro.value("pt_sec_winding");
pDlg->setExtendProperty(val);
}
}
}
}
}
}
}

View File

@ -1,4 +1,5 @@
#include <QMessageBox>
#include <QJsonDocument>
#include "measureSettingDlg.h"
#include "bayInfoDlg.h"
#include "graphicsDataModel/fixedPortsModel.h"
@ -56,8 +57,82 @@ void MeasureSettingDlg::initial()
ui->cb_rule->setItemData(1, 2);
}
void MeasureSettingDlg::showDlg()
void MeasureSettingDlg::showDlg(int type,propertyStateInfo proInfo,bool isDouble)
{
ui->label_wind->setVisible(false);
ui->cb_windIndex->setVisible(false);
//setDbCheckVisible(false);
if(isDouble)
setDbTagVisible(true);
else
setDbTagVisible(false);
_isDouble = isDouble;
if(type == 4){ //ct,显示index选择
ui->label_wind->setVisible(true);
ui->cb_windIndex->setVisible(true);
ui->cb_windIndex->clear();
QMap<int,CtExtraInfo> map;
/*QString jsonString = proInfo.defaultValue.toString();
QJsonDocument jsonDocument = QJsonDocument::fromJson(jsonString.toUtf8().data());
QJsonObject obj = jsonDocument.object();*/
QJsonObject obj = safeToJsonObject(proInfo.defaultValue);
if(obj.contains("winding")){
QJsonArray arr = obj["winding"].toArray();
for (QJsonValueRef jsonObj : arr)
{
CtExtraInfo info;
QJsonObject node = jsonObj.toObject();
info.index = node["index"].toInt();
info.scope = node["scope"].toString();
info.accuracy= node["accuracy"].toString();
info.volume = node["volume"].toString();
info.ratio = node["ratio"].toDouble();
info.polarity= node["polarity"].toBool();
map.insert(info.index,info);
ui->cb_windIndex->addItem(QString::number(info.index));
}
_tempCtMap = map;
}
}
else if(type == 5){ //pt,显示index选择
ui->label_wind->setVisible(true);
ui->cb_windIndex->setVisible(true);
ui->cb_windIndex->clear();
QMap<int,PtExtraInfo> map;
/*QString jsonString = proInfo.defaultValue.toString();
QJsonDocument jsonDocument = QJsonDocument::fromJson(jsonString.toUtf8().data());
QJsonObject obj = jsonDocument.object();*/
QJsonObject obj = safeToJsonObject(proInfo.defaultValue);
if(obj.contains("winding")){
QJsonArray arr = obj["winding"].toArray();
for (QJsonValueRef jsonObj : arr)
{
PtExtraInfo info;
QJsonObject node = jsonObj.toObject();
info.index = node["index"].toInt();
info.scope = node["scope"].toString();
info.accuracy= node["accuracy"].toString();
info.volume = node["volume"].toString();
info.star = node["star"].toString();
info.ratio = node["ratio"].toDouble();
info.polarity= node["polarity"].toBool();
map.insert(info.index,info);
ui->cb_windIndex->addItem(QString::number(info.index));
}
_tempPtMap = map;
}
}
ui->cb_windIndex->setCurrentIndex(0);
_curComponentType = type;
_curMode = 0;
clearData();
QStringList lstTag;
@ -87,8 +162,87 @@ void MeasureSettingDlg::showDlg()
}
}
void MeasureSettingDlg::showDlg(MeasurementInfo info)
void MeasureSettingDlg::showDlg(MeasurementInfo info,propertyStateInfo proInfo,bool isDouble)
{
ui->label_wind->setVisible(false);
ui->cb_windIndex->setVisible(false);
if(isDouble)
setDbTagVisible(true);
else
setDbTagVisible(false);
_isDouble = isDouble;
if(info.sWindType == "ct"){ //ct,显示index选择
ui->label_wind->setVisible(true);
ui->cb_windIndex->setVisible(true);
ui->cb_windIndex->clear();
QMap<int,CtExtraInfo> map;
/*QString jsonString = proInfo.defaultValue.toString();
QJsonDocument jsonDocument = QJsonDocument::fromJson(jsonString.toUtf8().data());
QJsonObject obj = jsonDocument.object();*/
QJsonObject obj = safeToJsonObject(proInfo.defaultValue);
if(obj.contains("winding")){
QJsonArray arr = obj["winding"].toArray();
for (QJsonValueRef jsonObj : arr)
{
CtExtraInfo info;
QJsonObject node = jsonObj.toObject();
info.index = node["index"].toInt();
info.scope = node["scope"].toString();
info.accuracy= node["accuracy"].toString();
info.volume = node["volume"].toString();
info.ratio = node["ratio"].toDouble();
info.polarity= node["polarity"].toBool();
map.insert(info.index,info);
ui->cb_windIndex->addItem(QString::number(info.index));
}
ui->cb_windIndex->setCurrentText(QString::number(info.nIndex));
_tempCtMap = map;
}
}
else if(info.sWindType == "pt"){ //pt,显示index选择
ui->label_wind->setVisible(true);
ui->cb_windIndex->setVisible(true);
ui->cb_windIndex->clear();
QMap<int,PtExtraInfo> map;
/*QString jsonString = proInfo.defaultValue.toString();
QJsonDocument jsonDocument = QJsonDocument::fromJson(jsonString.toUtf8().data());
QJsonObject obj = jsonDocument.object();*/
QJsonObject obj = safeToJsonObject(proInfo.defaultValue);
if(obj.contains("winding")){
QJsonArray arr = obj["winding"].toArray();
for (QJsonValueRef jsonObj : arr)
{
PtExtraInfo info;
QJsonObject node = jsonObj.toObject();
info.index = node["index"].toInt();
info.scope = node["scope"].toString();
info.accuracy= node["accuracy"].toString();
info.volume = node["volume"].toString();
info.star = node["star"].toString();
info.ratio = node["ratio"].toDouble();
info.polarity= node["polarity"].toBool();
map.insert(info.index,info);
ui->cb_windIndex->addItem(QString::number(info.index));
}
ui->cb_windIndex->setCurrentText(QString::number(info.nIndex));
_tempPtMap = map;
}
}
if(info.sWindType == "ct"){
_curComponentType = 4;
}
else if(info.sWindType == "pt"){
_curComponentType = 5;
}
show();
_curMode = 1;
clearData();
@ -196,6 +350,54 @@ void MeasureSettingDlg::clearData()
ui->lst_parameter->clear();
}
/*void MeasureSettingDlg::setDbCheckVisible(bool val)
{
if(val){
ui->label_dbCheck->setVisible(true);
ui->cB_dbCheck->setVisible(true);
}
else{
ui->label_dbCheck->setVisible(false);
ui->cB_dbCheck->setVisible(false);
}
}*/
void MeasureSettingDlg::setDbTagVisible(bool val)
{
if(val){
ui->label_dbTag->setVisible(true);
ui->le_dbTag->setVisible(true);
ui->label_dbName->setVisible(true);
ui->le_dbName->setVisible(true);
}
else{
ui->label_dbTag->setVisible(false);
ui->le_dbTag->setVisible(false);
ui->label_dbName->setVisible(false);
ui->le_dbName->setVisible(false);
}
}
QJsonObject MeasureSettingDlg::safeToJsonObject(const QVariant& var) {
switch (var.typeId()) {
case QMetaType::QJsonObject:
return var.toJsonObject();
case QMetaType::QString: {
QJsonParseError error;
auto doc = QJsonDocument::fromJson(
var.toString().toUtf8(),
&error
);
if (error.error == QJsonParseError::NoError)
return doc.object();
break;
}
default:
break;
}
return QJsonObject();
}
void MeasureSettingDlg::onOkClicked()
{
MeasurementInfo info;
@ -249,8 +451,43 @@ void MeasureSettingDlg::onOkClicked()
info.lstParameter.append(item->text());
}
if(_pBay)
if(_curComponentType == 4 || _curComponentType == 5){
int nNumber;
QString sNumber = ui->cb_windIndex->currentText();
nNumber = sNumber.isEmpty()?-1:sNumber.toInt();
if(nNumber != -1){
if(_curComponentType == 4){ //ct
info.sWindType = "ct";
info.nIndex = nNumber;
info.nRatio = _tempCtMap.value(nNumber).ratio;
info.nPolarity = _tempCtMap.value(nNumber).polarity;
}
else if(_curComponentType == 5){ //pt
info.sWindType = "pt";
info.nIndex = nNumber;
info.nRatio = _tempPtMap.value(nNumber).ratio;
info.nPolarity = _tempPtMap.value(nNumber).polarity;
}
}
}
if(_pBay){
if(_isDouble)
info.sSymmetry = ui->le_dbTag->text(); //与double互相记录
_pBay->addMeasure(info,_curMode);
}
if(_isDouble){
MeasurementInfo dbInfo;
dbInfo = info;
dbInfo.tag = ui->le_dbTag->text();
dbInfo.name = ui->le_dbName->text();
dbInfo.nPolarity = -info.nPolarity;
dbInfo.sSymmetry = info.tag; //与source互相记录
if(_pBay)
_pBay->addMeasure(dbInfo,_curMode);
}
hide();
}
@ -262,23 +499,41 @@ void MeasureSettingDlg::onCancelClicked()
void MeasureSettingDlg::onTagChanged(const QString& str)
{
auto lst = _pBay->getValidType();
QString curItemName;
if(_pBay){
auto pItemData = _pBay->getProperty();
curItemName = "_"+pItemData->name();
}
for(auto& item:lst){
if(item.tag == str){
ui->cb_name->setCurrentText(item.name);
return;
if(item.tag+curItemName == str){
ui->cb_name->setCurrentText(item.name+curItemName);
break;
}
}
if(_isDouble){
ui->le_dbTag->setText(str+"double");
}
}
void MeasureSettingDlg::onNameChanged(const QString& str)
{
auto lst = _pBay->getValidType();
QString curItemName;
if(_pBay){
auto pItemData = _pBay->getProperty();
curItemName = "_"+pItemData->name();
}
for(auto& item:lst){
if(item.name == str){
ui->cb_tag->setCurrentText(item.tag);
return;
if(item.name+curItemName == str){
ui->cb_tag->setCurrentText(item.tag+curItemName);
break;
}
}
if(_isDouble){
ui->le_dbName->setText(str+"对称");
}
}
void MeasureSettingDlg::onRuleIndexChanged(int n)

View File

@ -5,6 +5,7 @@
#include <QButtonGroup>
#include <QJsonArray>
#include <QJsonDocument>
#include <QMenu>
PtExtraInfoDlg::PtExtraInfoDlg(QWidget *parent)
: BaseContentDlg(parent)
@ -16,7 +17,11 @@ PtExtraInfoDlg::PtExtraInfoDlg(QWidget *parent)
_stateGroup_pt->addButton(ui->rb_spt_pt,0);
connect(ui->btn_add_pt,&QPushButton::clicked,this,&PtExtraInfoDlg::onAddClicked);
_count = 0;
ui->tb_pt->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
_count = 1;
ui->tb_pt->setContextMenuPolicy(Qt::CustomContextMenu);
connect(ui->tb_pt, &QTableWidget::customContextMenuRequested, this, &PtExtraInfoDlg::onTableCustomContextMenuRequested);
}
PtExtraInfoDlg::~PtExtraInfoDlg()
@ -80,16 +85,16 @@ QMap<QString,propertyStateInfo> PtExtraInfoDlg::getPropertyValue(BaseProperty* p
{
QJsonObject object;
QJsonArray arr;
for(auto info:_mapPT)
for(auto &info:_mapPT)
{
QJsonObject obj;
obj["id"] = info.id;
obj["transformationRatio"] = info.transRatio;
obj["minTransformationRatio"] = info.minTransRatio;
obj["maxTransformationRatio"] = info.maxTransRatio;
obj["accuracyClass"] = info.accuracyClass;
obj["secondaryLoadCapacity"] = info.secondaryLoadCapacity;
obj["windingConnectionMethod"] = info.windingConnectionMethod;
obj["index"] = info.index;
obj["scope"] = info.scope;
obj["accuracy"] = info.accuracy;
obj["volume"] = info.volume;
obj["star"] = info.star;
obj["ratio"] = info.ratio;
obj["polarity"] = info.polarity;
arr.push_back(obj);
}
object["winding"] = arr;
@ -124,7 +129,10 @@ void PtExtraInfoDlg::setPropertyValue(QVariant var)
}
else if(info.name == "一次绕组接线接地方式" || info.tagName == "pwcc")
{
ui->le_pwwgm->setText(info.defaultValue.toString());
int nIndex = 0;
if(info.defaultValue.toString() != "null")
nIndex = info.defaultValue.toInt();
ui->le_pwwgm->setText(QString::number(nIndex));
}
else if(info.name == "额定频率(Hz)" || info.tagName == "fn_hz")
{
@ -149,15 +157,15 @@ void PtExtraInfoDlg::setPropertyValue(QVariant var)
for (QJsonValueRef jsonObj : arr)
{
QJsonObject node = jsonObj.toObject();
int id = node["id"].toInt();
QString sTr = node["transformationRatio"].toString();
QString sMinTr = node["minTransformationRatio"].toString();
QString sMaxTr = node["maxTransformationRatio"].toString();
QString sAr = node["accuracyClass"].toString();
QString sSlc = node["secondaryLoadCapacity"].toString();
QString sWin = node["windingConnectionMethod"].toString();
int index = node["index"].toInt();
QString scope = node["scope"].toString();
QString accuracy = node["accuracy"].toString();
QString volume = node["volume"].toString();
QString star = node["star"].toString();
double ratio = node["ratio"].toDouble();
int polarity = node["polarity"].toInt();
addTableRow(sTr,sMinTr,sMaxTr,sAr,sSlc,sWin,id);
addTableRow(scope,accuracy,volume,star,ratio,polarity,index);
}
}
}
@ -165,79 +173,140 @@ void PtExtraInfoDlg::setPropertyValue(QVariant var)
void PtExtraInfoDlg::onAddClicked()
{
QString sTr = ui->le_tr_pt->text();
QString sMinTr = ui->le_trMin_pt->text();
QString sMaxTr = ui->le_trMax_pt->text();
QString sAr = ui->le_ac_pt->text();
QString sSlc = ui->le_slc_pt->text();
QString sWinding = ui->cb_wcm->currentText();
addTableRow(sTr,sMinTr,sMaxTr,sAr,sSlc,sWinding);
QString sRatioRange = ui->le_tr_range_pt->text();
QString sAccuracy= ui->le_ac_pt->text();
QString sVolume = ui->le_slc_pt->text();
QString sStar = ui->cb_wcm->currentText();
double dRatio = ui->le_tr_pt->text().toDouble();
bool bPolarity = ui->cB_polarity->checkState();
int index = -1;
if(ui->rb_spt_pt->isChecked())
index = 0;
addTableRow(sRatioRange,sAccuracy,sVolume,sStar,dRatio,bPolarity,index);
}
void PtExtraInfoDlg::onDeleteClicked()
{
QPushButton *btn = qobject_cast<QPushButton*>(sender());
if (btn) {
// 获取按钮在表格中的位置
QModelIndex index = ui->tb_pt->indexAt(btn->pos());
if (index.isValid()) {
QTableWidgetItem* pFirstItem = ui->tb_pt->item(index.row(),0);
int id = pFirstItem->data(Qt::UserRole).toInt();
_mapPT.remove(QString::number(id));
ui->tb_pt->removeRow(index.row());
}
void PtExtraInfoDlg::onTableCustomContextMenuRequested(const QPoint &pos) {
QModelIndex index = ui->tb_pt->indexAt(pos);
if (!index.isValid()) {
return;
}
int row = index.row();
// 创建右键菜单
QMenu menu(this);
QAction *deleteAction = menu.addAction("删除此行");
// 连接删除操作
connect(deleteAction, &QAction::triggered, this, [this, row]() {
deleteRowWithReindex(row);
//updateLables();
});
menu.exec(ui->tb_pt->viewport()->mapToGlobal(pos));
}
void PtExtraInfoDlg::addTableRow(QString sTr,QString sTrMin,QString sTrMax,QString sAr,QString sSlc,QString sWinding,int id)
void PtExtraInfoDlg::addTableRow(QString sRatioRange,QString sAccuracy,QString sVolume,QString sStar,double dRatio,bool bPolarity,int index)
{
if(_mapPT.contains(QString::number(id)))
if(_mapPT.contains(QString::number(index)))
{
return;
}
PtExtraInfo info;
if(id == -1){ //缺省id时新建否则加载
info.id = _count;
if(index == -1){ //缺省id时新建否则加载
info.index = _count;
_count += 1;
}
else{
info.id = id;
info.index = index;
}
int row = ui->tb_pt->rowCount();
ui->tb_pt->insertRow(row);
// 变比(输入框)
QTableWidgetItem *item = new QTableWidgetItem(sTr);
item->setData(Qt::UserRole,info.id);
// index
QTableWidgetItem *item = new QTableWidgetItem(QString::number(info.index));
item->setData(Qt::UserRole,info.index);
ui->tb_pt->setItem(row, 0, item);
//最小变比
ui->tb_pt->setItem(row, 1, new QTableWidgetItem(sTrMin));
//变比范围
ui->tb_pt->setItem(row, 1, new QTableWidgetItem(sRatioRange));
//最大变比
ui->tb_pt->setItem(row, 2, new QTableWidgetItem(sTrMax));
//精度等级
ui->tb_pt->setItem(row, 2, new QTableWidgetItem(sAccuracy));
// 精度等级(下拉框)
ui->tb_pt->setItem(row, 3, new QTableWidgetItem(sAr));
//二次负载容量
ui->tb_pt->setItem(row, 3, new QTableWidgetItem(sVolume));
// 二次负载容量(输入框)
ui->tb_pt->setItem(row, 4, new QTableWidgetItem(sSlc));
// 变比
ui->tb_pt->setItem(row, 4, new QTableWidgetItem(QString::number(dRatio)));
// 绕组接法(下拉框)
ui->tb_pt->setItem(row, 5, new QTableWidgetItem(sWinding));
// 极性
ui->tb_pt->setItem(row, 5, new QTableWidgetItem(QString::number(bPolarity? 1 : -1)));
// 删除按钮
QPushButton *deleteBtn = new QPushButton("删除");
connect(deleteBtn, &QPushButton::clicked, this, &PtExtraInfoDlg::onDeleteClicked);
ui->tb_pt->setCellWidget(row, 6, deleteBtn);
//接线
ui->tb_pt->setItem(row, 6, new QTableWidgetItem(sStar));
info.transRatio = sTr;
info.minTransRatio = sTrMin;
info.maxTransRatio = sTrMax;
info.accuracyClass = sAr;
info.secondaryLoadCapacity = sSlc;
info.windingConnectionMethod = sWinding;
_mapPT.insert(QString::number(info.id),info);
info.scope = sRatioRange;
info.accuracy = sAccuracy;
info.volume = sVolume;
info.star = sStar;
info.ratio = dRatio;
info.polarity = bPolarity? 1 : -1;
_mapPT.insert(QString::number(info.index),info);
}
void PtExtraInfoDlg::deleteRowWithReindex(int row) {
// 1. 获取要删除的ID
QTableWidgetItem* pFirstItem = ui->tb_pt->item(row, 0);
if (!pFirstItem) return;
int deletedId = pFirstItem->data(Qt::UserRole).toInt();
QString deletedKey = QString::number(deletedId);
// 2. 从表格中删除行
ui->tb_pt->removeRow(row);
// 3. 从_mapCT中删除对应项
if (_mapPT.contains(deletedKey)) {
_mapPT.remove(deletedKey);
}
// 4. 重新排序和更新index
reorderMapAndUpdateIndices(row);
}
void PtExtraInfoDlg::reorderMapAndUpdateIndices(int startRow) {
int totalRows = ui->tb_pt->rowCount();
// 遍历从startRow开始的所有行
for (int row = startRow; row < totalRows; ++row) {
QTableWidgetItem* idItem = ui->tb_pt->item(row, 0);
if (!idItem) continue;
int currentId = idItem->data(Qt::UserRole).toInt();
QString currentKey = QString::number(currentId);
// 计算新的ID和索引
int newId = row + 1; // 新的ID
int newIndex = row + 1; // 新的索引
if (_mapPT.contains(currentKey)) {
// 获取并更新数据
PtExtraInfo info = _mapPT[currentKey];
info.index = newIndex;
// 从旧位置移除
_mapPT.remove(currentKey);
// 添加到新位置
QString newKey = QString::number(newId);
_mapPT[newKey] = info;
// 更新表格显示
idItem->setText(QString::number(newId));
idItem->setData(Qt::UserRole, newId);
}
}
}

View File

@ -0,0 +1,80 @@
#include "structDataActionParaDlg.h"
#include <QHBoxLayout>
#include <QLineEdit>
#include <QPushButton>
StructDataActionParaDlg::StructDataActionParaDlg(QWidget *parent)
: QDialog(parent) {
setWindowTitle("动作参数");
resize(350, 300);
QVBoxLayout *layout = new QVBoxLayout(this);
// 告警列表
m_listWidget = new QListWidget(this);
layout->addWidget(m_listWidget);
// 添加区
QHBoxLayout *addLayout = new QHBoxLayout;
m_editLine = new QLineEdit(this);
m_editLine->setPlaceholderText("输入动作参数");
m_btnAdd = new QPushButton("添加", this);
addLayout->addWidget(m_editLine, 1);
addLayout->addWidget(m_btnAdd);
layout->addLayout(addLayout);
// 操作区
QHBoxLayout *opLayout = new QHBoxLayout;
m_btnDelete = new QPushButton("删除选中", this);
m_btnClear = new QPushButton("清空", this);
opLayout->addWidget(m_btnDelete);
opLayout->addWidget(m_btnClear);
opLayout->addStretch();
layout->addLayout(opLayout);
// 确定取消
QHBoxLayout *btnLayout = new QHBoxLayout;
m_btnOk = new QPushButton("确定", this);
m_btnCancel = new QPushButton("取消", this);
btnLayout->addStretch();
btnLayout->addWidget(m_btnOk);
btnLayout->addWidget(m_btnCancel);
layout->addLayout(btnLayout);
// 连接信号
connect(m_btnAdd, &QPushButton::clicked, this, &StructDataActionParaDlg::onAddClicked);
connect(m_btnDelete, &QPushButton::clicked, this, &StructDataActionParaDlg::onDeleteClicked);
connect(m_btnClear, &QPushButton::clicked, m_listWidget, &QListWidget::clear);
connect(m_editLine, &QLineEdit::returnPressed, this, &StructDataActionParaDlg::onAddClicked);
connect(m_btnOk, &QPushButton::clicked, this, &QDialog::accept);
connect(m_btnCancel, &QPushButton::clicked, this, &QDialog::reject);
}
void StructDataActionParaDlg::setAlarms(const QStringList &alarms) {
m_listWidget->clear();
m_listWidget->addItems(alarms);
}
QStringList StructDataActionParaDlg::alarms() const {
QStringList result;
for (int i = 0; i < m_listWidget->count(); ++i) {
result << m_listWidget->item(i)->text();
}
return result;
}
void StructDataActionParaDlg::onAddClicked() {
QString text = m_editLine->text().trimmed();
if (!text.isEmpty()) {
m_listWidget->addItem(text);
m_editLine->clear();
}
}
void StructDataActionParaDlg::onDeleteClicked() {
qDeleteAll(m_listWidget->selectedItems());
}

View File

@ -0,0 +1,125 @@
#include "structDataCauseEditDlg.h"
#include <QVBoxLayout>
#include <QDialogButtonBox>
#include <QLabel>
StructDataCauseEditDlg::StructDataCauseEditDlg(const QMap<QString, double>& initialData,QWidget* parent)
: QDialog(parent) {
setupUI();
setData(initialData);
}
void StructDataCauseEditDlg::setData(const QMap<QString, double>& data) {
m_data = data;
updateUIFromData();
}
QMap<QString, double> StructDataCauseEditDlg::getData() const {
return m_data;
}
void StructDataCauseEditDlg::setupUI() {
setWindowTitle("编辑 Cause 数据");
setMinimumSize(350, 200);
QVBoxLayout* mainLayout = new QVBoxLayout(this);
// 标题
QLabel* titleLabel = new QLabel("遥测原因", this);
titleLabel->setStyleSheet("font-weight: bold; font-size: 12pt;");
mainLayout->addWidget(titleLabel);
// 分隔线
QFrame* line = new QFrame(this);
line->setFrameShape(QFrame::HLine);
line->setFrameShadow(QFrame::Sunken);
mainLayout->addWidget(line);
// 可用的键列表
m_availableKeys = {"upup", "up", "down", "downdown"};
// 为每个键创建编辑器
for (const QString& key : m_availableKeys) {
QHBoxLayout* rowLayout = new QHBoxLayout;
// 复选框
QCheckBox* checkBox = new QCheckBox(key, this);
checkBox->setStyleSheet("QCheckBox { font-weight: bold; }");
// 数值输入框
QDoubleSpinBox* spinBox = new QDoubleSpinBox(this);
spinBox->setRange(0.0, 100.0);
//spinBox->setSuffix("%");
spinBox->setDecimals(1);
spinBox->setSingleStep(0.5);
spinBox->setButtonSymbols(QAbstractSpinBox::NoButtons);
// 连接信号
connect(checkBox, &QCheckBox::toggled, this, [this, key, spinBox, checkBox](bool checked) {
spinBox->setEnabled(checked);
if (checked) {
spinBox->setFocus();
spinBox->selectAll();
} else {
spinBox->setValue(0.0);
}
});
rowLayout->addWidget(checkBox);
rowLayout->addWidget(spinBox);
rowLayout->addStretch();
mainLayout->addLayout(rowLayout);
// 存储控件指针
m_checkBoxes[key] = checkBox;
m_spinBoxes[key] = spinBox;
}
// 分隔线
QFrame* line2 = new QFrame(this);
line2->setFrameShape(QFrame::HLine);
line2->setFrameShadow(QFrame::Sunken);
mainLayout->addWidget(line2);
// 按钮
m_buttonBox = new QDialogButtonBox(
QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
mainLayout->addWidget(m_buttonBox);
connect(m_buttonBox, &QDialogButtonBox::accepted, this, [this]() {
updateTotal();
accept();
});
connect(m_buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
setLayout(mainLayout);
// 初始更新
updateTotal();
}
void StructDataCauseEditDlg::updateUIFromData() {
for(auto iter = m_data.begin();iter != m_data.end();++iter) {
if (m_checkBoxes.contains(iter.key()) && m_spinBoxes.contains(iter.key())) {
bool hasValue = m_data.contains(iter.key()) && m_data[iter.key()] > 0;
m_checkBoxes[iter.key()]->setChecked(hasValue);
m_spinBoxes[iter.key()]->setValue(hasValue ? m_data[iter.key()] : 0.0);
m_spinBoxes[iter.key()]->setEnabled(hasValue);
}
}
}
void StructDataCauseEditDlg::updateTotal() {
m_data.clear();
for (const QString& key : m_availableKeys) {
if (m_checkBoxes[key]->isChecked()) {
double value = m_spinBoxes[key]->value();
m_data[key] = value;
}
}
}

View File

@ -6,6 +6,8 @@
#include <QKeyEvent>
#include "structDataMeasurementDelegate.h"
#include "structDataMeasurementModel.h"
#include "structDataCauseEditDlg.h"
#include "structDataActionParaDlg.h"
#include "uiCommunicationBus.h"
StructDataMeasurementDelegate::StructDataMeasurementDelegate(QObject* parent) : QStyledItemDelegate(parent) {}
@ -20,7 +22,6 @@ QWidget* StructDataMeasurementDelegate::createEditor(QWidget* parent,
switch (column) {
case StructDataMeasurementModel::ColConnectPara:
return createConnectParaEditor(parent);
case StructDataMeasurementModel::ColType:
return createMeasurementTypeEditor(parent);
case StructDataMeasurementModel::ColSize:
@ -39,6 +40,19 @@ QWidget* StructDataMeasurementDelegate::createEditor(QWidget* parent,
return createNumberEditor(parent);
case StructDataMeasurementModel::ColEnable:
return createEnableEditor(parent);
case StructDataMeasurementModel::ColCause:{
QString sType = getParaType(index);
if(sType == "遥测"){ //遥测
return createCauseYCEditor(parent,index);
}
else if(sType == "遥信") { //遥信
return createCauseYXEditor(parent);
}
}
case StructDataMeasurementModel::ColCommand:
return createCommandEditor(parent);
case StructDataMeasurementModel::ColParameters:
return createActionParaEditor(parent);
}
return nullptr;
@ -105,6 +119,32 @@ void StructDataMeasurementDelegate::setEditorData(QWidget* editor, const QModelI
comboBox->setCurrentIndex(index);
}
break;
case StructDataMeasurementModel::ColCause:{
QString sType = getParaType(index);
if(sType == "遥测"){
if (StructDataCauseEditDlg* dialog = qobject_cast<StructDataCauseEditDlg*>(editor)) {
QMap<QString, double> data = value.value<QMap<QString, double>>();
dialog->setData(data);
}
}
else if(sType == "遥信"){
if (QComboBox* comboBox = qobject_cast<QComboBox*>(editor)) {
comboBox->setCurrentText(value.toString());
}
}
}
break;
case StructDataMeasurementModel::ColCommand:
if (QComboBox* comboBox = qobject_cast<QComboBox*>(editor)) {
comboBox->setCurrentText(value.toString());
}
break;
case StructDataMeasurementModel::ColParameters:
if (StructDataActionParaDlg* dialog = qobject_cast<StructDataActionParaDlg*>(editor)) {
QStringList lst = value.toStringList();
dialog->setAlarms(lst);
}
break;
}
}
@ -158,9 +198,9 @@ void StructDataMeasurementDelegate::setModelData(QWidget* editor, QAbstractItemM
case StructDataMeasurementModel::ColSource:
if (QComboBox* comboBox = qobject_cast<QComboBox*>(editor)) {
// 转换文本为数值cl3611 -> 0, 104 -> 1
// 转换文本为数值cl3611 -> 1, 104 -> 21
QString text = comboBox->currentText();
newValue = (text == "cl3611") ? 0 : 1;
newValue = (text == "cl3611") ? 1 : 2;
}
break;
@ -171,6 +211,32 @@ void StructDataMeasurementDelegate::setModelData(QWidget* editor, QAbstractItemM
newValue = (text == "启用") ? true : false;
}
break;
case StructDataMeasurementModel::ColCause:{
QString sType = getParaType(index);
if(sType == "遥测"){
if (StructDataCauseEditDlg* dialog = qobject_cast<StructDataCauseEditDlg*>(editor)) {
if (dialog->result() == QDialog::Accepted) {
newValue = QVariant::fromValue(dialog->getData());
}
}
}
else if(sType == "遥信"){
if (QComboBox* comboBox = qobject_cast<QComboBox*>(editor)) {
newValue = comboBox->currentText();
}
}
break;
}
case StructDataMeasurementModel::ColCommand:
if (QComboBox* comboBox = qobject_cast<QComboBox*>(editor)) {
newValue = comboBox->currentText();
}
break;
case StructDataMeasurementModel::ColParameters:
if (StructDataActionParaDlg* dialog = qobject_cast<StructDataActionParaDlg*>(editor)) {
newValue = dialog->alarms();
}
break;
}
if (!newValue.isNull()) {
@ -307,3 +373,55 @@ QWidget* StructDataMeasurementDelegate::createEnableEditor(QWidget* parent) cons
comboBox->addItems({"启用", "禁用"});
return comboBox;
}
QWidget* StructDataMeasurementDelegate::createCauseYCEditor(QWidget* parent, const QModelIndex& index) const {
QVariant value = index.data(Qt::EditRole);
QMap<QString, double> initialData;
if (value.canConvert<QMap<QString, double>>()) {
initialData = value.value<QMap<QString, double>>();
}
StructDataCauseEditDlg* dialog = new StructDataCauseEditDlg(initialData, parent);
dialog->setAttribute(Qt::WA_DeleteOnClose);
// 对话框关闭时提交数据
connect(dialog, &StructDataCauseEditDlg::finished,
this, [this, dialog](int result) {
StructDataMeasurementDelegate* nonConstThis =
const_cast<StructDataMeasurementDelegate*>(this);
if (result == QDialog::Accepted) {
emit nonConstThis->commitData(dialog);
}
emit nonConstThis->closeEditor(dialog);
});
return dialog;
}
QWidget* StructDataMeasurementDelegate::createCauseYXEditor(QWidget* parent) const
{
QComboBox* comboBox = new QComboBox(parent);
comboBox->addItems({"raising", "falling"});
return comboBox;
}
QWidget* StructDataMeasurementDelegate::createCommandEditor(QWidget* parent) const
{
QComboBox* comboBox = new QComboBox(parent);
comboBox->addItems({"info", "warning", "error", "critical", "exception"});
return comboBox;
}
QWidget* StructDataMeasurementDelegate::createActionParaEditor(QWidget* parent) const
{
StructDataActionParaDlg* dlg = new StructDataActionParaDlg(parent);
return dlg;
}
QString StructDataMeasurementDelegate::getParaType(const QModelIndex& index) const
{
QModelIndex typeIndex = index.sibling(index.row(), StructDataMeasurementModel::ColType);
return typeIndex.data(Qt::DisplayRole).toString();
}

View File

@ -55,7 +55,7 @@ QVariant StructDataMeasurementModel::data(const QModelIndex& index, int role) co
case ColCode: return prop->code;
case ColSourceType: return "量测";
case ColConnectPara: return prop->connect_para;
default: return getMeasurementData(*prop, col);
default: return getMeasurementData(*prop, col ,role);
}
}
else if (role == Qt::UserRole) {
@ -90,7 +90,7 @@ bool StructDataMeasurementModel::setData(const QModelIndex& index, const QVarian
} else {
MeasurementInfo* data = m_dataManager->getMeasurementData(updatedProp);
if (data) {
changed = updateMeasurementData(data, col, value);
changed = updateMeasurementData(data, col, value, role);
if (changed) {
emit m_dataManager->dataChanged();
}
@ -98,6 +98,7 @@ bool StructDataMeasurementModel::setData(const QModelIndex& index, const QVarian
}
if (changed) {
updatedProp.bDataChanged = true;
if (m_dataManager->updateProperty(updatedProp)) {
emit dataChanged(index, index, {role});
emit propertyModified(index.row(), updatedProp);
@ -112,7 +113,7 @@ Qt::ItemFlags StructDataMeasurementModel::flags(const QModelIndex& index) const
Qt::ItemFlags flags = QAbstractTableModel::flags(index);
int col = index.column();
if (col == ColConnectPara || ColType || ColSize || ColSource || ColStation || ColEquipment || ColChannel || ColPacket || ColOffset || ColEnable) {
if (col == ColConnectPara || ColType || ColSize || ColSource || ColStation || ColEquipment || ColChannel || ColPacket || ColOffset || ColEnable || ColCause) {
flags |= Qt::ItemIsEditable;
}
@ -123,7 +124,7 @@ QVariant StructDataMeasurementModel::headerData(int section, Qt::Orientation ori
if (orientation == Qt::Horizontal && role == Qt::DisplayRole) {
QStringList headers = {
"名称", "标签", "编码", "类型", "连接参数",
"量测类型", "数据包size", "数据来源", "子站", "设备", "通道号","包号(104)","偏移量(104)","开启事件"
"量测类型", "数据包size", "数据来源", "子站", "设备", "通道号","包号(104)","偏移量(104)","开启事件","事件原因","执行动作","动作参数"
};
return headers.value(section, "");
}
@ -173,7 +174,7 @@ ExtraProperty* StructDataMeasurementModel::getProperty(int displayRow) const {
return m_dataManager->getPropertyByCode(m_propertyCodes[displayRow]);
}
QVariant StructDataMeasurementModel::getMeasurementData(const ExtraProperty& prop, int col) const {
QVariant StructDataMeasurementModel::getMeasurementData(const ExtraProperty& prop, int col, int role) const {
MeasurementInfo* data = m_dataManager->getMeasurementData(prop);
if (!data) return QVariant();
@ -187,11 +188,43 @@ QVariant StructDataMeasurementModel::getMeasurementData(const ExtraProperty& pro
case ColPacket: return data->nPacket;
case ColOffset: return data->nOffset;
case ColEnable: return data->bEnable ? "启用" : "禁用";
case ColCause:
if(data->type == 0){
if(role == Qt::EditRole){
return QVariant::fromValue(data->mapTE);
}
else if(role == Qt::DisplayRole){
if (data->mapTE.isEmpty()) {
return "(空)";
}
QStringList parts;
for (auto it = data->mapTE.begin(); it != data->mapTE.end(); ++it) {
parts << QString("%1: %2").arg(it.key()).arg(it.value(), 0, 'f', 1);
}
return parts.join("; ");
}
}
else
return data->sEdge;
case ColCommand: return data->sCommand;
case ColParameters:{
if(role == Qt::EditRole){
return data->lstParameter;
}
else if(role == Qt::DisplayRole){
if (data->lstParameter.isEmpty()) {
return "(空)";
}
return data->lstParameter.join(",");
}
}
}
return QVariant();
}
bool StructDataMeasurementModel::updateMeasurementData(MeasurementInfo* data, int col, const QVariant& value) {
bool StructDataMeasurementModel::updateMeasurementData(MeasurementInfo* data, int col, const QVariant& value,int role) {
switch (col) {
case ColType:
if (data->type != value.toInt()) {
@ -235,6 +268,37 @@ bool StructDataMeasurementModel::updateMeasurementData(MeasurementInfo* data, in
return true;
}
break;
case ColCause:
if(data->type == 0)
{
if(role == Qt::EditRole){
if (data->mapTE != value.value<QMap<QString,double>>()) {
data->mapTE = value.value<QMap<QString,double>>();
return true;
}
}
}
else{
if (data->sEdge != value.toString()) {
data->sEdge = value.toString();
return true;
}
}
break;
case ColCommand:
if (data->sCommand != value.toString()) {
data->sCommand = value.toString();
return true;
}
break;
case ColParameters:
if(role == Qt::EditRole){
if (data->lstParameter != value.toStringList()) {
data->lstParameter = value.toStringList();
return true;
}
}
break;
}
return false;
}
@ -258,12 +322,12 @@ QString StructDataMeasurementModel::getSourceText(int source) const {
int StructDataMeasurementModel::getSourceInt(QString sType) const {
if(sType == "cl3611"){
return 0;
}
else if(sType == "104"){
return 1;
}
else {
else if(sType == "104"){
return 2;
}
else {
return 3;
}
}

View File

@ -32,7 +32,7 @@ StructDataPreviewDlg::StructDataPreviewDlg(QWidget *parent)
this->setWindowFlags(Qt::FramelessWindowHint | windowFlags());
m_statusBar = new QStatusBar(this);
ui->mainLayout->addWidget(m_statusBar);
m_statusBar->setMaximumHeight(21);
m_statusBar->setMaximumHeight(24);
initial();
}
@ -47,6 +47,7 @@ void StructDataPreviewDlg::loadData()
m_dataSource->loadExtrapro(_pExtraProManager->geAlltProperty());
m_dataSource->loadMeasurementData(DataBase::GetInstance()->getAllMeasurements());
m_dataSource->loadPropertyData(DataManager::instance().modelData());
addLog(QString("载入属性:%1").arg(m_dataSource->getAllProperties().size()));
}
void StructDataPreviewDlg::initial()
@ -592,7 +593,6 @@ void StructDataPreviewDlg::saveCurrentIfModified()
void StructDataPreviewDlg::saveAll() {
m_dataSource->saveAll();
m_currentModified = false;
//updateWindowTitle();
m_statusBar->showMessage("保存成功", 2000);
}
@ -630,6 +630,7 @@ void StructDataPreviewDlg::setupMeasurementColumns() {
ui->tableView->setColumnWidth(StructDataMeasurementModel::ColPacket, 50);
ui->tableView->setColumnWidth(StructDataMeasurementModel::ColOffset, 60);
ui->tableView->setColumnWidth(StructDataMeasurementModel::ColEnable, 50);
ui->tableView->setColumnWidth(StructDataMeasurementModel::ColCause, 120);
}
void StructDataPreviewDlg::updateTableTitle(const QString& dataType, const QString& categoryName,
@ -890,6 +891,12 @@ void StructDataPreviewDlg::updateRecommandLst(QStringList lst)
_recommandCompleter->complete(); // 重新显示补全列表
}
void StructDataPreviewDlg::addLog(const QString &message)
{
QString time = QDateTime::currentDateTime().toString("hh:mm:ss");
ui->listWidget->addItem(QString("[%1] %2").arg(time).arg(message));
ui->listWidget->scrollToBottom();
}
void StructDataPreviewDlg::resizeEvent(QResizeEvent *event)
{

View File

@ -106,6 +106,7 @@ bool StructDataPropertyModel::setData(const QModelIndex& index, const QVariant&
if (changed) {
// 更新到DataManager
updatedProp.bDataChanged = true; //修改后设为真
if (m_dataManager->updateProperty(updatedProp)) {
emit dataChanged(index, index, {role});
emit propertyModified(index.row(), updatedProp);

View File

@ -1,4 +1,5 @@
#include "structDataSource.h"
#include "dataBase.h"
#include "global.h"
StructDataSource::StructDataSource(QObject* parent) : QObject(parent) {
@ -121,7 +122,63 @@ int StructDataSource::removeProperties(const QVector<QString>& codes) {
// 保存到文件
void StructDataSource::saveAll() {
for(auto& pro:allProperties){
if(pro.bDataChanged){ //已修改,需要保存
if(pro.sourceType == "measurement"){ //量测
auto pMeasure = getMeasurementData(pro);
if(pMeasure){
QJsonObject objDataSource;
QJsonObject objIoAddress;
if(pMeasure->nSource == 1){ //3611
objDataSource["type"] = 1;
objIoAddress["station"] = pMeasure->sStation;
objIoAddress["device"] = pMeasure->sDevice;
objIoAddress["channel"] = pMeasure->sChannel;
}
else if(pMeasure->nSource == 2){ //104
objDataSource["type"] = 2;
objIoAddress["station"] = pMeasure->sStation;
objIoAddress["packet"] = pMeasure->nPacket;
objIoAddress["offset"] = pMeasure->nOffset;
}
objDataSource["io_address"] = objIoAddress;
QJsonObject objEventPlan;
QJsonObject objCause;
QJsonObject objAction;
QJsonArray arrPara;
objEventPlan["enable"] = pMeasure->bEnable;
if(pMeasure->type == 0){ //遥测
for(auto iter = pMeasure->mapTE.begin();iter != pMeasure->mapTE.end();++iter){
objCause[iter.key()] = iter.value();
}
}
else if(pMeasure->type == 1){ //遥信
objCause["edge"] = pMeasure->sEdge;
}
objEventPlan["cause"] = objCause;
objAction["command"] = pMeasure->sCommand;
for(auto &para:pMeasure->lstParameter){
arrPara.append(para);
}
objAction["parameters"] = arrPara;
objEventPlan["action"] = objAction;
QJsonObject objBinding;
if(!pMeasure->sWindType.isEmpty()){
QJsonObject objWind;
objWind["ratio"] = pMeasure->nRatio;
objWind["polarity"] = pMeasure->nPolarity;
objWind["index"] = pMeasure->nIndex;
objBinding[pMeasure->sWindType] = objWind;
}
DataBase::GetInstance()->updateMeasurement(pMeasure->name,pMeasure->type,objDataSource,objEventPlan,objBinding,pMeasure->size,pMeasure->componentUuid);
}
}
}
}
}
// 加载数据

View File

@ -19,25 +19,10 @@
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
<number>10</number>
</property>
<property name="topMargin">
<number>10</number>
</property>
<property name="rightMargin">
<number>10</number>
</property>
<property name="bottomMargin">
<number>10</number>
</property>
<property name="horizontalSpacing">
<number>6</number>
</property>
<property name="verticalSpacing">
<number>10</number>
<number>8</number>
</property>
<item row="0" column="0" colspan="20">
<item row="0" column="0" colspan="17">
<widget class="QLabel" name="label_title_ct">
<property name="minimumSize">
<size>
@ -57,9 +42,12 @@
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignmentFlag::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<item row="1" column="0">
<widget class="QLabel" name="label_17">
<property name="text">
<string>额定电流</string>
@ -69,14 +57,21 @@
</property>
</widget>
</item>
<item row="1" column="2" colspan="3">
<item row="1" column="1" colspan="3">
<widget class="QLineEdit" name="le_ratedCurrent">
<property name="readOnly">
<bool>false</bool>
</property>
</widget>
</item>
<item row="1" column="8" colspan="3">
<item row="1" column="4">
<widget class="QLabel" name="label_18">
<property name="text">
<string>A</string>
</property>
</widget>
</item>
<item row="1" column="6" colspan="2">
<widget class="QLabel" name="label_22">
<property name="text">
<string>动稳定电流</string>
@ -86,21 +81,21 @@
</property>
</widget>
</item>
<item row="1" column="11" colspan="4">
<item row="1" column="8" colspan="4">
<widget class="QLineEdit" name="le_dsc_ct">
<property name="readOnly">
<bool>false</bool>
</property>
</widget>
</item>
<item row="1" column="15">
<item row="1" column="12">
<widget class="QLabel" name="label_21">
<property name="text">
<string>A</string>
</property>
</widget>
</item>
<item row="1" column="17">
<item row="1" column="14">
<widget class="QLabel" name="label_27">
<property name="text">
<string>短时热电流</string>
@ -110,21 +105,21 @@
</property>
</widget>
</item>
<item row="1" column="18">
<item row="1" column="15">
<widget class="QLineEdit" name="le_sttc">
<property name="readOnly">
<bool>false</bool>
</property>
</widget>
</item>
<item row="1" column="19">
<item row="1" column="16">
<widget class="QLabel" name="label_26">
<property name="text">
<string>As</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<item row="2" column="0">
<widget class="QLabel" name="label_20">
<property name="text">
<string>工频耐压</string>
@ -134,21 +129,21 @@
</property>
</widget>
</item>
<item row="2" column="2" colspan="2">
<item row="2" column="1" colspan="2">
<widget class="QLineEdit" name="le_pfwv_ct">
<property name="readOnly">
<bool>false</bool>
</property>
</widget>
</item>
<item row="2" column="4" colspan="2">
<item row="2" column="3" colspan="2">
<widget class="QLabel" name="label_19">
<property name="text">
<string>V/1min</string>
</property>
</widget>
</item>
<item row="2" column="7" colspan="2">
<item row="2" column="5">
<widget class="QLabel" name="label_24">
<property name="text">
<string>冲击耐压</string>
@ -158,21 +153,21 @@
</property>
</widget>
</item>
<item row="2" column="9" colspan="3">
<item row="2" column="7" colspan="2">
<widget class="QLineEdit" name="le_iwv_ct">
<property name="readOnly">
<bool>false</bool>
</property>
</widget>
</item>
<item row="2" column="12" colspan="2">
<item row="2" column="9">
<widget class="QLabel" name="label_23">
<property name="text">
<string>V</string>
</property>
</widget>
</item>
<item row="2" column="14" colspan="2">
<item row="2" column="10" colspan="3">
<widget class="QLabel" name="label_25">
<property name="text">
<string>仪表保安系数</string>
@ -182,14 +177,14 @@
</property>
</widget>
</item>
<item row="2" column="16">
<item row="2" column="13">
<widget class="QLineEdit" name="le_isf">
<property name="readOnly">
<bool>false</bool>
</property>
</widget>
</item>
<item row="2" column="17">
<item row="2" column="14">
<widget class="QLabel" name="label_28">
<property name="text">
<string>额定频率</string>
@ -199,14 +194,14 @@
</property>
</widget>
</item>
<item row="2" column="18">
<item row="2" column="15">
<widget class="QLineEdit" name="le_rf_ct">
<property name="readOnly">
<bool>false</bool>
</property>
</widget>
</item>
<item row="2" column="19">
<item row="2" column="16">
<widget class="QLabel" name="label_29">
<property name="text">
<string>Hz</string>
@ -220,70 +215,46 @@
</property>
</widget>
</item>
<item row="3" column="1" colspan="2">
<item row="3" column="1">
<widget class="QRadioButton" name="rb_tpt_ct">
<property name="text">
<string>三相互感器</string>
</property>
</widget>
</item>
<item row="3" column="3" colspan="4">
<item row="3" column="2" colspan="3">
<widget class="QRadioButton" name="rb_zst_ct">
<property name="text">
<string>零序互感器</string>
</property>
</widget>
</item>
<item row="4" column="0" colspan="3">
<item row="4" column="0" colspan="2">
<widget class="QLabel" name="label_31">
<property name="text">
<string>本元件内含CT的配置:</string>
</property>
<property name="alignment">
<set>Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter</set>
<set>Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter</set>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_32">
<property name="text">
<string>变比</string>
<string>变比范围</string>
</property>
</widget>
</item>
<item row="5" column="1" colspan="2">
<widget class="QLineEdit" name="le_tr_ct">
<item row="5" column="1">
<widget class="QLineEdit" name="le_tr_range_ct">
<property name="readOnly">
<bool>false</bool>
</property>
</widget>
</item>
<item row="5" column="5" colspan="2">
<widget class="QLineEdit" name="le_trMin_ct">
<property name="readOnly">
<bool>false</bool>
</property>
</widget>
</item>
<item row="5" column="7">
<widget class="QLabel" name="label_36">
<property name="text">
<string>最大变比</string>
</property>
<property name="alignment">
<set>Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter</set>
</property>
</widget>
</item>
<item row="5" column="8" colspan="2">
<widget class="QLineEdit" name="le_trMax_ct">
<property name="readOnly">
<bool>false</bool>
</property>
</widget>
</item>
<item row="5" column="10" colspan="3">
<widget class="QLabel" name="label_34">
<item row="5" column="2" colspan="2">
<widget class="QLabel" name="label_35">
<property name="text">
<string>精度等级</string>
</property>
@ -292,28 +263,55 @@
</property>
</widget>
</item>
<item row="5" column="13" colspan="3">
<item row="5" column="4">
<widget class="QLineEdit" name="le_ac_ct">
<property name="readOnly">
<bool>false</bool>
</property>
</widget>
</item>
<item row="5" column="16">
<item row="5" column="5" colspan="2">
<widget class="QLabel" name="label_33">
<property name="text">
<string>二次负载容量</string>
</property>
<property name="alignment">
<set>Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter</set>
</property>
</widget>
</item>
<item row="5" column="17" colspan="2">
<item row="5" column="7" colspan="4">
<widget class="QLineEdit" name="le_slc_ct">
<property name="readOnly">
<bool>false</bool>
</property>
</widget>
</item>
<item row="5" column="19">
<item row="5" column="11" colspan="2">
<widget class="QLabel" name="label_34">
<property name="text">
<string>变比</string>
</property>
<property name="alignment">
<set>Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter</set>
</property>
</widget>
</item>
<item row="5" column="13">
<widget class="QLineEdit" name="le_tr_ct">
<property name="readOnly">
<bool>false</bool>
</property>
</widget>
</item>
<item row="5" column="14" colspan="2">
<widget class="QCheckBox" name="cb_polarity">
<property name="text">
<string>正常极性</string>
</property>
</widget>
</item>
<item row="5" column="16">
<widget class="QPushButton" name="btn_add_ct">
<property name="minimumSize">
<size>
@ -356,10 +354,10 @@ QPushButton:disabled {
</property>
</widget>
</item>
<item row="6" column="0" colspan="20">
<item row="6" column="0" colspan="17">
<widget class="QTableWidget" name="tb_ct">
<attribute name="horizontalHeaderVisible">
<bool>false</bool>
<bool>true</bool>
</attribute>
<attribute name="horizontalHeaderDefaultSectionSize">
<number>100</number>
@ -367,19 +365,17 @@ QPushButton:disabled {
<attribute name="horizontalHeaderStretchLastSection">
<bool>true</bool>
</attribute>
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
<column>
<property name="text">
<string>变比</string>
<string>序号</string>
</property>
</column>
<column>
<property name="text">
<string>最小变比</string>
</property>
</column>
<column>
<property name="text">
<string>最大变比</string>
<string>变比范围</string>
</property>
</column>
<column>
@ -394,26 +390,14 @@ QPushButton:disabled {
</column>
<column>
<property name="text">
<string>删除</string>
<string>变比</string>
</property>
</column>
<column>
<property name="text">
<string>极性</string>
</property>
</column>
</widget>
</item>
<item row="1" column="5">
<widget class="QLabel" name="label_18">
<property name="text">
<string>A</string>
</property>
</widget>
</item>
<item row="5" column="3" colspan="2">
<widget class="QLabel" name="label_35">
<property name="text">
<string>最小变比</string>
</property>
<property name="alignment">
<set>Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter</set>
</property>
</widget>
</item>
</layout>

View File

@ -206,6 +206,118 @@ QTabBar::tab:selected {
<property name="verticalSpacing">
<number>10</number>
</property>
<item row="4" column="1">
<widget class="QComboBox" name="cb_windIndex">
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QLineEdit" name="le_dbName"/>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="cb_name">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLineEdit" name="le_dbTag"/>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_dbTag">
<property name="text">
<string>对称标签</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="le_size">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>80</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="label_10">
<property name="text">
<string>(唯一标识)</string>
</property>
<property name="alignment">
<set>Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="cb_tag">
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>数据大小(size):</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>标签(tag):</string>
</property>
<property name="alignment">
<set>Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter</set>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>类型:</string>
</property>
</widget>
</item>
<item row="7" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
@ -241,92 +353,17 @@ QTabBar::tab:selected {
</item>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_2">
<item row="4" column="0">
<widget class="QLabel" name="label_wind">
<property name="text">
<string>类型:</string>
<string>绕组序号</string>
</property>
</widget>
</item>
<item row="4" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="cb_tag">
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_8">
<item row="6" column="0">
<widget class="QLabel" name="label_dbName">
<property name="text">
<string>标签(tag):</string>
</property>
<property name="alignment">
<set>Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="cb_name">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="le_size">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>80</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>数据大小(size):</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="label_10">
<property name="text">
<string>(唯一标识)</string>
</property>
<property name="alignment">
<set>Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter</set>
<string>对称名称</string>
</property>
</widget>
</item>
@ -334,7 +371,7 @@ QTabBar::tab:selected {
</widget>
<widget class="QWidget" name="tab_2">
<attribute name="title">
<string>通信配置</string>
<string>数据配置</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">

View File

@ -19,95 +19,17 @@
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
<number>10</number>
</property>
<property name="topMargin">
<number>10</number>
</property>
<property name="rightMargin">
<number>10</number>
</property>
<property name="bottomMargin">
<number>10</number>
</property>
<property name="horizontalSpacing">
<number>6</number>
</property>
<property name="verticalSpacing">
<number>10</number>
<number>8</number>
</property>
<item row="0" column="0" colspan="22">
<widget class="QLabel" name="label_title_pt">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>30</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">border:4px double dark;</string>
</property>
<item row="5" column="10" colspan="2">
<widget class="QCheckBox" name="cB_polarity">
<property name="text">
<string/>
<string>正常极性</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QLabel" name="label">
<property name="text">
<string>额定电压</string>
</property>
<property name="alignment">
<set>Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="2" colspan="5">
<widget class="QLineEdit" name="le_ratedVol">
<property name="readOnly">
<bool>false</bool>
</property>
</widget>
</item>
<item row="1" column="7">
<widget class="QLabel" name="label_2">
<property name="text">
<string>V</string>
</property>
</widget>
</item>
<item row="1" column="8" colspan="2">
<widget class="QLabel" name="label_3">
<property name="text">
<string>工频耐压</string>
</property>
<property name="alignment">
<set>Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="12" colspan="2">
<widget class="QLineEdit" name="le_pfwv_pt">
<property name="readOnly">
<bool>false</bool>
</property>
</widget>
</item>
<item row="1" column="14" colspan="2">
<widget class="QLabel" name="label_4">
<property name="text">
<string>V/1min</string>
</property>
</widget>
</item>
<item row="1" column="16" colspan="2">
<item row="1" column="11" colspan="2">
<widget class="QLabel" name="label_5">
<property name="text">
<string>冲击耐压</string>
@ -117,17 +39,27 @@
</property>
</widget>
</item>
<item row="1" column="18" colspan="3">
<widget class="QLineEdit" name="le_iwv_pt">
<property name="readOnly">
<bool>false</bool>
<item row="5" column="14">
<widget class="QComboBox" name="cb_wcm">
<property name="currentText">
<string>Yn</string>
</property>
<item>
<property name="text">
<string>Yn</string>
</property>
</item>
<item>
<property name="text">
<string>d(open)</string>
</property>
</item>
</widget>
</item>
<item row="1" column="21">
<widget class="QLabel" name="label_6">
<item row="3" column="3" colspan="2">
<widget class="QRadioButton" name="rb_spt_pt">
<property name="text">
<string>V</string>
<string>单相互感器</string>
</property>
</widget>
</item>
@ -141,54 +73,72 @@
</property>
</widget>
</item>
<item row="2" column="2" colspan="5">
<widget class="QLineEdit" name="le_ratedVolFactor">
<item row="5" column="7">
<widget class="QLineEdit" name="le_slc_pt">
<property name="readOnly">
<bool>false</bool>
</property>
</widget>
</item>
<item row="2" column="8" colspan="4">
<widget class="QLabel" name="label_8">
<item row="4" column="0" colspan="4">
<widget class="QLabel" name="label_12">
<property name="text">
<string>一次绕组接线接地方式</string>
<string>本元件内含PT二次绕组的配置:</string>
</property>
</widget>
</item>
<item row="5" column="3">
<widget class="QLabel" name="label_14">
<property name="text">
<string>精度等级</string>
</property>
</widget>
</item>
<item row="5" column="8">
<widget class="QLabel" name="label_17">
<property name="text">
<string>变比</string>
</property>
<property name="alignment">
<set>Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter</set>
</property>
</widget>
</item>
<item row="2" column="12" colspan="2">
<widget class="QLineEdit" name="le_pwwgm">
<property name="readOnly">
<bool>false</bool>
</property>
</widget>
</item>
<item row="2" column="16" colspan="2">
<widget class="QLabel" name="label_9">
<item row="1" column="4">
<widget class="QLabel" name="label_2">
<property name="text">
<string>额定频率</string>
</property>
<property name="alignment">
<set>Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter</set>
<string>V</string>
</property>
</widget>
</item>
<item row="2" column="18" colspan="3">
<item row="2" column="13" colspan="2">
<widget class="QLineEdit" name="le_rf_pt">
<property name="readOnly">
<bool>false</bool>
</property>
</widget>
</item>
<item row="2" column="21">
<item row="2" column="15">
<widget class="QLabel" name="label_10">
<property name="text">
<string>Hz</string>
</property>
</widget>
</item>
<item row="5" column="9">
<widget class="QLineEdit" name="le_tr_pt">
<property name="readOnly">
<bool>false</bool>
</property>
</widget>
</item>
<item row="5" column="4">
<widget class="QLineEdit" name="le_ac_pt">
<property name="readOnly">
<bool>false</bool>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_11">
<property name="text">
@ -196,122 +146,14 @@
</property>
</widget>
</item>
<item row="3" column="1" colspan="3">
<item row="3" column="1" colspan="2">
<widget class="QRadioButton" name="rb_tpt_pt">
<property name="text">
<string>三相互感器</string>
</property>
</widget>
</item>
<item row="3" column="4" colspan="3">
<widget class="QRadioButton" name="rb_spt_pt">
<property name="text">
<string>单相互感器</string>
</property>
</widget>
</item>
<item row="4" column="0" colspan="6">
<widget class="QLabel" name="label_12">
<property name="text">
<string>本元件内含PT二次绕组的配置:</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_13">
<property name="text">
<string>变比</string>
</property>
</widget>
</item>
<item row="5" column="1" colspan="2">
<widget class="QLineEdit" name="le_tr_pt">
<property name="readOnly">
<bool>false</bool>
</property>
</widget>
</item>
<item row="5" column="3" colspan="2">
<widget class="QLabel" name="label_17">
<property name="text">
<string>最小变比</string>
</property>
</widget>
</item>
<item row="5" column="5">
<widget class="QLineEdit" name="le_trMin_pt">
<property name="readOnly">
<bool>false</bool>
</property>
</widget>
</item>
<item row="5" column="6" colspan="3">
<widget class="QLabel" name="label_18">
<property name="text">
<string>最大变比</string>
</property>
</widget>
</item>
<item row="5" column="9">
<widget class="QLineEdit" name="le_trMax_pt">
<property name="readOnly">
<bool>false</bool>
</property>
</widget>
</item>
<item row="5" column="10">
<widget class="QLabel" name="label_14">
<property name="text">
<string>精度等级</string>
</property>
</widget>
</item>
<item row="5" column="11" colspan="2">
<widget class="QLineEdit" name="le_ac_pt">
<property name="readOnly">
<bool>false</bool>
</property>
</widget>
</item>
<item row="5" column="13" colspan="2">
<widget class="QLabel" name="label_15">
<property name="text">
<string>二次负载容量</string>
</property>
</widget>
</item>
<item row="5" column="15" colspan="2">
<widget class="QLineEdit" name="le_slc_pt">
<property name="readOnly">
<bool>false</bool>
</property>
</widget>
</item>
<item row="5" column="17" colspan="2">
<widget class="QLabel" name="label_16">
<property name="text">
<string>绕组接法</string>
</property>
</widget>
</item>
<item row="5" column="19">
<widget class="QComboBox" name="cb_wcm">
<property name="currentText">
<string>Y</string>
</property>
<item>
<property name="text">
<string>Y</string>
</property>
</item>
<item>
<property name="text">
<string>Δ</string>
</property>
</item>
</widget>
</item>
<item row="5" column="20" colspan="2">
<item row="5" column="15">
<widget class="QPushButton" name="btn_add_pt">
<property name="minimumSize">
<size>
@ -354,10 +196,84 @@ QPushButton:disabled {
</property>
</widget>
</item>
<item row="6" column="0" colspan="22">
<item row="1" column="15">
<widget class="QLabel" name="label_6">
<property name="text">
<string>V</string>
</property>
</widget>
</item>
<item row="2" column="2" colspan="2">
<widget class="QLineEdit" name="le_ratedVolFactor">
<property name="readOnly">
<bool>false</bool>
</property>
</widget>
</item>
<item row="2" column="11" colspan="2">
<widget class="QLabel" name="label_9">
<property name="text">
<string>额定频率</string>
</property>
<property name="alignment">
<set>Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="0" colspan="16">
<widget class="QLabel" name="label_title_pt">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>30</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">border:4px double dark;</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="1" column="2" colspan="2">
<widget class="QLineEdit" name="le_ratedVol">
<property name="readOnly">
<bool>false</bool>
</property>
</widget>
</item>
<item row="5" column="5" colspan="2">
<widget class="QLabel" name="label_15">
<property name="text">
<string>二次负载容量</string>
</property>
</widget>
</item>
<item row="5" column="1" colspan="2">
<widget class="QLineEdit" name="le_tr_range_pt">
<property name="readOnly">
<bool>false</bool>
</property>
</widget>
</item>
<item row="5" column="12" colspan="2">
<widget class="QLabel" name="label_16">
<property name="text">
<string>绕组接法</string>
</property>
</widget>
</item>
<item row="6" column="0" colspan="16">
<widget class="QTableWidget" name="tb_pt">
<attribute name="horizontalHeaderVisible">
<bool>false</bool>
<bool>true</bool>
</attribute>
<attribute name="horizontalHeaderDefaultSectionSize">
<number>130</number>
@ -365,19 +281,17 @@ QPushButton:disabled {
<attribute name="horizontalHeaderStretchLastSection">
<bool>true</bool>
</attribute>
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
<column>
<property name="text">
<string>变比</string>
<string>序号</string>
</property>
</column>
<column>
<property name="text">
<string>最小变比</string>
</property>
</column>
<column>
<property name="text">
<string>最大变比</string>
<string>变比范围</string>
</property>
</column>
<column>
@ -392,14 +306,84 @@ QPushButton:disabled {
</column>
<column>
<property name="text">
<string>绕组接法</string>
<string>变比</string>
</property>
</column>
<column>
<property name="text">
<string>删除</string>
<string>极性</string>
</property>
</column>
<column>
<property name="text">
<string>绕组接法</string>
</property>
</column>
</widget>
</item>
<item row="1" column="13" colspan="2">
<widget class="QLineEdit" name="le_iwv_pt">
<property name="readOnly">
<bool>false</bool>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_13">
<property name="text">
<string>变比范围</string>
</property>
</widget>
</item>
<item row="2" column="5" colspan="3">
<widget class="QLabel" name="label_8">
<property name="text">
<string>一次绕组接线接地方式</string>
</property>
<property name="alignment">
<set>Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="5" colspan="3">
<widget class="QLabel" name="label_3">
<property name="text">
<string>工频耐压</string>
</property>
<property name="alignment">
<set>Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="8">
<widget class="QLineEdit" name="le_pfwv_pt">
<property name="readOnly">
<bool>false</bool>
</property>
</widget>
</item>
<item row="2" column="8">
<widget class="QLineEdit" name="le_pwwgm">
<property name="readOnly">
<bool>false</bool>
</property>
</widget>
</item>
<item row="1" column="9">
<widget class="QLabel" name="label_4">
<property name="text">
<string>V/1min</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QLabel" name="label">
<property name="text">
<string>额定电压</string>
</property>
<property name="alignment">
<set>Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter</set>
</property>
</widget>
</item>
</layout>

View File

@ -68,8 +68,8 @@ public:
bool ifBayExist(QUuid uuid);
bool deleteBay(QUuid uuid);
/*********************************************************************************/
bool insertMeasurement(QString name,QString tag,int type,QJsonObject dataSource,QJsonObject eventPlan,int size,QUuid bayId,QUuid componentId);
bool updateMeasurement(QString name,int type,QJsonObject dataSource,QJsonObject eventPlan,int size,QUuid componentId);
bool insertMeasurement(QString name,QString tag,int type,QJsonObject dataSource,QJsonObject eventPlan,QJsonObject binding,int size,QUuid bayId,QUuid componentId);
bool updateMeasurement(QString name,int type,QJsonObject dataSource,QJsonObject eventPlan,QJsonObject binding,int size,QUuid componentId);
bool delteMeasurement(QString name,QUuid componentId);
bool ifMeasureExist(QString name,QUuid componentId);
QList<MeasurementInfo> getMeasurement(QUuid componentId);

View File

@ -1387,21 +1387,25 @@ bool DataBase::deleteBay(QUuid uuid)
}
/*****************************************************************************/
bool DataBase::insertMeasurement(QString name,QString tag,int type,QJsonObject dataSource,QJsonObject eventPlan,int size,QUuid bayId,QUuid componentId)
bool DataBase::insertMeasurement(QString name,QString tag,int type,QJsonObject dataSource,QJsonObject eventPlan,QJsonObject binding,int size,QUuid bayId,QUuid componentId)
{
QString strSQL = "INSERT INTO measurement(tag, name, type, data_source, event_plan, size, bay_uuid, component_uuid) VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
QString strSQL = "INSERT INTO measurement(tag, name, type, data_source, event_plan, binding, size, bay_uuid, component_uuid) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)";
QJsonDocument dataDoc(dataSource);
QString strData = dataDoc.toJson(QJsonDocument::Compact);
QJsonDocument eventDoc(eventPlan);
QString strEvent = eventDoc.toJson(QJsonDocument::Compact);
QJsonDocument bindDoc(binding);
QString strBind = bindDoc.toJson(QJsonDocument::Compact);
QVariantList params;
params.append(tag);
params.append(name);
params.append(type);
params.append(strData);
params.append(strEvent);
params.append(strBind);
params.append(size);
params.append(bayId);
params.append(componentId);
@ -1418,7 +1422,7 @@ bool DataBase::insertMeasurement(QString name,QString tag,int type,QJsonObject d
}
}
bool DataBase::updateMeasurement(QString name,int type,QJsonObject dataSource,QJsonObject eventPlan,int size,QUuid componentId)
bool DataBase::updateMeasurement(QString name,int type,QJsonObject dataSource,QJsonObject eventPlan,QJsonObject binding,int size,QUuid componentId)
{
QJsonDocument dataDoc(dataSource);
QString strData = dataDoc.toJson(QJsonDocument::Compact);
@ -1426,11 +1430,15 @@ bool DataBase::updateMeasurement(QString name,int type,QJsonObject dataSource,QJ
QJsonDocument eventDoc(eventPlan);
QString strEvent = eventDoc.toJson(QJsonDocument::Compact);
QString strSQL = "UPDATE measurement SET type = ?,data_source = ?,event_plan = ?,size = ? WHERE name = ? AND component_uuid = ?";
QJsonDocument bindDoc(binding);
QString strBind = eventDoc.toJson(QJsonDocument::Compact);
QString strSQL = "UPDATE measurement SET type = ?,data_source = ?,event_plan = ?,binding = ?,size = ? WHERE name = ? AND component_uuid = ?";
QVariantList params;
params.append(type);
params.append(strData);
params.append(strEvent);
params.append(strBind);
params.append(size);
params.append(name);
params.append(componentId);
@ -1492,7 +1500,7 @@ bool DataBase::ifMeasureExist(QString name,QUuid componentId)
QList<MeasurementInfo> DataBase::getMeasurement(QUuid componentId)
{
QList<MeasurementInfo> lst;
QString strSQL = "SELECT tag, name, type, data_source, event_plan, size, bay_uuid, component_uuid FROM measurement WHERE component_uuid = ?";
QString strSQL = "SELECT tag, name, type, data_source, event_plan, binding, size, bay_uuid, component_uuid FROM measurement WHERE component_uuid = ?";
QVariantList params;
params.append(componentId);
@ -1512,9 +1520,12 @@ QList<MeasurementInfo> DataBase::getMeasurement(QUuid componentId)
QString sEvent = query.value(4).toString();
QJsonObject objEvent = QstringToJson(sEvent);
info.size = query.value(5).toInt();
info.bayUuid = QUuid(query.value(6).toString());
info.componentUuid = QUuid(query.value(7).toString());
QString sBinding = query.value(5).toString();
QJsonObject objBinding = QstringToJson(sBinding);
info.size = query.value(6).toInt();
info.bayUuid = QUuid(query.value(7).toString());
info.componentUuid = QUuid(query.value(8).toString());
info.nSource = objData["type"].toInt();
QJsonObject objIoAddress = objData["io_address"].toObject();
@ -1546,6 +1557,23 @@ QList<MeasurementInfo> DataBase::getMeasurement(QUuid componentId)
for(const QJsonValue &paraValue:arrPara){
info.lstParameter.append(paraValue.toString());
}
if(objBinding.contains("ct") || objBinding.contains("pt") ){
if(objBinding.contains("ct")){
QJsonObject objWind = objBinding["ct"].toObject();
info.nRatio = objWind["ratio"].toInt();
info.nPolarity = objWind["polarity"].toInt();
info.nIndex = objWind["index"].toInt();
info.sWindType = "ct";
}
else{
QJsonObject objWind = objBinding["pt"].toObject();
info.nRatio = objWind["ratio"].toInt();
info.nPolarity = objWind["polarity"].toInt();
info.nIndex = objWind["index"].toInt();
info.sWindType = "pt";
}
}
lst.append(info);
}
query.clear();
@ -1560,7 +1588,7 @@ QList<MeasurementInfo> DataBase::getMeasurement(QUuid componentId)
QMap<QString,MeasurementInfo> DataBase::getAllMeasurements()
{
QMap<QString,MeasurementInfo> lst;
QString strSQL = "SELECT tag, name, type, data_source, event_plan, size, bay_uuid, component_uuid FROM measurement";
QString strSQL = "SELECT tag, name, type, data_source, event_plan, binding, size, bay_uuid, component_uuid FROM measurement";
try
{
@ -1578,13 +1606,16 @@ QMap<QString,MeasurementInfo> DataBase::getAllMeasurements()
QString sEvent = query.value(4).toString();
QJsonObject objEvent = QstringToJson(sEvent);
info.size = query.value(5).toInt();
info.bayUuid = QUuid(query.value(6).toString());
info.componentUuid = QUuid(query.value(7).toString());
QString sBind = query.value(5).toString();
QJsonObject objBinding = QstringToJson(sBind);
info.size = query.value(6).toInt();
info.bayUuid = QUuid(query.value(7).toString());
info.componentUuid = QUuid(query.value(8).toString());
info.nSource = objData["type"].toInt();
QJsonObject objIoAddress = objData["io_address"].toObject();
info.sStation = objData["station"].toString();
info.sStation = objIoAddress["station"].toString();
info.sDevice = objIoAddress["device"].toString();
info.sChannel = objIoAddress["channel"].toString();
info.nPacket = objIoAddress["packet"].toInt();
@ -1612,6 +1643,21 @@ QMap<QString,MeasurementInfo> DataBase::getAllMeasurements()
for(const QJsonValue &paraValue:arrPara){
info.lstParameter.append(paraValue.toString());
}
if(objBinding.contains("ct") || objBinding.contains("pt") ){
if(objBinding.contains("ct")){
QJsonObject objWind = objBinding["ct"].toObject();
info.nRatio = objWind["ratio"].toInt();
info.nPolarity = objWind["polarity"].toInt();
info.nIndex = objWind["index"].toInt();
}
else{
QJsonObject objWind = objBinding["pt"].toObject();
info.nRatio = objWind["ratio"].toInt();
info.nPolarity = objWind["polarity"].toInt();
info.nIndex = objWind["index"].toInt();
}
}
lst.insert(info.tag,info);
}
query.clear();
@ -1625,7 +1671,7 @@ QMap<QString,MeasurementInfo> DataBase::getAllMeasurements()
/*****************************************************************************/
bool DataBase::insertExtraProperty(ExtraProperty pro)
{
QString strSQL = "INSERT INTO properties_setting(code, tag, name, grid_name, zone_name, station_name, current_level, bay_name, component_name, group_name, type_name, grid_tag, zone_tag, station_tag, page_tag, bay_tag, component_uuid, group_tag, type_tag, source_type, source_config, connect_para) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
QString strSQL = "INSERT INTO properties_setting(code, tag, name, grid_name, zone_name, station_name, current_level, bay_name, component_name, group_name, type_name, grid_tag, zone_tag, station_tag, page_tag, bay_tag, component_uuid, component_tag, group_tag, type_tag, source_type, source_config, connect_para) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
QJsonDocument configDoc(QJsonObject::fromVariantMap(pro.sourceConfig));
QString strConfig = configDoc.toJson(QJsonDocument::Compact);
@ -1648,6 +1694,7 @@ bool DataBase::insertExtraProperty(ExtraProperty pro)
params.append(pro.page_tag);
params.append(pro.bay_tag);
params.append(pro.component_uuid.toString());
params.append(pro.component_tag);
params.append(pro.group_tag);
params.append(pro.type_tag);
params.append(pro.sourceType);
@ -1731,7 +1778,7 @@ bool DataBase::ifExtraPropertyExist(QString code)
QList<ExtraProperty> DataBase::getCompoExtraProperty(QUuid uid)
{
QList<ExtraProperty> lst;
QString strSQL = "SELECT code, tag, name, grid_name, zone_name, station_name, current_level, bay_name, component_name, group_name, type_name, grid_tag, zone_tag, station_tag, page_tag, bay_tag, component_uuid, group_tag, type_tag, source_type, source_config, connect_para FROM properties_setting WHERE component_uuid = ?";
QString strSQL = "SELECT code, tag, name, grid_name, zone_name, station_name, current_level, bay_name, component_name, group_name, type_name, grid_tag, zone_tag, station_tag, page_tag, bay_tag, component_uuid, component_tag, group_tag, type_tag, source_type, source_config, connect_para FROM properties_setting WHERE component_uuid = ?";
QVariantList params;
params.append(uid);
@ -1759,14 +1806,15 @@ QList<ExtraProperty> DataBase::getCompoExtraProperty(QUuid uid)
info.page_tag = query.value(14).toString();
info.bay_tag = query.value(15).toString();
info.component_uuid = QUuid(query.value(16).toString());
info.group_tag = query.value(17).toString();
info.type_tag = query.value(18).toString();
info.component_tag = query.value(17).toString();
info.group_tag = query.value(18).toString();
info.type_tag = query.value(19).toString();
info.sourceType = query.value(19).toString();
QString sConfig = query.value(20).toString();
info.sourceType = query.value(20).toString();
QString sConfig = query.value(21).toString();
QJsonObject objConfig = QstringToJson(sConfig);
info.sourceConfig = objConfig.toVariantMap();
info.connect_para = query.value(21).toString();
info.connect_para = query.value(22).toString();
lst.append(info);
}
@ -1782,7 +1830,7 @@ QList<ExtraProperty> DataBase::getCompoExtraProperty(QUuid uid)
QList<ExtraProperty> DataBase::getAllExtraProperty()
{
QList<ExtraProperty> lst;
QString strSQL = "SELECT code, tag, name, grid_name, zone_name, station_name, current_level, bay_name, component_name, group_name, type_name, grid_tag, zone_tag, station_tag, page_tag, bay_tag, component_uuid, group_tag, type_tag, source_type, source_config, connect_para FROM properties_setting";
QString strSQL = "SELECT code, tag, name, grid_name, zone_name, station_name, current_level, bay_name, component_name, group_name, type_name, grid_tag, zone_tag, station_tag, page_tag, bay_tag, component_uuid, component_tag, group_tag, type_tag, source_type, source_config, connect_para FROM properties_setting";
try
{
@ -1808,14 +1856,15 @@ QList<ExtraProperty> DataBase::getAllExtraProperty()
info.page_tag = query.value(14).toString();
info.bay_tag = query.value(15).toString();
info.component_uuid = QUuid(query.value(16).toString());
info.group_tag = query.value(17).toString();
info.type_tag = query.value(18).toString();
info.component_tag = query.value(17).toString();
info.group_tag = query.value(18).toString();
info.type_tag = query.value(19).toString();
info.sourceType = query.value(19).toString();
QString sConfig = query.value(20).toString();
info.sourceType = query.value(20).toString();
QString sConfig = query.value(21).toString();
QJsonObject objConfig = QstringToJson(sConfig);
info.sourceConfig = objConfig.toVariantMap();
info.connect_para = query.value(21).toString();
info.connect_para = query.value(22).toString();
lst.append(info);
}