This commit is contained in:
高飞 2026-01-16 14:40:38 +08:00
parent 2cce1d0e4e
commit 3943a1f9ef
2 changed files with 141 additions and 0 deletions

View File

@ -0,0 +1,137 @@
ALTER PROC [dbo].[HJGL_sp_StatisticsSampleTable]
@projectId NVARCHAR(50) = NULL,
@iso_isoNo VARCHAR(50) = NULL,
@isHotPress bit = NULL,
@Welded NVARCHAR(50) =NULL,
@ndtType NVARCHAR(10) = NULL,
@ndtResult NVARCHAR(20)=NULL
AS
/*********统计样表 佘春生修改于2022.11.30********/
SELECT
JointInfo.JOT_ID,
project.ProjectCode, --
IsoInfo.PressureTestPackageNo,--
IsoInfo.ISO_ID,
IsoInfo.ISO_IsoNo, --线
'1-'+IsoClass.ISC_IsoName+'-'+Ser.SER_Code+'-'+Steel.STE_Code AS ISO_Code, --
IsoClass.ISC_IsoName, --
Ser.SER_Name, --
IsoInfo.ISO_DesignPress, --
IsoInfo.PipeLineClass, --
JointInfo.JOT_JointNo, --
JointInfo.JOT_JointDesc, --
JointInfo.JOT_Location, --
WeldMethod.WME_Name, --
JointType.JOTY_Code, --
JointType.JOTY_Group,
Sort1,Sort2,Sort3,Sort4,Sort5,
IsoInfo.ISO_Insulator, --
IsoInfo.ISO_DesignTemperature, --
IsoInfo.ISO_TestPress, --
(CASE WHEN WeldMat.WMT_MatCode IS NOT NULL AND WeldSilk.WMT_MatCode IS NOT NULL and WeldMat.WMT_MatCode!=WeldSilk.WMT_MatCode
THEN WeldMat.WMT_MatCode + '/' + WeldSilk.WMT_MatCode
WHEN WeldMat.WMT_MatCode IS NOT NULL THEN WeldMat.WMT_MatCode
ELSE ISNULL(WeldSilk.WMT_MatCode,'') END) AS WeldMatSilkCode,
(CASE WHEN JointInfo.JOT_CellWelder!=JointInfo.JOT_FloorWelder THEN Welder1.WED_Code+'/'+Welder2.WED_Code ELSE Welder1.WED_Code END) AS WED_Code,
--Welder1.WED_Code,--
Steel.STE_Code,--
Steel.STE_Name,--
NDTRate.NDTR_Name,--
(CASE WHEN JointInfo.Jot_WeldingDate IS NOT NULL THEN JointInfo.Jot_WeldingDate
ELSE WeldReportMain.JOT_WeldDate END) AS JOT_WeldDate, --
JointInfo.JOT_Size,--
Batch.BatchCode,--
BatchDetail.NDT, --Id
(CASE WHEN BatchDetail.PointType=2 THEN 'K' ELSE '' END) AS PointType,--
JointInfo.JOT_Dia,--
JointInfo.JOT_Sch, --
(CASE WHEN JointInfo.RT_TrustCode IS NOT NULL THEN '' ELSE '' END) AS RTTrust, --RT委托
JointInfo.RT_TrustCode, --RT委托单编号
JointInfo.RT_TrustDate AS RTTrustDate, --线
JointInfo.RTFeedbackDate, --线
JointInfo.RT_States AS RTTestResult,--RT检测结果
(CASE WHEN JointInfo.UT_TrustCode IS NOT NULL THEN '' ELSE '' END) AS UTTrust,--UT委托
JointInfo.UT_States AS UTTestResult,--UT检测结果
(CASE WHEN JointInfo.MT_TrustCode IS NOT NULL THEN '' ELSE '' END) AS MTTrust,--MT委托
JointInfo.MT_States AS MTTestResult,--MT检测结果
(CASE WHEN JointInfo.PT_TrustCode IS NOT NULL THEN '' ELSE '' END) AS PTTrust,--PT委托
JointInfo.PT_TrustCode, --PT委托单编号
JointInfo.PT_TrustDate, --PT委托日期
JointInfo.PT_States AS PTTestResult,--PT检测结果
(CASE WHEN JointInfo.PAUT_TrustCode IS NOT NULL THEN '' ELSE '' END) AS PAUTTrust, --PAUT委托
JointInfo.PAUT_TrustCode, --PAUT委托单编号
JointInfo.PAUT_TrustDate AS PAUTTrustDate, --PAUT检测委托日期
JointInfo.PAUT_States AS PAUTTestResult,--PAUT检测结果
(CASE WHEN (SELECT TOP 1 UnableCheck FROM dbo.HJGL_CH_TrustItem c WHERE c.JOT_ID=JointInfo.JOT_ID )=1
THEN '' ELSE '' END) AS UnableCheck,
(SELECT TOP 1 UnableCheckReason FROM dbo.HJGL_CH_TrustItem c WHERE c.JOT_ID=JointInfo.JOT_ID ) AS UnableCheckReason,
(CASE WHEN JointInfo.ProessTypes like '%4|5%' Then '消应力热处理,稳定化处理'
WHEN JointInfo.ProessTypes like '%4%' Then '消应力热处理'
WHEN JointInfo.ProessTypes like '%5%' Then '稳定化处理'
ELSE '' END) AS ProessTypes,--
(case when JointInfo.ProessTypes like '%4%' or JointInfo.ProessTypes like '%5%' then 'Y'
else 'N' end) as IS_Proess,
(case when JointInfo.ProessTypes like '%1%' then 'Y'
else '' end) as IS_Preheating,
(select top 1 HotProessTrustCode from HJGL_CH_HotProessTrust t left join HJGL_CH_HotProessTrustItem i on t.HotProessTrustId=i.HotProessTrustId where i.JOT_ID=JointInfo.JOT_ID order by TrustDate desc)
as HotProessTrustCode, --
JointInfo.HotProessTrustDate,--
(select top 1 HotStartDate from HJGL_HotProessItem hpi where hpi.JOT_ID=JointInfo.JOT_ID) as HotStartDate, --
JointInfo.HotResultDate,--
(select top 1 HotHardCode from HJGL_CH_HardTestReport t left join HJGL_CH_HardTestReportItem i on t.HardTestReportId=i.HardTestReportId where i.JOT_ID=JointInfo.JOT_ID order by TestDate desc)
as HotHardCode, --
JointInfo.HardTrustDate,--
JointInfo.HardResultDate,--
(case when JointInfo.HardTestResultOK=1 then '合格' when JointInfo.HardTestResultOK=0 then '不合格' else '' end) as HardResult,--
BatchDetail.BatchDetailId
FROM dbo.HJGL_PW_JointInfo AS JointInfo
LEFT JOIN DBO.HJGL_BO_BatchDetail AS BatchDetail ON JointInfo.JOT_ID = BatchDetail.JOT_ID
LEFT JOIN DBO.HJGL_PW_IsoInfo AS IsoInfo ON IsoInfo.ISO_ID = JointInfo.ISO_ID
LEFT JOIN HJGL_BS_WeldMethod AS WeldMethod ON WeldMethod.WME_ID = JointInfo.WME_ID
LEFT JOIN HJGL_BS_JointType AS JointType ON JointType.JOTY_ID=JointInfo.JOTY_ID
LEFT JOIN DBO.HJGL_BO_Batch AS Batch ON Batch.BatchId = BatchDetail.BatchId
LEFT JOIN dbo.Base_Project project ON project.ProjectId=JointInfo.ProjectId
LEFT JOIN dbo.HJGL_BS_Steel AS Steel ON Steel.STE_ID = JointInfo.STE_ID
LEFT JOIN DBO.HJGL_BS_Welder AS Welder1 ON Welder1.WED_ID = JointInfo.JOT_CellWelder
LEFT JOIN DBO.HJGL_BS_Welder AS Welder2 ON Welder2.WED_ID = JointInfo.JOT_FloorWelder
LEFT JOIN DBO.HJGL_BO_WeldReportMain AS WeldReportMain ON WeldReportMain.DReportID = JointInfo.DReportID
LEFT JOIN dbo.HJGL_BS_NDTRate AS NDTRate ON NDTRate.NDTR_ID = JointInfo.NDTR_ID
LEFT JOIN dbo.HJGL_BS_IsoClass AS IsoClass ON IsoClass.ISC_ID =IsoInfo.ISC_ID
LEFT JOIN dbo.HJGL_BS_Service AS Ser ON Ser.SER_ID = IsoInfo.SER_ID
LEFT JOIN HJGL_BS_WeldMaterial AS WeldMat ON WeldMat.WMT_ID=JointInfo.JOT_WeldMat
LEFT JOIN HJGL_BS_WeldMaterial AS WeldSilk ON WeldSilk.WMT_ID=JointInfo.JOT_WeldSilk
WHERE (JointInfo.ProjectId=@projectId OR @projectId IS NULL)
AND ((CASE WHEN @ndtType='RT' THEN JointInfo.RT_TrustCode
WHEN @ndtType='PT' THEN JointInfo.PT_TrustCode
WHEN @ndtType='MT' THEN JointInfo.MT_TrustCode
WHEN @ndtType='UT' THEN JointInfo.UT_TrustCode
WHEN @ndtType='PAUT' THEN JointInfo.PAUT_TrustCode END) IS NOT NULL OR @ndtType IS NULL)
AND ((CASE WHEN @ndtType='RT' AND @ndtResult IS NOT NULL THEN JointInfo.RT_States
WHEN @ndtType='PT' AND @ndtResult IS NOT NULL THEN JointInfo.PT_States
WHEN @ndtType='MT' AND @ndtResult IS NOT NULL THEN JointInfo.MT_States
WHEN @ndtType='UT' AND @ndtResult IS NOT NULL THEN JointInfo.UT_States
WHEN @ndtType='PAUT' AND @ndtResult IS NOT NULL THEN JointInfo.PAUT_States END) =@ndtResult OR @ndtResult IS NULL)
AND ((case when JointInfo.DReportID IS NOT NULL then '1' else '2' end)=@Welded OR @Welded IS NULL)
AND (IsoInfo.ISO_IsoNo =@iso_isoNo OR @iso_isoNo IS NULL)
AND (((SELECT TOP 1 TrustDate from dbo.HJGL_CH_HotProessTrustItem a
WHERE a.JOT_ID=BatchDetail.JOT_ID and (a.ProessTypes='4' OR a.ProessTypes='5')) IS NOT NULL
AND @isHotPress=1) OR @isHotPress IS NULL)
ORDER BY project.ProjectCode,IsoInfo.ISO_IsoNo,JointInfo.JOT_JointNo
GO

View File

@ -226,6 +226,10 @@
SortField="HotProessTrustDate" FieldType="Date" Renderer="Date" HeaderTextAlign="Center" RendererArgument="yyyy-MM-dd"
TextAlign="Center" Width="120px">
</f:RenderField>
<f:RenderField HeaderText="热处理开始时间" ColumnID="HotStartDate" DataField="HotStartDate"
SortField="HotStartDate" FieldType="Date" Renderer="Date" HeaderTextAlign="Center" RendererArgument="yyyy-MM-dd"
TextAlign="Center" Width="120px">
</f:RenderField>
<f:RenderField HeaderText="HB硬度委托编号" ColumnID="HotHardCode" DataField="HotHardCode"
SortField="HotHardCode" FieldType="String" HeaderTextAlign="Center"
TextAlign="Center" Width="150px">