using NPOI.OpenXmlFormats.Shared; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Model; namespace BLL { public class APIPipelineComponentService { public static List GetPackagingManageList(string projectid) { using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { var q = (from x in db.HJGL_Pipeline_Component join y in db.HJGL_Pipeline on x.PipelineId equals y.PipelineId join z in db.Base_Unit on x.PreUnit equals z.UnitId into tt from t in tt.DefaultIfEmpty() where y.ProjectId == projectid select new PipelineComponentItem { PipelineComponentId = x.PipelineComponentId, PipelineComponentCode = x.PipelineComponentCode, PreUnit = t.UnitName, DrawingName = x.DrawingName, BoxNumber = x.BoxNumber, State = x.State, PlanStartDate = y.PlanStartDate, QRCode = x.QRCode, }).Distinct(); return q.ToList(); } } public static PipelineComponentDetail GetPipelineComponentById(string projectId, string personId, string PipelineComponentId) { using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { PipelineComponentDetail pipelineComponentDetail = new PipelineComponentDetail(); var q = (from x in db.HJGL_Pipeline_Component join y in db.HJGL_Pipeline on x.PipelineId equals y.PipelineId join z in db.Base_Unit on x.PreUnit equals z.UnitId into tt from t in tt.DefaultIfEmpty() where x.PipelineComponentId== PipelineComponentId select new PipelineComponentItem { PipelineComponentId = x.PipelineComponentId, PipelineComponentCode = x.PipelineComponentCode, PreUnit = t.UnitName, DrawingName = x.DrawingName, BoxNumber = x.BoxNumber, State = x.State, PlanStartDate = y.PlanStartDate, QRCode = x.QRCode, }).FirstOrDefault(); bool isPower = Person_PersonsService.IsGeneralUnitByPersonId(personId, projectId); pipelineComponentDetail.pipelineComponentItem = q; pipelineComponentDetail.isPower=isPower; return pipelineComponentDetail; } } public static void GetComponentConfirmArrival(string PipelineComponentId) { var q = BLL.HJGL_PipelineComponentService.GetPipelineComponentById(PipelineComponentId); if (q != null) { q.State = HJGL_PipelineComponentService.state_1; HJGL_PipelineComponentService.UpdatePipelineComponent(q); } } } }