ALTER VIEW [dbo].[View_Common_Project_UnitList] /*项目参与单位列表视图*/ AS SELECT ProjectUnit.ProjectUnitId ,ProjectUnit.UnitId ,ProjectUnit.ProjectId ,BaseUnit.UnitName ,ProjectUnit.UnitType ,unitType.UnitTypeName ,BaseUnit.UnitCode ,ProjectUnit.ProjectRange ,BaseUnit.Address ,ProjectUnit.InTime ,ProjectUnit.OutTime ,ProjectUnit.Phone FROM dbo.Project_Unit AS ProjectUnit LEFT JOIN dbo.Base_Unit AS BaseUnit ON ProjectUnit.UnitId =BaseUnit.UnitId LEFT JOIN dbo.Base_UnitType unitType ON unitType.UnitTypeId = BaseUnit.UnitTypeId GO ALTER VIEW [dbo].[View_Batch_BatchTrustItem] AS /********无损委托********/ SELECT BatchTrustItem.TrustBatchItemId, BatchTrustItem.TrustBatchId, BatchTrustItem.PointBatchItemId, BatchTrustItem.WeldJointId, BatchTrustItem.CreateDate, BatchTrustItem.TrustNum, BatchTrust.TrustType, BatchTrustItem.RepairNum, BatchTrust.TrustBatchCode, --委托单号 BatchTrust.ProjectId, ins.InstallationCode, --装置 area.WorkAreaCode, --工区号 pipe.PipelineCode, --管线号 pipingClass.PipingClassCode, --管线等级 jot.WeldJointCode, --焊口号 mat.MaterialCode, --材质 jot.JointArea, --焊接区域 welder.WelderCode AS WelderCode, --焊工号 weldType.WeldTypeCode, --焊缝类型 jot.Dia, --外径 jot.Size, --寸径 jot.Thickness, --壁厚 method.WeldingMethodCode, --焊接方法 rate.DetectionRateCode, PointBatchItem.PointDate, --点口日期 PipingClass.PNO FROM Batch_BatchTrustItem AS BatchTrustItem LEFT JOIN dbo.Batch_BatchTrust AS BatchTrust ON BatchTrust.TrustBatchId=BatchTrustItem.TrustBatchId LEFT JOIN Batch_PointBatchItem AS PointBatchItem ON PointBatchItem.PointBatchItemId=BatchTrustItem.PointBatchItemId LEFT JOIN dbo.Batch_PointBatch point ON point.PointBatchId = PointBatchItem.PointBatchId LEFT JOIN dbo.Base_DetectionRate rate ON rate.DetectionRateId = point.DetectionRateId LEFT JOIN dbo.Pipeline_WeldJoint jot ON jot.WeldJointId = BatchTrustItem.WeldJointId LEFT JOIN dbo.Pipeline_Pipeline pipe ON pipe.PipelineId = jot.PipelineId LEFT JOIN Base_PipingClass AS pipingClass ON PipingClass.PipingClassId=pipe.PipingClassId LEFT JOIN dbo.Project_Installation ins ON ins.InstallationId = BatchTrust.InstallationId LEFT JOIN dbo.Project_WorkArea area ON pipe.WorkAreaId=area.WorkAreaId LEFT JOIN dbo.Base_WeldType weldType ON weldType.WeldTypeId = jot.WeldTypeId LEFT JOIN dbo.Welder_Welder welder ON welder.WelderId = jot.BackingWelderId LEFT JOIN dbo.Base_Material mat ON mat.MaterialId = jot.Material1Id LEFT JOIN dbo.Base_WeldingMethod method ON method.WeldingMethodId = jot.WeldingMethodId GO ALTER VIEW [dbo].[View_NDTBacklogList] /**********NDE积压焊口一览表***************/ AS SELECT PointBatch.ProjectId, PointBatch.InstallationId, PointBatch.UnitId, BatchTrustItem.TrustBatchItemId ,(ISNULL(WorkArea.WorkAreaCode,'')+ '-' + Pipeline.PipelineCode + '-' + ISNULL(Medium.MediumCode,'')) AS ISO_IsoNo --施工区域+管线号+介质 ,PipingClass.PipingClassName --管线等级 ,WeldJoint.WeldJointCode --焊口号 ,WeldJoint.JointArea --焊接区域 ,Welder.WelderCode --焊工号 ,WeldType.WeldTypeName --焊缝类型 ,CAST(WeldJoint.Size AS NVARCHAR(100)) AS JOT_Dia--外径 ,CAST(WeldJoint.Thickness AS NVARCHAR(100)) AS JOT_Sch --壁厚 ,CONVERT(VARCHAR(100), PointBatchItem.PointDate, 1) AS PointDate --点口日期 --,(case when NDTType.SysType ='1' then NDTRate.AcceptGrade else 'Ⅰ' end) as AcceptGrade --'1'为RT类型 ,DetectionType.DetectionTypeId ,DetectionType.DetectionTypeName --检测方法 ,PipingClass.PNO FROM Batch_BatchTrustItem AS BatchTrustItem LEFT JOIN Batch_BatchTrust AS BatchTrust ON BatchTrust.TrustBatchId =BatchTrustItem.TrustBatchId LEFT JOIN Batch_PointBatchItem AS PointBatchItem ON PointBatchItem.PointBatchItemId =BatchTrustItem.PointBatchItemId LEFT JOIN Batch_PointBatch AS PointBatch ON PointBatchItem.PointBatchId =PointBatch.PointBatchId LEFT JOIN Batch_NDEItem ON Batch_NDEItem.TrustBatchItemId = BatchTrustItem.TrustBatchItemId LEFT JOIN Pipeline_WeldJoint AS WeldJoint ON WeldJoint.WeldJointId =PointBatchItem.WeldJointId LEFT JOIN Pipeline_Pipeline AS Pipeline ON Pipeline.PipelineId =WeldJoint.PipelineId LEFT JOIN Base_PipingClass AS PipingClass ON PipingClass.PipingClassId =Pipeline.PipingClassId LEFT JOIN Project_WorkArea AS WorkArea ON WorkArea.WorkAreaId =Pipeline.WorkAreaId LEFT JOIN Base_Medium AS Medium ON Medium.MediumId =Pipeline.MediumId LEFT JOIN Welder_Welder AS Welder ON Welder.WelderId =WeldJoint.CoverWelderId LEFT JOIN Base_WeldType AS WeldType ON WeldType.WeldTypeId =PointBatch.WeldTypeId LEFT JOIN Base_DetectionType AS DetectionType ON DetectionType.DetectionTypeId =PointBatch.DetectionTypeId LEFT JOIN Base_DetectionRate AS DetectionRate ON DetectionRate.DetectionRateId =PointBatch.DetectionRateId WHERE NDEItemID IS NULL OR(NDEItemID IS NOT NULL AND Batch_NDEItem.SubmitDate IS NULL) GO