fix measurement category
This commit is contained in:
parent
5d49f07558
commit
ed6c2ec041
|
|
@ -31,6 +31,7 @@ public:
|
||||||
virtual void clearData(){};
|
virtual void clearData(){};
|
||||||
|
|
||||||
QJsonObject parseCTWindingDefaultValue(const QVariant &value); //QVariant类型到QJsonObject转换(数据库读取的是var是QString)
|
QJsonObject parseCTWindingDefaultValue(const QVariant &value); //QVariant类型到QJsonObject转换(数据库读取的是var是QString)
|
||||||
|
QList<MeasureAttributeType> getAttributeList(const QString& sMeta); //返回基模-bay属性组下所有属性
|
||||||
protected:
|
protected:
|
||||||
QMap<QString,PropertyContentInfo> _mapPro;
|
QMap<QString,PropertyContentInfo> _mapPro;
|
||||||
QFormLayout* createFormLayout(QWidget* parent);
|
QFormLayout* createFormLayout(QWidget* parent);
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
#include "baseContentDlg.h"
|
#include "baseContentDlg.h"
|
||||||
|
#include "projectModelManager.h"
|
||||||
#include <QScrollArea>
|
#include <QScrollArea>
|
||||||
#include <QFormLayout>
|
#include <QFormLayout>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
|
@ -68,3 +69,8 @@ QJsonObject BaseContentDlg::parseCTWindingDefaultValue(const QVariant &value)
|
||||||
<< value.typeName();
|
<< value.typeName();
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QList<MeasureAttributeType> BaseContentDlg::getAttributeList(const QString& sMeta)
|
||||||
|
{
|
||||||
|
return ProjectModelManager::instance().getAttributeLabelInfo(sMeta);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,9 @@ void BayInfoDlg::setPropertyValue(QVariant var)
|
||||||
if(property)
|
if(property)
|
||||||
{
|
{
|
||||||
_itemProperty = property;
|
_itemProperty = property;
|
||||||
QList<MeasureAttributeType> lstType = DataBase::GetInstance()->getMeasureAttributeTypes();
|
QString sMeta = property->metaModelName();
|
||||||
|
QList<MeasureAttributeType> lstType = getAttributeList(sMeta);
|
||||||
|
//QList<MeasureAttributeType> lstType = DataBase::GetInstance()->getMeasureAttributeTypes();
|
||||||
|
|
||||||
_validType = lstType;
|
_validType = lstType;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -411,7 +411,7 @@ void DiagramCavas::onSignal_panelDelete(const QString& name,int nType)
|
||||||
this->removeSubWindow(pPanel);
|
this->removeSubWindow(pPanel);
|
||||||
delete pPanel;
|
delete pPanel;
|
||||||
}
|
}
|
||||||
calculateLauncherVisible();
|
//calculateLauncherVisible();
|
||||||
emit clearTopology();
|
emit clearTopology();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,8 @@ public:
|
||||||
QStringList getModelList() const; //获取元模型列表
|
QStringList getModelList() const; //获取元模型列表
|
||||||
QStringList getGroupList(const QString& model) const; //返回该元模下的属性组列表
|
QStringList getGroupList(const QString& model) const; //返回该元模下的属性组列表
|
||||||
QStringList getPublicGroupList() const; //返回公共属性组列表
|
QStringList getPublicGroupList() const; //返回公共属性组列表
|
||||||
QStringList getAttributeList(const QString& model,const QString& group) const; //根据元模名和组名返回属性列表
|
QStringList getAttributeList(const QString& model,const QString& group,bool bContainInvalid = false) const; //根据元模名和组名返回属性列表 bContainInvalid:包含不可用属性(visible = 2)
|
||||||
|
QList<MeasureAttributeType> getAttributeLabelInfo(const QString& model,const QString& group = "bay") const; //返回属性列表标签信息 元模名,属性组名
|
||||||
QStringList getPublicAttributeList(const QString& group); //返回公共属性组的属性列表
|
QStringList getPublicAttributeList(const QString& group); //返回公共属性组的属性列表
|
||||||
void setItemAttribute(const QString&,QStandardItem*); //设置item的属性(数据库表字段名)
|
void setItemAttribute(const QString&,QStandardItem*); //设置item的属性(数据库表字段名)
|
||||||
QPair<QString,QString> combinePropertySql(const QStandardItem*); //根据item属性生成sql
|
QPair<QString,QString> combinePropertySql(const QStandardItem*); //根据item属性生成sql
|
||||||
|
|
@ -46,6 +47,7 @@ private:
|
||||||
QJsonObject getSelectedState(QList<QStandardItem*> select,QList<QStandardItem*> base); //返回json格式的选中状态
|
QJsonObject getSelectedState(QList<QStandardItem*> select,QList<QStandardItem*> base); //返回json格式的选中状态
|
||||||
QString getItemDataType(const QStandardItem* pItem); //返回数据类型
|
QString getItemDataType(const QStandardItem* pItem); //返回数据类型
|
||||||
ProjectModelSettingStruct getModelSetting(const QString& sMeta,const QString& sProject); //获取指定工程模的设定
|
ProjectModelSettingStruct getModelSetting(const QString& sMeta,const QString& sProject); //获取指定工程模的设定
|
||||||
|
QList<MeasureAttributeType> processSpecialAttribute(const QString&,const QString&) const; //处理特殊量测
|
||||||
|
|
||||||
QByteArray cleanHexData(const QByteArray& hexData);
|
QByteArray cleanHexData(const QByteArray& hexData);
|
||||||
QByteArray fixHexLength(const QByteArray& hexData);
|
QByteArray fixHexLength(const QByteArray& hexData);
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,8 @@ BasePropertyManager::~BasePropertyManager()
|
||||||
{
|
{
|
||||||
qDeleteAll(m_entityData);
|
qDeleteAll(m_entityData);
|
||||||
qDeleteAll(m_bayData);
|
qDeleteAll(m_bayData);
|
||||||
|
m_entityData.clear();
|
||||||
|
m_bayData.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BasePropertyManager::insertEntityData(QUuid uid,BaseProperty* p)
|
void BasePropertyManager::insertEntityData(QUuid uid,BaseProperty* p)
|
||||||
|
|
|
||||||
|
|
@ -394,7 +394,7 @@ QStringList ProjectModelManager::getPublicGroupList() const
|
||||||
return groupList;
|
return groupList;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList ProjectModelManager::getAttributeList(const QString& sM,const QString& sG) const
|
QStringList ProjectModelManager::getAttributeList(const QString& sM,const QString& sG,bool bContainInvalid) const
|
||||||
{
|
{
|
||||||
QMap<int,modelType> modelType = DataBase::GetInstance()->ModelType();
|
QMap<int,modelType> modelType = DataBase::GetInstance()->ModelType();
|
||||||
QMap<int,attributeGroup> groupMap = DataBase::GetInstance()->AttributeGroup();
|
QMap<int,attributeGroup> groupMap = DataBase::GetInstance()->AttributeGroup();
|
||||||
|
|
@ -426,7 +426,7 @@ QStringList ProjectModelManager::getAttributeList(const QString& sM,const QStrin
|
||||||
{
|
{
|
||||||
if(mt.modelTypeId == metaId && mt.attributeGroupId == groupId)
|
if(mt.modelTypeId == metaId && mt.attributeGroupId == groupId)
|
||||||
{
|
{
|
||||||
if(attMap[mt.attributeId].isVisible == 2) //2为特殊属性,不加入选择
|
if(!bContainInvalid && attMap[mt.attributeId].isVisible == 2) //2为特殊属性,不加入选择
|
||||||
continue;
|
continue;
|
||||||
lst.append(attMap[mt.attributeId].attribute);
|
lst.append(attMap[mt.attributeId].attribute);
|
||||||
}
|
}
|
||||||
|
|
@ -435,6 +435,58 @@ QStringList ProjectModelManager::getAttributeList(const QString& sM,const QStrin
|
||||||
return lst;
|
return lst;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QList<MeasureAttributeType> ProjectModelManager::getAttributeLabelInfo(const QString& sM,const QString& sG) const
|
||||||
|
{
|
||||||
|
QMap<int,modelType> modelType = DataBase::GetInstance()->ModelType();
|
||||||
|
QMap<int,attributeGroup> groupMap = DataBase::GetInstance()->AttributeGroup();
|
||||||
|
QMap<int,modelAttribute> modelAttMap = DataBase::GetInstance()->ModelAttribute();
|
||||||
|
QMap<int,attribute> attMap = DataBase::GetInstance()->Attribute();
|
||||||
|
|
||||||
|
int metaId = -1;
|
||||||
|
int baseType = -1;
|
||||||
|
for(auto &meta:modelType)
|
||||||
|
{
|
||||||
|
if(sM == meta.modelType) //查找元模对应的id
|
||||||
|
{
|
||||||
|
metaId = meta.id;
|
||||||
|
baseType = meta.graphicElement;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int groupId = -1;
|
||||||
|
for(auto &attGroup:groupMap)
|
||||||
|
{
|
||||||
|
if(attGroup.groupType == sG) //固定为bay
|
||||||
|
{
|
||||||
|
groupId = attGroup.id;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<MeasureAttributeType> lst;
|
||||||
|
for(auto &mt:modelAttMap)
|
||||||
|
{
|
||||||
|
if(mt.modelTypeId == metaId && mt.attributeGroupId == groupId)
|
||||||
|
{
|
||||||
|
if(baseType == 4 || baseType == 5){ //pt和ct的情况,将visible为2的处理后加入量测列表
|
||||||
|
if(attMap[mt.attributeId].isVisible == 2){
|
||||||
|
auto tLst = processSpecialAttribute(attMap[mt.attributeId].attribute,attMap[mt.attributeId].attributeName);
|
||||||
|
lst += tLst;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{ //其他元件直接添加到量测列表
|
||||||
|
MeasureAttributeType info;
|
||||||
|
info.tag = attMap[mt.attributeId].attribute;
|
||||||
|
info.name = attMap[mt.attributeId].attributeName;
|
||||||
|
lst.append(info);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return lst;
|
||||||
|
}
|
||||||
|
|
||||||
QStringList ProjectModelManager::getPublicAttributeList(const QString& group)
|
QStringList ProjectModelManager::getPublicAttributeList(const QString& group)
|
||||||
{
|
{
|
||||||
QMap<int,modelAttributePublic> modelAttPublic = DataBase::GetInstance()->ModelAttributePublic();
|
QMap<int,modelAttributePublic> modelAttPublic = DataBase::GetInstance()->ModelAttributePublic();
|
||||||
|
|
@ -861,6 +913,128 @@ ProjectModelSettingStruct ProjectModelManager::getModelSetting(const QString& sM
|
||||||
return setting;
|
return setting;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QList<MeasureAttributeType> ProjectModelManager::processSpecialAttribute(const QString& attribute,const QString& attributeName) const
|
||||||
|
{
|
||||||
|
QList<MeasureAttributeType> lst;
|
||||||
|
QString attName = attribute;
|
||||||
|
QString attTag = attributeName;
|
||||||
|
|
||||||
|
const QChar firstChar = attName.isEmpty() ? QChar() : attName.at(0);
|
||||||
|
const bool hasDollar = attName.contains("$");
|
||||||
|
const bool hasUnderDollar = attName.contains("_$");
|
||||||
|
const bool hasSn = attName.contains("sn");
|
||||||
|
|
||||||
|
/* ========== 规则 1:_$ ========== */
|
||||||
|
if (hasUnderDollar)
|
||||||
|
{
|
||||||
|
QStringList underDollarValues;
|
||||||
|
|
||||||
|
if (firstChar == 'I')
|
||||||
|
{
|
||||||
|
underDollarValues = QStringList{"a", "b", "c"};
|
||||||
|
}
|
||||||
|
else // U
|
||||||
|
{
|
||||||
|
underDollarValues = QStringList{"ab", "bc", "ca"}; // ✅ 已修正
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasSn)
|
||||||
|
{
|
||||||
|
for (const QString& u : underDollarValues)
|
||||||
|
{
|
||||||
|
QString tmpName = attName;
|
||||||
|
QString tmpTag = attTag;
|
||||||
|
tmpName.replace("_$", u);
|
||||||
|
tmpTag.replace("_$", u);
|
||||||
|
|
||||||
|
for (const QString& sn : {"s1","s2","s3"})
|
||||||
|
{
|
||||||
|
MeasureAttributeType m;
|
||||||
|
m.tag = tmpName;
|
||||||
|
m.name = tmpTag;
|
||||||
|
m.tag.replace("sn", sn);
|
||||||
|
m.name.replace("sn", sn);
|
||||||
|
lst.append(m);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (const QString& u : underDollarValues)
|
||||||
|
{
|
||||||
|
MeasureAttributeType m;
|
||||||
|
m.tag = attName;
|
||||||
|
m.name = attTag;
|
||||||
|
m.tag.replace("_$", u);
|
||||||
|
m.name.replace("_$", u);
|
||||||
|
lst.append(m);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* ========== 规则 2:$ ========== */
|
||||||
|
else if (hasDollar)
|
||||||
|
{
|
||||||
|
QStringList dollarValues =
|
||||||
|
(firstChar == 'I') ? QStringList{"A","B","C"}
|
||||||
|
: QStringList{"AB","BC","CA"};
|
||||||
|
|
||||||
|
if (hasSn)
|
||||||
|
{
|
||||||
|
for (const QString& d : dollarValues)
|
||||||
|
{
|
||||||
|
QString tmpName = attName;
|
||||||
|
QString tmpTag = attTag;
|
||||||
|
tmpName.replace("$", d);
|
||||||
|
tmpTag.replace("$", d);
|
||||||
|
|
||||||
|
for (const QString& sn : {"s1","s2","s3"})
|
||||||
|
{
|
||||||
|
MeasureAttributeType m;
|
||||||
|
m.tag = tmpName;
|
||||||
|
m.name = tmpTag;
|
||||||
|
m.tag.replace("sn", sn);
|
||||||
|
m.name.replace("sn", sn);
|
||||||
|
lst.append(m);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (const QString& d : dollarValues)
|
||||||
|
{
|
||||||
|
MeasureAttributeType m;
|
||||||
|
m.tag = attName;
|
||||||
|
m.name = attTag;
|
||||||
|
m.tag.replace("$", d);
|
||||||
|
m.name.replace("$", d);
|
||||||
|
lst.append(m);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* ========== 规则 3:仅 sn ========== */
|
||||||
|
else if (hasSn)
|
||||||
|
{
|
||||||
|
for (const QString& sn : {"s1","s2","s3"})
|
||||||
|
{
|
||||||
|
MeasureAttributeType m;
|
||||||
|
m.tag = attName;
|
||||||
|
m.name = attTag;
|
||||||
|
m.tag.replace("sn", sn);
|
||||||
|
m.name.replace("sn", sn);
|
||||||
|
lst.append(m);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* ========== 规则 4:无占位符 ========== */
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MeasureAttributeType m;
|
||||||
|
m.tag = attName;
|
||||||
|
m.name = attTag;
|
||||||
|
lst.append(m);
|
||||||
|
}
|
||||||
|
return lst;
|
||||||
|
}
|
||||||
|
|
||||||
QByteArray ProjectModelManager::cleanHexData(const QByteArray& hexData) {
|
QByteArray ProjectModelManager::cleanHexData(const QByteArray& hexData) {
|
||||||
QByteArray cleaned = hexData;
|
QByteArray cleaned = hexData;
|
||||||
// 移除空格、换行等空白字符
|
// 移除空格、换行等空白字符
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue