Merge branch 'master' of http://47.104.102.122:3000/panhf/CNCEC_SUBQHSE_WUHUAN
This commit is contained in:
@@ -594,6 +594,7 @@
|
||||
<Compile Include="HSSE\Technique\SpecialSchemeService.cs" />
|
||||
<Compile Include="HSSE\Technique\Technique_CheckItemDetailService.cs" />
|
||||
<Compile Include="HSSE\Technique\Technique_CheckItemSetService.cs" />
|
||||
<Compile Include="IDP\IDPPreRunDataService.cs" />
|
||||
<Compile Include="IDP\IDPDataService.cs" />
|
||||
<Compile Include="JDGL\Check\ElectricalCompletionService.cs" />
|
||||
<Compile Include="JDGL\Check\EquipmentCompletionService.cs" />
|
||||
|
||||
+658
-113
@@ -9,9 +9,11 @@ using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
@@ -30,105 +32,607 @@ namespace BLL
|
||||
//private static readonly string IDPApiUrl = "https://idp.cwcec.com/";
|
||||
private static readonly string IDPApiUrl = SysConstSetService.WuHuanIDPPath;
|
||||
|
||||
#region 接口授权认证
|
||||
#region 试车工作包
|
||||
|
||||
#region 管道一览表
|
||||
|
||||
/// <summary>
|
||||
/// 加密公钥
|
||||
/// 项目试车工作包——管道一览表
|
||||
/// </summary>
|
||||
private static readonly string publicKey = "<RSAKeyValue><Modulus>g1sk7Xtc1TJouHdY4+FAe5atGCu2n17NhoKVDV57pki1IL+9+S7BY4gxAjmMkUU2/cbCCdbPoUJLBrCBCjX7yI3UJW6FZwQWkn3kVoeulLEwdPCIq/GUjMXaWf3Iaaad5wBUFbfXAzv15VN6z48Nt1IY/O8YEzhIpuZdtEgDdos=</Modulus><Exponent>AQAB</Exponent></RSAKeyValue>";
|
||||
//private static readonly string publicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQChnc2YD0YzJPx6QTh+/n7XzjR1ugFzrsmPolJhpCfWMKrSGbT7iX/Kgcm1AI+T95K4Jzv3KS42QTecZ1ziJ4Rr9Luzw+9ZCSjMZgrmAUbY5IeBaA6GzaSk8UWHZ4n5PL+GUGq+2f+COL7+KCS2AxEpaqDZVrJrIfg/UektdgNyzwIDAQAB";
|
||||
|
||||
/// <summary>
|
||||
/// 第三方加密认证接口
|
||||
/// </summary>
|
||||
/// 五环IDP系统SessionId有效期30分钟
|
||||
/// <returns></returns>
|
||||
public static SessionItem GetAuthenticationSession()
|
||||
/// <param name="session">session</param>
|
||||
/// <param name="projectId">项目Id</param>
|
||||
public static string GetIDPProjectPreRunDataPiping(SessionItem session, string projectId)
|
||||
{
|
||||
SessionItem session = new SessionItem();
|
||||
try
|
||||
string result = string.Empty;
|
||||
if (string.IsNullOrWhiteSpace(projectId))
|
||||
{
|
||||
//// 创建RSA加密服务提供者
|
||||
////using (RSA rsa = RSA.Create())
|
||||
//using (RSACryptoServiceProvider rsa = new RSACryptoServiceProvider())
|
||||
//{
|
||||
//// 获取公钥false表示只导出公钥
|
||||
//string publicKey = rsa.ToXmlString(false);
|
||||
//// 获取私钥true表示导出公钥和私钥
|
||||
//string privateKey = rsa.ToXmlString(true);
|
||||
result = "请传项目Id";
|
||||
}
|
||||
else
|
||||
{
|
||||
var project = BLL.ProjectService.GetProjectByProjectId(projectId);
|
||||
var mainProjects = BLL.PMPDataService.GetPMPProjectListByCode(project.ProjectCode);
|
||||
|
||||
|
||||
////用户名加密
|
||||
//string encryptedUsername = EncryptData("dataviewer", publicKey);
|
||||
////密码加密
|
||||
//string encryptedPassword = EncryptData("a3365$!", publicKey);
|
||||
|
||||
//用户名加密后的密文
|
||||
string encryptedUsername = "k0N0tx/hfRPY0v2lq1G8eH6hCO+UiMqlSZi1PD6bhGf4YpP/koJq5hfMsDSzdn3dZjzExrwyrjFWp/1jZLde0+gRbQ0D7tzm0R5D6AmriodD2cJvrEiwtDy7SeGNloSaNmpTEMuycpuueiOeGhMkKnTwWfRkEw73lxEpTmaahq4=";
|
||||
//密码加密后的密文
|
||||
string encryptedPassword = "HLLroiNJJzyTWJt9td1xgChbVzyQkoxWCGGXqdwI2cvlUF/A30FAPaInszSwEhNRQlJZZ01EODElemkgv36DMF+XGwfDi0BfIq9jKG+/+wq0TVOHNhiu2NPzpn5Ji2X3yXIXpH1zv6XEtkvx/qiLToZYfRQCufsl5vH1cZxk2fQ=";
|
||||
|
||||
string url = $"{IDPApiUrl}UAMS/authEncrypt";
|
||||
//string url = $"http://10.5.6.151:8100/UAMS/authEncrypt";
|
||||
string contenttype = "application/json;charset=utf-8";
|
||||
var body = new
|
||||
List<string> idpPipingIds = IDPPreRunDataService.GetIDPPreRunDataPipingIds(projectId);
|
||||
List<IDP_PreRunData_Piping> addItems = new List<IDP_PreRunData_Piping>();
|
||||
List<IDP_PreRunData_Piping> modifyItems = new List<IDP_PreRunData_Piping>();
|
||||
int all = 0;
|
||||
foreach (var pro in mainProjects)
|
||||
{
|
||||
encryptedUsername = encryptedUsername,
|
||||
encryptedPassword = encryptedPassword
|
||||
};
|
||||
string url = $"{IDPApiUrl}OSS/projects/{pro.Code}/workitems/CP2600/objects/latest";
|
||||
//string url = $"{IDPApiUrl}OSS/projects/100168/workitems/CP2600/objects/latest";
|
||||
|
||||
string pushContent = JsonConvert.SerializeObject(body);
|
||||
string strJosn = APIGetHttpService.Http(url, "POST", contenttype, null, pushContent);
|
||||
//string strJosn = HttpHelper.Post(url, null, pushContent);
|
||||
JObject obj = JObject.Parse(strJosn);
|
||||
if (!string.IsNullOrEmpty(strJosn))
|
||||
{
|
||||
string value = obj["value"].ToString();
|
||||
string name = obj["name"].ToString();
|
||||
session.value = value;
|
||||
session.name = name;
|
||||
try
|
||||
{
|
||||
//var session = GetAuthenticationSession();
|
||||
//ErrLogInfo.WriteLog($"Session——name:{session.name};value:{session.value}");
|
||||
Hashtable newToken = new Hashtable { { "Cookie", $"{session.name}={session.value}" } };
|
||||
var returndata = BLL.APIGetHttpService.OutsideHttp(url, "GET", null, newToken, null);
|
||||
if (!string.IsNullOrEmpty(returndata))
|
||||
{
|
||||
if (returndata.Contains("\"code\":404,\"message\":\"资源不存在\""))
|
||||
{
|
||||
result += $"失败!{returndata}|";
|
||||
}
|
||||
else if (returndata.Contains("\"status\":404,\"error\":\"Not Found\""))
|
||||
{
|
||||
result += $"失败!{returndata}|";
|
||||
}
|
||||
else
|
||||
{
|
||||
List<IDPPreRunPiping> responseDatas = IDPPreRunPiping.FromJson(returndata);
|
||||
all += responseDatas.Count();
|
||||
foreach (var item in responseDatas)
|
||||
{
|
||||
IDP_PreRunData_Piping newItem = new IDP_PreRunData_Piping();
|
||||
newItem.ItemId = item.ItemId;
|
||||
newItem.ProjId = pro.Code;//主数据项目Id
|
||||
newItem.ProjCode = pro.StNum;//主数据项目Code
|
||||
newItem.ProjectId = project.ProjectId;//智慧施工项目Id
|
||||
newItem.LastTime = DateTime.Now;//入库时间
|
||||
newItem.WbsCode = item.WbsCode;//装置工序主项码
|
||||
newItem.DeviceCode = item.DeviceCode;//装置码
|
||||
newItem.ProcessesCode = item.ProcessesCode;//工序码
|
||||
newItem.SubjectCode = item.SubjectCode;//主项码
|
||||
newItem.Category = item.Category;
|
||||
newItem.Category = item.Category;
|
||||
newItem.Tag = item.Tag;
|
||||
newItem.PipingCode = item.PipingCode;
|
||||
newItem.Diameter = item.Diameter;
|
||||
newItem.DiameterUnit = item.DiameterUnit;
|
||||
newItem.MaterialLevel = item.MaterialLevel;
|
||||
newItem.AdiabatType = item.AdiabatType;
|
||||
newItem.AdiabatThickness = item.AdiabatThickness;
|
||||
newItem.AdiabatThicknessUnit = item.AdiabatThicknessUnit;
|
||||
newItem.MediumState = item.MediumState;
|
||||
newItem.DrawingStartNo = item.DrawingStartNo;
|
||||
newItem.DrawingEndNo = item.DrawingEndNo;
|
||||
newItem.PipingStart = item.PipingStart;
|
||||
newItem.PipingEnd = item.PipingEnd;
|
||||
newItem.PipingLevel = item.PipingLevel;
|
||||
newItem.NormalTemperature = item.NormalTemperature;
|
||||
newItem.NormalTemperatureUnit = item.NormalTemperatureUnit;
|
||||
newItem.NormalPressure = item.NormalPressure;
|
||||
newItem.NormalPressureUnit = item.NormalPressureUnit;
|
||||
newItem.DesignTemperature = item.DesignTemperature;
|
||||
newItem.DesignTemperatureUnit = item.DesignTemperatureUnit;
|
||||
newItem.DesignPressure = item.DesignPressure;
|
||||
newItem.DesignPressureUnit = item.DesignPressureUnit;
|
||||
newItem.PaintLevel = item.PaintLevel;
|
||||
newItem.Remark = item.Remark;
|
||||
newItem.DetailInfo = JsonConvert.SerializeObject(item, Formatting.Indented);
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(item.ItemId) && idpPipingIds.Contains(item.ItemId))
|
||||
{//编辑
|
||||
modifyItems.Add(newItem);
|
||||
}
|
||||
else
|
||||
{//新增
|
||||
addItems.Add(newItem);
|
||||
idpPipingIds.Add(item.ItemId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
result = "失败!";
|
||||
}
|
||||
}
|
||||
catch (WebException ex)
|
||||
{
|
||||
result = $"程序异常:{ex.Message}";
|
||||
}
|
||||
}
|
||||
//}
|
||||
}
|
||||
catch (WebException ex)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
if (addItems.Any()) { AddIDPPreRunPiping(addItems); }
|
||||
if (modifyItems.Any()) { ModifyIDPPreRunPiping(modifyItems); }
|
||||
result = $"成功!总数:{all}条;新增:{addItems.Count()}条,维护:{(all - addItems.Count())}条";
|
||||
|
||||
}
|
||||
return session;
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加密字符串
|
||||
/// 批量插入数据
|
||||
/// </summary>
|
||||
/// <param name="data">加密信息</param>
|
||||
/// <param name="publicKey">公钥</param>
|
||||
/// <returns></returns>
|
||||
public static string EncryptData(string data, string publicKey)
|
||||
/// <param name="list"></param>
|
||||
public static void AddIDPPreRunPiping(List<Model.IDP_PreRunData_Piping> list)
|
||||
{
|
||||
using (RSACryptoServiceProvider rsa = new RSACryptoServiceProvider())
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
db.IDP_PreRunData_Piping.InsertAllOnSubmit(list);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新数据
|
||||
/// </summary>
|
||||
/// <param name="list"></param>
|
||||
public static void ModifyIDPPreRunPiping(List<Model.IDP_PreRunData_Piping> list)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
foreach (var obj in list)
|
||||
{
|
||||
string result = string.Empty;
|
||||
try
|
||||
IDP_PreRunData_Piping newItem = db.IDP_PreRunData_Piping.FirstOrDefault(x => x.ItemId == obj.ItemId);
|
||||
if (newItem != null)
|
||||
{
|
||||
rsa.FromXmlString(publicKey); //从字符串加载公钥
|
||||
byte[] dataBytes = Encoding.UTF8.GetBytes(data);
|
||||
byte[] encryptedBytes = rsa.Encrypt(dataBytes, false); //使用公钥加密数据,false表示使用OAEP填充方式
|
||||
result = Convert.ToBase64String(encryptedBytes); //返回Base64编码的加密数据
|
||||
newItem.ProjId = obj.ProjId;//主数据项目Id
|
||||
newItem.ProjCode = obj.ProjCode;//主数据项目Code
|
||||
newItem.ProjectId = obj.ProjectId;//智慧施工项目Id
|
||||
newItem.LastTime = DateTime.Now;//入库时间
|
||||
newItem.WbsCode = obj.WbsCode;//装置工序主项码
|
||||
newItem.DeviceCode = obj.DeviceCode;//装置码
|
||||
newItem.ProcessesCode = obj.ProcessesCode;//工序码
|
||||
newItem.SubjectCode = obj.SubjectCode;//主项码
|
||||
newItem.Category = obj.Category;
|
||||
newItem.Tag = obj.Tag;
|
||||
newItem.PipingCode = obj.PipingCode;
|
||||
newItem.Diameter = obj.Diameter;
|
||||
newItem.DiameterUnit = obj.DiameterUnit;
|
||||
newItem.MaterialLevel = obj.MaterialLevel;
|
||||
newItem.AdiabatType = obj.AdiabatType;
|
||||
newItem.AdiabatThickness = obj.AdiabatThickness;
|
||||
newItem.AdiabatThicknessUnit = obj.AdiabatThicknessUnit;
|
||||
newItem.MediumState = obj.MediumState;
|
||||
newItem.DrawingStartNo = obj.DrawingStartNo;
|
||||
newItem.DrawingEndNo = obj.DrawingEndNo;
|
||||
newItem.PipingStart = obj.PipingStart;
|
||||
newItem.PipingEnd = obj.PipingEnd;
|
||||
newItem.PipingLevel = obj.PipingLevel;
|
||||
newItem.NormalTemperature = obj.NormalTemperature;
|
||||
newItem.NormalTemperatureUnit = obj.NormalTemperatureUnit;
|
||||
newItem.NormalPressure = obj.NormalPressure;
|
||||
newItem.NormalPressureUnit = obj.NormalPressureUnit;
|
||||
newItem.DesignTemperature = obj.DesignTemperature;
|
||||
newItem.DesignTemperatureUnit = obj.DesignTemperatureUnit;
|
||||
newItem.DesignPressure = obj.DesignPressure;
|
||||
newItem.DesignPressureUnit = obj.DesignPressureUnit;
|
||||
newItem.PaintLevel = obj.PaintLevel;
|
||||
newItem.Remark = obj.Remark;
|
||||
newItem.DetailInfo = obj.DetailInfo;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("Error encrypting: {0}", ex.Message);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 设备一览表
|
||||
|
||||
/// <summary>
|
||||
/// 项目试车工作包——设备一览表
|
||||
/// </summary>
|
||||
/// <param name="session"></param>
|
||||
/// <param name="projectId"></param>
|
||||
public static string GetIDPProjectPreRunDataEquipment(SessionItem session, string projectId)
|
||||
{
|
||||
string result = string.Empty;
|
||||
if (string.IsNullOrWhiteSpace(projectId))
|
||||
{
|
||||
result = "请传项目Id";
|
||||
}
|
||||
else
|
||||
{
|
||||
var project = BLL.ProjectService.GetProjectByProjectId(projectId);
|
||||
var mainProjects = BLL.PMPDataService.GetPMPProjectListByCode(project.ProjectCode);
|
||||
|
||||
List<string> idpEquipmentIds = IDPPreRunDataService.GetIDPPreRunDataEquipmentIds(projectId);
|
||||
List<IDP_PreRunData_Equipment> addItems = new List<IDP_PreRunData_Equipment>();
|
||||
List<IDP_PreRunData_Equipment> modifyItems = new List<IDP_PreRunData_Equipment>();
|
||||
int all = 0;
|
||||
foreach (var pro in mainProjects)
|
||||
{
|
||||
string url = $"{IDPApiUrl}OSS/projects/{pro.Code}/workitems/CP2100/objects/latest";
|
||||
//string url = $"{IDPApiUrl}OSS/projects/100168/workitems/CP2100/objects/latest";
|
||||
try
|
||||
{
|
||||
Hashtable newToken = new Hashtable { { "Cookie", $"{session.name}={session.value}" } };
|
||||
var returndata = BLL.APIGetHttpService.OutsideHttp(url, "GET", null, newToken, null);
|
||||
if (!string.IsNullOrEmpty(returndata))
|
||||
{
|
||||
if (returndata.Contains("\"code\":404,\"message\":\"资源不存在\""))
|
||||
{
|
||||
result += $"失败!{returndata}|";
|
||||
}
|
||||
else if (returndata.Contains("\"status\":404,\"error\":\"Not Found\""))
|
||||
{
|
||||
result += $"失败!{returndata}|";
|
||||
}
|
||||
else
|
||||
{
|
||||
List<IDPPreRunEquipment> responseDatas = IDPPreRunEquipment.FromJson(returndata);
|
||||
all += responseDatas.Count();
|
||||
foreach (var item in responseDatas)
|
||||
{
|
||||
Type type = typeof(IDPPreRunEquipment);
|
||||
|
||||
IDP_PreRunData_Equipment newItem = new IDP_PreRunData_Equipment();
|
||||
newItem.ItemId = item.ItemId;
|
||||
newItem.ProjId = pro.Code;//主数据项目Id
|
||||
newItem.ProjCode = pro.StNum;//主数据项目Code
|
||||
newItem.ProjectId = project.ProjectId;//智慧施工项目Id
|
||||
newItem.LastTime = DateTime.Now;//入库时间
|
||||
newItem.WbsCode = item.WbsCode;//装置工序主项码
|
||||
newItem.DeviceCode = item.DeviceCode;//装置码
|
||||
newItem.ProcessesCode = item.ProcessesCode;//工序码
|
||||
newItem.SubjectCode = item.SubjectCode;//主项码
|
||||
newItem.Category = item.Category;
|
||||
newItem.Tag = item.Tag;
|
||||
newItem.TagNumber = item.TagNumber;
|
||||
string nameSpecifications = !string.IsNullOrWhiteSpace(item.NameSpecifications)? $"{item.NameSpecifications}。":string.Empty;
|
||||
if (!string.IsNullOrWhiteSpace(item.DrivingType))
|
||||
{
|
||||
nameSpecifications = $"{nameSpecifications} {type.GetProperty("DrivingType").GetCustomAttribute<JsonPropertyAttribute>().PropertyName}:{item.DrivingType};";
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(item.EquipmentType))
|
||||
{
|
||||
nameSpecifications = $"{nameSpecifications} {type.GetProperty("EquipmentType").GetCustomAttribute<JsonPropertyAttribute>().PropertyName}:{item.EquipmentType};";
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(item.EquipmentTypeModel))
|
||||
{
|
||||
nameSpecifications = $"{nameSpecifications} {type.GetProperty("EquipmentTypeModel").GetCustomAttribute<JsonPropertyAttribute>().PropertyName}:{item.EquipmentTypeModel};";
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(item.EquipmentForm))
|
||||
{
|
||||
nameSpecifications = $"{nameSpecifications} {type.GetProperty("EquipmentForm").GetCustomAttribute<JsonPropertyAttribute>().PropertyName}:{item.EquipmentForm};";
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(item.MPaG))
|
||||
{
|
||||
nameSpecifications = $"{nameSpecifications} {type.GetProperty("MPaG").GetCustomAttribute<JsonPropertyAttribute>().PropertyName}:{item.MPaG} {item.MPaGUnit};";
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(item.KPa))
|
||||
{
|
||||
nameSpecifications = $"{nameSpecifications} {type.GetProperty("KPa").GetCustomAttribute<JsonPropertyAttribute>().PropertyName}:{item.KPa} {item.KPaUnit};";
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(item.DimensionsID))
|
||||
{
|
||||
nameSpecifications = $"{nameSpecifications} {type.GetProperty("DimensionsID").GetCustomAttribute<JsonPropertyAttribute>().PropertyName}:{item.DimensionsID} {item.DimensionsIDUnit};";
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(item.DimensionsHTT))
|
||||
{
|
||||
nameSpecifications = $"{nameSpecifications} {type.GetProperty("DimensionsHTT").GetCustomAttribute<JsonPropertyAttribute>().PropertyName}:{item.DimensionsHTT} {item.DimensionsHTTUnit};";
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(item.DesignFlow))
|
||||
{
|
||||
nameSpecifications = $"{nameSpecifications} {type.GetProperty("DesignFlow").GetCustomAttribute<JsonPropertyAttribute>().PropertyName}:{item.DesignFlow} {item.DesignFlowUnit};";
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(item.ShaftPower))
|
||||
{
|
||||
nameSpecifications = $"{nameSpecifications} {type.GetProperty("ShaftPower").GetCustomAttribute<JsonPropertyAttribute>().PropertyName}:{item.ShaftPower} {item.ShaftPowerUnit};";
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(item.RatedPower))
|
||||
{
|
||||
nameSpecifications = $"{nameSpecifications} {type.GetProperty("RatedPower").GetCustomAttribute<JsonPropertyAttribute>().PropertyName}:{item.RatedPower} {item.RatedPowerUnit};";
|
||||
}
|
||||
string materials = string.Empty;
|
||||
if (!string.IsNullOrWhiteSpace(item.Materials))
|
||||
{
|
||||
materials = $"{type.GetProperty("Materials").GetCustomAttribute<JsonPropertyAttribute>().PropertyName}:{item.Materials};";
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(item.ImpellerMaterial))
|
||||
{
|
||||
materials = $"{materials} {type.GetProperty("ImpellerMaterial").GetCustomAttribute<JsonPropertyAttribute>().PropertyName}:{item.ImpellerMaterial};";
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(item.ShellMaterial))
|
||||
{
|
||||
materials = $"{materials} {type.GetProperty("ShellMaterial").GetCustomAttribute<JsonPropertyAttribute>().PropertyName}:{item.ShellMaterial};";
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(item.CylinderMaterial))
|
||||
{
|
||||
materials = $"{materials} {type.GetProperty("CylinderMaterial").GetCustomAttribute<JsonPropertyAttribute>().PropertyName}:{item.CylinderMaterial};";
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(item.TrayMaterial))
|
||||
{
|
||||
materials = $"{materials} {type.GetProperty("TrayMaterial").GetCustomAttribute<JsonPropertyAttribute>().PropertyName}:{item.TrayMaterial};";
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(item.PackingMaterial))
|
||||
{
|
||||
materials = $"{materials} {type.GetProperty("PackingMaterial").GetCustomAttribute<JsonPropertyAttribute>().PropertyName}:{item.PackingMaterial};";
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(item.PlateMaterial))
|
||||
{
|
||||
materials = $"{materials} {type.GetProperty("PlateMaterial").GetCustomAttribute<JsonPropertyAttribute>().PropertyName}:{item.PlateMaterial};";
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(item.TrimMaterial))
|
||||
{
|
||||
materials = $"{materials} {type.GetProperty("TrimMaterial").GetCustomAttribute<JsonPropertyAttribute>().PropertyName}:{item.TrimMaterial};";
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(item.CoilMaterial))
|
||||
{
|
||||
materials = $"{materials} {type.GetProperty("CoilMaterial").GetCustomAttribute<JsonPropertyAttribute>().PropertyName}:{item.CoilMaterial};";
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(item.PreheaterMaterial))
|
||||
{
|
||||
materials = $"{materials} {type.GetProperty("PreheaterMaterial").GetCustomAttribute<JsonPropertyAttribute>().PropertyName}:{item.PreheaterMaterial};";
|
||||
}
|
||||
newItem.NameSpecifications = nameSpecifications;
|
||||
newItem.Materials = materials;
|
||||
newItem.NumOperate = item.DeviceNum;
|
||||
newItem.WeightSingle = item.WeightSingle;
|
||||
newItem.WeightSingleUnit = item.WeightSingleUnit;
|
||||
newItem.Remark = item.Remark;
|
||||
newItem.DetailInfo = JsonConvert.SerializeObject(item, Formatting.Indented);
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(item.ItemId) && idpEquipmentIds.Contains(item.ItemId))
|
||||
{//编辑
|
||||
modifyItems.Add(newItem);
|
||||
}
|
||||
else
|
||||
{//新增
|
||||
addItems.Add(newItem);
|
||||
idpEquipmentIds.Add(item.ItemId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
result = "失败!";
|
||||
}
|
||||
}
|
||||
catch (WebException ex)
|
||||
{
|
||||
result = $"程序异常:{ex.Message}";
|
||||
}
|
||||
}
|
||||
|
||||
if (addItems.Any()) { AddIDPPreRunEquipment(addItems); }
|
||||
if (modifyItems.Any()) { ModifyIDPPreRunEquipment(modifyItems); }
|
||||
result = $"成功!总数:{all}条;新增:{addItems.Count()}条,维护:{(all - addItems.Count())}条";
|
||||
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 批量插入数据
|
||||
/// </summary>
|
||||
/// <param name="list"></param>
|
||||
public static void AddIDPPreRunEquipment(List<Model.IDP_PreRunData_Equipment> list)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
db.IDP_PreRunData_Equipment.InsertAllOnSubmit(list);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新数据
|
||||
/// </summary>
|
||||
/// <param name="list"></param>
|
||||
public static void ModifyIDPPreRunEquipment(List<Model.IDP_PreRunData_Equipment> list)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
foreach (var obj in list)
|
||||
{
|
||||
IDP_PreRunData_Equipment newItem = db.IDP_PreRunData_Equipment.FirstOrDefault(x => x.ItemId == obj.ItemId);
|
||||
if (newItem != null)
|
||||
{
|
||||
newItem.ProjId = obj.ProjId;//主数据项目Id
|
||||
newItem.ProjCode = obj.ProjCode;//主数据项目Code
|
||||
newItem.ProjectId = obj.ProjectId;//智慧施工项目Id
|
||||
newItem.LastTime = DateTime.Now;//入库时间
|
||||
newItem.WbsCode = obj.WbsCode;//装置工序主项码
|
||||
newItem.DeviceCode = obj.DeviceCode;//装置码
|
||||
newItem.ProcessesCode = obj.ProcessesCode;//工序码
|
||||
newItem.SubjectCode = obj.SubjectCode;//主项码
|
||||
newItem.Category = obj.Category;
|
||||
newItem.Tag = obj.Tag;
|
||||
newItem.TagNumber = obj.TagNumber;
|
||||
newItem.NameSpecifications = obj.NameSpecifications;
|
||||
newItem.Materials = obj.Materials;
|
||||
newItem.WeightSingle = obj.WeightSingle;
|
||||
newItem.WeightSingleUnit = obj.WeightSingleUnit;
|
||||
newItem.Remark = obj.Remark;
|
||||
newItem.DetailInfo = obj.DetailInfo;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 仪表索引
|
||||
|
||||
/// <summary>
|
||||
/// 项目试车工作包——仪表索引
|
||||
/// </summary>
|
||||
/// <param name="session"></param>
|
||||
/// <param name="projectId"></param>
|
||||
public static string GetIDPProjectPreRunDataInstrumentation(SessionItem session, string projectId)
|
||||
{
|
||||
string result = string.Empty;
|
||||
if (string.IsNullOrWhiteSpace(projectId))
|
||||
{
|
||||
result = "请传项目Id";
|
||||
}
|
||||
else
|
||||
{
|
||||
var project = BLL.ProjectService.GetProjectByProjectId(projectId);
|
||||
var mainProjects = BLL.PMPDataService.GetPMPProjectListByCode(project.ProjectCode);
|
||||
|
||||
List<string> idpInstrumentationIds = IDPPreRunDataService.GetIDPPreRunDataInstrumentationIds(projectId);
|
||||
List<IDP_PreRunData_Instrumentation> addItems = new List<IDP_PreRunData_Instrumentation>();
|
||||
List<IDP_PreRunData_Instrumentation> modifyItems = new List<IDP_PreRunData_Instrumentation>();
|
||||
int all = 0;
|
||||
foreach (var pro in mainProjects)
|
||||
{
|
||||
string urlCP7601 = $"{IDPApiUrl}OSS/projects/{pro.Code}/workitems/CP7601/objects/latest";
|
||||
string urlCP7603 = $"{IDPApiUrl}OSS/projects/{pro.Code}/workitems/CP7603/objects/latest";
|
||||
//string url = $"{IDPApiUrl}OSS/projects/{pro.Code}/workitems/IN1000/objects/latest";
|
||||
//string url = $"{IDPApiUrl}OSS/projects/100168/workitems/IN1000/objects/latest";
|
||||
//string urlCP7601 = $"{IDPApiUrl}OSS/projects/100168/workitems/CP7601/objects/latest";
|
||||
//string urlCP7603 = $"{IDPApiUrl}OSS/projects/100168/workitems/CP7603/objects/latest";
|
||||
try
|
||||
{
|
||||
Hashtable newToken = new Hashtable { { "Cookie", $"{session.name}={session.value}" } };
|
||||
var returndataCP7601 = BLL.APIGetHttpService.OutsideHttp(urlCP7601, "GET", null, newToken, null);
|
||||
var returndataCP7603 = BLL.APIGetHttpService.OutsideHttp(urlCP7603, "GET", null, newToken, null);
|
||||
List<IDPPreRunInstrumentation> results = new List<IDPPreRunInstrumentation>();
|
||||
if (!string.IsNullOrEmpty(returndataCP7601))
|
||||
{
|
||||
if (returndataCP7601.Contains("\"code\":404,\"message\":\"资源不存在\""))
|
||||
{
|
||||
result += $"失败!{returndataCP7601}|";
|
||||
}
|
||||
else if (returndataCP7601.Contains("\"status\":404,\"error\":\"Not Found\""))
|
||||
{
|
||||
result += $"失败!{returndataCP7601}|";
|
||||
}
|
||||
else
|
||||
{
|
||||
List<IDPPreRunInstrumentation> responseDatas = IDPPreRunInstrumentation.FromJson(returndataCP7601);
|
||||
results.AddRange(responseDatas);
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(returndataCP7603))
|
||||
{
|
||||
if (returndataCP7603.Contains("\"code\":404,\"message\":\"资源不存在\""))
|
||||
{
|
||||
result += $"失败!{returndataCP7603}|";
|
||||
}
|
||||
else if (returndataCP7603.Contains("\"status\":404,\"error\":\"Not Found\""))
|
||||
{
|
||||
result += $"失败!{returndataCP7603}|";
|
||||
}
|
||||
else
|
||||
{
|
||||
List<IDPPreRunInstrumentation> responseDatas = IDPPreRunInstrumentation.FromJson(returndataCP7603);
|
||||
results.AddRange(responseDatas);
|
||||
}
|
||||
}
|
||||
if (results.Any())
|
||||
{
|
||||
all += results.Count();
|
||||
foreach (var item in results)
|
||||
{
|
||||
Type type = typeof(IDPPreRunInstrumentation);
|
||||
|
||||
IDP_PreRunData_Instrumentation newItem = new IDP_PreRunData_Instrumentation();
|
||||
newItem.ItemId = item.ItemId;
|
||||
newItem.ProjId = pro.Code;//主数据项目Id
|
||||
newItem.ProjCode = pro.StNum;//主数据项目Code
|
||||
newItem.ProjectId = project.ProjectId;//智慧施工项目Id
|
||||
newItem.LastTime = DateTime.Now;//入库时间
|
||||
newItem.WbsCode = item.WbsCode;//装置工序主项码
|
||||
newItem.DeviceCode = item.DeviceCode;//装置码
|
||||
newItem.ProcessesCode = item.ProcessesCode;//工序码
|
||||
newItem.SubjectCode = item.SubjectCode;//主项码
|
||||
newItem.Category = item.Category;
|
||||
newItem.Tag = item.Tag;
|
||||
newItem.InstrumentTag = item.InstrumentTag;
|
||||
newItem.UseTo = item.UseTo;
|
||||
newItem.InstrumentName = item.InstrumentName;
|
||||
newItem.Supplier = item.Supplier;
|
||||
newItem.InstallationPosition = item.InstallationPosition;
|
||||
newItem.SignalType = item.SignalType;
|
||||
newItem.AssociatedSystem = item.AssociatedSystem;
|
||||
newItem.Cp25 = item.Cp25;
|
||||
newItem.In11 = item.In11;
|
||||
newItem.In40 = item.In40;
|
||||
newItem.Remark = item.Remark;
|
||||
newItem.DetailInfo = JsonConvert.SerializeObject(item, Formatting.Indented);
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(item.ItemId) && idpInstrumentationIds.Contains(item.ItemId))
|
||||
{//编辑
|
||||
modifyItems.Add(newItem);
|
||||
}
|
||||
else
|
||||
{//新增
|
||||
addItems.Add(newItem);
|
||||
idpInstrumentationIds.Add(item.ItemId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (WebException ex)
|
||||
{
|
||||
result = $"程序异常:{ex.Message}";
|
||||
}
|
||||
}
|
||||
|
||||
if (addItems.Any()) { AddIDPPreRunInstrumentation(addItems); }
|
||||
if (modifyItems.Any()) { ModifyIDPPreRunInstrumentation(modifyItems); }
|
||||
result = $"成功!总数:{all}条;新增:{addItems.Count()}条,维护:{(all - addItems.Count())}条";
|
||||
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 批量插入数据
|
||||
/// </summary>
|
||||
/// <param name="list"></param>
|
||||
public static void AddIDPPreRunInstrumentation(List<Model.IDP_PreRunData_Instrumentation> list)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
db.IDP_PreRunData_Instrumentation.InsertAllOnSubmit(list);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新数据
|
||||
/// </summary>
|
||||
/// <param name="list"></param>
|
||||
public static void ModifyIDPPreRunInstrumentation(List<Model.IDP_PreRunData_Instrumentation> list)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
foreach (var obj in list)
|
||||
{
|
||||
IDP_PreRunData_Instrumentation newItem = db.IDP_PreRunData_Instrumentation.FirstOrDefault(x => x.ItemId == obj.ItemId);
|
||||
if (newItem != null)
|
||||
{
|
||||
newItem.ProjId = obj.ProjId;//主数据项目Id
|
||||
newItem.ProjCode = obj.ProjCode;//主数据项目Code
|
||||
newItem.ProjectId = obj.ProjectId;//智慧施工项目Id
|
||||
newItem.LastTime = DateTime.Now;//入库时间
|
||||
newItem.WbsCode = obj.WbsCode;//装置工序主项码
|
||||
newItem.DeviceCode = obj.DeviceCode;//装置码
|
||||
newItem.ProcessesCode = obj.ProcessesCode;//工序码
|
||||
newItem.SubjectCode = obj.SubjectCode;//主项码
|
||||
newItem.Category = obj.Category;
|
||||
newItem.Tag = obj.Tag;
|
||||
newItem.InstrumentTag = obj.InstrumentTag;
|
||||
newItem.UseTo = obj.UseTo;
|
||||
newItem.InstrumentName = obj.InstrumentName;
|
||||
newItem.Supplier = obj.Supplier;
|
||||
newItem.InstallationPosition = obj.InstallationPosition;
|
||||
newItem.SignalType = obj.SignalType;
|
||||
newItem.AssociatedSystem = obj.AssociatedSystem;
|
||||
newItem.Cp25 = obj.Cp25;
|
||||
newItem.In11 = obj.In11;
|
||||
newItem.In40 = obj.In40;
|
||||
newItem.Remark = obj.Remark;
|
||||
newItem.DetailInfo = obj.DetailInfo;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region 质量管理设计图纸
|
||||
|
||||
#region IDP
|
||||
@@ -680,63 +1184,104 @@ namespace BLL
|
||||
|
||||
#endregion
|
||||
|
||||
#region 试车工作包
|
||||
#region IDP平台接口授权认证
|
||||
|
||||
/// <summary>
|
||||
/// 获取工作包结构化数据
|
||||
/// 加密公钥
|
||||
/// </summary>
|
||||
public static void GetIDPProjectMasterData()
|
||||
private static readonly string publicKey = "<RSAKeyValue><Modulus>g1sk7Xtc1TJouHdY4+FAe5atGCu2n17NhoKVDV57pki1IL+9+S7BY4gxAjmMkUU2/cbCCdbPoUJLBrCBCjX7yI3UJW6FZwQWkn3kVoeulLEwdPCIq/GUjMXaWf3Iaaad5wBUFbfXAzv15VN6z48Nt1IY/O8YEzhIpuZdtEgDdos=</Modulus><Exponent>AQAB</Exponent></RSAKeyValue>";
|
||||
//private static readonly string publicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQChnc2YD0YzJPx6QTh+/n7XzjR1ugFzrsmPolJhpCfWMKrSGbT7iX/Kgcm1AI+T95K4Jzv3KS42QTecZ1ziJ4Rr9Luzw+9ZCSjMZgrmAUbY5IeBaA6GzaSk8UWHZ4n5PL+GUGq+2f+COL7+KCS2AxEpaqDZVrJrIfg/UektdgNyzwIDAQAB";
|
||||
|
||||
/// <summary>
|
||||
/// 第三方加密认证接口
|
||||
/// </summary>
|
||||
/// 五环IDP系统SessionId有效期30分钟
|
||||
/// <returns></returns>
|
||||
public static SessionItem GetAuthenticationSession()
|
||||
{
|
||||
string projectId = string.Empty;//五环主数据项目Id
|
||||
string wbsCode = string.Empty;//五环主数据wbs编码
|
||||
string workitemCode = string.Empty;//五环主数据文件类别码
|
||||
|
||||
//https://idp.cwcec.com/OSS/projects/9100168/wbs/000000/workitems/CP2100/objects/latest
|
||||
//string url = $"{IDPApiUrl}/OSS/projects/{projectId}/wbs/{wbsCode}/workitems/{workitemCode}/objects/latest";
|
||||
string url = $"{IDPApiUrl}/OSS/projects/9100168/wbs/000000/workitems/CP2100/objects/latest";
|
||||
|
||||
|
||||
//测试环境接口地址
|
||||
var testApiUrl = "http://10.5.6.151:8100/OSS/projects/9100168/wbs/000000/workitems/CP2100/objects/latest";
|
||||
SessionItem session = new SessionItem();
|
||||
try
|
||||
{
|
||||
var session = GetAuthenticationSession();
|
||||
//// 创建RSA加密服务提供者
|
||||
////using (RSA rsa = RSA.Create())
|
||||
//using (RSACryptoServiceProvider rsa = new RSACryptoServiceProvider())
|
||||
//{
|
||||
//// 获取公钥false表示只导出公钥
|
||||
//string publicKey = rsa.ToXmlString(false);
|
||||
//// 获取私钥true表示导出公钥和私钥
|
||||
//string privateKey = rsa.ToXmlString(true);
|
||||
|
||||
ErrLogInfo.WriteLog($"Session——name:{session.name};value:{session.value}");
|
||||
Hashtable newToken = new Hashtable { { session.name, session.value } };
|
||||
var returndata = BLL.APIGetHttpService.OutsideHttp(url, "GET", null, newToken, null);
|
||||
|
||||
////用户名加密
|
||||
//string encryptedUsername = EncryptData("dataviewer", publicKey);
|
||||
////密码加密
|
||||
//string encryptedPassword = EncryptData("a3365$!", publicKey);
|
||||
|
||||
//用户名加密后的密文
|
||||
string encryptedUsername = "k0N0tx/hfRPY0v2lq1G8eH6hCO+UiMqlSZi1PD6bhGf4YpP/koJq5hfMsDSzdn3dZjzExrwyrjFWp/1jZLde0+gRbQ0D7tzm0R5D6AmriodD2cJvrEiwtDy7SeGNloSaNmpTEMuycpuueiOeGhMkKnTwWfRkEw73lxEpTmaahq4=";
|
||||
//密码加密后的密文
|
||||
string encryptedPassword = "HLLroiNJJzyTWJt9td1xgChbVzyQkoxWCGGXqdwI2cvlUF/A30FAPaInszSwEhNRQlJZZ01EODElemkgv36DMF+XGwfDi0BfIq9jKG+/+wq0TVOHNhiu2NPzpn5Ji2X3yXIXpH1zv6XEtkvx/qiLToZYfRQCufsl5vH1cZxk2fQ=";
|
||||
|
||||
string url = $"{IDPApiUrl}UAMS/authEncrypt";
|
||||
//string url = $"http://10.5.6.151:8100/UAMS/authEncrypt";
|
||||
string contenttype = "application/json;charset=utf-8";
|
||||
var body = new
|
||||
{
|
||||
encryptedUsername = encryptedUsername,
|
||||
encryptedPassword = encryptedPassword
|
||||
};
|
||||
|
||||
string pushContent = JsonConvert.SerializeObject(body);
|
||||
string strJosn = APIGetHttpService.Http(url, "POST", contenttype, null, pushContent);
|
||||
//string strJosn = HttpHelper.Post(url, null, pushContent);
|
||||
JObject obj = JObject.Parse(strJosn);
|
||||
if (!string.IsNullOrEmpty(strJosn))
|
||||
{
|
||||
string value = obj["value"].ToString();
|
||||
string name = obj["name"].ToString();
|
||||
session.value = value;
|
||||
session.name = name;
|
||||
}
|
||||
//}
|
||||
}
|
||||
catch (WebException ex)
|
||||
{
|
||||
|
||||
return null;
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
}
|
||||
return session;
|
||||
}
|
||||
|
||||
|
||||
//public static void AddPMP_Project(List<Model.PMP_Project> newtables)
|
||||
//{
|
||||
// Model.SGGLDB db = Funs.DB;
|
||||
// db.PMP_Project.InsertAllOnSubmit(newtables);
|
||||
// db.SubmitChanges();
|
||||
//}
|
||||
|
||||
//public static void DeleteAllPMP_Project()
|
||||
//{
|
||||
// Model.SGGLDB db = Funs.DB;
|
||||
// if (db.PMP_Project.FirstOrDefault() != null)
|
||||
// {
|
||||
// db.PMP_Project.DeleteAllOnSubmit(db.PMP_Project);
|
||||
// db.SubmitChanges();
|
||||
// }
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// 加密字符串
|
||||
/// </summary>
|
||||
/// <param name="data">加密信息</param>
|
||||
/// <param name="publicKey">公钥</param>
|
||||
/// <returns></returns>
|
||||
public static string EncryptData(string data, string publicKey)
|
||||
{
|
||||
using (RSACryptoServiceProvider rsa = new RSACryptoServiceProvider())
|
||||
{
|
||||
string result = string.Empty;
|
||||
try
|
||||
{
|
||||
rsa.FromXmlString(publicKey); //从字符串加载公钥
|
||||
byte[] dataBytes = Encoding.UTF8.GetBytes(data);
|
||||
byte[] encryptedBytes = rsa.Encrypt(dataBytes, false); //使用公钥加密数据,false表示使用OAEP填充方式
|
||||
result = Convert.ToBase64String(encryptedBytes); //返回Base64编码的加密数据
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("Error encrypting: {0}", ex.Message);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
/// <summary>
|
||||
/// IDP平台试车数据服务
|
||||
/// </summary>
|
||||
public static class IDPPreRunDataService
|
||||
{
|
||||
#region 管道一览表
|
||||
|
||||
/// <summary>
|
||||
/// 获取明细
|
||||
/// </summary>
|
||||
/// <param name="ItemId"></param>
|
||||
/// <returns></returns>
|
||||
public static Model.IDP_PreRunData_Piping GetPipingById(string ItemId)
|
||||
{
|
||||
return Funs.DB.IDP_PreRunData_Piping.FirstOrDefault(x => x.ItemId == ItemId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取IDP试车管道一览表
|
||||
/// </summary>
|
||||
/// <param name="projectId"></param>
|
||||
/// <returns></returns>
|
||||
public static List<Model.IDP_PreRunData_Piping> GetIDPPreRunDataPipingList(string projectId)
|
||||
{
|
||||
var list = (from x in Funs.DB.IDP_PreRunData_Piping where x.ProjectId == projectId orderby x.ProjCode select x).ToList();
|
||||
return list;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取IDP试车管道一览表Ids
|
||||
/// </summary>
|
||||
/// <param name="projectId"></param>
|
||||
/// <returns></returns>
|
||||
public static List<string> GetIDPPreRunDataPipingIds(string projectId)
|
||||
{
|
||||
return (from x in Funs.DB.IDP_PreRunData_Piping where x.ProjectId == projectId select x.ItemId).ToList();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 设备一览表
|
||||
|
||||
/// <summary>
|
||||
/// 获取明细
|
||||
/// </summary>
|
||||
/// <param name="ItemId"></param>
|
||||
/// <returns></returns>
|
||||
public static Model.IDP_PreRunData_Equipment GetEquipmentById(string ItemId)
|
||||
{
|
||||
return Funs.DB.IDP_PreRunData_Equipment.FirstOrDefault(x => x.ItemId == ItemId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取IDP试车管道一览表Ids
|
||||
/// </summary>
|
||||
/// <param name="projectId"></param>
|
||||
/// <returns></returns>
|
||||
public static List<string> GetIDPPreRunDataEquipmentIds(string projectId)
|
||||
{
|
||||
return (from x in Funs.DB.IDP_PreRunData_Equipment where x.ProjectId == projectId select x.ItemId).ToList();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 仪表索引
|
||||
|
||||
/// <summary>
|
||||
/// 获取明细
|
||||
/// </summary>
|
||||
/// <param name="ItemId"></param>
|
||||
/// <returns></returns>
|
||||
public static Model.IDP_PreRunData_Instrumentation GetInstrumentationById(string ItemId)
|
||||
{
|
||||
return Funs.DB.IDP_PreRunData_Instrumentation.FirstOrDefault(x => x.ItemId == ItemId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取IDP试车管道一览表Ids
|
||||
/// </summary>
|
||||
/// <param name="projectId"></param>
|
||||
/// <returns></returns>
|
||||
public static List<string> GetIDPPreRunDataInstrumentationIds(string projectId)
|
||||
{
|
||||
return (from x in Funs.DB.IDP_PreRunData_Instrumentation where x.ProjectId == projectId select x.ItemId).ToList();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,27 @@ namespace BLL
|
||||
//private static readonly string PmpApiUrl = "http://mdm.cwcec.com:8020/";
|
||||
private static readonly string PmpApiUrl = SysConstSetService.WuHuanPMPPath;
|
||||
|
||||
/// <summary>
|
||||
/// 根据主项目code获取主项目数据
|
||||
/// </summary>
|
||||
/// <param name="proCode"></param>
|
||||
/// <returns></returns>
|
||||
public static Model.PMP_Project GetPMPProjectByCode(string proCode)
|
||||
{
|
||||
return Funs.DB.PMP_Project.OrderBy(x => x.RealEndDate).FirstOrDefault(e => e.StNum == proCode);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据主项目code获取主项目数据
|
||||
/// </summary>
|
||||
/// <param name="proCode"></param>
|
||||
/// <returns></returns>
|
||||
public static List<Model.PMP_Project> GetPMPProjectListByCode(string proCode)
|
||||
{
|
||||
var list = (from x in Funs.DB.PMP_Project where x.StNum == proCode orderby x.Code select x).ToList();
|
||||
return list;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取token
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user