SGGL_SHJ/DataBase/版本日志/SGGLDB_V2023-11-24.sql

94 lines
4.3 KiB
MySQL
Raw Normal View History

2023-11-24 11:35:23 +08:00
CREATE PROC [dbo].[sp_rpt_CheckResult]
@unitId NVARCHAR(50) = NULL, --<EFBFBD><EFBFBD>λId
@detectionTypeId NVARCHAR(50) = NULL, --̽<EFBFBD><EFBFBD>
@flowingSection NVARCHAR(50) = NULL, --̽<EFBFBD><EFBFBD>
@date1 DATETIME = NULL,
@date2 DATETIME = NULL,
@projectId NVARCHAR(50) = NULL
AS
/*<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
2023-11-24 12:11:42 +08:00
select ndeItem.NDEItemID,unit.UnitName,jot.WeldJointCode,detectionType.DetectionTypeCode,ndeItem.TotalFilm,ndeItem.PassFilm,
2023-11-24 11:35:23 +08:00
case ndeItem.CheckResult when '1' then '<EFBFBD>ϸ<EFBFBD>' else '<EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD>' end as CheckResult,pipeline.FlowingSection
from HJGL_Batch_NDEItem ndeItem
LEFT JOIN dbo.Base_DetectionType detectionType ON detectionType.DetectionTypeId = ndeItem.DetectionTypeId
LEFT JOIN dbo.HJGL_Batch_BatchTrustItem trustItem ON trustItem.TrustBatchItemId = ndeItem.TrustBatchItemId
LEFT JOIN dbo.HJGL_WeldJoint jot ON jot.WeldJointId = trustItem.WeldJointId
LEFT JOIN dbo.HJGL_Pipeline pipeline ON jot.PipelineId = pipeline.PipelineId
LEFT JOIN dbo.HJGL_WeldingDaily daily ON daily.WeldingDailyId = jot.WeldingDailyId
LEFT JOIN dbo.Base_Unit unit ON unit.UnitId = daily.UnitId
WHERE (ndeItem.DetectionTypeId=@detectionTypeId OR @detectionTypeId IS NULL)
AND (jot.ProjectId=@projectId OR @projectId IS NULL)
AND (daily.UnitId = @unitId OR @unitId IS NULL)
AND (daily.WeldingDate >= @date1 OR @date1 IS NULL)
AND (daily.WeldingDate <= @date2 OR @date2 IS NULL)
AND (pipeline.FlowingSection like '%'+@flowingSection+'%' OR @flowingSection IS NULL)
ORDER BY daily.UnitId,detectionType.DetectionTypeCode,jot.WeldJointCode
GO
2023-11-24 18:29:30 +08:00
ALTER VIEW [dbo].[View_HJGL_Batch_PointBatchItem]
AS
/*************<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD><EFBFBD>*************/
SELECT PointBatchItem.PointBatchItemId,
PointBatchItem.PointBatchId,
PointBatch.ProjectId,
PointBatch.UnitId,
PointBatch.DetectionTypeId,
PointBatch.DetectionRateId,
PointBatch.PointBatchCode,
Pipeline.UnitWorkId,
PointBatchItem.WeldJointId,
(CASE PointBatchItem.PointState WHEN '1' THEN '<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' WHEN '2' THEN '<EFBFBD><EFBFBD>͸' END) AS PointState,
(CASE PointBatchItem.IsBuildTrust WHEN 1 THEN '<EFBFBD><EFBFBD>' ELSE '' END) AS IsBuildTrust,
(CASE WHEN PointBatchItem.IsAudit=1 THEN '<EFBFBD><EFBFBD>'
WHEN (PointBatchItem.IsAudit IS NULL OR PointBatchItem.IsAudit=0) AND PointBatchItem.PointState IS NOT NULL THEN '<EFBFBD><EFBFBD>'
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>
(CASE PointBatchItem.IsWelderFirst WHEN 1 THEN '<EFBFBD><EFBFBD>' ELSE '' END) AS IsWelderFirst,
PointBatchItem.RepairDate,--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
PointBatchItem.RepairRecordId,
PointBatchItem.CutDate,--<EFBFBD>г<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
PointBatchItem.PBackingWelderId,--<EFBFBD><EFBFBD><EFBFBD>޴<EFBFBD><EFBFBD>׺<EFBFBD><EFBFBD><EFBFBD>
PointBatchItem.PCoverWelderId,--<EFBFBD><EFBFBD><EFBFBD>޸<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
UnitWork.UnitWorkCode,--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
WeldJoint.WeldJointCode,--<EFBFBD><EFBFBD><EFBFBD>ں<EFBFBD>
WeldJoint.BackingWelderId AS WelderId, --<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ID
BackingWelder.WelderCode AS BackingWelderCode,
CoverWelder.WelderCode AS CoverWelderCode,
WeldType.WeldTypeCode,
WeldJoint.JointAttribute,
WeldJoint.JointArea,--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
WeldJoint.Size,--ʵ<EFBFBD>ʴ
WeldingDaily.WeldingDate,--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
WeldJoint.PipelineId, --<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ID
WeldJoint.Material1Id AS Mat, --<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
WeldJoint.Specification, --<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
Pipeline.PipelineCode, --<EFBFBD><EFBFBD><EFBFBD>ߺ<EFBFBD>
PipingClass.PipingClassName , --<EFBFBD>ܵ<EFBFBD><EFBFBD>ȼ<EFBFBD>
WeldJoint.BackingWelderId,
WeldJoint.CoverWelderId
FROM dbo.HJGL_Batch_PointBatchItem AS PointBatchItem
LEFT JOIN dbo.HJGL_Batch_PointBatch AS PointBatch ON PointBatch.PointBatchId=PointBatchItem.PointBatchId
LEFT JOIN dbo.HJGL_WeldJoint AS WeldJoint ON WeldJoint.WeldJointId=PointBatchItem.WeldJointId
LEFT JOIN dbo.HJGL_Pipeline AS Pipeline ON Pipeline.PipelineId=WeldJoint.PipelineId
LEFT JOIN dbo.WBS_UnitWork AS UnitWork ON UnitWork.UnitWorkId=Pipeline.UnitWorkId
LEFT JOIN dbo.HJGL_WeldingDaily AS WeldingDaily ON WeldingDaily.WeldingDailyId=WeldJoint.WeldingDailyId
LEFT JOIN dbo.Base_PipingClass AS PipingClass ON PipingClass.PipingClassId=Pipeline.PipingClassId
LEFT JOIN SitePerson_Person AS BackingWelder ON BackingWelder.PersonId=WeldJoint.BackingWelderId
LEFT JOIN SitePerson_Person AS CoverWelder ON CoverWelder.PersonId=WeldJoint.CoverWelderId
LEFT JOIN Base_WeldType AS WeldType ON WeldType.WeldTypeId=WeldJoint.WeldTypeId
LEFT JOIN HJGL_Hard_TrustItem HardTrustItem ON HardTrustItem.WeldJointId=PointBatchItem.WeldJointId
where (WeldJoint.IsHotProess!=1 or (WeldJoint.IsHotProess=1 and HardTrustItem.IsPass=1))
and BackingWelder.ProjectId=Pipeline.ProjectId and CoverWelder.ProjectId=Pipeline.ProjectId
GO