修改电缆属性修改的判定规则,主要是增加上级系统是否一致的判定,SYSTEM还是让他去主系统改,不是主系统不让改系统,哪怕从空到有。
This commit is contained in:
parent
b9b4980541
commit
023ed5d713
@ -1562,6 +1562,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
||||
var typeTbName = ProjectSugar.TableName<ec_objecttypeEntity>(projectId);
|
||||
var dwgTbName = ProjectSugar.TableName<ec_drawing_fileEntity>(projectId);
|
||||
var pixelTbName = ProjectSugar.TableName<ec_enginedata_pixelEntity>(projectId);
|
||||
var dataitemdetailTableName = TableName<ec_dataitemdetailEntity>(projectId);
|
||||
|
||||
var allType = SqlSugarHelper.Db.Queryable<ec_objecttypeEntity>().AS(typeTbName).ToList();
|
||||
var systems = new ec_dataitemBLL().GetDetailList(GlobalObject.enumlist_System, "", projectId);
|
||||
@ -1573,14 +1574,24 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
||||
{
|
||||
|
||||
var cableSystemObj = entity.EngineDataProperty.FirstOrDefault(x => x.PropertyName == GlobalObject.propName_System);
|
||||
var cableSystem = cableSystemObj == null ? "" : systems.FirstOrDefault(x => x.DataItemName == cableSystemObj.PropertyValue)?.DataItemDetailID;
|
||||
if (cableSystem != null)
|
||||
string systemNameAfterDealWith = string.Empty;
|
||||
var cableSystem =string.Empty;
|
||||
var topDataItemDetailIDofDwg = string.Empty;
|
||||
var topDataItemDetailIDofEng = string.Empty;
|
||||
if (cableSystemObj != null)
|
||||
{
|
||||
if (dwgObj.DrawingSystem == cableSystem && !string.IsNullOrEmpty(dwgObj.DrawingSystem))
|
||||
int index = cableSystemObj.PropertyValue.IndexOf("||");
|
||||
systemNameAfterDealWith = index >= 0 ? cableSystemObj.PropertyValue.Substring(0, index) : cableSystemObj.PropertyValue;
|
||||
cableSystem = systems.FirstOrDefault(x => x.DataItemName == systemNameAfterDealWith)?.DataItemDetailID;
|
||||
//获取图纸系统的最上级ID
|
||||
topDataItemDetailIDofDwg = GetTopParentDataItemDetailByID(dataitemdetailTableName, dwgObj.DrawingSystem);
|
||||
//获取位号系统的最上级ID
|
||||
topDataItemDetailIDofEng= GetTopParentDataItemDetailByID(dataitemdetailTableName, cableSystem);
|
||||
if (topDataItemDetailIDofDwg == topDataItemDetailIDofEng && !string.IsNullOrEmpty(dwgObj.DrawingSystem))
|
||||
{
|
||||
//可以修改
|
||||
}
|
||||
else if (string.IsNullOrEmpty(cableSystem))
|
||||
else if (string.IsNullOrEmpty(topDataItemDetailIDofEng))
|
||||
{
|
||||
//不可以
|
||||
allowPropertyModify = false;
|
||||
@ -1606,6 +1617,12 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
||||
|
||||
}
|
||||
}
|
||||
//var cableSystem = cableSystemObj == null ? "" : systems.FirstOrDefault(x => x.DataItemName == cableSystemObj.PropertyValue)?.DataItemDetailID;
|
||||
//if (cableSystem != null)
|
||||
//{
|
||||
|
||||
|
||||
//}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2412,6 +2429,38 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
||||
return current.DataItemName;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 找到最上级的DataItemDetailID
|
||||
/// </summary>
|
||||
/// <param name="DtatTableName">表名</param>
|
||||
/// <param name="strDataItemName">当前的DataItemName</param>
|
||||
/// <returns>最上层的Name</returns>
|
||||
public string GetTopParentDataItemDetailByID(string DtatTableName, string strDataItemDetailID)
|
||||
{
|
||||
// 先找到初始节点
|
||||
var current = Db.Queryable<ec_dataitemdetailEntity>().AS(DtatTableName).Where(x => x.DataItemDetailID == strDataItemDetailID).First();
|
||||
|
||||
// 如果找不到,直接返回 null
|
||||
if (current == null)
|
||||
return null;
|
||||
|
||||
// 循环向上查找
|
||||
while (current.UpDataItemDetailID != "0")
|
||||
{
|
||||
// upDataItemDetailID是上级节点的DataItemDetailID
|
||||
var parent = Db.Queryable<ec_dataitemdetailEntity>().AS(DtatTableName).Where(x => x.DataItemDetailID == current.UpDataItemDetailID).First();
|
||||
|
||||
// 如果找不到就返回 null(防止死循环)
|
||||
if (parent == null)
|
||||
return null;
|
||||
|
||||
current = parent;
|
||||
}
|
||||
|
||||
// 返回最上层的 DataItemDetailID(也就是 0对应的ID)
|
||||
return current.DataItemDetailID;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 过滤掉与图纸系统最上层不一致的 EngineDataID
|
||||
/// </summary>
|
||||
@ -2583,5 +2632,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user