186 lines
7.9 KiB
C#
186 lines
7.9 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using System.Threading.Tasks;
|
|||
|
|
|||
|
namespace BLL
|
|||
|
{
|
|||
|
public static class APIBaseInfoService
|
|||
|
{
|
|||
|
#region 根据登陆的用户ID获取项目列表(对施工单位)
|
|||
|
/// <summary>
|
|||
|
/// 根据登陆的用户ID获取项目列表
|
|||
|
/// </summary>
|
|||
|
/// <param name="userId">登陆的用户ID</param>
|
|||
|
/// <param name="projectArea">项目区域</param>
|
|||
|
/// <returns></returns>
|
|||
|
public static List<Model.BaseInfoItem> getProjectList(string userId,string projectArea)
|
|||
|
{
|
|||
|
using (Model.HJGLDB db = new Model.HJGLDB(Funs.ConnString))
|
|||
|
{
|
|||
|
var getDataLists = (from x in db.Base_Project
|
|||
|
join y in db.Project_User
|
|||
|
on x.ProjectId equals y.ProjectId
|
|||
|
where y.UserId == userId && x.ProjectArea == projectArea
|
|||
|
&& x.IsClosed == false
|
|||
|
select new Model.BaseInfoItem
|
|||
|
{
|
|||
|
BaseInfoId = x.ProjectId,
|
|||
|
BaseInfoCode = x.ProjectCode,
|
|||
|
BaseInfoName = x.ProjectName
|
|||
|
}).Distinct().ToList();
|
|||
|
|
|||
|
return getDataLists;
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 根据项目区域获取项目列表(对查询)
|
|||
|
/// <summary>
|
|||
|
/// 根据项目区域获取项目列表
|
|||
|
/// </summary>
|
|||
|
/// <param name="userId">登陆的用户ID</param>
|
|||
|
/// <param name="projectArea">项目区域</param>
|
|||
|
/// <returns></returns>
|
|||
|
public static List<Model.BaseInfoItem> getProjectListByArea(string projectArea)
|
|||
|
{
|
|||
|
using (Model.HJGLDB db = new Model.HJGLDB(Funs.ConnString))
|
|||
|
{
|
|||
|
var getDataLists = (from x in db.Base_Project
|
|||
|
where x.ProjectArea == projectArea
|
|||
|
select new Model.BaseInfoItem
|
|||
|
{
|
|||
|
BaseInfoId = x.ProjectId,
|
|||
|
BaseInfoCode = x.ProjectCode,
|
|||
|
BaseInfoName = x.ProjectName
|
|||
|
}).Distinct().ToList();
|
|||
|
|
|||
|
return getDataLists;
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 根据项目ID和施工单位获取区域列表
|
|||
|
/// <summary>
|
|||
|
/// 根据项目ID和施工单位获取区域列表
|
|||
|
/// </summary>
|
|||
|
/// <param name="projectId">项目ID</param>
|
|||
|
/// <param name="unitId">施工单位ID</param>
|
|||
|
/// <returns></returns>
|
|||
|
public static List<Model.BaseInfoItem> getWorkAreaList(string projectId, string unitId)
|
|||
|
{
|
|||
|
using (Model.HJGLDB db = new Model.HJGLDB(Funs.ConnString))
|
|||
|
{
|
|||
|
var getDataLists = (from x in db.Project_WorkArea
|
|||
|
where x.ProjectId == projectId && x.UnitId == unitId
|
|||
|
select new Model.BaseInfoItem
|
|||
|
{
|
|||
|
BaseInfoId = x.WorkAreaId,
|
|||
|
BaseInfoCode = x.WorkAreaCode,
|
|||
|
BaseInfoName = x.WorkAreaName,
|
|||
|
Remark = x.InstallationId
|
|||
|
}).Distinct().ToList();
|
|||
|
|
|||
|
return getDataLists;
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 根据项目ID和施工区域获取管线列表信息
|
|||
|
/// <summary>
|
|||
|
/// 根据项目ID和施工区域获取管线列表信息
|
|||
|
/// </summary>
|
|||
|
/// <param name="projectId">项目ID</param>
|
|||
|
/// <param name="wordAreaId">施工区域ID</param>
|
|||
|
/// <returns></returns>
|
|||
|
public static List<Model.BaseInfoItem> getPipeLineList(string projectId, string wordAreaId)
|
|||
|
{
|
|||
|
using (Model.HJGLDB db = new Model.HJGLDB(Funs.ConnString))
|
|||
|
{
|
|||
|
var getDataLists = (from x in db.Pipeline_Pipeline
|
|||
|
where x.ProjectId == projectId && x.WorkAreaId == wordAreaId
|
|||
|
select new Model.BaseInfoItem
|
|||
|
{
|
|||
|
BaseInfoId = x.PipelineId,
|
|||
|
BaseInfoCode = x.PipelineCode,
|
|||
|
BaseInfoName = x.PipelineCode
|
|||
|
}).Distinct().OrderBy(x=>x.BaseInfoCode).ToList();
|
|||
|
|
|||
|
return getDataLists;
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 根据管线ID获取焊口列表信息
|
|||
|
/// <summary>
|
|||
|
/// 根据管线ID获取焊口列表信息
|
|||
|
/// </summary>
|
|||
|
/// <param name="pipelineId">管线ID</param>
|
|||
|
/// <returns></returns>
|
|||
|
public static List<Model.BaseInfoItem> getWeldJointList(string pipelineId)
|
|||
|
{
|
|||
|
using (Model.HJGLDB db = new Model.HJGLDB(Funs.ConnString))
|
|||
|
{
|
|||
|
// 预提交的焊口
|
|||
|
var preJotId = (from x in db.Pipeline_PreWeldingDaily
|
|||
|
join y in db.Pipeline_WeldJoint on x.WeldJointId equals y.WeldJointId
|
|||
|
where y.PipelineId == pipelineId
|
|||
|
select x.WeldJointId).Distinct();
|
|||
|
|
|||
|
// 未焊接的焊口
|
|||
|
var weldJointLists = from x in Funs.DB.Pipeline_WeldJoint
|
|||
|
where x.PipelineId == pipelineId && x.WeldingDailyId == null
|
|||
|
&& (x.IsCancel == null || x.IsCancel == false)
|
|||
|
select new
|
|||
|
{
|
|||
|
x.WeldJointId,
|
|||
|
x.WeldJointCode,
|
|||
|
};
|
|||
|
|
|||
|
List<Model.BaseInfoItem> getDataLists = new List<Model.BaseInfoItem>();
|
|||
|
if (weldJointLists.Count() > 0)
|
|||
|
{
|
|||
|
foreach (var item in weldJointLists)
|
|||
|
{
|
|||
|
if (!preJotId.Contains(item.WeldJointId))
|
|||
|
{
|
|||
|
Model.BaseInfoItem info = new Model.BaseInfoItem();
|
|||
|
info.BaseInfoId = item.WeldJointId;
|
|||
|
info.BaseInfoCode = item.WeldJointCode;
|
|||
|
getDataLists.Add(info);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
return getDataLists.OrderBy(x => x.BaseInfoCode).ToList() ;
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 根据企业ID获取装置列表信息
|
|||
|
/// <summary>
|
|||
|
/// 根据企业ID获取装置列表信息
|
|||
|
/// </summary>
|
|||
|
/// <param name="pipelineId">管线ID</param>
|
|||
|
/// <returns></returns>
|
|||
|
public static List<Model.BaseInfoItem> getInstallationList(string projectId)
|
|||
|
{
|
|||
|
using (Model.HJGLDB db = new Model.HJGLDB(Funs.ConnString))
|
|||
|
{
|
|||
|
var getDataLists = (from x in Funs.DB.Project_Installation
|
|||
|
where x.ProjectId == projectId
|
|||
|
orderby x.InstallationCode
|
|||
|
select new Model.BaseInfoItem
|
|||
|
{
|
|||
|
BaseInfoId = x.InstallationId,
|
|||
|
BaseInfoCode = x.InstallationCode,
|
|||
|
BaseInfoName = x.InstallationName
|
|||
|
}).Distinct().ToList();
|
|||
|
|
|||
|
return getDataLists;
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
}
|
|||
|
}
|