Basf_TCC7/DataBase/版本日志/已完成/HJGLDB_2024.01.21.sql

82 lines
3.1 KiB
Transact-SQL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

UPDATE dbo.Pipeline_WeldJoint SET Specification=REPLACE(Specification,'*','×')
GO
ALTER TABLE dbo.Base_Project ADD EnProjectName NVARCHAR(150) NULL
GO
ALTER TABLE dbo.Project_WorkArea ADD EnWorkAreaName NVARCHAR(100) NULL
GO
ALTER TABLE dbo.Base_DetectionType ADD TestStandard NVARCHAR(100) NULL
GO
ALTER TABLE dbo.Base_DetectionType ADD TechLevel NVARCHAR(20) NULL
GO
ALTER TABLE dbo.WPQ_WPQList DROP CONSTRAINT FK_WPQ_WPQList_Base_Material1
ALTER TABLE dbo.WPQ_WPQList DROP CONSTRAINT FK_WPQ_WPQList_Base_Material2
ALTER TABLE dbo.WPQ_WPQList ALTER COLUMN MaterialId1 NVARCHAR(500) NULL
ALTER TABLE dbo.WPQ_WPQList ALTER COLUMN MaterialId2 NVARCHAR(500) NULL
GO
ALTER TABLE dbo.Batch_BatchTrust ADD SurfaceState NVARCHAR(50) NULL
ALTER TABLE dbo.Batch_BatchTrust ADD DetectionTiming NVARCHAR(50) NULL
GO
ALTER VIEW [dbo].[View_Batch_BatchTrust]
AS
/********无损委托********/
SELECT BatchTrust.TrustBatchId,
BatchTrust.TrustBatchCode,
(CASE WHEN BatchTrust.TrustType='1' THEN BatchTrust.TrustBatchCode
WHEN BatchTrust.TrustType='2' THEN BatchTrust.TrustBatchCode+'K1'
WHEN BatchTrust.TrustType='3' THEN BatchTrust.TrustBatchCode+'R1' END) AS NewTrustBatchCode,
BatchTrust.TrustDate,
BatchTrust.NDEUuit,
BatchTrust.ProjectId,
project.ProjectCode,
BatchTrust.UnitId,
BatchTrust.InstallationId,
BatchTrust.PipelineId,
pipe.PipelineCode,
BatchTrust.DetectionTypeId,
BatchTrust.IsCheck,
BatchTrust.TopointBatch,
BatchTrust.SurfaceState,
BatchTrust.DetectionTiming,
BatchTrust.QuaCertFile,
BatchTrust.AcceptStandard,
Unit.UnitCode,
Unit.UnitName,
Installation.InstallationName,
Installation.InstallationCode,
DetectionType.DetectionTypeCode,
ndtCheck.TrustBatchId AS CheckTrustBatchId,
DetectionType.TestStandard,
DetectionType.TechLevel,
rate.DetectionRateCode,
'巴斯夫一体化基地(广东)有限公司' AS TrustUnit,
(SELECT GrooveTypeCode FROM dbo.Base_GrooveType WHERE GrooveTypeId=
(SELECT TOP 1 GrooveTypeId FROM dbo.Pipeline_WeldJoint WHERE WeldJointId =
(SELECT TOP 1 WeldJointId FROM dbo.Batch_BatchTrustItem WHERE TrustBatchId=BatchTrust.TrustBatchId))) AS GrooveTypeCode,
(SELECT WeldingMethodCode FROM dbo.Base_WeldingMethod WHERE WeldingMethodId=
(SELECT TOP 1 WeldingMethodId FROM dbo.Pipeline_WeldJoint WHERE WeldJointId =
(SELECT TOP 1 WeldJointId FROM dbo.Batch_BatchTrustItem WHERE TrustBatchId=BatchTrust.TrustBatchId))) AS WeldingMethodCode
FROM Batch_BatchTrust AS BatchTrust
LEFT JOIN dbo.Base_Project project ON project.ProjectId = BatchTrust.ProjectId
LEFT JOIN Base_Unit AS Unit ON Unit.UnitId=BatchTrust.UnitId
LEFT JOIN Project_Installation AS Installation ON Installation.InstallationId=BatchTrust.InstallationId
LEFT JOIN dbo.Pipeline_Pipeline pipe ON pipe.PipelineId = BatchTrust.PipelineId
LEFT JOIN Base_DetectionType AS DetectionType ON DetectionType.DetectionTypeId=BatchTrust.DetectionTypeId
LEFT JOIN dbo.Base_DetectionRate rate ON rate.DetectionRateId=pipe.DetectionRateId
LEFT JOIN dbo.Batch_NDE ndtCheck ON ndtCheck.TrustBatchId = BatchTrust.TrustBatchId
WHERE (SELECT COUNT(TrustBatchItemId) FROM Batch_BatchTrustItem WHERE IsCancelTrust IS NULL AND TrustBatchId=BatchTrust.TrustBatchId)>0
GO