2023-10-15
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
@@ -15,6 +16,14 @@ namespace BLL
|
||||
return Funs.DB.Base_DNCompare.FirstOrDefault(e => e.DNCompareId == dNCompareId);
|
||||
}
|
||||
|
||||
public static Model.Base_DNCompare GetDNCompareByDN(int DN)
|
||||
{
|
||||
return Funs.DB.Base_DNCompare.FirstOrDefault(e => e.DN == DN);
|
||||
}
|
||||
public static Model.Base_DNCompare GetDNCompareByOutSizeDia(decimal OutSizeDia)
|
||||
{
|
||||
return Funs.DB.Base_DNCompare.FirstOrDefault(e => e.OutSizeDia == OutSizeDia);
|
||||
}
|
||||
/// <summary>
|
||||
/// 增加直径寸径对照信息
|
||||
/// </summary>
|
||||
@@ -28,8 +37,8 @@ namespace BLL
|
||||
DN = dNCompare.DN,
|
||||
PipeSize = dNCompare.PipeSize,
|
||||
OutSizeDia = dNCompare.OutSizeDia,
|
||||
Sch5S = dNCompare.Sch5S,
|
||||
Sch10S = dNCompare.Sch10S,
|
||||
SCH5S = dNCompare.SCH5S,
|
||||
SCH10S = dNCompare.SCH10S,
|
||||
SCH10 = dNCompare.SCH10,
|
||||
SCH20 = dNCompare.SCH20,
|
||||
SCH30 = dNCompare.SCH30,
|
||||
@@ -72,8 +81,8 @@ namespace BLL
|
||||
newDNCompare.DN = dNCompare.DN;
|
||||
newDNCompare.PipeSize = dNCompare.PipeSize;
|
||||
newDNCompare.OutSizeDia = dNCompare.OutSizeDia;
|
||||
newDNCompare.Sch5S = dNCompare.Sch5S;
|
||||
newDNCompare.Sch10S = dNCompare.Sch10S;
|
||||
newDNCompare.SCH5S = dNCompare.SCH5S;
|
||||
newDNCompare.SCH10S = dNCompare.SCH10S;
|
||||
newDNCompare.SCH10 = dNCompare.SCH10;
|
||||
newDNCompare.SCH20 = dNCompare.SCH20;
|
||||
newDNCompare.SCH30 = dNCompare.SCH30;
|
||||
@@ -130,6 +139,57 @@ namespace BLL
|
||||
return list;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据DN直径获取壁厚
|
||||
/// </summary>
|
||||
/// <param name="DN"></param>
|
||||
/// <param name="sch"></param>
|
||||
/// <returns></returns>
|
||||
public static decimal? GetThicknessByDNDia(int DN,string sch)
|
||||
{
|
||||
decimal result = 0;
|
||||
var q = GetDNCompareByDN(DN);
|
||||
if (q!=null)
|
||||
{
|
||||
var diaProperty = q.GetType().GetProperty(sch);
|
||||
diaProperty = (diaProperty == null ? q.GetType().GetProperty(sch.Replace("Sch", "SCH")) : diaProperty);
|
||||
|
||||
if (diaProperty != null)
|
||||
{
|
||||
var diaValue = diaProperty.GetValue(q);
|
||||
|
||||
result = Funs.GetNewDecimalOrZero(diaValue?.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
/// <summary>
|
||||
/// 根据外径获取壁厚
|
||||
/// </summary>
|
||||
/// <param name="Dia"></param>
|
||||
/// <param name="sch"></param>
|
||||
/// <returns></returns>
|
||||
public static decimal? GetThicknessByDia(decimal? Dia, string sch)
|
||||
{
|
||||
decimal result = 0;
|
||||
sch = sch.Replace("", "");
|
||||
var q = GetDNCompareByOutSizeDia((decimal)Dia);
|
||||
if (q != null)
|
||||
{
|
||||
var diaProperty = q.GetType().GetProperty(sch);
|
||||
diaProperty = (diaProperty == null ? q.GetType().GetProperty(sch.Replace("Sch", "SCH")) : diaProperty);
|
||||
if (diaProperty != null)
|
||||
{
|
||||
var diaValue = diaProperty.GetValue(q);
|
||||
|
||||
result = Funs.GetNewDecimalOrZero(diaValue?.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static decimal? GetSizeByDia(decimal dia)
|
||||
{
|
||||
var q = Funs.DB.Base_DNCompare.FirstOrDefault(x => x.OutSizeDia == dia);
|
||||
|
||||
Reference in New Issue
Block a user