Basf_TCC7/HJGL/DataBase/版本日志/BSFDB_2019.07.09.sql

116 lines
4.7 KiB
Transact-SQL
Raw Blame History

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 '<27>' 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