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); var info = GetTestPackageInfo(this.tvControlItem.SelectedNodeID);
//模拟数据 string sql = @"
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"; 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 end ) as FjointCount, --线
c.WelderCode, --
//select * from ( ( case when a.isAll=1 then
//select d.PipelineCode, (select count(1) from View_Pipeline_WeldJoint as vjoint where vjoint.PipelineId=a.PipelineId and vjoint.WelderCode=c.WelderCode)
//(select MaterialCode from Base_Material as m where d.MainMaterialId=m.MaterialId) as MaterialCode , else
//d.Specification, (select count(1) from View_Pipeline_WeldJoint as vjoint where vjoint.PipelineId=a.PipelineId
//(select count(1) from Pipeline_WeldJoint as joint where joint.PipelineId=a.PipelineId) as jointCount, --当前管线的焊口总数 and CHARINDEX(','+vjoint.WeldJointCode+',',','+a.WeldJonintCode+'')>0 and vjoint.WelderCode=c.WelderCode)
// ( case when a.isAll=1 then end ) as WelderNum,
// (select count(1) from Pipeline_WeldJoint as joint where joint.PipelineId=a.PipelineId and joint.JointAttribute='固定F') (case when a.isAll=1 then
// else (select count(1) from Batch_NDEItem as nde inner join Batch_BatchTrustItem as trust
// (select count(1) from Pipeline_WeldJoint as joint where joint.PipelineId=a.PipelineId and joint.JointAttribute='固定' and CHARINDEX(','+joint.WeldJointCode+',',','+a.WeldJonintCode+'')>0) ON trust.TrustBatchItemId = nde.TrustBatchItemId
inner join View_Pipeline_WeldJoint as joint
// end ) as FjointCount, --当前管线的焊口的固定口总数 ON joint.WeldJointId=trust.WeldJointId
//c.WelderCode, --焊工号 where joint.PipelineId=a.PipelineId and joint.WelderCode=c.WelderCode)
// ( case when a.isAll=1 then else
// (select count(1) from View_Pipeline_WeldJoint as vjoint where vjoint.PipelineId=a.PipelineId and vjoint.WelderCode=c.WelderCode) (
// else select count(1) from Batch_NDEItem as nde inner join Batch_BatchTrustItem as trust
// (select count(1) from View_Pipeline_WeldJoint as vjoint where vjoint.PipelineId=a.PipelineId ON trust.TrustBatchItemId = nde.TrustBatchItemId
// and CHARINDEX(','+vjoint.WeldJointCode+',',','+a.WeldJonintCode+'')>0 and vjoint.WelderCode=c.WelderCode) inner join View_Pipeline_WeldJoint as joint
// end ) as WelderNum, ON joint.WeldJointId=trust.WeldJointId
// (case when a.isAll=1 then where joint.PipelineId=a.PipelineId and CHARINDEX(','+joint.WeldJointCode+',',','+a.WeldJonintCode+'')>0 and joint.WelderCode=c.WelderCode
// (select count(1) from Batch_NDEItem as nde inner join Batch_BatchTrustItem as trust )
// ON trust.TrustBatchItemId = nde.TrustBatchItemId end
// inner join View_Pipeline_WeldJoint as joint ) as NdeNum, --
// ON joint.WeldJointId=trust.WeldJointId (case when a.isAll=1 then
// where joint.PipelineId=a.PipelineId and joint.WelderCode=c.WelderCode) (select count(1) from Batch_NDEItem as nde inner join Batch_BatchTrustItem as trust
// else ON trust.TrustBatchItemId = nde.TrustBatchItemId
// ( inner join View_Pipeline_WeldJoint as joint
// select count(1) from Batch_NDEItem as nde inner join Batch_BatchTrustItem as trust ON joint.WeldJointId=trust.WeldJointId
// ON trust.TrustBatchItemId = nde.TrustBatchItemId where joint.PipelineId=a.PipelineId and joint.JointAttribute='F' and joint.WelderCode=c.WelderCode)
// inner join View_Pipeline_WeldJoint as joint else
// ON joint.WeldJointId=trust.WeldJointId (
// where joint.PipelineId=a.PipelineId and CHARINDEX(','+joint.WeldJointCode+',',','+a.WeldJonintCode+'')>0 and joint.WelderCode=c.WelderCode select count(1) from Batch_NDEItem as nde inner join Batch_BatchTrustItem as trust
// ) ON trust.TrustBatchItemId = nde.TrustBatchItemId
// end inner join View_Pipeline_WeldJoint as joint
// ) as NdeNum, --检测口数量 ON joint.WeldJointId=trust.WeldJointId
// (case when a.isAll=1 then where joint.PipelineId=a.PipelineId and CHARINDEX(','+joint.WeldJointCode+',',','+a.WeldJonintCode+'')>0 and joint.JointAttribute='F' and joint.WelderCode=c.WelderCode
// (select count(1) from Batch_NDEItem as nde inner join Batch_BatchTrustItem as trust )
// ON trust.TrustBatchItemId = nde.TrustBatchItemId end
// inner join View_Pipeline_WeldJoint as joint ) as FNdeNum , --
// ON joint.WeldJointId=trust.WeldJointId (
// where joint.PipelineId=a.PipelineId and joint.JointAttribute='固定F' and joint.WelderCode=c.WelderCode) case when a.isAll=1 then
// else (stuff((select ','+nde.NDEReportNo from Batch_NDEItem as nde inner join Batch_BatchTrustItem as trust
// ( ON trust.TrustBatchItemId = nde.TrustBatchItemId
// select count(1) from Batch_NDEItem as nde inner join Batch_BatchTrustItem as trust inner join View_Pipeline_WeldJoint as joint
// ON trust.TrustBatchItemId = nde.TrustBatchItemId ON joint.WeldJointId=trust.WeldJointId
// inner join View_Pipeline_WeldJoint as joint where joint.PipelineId=a.PipelineId and joint.WelderCode=c.WelderCode FOR xml path ('') ),1,1,''))
// ON joint.WeldJointId=trust.WeldJointId else
// where joint.PipelineId=a.PipelineId and CHARINDEX(','+joint.WeldJointCode+',',','+a.WeldJonintCode+'')>0 and joint.JointAttribute='固定F' and joint.WelderCode=c.WelderCode (stuff((select ','+nde.NDEReportNo from Batch_NDEItem as nde inner join Batch_BatchTrustItem as trust
// ) ON trust.TrustBatchItemId = nde.TrustBatchItemId
// end inner join View_Pipeline_WeldJoint as joint
// ) as FNdeNum , --检测固定口数量 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,'') )
// case when a.isAll=1 then end) as NdeReportNo
// (stuff((select ','+nde.NDEReportNo from Batch_NDEItem as nde inner join Batch_BatchTrustItem as trust from
// ON trust.TrustBatchItemId = nde.TrustBatchItemId PTP_PipelineList as a inner join
// inner join View_Pipeline_WeldJoint as joint PTP_TestPackage as b on a.PTP_ID=b.PTP_ID
// ON joint.WeldJointId=trust.WeldJointId inner join View_Pipeline_WeldJoint as c
// where joint.PipelineId=a.PipelineId and joint.WelderCode=c.WelderCode FOR xml path ('') ),1,1,'')) on c.PipelineId=a.PipelineId
// else inner join Pipeline_Pipeline as d
// (stuff((select ','+nde.NDEReportNo from Batch_NDEItem as nde inner join Batch_BatchTrustItem as trust on c.PipelineId=d.PipelineId
// ON trust.TrustBatchItemId = nde.TrustBatchItemId where b.PTP_ID=@PTPID and b.ProjectId=@projectId
// inner join View_Pipeline_WeldJoint as joint ) as t
// ON joint.WeldJointId=trust.WeldJointId group by t.PipelineCode,t.MaterialCode,t.Specification,t.jointCount,t.FjointCount,t.WelderCode,t.WelderNum,t.NdeNum,t.FNdeNum,t.NdeReportNo";
// 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 = SqlParameter[] parms =
{ {