查询优化
This commit is contained in:
@@ -122,19 +122,19 @@ namespace FineUIPro.Web.DataShow
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 定义变量
|
||||
/// </summary>
|
||||
private static IQueryable<Model.QualityAcceptanceItem> 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
|
||||
};
|
||||
///// <summary>
|
||||
///// 定义变量
|
||||
///// </summary>
|
||||
//private static IQueryable<Model.QualityAcceptanceItem> 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
|
||||
// };
|
||||
|
||||
/// <summary>
|
||||
/// 数量
|
||||
@@ -143,6 +143,17 @@ namespace FineUIPro.Web.DataShow
|
||||
/// <returns></returns>
|
||||
protected int Count1(object projectId)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
IQueryable<Model.QualityAcceptanceItem> getDataItemLists = from x in db.ProcessControl_InspectionManagementDetail
|
||||
join y in db.ProcessControl_InspectionManagement on x.InspectionId equals y.InspectionId
|
||||
join z in 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
|
||||
};
|
||||
int cout1 = 0;
|
||||
if (projectId != null)
|
||||
{
|
||||
@@ -159,6 +170,17 @@ namespace FineUIPro.Web.DataShow
|
||||
/// <returns></returns>
|
||||
protected int Count2(object projectId)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
IQueryable<Model.QualityAcceptanceItem> getDataItemLists = from x in db.ProcessControl_InspectionManagementDetail
|
||||
join y in db.ProcessControl_InspectionManagement on x.InspectionId equals y.InspectionId
|
||||
join z in 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
|
||||
};
|
||||
int cout1 = 0;
|
||||
if (projectId != null)
|
||||
{
|
||||
@@ -175,6 +197,17 @@ namespace FineUIPro.Web.DataShow
|
||||
/// <returns></returns>
|
||||
protected int Count3(object projectId)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
IQueryable<Model.QualityAcceptanceItem> getDataItemLists = from x in db.ProcessControl_InspectionManagementDetail
|
||||
join y in db.ProcessControl_InspectionManagement on x.InspectionId equals y.InspectionId
|
||||
join z in 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
|
||||
};
|
||||
int cout1 = 0;
|
||||
if (projectId != null)
|
||||
{
|
||||
@@ -192,6 +225,17 @@ namespace FineUIPro.Web.DataShow
|
||||
/// <returns></returns>
|
||||
protected string Count4(object projectId)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
IQueryable<Model.QualityAcceptanceItem> getDataItemLists = from x in db.ProcessControl_InspectionManagementDetail
|
||||
join y in db.ProcessControl_InspectionManagement on x.InspectionId equals y.InspectionId
|
||||
join z in 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
|
||||
};
|
||||
string rate = string.Empty;
|
||||
if (projectId != null)
|
||||
{
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace FineUIPro.Web.DataShow
|
||||
|
||||
// cpara += " AND c.RegisterDate <=" + this.txtEndTime.Text;
|
||||
//}
|
||||
|
||||
|
||||
SqlParameter[] parameter = listStr.ToArray();
|
||||
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||||
Grid1.RecordCount = tb.Rows.Count;
|
||||
@@ -164,7 +164,7 @@ namespace FineUIPro.Web.DataShow
|
||||
int cout1 = 0;
|
||||
if (projectId != null)
|
||||
{
|
||||
cout1= getcount(projectId.ToString(), "B");
|
||||
cout1 = getcount(projectId.ToString(), "B");
|
||||
}
|
||||
return cout1;
|
||||
}
|
||||
@@ -178,11 +178,11 @@ namespace FineUIPro.Web.DataShow
|
||||
}
|
||||
return cout1;
|
||||
}
|
||||
/// <summary>
|
||||
/// 定义变量
|
||||
/// </summary>
|
||||
private static IQueryable<Model.WBS_BreakdownProject> getDataLists = from x in Funs.DB.WBS_BreakdownProject
|
||||
select x;
|
||||
///// <summary>
|
||||
///// 定义变量
|
||||
///// </summary>
|
||||
//private static IQueryable<Model.WBS_BreakdownProject> getDataLists = from x in Funs.DB.WBS_BreakdownProject
|
||||
// select x;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
@@ -191,7 +191,8 @@ namespace FineUIPro.Web.DataShow
|
||||
/// <returns></returns>
|
||||
private int getcount(string projectId, string level)
|
||||
{
|
||||
int count = 0;
|
||||
var getDataLists = from x in Funs.DB.WBS_BreakdownProject select x;
|
||||
int count = 0;
|
||||
count = getDataLists.Where(x => x.ProjectId == projectId && x.Class.Contains(level)).Count();
|
||||
return count;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user