YZ_BSF/DataBase/版本日志/已完成/HJGLDB_2025.09.12.sql

224 lines
9.0 KiB
MySQL
Raw Permalink Normal View History

2026-02-10 15:50:55 +08:00
--
update Batch_PointBatch set EndDate=GETDATE() where EndDate is null
GO
update Batch_PointBatch set ClearDate=GETDATE() where ClearDate is null
GO
INSERT INTO dbo.Sys_Menu VALUES
( '9E3834DC-ECA6-41CF-AFDB-307AEDE69EBB', '焊口业务未处理清单', 'WeldInfo No Handle List','PublicInfo/ProcessControl/WeldNoHandle.aspx',80 ,'083CE783-E1E0-46F3-9DFB-54E17A16AFD3','2',NULL)
INSERT INTO dbo.Sys_ButtonToMenu VALUES(NEWID(),'9E3834DC-ECA6-41CF-AFDB-307AEDE69EBB','查看','See',5)
GO
--delete from Sys_ButtonToMenu where MenuId='C0AF6083-0535-4D5F-99EB-CC51F4A45AC0'
--delete from Sys_Menu where MenuId='C0AF6083-0535-4D5F-99EB-CC51F4A45AC0'
--GO
INSERT INTO dbo.Sys_Menu VALUES
( 'C0AF6083-0535-4D5F-99EB-CC51F4A45AC0', 'NDE预点口统计表', 'Pro Point weld List','WeldingProcess/WeldingReport/ProPointWeldList.aspx',155 ,'F3B157B7-9BEE-4150-80CB-087828F1C51D','3',NULL)
INSERT INTO dbo.Sys_ButtonToMenu VALUES(NEWID(),'C0AF6083-0535-4D5F-99EB-CC51F4A45AC0','查看','See',5)
GO
--
ALTER TABLE dbo.Pipeline_Pipeline ADD IsPressurePipe BIT NULL
GO
--
ALTER TABLE dbo.Batch_PointBatch ADD JointArea nvarchar(10) NULL
GO
--
ALTER TABLE dbo.Base_ProjectType ADD ProjectTypeCode nvarchar(50) NULL
GO
ALTER VIEW [dbo].[View_Pipeline_Pipeline]
AS
/*************管线视图*****************/
SELECT pipeline.PipelineId,
pipeline.ProjectId,
pipeline.InstallationId,
pipeline.UnitId,
pipeline.WorkAreaId,
pipeline.PipelineCode,
pipeline.SingleNumber,
pipeline.PipingClassId,
pipeline.MainMaterialId,
pipeline.MediumId,
pipeline.Specification,
pipeline.SystemNumber,
pipeline.SubSystemNumber,
pipeline.WorkPackageCode,
pipeline.TestPackageCode,
pipeline.PipelineLength,
pipeline.Sheet,
pipeline.PipeSegment,
pipeline.DrawingsNum,
pipeline.PaintingCategory,
pipeline.AdiabaticCategory,
pipeline.DesignPressure,
pipeline.DesignTemperature,
pipeline.TestPressure,
pipeline.TestTemperature,
pipeline.ModifierId,
pipeline.ModifyDate,
pipeline.CreatorId,
pipeline.CreateDate,
pipeline.PenetrationRatio,
pipeline.PenetrationClass,
pipeline.IfPickling,
pipeline.IfChasing,
pipeline.Remark,
pipeline.IsPressurePipe,
pipingClass.PipingClassCode,
case pipeline.IfPickling when 1 then '' else '' end as IfPicklingStr,
CAST((select SUM(ISNULL(Size,0)) from dbo.Pipeline_WeldJoint where PipelineId=pipeline.PipelineId) AS DECIMAL(19,4)) AS TotalDin,
(select Count(WeldJointId) from dbo.Pipeline_WeldJoint where PipelineId=pipeline.PipelineId) AS JointCount,
unit.UnitName,
workArea.WorkAreaCode,
material.MaterialCode,
medium.MediumCode
FROM Pipeline_Pipeline AS pipeline
LEFT JOIN Base_PipingClass AS pipingClass ON pipingClass.PipingClassId=pipeline.PipingClassId
LEFT JOIN dbo.Base_Unit AS unit on unit.UnitId=pipeline.UnitId
LEFT JOIN Project_WorkArea AS workArea on workArea.WorkAreaId=pipeline.WorkAreaId
LEFT JOIN Base_Material AS material on material.MaterialId=pipeline.MainMaterialId
LEFT JOIN Base_Medium AS medium on medium.MediumId=pipeline.MediumId
GO
ALTER VIEW [dbo].[View_Batch_BatchTrustItem]
AS
/********无损委托********/
SELECT
ROW_NUMBER() OVER(ORDER BY WeldJointCode) AS Number,
BatchTrustItem.TrustBatchItemId,
BatchTrustItem.TrustBatchId,
BatchTrustItem.PointBatchItemId,
BatchTrustItem.WeldJointId,
BatchTrustItem.CreateDate,
BatchTrustItem.TrustNum,
BatchTrust.TrustType,
BatchTrustItem.RepairNum,
BatchTrustItem.IsCancelTrust,
BatchTrustItem.CancelReason,
BatchTrustItem.Remark,
BatchTrust.TrustBatchCode, --
BatchTrust.TrustDate,
BatchTrust.ProjectId,
ins.InstallationCode, --
area.WorkAreaCode, --
pipe.PipelineCode, --线
pipingClass.PipingClassCode, --线
jot.WeldJointCode, --
(CASE WHEN jot.Material1Id!=jot.Material1Id THEN mat1.MaterialCode+'/'+mat2.MaterialCode ELSE mat1.MaterialCode END) AS MaterialCode, --
(CASE WHEN jot.WeldingLocationId!='' AND jot.WeldingLocationId IS NOT NULL THEN jot.JointArea+'-'+loc.WeldingLocationCode
ELSE jot.JointArea END) AS JointArea, --
(CASE WHEN jot.CoverWelderId!=jot.BackingWelderId THEN welderb.WelderCode+'/'+welderc.WelderCode ELSE welderb.WelderCode END) AS WelderCode, --
--welder.WelderCode AS WelderCode, --
weldType.WeldTypeCode, --
jot.Dia, --
jot.Size, --
jot.Thickness, --
method.WeldingMethodCode, --
rate.DetectionRateCode+'%' AS DetectionRateCode,
PointBatchItem.PointDate, --
PointBatchItem.AcceptLevel, --
pipe.Sheet, --
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 welderb ON welderb.WelderId = jot.BackingWelderId
LEFT JOIN dbo.Welder_Welder welderc ON welderc.WelderId = jot.CoverWelderId
LEFT JOIN dbo.Base_Material mat1 ON mat1.MaterialId = jot.Material1Id
LEFT JOIN dbo.Base_Material mat2 ON mat2.MaterialId = jot.Material2Id
LEFT JOIN dbo.Base_WeldingMethod method ON method.WeldingMethodId = jot.WeldingMethodId
LEFT JOIN dbo.Base_WeldingLocation loc ON loc.WeldingLocationId = jot.WeldingLocationId
GO
ALTER VIEW [dbo].[View_Batch_PointBatchItem]
AS
/*************点口明细表*************/
SELECT PointBatchItem.PointBatchItemId,
PointBatchItem.PointBatchId,
PointBatchItem.WeldJointId,
mat.MaterialCode,
(CASE PointBatchItem.PointState WHEN '1' THEN '点口' WHEN '2' THEN '扩透' END) AS PointState,
PointBatchItem.PointDate,--
PointBatchItem.RepairDate,--
PointBatchItem.CutDate,--
WorkArea.WorkAreaCode,--
WeldJoint.WeldJointCode,--
WeldJoint.JointArea,--
WeldJoint.Size,--
WeldJoint.IsCancel,--
WeldingDaily.WeldingDate,--
Pipeline.PipelineCode, --线
Pipeline.IsPressurePipe,--
PipingClass.PipingClassName, --
PointBatchItem.Remark
FROM Batch_PointBatchItem AS PointBatchItem
LEFT JOIN Batch_PointBatch AS PointBatch ON PointBatch.PointBatchId=PointBatchItem.PointBatchId
LEFT JOIN Pipeline_WeldJoint AS WeldJoint ON WeldJoint.WeldJointId=PointBatchItem.WeldJointId
LEFT JOIN Pipeline_Pipeline AS Pipeline ON Pipeline.PipelineId=WeldJoint.PipelineId
LEFT JOIN Project_WorkArea AS WorkArea ON WorkArea.WorkAreaId=Pipeline.WorkAreaId
LEFT JOIN Pipeline_WeldingDaily AS WeldingDaily ON WeldingDaily.WeldingDailyId=WeldJoint.WeldingDailyId
LEFT JOIN Base_PipingClass AS PipingClass ON PipingClass.PipingClassId=Pipeline.PipingClassId
LEFT JOIN dbo.Base_Material mat ON mat.MaterialId = WeldJoint.Material1Id
GO
CREATE VIEW [dbo].[View_Batch_PointBatchItem2]
AS
/*************点口明细表*************/
SELECT PointBatchItem.PointBatchItemId,
PointBatchItem.PointBatchId,
PointBatchItem.WeldJointId,
mat.MaterialCode,
(CASE PointBatchItem.PointState WHEN '1' THEN '点口' WHEN '2' THEN '扩透' END) AS PointState,
PointBatchItem.PointDate,--
PointBatchItem.RepairDate,--
PointBatchItem.CutDate,--
WorkArea.WorkAreaCode,--
WeldJoint.WeldJointCode,--
WeldJoint.JointArea,--
WeldJoint.Size,--
WeldJoint.IsCancel,--
WeldingDaily.WeldingDate,--
Pipeline.PipelineCode, --线
Pipeline.IsPressurePipe,--
PipingClass.PipingClassName, --
(select COUNT(1) from dbo.Batch_NDEItem where TrustBatchItemId in (select TrustBatchItemId from dbo.Batch_BatchTrustItem
where PointBatchItemId=PointBatchItem.PointBatchItemId)) AS CheckNum, --
PointBatchItem.Remark
FROM Batch_PointBatchItem AS PointBatchItem
LEFT JOIN Batch_PointBatch AS PointBatch ON PointBatch.PointBatchId=PointBatchItem.PointBatchId
LEFT JOIN Pipeline_WeldJoint AS WeldJoint ON WeldJoint.WeldJointId=PointBatchItem.WeldJointId
LEFT JOIN Pipeline_Pipeline AS Pipeline ON Pipeline.PipelineId=WeldJoint.PipelineId
LEFT JOIN Project_WorkArea AS WorkArea ON WorkArea.WorkAreaId=Pipeline.WorkAreaId
LEFT JOIN Pipeline_WeldingDaily AS WeldingDaily ON WeldingDaily.WeldingDailyId=WeldJoint.WeldingDailyId
LEFT JOIN Base_PipingClass AS PipingClass ON PipingClass.PipingClassId=Pipeline.PipingClassId
LEFT JOIN dbo.Base_Material mat ON mat.MaterialId = WeldJoint.Material1Id
GO