布置图图例规则更新,针对对象进行设置,增加是否默认图标标记,图纸导入修改,图纸检查属性互斥BUG修正

This commit is contained in:
supercjj2023 2025-08-27 09:57:40 +08:00
parent fd11db648d
commit c0726a41d4
6 changed files with 52 additions and 18 deletions

View File

@ -173,6 +173,7 @@ namespace Learun.Application.Web.AppApi
#region #region
var fileId = tagInfo.DefaultLayoutLibFileID; var fileId = tagInfo.DefaultLayoutLibFileID;
var matched = false; var matched = false;
var isNotDefaultSymbol = true;
foreach (var filter in allFilter.Where(x => x.ObjectTypeId == tagInfo.ObjectTypeID)) foreach (var filter in allFilter.Where(x => x.ObjectTypeId == tagInfo.ObjectTypeID))
{ {
if (matched) if (matched)
@ -195,13 +196,20 @@ namespace Learun.Application.Web.AppApi
//一个满足即可 //一个满足即可
matched = true; matched = true;
fileId = filter.LayoutLibFileID; fileId = filter.LayoutLibFileID;
isNotDefaultSymbol = false;
break; break;
} }
//如果是and继续看下面的属性先给图例如果有一个不满足会break的,主要是避免只有一个条件的时候
fileId = filter.LayoutLibFileID;
matched = true;
isNotDefaultSymbol = false;
} }
else else
{ {
if (filterOp.ToUpper() == "AND") if (filterOp.ToUpper() == "AND")
{ {
matched = false;
isNotDefaultSymbol = true;
//一个不满足都不满足 //一个不满足都不满足
break; break;
} }
@ -212,20 +220,19 @@ namespace Learun.Application.Web.AppApi
//压根没这个属性,认为不符合 //压根没这个属性,认为不符合
if (filterOp.ToUpper() == "AND") if (filterOp.ToUpper() == "AND")
{ {
matched = false;
isNotDefaultSymbol = true;
break; break;
} }
} }
} }
//能走到这里说明满足这个
matched = true;
fileId = tagInfo.DefaultLayoutLibFileID;
} }
#endregion #endregion
var layoutTagInfo = new layoutTagInfoBrief() var layoutTagInfo = new layoutTagInfoBrief()
{ {
EngineDataID = matchPointTagId, EngineDataID = matchPointTagId,
FileId = fileId, //2个优先级 FileId = fileId, //2个优先级
IsNotDefaultSymbol= isNotDefaultSymbol,
PixelOnDwg = "", PixelOnDwg = "",
TagNumber = tagInfo.TagNumber, TagNumber = tagInfo.TagNumber,
X = frameLists.FirstOrDefault(X => X.Num == Prop_Frame).Value, X = frameLists.FirstOrDefault(X => X.Num == Prop_Frame).Value,

View File

@ -808,10 +808,6 @@ namespace Learun.Application.Web.Areas.ZZDT_EC.Controllers
foreach (var cable in cables) //Where(x => x.TagNumber == "TEST-CABLE-001" || x.TagNumber == "1L11-7") foreach (var cable in cables) //Where(x => x.TagNumber == "TEST-CABLE-001" || x.TagNumber == "1L11-7")
{ {
if (cable.TagNumber == "3MAC-03")
{
var a = 1;
}
try try
{ {

View File

@ -1046,7 +1046,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
sourceTag.UpdateTime = DateTime.Now; sourceTag.UpdateTime = DateTime.Now;
sourceTag.UpdateUserID = LoginUserInfo.Get().userId; sourceTag.UpdateUserID = LoginUserInfo.Get().userId;
sourceTag.EngineDataID = targetTagWithSameName.EngineDataID;//已经是新的了 sourceTag.EngineDataID = targetTagWithSameName.EngineDataID;//已经是新的了
sourceTag.originId = sourceTag.EngineDataID; //sourceTag.originId = sourceTag.EngineDataID;
} }
else else
{ {
@ -1315,7 +1315,11 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
#region property #region property
//获取对应的工程数据属性 //获取对应的工程数据属性
var sourceTagProps = PropServ.GetTagPropById(item.ProjectId, sourceTag.originId).ToList(); var sourceTagProps = PropServ.GetTagPropById(item.ProjectId, sourceTag.originId).ToList();
var targetTagProps = PropServ.GetTagPropById(ProjectId, sourceTag.originId).ToList(); var targetTagProps = PropServ.GetTagPropById(ProjectId, sourceTag.EngineDataID).ToList();
var updateList = new List<ec_enginedata_propertyEntity>();
var hisInsertList = new List<ec_enginedata_propertyhisEntity>();
if (sourceTagProps != null && sourceTagProps.Count > 0) if (sourceTagProps != null && sourceTagProps.Count > 0)
{ {
foreach (var property in sourceTagProps) foreach (var property in sourceTagProps)
@ -1332,14 +1336,16 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
EngineDataID = tarProp.EngineDataID EngineDataID = tarProp.EngineDataID
}; };
propHis.Create(); propHis.Create();
hisInsertList.Add(propHis);
//已有属性 //已有属性
tarProp.PropertyValue = property.PropertyValue; //新值 tarProp.PropertyValue = property.PropertyValue; //新值
tarProp.MeasuringUnit = property.MeasuringUnit; tarProp.MeasuringUnit = property.MeasuringUnit;
tarProp.UpdateTime = System.DateTime.Now; tarProp.UpdateTime = System.DateTime.Now;
tarProp.UpdateUserID = userInfo.userId; tarProp.UpdateUserID = userInfo.userId;
Db.Updateable(tarProp).AS($"ec_enginedata_property_{targetProject.ProjectIndex}").ExecuteCommand(); updateList.Add(tarProp);
Db.Insertable(propHis).AS($"ec_enginedata_propertyhis_{targetProject.ProjectIndex}").ExecuteCommand(); //Db.Updateable(tarProp).AS($"ec_enginedata_property_{targetProject.ProjectIndex}").ExecuteCommand();
//Db.Insertable(propHis).AS($"ec_enginedata_propertyhis_{targetProject.ProjectIndex}").ExecuteCommand();
} }
else else
{ {
@ -1354,6 +1360,25 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
//要和现有的比一下,没有的就插入,有的就更新 //要和现有的比一下,没有的就插入,有的就更新
} }
} }
if (updateList.Count > 0)
{
Db.Updateable(updateList)
.AS($"ec_enginedata_property_{targetProject.ProjectIndex}")
.UpdateColumns(x => new {
x.PropertyValue,
x.MeasuringUnit,
x.UpdateTime,
x.UpdateUserID
})
.WhereColumns(x => x.EngineDataPropertyID) // 确保按主键更新
.ExecuteCommand();
}
if (hisInsertList.Count > 0)
{
Db.Insertable(hisInsertList)
.AS($"ec_enginedata_propertyhis_{targetProject.ProjectIndex}")
.ExecuteCommand();
}
#endregion #endregion
#region pixel #region pixel
//获取工程数据对应的图元数据 //获取工程数据对应的图元数据

View File

@ -421,6 +421,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
foreach (var tag in allTagByType) foreach (var tag in allTagByType)
{ {
var propCol2 = propCol;//这个开始列不能变 var propCol2 = propCol;//这个开始列不能变
var grpPropCol = propCol;
//先横后纵(先位号) //先横后纵(先位号)
foreach (var group in groups) foreach (var group in groups)
{ {
@ -507,9 +508,10 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
} }
//不满足 涂色 //不满足 涂色
curSheet.Cells[curRow, propCol, curRow, propCol2 - 1].Style.Fill.PatternType = OfficeOpenXml.Style.ExcelFillStyle.Solid; curSheet.Cells[curRow, grpPropCol, curRow, propCol2 - 1].Style.Fill.PatternType = OfficeOpenXml.Style.ExcelFillStyle.Solid;
curSheet.Cells[curRow, propCol, curRow, propCol2 - 1].Style.Fill.BackgroundColor.SetColor(color); curSheet.Cells[curRow, grpPropCol, curRow, propCol2 - 1].Style.Fill.BackgroundColor.SetColor(color);
curSheet.Cells[curRow, propCol, curRow, propCol2 - 1].AddComment(strComment); curSheet.Cells[curRow, grpPropCol, curRow, propCol2 - 1].AddComment(strComment);
grpPropCol = propCol2;
} }
} }
curRow++; curRow++;

View File

@ -24,6 +24,10 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
/// </summary> /// </summary>
public string TagNumber { get; set; } = ""; public string TagNumber { get; set; } = "";
/// <summary> /// <summary>
/// 是否默认图标
/// </summary>
public bool IsNotDefaultSymbol { get; set; }
/// <summary>
/// 图元文件Id /// 图元文件Id
/// </summary> /// </summary>
public string FileId { get; set; } public string FileId { get; set; }

View File

@ -201,7 +201,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
public List<ec_objTypeLayoutFilter> GetLayoutFilterList(string projId, string objTypeId) public List<ec_objTypeLayoutFilter> GetLayoutFilterList(string projId, string objTypeId)
{ {
var tbName = ProjectSugar.TableName<ec_objTypeLayoutFilter>(projId); var tbName = ProjectSugar.TableName<ec_objTypeLayoutFilter>(projId);
var res = Db.Queryable<ec_objTypeLayoutFilter>().AS(tbName).ToList(); var res = Db.Queryable<ec_objTypeLayoutFilter>().AS(tbName).Where(x=>x.ObjectTypeId==objTypeId).ToList();
var tbFileName = ProjectSugar.TableName<ec_library_fileEntity>(projId); var tbFileName = ProjectSugar.TableName<ec_library_fileEntity>(projId);
var fileBll = new ec_library_fileBLL(); var fileBll = new ec_library_fileBLL();
var res2 = fileBll.GetList("{ProjectId:\"" + projId + "\"}").ToList(); var res2 = fileBll.GetList("{ProjectId:\"" + projId + "\"}").ToList();