Compare commits

..

No commits in common. "74a2cd0399228c60213afaeb74758cb46d35c0cc" and "05801d8e582a1b1282f4fbf4c094c56690f2dc71" have entirely different histories.

2 changed files with 52 additions and 81 deletions

Binary file not shown.

View File

@ -3998,82 +3998,53 @@ namespace FineUIPro.Web.WeldingProcess.TestPackageManage
////模拟数据 ////模拟数据
//string sql = "SELECT '' AS totalNum,'' TestPackageNo,'' PipelineId,'模拟数据' PipelineCode,'' Specification,'' MaterialCode,'' WelderCode,'' FNum,'' NdeNum,'' FNdeNum,'' NdeCode from Sys_User union all SELECT '' AS totalNum,'' TestPackageNo,'' PipelineId,'模拟数据' PipelineCode,'' Specification,'' MaterialCode,'' WelderCode,'' FNum,'' NdeNum,'' FNdeNum,'' NdeCode from Sys_User union all SELECT '' AS totalNum,'' TestPackageNo,'' PipelineId,'模拟数据' PipelineCode,'' Specification,'' MaterialCode,'' WelderCode,'' FNum,'' NdeNum,'' FNdeNum,'' NdeCode from Sys_User"; //string sql = "SELECT '' AS totalNum,'' TestPackageNo,'' PipelineId,'模拟数据' PipelineCode,'' Specification,'' MaterialCode,'' WelderCode,'' FNum,'' NdeNum,'' FNdeNum,'' NdeCode from Sys_User union all SELECT '' AS totalNum,'' TestPackageNo,'' PipelineId,'模拟数据' PipelineCode,'' Specification,'' MaterialCode,'' WelderCode,'' FNum,'' NdeNum,'' FNdeNum,'' NdeCode from Sys_User union all SELECT '' AS totalNum,'' TestPackageNo,'' PipelineId,'模拟数据' PipelineCode,'' Specification,'' MaterialCode,'' WelderCode,'' FNum,'' NdeNum,'' FNdeNum,'' NdeCode from Sys_User";
string sql = @"use HJGLDB_ZJBSF string sql = @"SELECT H.*,
Ma.MaterialCode, PPline.Specification FROM
select * from ( ( SELECT COUNT ( 1 ) AS totalNum,t.TestPackageNo,t.PipelineId,T.PipelineCode,t.WelderCode,
select d.PipelineCode, ( SELECT COUNT( 1 ) FROM dbo.View_Pipeline_WeldJoint AS jot
(select MaterialCode from Base_Material as m where d.MainMaterialId=m.MaterialId) as MaterialCode , WHERE jot.PipelineId= T.PipelineId AND jot.WelderCode= t.WelderCode AND jot.JointAttribute= 'F'
d.Specification, ) AS FNum,
(select count(1) from Pipeline_WeldJoint as joint where joint.PipelineId=a.PipelineId) as jointCount, --线 SUM ( T.NdeNum ) AS NdeNum,
( case when a.isAll=1 then SUM ( t.FNdeNum ) AS FNdeNum,
(select count(1) from Pipeline_WeldJoint as joint where joint.PipelineId=a.PipelineId and joint.JointAttribute='F') NdeCode
else FROM ( SELECT
(select count(1) from Pipeline_WeldJoint as joint where joint.PipelineId=a.PipelineId and joint.JointAttribute='' and CHARINDEX(','+joint.WeldJointCode+',',','+a.WeldJonintCode+'')>0) a.TestPackageNo,b.PipelineId,c.PipelineCode,c.WeldJointId,c.WelderCode,
(SELECT COUNT( 1 ) FROM dbo.Batch_NDEItem nde
end ) as FjointCount, --线 LEFT JOIN dbo.Batch_BatchTrustItem trust ON trust.TrustBatchItemId = nde.TrustBatchItemId
c.WelderCode, -- WHERE trust.WeldJointId= c.WeldJointId ) AS NdeNum,--
( case when a.isAll=1 then STUFF((SELECT nde.NDEReportNo FROM dbo.Batch_NDEItem nde
(select count(1) from View_Pipeline_WeldJoint as vjoint where vjoint.PipelineId=a.PipelineId and vjoint.WelderCode=c.WelderCode) LEFT JOIN dbo.Batch_BatchTrustItem trust ON trust.TrustBatchItemId = nde.TrustBatchItemId
else WHERE trust.WeldJointId= c.WeldJointId FOR xml path ( '' ) ),1,1,'' ) AS NdeCode,--
(select count(1) from View_Pipeline_WeldJoint as vjoint where vjoint.PipelineId=a.PipelineId (SELECT COUNT( 1 ) FROM dbo.Batch_NDEItem nde
and CHARINDEX(','+vjoint.WeldJointCode+',',','+a.WeldJonintCode+'')>0 and vjoint.WelderCode=c.WelderCode) LEFT JOIN dbo.Batch_BatchTrustItem trust ON trust.TrustBatchItemId = nde.TrustBatchItemId
end ) as WelderNum, LEFT JOIN dbo.Pipeline_WeldJoint j ON j.WeldJointId = trust.WeldJointId
(case when a.isAll=1 then WHERE trust.WeldJointId= c.WeldJointId AND j.JointAttribute= 'F' ) AS FNdeNum --
(select count(1) from Batch_NDEItem as nde inner join Batch_BatchTrustItem as trust FROM dbo.PTP_TestPackage AS a
ON trust.TrustBatchItemId = nde.TrustBatchItemId INNER JOIN dbo.PTP_PipelineList AS b ON a.PTP_ID= b.PTP_ID
inner join View_Pipeline_WeldJoint as joint LEFT JOIN dbo.View_Pipeline_WeldJoint AS C ON b.PipelineId= c.PipelineId
ON joint.WeldJointId=trust.WeldJointId LEFT JOIN dbo.Pipeline_Pipeline AS d ON b.PipelineId= d.PipelineId
where joint.PipelineId=a.PipelineId and joint.WelderCode=c.WelderCode) WHERE b.isAll= 1 and a.ProjectId=@projectId and a.PTP_ID=@PTPID
else UNION ALL
( SELECT a.TestPackageNo, b.PipelineId,d.PipelineCode,c.WeldJointId,c.WelderCode,
select count(1) from Batch_NDEItem as nde inner join Batch_BatchTrustItem as trust (SELECT COUNT( 1 )
ON trust.TrustBatchItemId = nde.TrustBatchItemId FROM dbo.Batch_NDEItem nde LEFT JOIN dbo.Batch_BatchTrustItem trust ON trust.TrustBatchItemId = nde.TrustBatchItemId
inner join View_Pipeline_WeldJoint as joint WHERE trust.WeldJointId= c.WeldJointId ) AS NdeNum,--
ON joint.WeldJointId=trust.WeldJointId STUFF((SELECT nde.NDEReportNo FROM dbo.Batch_NDEItem nde
where joint.PipelineId=a.PipelineId and CHARINDEX(','+joint.WeldJointCode+',',','+a.WeldJonintCode+'')>0 and joint.WelderCode=c.WelderCode LEFT JOIN dbo.Batch_BatchTrustItem trust ON trust.TrustBatchItemId = nde.TrustBatchItemId
) WHERE trust.WeldJointId= c.WeldJointId FOR xml path ( '' ) ),1,1,'' ) AS NdeCode,--
end (SELECT COUNT( 1 )
) as NdeNum, -- FROM dbo.Batch_NDEItem nde LEFT JOIN dbo.Batch_BatchTrustItem trust ON trust.TrustBatchItemId = nde.TrustBatchItemId
(case when a.isAll=1 then LEFT JOIN dbo.Pipeline_WeldJoint j ON j.WeldJointId = trust.WeldJointId
(select count(1) from Batch_NDEItem as nde inner join Batch_BatchTrustItem as trust WHERE trust.WeldJointId= c.WeldJointId AND j.JointAttribute= 'F' ) AS FNdeNum --
ON trust.TrustBatchItemId = nde.TrustBatchItemId FROM dbo.PTP_TestPackage AS a INNER JOIN dbo.PTP_PipelineList AS b ON a.PTP_ID= b.PTP_ID
inner join View_Pipeline_WeldJoint as joint LEFT JOIN dbo.View_Pipeline_WeldJoint AS C ON b.PipelineId= c.PipelineId
ON joint.WeldJointId=trust.WeldJointId LEFT JOIN dbo.Pipeline_Pipeline AS d ON b.PipelineId= d.PipelineId
where joint.PipelineId=a.PipelineId and joint.JointAttribute='F' and joint.WelderCode=c.WelderCode) WHERE b.isAll= 0 AND PATINDEX( '%' + c.WeldJointCode+ '%', b.WeldJonintCode ) > 0
else and a.ProjectId=@projectId and a.PTP_ID=@PTPID
( ) AS t
select count(1) from Batch_NDEItem as nde inner join Batch_BatchTrustItem as trust GROUP BY t.TestPackageNo, t.PipelineCode, t.WelderCode, t.PipelineId, t.NdeCode ) AS H
ON trust.TrustBatchItemId = nde.TrustBatchItemId LEFT JOIN Pipeline_Pipeline AS PPline ON H.PipelineId= PPline.PipelineId
inner join View_Pipeline_WeldJoint as joint LEFT JOIN Base_Material AS Ma ON PPline.MainMaterialId= Ma.MaterialId";
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 = SqlParameter[] parms =
{ {
@ -4269,14 +4240,14 @@ group by t.PipelineCode,t.MaterialCode,t.Specification,t.jointCount,t.FjointCoun
ws.GetRow(dataIndex).GetCell(0).SetCellValue(dr["PipelineCode"].ToString()); ws.GetRow(dataIndex).GetCell(0).SetCellValue(dr["PipelineCode"].ToString());
ws.GetRow(dataIndex).GetCell(2).SetCellValue(dr["MaterialCode"].ToString()); ws.GetRow(dataIndex).GetCell(2).SetCellValue(dr["MaterialCode"].ToString());
ws.GetRow(dataIndex).GetCell(3).SetCellValue(dr["Specification"].ToString()); ws.GetRow(dataIndex).GetCell(3).SetCellValue(dr["Specification"].ToString());
ws.GetRow(dataIndex).GetCell(5).SetCellValue(dr["jointCount"].ToString()); ws.GetRow(dataIndex).GetCell(5).SetCellValue(dr["totalNum"].ToString());
ws.GetRow(dataIndex).GetCell(7).SetCellValue(dr["fjointCount"].ToString()); ws.GetRow(dataIndex).GetCell(7).SetCellValue(dr["Fnum"].ToString());
ws.GetRow(dataIndex).GetCell(9).SetCellValue(dr["WelderCode"].ToString()); ws.GetRow(dataIndex).GetCell(9).SetCellValue(dr["WelderCode"].ToString());
ws.GetRow(dataIndex).GetCell(11).SetCellValue(dr["WelderNum"].ToString()); ws.GetRow(dataIndex).GetCell(11).SetCellValue(dr["Fnum"].ToString());
ws.GetRow(dataIndex).GetCell(13).SetCellValue(dr["NdeNum"].ToString()); ws.GetRow(dataIndex).GetCell(13).SetCellValue(dr["NdeNum"].ToString());
ws.GetRow(dataIndex).GetCell(15).SetCellValue(dr["FNdeNum"].ToString()); ws.GetRow(dataIndex).GetCell(15).SetCellValue(dr["FNdeNum"].ToString());
string a = string.IsNullOrEmpty(dr["NdeNum"].ToString()) ? "0" : dr["NdeNum"].ToString(); string a = string.IsNullOrEmpty(dr["NdeNum"].ToString()) ? "0" : dr["NdeNum"].ToString();
string b = string.IsNullOrEmpty(dr["WelderNum"].ToString()) ? "0" : dr["WelderNum"].ToString(); string b = string.IsNullOrEmpty(dr["Fnum"].ToString()) ? "0" : dr["Fnum"].ToString();
if (b == "0") if (b == "0")
{ {
@ -4287,7 +4258,7 @@ group by t.PipelineCode,t.MaterialCode,t.Specification,t.jointCount,t.FjointCoun
decimal rate = Math.Round((decimal.Parse(a) / decimal.Parse(b)), 2); decimal rate = Math.Round((decimal.Parse(a) / decimal.Parse(b)), 2);
ws.GetRow(dataIndex).GetCell(17).SetCellValue($"{rate * 100}%"); ws.GetRow(dataIndex).GetCell(17).SetCellValue($"{rate * 100}%");
} }
ws.GetRow(dataIndex).GetCell(20).SetCellValue(dr["NdeReportNo"].ToString()); ws.GetRow(dataIndex).GetCell(20).SetCellValue(dr["NdeCode"].ToString());
} }
j++; j++;
} }