This commit is contained in:
佘春生 2024-06-14 09:05:32 +08:00
commit 2ffb58808e
1 changed files with 74 additions and 78 deletions

View File

@ -3996,85 +3996,81 @@ namespace FineUIPro.Web.WeldingProcess.TestPackageManage
{
var info = GetTestPackageInfo(this.tvControlItem.SelectedNodeID);
//模拟数据
string sql = "SELECT top 5 'AA' PipelineCode,'BB' MaterialCode,'CC' Specification,'DD' jointCount,'EE' FjointCount,'W1' WelderCode,'3' WelderNum,'1' NdeNum,'11' FNdeNum,'2' NdeReportNo FROM Sys_User union all SELECT top 6 'FF' PipelineCode,'GG' MaterialCode,'HH' Specification,'II' jointCount,'JJ' FjointCount,'W2' WelderCode,'3' WelderNum,'1' NdeNum,'2' FNdeNum,'D2' NdeReportNo FROM Sys_User union all SELECT top 7 'KK' PipelineCode,'LL' MaterialCode,'MM' Specification,'NN' jointCount,'OO' FjointCount,'W3' WelderCode,'3' WelderNum,'1' NdeNum,'2' FNdeNum,'D3' NdeReportNo FROM Sys_User union all SELECT top 1 '1' PipelineCode,'2' MaterialCode,'3' Specification,'4' jointCount,'5' FjointCount,'6' WelderCode,'3' WelderNum,'1' NdeNum,'2' FNdeNum,'D3' NdeReportNo FROM Sys_User";
string sql = @"
select * from (
select d.PipelineCode,
(select MaterialCode from Base_Material as m where d.MainMaterialId=m.MaterialId) as MaterialCode ,
d.Specification,
(select count(1) from Pipeline_WeldJoint as joint where joint.PipelineId=a.PipelineId) as jointCount, --线
( case when a.isAll=1 then
(select count(1) from Pipeline_WeldJoint as joint where joint.PipelineId=a.PipelineId and joint.JointAttribute='F')
else
(select count(1) from Pipeline_WeldJoint as joint where joint.PipelineId=a.PipelineId and joint.JointAttribute='' and CHARINDEX(','+joint.WeldJointCode+',',','+a.WeldJonintCode+'')>0)
// string sql = @"use HJGLDB_ZJBSF
//select * from (
//select d.PipelineCode,
//(select MaterialCode from Base_Material as m where d.MainMaterialId=m.MaterialId) as MaterialCode ,
//d.Specification,
//(select count(1) from Pipeline_WeldJoint as joint where joint.PipelineId=a.PipelineId) as jointCount, --当前管线的焊口总数
// ( case when a.isAll=1 then
// (select count(1) from Pipeline_WeldJoint as joint where joint.PipelineId=a.PipelineId and joint.JointAttribute='固定F')
// else
// (select count(1) from Pipeline_WeldJoint as joint where joint.PipelineId=a.PipelineId and joint.JointAttribute='固定' and CHARINDEX(','+joint.WeldJointCode+',',','+a.WeldJonintCode+'')>0)
// end ) as FjointCount, --当前管线的焊口的固定口总数
//c.WelderCode, --焊工号
// ( case when a.isAll=1 then
// (select count(1) from View_Pipeline_WeldJoint as vjoint where vjoint.PipelineId=a.PipelineId and vjoint.WelderCode=c.WelderCode)
// else
// (select count(1) from View_Pipeline_WeldJoint as vjoint where vjoint.PipelineId=a.PipelineId
// and CHARINDEX(','+vjoint.WeldJointCode+',',','+a.WeldJonintCode+'')>0 and vjoint.WelderCode=c.WelderCode)
// end ) as WelderNum,
// (case when a.isAll=1 then
// (select count(1) from Batch_NDEItem as nde inner join Batch_BatchTrustItem as trust
// ON trust.TrustBatchItemId = nde.TrustBatchItemId
// inner join View_Pipeline_WeldJoint as joint
// ON joint.WeldJointId=trust.WeldJointId
// where joint.PipelineId=a.PipelineId and joint.WelderCode=c.WelderCode)
// else
// (
// select count(1) from Batch_NDEItem as nde inner join Batch_BatchTrustItem as trust
// ON trust.TrustBatchItemId = nde.TrustBatchItemId
// inner join View_Pipeline_WeldJoint as joint
// ON joint.WeldJointId=trust.WeldJointId
// where joint.PipelineId=a.PipelineId and CHARINDEX(','+joint.WeldJointCode+',',','+a.WeldJonintCode+'')>0 and joint.WelderCode=c.WelderCode
// )
// end
// ) as NdeNum, --检测口数量
// (case when a.isAll=1 then
// (select count(1) from Batch_NDEItem as nde inner join Batch_BatchTrustItem as trust
// ON trust.TrustBatchItemId = nde.TrustBatchItemId
// inner join View_Pipeline_WeldJoint as joint
// ON joint.WeldJointId=trust.WeldJointId
// where joint.PipelineId=a.PipelineId and joint.JointAttribute='固定F' and joint.WelderCode=c.WelderCode)
// else
// (
// select count(1) from Batch_NDEItem as nde inner join Batch_BatchTrustItem as trust
// ON trust.TrustBatchItemId = nde.TrustBatchItemId
// inner join View_Pipeline_WeldJoint as joint
// ON joint.WeldJointId=trust.WeldJointId
// where joint.PipelineId=a.PipelineId and CHARINDEX(','+joint.WeldJointCode+',',','+a.WeldJonintCode+'')>0 and joint.JointAttribute='固定F' and joint.WelderCode=c.WelderCode
// )
// end
// ) as FNdeNum , --检测固定口数量
// (
// case when a.isAll=1 then
// (stuff((select ','+nde.NDEReportNo from Batch_NDEItem as nde inner join Batch_BatchTrustItem as trust
// ON trust.TrustBatchItemId = nde.TrustBatchItemId
// inner join View_Pipeline_WeldJoint as joint
// ON joint.WeldJointId=trust.WeldJointId
// where joint.PipelineId=a.PipelineId and joint.WelderCode=c.WelderCode FOR xml path ('') ),1,1,''))
// else
// (stuff((select ','+nde.NDEReportNo from Batch_NDEItem as nde inner join Batch_BatchTrustItem as trust
// ON trust.TrustBatchItemId = nde.TrustBatchItemId
// inner join View_Pipeline_WeldJoint as joint
// ON joint.WeldJointId=trust.WeldJointId
// where joint.PipelineId=a.PipelineId and CHARINDEX(','+joint.WeldJointCode+',',','+a.WeldJonintCode+'')>0 and joint.WelderCode=c.WelderCode FOR xml path ( '' ) ),1,1,'') )
// end) as NdeReportNo
//from
//PTP_PipelineList as a inner join
//PTP_TestPackage as b on a.PTP_ID=b.PTP_ID
//inner join View_Pipeline_WeldJoint as c
//on c.PipelineId=a.PipelineId
//inner join Pipeline_Pipeline as d
//on c.PipelineId=d.PipelineId
//where b.PTP_ID=@PTPID and b.ProjectId=@projectId
//) as t
//group by t.PipelineCode,t.MaterialCode,t.Specification,t.jointCount,t.FjointCount,t.WelderCode,t.WelderNum,t.NdeNum,t.FNdeNum,t.NdeReportNo";
end ) as FjointCount, --线
c.WelderCode, --
( case when a.isAll=1 then
(select count(1) from View_Pipeline_WeldJoint as vjoint where vjoint.PipelineId=a.PipelineId and vjoint.WelderCode=c.WelderCode)
else
(select count(1) from View_Pipeline_WeldJoint as vjoint where vjoint.PipelineId=a.PipelineId
and CHARINDEX(','+vjoint.WeldJointCode+',',','+a.WeldJonintCode+'')>0 and vjoint.WelderCode=c.WelderCode)
end ) as WelderNum,
(case when a.isAll=1 then
(select count(1) from Batch_NDEItem as nde inner join Batch_BatchTrustItem as trust
ON trust.TrustBatchItemId = nde.TrustBatchItemId
inner join View_Pipeline_WeldJoint as joint
ON joint.WeldJointId=trust.WeldJointId
where joint.PipelineId=a.PipelineId and joint.WelderCode=c.WelderCode)
else
(
select count(1) from Batch_NDEItem as nde inner join Batch_BatchTrustItem as trust
ON trust.TrustBatchItemId = nde.TrustBatchItemId
inner join View_Pipeline_WeldJoint as joint
ON joint.WeldJointId=trust.WeldJointId
where joint.PipelineId=a.PipelineId and CHARINDEX(','+joint.WeldJointCode+',',','+a.WeldJonintCode+'')>0 and joint.WelderCode=c.WelderCode
)
end
) as NdeNum, --
(case when a.isAll=1 then
(select count(1) from Batch_NDEItem as nde inner join Batch_BatchTrustItem as trust
ON trust.TrustBatchItemId = nde.TrustBatchItemId
inner join View_Pipeline_WeldJoint as joint
ON joint.WeldJointId=trust.WeldJointId
where joint.PipelineId=a.PipelineId and joint.JointAttribute='F' and joint.WelderCode=c.WelderCode)
else
(
select count(1) from Batch_NDEItem as nde inner join Batch_BatchTrustItem as trust
ON trust.TrustBatchItemId = nde.TrustBatchItemId
inner join View_Pipeline_WeldJoint as joint
ON joint.WeldJointId=trust.WeldJointId
where joint.PipelineId=a.PipelineId and CHARINDEX(','+joint.WeldJointCode+',',','+a.WeldJonintCode+'')>0 and joint.JointAttribute='F' and joint.WelderCode=c.WelderCode
)
end
) as FNdeNum , --
(
case when a.isAll=1 then
(stuff((select ','+nde.NDEReportNo from Batch_NDEItem as nde inner join Batch_BatchTrustItem as trust
ON trust.TrustBatchItemId = nde.TrustBatchItemId
inner join View_Pipeline_WeldJoint as joint
ON joint.WeldJointId=trust.WeldJointId
where joint.PipelineId=a.PipelineId and joint.WelderCode=c.WelderCode FOR xml path ('') ),1,1,''))
else
(stuff((select ','+nde.NDEReportNo from Batch_NDEItem as nde inner join Batch_BatchTrustItem as trust
ON trust.TrustBatchItemId = nde.TrustBatchItemId
inner join View_Pipeline_WeldJoint as joint
ON joint.WeldJointId=trust.WeldJointId
where joint.PipelineId=a.PipelineId and CHARINDEX(','+joint.WeldJointCode+',',','+a.WeldJonintCode+'')>0 and joint.WelderCode=c.WelderCode FOR xml path ( '' ) ),1,1,'') )
end) as NdeReportNo
from
PTP_PipelineList as a inner join
PTP_TestPackage as b on a.PTP_ID=b.PTP_ID
inner join View_Pipeline_WeldJoint as c
on c.PipelineId=a.PipelineId
inner join Pipeline_Pipeline as d
on c.PipelineId=d.PipelineId
where b.PTP_ID=@PTPID and b.ProjectId=@projectId
) as t
group by t.PipelineCode,t.MaterialCode,t.Specification,t.jointCount,t.FjointCount,t.WelderCode,t.WelderNum,t.NdeNum,t.FNdeNum,t.NdeReportNo";
SqlParameter[] parms =
{