This commit is contained in:
xingheng 2025-09-26 11:04:11 +08:00
commit b84f7d9d0f
3 changed files with 55 additions and 13 deletions

View File

@ -61,6 +61,12 @@ namespace Learun.Application.Web.AppApi
{
return Fail("项目数据字典中,没有找到【肋位号】的下拉项中。");// 或者 无法从数据字典中找到对应的那个下拉
}
ec_dataitemBLL ec_DataitemBLL = new ec_dataitemBLL();
var roomLists = ec_DataitemBLL.GetDetailList("RoomNo", "", ProjectId, false);
if (roomLists == null)
{
return Fail("项目数据字典中,没有找到【房间号】的下拉项中。");// 或者 无法从数据字典中找到对应的那个下拉
}
#endregion
@ -85,10 +91,17 @@ namespace Learun.Application.Web.AppApi
{
Prop_Frame = Prop_Frame.Split(new string[] { GlobalObject.enum_separator }, StringSplitOptions.None)[0];//插件端对于下拉列表 都是 name || nameEN
}
var Prop_Room = tagProps.FirstOrDefault(x => x.PropertyName == GlobalObject.propName_Room)?.PropertyValue;
if (Prop_Room != null)
{
Prop_Room = Prop_Room.Split(new string[] { GlobalObject.enum_separator }, StringSplitOptions.None)[0];//插件端对于下拉列表 都是 name || nameEN
}
var matchedFrame = frameLists.FirstOrDefault(X => X.Num == Prop_Frame);
if (matchedFrame == null)
var matchedRoom = roomLists.FirstOrDefault(X => X.DataItemName == Prop_Room);
if (matchedFrame == null && matchedRoom == null)
{
//没有
//无效的基点
@ -104,12 +117,22 @@ namespace Learun.Application.Web.AppApi
res.Add(layoutTagInvalid);
continue;
}
var xValue = frameLists.FirstOrDefault(X => X.Num == Prop_Frame).Value;
if (xValue < 400)
double xValue = 0 ;
if (matchedFrame != null)
{
// 小于400我几乎可以认为此时肋位号用的是m这个单位。因为如果用的是mm400mm的肋位号似乎也太小了。
xValue = 1000 * xValue; // 转成mm
xValue = frameLists.FirstOrDefault(X => X.Num == Prop_Frame).Value;
if (xValue < 400)
{
// 小于400我几乎可以认为此时肋位号用的是m这个单位。因为如果用的是mm400mm的肋位号似乎也太小了。
xValue = 1000 * xValue; // 转成mm
}
}
string strRoom = string.Empty;
if (matchedRoom != null)
{
strRoom = matchedRoom.DataItemName;
}
var Prop_FrameOff = tagProps.FirstOrDefault(x => x.PropertyName == GlobalObject.propName_FrameOff)?.PropertyValue;
var Prop_YOff = tagProps.FirstOrDefault(x => x.PropertyName == GlobalObject.propName_YOff)?.PropertyValue;
var DECK = tagProps.FirstOrDefault(x => x.PropertyName == "甲板号")?.PropertyValue;
@ -128,7 +151,8 @@ namespace Learun.Application.Web.AppApi
YOff = Prop_YOff,
deck = DECK,
area = AREA,
Scale = BasePointProp_scale == null ? 1 : (double.TryParse(BasePointProp_scale.PropertyValue, out double scale) ? scale : 1)
Scale = BasePointProp_scale == null ? 1 : (double.TryParse(BasePointProp_scale.PropertyValue, out double scale) ? scale : 1),
RoomNo = strRoom
};
layoutTag.Scale = 1.0 / layoutTag.Scale; // 这里的比例是放大多少倍,所以取倒数。
@ -195,8 +219,14 @@ namespace Learun.Application.Web.AppApi
{
Prop_Frame = Prop_Frame.Split(new string[] { GlobalObject.enum_separator }, StringSplitOptions.None)[0];//插件端对于下拉列表 都是 name || nameEN
}
var Prop_RoomNo = tagProps.FirstOrDefault(x => x.PropertyName == GlobalObject.propName_Room)?.PropertyValue;
if (Prop_RoomNo != null)
{
Prop_RoomNo = Prop_RoomNo.Split(new string[] { GlobalObject.enum_separator }, StringSplitOptions.None)[0];//插件端对于下拉列表 都是 name || nameEN
}
var matchedFrame = frameLists.FirstOrDefault(X => X.Num == Prop_Frame);
if (matchedFrame == null)
var matchedRoom = roomLists.FirstOrDefault(x => x.DataItemName == Prop_RoomNo);
if (matchedFrame == null && matchedRoom == null)
{
var layoutTagInfoInvalid = new layoutTagInfoBrief()
{
@ -208,11 +238,20 @@ namespace Learun.Application.Web.AppApi
basePoint.Tags.Add(layoutTagInfoInvalid);
continue;
}
var xValue = frameLists.FirstOrDefault(X => X.Num == Prop_Frame).Value;
if (xValue < 400)
double xValue = 0;
if (matchedFrame != null)
{
// 小于400我几乎可以认为此时肋位号用的是m这个单位。因为如果用的是mm400mm的肋位号似乎也太小了。
xValue = 1000 * xValue; // 转成mm
xValue = frameLists.FirstOrDefault(X => X.Num == Prop_Frame).Value;
if (xValue < 400)
{
// 小于400我几乎可以认为此时肋位号用的是m这个单位。因为如果用的是mm400mm的肋位号似乎也太小了。
xValue = 1000 * xValue; // 转成mm
}
}
string strRoom = string.Empty;
if (matchedRoom != null)
{
strRoom = matchedRoom.DataItemName;
}
var Prop_FrameOff = tagProps.FirstOrDefault(x => x.PropertyName == GlobalObject.propName_FrameOff)?.PropertyValue;
var Prop_YOff = tagProps.FirstOrDefault(x => x.PropertyName == GlobalObject.propName_YOff)?.PropertyValue;
@ -309,7 +348,8 @@ namespace Learun.Application.Web.AppApi
YOff = Prop_YOff,
deck = basePoint.deck,
area = basePoint.area,
Scale = basePoint.Scale
Scale = basePoint.Scale,
RoomNo = strRoom
};
basePoint.Tags.Add(layoutTagInfo);
}

View File

@ -80,6 +80,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
public const string propName_FrameOff = "肋位号偏移量(mm)";
public const string propName_YOff = "纵骨偏移量(mm)";
public const string propName_TagNumber = "TagNumber";
public const string propName_Room = "房间号";
#endregion
#region projSetting

View File

@ -59,9 +59,10 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
/// 基点从属的、或者说附近的设备位号
/// </summary>
public List<layoutTagInfoBrief> Tags { get; set; } = new List<layoutTagInfoBrief>();
public string RoomNo { get; set; }
#endregion
}
}