using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace BLL { public class ShowRepairSearchService { public static List GetSpRepairSearchItems(string projectId, List jotList, bool ckISO, bool ckWeld, string[] workAreaId, string unitId, string CH_TrustID) { Model.SGGLDB db = Funs.DB; List SpRepairSearchItems = new List(); if (jotList != null) { var IsoInfo = from x in db.PW_IsoInfo where x.ProjectId == projectId && x.UnitId == unitId select x; if (workAreaId.Count() > 1 || (workAreaId.Count() == 1 && workAreaId[0] != BLL.Const._Null)) { IsoInfo = IsoInfo.Where(x => workAreaId.Contains(x.WorkAreaId)); } if (ckISO) { var isoList = (from x in db.PW_JointInfo where jotList.Contains(x.JOT_ID) select x.ISO_ID).Distinct().ToList(); IsoInfo = IsoInfo.Where(x => isoList.Contains(x.ISO_ID)); } if (IsoInfo.Count() > 0) { foreach (var isoItem in IsoInfo) { var jots = from x in db.PW_JointInfo where x.ISO_ID == isoItem.ISO_ID && x.JOT_JointStatus == "100" && x.DReportID != null select x; if (ckWeld) { var weldList = (from x in db.PW_JointInfo where jotList.Contains(x.JOT_ID) select x.JOT_CellWelder).Distinct().ToList(); jots = jots.Where(x => weldList.Contains(x.JOT_CellWelder)).Distinct(); } if (jots.Count() > 0) { foreach (var jotItem in jots) { if (!jotList.Contains(jotItem.JOT_ID)) { var jointInfoAndIsoInfoItem = Funs.DB.View_JointInfoAndIsoInfo.FirstOrDefault(x => x.JOT_ID == jotItem.JOT_ID); SpRepairSearchItems.Add(jointInfoAndIsoInfoItem); } } } } } } return SpRepairSearchItems; } } }