527 lines
32 KiB
Transact-SQL
527 lines
32 KiB
Transact-SQL
|
|
ALTER PROCEDURE [dbo].[HJGL_sp_rpt_TestingReportPrint]
|
|||
|
|
(
|
|||
|
|
@TestingReportPrintId NVARCHAR(50),
|
|||
|
|
--@RowNum INT,
|
|||
|
|
--@Flag CHAR(1),
|
|||
|
|
@STE_ID nvarchar(50),
|
|||
|
|
@STE_ID2 nvarchar(50),
|
|||
|
|
@WME_ID nvarchar(50)
|
|||
|
|
)
|
|||
|
|
AS
|
|||
|
|
/***************检测报告打印报表******************/
|
|||
|
|
SELECT Report.TestingReportPrintId,
|
|||
|
|
Report.ISO_ID,
|
|||
|
|
Report.Specifications, --检件规格
|
|||
|
|
Report.NDT_ID,
|
|||
|
|
Report.BatchId,
|
|||
|
|
SUBSTRING(Report.ReportCode,CHARINDEX('-',Report.ReportCode,1)+1,LEN(Report.ReportCode)) AS ReportCode, --报告编号
|
|||
|
|
Report.ContractUnitId, --承包单位
|
|||
|
|
|
|||
|
|
Project.ProjectName, --工程名称
|
|||
|
|
'管道' AS InstallationName, --单元名称
|
|||
|
|
Unit.UnitName, --委托单位
|
|||
|
|
Report.JotyName, --检件名称
|
|||
|
|
IsoInfo.ISO_IsoNo, --检件编号
|
|||
|
|
IsoInfo.TestCategoryNum,--检测类别号
|
|||
|
|
(CASE WHEN Steel.STE_Code IS NOT NULL AND Steel2.STE_Code IS NOT NULL and Steel.STE_Code!=Steel2.STE_Code
|
|||
|
|
THEN Steel.STE_Code + '/' + Steel2.STE_Code
|
|||
|
|
WHEN Steel.STE_Code IS NOT NULL THEN Steel.STE_Code
|
|||
|
|
ELSE ISNULL(Steel2.STE_Code,'') END) AS STE_Code, --检件材质
|
|||
|
|
WeldMethod.WME_Name, --焊接方法
|
|||
|
|
(SELECT TOP 1 CH_NDTCriteria FROM dbo.HJGL_CH_Trust trust
|
|||
|
|
WHERE trust.BatchId = Report.BatchId AND trust.CH_NDTMethod=Report.NDT_ID ) AS CH_NDTCriteria, --检测标准
|
|||
|
|
NDTRate.NDTR_Name, --检测比例
|
|||
|
|
|
|||
|
|
(CASE WHEN (NDT.NDT_Code='MT' OR NDT.NDT_Code='PT') AND
|
|||
|
|
(SELECT TOP 1 joty.JOTY_Group FROM dbo.HJGL_CH_TrustItem trustItem
|
|||
|
|
LEFT JOIN HJGL_PW_JointInfo jot ON jot.JOT_ID=trustItem.JOT_ID
|
|||
|
|
LEFT JOIN dbo.HJGL_BS_JointType joty ON joty.JOTY_ID = jot.JOTY_ID
|
|||
|
|
LEFT join dbo.HJGL_CH_Trust trust on trust.CH_TrustID=trustItem.CH_TrustID
|
|||
|
|
WHERE trust.BatchId = Report.BatchId AND trust.CH_NDTMethod=Report.NDT_ID)='1' THEN 'Ⅰ'
|
|||
|
|
ELSE (SELECT TOP 1 jot.JOT_QualifiedLevel FROM dbo.HJGL_CH_TrustItem trustItem
|
|||
|
|
LEFT JOIN HJGL_PW_JointInfo jot ON jot.JOT_ID=trustItem.JOT_ID
|
|||
|
|
left join dbo.HJGL_CH_Trust trust on trust.CH_TrustID=trustItem.CH_TrustID
|
|||
|
|
WHERE trust.BatchId = Report.BatchId AND trust.CH_NDTMethod=Report.NDT_ID)
|
|||
|
|
END) AS CH_AcceptGrade,--合格级别
|
|||
|
|
|
|||
|
|
--(select top 1 jot.JOT_QualifiedLevel
|
|||
|
|
-- FROM dbo.HJGL_CH_TrustItem trustItem
|
|||
|
|
--left join HJGL_PW_JointInfo jot on jot.JOT_ID=trustItem.JOT_ID
|
|||
|
|
--left join dbo.HJGL_CH_Trust trust on trust.CH_TrustID=trustItem.CH_TrustID
|
|||
|
|
--WHERE trust.BatchId = Report.BatchId AND trust.CH_NDTMethod=Report.NDT_ID) as CH_AcceptGrade, --合格级别
|
|||
|
|
|
|||
|
|
Report.TestingTime, -- 检测时机
|
|||
|
|
|
|||
|
|
Report.HotProessState, --热处理状态
|
|||
|
|
Report.TransilluminationMode, --透照方式
|
|||
|
|
Report.EquipmentCode, --设备型号
|
|||
|
|
Equipmnet.EquipmentName AS EquipmentName, --设备名称
|
|||
|
|
Report.FilmModel, --胶片牌号
|
|||
|
|
Report.IntensifyingWay, --增感屏
|
|||
|
|
Report.TubeVoltage, --管电压
|
|||
|
|
Report.SourceActivity, --γ源活度
|
|||
|
|
Report.ImageQualityModel, --像质计型号
|
|||
|
|
Report.WireDiameterCode, --线径编号
|
|||
|
|
Report.FocalLength, --焦距
|
|||
|
|
Report.ExposureTime, --曝光时间
|
|||
|
|
Report.EffectiveLength, --有效片长
|
|||
|
|
NDT.NDT_Code,--MT磁化方法
|
|||
|
|
'ⅡC-d' AS PTNDTCode, --PT检测方法
|
|||
|
|
(SELECT slope.JST_Code FROM dbo.HJGL_BS_SlopeType AS slope
|
|||
|
|
WHERE slope.JST_ID=(SELECT TOP 1 jot.JST_ID FROM dbo.HJGL_PW_JointInfo jot
|
|||
|
|
LEFT JOIN dbo.HJGL_BO_BatchDetail d ON d.JOT_ID = jot.JOT_ID
|
|||
|
|
WHERE d.BatchId=Report.BatchId AND jot.ISO_ID=Report.ISO_ID AND jot.JOT_JointDesc=Report.Specifications))
|
|||
|
|
AS JST_Name, --坡口类型
|
|||
|
|
----------------RT------------------------
|
|||
|
|
Report.RT_TechnicalGrade, --RT 技术等级
|
|||
|
|
Report.RT_FocalSize,--RT 焦点尺寸
|
|||
|
|
(CASE WHEN Report.RT_TubeCurrent IS NULL
|
|||
|
|
THEN ISNULL(Report.SourceActivity,'')
|
|||
|
|
ELSE (CASE WHEN Report.SourceActivity IS NULL
|
|||
|
|
THEN ISNULL(Report.RT_TubeCurrent,'')
|
|||
|
|
ELSE (ISNULL(Report.RT_TubeCurrent,'') +'/'+ ISNULL(Report.SourceActivity,'')) END)
|
|||
|
|
END) AS RT_TubeCurrent,--RT 管电流/源活度
|
|||
|
|
Report.RT_SourceType,--RT γ源种类
|
|||
|
|
Report.RT_FilmDensity,--RT 底片黑度
|
|||
|
|
Report.RT_DeveloperTemperature,--RT 显影温度
|
|||
|
|
Report.RT_DeveloperTime,--RT 显影时间
|
|||
|
|
|
|||
|
|
(CASE WHEN Report.TubeVoltage IS NULL
|
|||
|
|
THEN ISNULL(Equipmnet.LineEnergy,'')
|
|||
|
|
ELSE (CASE WHEN Equipmnet.LineEnergy IS NULL
|
|||
|
|
THEN ISNULL(Report.TubeVoltage,'')
|
|||
|
|
ELSE (ISNULL(Report.TubeVoltage,'') +'/'+ ISNULL(Equipmnet.LineEnergy,'')) END)
|
|||
|
|
END) AS TubeVoltageLineEnergy,--RT 管电压/源能量
|
|||
|
|
|
|||
|
|
(CASE WHEN Equipmnet.EquipmentName IS NULL
|
|||
|
|
THEN ISNULL(Report.RT_SourceType,'')
|
|||
|
|
ELSE (CASE WHEN Report.RT_SourceType IS NULL
|
|||
|
|
THEN ISNULL(Equipmnet.EquipmentName,'')
|
|||
|
|
ELSE (ISNULL(Equipmnet.EquipmentName,'') +'/'+ ISNULL(Report.RT_SourceType,'')) END)
|
|||
|
|
END) AS EquipmentSourceType,--RT 设备型号/射源种类
|
|||
|
|
|
|||
|
|
------------------PT-------------------------
|
|||
|
|
Report.PT_SurfaceState, --PT 表面状态
|
|||
|
|
Report.PT_PenetrantGrade, --PT 渗透剂牌号
|
|||
|
|
Report.PT_CleaningGrade, --PT 清洗剂牌号
|
|||
|
|
Report.PT_ImagingGrade, --PT 显像剂牌号
|
|||
|
|
Report.PT_OsmoticTemperature, --PT 渗透温度
|
|||
|
|
Report.PT_ImposingMethod, --PT 施加方法
|
|||
|
|
Report.PT_ObservationMethod, --PT 观察方法
|
|||
|
|
Report.PT_SensitivityTestBlock, --PT 灵敏度试块
|
|||
|
|
Report.PT_PermeationTime, --PT 渗透时间
|
|||
|
|
Report.PT_ImagingTime, --PT 显像时间
|
|||
|
|
---------------------MT-------------------------
|
|||
|
|
Report.MT_SurfaceState, --MT 表面状态
|
|||
|
|
Report.MT_SensitivityTestBlock, --MT 灵敏度试片
|
|||
|
|
Report.MT_CurrentType, --MT 电流类型
|
|||
|
|
Report.MT_LiftingPower, --MT 提升力/电流
|
|||
|
|
Report.MT_MagnetizationTime, --MT 磁化时间
|
|||
|
|
Report.MT_MagneticPowderType, --MT 磁粉种类
|
|||
|
|
Report.MT_Concentration, --MT 磁悬液浓度
|
|||
|
|
Report.MT_ImposingMethod, --MT 施加方法
|
|||
|
|
Report.MT_TestMethod, --MT 磁化方法
|
|||
|
|
Report.PoleSpacing, --MT 电/磁极间距
|
|||
|
|
----------------------UT--------------------------------
|
|||
|
|
Report.UT_TechnicalGrade, --UT 技术等级
|
|||
|
|
Report.UT_DetectionSurface, --UT 检测面
|
|||
|
|
Report.UT_SurfaceState, --UT 表面状态
|
|||
|
|
Report.UT_StandardTestBlock, --UT 标准试块1
|
|||
|
|
Report.UT_StandardTestBlock2,--UT 标准试块2
|
|||
|
|
Report.UT_ProbeType, --UT 探头型号
|
|||
|
|
Report.UT_SurfaceCompensation, --UT 表面补偿
|
|||
|
|
Report.UT_ScanningRate, --UT 扫描比例
|
|||
|
|
Report.UT_DetectionSensitivity, --UT 检测灵敏度
|
|||
|
|
Report.UT_CouplingAgent, --UT 耦合剂
|
|||
|
|
--------------------------------------------------------
|
|||
|
|
Report.Type,
|
|||
|
|
Report.Printer,
|
|||
|
|
Report.PrintTime,
|
|||
|
|
Report.TestBlock,
|
|||
|
|
(select top 1 InstallationCode from Project_Installation where ProjectId=IsoInfo.ProjectId) as WorkAreaCode --区号
|
|||
|
|
FROM dbo.HJGL_CH_TestingReportPrint AS Report
|
|||
|
|
LEFT JOIN DBO.HJGL_PW_IsoInfo AS IsoInfo ON IsoInfo.ISO_ID = Report.ISO_ID
|
|||
|
|
LEFT JOIN DBO.Base_Project AS Project ON Project.ProjectId = IsoInfo.ProjectId
|
|||
|
|
LEFT JOIN DBO.HJGL_BO_Batch AS Batch ON Batch.BatchId=Report.BatchId
|
|||
|
|
LEFT JOIN DBO.Base_Unit AS Unit ON Unit.UnitId = IsoInfo.BSU_ID
|
|||
|
|
|
|||
|
|
LEFT JOIN HJGL_BS_Steel AS Steel ON Steel.STE_ID=@STE_ID
|
|||
|
|
LEFT JOIN HJGL_BS_Steel AS Steel2 ON Steel2.STE_ID=@STE_ID2
|
|||
|
|
left join HJGL_BS_WeldMethod AS WeldMethod on WeldMethod.WME_ID=@WME_ID
|
|||
|
|
LEFT JOIN DBO.HJGL_BS_NDTRate AS NDTRate ON NDTRate.NDTR_ID = Batch.NDTR_ID
|
|||
|
|
LEFT JOIN dbo.HJGL_BS_NDTType AS NDT ON NDT.NDT_ID = Report.NDT_ID
|
|||
|
|
LEFT JOIN dbo.HJGL_BS_Equipment AS Equipmnet ON Equipmnet.EquipmentId= Report.EquipmentName
|
|||
|
|
WHERE Report.TestingReportPrintId=@TestingReportPrintId
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
GO
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
ALTER PROCEDURE [dbo].[HJGL_sp_rpt_TestingReportPrintItem]
|
|||
|
|
(
|
|||
|
|
@TestingReportPrintId nvarchar(50),
|
|||
|
|
--@RowNum INT,
|
|||
|
|
--@Flag CHAR(1),
|
|||
|
|
@STE_ID nvarchar(50),
|
|||
|
|
@STE_ID2 nvarchar(50),
|
|||
|
|
@WME_ID nvarchar(50)
|
|||
|
|
)
|
|||
|
|
AS
|
|||
|
|
/***************检测报告打印报表明细表 佘春生修改于2018.2.8******************/
|
|||
|
|
create table #SIS(
|
|||
|
|
Number int null,
|
|||
|
|
QualityRatingId nvarchar(50),
|
|||
|
|
JOT_JointDesc nvarchar(50),
|
|||
|
|
JOT_JointNo nvarchar(50),
|
|||
|
|
FilmNum nvarchar(50),
|
|||
|
|
WED_Code nvarchar(50),
|
|||
|
|
DefectNature nvarchar(50),
|
|||
|
|
DefectSize nvarchar(50),
|
|||
|
|
DefectResult nvarchar(50),
|
|||
|
|
DefectRation nvarchar(50),
|
|||
|
|
BatchCode nvarchar(50),
|
|||
|
|
ISO_IsoNo nvarchar(50),
|
|||
|
|
Remark nvarchar(50),
|
|||
|
|
Defect nvarchar(100),
|
|||
|
|
PeakAmplitude nvarchar(100),
|
|||
|
|
DefectLocation nvarchar(100),
|
|||
|
|
IndicatingLength nvarchar(100),
|
|||
|
|
DepthDefect nvarchar(100),
|
|||
|
|
)
|
|||
|
|
--IF(@Flag='1')
|
|||
|
|
--BEGIN
|
|||
|
|
--insert into #SIS
|
|||
|
|
--SELECT v.* FROM
|
|||
|
|
--(SELECT ROW_NUMBER() OVER(ORDER BY report.JOT_JointNo,report.FilmNum) AS Number,report.*
|
|||
|
|
-- FROM
|
|||
|
|
--(SELECT v1.*
|
|||
|
|
--FROM
|
|||
|
|
--(SELECT QualityRating.QualityRatingId,
|
|||
|
|
-- JointInfo.JOT_JointDesc,
|
|||
|
|
-- JointInfo.JOT_JointNo+(case batchDetail.PointType when '2' then 'K' else '' end) as JOT_JointNo,
|
|||
|
|
-- QualityRating.FilmNum,
|
|||
|
|
-- (CASE WHEN JointInfo.JOT_CellWelder!=JointInfo.JOT_FloorWelder THEN Welder1.WED_Code+'/'+Welder2.WED_Code ELSE Welder1.WED_Code END) AS WED_Code,
|
|||
|
|
-- dbo.GetDefectNature(QualityRating.QualityRatingId,QualityRating.CH_TrustItemID) as DefectNature,--缺陷性质
|
|||
|
|
-- QualityRating.DefectSize,--缺陷定量
|
|||
|
|
-- Replace(QualityRating.DefectResult,' ','') AS DefectResult,--评定级别
|
|||
|
|
-- QualityRating.DefectRation,
|
|||
|
|
-- batch.BatchCode, --检测批号
|
|||
|
|
-- isoInfo.ISO_IsoNo,
|
|||
|
|
-- Equipment.EquipmentName as Remark,
|
|||
|
|
-- case when ndtType.NDT_Code='MT'
|
|||
|
|
-- then ((case when QualityRating.DefectNature is not null and QualityRating.DefectNature!='' then '性质:'+QualityRating.DefectNature+',' else '' end)
|
|||
|
|
-- +(case when QualityRating.DefectLocation is not null and QualityRating.DefectLocation!='' then '位置:'+QualityRating.DefectLocation+',' else '' end)
|
|||
|
|
-- +(case when QualityRating.DefectSize is not null then '尺寸:'+convert(nvarchar(10),cast(QualityRating.DefectSize as real)) else '' end))
|
|||
|
|
-- when ndtType.NDT_Code='PT'
|
|||
|
|
-- then ((case when QualityRating.DefectNature is not null and QualityRating.DefectNature!='' then '性质:'+QualityRating.DefectNature+',' else '' end)
|
|||
|
|
-- +(case when QualityRating.DefectLocation is not null and QualityRating.DefectLocation!='' then '位置:'+QualityRating.DefectLocation+',' else '' end)
|
|||
|
|
-- +(case when QualityRating.DefectSize is not null then '尺寸:'+convert(nvarchar(10),cast(QualityRating.DefectSize as real)) else '' end))
|
|||
|
|
-- when ndtType.NDT_Code='UT'
|
|||
|
|
-- then ((case when QualityRating.PeakAmplitude is not null and QualityRating.PeakAmplitude!='' then '波幅:'+QualityRating.PeakAmplitude+',' else '' end)
|
|||
|
|
-- +(case when QualityRating.DefectLocation is not null and QualityRating.DefectLocation!='' then '位置:'+QualityRating.DefectLocation+',' else '' end)
|
|||
|
|
-- +(case when QualityRating.DepthDefect is not null then '深度:'+convert(nvarchar(10),cast(QualityRating.DepthDefect as real))+',' else '' end)
|
|||
|
|
-- +(case when QualityRating.IndicatingLength is not null then '长度:'+convert(nvarchar(10),cast(QualityRating.IndicatingLength as real)) else '' end))
|
|||
|
|
-- else '' end
|
|||
|
|
-- AS Defect --缺陷情况或缺陷示意图编号
|
|||
|
|
--FROM dbo.HJGL_BO_QualityRating AS QualityRating
|
|||
|
|
--LEFT JOIN DBO.HJGL_CH_TrustItem AS TrustItem ON TrustItem.CH_TrustItemID = QualityRating.CH_TrustItemID
|
|||
|
|
--LEFT JOIN HJGL_BS_Equipment AS Equipment ON Equipment.EquipmentId=TrustItem.EquipmentId
|
|||
|
|
--LEFT JOIN dbo.HJGL_CH_Trust trust ON trust.CH_TrustID = TrustItem.CH_TrustID
|
|||
|
|
--LEFT JOIN dbo.HJGL_BS_NDTType ndtType on ndtType.NDT_ID=trust.CH_NDTMethod
|
|||
|
|
--LEFT JOIN dbo.HJGL_BO_BatchDetail batchDetail ON batchDetail.JOT_ID = QualityRating.JOT_ID
|
|||
|
|
--LEFT JOIN dbo.HJGL_BO_Batch batch ON batch.BatchId=batchDetail.BatchId
|
|||
|
|
--LEFT JOIN DBO.HJGL_PW_JointInfo AS JointInfo ON JointInfo.JOT_ID=QualityRating.JOT_ID
|
|||
|
|
--LEFT JOIN dbo.HJGL_PW_IsoInfo AS isoInfo ON isoInfo.ISO_ID=JointInfo.ISO_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_CH_TestingReportPrint AS TestingReportPrint ON TestingReportPrint.ISO_ID = QualityRating.ISO_ID
|
|||
|
|
--WHERE TestingReportPrint.ISO_ID=QualityRating.ISO_ID and JointInfo.STE_ID=@STE_ID AND (JointInfo.STE_ID2=@STE_ID2 or @STE_ID2='') AND JointInfo.WME_ID=@WME_ID
|
|||
|
|
--AND TestingReportPrint.Specifications=JointInfo.JOT_JointDesc
|
|||
|
|
--AND TestingReportPrint.BatchId = trust.BatchId
|
|||
|
|
--AND TestingReportPrint.NDT_ID = trust.CH_NDTMethod
|
|||
|
|
--AND TestingReportPrint.TestingReportPrintId=@TestingReportPrintId) v1
|
|||
|
|
--UNION all
|
|||
|
|
--SELECT v2.*
|
|||
|
|
--from
|
|||
|
|
--(SELECT qualityRatingRepair.QualityRatingRepairId AS QualityRatingId,
|
|||
|
|
-- JointInfo.JOT_JointDesc,
|
|||
|
|
-- JointInfo.JOT_JointNo+(case repair.NDT_ID when '20d2cbca-8b3d-434b-b1c1-181796986fa5' then '' else record.RepairMark end)+(case batchDetail.PointType when '2' then 'K' else '' end) as JOT_JointNo,
|
|||
|
|
-- (qualityRatingRepair.FilmNum+record.RepairMark) AS FilmNum,
|
|||
|
|
-- Welder.WED_Code,
|
|||
|
|
-- dbo.GetRepairDefectNature(qualityRatingRepair.QualityRatingRepairId,qualityRatingRepair.CH_RepairItemId) as DefectNature,
|
|||
|
|
-- qualityRatingRepair.DefectSize,
|
|||
|
|
-- Replace(qualityRatingRepair.DefectResult,' ','') AS DefectResult,
|
|||
|
|
-- qualityRatingRepair.DefectRation,
|
|||
|
|
-- batch.BatchCode, --检测批号
|
|||
|
|
-- isoInfo.ISO_IsoNo,
|
|||
|
|
-- Equipment.EquipmentName as Remark,
|
|||
|
|
-- case when ndtType.NDT_Code='MT'
|
|||
|
|
-- then ((case when qualityRatingRepair.DefectNature is not null and qualityRatingRepair.DefectNature!='' then '性质:'+qualityRatingRepair.DefectNature else '' end)
|
|||
|
|
-- +(case when qualityRatingRepair.DefectLocation is not null and qualityRatingRepair.DefectLocation!='' then '位置:'+qualityRatingRepair.DefectLocation else '' end)
|
|||
|
|
-- +(case when qualityRatingRepair.DefectSize is not null then '尺寸:'+convert(nvarchar(10),cast(qualityRatingRepair.DefectSize as real)) else '' end))
|
|||
|
|
-- when ndtType.NDT_Code='PT'
|
|||
|
|
-- then ((case when qualityRatingRepair.DefectNature is not null and qualityRatingRepair.DefectNature!='' then '性质:'+qualityRatingRepair.DefectNature else '' end)
|
|||
|
|
-- +(case when qualityRatingRepair.DefectLocation is not null and qualityRatingRepair.DefectLocation!='' then '位置:'+qualityRatingRepair.DefectLocation else '' end)
|
|||
|
|
-- +(case when qualityRatingRepair.DefectSize is not null then '尺寸:'+convert(nvarchar(10),cast(qualityRatingRepair.DefectSize as real)) else '' end))
|
|||
|
|
-- when ndtType.NDT_Code='UT'
|
|||
|
|
-- then ((case when qualityRatingRepair.PeakAmplitude is not null and qualityRatingRepair.PeakAmplitude!='' then '波幅:'+qualityRatingRepair.PeakAmplitude else '' end)
|
|||
|
|
-- +(case when qualityRatingRepair.DefectLocation is not null and qualityRatingRepair.DefectLocation!='' then '位置:'+qualityRatingRepair.DefectLocation else '' end)
|
|||
|
|
-- +(case when qualityRatingRepair.DepthDefect is not null then '深度:'+convert(nvarchar(10),cast(qualityRatingRepair.DepthDefect as real)) else '' end)
|
|||
|
|
-- +(case when qualityRatingRepair.IndicatingLength is not null then '长度:'+convert(nvarchar(10),cast(qualityRatingRepair.IndicatingLength as real)) else '' end))
|
|||
|
|
-- else '' end
|
|||
|
|
-- AS Defect --缺陷情况或缺陷示意图编号
|
|||
|
|
--FROM dbo.HJGL_BO_QualityRatingRepair AS qualityRatingRepair
|
|||
|
|
--LEFT JOIN dbo.HJGL_CH_RepairItem AS repairItem ON repairItem.CH_RepairItemId = qualityRatingRepair.CH_RepairItemId
|
|||
|
|
--LEFT JOIN HJGL_BS_Equipment AS Equipment ON Equipment.EquipmentId=repairItem.EquipmentId
|
|||
|
|
--LEFT JOIN dbo.HJGL_CH_Repair repair ON repair.CH_RepairID = repairItem.CH_RepairID
|
|||
|
|
--LEFT JOIN dbo.HJGL_BS_NDTType ndtType on ndtType.NDT_ID=repair.NDT_ID
|
|||
|
|
--LEFT JOIN dbo.HJGL_BO_BatchDetail batchDetail ON batchDetail.JOT_ID = qualityRatingRepair.JOT_ID
|
|||
|
|
--LEFT JOIN dbo.HJGL_BO_Batch batch ON batch.BatchId=batchDetail.BatchId
|
|||
|
|
--LEFT JOIN DBO.HJGL_PW_JointInfo AS JointInfo ON JointInfo.JOT_ID=qualityRatingRepair.JOT_ID
|
|||
|
|
--LEFT JOIN dbo.HJGL_PW_IsoInfo AS isoInfo ON isoInfo.ISO_ID=JointInfo.ISO_ID
|
|||
|
|
--LEFT JOIN dbo.HJGL_CH_RepairItemRecord record ON record.RepairItemRecordId = repairItem.RepairItemRecordId
|
|||
|
|
--LEFT JOIN DBO.HJGL_BS_Welder AS Welder ON Welder.WED_ID =record.JOT_CellWelder
|
|||
|
|
--LEFT JOIN DBO.HJGL_CH_TestingReportPrint AS TestingReportPrint ON TestingReportPrint.ISO_ID = qualityRatingRepair.ISO_ID
|
|||
|
|
--WHERE TestingReportPrint.ISO_ID=qualityRatingRepair.ISO_ID and JointInfo.STE_ID=@STE_ID AND (JointInfo.STE_ID2=@STE_ID2 or @STE_ID2='') AND JointInfo.WME_ID=@WME_ID
|
|||
|
|
--AND TestingReportPrint.Specifications=JointInfo.JOT_JointDesc
|
|||
|
|
--AND TestingReportPrint.BatchId = repair.BatchId
|
|||
|
|
--AND TestingReportPrint.NDT_ID = repair.NDT_ID
|
|||
|
|
--AND TestingReportPrint.TestingReportPrintId=@TestingReportPrintId) v2)
|
|||
|
|
--report) v
|
|||
|
|
--WHERE v.Number<=@RowNum
|
|||
|
|
--END
|
|||
|
|
|
|||
|
|
--ELSE IF(@Flag='2')
|
|||
|
|
--BEGIN
|
|||
|
|
--insert into #SIS
|
|||
|
|
--SELECT v.* FROM
|
|||
|
|
--(SELECT ROW_NUMBER() OVER(ORDER BY report.JOT_JointNo,report.FilmNum) AS Number,report.*
|
|||
|
|
-- FROM
|
|||
|
|
--(SELECT v1.*
|
|||
|
|
--FROM
|
|||
|
|
--(SELECT QualityRating.QualityRatingId,
|
|||
|
|
-- JointInfo.JOT_JointDesc,JointInfo.JOT_JointNo+(case batchDetail.PointType when '2' then 'K' else '' end) as JOT_JointNo,
|
|||
|
|
-- QualityRating.FilmNum,
|
|||
|
|
-- (CASE WHEN JointInfo.JOT_CellWelder!=JointInfo.JOT_FloorWelder THEN Welder1.WED_Code+'/'+Welder2.WED_Code ELSE Welder1.WED_Code END) AS WED_Code,
|
|||
|
|
-- dbo.GetDefectNature(QualityRating.QualityRatingId,QualityRating.CH_TrustItemID) as DefectNature,QualityRating.DefectSize,
|
|||
|
|
-- Replace(QualityRating.DefectResult,' ','') AS DefectResult,
|
|||
|
|
-- QualityRating.DefectRation,
|
|||
|
|
-- batch.BatchCode, --检测批号
|
|||
|
|
-- isoInfo.ISO_IsoNo,
|
|||
|
|
-- Equipment.EquipmentName as Remark,
|
|||
|
|
-- case when ndtType.NDT_Code='MT'
|
|||
|
|
-- then ((case when QualityRating.DefectNature is not null and QualityRating.DefectNature!='' then '性质:'+QualityRating.DefectNature else '' end)
|
|||
|
|
-- +(case when QualityRating.DefectLocation is not null and QualityRating.DefectLocation!='' then '位置:'+QualityRating.DefectLocation else '' end)
|
|||
|
|
-- +(case when QualityRating.DefectSize is not null then '尺寸:'+convert(nvarchar(10),cast(QualityRating.DefectSize as real)) else '' end))
|
|||
|
|
-- when ndtType.NDT_Code='PT'
|
|||
|
|
-- then ((case when QualityRating.DefectNature is not null and QualityRating.DefectNature!='' then '性质:'+QualityRating.DefectNature else '' end)
|
|||
|
|
-- +(case when QualityRating.DefectLocation is not null and QualityRating.DefectLocation!='' then '位置:'+QualityRating.DefectLocation else '' end)
|
|||
|
|
-- +(case when QualityRating.DefectSize is not null then '尺寸:'+convert(nvarchar(10),cast(QualityRating.DefectSize as real)) else '' end))
|
|||
|
|
-- when ndtType.NDT_Code='UT'
|
|||
|
|
-- then ((case when QualityRating.PeakAmplitude is not null and QualityRating.PeakAmplitude!='' then '波幅:'+QualityRating.PeakAmplitude else '' end)
|
|||
|
|
-- +(case when QualityRating.DefectLocation is not null and QualityRating.DefectLocation!='' then '位置:'+QualityRating.DefectLocation else '' end)
|
|||
|
|
-- +(case when QualityRating.DepthDefect is not null then '深度:'+convert(nvarchar(10),cast(QualityRating.DepthDefect as real)) else '' end)
|
|||
|
|
-- +(case when QualityRating.IndicatingLength is not null then '长度:'+convert(nvarchar(10),cast(QualityRating.IndicatingLength as real)) else '' end))
|
|||
|
|
-- else '' end
|
|||
|
|
-- AS Defect --缺陷情况或缺陷示意图编号
|
|||
|
|
--FROM dbo.HJGL_BO_QualityRating AS QualityRating
|
|||
|
|
--LEFT JOIN DBO.HJGL_CH_TrustItem AS TrustItem ON TrustItem.CH_TrustItemID = QualityRating.CH_TrustItemID
|
|||
|
|
--LEFT JOIN HJGL_BS_Equipment AS Equipment ON Equipment.EquipmentId=TrustItem.EquipmentId
|
|||
|
|
--LEFT JOIN dbo.HJGL_CH_Trust trust ON trust.CH_TrustID = TrustItem.CH_TrustID
|
|||
|
|
--LEFT JOIN dbo.HJGL_BS_NDTType ndtType on ndtType.NDT_ID=trust.CH_NDTMethod
|
|||
|
|
--LEFT JOIN dbo.HJGL_BO_BatchDetail batchDetail ON batchDetail.JOT_ID = QualityRating.JOT_ID
|
|||
|
|
--LEFT JOIN dbo.HJGL_BO_Batch batch ON batch.BatchId=batchDetail.BatchId
|
|||
|
|
--LEFT JOIN DBO.HJGL_PW_JointInfo AS JointInfo ON JointInfo.JOT_ID=QualityRating.JOT_ID
|
|||
|
|
--LEFT JOIN dbo.HJGL_PW_IsoInfo AS isoInfo ON isoInfo.ISO_ID=JointInfo.ISO_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_CH_TestingReportPrint AS TestingReportPrint ON TestingReportPrint.ISO_ID = QualityRating.ISO_ID
|
|||
|
|
--WHERE TestingReportPrint.ISO_ID=QualityRating.ISO_ID and JointInfo.STE_ID=@STE_ID AND (JointInfo.STE_ID2=@STE_ID2 or @STE_ID2='') AND JointInfo.WME_ID=@WME_ID
|
|||
|
|
--AND TestingReportPrint.Specifications=JointInfo.JOT_JointDesc
|
|||
|
|
--AND TestingReportPrint.BatchId = trust.BatchId
|
|||
|
|
--AND TestingReportPrint.NDT_ID = trust.CH_NDTMethod
|
|||
|
|
--AND TestingReportPrint.TestingReportPrintId=@TestingReportPrintId) v1
|
|||
|
|
--UNION all
|
|||
|
|
--SELECT v2.*
|
|||
|
|
--from
|
|||
|
|
--(SELECT qualityRatingRepair.QualityRatingRepairId AS QualityRatingId,
|
|||
|
|
-- JointInfo.JOT_JointDesc,JointInfo.JOT_JointNo+(case repair.NDT_ID when '20d2cbca-8b3d-434b-b1c1-181796986fa5' then '' else record.RepairMark end)+(case batchDetail.PointType when '2' then 'K' else '' end) as JOT_JointNo,
|
|||
|
|
-- (qualityRatingRepair.FilmNum+record.RepairMark) AS FilmNum,
|
|||
|
|
-- Welder.WED_Code,
|
|||
|
|
-- dbo.GetRepairDefectNature(qualityRatingRepair.QualityRatingRepairId,qualityRatingRepair.CH_RepairItemId) as DefectNature,
|
|||
|
|
-- qualityRatingRepair.DefectSize,
|
|||
|
|
-- Replace(qualityRatingRepair.DefectResult,' ','') AS DefectResult,
|
|||
|
|
-- qualityRatingRepair.DefectRation,
|
|||
|
|
-- batch.BatchCode, --检测批号
|
|||
|
|
-- isoInfo.ISO_IsoNo,
|
|||
|
|
-- Equipment.EquipmentName as Remark,
|
|||
|
|
-- case when ndtType.NDT_Code='MT'
|
|||
|
|
-- then ((case when qualityRatingRepair.DefectNature is not null and qualityRatingRepair.DefectNature!='' then '性质:'+qualityRatingRepair.DefectNature else '' end)
|
|||
|
|
-- +(case when qualityRatingRepair.DefectLocation is not null and qualityRatingRepair.DefectLocation!='' then '位置:'+qualityRatingRepair.DefectLocation else '' end)
|
|||
|
|
-- +(case when qualityRatingRepair.DefectSize is not null then '尺寸:'+convert(nvarchar(10),cast(qualityRatingRepair.DefectSize as real)) else '' end))
|
|||
|
|
-- when ndtType.NDT_Code='PT'
|
|||
|
|
-- then ((case when qualityRatingRepair.DefectNature is not null and qualityRatingRepair.DefectNature!='' then '性质:'+qualityRatingRepair.DefectNature else '' end)
|
|||
|
|
-- +(case when qualityRatingRepair.DefectLocation is not null and qualityRatingRepair.DefectLocation!='' then '位置:'+qualityRatingRepair.DefectLocation else '' end)
|
|||
|
|
-- +(case when qualityRatingRepair.DefectSize is not null then '尺寸:'+convert(nvarchar(10),cast(qualityRatingRepair.DefectSize as real)) else '' end))
|
|||
|
|
-- when ndtType.NDT_Code='UT'
|
|||
|
|
-- then ((case when qualityRatingRepair.PeakAmplitude is not null and qualityRatingRepair.PeakAmplitude!='' then '波幅:'+qualityRatingRepair.PeakAmplitude else '' end)
|
|||
|
|
-- +(case when qualityRatingRepair.DefectLocation is not null and qualityRatingRepair.DefectLocation!='' then '位置:'+qualityRatingRepair.DefectLocation else '' end)
|
|||
|
|
-- +(case when qualityRatingRepair.DepthDefect is not null then '深度:'+convert(nvarchar(10),cast(qualityRatingRepair.DepthDefect as real)) else '' end)
|
|||
|
|
-- +(case when qualityRatingRepair.IndicatingLength is not null then '长度:'+convert(nvarchar(10),cast(qualityRatingRepair.IndicatingLength as real)) else '' end))
|
|||
|
|
-- else '' end
|
|||
|
|
-- AS Defect --缺陷情况或缺陷示意图编号
|
|||
|
|
--FROM dbo.HJGL_BO_QualityRatingRepair AS qualityRatingRepair
|
|||
|
|
--LEFT JOIN dbo.HJGL_CH_RepairItem AS repairItem ON repairItem.CH_RepairItemId = qualityRatingRepair.CH_RepairItemId
|
|||
|
|
--LEFT JOIN HJGL_BS_Equipment AS Equipment ON Equipment.EquipmentId=repairItem.EquipmentId
|
|||
|
|
--LEFT JOIN dbo.HJGL_CH_Repair repair ON repair.CH_RepairID = repairItem.CH_RepairID
|
|||
|
|
--LEFT JOIN dbo.HJGL_BS_NDTType ndtType on ndtType.NDT_ID=repair.NDT_ID
|
|||
|
|
--LEFT JOIN dbo.HJGL_BO_BatchDetail batchDetail ON batchDetail.JOT_ID = qualityRatingRepair.JOT_ID
|
|||
|
|
--LEFT JOIN dbo.HJGL_BO_Batch batch ON batch.BatchId=batchDetail.BatchId
|
|||
|
|
--LEFT JOIN DBO.HJGL_PW_JointInfo AS JointInfo ON JointInfo.JOT_ID=qualityRatingRepair.JOT_ID
|
|||
|
|
--LEFT JOIN dbo.HJGL_PW_IsoInfo AS isoInfo ON isoInfo.ISO_ID=JointInfo.ISO_ID
|
|||
|
|
--LEFT JOIN dbo.HJGL_CH_RepairItemRecord record ON record.RepairItemRecordId = repairItem.RepairItemRecordId
|
|||
|
|
--LEFT JOIN DBO.HJGL_BS_Welder AS Welder ON Welder.WED_ID =record.JOT_CellWelder
|
|||
|
|
--LEFT JOIN DBO.HJGL_CH_TestingReportPrint AS TestingReportPrint ON TestingReportPrint.ISO_ID = qualityRatingRepair.ISO_ID
|
|||
|
|
--WHERE TestingReportPrint.ISO_ID=qualityRatingRepair.ISO_ID and JointInfo.STE_ID=@STE_ID AND (JointInfo.STE_ID2=@STE_ID2 or @STE_ID2='') AND JointInfo.WME_ID=@WME_ID
|
|||
|
|
--AND TestingReportPrint.Specifications=JointInfo.JOT_JointDesc
|
|||
|
|
--AND TestingReportPrint.BatchId = repair.BatchId
|
|||
|
|
--AND TestingReportPrint.NDT_ID = repair.NDT_ID
|
|||
|
|
--AND TestingReportPrint.TestingReportPrintId=@TestingReportPrintId) v2)
|
|||
|
|
--report) v
|
|||
|
|
--WHERE v.Number>@RowNum
|
|||
|
|
--END
|
|||
|
|
|
|||
|
|
--ELSE
|
|||
|
|
BEGIN
|
|||
|
|
insert into #SIS
|
|||
|
|
SELECT v.* FROM
|
|||
|
|
(SELECT ROW_NUMBER() OVER(ORDER BY report.JOT_JointNo,report.FilmNum) AS Number,report.*
|
|||
|
|
FROM
|
|||
|
|
(SELECT v1.*
|
|||
|
|
FROM
|
|||
|
|
(SELECT QualityRating.QualityRatingId,
|
|||
|
|
JointInfo.JOT_JointDesc,JointInfo.JOT_JointNo+(case batchDetail.PointType when '2' then 'K' else '' end) as JOT_JointNo,
|
|||
|
|
QualityRating.FilmNum,
|
|||
|
|
(CASE WHEN JointInfo.JOT_CellWelder!=JointInfo.JOT_FloorWelder THEN Welder1.WED_Code+'/'+Welder2.WED_Code ELSE Welder1.WED_Code END) AS WED_Code,
|
|||
|
|
dbo.GetDefectNature(QualityRating.QualityRatingId,QualityRating.CH_TrustItemID) as DefectNature,QualityRating.DefectSize,
|
|||
|
|
Replace(QualityRating.DefectResult,' ','') AS DefectResult,
|
|||
|
|
QualityRating.DefectRation,
|
|||
|
|
batch.BatchCode, --检测批号
|
|||
|
|
isoInfo.ISO_IsoNo,
|
|||
|
|
Equipment.EquipmentName as Remark,
|
|||
|
|
case when ndtType.NDT_Code='MT'
|
|||
|
|
then ((case when QualityRating.DefectNature is not null and QualityRating.DefectNature!='' then '性质:'+QualityRating.DefectNature else '' end)
|
|||
|
|
+(case when QualityRating.DefectLocation is not null and QualityRating.DefectLocation!='' then '位置:'+QualityRating.DefectLocation else '' end)
|
|||
|
|
+(case when QualityRating.DefectSize is not null then '尺寸:'+convert(nvarchar(10),cast(QualityRating.DefectSize as real)) else '' end))
|
|||
|
|
when ndtType.NDT_Code='PT'
|
|||
|
|
then ((case when QualityRating.DefectNature is not null and QualityRating.DefectNature!='' then '性质:'+QualityRating.DefectNature else '' end)
|
|||
|
|
+(case when QualityRating.DefectLocation is not null and QualityRating.DefectLocation!='' then '位置:'+QualityRating.DefectLocation else '' end)
|
|||
|
|
+(case when QualityRating.DefectSize is not null then '尺寸:'+convert(nvarchar(10),cast(QualityRating.DefectSize as real)) else '' end))
|
|||
|
|
when ndtType.NDT_Code='UT'
|
|||
|
|
then ((case when QualityRating.PeakAmplitude is not null and QualityRating.PeakAmplitude!='' then '波幅:'+QualityRating.PeakAmplitude else '' end)
|
|||
|
|
+(case when QualityRating.DefectLocation is not null and QualityRating.DefectLocation!='' then '位置:'+QualityRating.DefectLocation else '' end)
|
|||
|
|
+(case when QualityRating.DepthDefect is not null then '深度:'+convert(nvarchar(10),cast(QualityRating.DepthDefect as real)) else '' end)
|
|||
|
|
+(case when QualityRating.IndicatingLength is not null then '长度:'+convert(nvarchar(10),cast(QualityRating.IndicatingLength as real)) else '' end))
|
|||
|
|
else '' end
|
|||
|
|
AS Defect, --缺陷情况或缺陷示意图编号
|
|||
|
|
QualityRating.PeakAmplitude,--SL偏差dB
|
|||
|
|
QualityRating.DefectLocation, --区域
|
|||
|
|
QualityRating.IndicatingLength, --缺陷指示长度mm
|
|||
|
|
QualityRating.DepthDefect --缺陷埋藏深度mm
|
|||
|
|
FROM dbo.HJGL_BO_QualityRating AS QualityRating
|
|||
|
|
LEFT JOIN DBO.HJGL_CH_TrustItem AS TrustItem ON TrustItem.CH_TrustItemID = QualityRating.CH_TrustItemID
|
|||
|
|
LEFT JOIN HJGL_BS_Equipment AS Equipment ON Equipment.EquipmentId=TrustItem.EquipmentId
|
|||
|
|
LEFT JOIN dbo.HJGL_CH_Trust trust ON trust.CH_TrustID = TrustItem.CH_TrustID
|
|||
|
|
LEFT JOIN dbo.HJGL_BS_NDTType ndtType on ndtType.NDT_ID=trust.CH_NDTMethod
|
|||
|
|
LEFT JOIN dbo.HJGL_BO_BatchDetail batchDetail ON batchDetail.JOT_ID = QualityRating.JOT_ID
|
|||
|
|
LEFT JOIN dbo.HJGL_BO_Batch batch ON batch.BatchId=batchDetail.BatchId
|
|||
|
|
LEFT JOIN DBO.HJGL_PW_JointInfo AS JointInfo ON JointInfo.JOT_ID=QualityRating.JOT_ID
|
|||
|
|
LEFT JOIN dbo.HJGL_PW_IsoInfo AS isoInfo ON isoInfo.ISO_ID=JointInfo.ISO_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_CH_TestingReportPrint AS TestingReportPrint ON TestingReportPrint.ISO_ID = QualityRating.ISO_ID
|
|||
|
|
WHERE TestingReportPrint.ISO_ID=QualityRating.ISO_ID and JointInfo.STE_ID=@STE_ID AND (JointInfo.STE_ID2=@STE_ID2 or @STE_ID2='') AND JointInfo.WME_ID=@WME_ID
|
|||
|
|
AND TestingReportPrint.Specifications=JointInfo.JOT_JointDesc
|
|||
|
|
AND TestingReportPrint.BatchId = trust.BatchId
|
|||
|
|
AND TestingReportPrint.NDT_ID = trust.CH_NDTMethod
|
|||
|
|
AND TestingReportPrint.TestingReportPrintId=@TestingReportPrintId) v1
|
|||
|
|
UNION all
|
|||
|
|
SELECT v2.*
|
|||
|
|
from
|
|||
|
|
(SELECT qualityRatingRepair.QualityRatingRepairId AS QualityRatingId,
|
|||
|
|
JointInfo.JOT_JointDesc,JointInfo.JOT_JointNo+(case repair.NDT_ID when '20d2cbca-8b3d-434b-b1c1-181796986fa5' then '' else record.RepairMark end)+(case batchDetail.PointType when '2' then 'K' else '' end) as JOT_JointNo,
|
|||
|
|
(qualityRatingRepair.FilmNum+record.RepairMark) AS FilmNum,
|
|||
|
|
Welder.WED_Code,
|
|||
|
|
dbo.GetRepairDefectNature(qualityRatingRepair.QualityRatingRepairId,qualityRatingRepair.CH_RepairItemId) as DefectNature,
|
|||
|
|
qualityRatingRepair.DefectSize,
|
|||
|
|
Replace(qualityRatingRepair.DefectResult,' ','') AS DefectResult,
|
|||
|
|
qualityRatingRepair.DefectRation,
|
|||
|
|
batch.BatchCode, --检测批号
|
|||
|
|
isoInfo.ISO_IsoNo,
|
|||
|
|
Equipment.EquipmentName as Remark,
|
|||
|
|
case when ndtType.NDT_Code='MT'
|
|||
|
|
then ((case when qualityRatingRepair.DefectNature is not null and qualityRatingRepair.DefectNature!='' then '性质:'+qualityRatingRepair.DefectNature else '' end)
|
|||
|
|
+(case when qualityRatingRepair.DefectLocation is not null and qualityRatingRepair.DefectLocation!='' then '位置:'+qualityRatingRepair.DefectLocation else '' end)
|
|||
|
|
+(case when qualityRatingRepair.DefectSize is not null then '尺寸:'+convert(nvarchar(10),cast(qualityRatingRepair.DefectSize as real)) else '' end))
|
|||
|
|
when ndtType.NDT_Code='PT'
|
|||
|
|
then ((case when qualityRatingRepair.DefectNature is not null and qualityRatingRepair.DefectNature!='' then '性质:'+qualityRatingRepair.DefectNature else '' end)
|
|||
|
|
+(case when qualityRatingRepair.DefectLocation is not null and qualityRatingRepair.DefectLocation!='' then '位置:'+qualityRatingRepair.DefectLocation else '' end)
|
|||
|
|
+(case when qualityRatingRepair.DefectSize is not null then '尺寸:'+convert(nvarchar(10),cast(qualityRatingRepair.DefectSize as real)) else '' end))
|
|||
|
|
when ndtType.NDT_Code='UT'
|
|||
|
|
then ((case when qualityRatingRepair.PeakAmplitude is not null and qualityRatingRepair.PeakAmplitude!='' then '波幅:'+qualityRatingRepair.PeakAmplitude else '' end)
|
|||
|
|
+(case when qualityRatingRepair.DefectLocation is not null and qualityRatingRepair.DefectLocation!='' then '位置:'+qualityRatingRepair.DefectLocation else '' end)
|
|||
|
|
+(case when qualityRatingRepair.DepthDefect is not null then '深度:'+convert(nvarchar(10),cast(qualityRatingRepair.DepthDefect as real)) else '' end)
|
|||
|
|
+(case when qualityRatingRepair.IndicatingLength is not null then '长度:'+convert(nvarchar(10),cast(qualityRatingRepair.IndicatingLength as real)) else '' end))
|
|||
|
|
else '' end
|
|||
|
|
AS Defect, --缺陷情况或缺陷示意图编号
|
|||
|
|
qualityRatingRepair.PeakAmplitude,--SL偏差dB
|
|||
|
|
qualityRatingRepair.DefectLocation, --区域
|
|||
|
|
qualityRatingRepair.IndicatingLength, --缺陷指示长度mm
|
|||
|
|
qualityRatingRepair.DepthDefect --缺陷埋藏深度mm
|
|||
|
|
FROM dbo.HJGL_BO_QualityRatingRepair AS qualityRatingRepair
|
|||
|
|
LEFT JOIN dbo.HJGL_CH_RepairItem AS repairItem ON repairItem.CH_RepairItemId = qualityRatingRepair.CH_RepairItemId
|
|||
|
|
LEFT JOIN HJGL_BS_Equipment AS Equipment ON Equipment.EquipmentId=repairItem.EquipmentId
|
|||
|
|
LEFT JOIN dbo.HJGL_CH_Repair repair ON repair.CH_RepairID = repairItem.CH_RepairID
|
|||
|
|
LEFT JOIN dbo.HJGL_BS_NDTType ndtType on ndtType.NDT_ID=repair.NDT_ID
|
|||
|
|
LEFT JOIN dbo.HJGL_BO_BatchDetail batchDetail ON batchDetail.JOT_ID = qualityRatingRepair.JOT_ID
|
|||
|
|
LEFT JOIN dbo.HJGL_BO_Batch batch ON batch.BatchId=batchDetail.BatchId
|
|||
|
|
LEFT JOIN DBO.HJGL_PW_JointInfo AS JointInfo ON JointInfo.JOT_ID=qualityRatingRepair.JOT_ID
|
|||
|
|
LEFT JOIN dbo.HJGL_PW_IsoInfo AS isoInfo ON isoInfo.ISO_ID=JointInfo.ISO_ID
|
|||
|
|
LEFT JOIN dbo.HJGL_CH_RepairItemRecord record ON record.RepairItemRecordId = repairItem.RepairItemRecordId
|
|||
|
|
LEFT JOIN DBO.HJGL_BS_Welder AS Welder ON Welder.WED_ID =record.JOT_CellWelder
|
|||
|
|
LEFT JOIN DBO.HJGL_CH_TestingReportPrint AS TestingReportPrint ON TestingReportPrint.ISO_ID = qualityRatingRepair.ISO_ID
|
|||
|
|
WHERE TestingReportPrint.ISO_ID=qualityRatingRepair.ISO_ID and JointInfo.STE_ID=@STE_ID AND (JointInfo.STE_ID2=@STE_ID2 or @STE_ID2='') AND JointInfo.WME_ID=@WME_ID
|
|||
|
|
AND TestingReportPrint.Specifications=JointInfo.JOT_JointDesc
|
|||
|
|
AND TestingReportPrint.BatchId = repair.BatchId
|
|||
|
|
AND TestingReportPrint.NDT_ID = repair.NDT_ID
|
|||
|
|
AND TestingReportPrint.TestingReportPrintId=@TestingReportPrintId) v2)
|
|||
|
|
report) v
|
|||
|
|
|
|||
|
|
END
|
|||
|
|
--if((select COUNT(*) from #SIS)=@RowNum and @Flag='1')
|
|||
|
|
--begin
|
|||
|
|
--select * from #SIS
|
|||
|
|
--end
|
|||
|
|
--else
|
|||
|
|
begin
|
|||
|
|
--insert into #SIS values(10000,newid(),null,null,null,null,null,null,null,null,null,'以下空白',null,null,null,null,null,null)
|
|||
|
|
select * from #SIS
|
|||
|
|
end
|
|||
|
|
drop table #SIS
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
GO
|
|||
|
|
|
|||
|
|
|