更改PMI代码
This commit is contained in:
@@ -37,74 +37,28 @@ namespace FineUIPro.Web.WeldingProcess.PMI
|
||||
/// </summary>
|
||||
private void BindGrid()
|
||||
{
|
||||
string sql = @"select *from (
|
||||
select
|
||||
projectId,
|
||||
InstallationId,
|
||||
WorkAreaId,
|
||||
UnitId,
|
||||
PipelineId,
|
||||
InstallationCode,
|
||||
WorkAreaCode,
|
||||
PipelineCode,
|
||||
PMINum,
|
||||
isnull((convert(float,PMIBySNum)/NULLIF(convert(float,PMINum),0)*100),0) as RateBys,
|
||||
PMIBySNum,
|
||||
isnull( (convert(float,PMIByFNum)/NULLIF(convert(float,PMINum),0)*100),0) as RateByf,
|
||||
PMIByFNum
|
||||
from (
|
||||
select
|
||||
a.projectId,
|
||||
a.InstallationId,
|
||||
a.WorkAreaId,
|
||||
a.UnitId,
|
||||
a.PipelineId,
|
||||
b.InstallationCode,
|
||||
c.WorkAreaCode,
|
||||
a.PipelineCode,
|
||||
(select count(1) from Pipeline_WeldJoint as d where isPMI=1 and d.PipelineId=a.PipelineId) as PMINum,
|
||||
(
|
||||
select count(1) from PMI_Delegation as pd inner join PMI_DelegationDetails as pdd on pd.Id=pdd.PMIId
|
||||
inner join Pipeline_WeldJoint as pwj on pdd.JointId=pwj.WeldJointId
|
||||
where pd.InstallationId=a.InstallationId and pd.UnitId=a.UnitId and pdd.WorkAreaId=a.WorkAreaId
|
||||
and pwj.PipelineId=a.PipelineId and pwj.JointAttribute='活动S' and pwj.isPMI=1
|
||||
) as PMIBySNum,
|
||||
(
|
||||
select count(1) from PMI_Delegation as pd inner join PMI_DelegationDetails as pdd on pd.Id=pdd.PMIId
|
||||
inner join Pipeline_WeldJoint as pwj on pdd.JointId=pwj.WeldJointId
|
||||
where pd.InstallationId=a.InstallationId and pd.UnitId=a.UnitId and pdd.WorkAreaId=a.WorkAreaId
|
||||
and pwj.PipelineId=a.PipelineId and pwj.JointAttribute='固定F' and pwj.isPMI=1
|
||||
) as PMIByFNum
|
||||
from Pipeline_Pipeline as a
|
||||
left join Project_Installation as b on a.InstallationId=b.InstallationId
|
||||
left join Project_WorkArea as c on a.WorkAreaId=c.WorkAreaId
|
||||
) as t
|
||||
) as H where projectId=@projectId ";
|
||||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||||
listStr.Add(new SqlParameter("@projectId", this.CurrUser.LoginProjectId));
|
||||
var query = Funs.DB.View_PMIDetections.Where(t => t.ProjectId == this.CurrUser.LoginProjectId).AsQueryable();
|
||||
|
||||
|
||||
if (this.drpUnitId.SelectedValue != BLL.Const._Null)
|
||||
{
|
||||
sql += " and UnitId=@unitId";
|
||||
listStr.Add(new SqlParameter("@unitId", this.drpUnitId.SelectedValue));
|
||||
query = query.Where(t => t.UnitId == this.drpUnitId.SelectedValue);
|
||||
}
|
||||
if (this.drpWorkAreaId.SelectedValue != BLL.Const._Null)
|
||||
{
|
||||
sql += " and WorkAreaId=@workAreaId ";
|
||||
listStr.Add(new SqlParameter("@workAreaId", this.drpWorkAreaId.SelectedValue));
|
||||
query = query.Where(t => t.WorkAreaId == this.drpWorkAreaId.SelectedValue);
|
||||
}
|
||||
if (this.drpIsALl.SelectedValue=="报警")
|
||||
{
|
||||
sql += " and ((RateBys<=2 and PMIBySNum<=2) or RateByf<=2 and PMIByFNum<=2)";
|
||||
query = query.Where(t=>(t.RateBys<=2 && t.PMIBySNum<=2) || (t.RateByf<=2 && t.PMIByFNum<=2));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(this.txtPipelineCode.Text))
|
||||
{
|
||||
sql += " and PipelineCode like '%'+@PipelineCode+'%'";
|
||||
listStr.Add(new SqlParameter("@PipelineCode", this.txtPipelineCode.Text.Trim()));
|
||||
query = query.Where(t => t.PipelineCode.Contains(this.txtPipelineCode.Text));
|
||||
}
|
||||
SqlParameter[] parameter = listStr.ToArray();
|
||||
DataTable tb = SQLHelper.GetDataTableRunText(sql, parameter);
|
||||
this.Grid1.RecordCount = tb.Rows.Count;
|
||||
var table = this.GetPagedDataTable(Grid1, tb);
|
||||
var dataList=query.ToList();
|
||||
this.Grid1.RecordCount = dataList.Count;
|
||||
var table = this.GetPagedDataTable(Grid1, dataList);
|
||||
Grid1.DataSource = table;
|
||||
Grid1.DataBind();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user