//Model.Sys_UserShowColumns c = BLL.UserShowColumnsService.GetColumnsByUserId(this.CurrUser.UserId, Const.UnitAreaQualityMenuId);
//if (c != null)
//{
// this.GetShowColumn(c.Columns);
//}
//BindGrid();
}
}
#endregion
#region绑定BindGrid
/// <summary>
/// 绑定数据
/// </summary>
privatevoidBindGrid()
{
stringstrSql=@"select 1 id,a.WorkAreaCode,a.WorkAreaId,c.UnitName TrustName ,b.UnitId TrustUnitId ,e.UnitName CheckName ,h.DetectionTypeName,d.UnitId CheckUnitId ,f.CH_NDTMethod,f.trustTotalNum,g.CheckTotalNum,f.trustTotalNum-g.CheckTotalNum NotCheck,100*g.CheckTotalNum/f.trustTotalNum HasPer from ProjectData_WorkArea a
left join Project_ProjectUnit b on b.ProjectId = a.ProjectId and b.UnitType='2' and a.UnitId =b.UnitId
left join Base_Unit c on c.UnitId=b.UnitId
left join Project_ProjectUnit d on d.ProjectId = a.ProjectId and d.UnitType='6'
left join Base_Unit e on e.UnitId=d.UnitId
left join (
select a.CH_TrustUnit,a.CH_CheckUnit,a.CH_NDTMethod,WorkAreaId,count(distinct b.JOT_ID)TrustTotalNum from CH_Trust a left join CH_TrustItem b on a.CH_TrustID=b.CH_TrustID
LEFT JOIN pw_jointinfo c on c.JOT_ID=b.JOT_ID LEFT JOIN pw_isoinfo ON c.ISO_ID = pw_isoinfo.ISO_ID
where a.ProjectId=@ProjectId and a.CH_AuditDate is not null and (pw_isoinfo.Is_Standard=@IsStandard OR @IsStandard ='')
group by a.CH_TrustUnit,a.CH_CheckUnit,a.CH_NDTMethod,WorkAreaId
) f on f.CH_CheckUnit = d.UnitId and f.CH_TrustUnit=b.UnitId and a.WorkAreaId =f.WorkAreaId
left join (
select a.CH_TrustUnit,a.CH_CheckUnit,a.CH_NDTMethod,WorkAreaId,count(distinct c.JOT_ID)CheckTotalNum from CH_Trust a left join CH_Check b on a.CH_TrustID=b.CH_TrustID
left join CH_CheckItem c on b.CHT_CheckID=c.CHT_CheckID LEFT JOIN pw_jointinfo d on d.JOT_ID=c.JOT_ID LEFT JOIN pw_isoinfo ON d.ISO_ID = pw_isoinfo.ISO_ID
where a.ProjectId=@ProjectId and a.CH_AuditDate is not null and (pw_isoinfo.Is_Standard=@IsStandard OR @IsStandard ='')
group by a.CH_TrustUnit,a.CH_CheckUnit ,a.CH_NDTMethod ,WorkAreaId
) g on g.CH_CheckUnit = d.UnitId and g.CH_TrustUnit=b.UnitId and f.CH_NDTMethod=g.CH_NDTMethod and g.WorkAreaId = a.WorkAreaId
left join Base_DetectionType h on h.DetectionTypeId = f.CH_NDTMethod
where h.DetectionTypeName is not null and a.ProjectId=@ProjectId ";
strSql+=" and a.CH_CheckUnit ='"+this.drpCheckUnit.SelectedValue+"' ";
}
strSql+=" and a.CH_AuditDate >='"+dpDate.SelectedDate.Value.ToString("yyyy-MM-01")+"' and a.CH_AuditDate <'"+dpDate.SelectedDate.Value.AddMonths(1).ToString("yyyy-MM-01")+"'";
strSql+=@" group by a.CH_TrustUnit,a.CH_CheckUnit,WorkAreaId,a.CH_NDTMethod,DAY(CH_AuditDate) ,MONTH(CH_AuditDate) ";
strSql=@" select a.CH_TrustUnit,a.CH_CheckUnit,a.CH_NDTMethod,WorkAreaId,DAY(b.CHT_AuditDate) Day ,MONTH(b.CHT_AuditDate) Month,count(distinct c.JOT_ID)TrustTotalNum from CH_Trust a left join CH_Check b on a.CH_TrustID=b.CH_TrustID
left join CH_CheckItem c on b.CHT_CheckID=c.CHT_CheckID
LEFT JOIN pw_jointinfo e on e.JOT_ID=c.JOT_ID LEFT JOIN pw_isoinfo ON e.ISO_ID = pw_isoinfo.ISO_ID
where (pw_isoinfo.Is_Standard=@IsStandard OR @IsStandard ='') and a.CH_AuditDate is not null and a.ProjectId = '"+this.CurrUser.LoginProjectId+"' ";
if(this.drpUnit.SelectedValue!=BLL.Const._Null)
{
strSql+=" and a.CH_TrustUnit ='"+this.drpUnit.SelectedValue+"' ";
strSql+=" and a.CH_CheckUnit ='"+this.drpCheckUnit.SelectedValue+"' ";
}
strSql+=" and b.CHT_AuditDate >='"+dpDate.SelectedDate.Value.ToString("yyyy-MM-01")+"' and b.CHT_AuditDate <'"+dpDate.SelectedDate.Value.AddMonths(1).ToString("yyyy-MM-01")+"'";
strSql+=@" group by a.CH_TrustUnit,a.CH_CheckUnit,WorkAreaId,a.CH_NDTMethod,DAY(b.CHT_AuditDate) ,MONTH(b.CHT_AuditDate) ";
strSql=@"select a.UnitId,b.UnitName,c.CH_NDTMethod,c.TrustTotalNum,e.DetectionTypeName,d.CheckTotalNum,c.trustTotalNum-d.CheckTotalNum NotCheck,100*d.CheckTotalNum/c.trustTotalNum HasPer from Project_ProjectUnit a
left join Base_Unit b on a.UnitId=b.UnitId
left join (
select a.CH_CheckUnit,a.CH_NDTMethod,count(distinct b.JOT_ID)TrustTotalNum from CH_Trust a left join CH_TrustItem b on a.CH_TrustID=b.CH_TrustID
LEFT JOIN pw_jointinfo c on c.JOT_ID=b.JOT_ID LEFT JOIN pw_isoinfo ON c.ISO_ID = pw_isoinfo.ISO_ID
where a.ProjectId=@ProjectId and a.CH_AuditDate is not null and (pw_isoinfo.Is_Standard=@IsStandard OR @IsStandard ='')
group by a.CH_CheckUnit,a.CH_NDTMethod)
c on a.UnitId = c.CH_CheckUnit
left join (
select a.CH_CheckUnit,a.CH_NDTMethod,count(distinct c.JOT_ID)CheckTotalNum from CH_Trust a left join CH_Check b on a.CH_TrustID=b.CH_TrustID
left join CH_CheckItem c on b.CHT_CheckID=c.CHT_CheckID LEFT JOIN pw_jointinfo d on d.JOT_ID=c.JOT_ID LEFT JOIN pw_isoinfo ON d.ISO_ID = pw_isoinfo.ISO_ID
where a.ProjectId=@ProjectId and c.CHT_FilmDate is not null and (pw_isoinfo.Is_Standard=@IsStandard OR @IsStandard ='')
group by a.CH_CheckUnit ,a.CH_NDTMethod
)d on a.UnitId = d.CH_CheckUnit and d.CH_NDTMethod = c.CH_NDTMethod
left join Base_DetectionType e on e.DetectionTypeId = c.CH_NDTMethod
where a.UnitType = '6' and a.ProjectId=@ProjectId ";
strSql+=" and a.CH_CheckUnit ='"+this.drpCheckUnit.SelectedValue+"' ";
}
strSql+=" and a.CH_AuditDate >='"+dpDate.SelectedDate.Value.ToString("yyyy-MM-01")+"' and a.CH_AuditDate <'"+dpDate.SelectedDate.Value.AddMonths(1).ToString("yyyy-MM-01")+"'";
strSql+=@" group by a.CH_CheckUnit,a.CH_NDTMethod,DAY(CH_AuditDate) ,MONTH(CH_AuditDate) ";
strSql=@" select a.CH_CheckUnit,a.CH_NDTMethod,DAY(b.CHT_AuditDate) Day ,MONTH(b.CHT_AuditDate) Month,count(distinct c.JOT_ID)TrustTotalNum from CH_Trust a left join CH_Check b on a.CH_TrustID=b.CH_TrustID
left join CH_CheckItem c on b.CHT_CheckID=c.CHT_CheckID
LEFT JOIN pw_jointinfo e on e.JOT_ID=c.JOT_ID LEFT JOIN pw_isoinfo ON e.ISO_ID = pw_isoinfo.ISO_ID
where (pw_isoinfo.Is_Standard=@IsStandard OR @IsStandard ='') and c.CHT_FilmDate is not null and a.ProjectId = '"+this.CurrUser.LoginProjectId+"' ";
strSql+=" and a.CH_CheckUnit ='"+this.drpCheckUnit.SelectedValue+"' ";
}
strSql+=" and b.CHT_AuditDate >='"+dpDate.SelectedDate.Value.ToString("yyyy-MM-01")+"' and b.CHT_AuditDate <'"+dpDate.SelectedDate.Value.AddMonths(1).ToString("yyyy-MM-01")+"'";
strSql+=@" group by a.CH_CheckUnit,a.CH_NDTMethod,DAY(b.CHT_AuditDate) ,MONTH(b.CHT_AuditDate) ";