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

168 lines
8.9 KiB
MySQL
Raw Normal View History

2024-05-08 10:02:08 +08:00
ALTER TABLE dbo.Batch_PointBatchItem ADD JLAudit NVARCHAR(50) NULL
ALTER TABLE dbo.Batch_PointBatchItem ADD GLGSAudit NVARCHAR(50) NULL
ALTER TABLE dbo.Batch_PointBatchItem ADD QTAudit NVARCHAR(50) NULL
GO
INSERT INTO Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,ButtonEnName,SortIndex)
VALUES('4F7159BD-41CE-420B-97BD-47C424C03B57','3ACE25CE-C5CE-4CEC-AD27-0D5CF1DF2F01','<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','JLAudit',7)
GO
INSERT INTO Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,ButtonEnName,SortIndex)
VALUES('50B2493D-6D31-428B-A7BE-BADAFCD42133','3ACE25CE-C5CE-4CEC-AD27-0D5CF1DF2F01','<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˾<EFBFBD><EFBFBD><EFBFBD><EFBFBD>','GLGSAudit',8)
GO
INSERT INTO Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,ButtonEnName,SortIndex)
VALUES('5767A4F3-3F07-480B-B571-FAF8BD3E3932','3ACE25CE-C5CE-4CEC-AD27-0D5CF1DF2F01','<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','QTAudit',9)
GO
DELETE FROM dbo.Sys_ButtonToMenu WHERE ButtonToMenuId='8A5AAC48-660A-4139-9D27-B43716F4BD90'
UPDATE dbo.Sys_ButtonToMenu SET SortIndex=15 WHERE ButtonToMenuId='477D2645-257D-4928-9FE5-3A54241ADF16'
ALTER VIEW [dbo].[View_Batch_PointBatchItem]
AS
/*************<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD><EFBFBD>*************/
SELECT PointBatchItem.PointBatchItemId,
PointBatchItem.PointBatchId,
PointBatch.ProjectId,
PointBatch.InstallationId,
PointBatch.UnitId,
PointBatch.PointBatchCode,
PointBatch.DetectionTypeId,
Pipeline.WorkAreaId,
PointBatchItem.WeldJointId,
PointBatchItem.PointState AS PState,
(CASE PointBatchItem.PointState WHEN '1' THEN '<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' WHEN '2' THEN '<EFBFBD><EFBFBD>͸' END) AS PointState,
--(CASE PointBatchItem.IsAudit WHEN 1 THEN '<EFBFBD><EFBFBD>' ELSE '<EFBFBD><EFBFBD>' END) AS PointIsAudit,
--(CASE WHEN PointBatchItem.IsAudit=1 THEN '<EFBFBD><EFBFBD>'
-- WHEN (PointBatchItem.IsAudit IS NULL OR PointBatchItem.IsAudit=0) AND PointBatchItem.PointState IS NOT NULL THEN '<27><>'
-- WHEN (PointBatchItem.IsAudit IS NULL OR PointBatchItem.IsAudit=0) AND PointBatchItem.PointState IS NULL THEN '' END) AS PointIsAudit,
PointBatchItem.PointDate,--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
PointBatchItem.RepairDate,--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
PointBatchItem.CutDate,--<EFBFBD>г<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
PointBatchItem.RepairRecordId,
PointBatchItem.IsBuildTrust,--<EFBFBD>Ƿ<EFBFBD>ί<EFBFBD><EFBFBD>
WorkArea.WorkAreaCode,--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
jot.WeldJointCode,--<EFBFBD><EFBFBD><EFBFBD>ں<EFBFBD>
jot.BackingWelderId AS WelderId, --<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ID
jot.JointArea,--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
jot.Dia,
jot.Size,--ʵ<EFBFBD>ʴ
WeldingDaily.WeldingDate,--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
jot.PipelineId, --<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ID
jot.Material1Id AS Mat, --<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
jot.Specification, --<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
weldType.Flag, --<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
Pipeline.PipelineCode, --<EFBFBD><EFBFBD><EFBFBD>ߺ<EFBFBD>
PipingClass.PipingClassName, --<EFBFBD>ܵ<EFBFBD><EFBFBD>ȼ<EFBFBD>
(CASE WHEN PointBatchItem.JLAudit IS NOT NULL THEN userJL.UserName ELSE (CASE WHEN PointBatchItem.PointState IS NOT NULL THEN 'δ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' ELSE '' END) END) AS JLAudit,
(CASE WHEN PointBatchItem.GLGSAudit IS NOT NULL THEN userGLGS.UserName ELSE (CASE WHEN PointBatchItem.PointState IS NOT NULL THEN 'δ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' ELSE '' END) END) AS GLGSAudit,
(CASE WHEN PointBatchItem.QTAudit IS NOT NULL THEN userQT.UserName ELSE (CASE WHEN PointBatchItem.PointState IS NOT NULL THEN 'δ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' ELSE '' END) END) AS QTAudit,
(CASE WHEN jot.BackingWelderId!=jot.CoverWelderId THEN backingWelder.WelderCode+'/'+coverWelder.WelderCode ELSE backingWelder.WelderCode END) AS WelderCode--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
FROM Batch_PointBatchItem AS PointBatchItem
LEFT JOIN Batch_PointBatch AS PointBatch ON PointBatch.PointBatchId=PointBatchItem.PointBatchId
LEFT JOIN Pipeline_WeldJoint AS jot ON jot.WeldJointId=PointBatchItem.WeldJointId
LEFT JOIN Pipeline_Pipeline AS Pipeline ON Pipeline.PipelineId=jot.PipelineId
LEFT JOIN dbo.Base_WeldType weldType ON weldType.WeldTypeId = jot.WeldTypeId
LEFT JOIN dbo.Welder_Welder backingWelder ON backingWelder.WelderId = jot.BackingWelderId
LEFT JOIN dbo.Welder_Welder coverWelder ON coverWelder.WelderId = jot.CoverWelderId
LEFT JOIN Project_WorkArea AS WorkArea ON WorkArea.WorkAreaId=Pipeline.WorkAreaId
LEFT JOIN Pipeline_WeldingDaily AS WeldingDaily ON WeldingDaily.WeldingDailyId=jot.WeldingDailyId
LEFT JOIN Base_PipingClass AS PipingClass ON PipingClass.PipingClassId=Pipeline.PipingClassId
LEFT JOIN dbo.Sys_User userJL ON userJL.UserId = PointBatchItem.JLAudit
LEFT JOIN dbo.Sys_User userGLGS ON userGLGS.UserId = PointBatchItem.GLGSAudit
LEFT JOIN dbo.Sys_User userQT ON userQT.UserId = PointBatchItem.GLGSAudit
GO
ALTER PROC [dbo].[sp_rpt_JointComprehensive]
@projectId NVARCHAR(50),
@workAreaId NVARCHAR(50)=NULL,
@pipelineIds NVARCHAR(MAX) = NULL
AS
/**********<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ۺ<EFBFBD><EFBFBD><EFBFBD>Ϣ**********/
SELECT
weldJoint.WeldJointId,
weldJoint.ProjectId,
WorkArea.WorkAreaId,
WorkArea.WorkAreaCode,
weldJoint.SystemNumber,
weldJoint.TestPackageNo,
pipeline.SingleNumber,
pipeline.PipelineCode,
weldJoint.PipeSegment,--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܶ<EFBFBD>
(CASE WHEN weldJoint.JointAttribute='<EFBFBD>̶<EFBFBD>F' THEN 'F'+weldJoint.WeldJointCode ELSE 'S'+weldJoint.WeldJointCode END) AS WeldJointCode,
weldType.WeldTypeCode,
weldJoint.JointAttribute,
weldJoint.Dia,
weldJoint.Thickness,--<EFBFBD>ں<EFBFBD>
weldJoint.HeartNo1,
weldJoint.HeartNo2,
com1.ComponentsName AS PipeAssembly1,
com2.ComponentsName AS PipeAssembly2,
material.MaterialCode,
cw.WelderCode AS CoverWelderCode,
fw.WelderCode AS BackingWelderCode,
WeldMethod.WeldingMethodName,
medium.MediumName,
weldingDaily.WeldingDate,
weldingDaily.WeldingDailyCode,
trust.TrustBatchCode,
--TrustBatchCode.DetectionRateCode,
--TrustBatchCode.AcceptLevel,
(CASE WHEN weldJoint.IsHotProess=1 THEN '<EFBFBD><EFBFBD>' ELSE '<EFBFBD><EFBFBD>' END) AS IsHotProess,
null as TrustBatchCode,
null as DetectionRateCode,
null as AcceptLevel,
nde.NDEDate AS CHT_CHECKDATE,
ndeItem.NDEReportNo,
CAST(ISNULL(weldJoint.Size,0) AS DECIMAL(19,2)) AS JOT_Size,
WeldMaterialMat.ConsumablesCode AS WMT_MatCode,
WeldMaterialMat.ConsumablesName AS WMT_Matname,
WeldMaterialSilk.ConsumablesCode AS hsCode,
WeldMaterialSilk.ConsumablesName AS hsname,
weldJoint.Specification,
wps.WPQCode,ndttype.DetectionTypeCode,NULL AS HotReportCode,
(CASE WHEN (PointBatchItem.PointState='1' OR PointBatchItem.PointState='2') then '<EFBFBD><EFBFBD>' ELSE '<EFBFBD><EFBFBD>' END) AS if_dk
FROM Pipeline_WeldJoint AS weldJoint
LEFT JOIN Pipeline_Pipeline AS pipeline ON pipeline.PipelineId = weldJoint.PipelineId
LEFT JOIN Project_WorkArea AS WorkArea ON WorkArea.WorkAreaId = pipeline.WorkAreaId
LEFT JOIN Base_Material AS material ON material.MaterialId = weldJoint.Material1Id
LEFT JOIN Base_WeldingMethod AS WeldMethod ON WeldMethod.WeldingMethodId = weldJoint.WeldingMethodId
LEFT JOIN dbo.Base_WeldType weldType ON weldType.WeldTypeId = weldJoint.WeldTypeId
LEFT JOIN Base_Medium AS medium ON medium.MediumId = pipeline.MediumId
LEFT JOIN Base_Components com1 ON com1.ComponentsId=weldJoint.PipeAssembly1Id
LEFT JOIN Base_Components com2 ON com2.ComponentsId=weldJoint.PipeAssembly2Id
LEFT JOIN Pipeline_WeldingDaily AS weldingDaily ON weldingDaily.WeldingDailyId = weldJoint.WeldingDailyId
LEFT JOIN dbo.WPQ_WPQList wps ON wps.WPQId = weldJoint.WPQId
left join Welder_Welder AS fw on weldJoint.BackingWelderId = fw.WelderId
left join Welder_Welder AS cw on weldJoint.CoverWelderId = cw.WelderId
LEFT JOIN Base_Consumables AS WeldMaterialMat ON WeldMaterialMat.ConsumablesId =weldJoint.WeldMatId
LEFT JOIN Base_Consumables AS WeldMaterialSilk ON WeldMaterialSilk.ConsumablesId =weldJoint.WeldSilkId
LEFT JOIN Batch_PointBatchItem AS PointBatchItem ON PointBatchItem.WeldJointId =weldJoint.WeldJointId
LEFT JOIN dbo.Batch_PointBatch point ON point.PointBatchId = PointBatchItem.PointBatchId
LEFT JOIN dbo.Base_DetectionType ndttype ON ndttype.DetectionTypeId = point.DetectionTypeId
LEFT JOIN dbo.Batch_BatchTrustItem trustItem ON trustItem.PointBatchItemId = PointBatchItem.PointBatchItemId
LEFT JOIN dbo.Batch_BatchTrust trust ON trust.TrustBatchId = trustItem.TrustBatchId
LEFT JOIN dbo.Batch_NDEItem ndeItem ON ndeItem.TrustBatchItemId = trustItem.TrustBatchItemId
LEFT JOIN dbo.Batch_NDE nde ON nde.NDEID = ndeItem.NDEID
--LEFT JOIN (SELECT PointBatchItem.WeldJointId,PointBatchItem.AcceptLevel, TrustBatchCode,rate.DetectionRateCode FROM Batch_BatchTrustItem AS TrustBatchItem
-- LEFT JOIN Batch_BatchTrust AS TrustBatch ON TrustBatchItem.TrustBatchId = TrustBatch.TrustBatchId
-- LEFT JOIN Batch_PointBatchItem AS PointBatchItem ON TrustBatchItem.PointBatchItemId =PointBatchItem.PointBatchItemId
-- LEFT JOIN Batch_PointBatch AS point ON point.PointBatchId =PointBatchItem.PointBatchId
-- LEFT JOIN Base_DetectionRate rate ON rate.DetectionRateId =point.DetectionRateId)
-- AS TrustBatchCode ON TrustBatchCode.WeldJointId = weldJoint.WeldJointId
--LEFT JOIN (SELECT PointBatchItem.WeldJointId,NDEDate
-- FROM Batch_NDEItem AS NDEItem
-- LEFT JOIN Batch_BatchTrustItem AS TrustBatchItem ON NDEItem.TrustBatchItemId = TrustBatchItem.TrustBatchItemId
-- LEFT JOIN Batch_PointBatchItem AS PointBatchItem ON PointBatchItem.PointBatchItemId = TrustBatchItem.PointBatchItemId
-- LEFT JOIN Batch_NDE AS Checks ON NDEItem.NDEID = Checks.NDEID)
-- AS CheckDate ON CheckDate.WeldJointId = weldJoint.WeldJointId
WHERE weldJoint.ProjectId=@projectId
AND(pipeline.WorkAreaId=@workAreaId OR @workAreaId IS NULL)
AND (CHARINDEX(weldJoint.PipelineId,@pipelineIds)>0 or @pipelineIds IS NULl)
--AND(pipeline.PipelineCode=@pipelineCode OR @pipelineCode IS NULl)
GO