修改了BOM接口的分组条件

This commit is contained in:
xingheng 2025-09-03 15:15:24 +08:00
parent 1242b32386
commit 26e699c05e

View File

@ -88,7 +88,11 @@ namespace Learun.Application.Web.AppApi
TagNumber = tag.TagNumber,
Group = GroupName,// 如 A-B1,A-B2,
vendor = allProp.FirstOrDefault(x => x.EngineDataID == tag.EngineDataID && x.PropertyName == "厂商")?.PropertyValue ?? "",
Spec = allProp.FirstOrDefault(x => x.EngineDataID == tag.EngineDataID && x.PropertyName == "设备型号")?.PropertyValue ?? "",
Model = allProp.FirstOrDefault(x => x.EngineDataID == tag.EngineDataID && x.PropertyName == "设备型号")?.PropertyValue ?? "",
Volt = allProp.FirstOrDefault(x => x.EngineDataID == tag.EngineDataID && x.PropertyName == "电制")?.PropertyValue ?? "",
RatingPower = allProp.FirstOrDefault(x => x.EngineDataID == tag.EngineDataID && x.PropertyName == "额定功率")?.PropertyValue ?? "",
IPLevel = allProp.FirstOrDefault(x => x.EngineDataID == tag.EngineDataID && x.PropertyName == "IP等级")?.PropertyValue ?? "",
ExplosionProofLevel = allProp.FirstOrDefault(x => x.EngineDataID == tag.EngineDataID && x.PropertyName == "防爆等级")?.PropertyValue ?? "",
Name = "",
Seq = seq
};
@ -106,7 +110,18 @@ namespace Learun.Application.Web.AppApi
}
var groups = TagsInBOM.GroupBy(x => new { x.objectTypeId, x.Group, x.vendor, x.Spec, x.Name }).ToList();
var groups = TagsInBOM.GroupBy(x => new
{
x.objectTypeId,
x.Group,
x.vendor,
x.Model,
x.Volt,
x.IPLevel,
x.RatingPower,
x.ExplosionProofLevel,
x.Name
}).ToList();
#endregion
foreach (var group in groups)
{
@ -141,14 +156,15 @@ namespace Learun.Application.Web.AppApi
#endregion
var typeInfo = allType.FirstOrDefault(x => x.ObjectTypeID == group.Key.objectTypeId);
var specCombine = $"{group.Key.Volt} {group.Key.RatingPower} {group.Key.IPLevel} {group.Key.ExplosionProofLevel}";
var BOMGroupInfo = new BOMGroupInfo
{
upper_text = upper_text_Part1 + upper_text_Part2,
lower_text = GroupName.Split('-')[0],//A
Count = group.Count(),
Remark = group.Key.vendor,
Spec = group.Key.Spec,
Model = group.Key.Model,
Spec = specCombine,
FileId = GetSymbolForBOM(typeInfo, allLib)
};
@ -232,15 +248,40 @@ namespace Learun.Application.Web.AppApi
{
public string objectTypeId { set; get; }
public string TagNumber { set; get; }
/// <summary>
/// 去除数字后的内容大概率是A-B。A为systemB为tag
/// </summary>
public string Group { set; get; }
/// <summary>
/// 正常情况下 Group + Seq = TagNumber
/// </summary>
public string Seq { set; get; }
public string vendor { set; get; }
public string Spec { set; get; }
/// <summary>
/// 中文名称
/// 厂商,对应<see cref="BOMGroupInfo.Remark"/>
/// </summary>
public string vendor { set; get; }
/// <summary>
/// 设备型号,对应<see cref="BOMGroupInfo.Model"/>
/// </summary>
public string Model { set; get; }
/// <summary>
/// 电制
/// </summary>
public string Volt { set; get; }
/// <summary>
/// 额定功率
/// </summary>
public string RatingPower { set; get; }
/// <summary>
/// ip等级
/// </summary>
public string IPLevel { set; get; }
/// <summary>
/// 防爆等级
/// </summary>
public string ExplosionProofLevel { set; get; }
/// <summary>
/// 中文名称(针对某些特殊类型的分组需要用到)
/// </summary>
public string Name { set; get; }
}
@ -252,10 +293,24 @@ namespace Learun.Application.Web.AppApi
/// 每一行用的symbol是什么
/// </summary>
public string FileId { set; get; }
/// <summary>
/// 个数
/// </summary>
public int Count { set; get; }
/// <summary>
/// 备注(由 厂商)
/// </summary>
public string Remark { set; get; }
/// <summary>
/// 规格(由 电制 额定功率 ip等级 防爆等级等属性拼接而成)
/// </summary>
public string Spec { set; get; }
/// <summary>
/// 型号
/// </summary>
public string Model { set; get; }
}
}