using Model; using Model.APIItem; using System; using System.Collections.Generic; using System.Collections.Specialized; using System.Linq; using System.Text; using System.Web.Security; using System.Web.UI; namespace BLL.API { public class APIBaseServices { /// ///项目列表 /// /// /// /// public static Model.ResponeData baseProjectList(string userId, string trustType) { Model.ResponeData respone = new ResponeData(); using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { List projectids = new List(); var upids = db.Project_User.Where(x => x.UserId == userId).Select(x => x.ProjectId).ToList(); projectids.AddRange(upids); var wpids = db.Project_Welder.Where(x => x.WED_ID == userId).Select(x => x.ProjectId).ToList(); projectids.AddRange(wpids); var q = (from x in db.Base_Project where projectids.Contains(x.ProjectId) select x).ToList(); List res = new List(); foreach (var p in q) { BaseProjectItem item = new BaseProjectItem(); item.ProjectId = p.ProjectId; item.ProjectCode = p.ProjectCode; item.ProjectName = p.ProjectName; item.ShortName = p.ShortName; item.StartDate = p.StartDate; item.EndDate = p.EndDate; item.ProjectPrincipal = p.ProjectPrincipal; item.ProjectManager = p.ProjectManager; item.TechnicalPrincipal = p.TechnicalPrincipal; item.SecurePrincipal = p.SecurePrincipal; item.Remark = p.Remark; item.WatchUnit = p.WatchUnit; item.SubUnit = p.SubUnit; item.IsClosed = p.IsClosed; item.TestEngineeringCode = p.TestEngineeringCode; item.ProjectSoft = p.ProjectSoft; item.CheckUnitId = p.CheckUnitId; item.TestStandardId = p.TestStandardId; item.CreateManId = p.CreateManId; item.PowerIsExtracted = p.PowerIsExtracted; item.TestEngineeringCode = p.TestEngineeringCode; if (!string.IsNullOrEmpty(trustType)) { switch (trustType) { case "1": var hjglchHotProessTrustList = db.HJGL_CH_HotProessTrust.Where(x => !x.IsPrint.HasValue || !x.IsPrint.Value).Select(x => x.HotProessTrustId); if (hjglchHotProessTrustList.Count() > 0) { item.IsRed = true; } break; case "2": var hjglchHardTestReportList = db.HJGL_CH_HardTestReport.Where(x => !x.PrintReportDate.HasValue).Select(x => x.HardTestReportId); if (hjglchHardTestReportList.Count() > 0) { item.IsRed = true; } break; case "3": var hjglchTrustList = db.HJGL_CH_Trust.Where(x => !x.CH_PrintDate.HasValue).Select(x => x.CH_TrustID); if (hjglchTrustList.Count() > 0) { item.IsRed = true; } break; } } res.Add(item); } if (!string.IsNullOrEmpty(trustType)) { } respone.data = res; } return respone; } public static Model.ResponeData weldInfoList( ) { Model.ResponeData respone = new ResponeData(); using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { var q = (from x in db.Weld_WeldInfo orderby x.WeldCode select x).ToList(); List res = new List(); foreach (var p in q) { WeldInfoItem item = new WeldInfoItem(); item.WeldId = p.WeldId; item.WeldCode = p.WeldCode; item.WeldName = p.WeldName; item.WeldSpec = p.WeldSpec; item.WeldTypeId = p.WeldTypeId; item.ConvertValue = p.ConvertValue; item.WarnAmount = p.WarnAmount; item.SteelType = p.SteelType; item.ModifyMan = p.ModifyMan; item.CreateMan = p.CreateMan; if (!string.IsNullOrEmpty(p.WeldTypeId)) { item.WeldUnit = db.Weld_WeldType.Where(x => x.WeldTypeId == p.WeldTypeId).Select(x => x.WeldUnit).FirstOrDefault(); } res.Add(item); } respone.data = res; } return respone; } public static Model.ResponeData baseUnitList(string projectId) { Model.ResponeData respone = new ResponeData(); using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { var q = (from x in db.Base_Unit join y in db.Project_Unit on x.UnitId equals y.UnitId where y.ProjectId==projectId orderby x.UnitCode select x).ToList(); List res = new List(); foreach (var p in q) { BaseUnitItem item = new BaseUnitItem(); item.UnitId = p.UnitId; item.UnitCode = p.UnitCode; item.UnitName = p.UnitName; item.ProjectRange = p.ProjectRange; item.Corporate = p.Corporate; item.Address = p.Address; item.Telephone = p.Telephone; item.Fax = p.Fax; item.IsSubUnit = p.IsSubUnit; item.IsMain = p.IsMain; res.Add(item); } respone.data = res; } return respone; } public static Model.ResponeData usePositionList(string projectId) { Model.ResponeData respone = new ResponeData(); using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { var q = (from x in db.View_UsePosition where x.ProjectId == projectId orderby x.UsePosition select x).ToList(); List res = new List(); foreach (var p in q) { UsepositionItem item = new UsepositionItem(); item.UsePosition = p.UsePosition; item.ProjectId = p.ProjectId; res.Add(item); } respone.data = res; } return respone; } public static Model.ResponeData baseTeamGroupList(string projectId, string unitId) { Model.ResponeData respone = new ResponeData(); using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { var q = (from x in db.Base_TeamGroup where x.ProjectId == projectId && x.UnitId== unitId orderby x.TeamGroupCode select x).ToList(); List res = new List(); foreach (var p in q) { BaseTeamgroupItem item = new BaseTeamgroupItem(); item.TeamGroupId = p.TeamGroupId; item.TeamGroupCode = p.TeamGroupCode; item.TeamGroupName = p.TeamGroupName; item.UnitId = p.UnitId; item.Remark = p.Remark; item.Area = p.Area; item.ProjectId = p.ProjectId; res.Add(item); } respone.data = res; } return respone; } public static Model.ResponeData bsWelderList(string projectId) { Model.ResponeData respone = new ResponeData(); using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { var q = (from x in db.HJGL_BS_Welder join y in db.Project_Welder on x.WED_ID equals y.WED_ID where y.ProjectId == projectId orderby x.WED_Code select x).ToList(); List res = new List(); foreach (var p in q) { WelderItem item = new WelderItem(); item.WED_ID = p.WED_ID; item.WED_Unit = p.WED_Unit; item.EDU_ID = p.EDU_ID; item.SE_EquipmentID = p.SE_EquipmentID; item.NP_NondestructivePersonID = p.NP_NondestructivePersonID; item.WED_Code = p.WED_Code; item.WED_Name = p.WED_Name; item.WED_UserType = p.WED_UserType; item.WED_Sex = p.WED_Sex; item.WED_Birthday = p.WED_Birthday; item.WED_WorkCode = p.WED_WorkCode; item.WED_Class = p.WED_Class; item.WED_TotalDin = p.WED_TotalDin; item.WED_TotalJoint = p.WED_TotalJoint; item.WED_ExtendDin = p.WED_ExtendDin; item.WED_ExtendJoint = p.WED_ExtendJoint; item.WED_RepairJoint = p.WED_RepairJoint; item.WED_IfOnGuard = p.WED_IfOnGuard; item.WED_Remark = p.WED_Remark; item.WED_TotalFilm = p.WED_TotalFilm; item.WED_PassFilm = p.WED_PassFilm; item.WED_ExtendTotalFilm = p.WED_ExtendTotalFilm; item.WED_ExtendPassFilm = p.WED_ExtendPassFilm; item.ProjectId = p.ProjectId; item.ThicknessMax = p.ThicknessMax; item.ThicknessMin = p.ThicknessMin; item.SizesMax = p.SizesMax; item.SizesMin = p.SizesMin; item.RecordDate = p.RecordDate; item.MyFinger = p.MyFinger; item.SignatureUrl = p.SignatureUrl; item.Education = p.Education; item.WED_States = p.WED_States; item.IsOAM = p.IsOAM; item.LimitDate = p.LimitDate; item.IdentityCard = p.IdentityCard; item.AttachUrl = p.AttachUrl; item.IsFaceTrain = p.IsFaceTrain; res.Add(item); } respone.data = res; } return respone; } public static Model.ResponeData bsSteelList() { Model.ResponeData respone = new ResponeData(); using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { var q = (from x in db.HJGL_BS_Steel orderby x.STE_Code select x).ToList(); List res = new List(); foreach (var p in q) { BSteelItem item = new BSteelItem(); item.HardQuaStandard = p.HardQuaStandard; item.STE_Remark = p.STE_Remark; item.STE_Code = p.STE_Code; item.STE_ID = p.STE_ID; item.MaterialGroup = p.MaterialGroup; item.STE_SteelType = p.STE_SteelType; item.MaterialType = p.MaterialType; item.STE_Name = p.STE_Name; res.Add(item); } respone.data = res; } return respone; } } }