using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace BLL { public static class APIBaseInfoService { #region 根据登陆的用户ID获取项目列表(对施工单位) /// /// 根据登陆的用户ID获取项目列表 /// /// 登陆的用户ID /// 项目区域 /// public static List 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 根据项目区域获取项目列表(对查询) /// /// 根据项目区域获取项目列表 /// /// 登陆的用户ID /// 项目区域 /// public static List 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和施工单位获取区域列表 /// /// 根据项目ID和施工单位获取区域列表 /// /// 项目ID /// 施工单位ID /// public static List 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和施工区域获取管线列表信息 /// /// 根据项目ID和施工区域获取管线列表信息 /// /// 项目ID /// 施工区域ID /// public static List 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获取焊口列表信息 /// /// 根据管线ID获取焊口列表信息 /// /// 管线ID /// public static List 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 getDataLists = new List(); 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获取装置列表信息 /// /// 根据企业ID获取装置列表信息 /// /// 管线ID /// public static List 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 } }