111
This commit is contained in:
commit
fb0e3dc6c7
|
@ -3998,53 +3998,82 @@ 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 H.*,
|
||||
Ma.MaterialCode, PPline.Specification FROM
|
||||
( SELECT COUNT ( 1 ) AS totalNum,t.TestPackageNo,t.PipelineId,T.PipelineCode,t.WelderCode,
|
||||
( SELECT COUNT( 1 ) FROM dbo.View_Pipeline_WeldJoint AS jot
|
||||
WHERE jot.PipelineId= T.PipelineId AND jot.WelderCode= t.WelderCode AND jot.JointAttribute= '固定F'
|
||||
) AS FNum,
|
||||
SUM ( T.NdeNum ) AS NdeNum,
|
||||
SUM ( t.FNdeNum ) AS FNdeNum,
|
||||
NdeCode
|
||||
FROM ( SELECT
|
||||
a.TestPackageNo,b.PipelineId,c.PipelineCode,c.WeldJointId,c.WelderCode,
|
||||
(SELECT COUNT( 1 ) FROM dbo.Batch_NDEItem nde
|
||||
LEFT JOIN dbo.Batch_BatchTrustItem trust ON trust.TrustBatchItemId = nde.TrustBatchItemId
|
||||
WHERE trust.WeldJointId= c.WeldJointId ) AS NdeNum,--检测数
|
||||
STUFF((SELECT nde.NDEReportNo FROM dbo.Batch_NDEItem nde
|
||||
LEFT JOIN dbo.Batch_BatchTrustItem trust ON trust.TrustBatchItemId = nde.TrustBatchItemId
|
||||
WHERE trust.WeldJointId= c.WeldJointId FOR xml path ( '' ) ),1,1,'' ) AS NdeCode,--检测报告编号
|
||||
(SELECT COUNT( 1 ) FROM dbo.Batch_NDEItem nde
|
||||
LEFT JOIN dbo.Batch_BatchTrustItem trust ON trust.TrustBatchItemId = nde.TrustBatchItemId
|
||||
LEFT JOIN dbo.Pipeline_WeldJoint j ON j.WeldJointId = trust.WeldJointId
|
||||
WHERE trust.WeldJointId= c.WeldJointId AND j.JointAttribute= '固定F' ) AS FNdeNum --固定口检测数
|
||||
FROM dbo.PTP_TestPackage AS a
|
||||
INNER JOIN dbo.PTP_PipelineList AS b ON a.PTP_ID= b.PTP_ID
|
||||
LEFT JOIN dbo.View_Pipeline_WeldJoint AS C ON b.PipelineId= c.PipelineId
|
||||
LEFT JOIN dbo.Pipeline_Pipeline AS d ON b.PipelineId= d.PipelineId
|
||||
WHERE b.isAll= 1 and a.ProjectId=@projectId and a.PTP_ID=@PTPID
|
||||
UNION ALL
|
||||
SELECT a.TestPackageNo, b.PipelineId,d.PipelineCode,c.WeldJointId,c.WelderCode,
|
||||
(SELECT COUNT( 1 )
|
||||
FROM dbo.Batch_NDEItem nde LEFT JOIN dbo.Batch_BatchTrustItem trust ON trust.TrustBatchItemId = nde.TrustBatchItemId
|
||||
WHERE trust.WeldJointId= c.WeldJointId ) AS NdeNum,--检测数
|
||||
STUFF((SELECT nde.NDEReportNo FROM dbo.Batch_NDEItem nde
|
||||
LEFT JOIN dbo.Batch_BatchTrustItem trust ON trust.TrustBatchItemId = nde.TrustBatchItemId
|
||||
WHERE trust.WeldJointId= c.WeldJointId FOR xml path ( '' ) ),1,1,'' ) AS NdeCode,--检测报告编号
|
||||
(SELECT COUNT( 1 )
|
||||
FROM dbo.Batch_NDEItem nde LEFT JOIN dbo.Batch_BatchTrustItem trust ON trust.TrustBatchItemId = nde.TrustBatchItemId
|
||||
LEFT JOIN dbo.Pipeline_WeldJoint j ON j.WeldJointId = trust.WeldJointId
|
||||
WHERE trust.WeldJointId= c.WeldJointId AND j.JointAttribute= '固定F' ) AS FNdeNum --固定口检测数
|
||||
FROM dbo.PTP_TestPackage AS a INNER JOIN dbo.PTP_PipelineList AS b ON a.PTP_ID= b.PTP_ID
|
||||
LEFT JOIN dbo.View_Pipeline_WeldJoint AS C ON b.PipelineId= c.PipelineId
|
||||
LEFT JOIN dbo.Pipeline_Pipeline AS d ON b.PipelineId= d.PipelineId
|
||||
WHERE b.isAll= 0 AND PATINDEX( '%' + c.WeldJointCode+ '%', b.WeldJonintCode ) > 0
|
||||
and a.ProjectId=@projectId and a.PTP_ID=@PTPID
|
||||
) AS t
|
||||
GROUP BY t.TestPackageNo, t.PipelineCode, t.WelderCode, t.PipelineId, t.NdeCode ) AS H
|
||||
LEFT JOIN Pipeline_Pipeline AS PPline ON H.PipelineId= PPline.PipelineId
|
||||
LEFT JOIN Base_Material AS Ma ON PPline.MainMaterialId= Ma.MaterialId";
|
||||
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";
|
||||
|
||||
SqlParameter[] parms =
|
||||
{
|
||||
|
@ -4240,14 +4269,14 @@ namespace FineUIPro.Web.WeldingProcess.TestPackageManage
|
|||
ws.GetRow(dataIndex).GetCell(0).SetCellValue(dr["PipelineCode"].ToString());
|
||||
ws.GetRow(dataIndex).GetCell(2).SetCellValue(dr["MaterialCode"].ToString());
|
||||
ws.GetRow(dataIndex).GetCell(3).SetCellValue(dr["Specification"].ToString());
|
||||
ws.GetRow(dataIndex).GetCell(5).SetCellValue(dr["totalNum"].ToString());
|
||||
ws.GetRow(dataIndex).GetCell(7).SetCellValue(dr["Fnum"].ToString());
|
||||
ws.GetRow(dataIndex).GetCell(5).SetCellValue(dr["jointCount"].ToString());
|
||||
ws.GetRow(dataIndex).GetCell(7).SetCellValue(dr["fjointCount"].ToString());
|
||||
ws.GetRow(dataIndex).GetCell(9).SetCellValue(dr["WelderCode"].ToString());
|
||||
ws.GetRow(dataIndex).GetCell(11).SetCellValue(dr["Fnum"].ToString());
|
||||
ws.GetRow(dataIndex).GetCell(11).SetCellValue(dr["WelderNum"].ToString());
|
||||
ws.GetRow(dataIndex).GetCell(13).SetCellValue(dr["NdeNum"].ToString());
|
||||
ws.GetRow(dataIndex).GetCell(15).SetCellValue(dr["FNdeNum"].ToString());
|
||||
string a = string.IsNullOrEmpty(dr["NdeNum"].ToString()) ? "0" : dr["NdeNum"].ToString();
|
||||
string b = string.IsNullOrEmpty(dr["Fnum"].ToString()) ? "0" : dr["Fnum"].ToString();
|
||||
string b = string.IsNullOrEmpty(dr["WelderNum"].ToString()) ? "0" : dr["WelderNum"].ToString();
|
||||
|
||||
if (b == "0")
|
||||
{
|
||||
|
@ -4258,7 +4287,7 @@ namespace FineUIPro.Web.WeldingProcess.TestPackageManage
|
|||
decimal rate = Math.Round((decimal.Parse(a) / decimal.Parse(b)), 2);
|
||||
ws.GetRow(dataIndex).GetCell(17).SetCellValue($"{rate * 100}%");
|
||||
}
|
||||
ws.GetRow(dataIndex).GetCell(20).SetCellValue(dr["NdeCode"].ToString());
|
||||
ws.GetRow(dataIndex).GetCell(20).SetCellValue(dr["NdeReportNo"].ToString());
|
||||
}
|
||||
j++;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue