diff --git a/SGGL/FineUIPro.Web/DataShow/QualityAcceptance.aspx.cs b/SGGL/FineUIPro.Web/DataShow/QualityAcceptance.aspx.cs index e2b35a5e..42233531 100644 --- a/SGGL/FineUIPro.Web/DataShow/QualityAcceptance.aspx.cs +++ b/SGGL/FineUIPro.Web/DataShow/QualityAcceptance.aspx.cs @@ -122,6 +122,20 @@ namespace FineUIPro.Web.DataShow } #endregion + /// + /// 定义变量 + /// + private static IQueryable getDataItemLists = from x in Funs.DB.ProcessControl_InspectionManagementDetail + join y in Funs.DB.ProcessControl_InspectionManagement on x.InspectionId equals y.InspectionId + join z in Funs.DB.WBS_BreakdownProject on x.ControlPointType equals z.BreakdownProjectId + select new Model.QualityAcceptanceItem + { + InspectionDetailId = x.InspectionDetailId, + ProjectId = z.ProjectId, + CheckAcceptType = z.CheckAcceptType, + IsOnceQualified = y.IsOnceQualified + }; + /// /// 数量 /// @@ -132,11 +146,7 @@ namespace FineUIPro.Web.DataShow int cout1 = 0; if (projectId != null) { - var getT = (from x in Funs.DB.ProcessControl_InspectionManagementDetail - join y in Funs.DB.ProcessControl_InspectionManagement on x.InspectionId equals y.InspectionId - join z in Funs.DB.WBS_BreakdownProject on x.ControlPointType equals z.BreakdownProjectId - where z.ProjectId == projectId.ToString() && z.CheckAcceptType == this.rbType.SelectedValue - select x).Distinct().ToList(); + var getT = getDataItemLists.Where(x => x.ProjectId == projectId.ToString() && x.CheckAcceptType == this.rbType.SelectedValue).Distinct().ToList(); cout1 = getT.Count(); } return cout1; @@ -152,11 +162,7 @@ namespace FineUIPro.Web.DataShow int cout1 = 0; if (projectId != null) { - var getT = (from x in Funs.DB.ProcessControl_InspectionManagementDetail - join y in Funs.DB.ProcessControl_InspectionManagement on x.InspectionId equals y.InspectionId - join z in Funs.DB.WBS_BreakdownProject on x.ControlPointType equals z.BreakdownProjectId - where z.ProjectId == projectId.ToString() && z.CheckAcceptType == this.rbType.SelectedValue && y.IsOnceQualified == true - select x).Distinct().ToList(); + var getT = getDataItemLists.Where(x => x.ProjectId == projectId.ToString() && x.CheckAcceptType == this.rbType.SelectedValue && x.IsOnceQualified == true).Distinct().ToList(); cout1 = getT.Count(); } return cout1; @@ -172,16 +178,8 @@ namespace FineUIPro.Web.DataShow int cout1 = 0; if (projectId != null) { - var getT1 = (from x in Funs.DB.ProcessControl_InspectionManagementDetail - join y in Funs.DB.ProcessControl_InspectionManagement on x.InspectionId equals y.InspectionId - join z in Funs.DB.WBS_BreakdownProject on x.ControlPointType equals z.BreakdownProjectId - where z.ProjectId == projectId.ToString() && z.CheckAcceptType == this.rbType.SelectedValue - select x).Distinct().ToList(); - var getT2 = (from x in Funs.DB.ProcessControl_InspectionManagementDetail - join y in Funs.DB.ProcessControl_InspectionManagement on x.InspectionId equals y.InspectionId - join z in Funs.DB.WBS_BreakdownProject on x.ControlPointType equals z.BreakdownProjectId - where z.ProjectId == projectId.ToString() && z.CheckAcceptType == this.rbType.SelectedValue && y.IsOnceQualified == true - select x).Distinct().ToList(); + var getT1 = getDataItemLists.Where(x => x.ProjectId == projectId.ToString() && x.CheckAcceptType == this.rbType.SelectedValue).Distinct().ToList(); + var getT2 = getDataItemLists.Where(x => x.ProjectId == projectId.ToString() && x.CheckAcceptType == this.rbType.SelectedValue && x.IsOnceQualified == true).Distinct().ToList(); cout1 = getT1.Count() - getT2.Count(); } return cout1; @@ -197,16 +195,8 @@ namespace FineUIPro.Web.DataShow string rate = string.Empty; if (projectId != null) { - var getT1 = (from x in Funs.DB.ProcessControl_InspectionManagementDetail - join y in Funs.DB.ProcessControl_InspectionManagement on x.InspectionId equals y.InspectionId - join z in Funs.DB.WBS_BreakdownProject on x.ControlPointType equals z.BreakdownProjectId - where z.ProjectId == projectId.ToString() && z.CheckAcceptType == this.rbType.SelectedValue - select x).Distinct().ToList(); - var getT2 = (from x in Funs.DB.ProcessControl_InspectionManagementDetail - join y in Funs.DB.ProcessControl_InspectionManagement on x.InspectionId equals y.InspectionId - join z in Funs.DB.WBS_BreakdownProject on x.ControlPointType equals z.BreakdownProjectId - where z.ProjectId == projectId.ToString() && z.CheckAcceptType == this.rbType.SelectedValue && y.IsOnceQualified == true - select x).Distinct().ToList(); + var getT1 = getDataItemLists.Where(x => x.ProjectId == projectId.ToString() && x.CheckAcceptType == this.rbType.SelectedValue).Distinct().ToList(); + var getT2 = getDataItemLists.Where(x => x.ProjectId == projectId.ToString() && x.CheckAcceptType == this.rbType.SelectedValue && x.IsOnceQualified == true).Distinct().ToList(); if (getT1.Count() > 0) { rate = Math.Round(getT2.Count() * 1.0 / getT1.Count() * 100, 2).ToString(); diff --git a/SGGL/Model/CQMS/QualityAcceptanceItem.cs b/SGGL/Model/CQMS/QualityAcceptanceItem.cs new file mode 100644 index 00000000..d91782f0 --- /dev/null +++ b/SGGL/Model/CQMS/QualityAcceptanceItem.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Model +{ + public class QualityAcceptanceItem + { + /// + /// + /// + public string InspectionDetailId + { + get; + set; + } + + /// + /// + /// + public string ProjectId + { + get; + set; + } + + /// + /// + /// + public string CheckAcceptType + { + get; + set; + } + + /// + /// + /// + public bool? IsOnceQualified + { + get; + set; + } + } +} diff --git a/SGGL/Model/Model.csproj b/SGGL/Model/Model.csproj index 08af1c30..89bcf3a3 100644 --- a/SGGL/Model/Model.csproj +++ b/SGGL/Model/Model.csproj @@ -173,6 +173,7 @@ +