initproject
This commit is contained in:
Binary file not shown.
@@ -0,0 +1,378 @@
|
||||
|
||||
ALTER TABLE dbo.Pipeline_WeldJoint DROP CONSTRAINT FK_Pipeline_Weldline_Base_Consumables
|
||||
ALTER TABLE dbo.Pipeline_WeldJoint DROP CONSTRAINT FK_Pipeline_Weldline_Base_Consumables1
|
||||
GO
|
||||
ALTER TABLE dbo.Pipeline_WeldJoint ALTER COLUMN WeldSilkId NVARCHAR(200) NULL
|
||||
GO
|
||||
INSERT INTO Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,ButtonEnName,SortIndex)
|
||||
VALUES('5EFA45FD-D335-473A-B6A2-0EFB2D24E7D7','3ACE25CE-C5CE-4CEC-AD27-0D5CF1DF2F01','手动生成委托单','HandGenerate',1)
|
||||
GO
|
||||
|
||||
ALTER VIEW [dbo].[View_Pipeline_WeldJoint]
|
||||
AS
|
||||
/************焊口信息视图*****************/
|
||||
SELECT WeldJoint.WeldJointId,
|
||||
WeldJoint.ProjectId,
|
||||
WeldJoint.PipelineId,
|
||||
WeldJoint.WeldJointCode,
|
||||
dbo.Fun_GetParseInt(WeldJoint.WeldJointCode) AS ConvertWeldJoint,
|
||||
WeldJoint.WeldTypeId,
|
||||
WeldJoint.Material1Id,
|
||||
WeldJoint.Material2Id,
|
||||
WeldJoint.ANSISCH,
|
||||
WeldJoint.Thickness,
|
||||
WeldJoint.Dia,
|
||||
WeldJoint.Size,
|
||||
WeldJoint.JointAttribute,
|
||||
WeldJoint.JointArea,
|
||||
WeldJoint.WeldingMethodId,
|
||||
WeldJoint.IsHotProess,
|
||||
WeldJoint.WeldingLocationId,
|
||||
WeldJoint.WeldMatId,
|
||||
WeldJoint.WeldSilkId,
|
||||
WeldJoint.GrooveTypeId,
|
||||
WeldJoint.PipeSegment,
|
||||
WeldJoint.PipeAssembly1Id,
|
||||
WeldJoint.PipeAssembly2Id,
|
||||
WeldJoint.PipeAssemblyCount,
|
||||
WeldJoint.HeartNo1,
|
||||
WeldJoint.HeartNo2,
|
||||
WeldJoint.LastTemp,
|
||||
WeldJoint.CellTemp,
|
||||
WeldJoint.PrepareTemp,
|
||||
WeldJoint.Electricity,
|
||||
WeldJoint.SystemNumber,
|
||||
WeldJoint.Remark,
|
||||
WeldJoint.DoneDin,
|
||||
WeldJoint.Voltage,
|
||||
WeldJoint.TestPackageNo,
|
||||
WeldJoint.WeldingDailyCode,
|
||||
WeldJoint.WeldingDailyId,
|
||||
WeldJoint.BackingWelderId,
|
||||
WeldJoint.CoverWelderId,
|
||||
WeldJoint.PipingClassId,
|
||||
WeldJoint.Specification,
|
||||
WeldJoint.CancelResult,
|
||||
Project.ProjectCode,
|
||||
Project.ProjectName,
|
||||
Pipeline.PipelineCode,
|
||||
Pipeline.InstallationId,
|
||||
Pipeline.UnitId,
|
||||
Pipeline.SingleNumber,
|
||||
Pipeline.WorkAreaId,
|
||||
WeldType.WeldTypeCode,
|
||||
Material1.MaterialCode AS Material1Code,
|
||||
Material2.MaterialCode AS Material2Code,
|
||||
WeldingMethod.WeldingMethodCode,
|
||||
WeldingLocation.WeldingLocationCode,
|
||||
WeldMat.ConsumablesCode AS WeldMatCode,
|
||||
--WeldSilk.ConsumablesCode AS WeldSilkCode,
|
||||
'' AS WeldSilkCode,
|
||||
GrooveType.GrooveTypeCode,
|
||||
CASE WHEN WeldJoint.WeldingDailyId IS NULL THEN '否' ELSE '是' END AS Is_hjName,
|
||||
CASE WHEN WeldJoint.IsHotProess=1 THEN '是' ELSE '否' END AS IsHotProessStr,
|
||||
Components1.ComponentsCode AS ComponentsCode1,
|
||||
Components2.ComponentsCode AS ComponentsCode2,
|
||||
BackingWelder.WelderCode AS BackingWelderCode,
|
||||
BackingWelder.WelderName AS BackingWelderName,
|
||||
CoverWelder.WelderCode AS CoverWelderCode,
|
||||
CoverWelder.WelderName AS CoverWelderName,
|
||||
(CASE WHEN CoverWelder.WelderCode IS NOT NULL AND BackingWelder.WelderCode IS NOT NULL
|
||||
THEN CoverWelder.WelderCode + '/' + BackingWelder.WelderCode
|
||||
ELSE (ISNULL(CoverWelder.WelderCode,'') + ISNULL(BackingWelder.WelderCode,'')) END) AS WelderCode, --焊工
|
||||
(CASE WHEN Material1.MaterialCode IS NOT NULL AND Material2.MaterialCode IS NOT NULL
|
||||
THEN Material1.MaterialCode + '/' + Material2.MaterialCode
|
||||
ELSE (ISNULL(Material1.MaterialCode,'') + ISNULL(Material2.MaterialCode,'')) END) AS MaterialCode, --材质
|
||||
pipingClass.PipingClassCode,
|
||||
CONVERT(VARCHAR(100), WeldingDaily.WeldingDate, 23) AS WeldingDate,
|
||||
WeldJoint.IsCancel,
|
||||
WeldJoint.IsGoldJoint,
|
||||
WeldJoint.WPQId,wps.WPQCode,
|
||||
WeldJoint.DetectionType,
|
||||
WeldJoint.PageNum
|
||||
FROM Pipeline_WeldJoint AS WeldJoint
|
||||
LEFT JOIN Base_Project AS Project ON Project.ProjectId=WeldJoint.ProjectId
|
||||
LEFT JOIN Pipeline_Pipeline AS Pipeline ON Pipeline.PipelineId = WeldJoint.PipelineId
|
||||
LEFT JOIN Base_WeldType AS WeldType ON WeldType.WeldTypeId=WeldJoint.WeldTypeId
|
||||
LEFT JOIN Base_Material AS Material1 ON Material1.MaterialId = WeldJoint.Material1Id
|
||||
LEFT JOIN Base_Material AS Material2 ON Material2.MaterialId = WeldJoint.Material2Id
|
||||
LEFT JOIN Base_WeldingMethod AS WeldingMethod ON WeldingMethod.WeldingMethodId=WeldJoint.WeldingMethodId
|
||||
LEFT JOIN Base_WeldingLocation AS WeldingLocation ON WeldingLocation.WeldingLocationId=WeldJoint.WeldingLocationId
|
||||
LEFT JOIN Base_Consumables AS WeldMat ON WeldMat.ConsumablesId=WeldJoint.WeldMatId
|
||||
--LEFT JOIN Base_Consumables AS WeldSilk ON WeldSilk.ConsumablesId=WeldJoint.WeldSilkId
|
||||
LEFT JOIN Base_GrooveType AS GrooveType ON GrooveType.GrooveTypeId=WeldJoint.GrooveTypeId
|
||||
LEFT JOIN Base_Components AS Components1 ON Components1.ComponentsId = WeldJoint.PipeAssembly1Id
|
||||
LEFT JOIN Base_Components AS Components2 ON Components2.ComponentsId = WeldJoint.PipeAssembly2Id
|
||||
LEFT JOIN Welder_Welder AS BackingWelder ON BackingWelder.WelderId=WeldJoint.BackingWelderId
|
||||
LEFT JOIN Welder_Welder AS CoverWelder ON CoverWelder.WelderId=WeldJoint.CoverWelderId
|
||||
LEFT JOIN Pipeline_WeldingDaily AS WeldingDaily ON WeldingDaily.WeldingDailyId=WeldJoint.WeldingDailyId
|
||||
LEFT JOIN Base_PipingClass AS pipingClass ON pipingClass.PipingClassId=WeldJoint.PipingClassId
|
||||
LEFT JOIN dbo.WPQ_WPQList wps ON wps.WPQId=WeldJoint.WPQId
|
||||
|
||||
|
||||
GO
|
||||
|
||||
|
||||
ALTER PROC [dbo].[sp_rpt_JointComprehensive]
|
||||
@projectId NVARCHAR(50),
|
||||
@workAreaId NVARCHAR(50)=NULL,
|
||||
@pipelineIds NVARCHAR(MAX) = NULL
|
||||
|
||||
AS
|
||||
/**********焊口综合信息**********/
|
||||
SELECT
|
||||
weldJoint.WeldJointId,
|
||||
weldJoint.ProjectId,
|
||||
WorkArea.WorkAreaId,
|
||||
WorkArea.WorkAreaCode,
|
||||
weldJoint.SystemNumber,
|
||||
weldJoint.TestPackageNo,
|
||||
pipeline.SingleNumber,
|
||||
pipeline.PipelineCode,
|
||||
weldJoint.PipeSegment,--所属管段
|
||||
(CASE WHEN weldJoint.JointAttribute='固定F' THEN 'F'+weldJoint.WeldJointCode ELSE 'S'+weldJoint.WeldJointCode END) AS WeldJointCode,
|
||||
weldType.WeldTypeCode,
|
||||
weldJoint.JointAttribute,
|
||||
wl.WeldingLocationCode,
|
||||
weldJoint.Dia,
|
||||
weldJoint.Thickness,--壁厚
|
||||
weldJoint.HeartNo1,
|
||||
weldJoint.HeartNo2,
|
||||
com1.ComponentsName AS PipeAssembly1,
|
||||
com2.ComponentsName AS PipeAssembly2,
|
||||
--material.MaterialCode,
|
||||
mat1.MaterialCode AS MaterialCode1,
|
||||
mat2.MaterialCode AS MaterialCode2,
|
||||
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 '是' ELSE '否' END) AS IsHotProess,
|
||||
null as TrustBatchCode,
|
||||
null as DetectionRateCode,
|
||||
null as AcceptLevel,
|
||||
nde.NDEDate AS CHT_CHECKDATE,
|
||||
ndeItem.NDEReportNo,
|
||||
CAST(CAST(ISNULL(weldJoint.Size,0) AS REAL) AS NVARCHAR(8)) AS JOT_Size,
|
||||
WeldMaterialMat.ConsumablesCode AS WMT_MatCode,
|
||||
WeldMaterialMat.ConsumablesName AS WMT_Matname,
|
||||
weldJoint.WeldSilkId,
|
||||
--WeldMaterialSilk.ConsumablesCode AS hsCode,
|
||||
--WeldMaterialSilk.ConsumablesName AS hsname,
|
||||
--WeldMaterialSilk.UserFlux,
|
||||
weldJoint.Specification,
|
||||
wps.WPQCode,ndttype.DetectionTypeCode,NULL AS HotReportCode,
|
||||
|
||||
(CASE WHEN (PointBatchItem.PointState='1' OR PointBatchItem.PointState='2') then '是' ELSE '否' 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 mat1 ON mat1.MaterialId = weldJoint.Material1Id
|
||||
LEFT JOIN Base_Material AS mat2 ON mat2.MaterialId = weldJoint.Material2Id
|
||||
LEFT JOIN Base_WeldingMethod AS WeldMethod ON WeldMethod.WeldingMethodId = weldJoint.WeldingMethodId
|
||||
LEFT JOIN dbo.Base_WeldType weldType ON weldType.WeldTypeId = weldJoint.WeldTypeId
|
||||
LEFT JOIN dbo.Base_WeldingLocation wl ON wl.WeldingLocationId = weldJoint.WeldingLocationId
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
|
||||
|
||||
ALTER VIEW [dbo].[View_Batch_PointBatchItem]
|
||||
AS
|
||||
/*************点口明细表*************/
|
||||
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 '点口' WHEN '2' THEN '扩透' END) AS PointState,
|
||||
--(CASE PointBatchItem.IsAudit WHEN 1 THEN '是' ELSE '否' END) AS PointIsAudit,
|
||||
--(CASE WHEN PointBatchItem.IsAudit=1 THEN '是'
|
||||
-- WHEN (PointBatchItem.IsAudit IS NULL OR PointBatchItem.IsAudit=0) AND PointBatchItem.PointState IS NOT NULL THEN '否'
|
||||
-- WHEN (PointBatchItem.IsAudit IS NULL OR PointBatchItem.IsAudit=0) AND PointBatchItem.PointState IS NULL THEN '' END) AS PointIsAudit,
|
||||
PointBatchItem.PointDate,--点口日期
|
||||
PointBatchItem.RepairDate,--返修日期
|
||||
PointBatchItem.CutDate,--切除日期
|
||||
PointBatchItem.RepairRecordId,
|
||||
PointBatchItem.IsBuildTrust,--是否委托
|
||||
WorkArea.WorkAreaCode,--工区号
|
||||
jot.WeldJointCode,--焊口号
|
||||
jot.BackingWelderId AS WelderId, --焊工ID
|
||||
jot.JointArea,--焊接区域
|
||||
jot.Dia,
|
||||
jot.Size,--实际寸径
|
||||
WeldingDaily.WeldingDate,--焊接日期
|
||||
jot.PipelineId, --管线ID
|
||||
jot.Material1Id AS Mat, --材质
|
||||
jot.Specification, --规格
|
||||
weldType.Flag, --焊缝类型
|
||||
Pipeline.PipelineCode, --管线号
|
||||
PipingClass.PipingClassName, --管道等级
|
||||
PointBatchItem.IsWelderFirst,
|
||||
(CASE WHEN PointBatchItem.JLAudit IS NOT NULL THEN userJL.UserName ELSE (CASE WHEN PointBatchItem.PointState IS NOT NULL THEN '未审核' ELSE '' END) END) AS JLAudit,
|
||||
(CASE WHEN PointBatchItem.GLGSAudit IS NOT NULL THEN userGLGS.UserName ELSE (CASE WHEN PointBatchItem.PointState IS NOT NULL THEN '未审核' ELSE '' END) END) AS GLGSAudit,
|
||||
(CASE WHEN PointBatchItem.QTAudit IS NOT NULL THEN userQT.UserName ELSE (CASE WHEN PointBatchItem.PointState IS NOT NULL THEN '未审核' ELSE '' END) END) AS QTAudit,
|
||||
(CASE WHEN jot.BackingWelderId!=jot.CoverWelderId THEN backingWelder.WelderCode+'/'+coverWelder.WelderCode ELSE backingWelder.WelderCode END) AS WelderCode, --焊工号
|
||||
(CASE WHEN PointBatchItem.JLAudit IS NOT NULL AND PointBatchItem.GLGSAudit IS NOT NULL THEN 1 ELSE 0 END) AS IsPointAudit
|
||||
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 VIEW [dbo].[View_Batch_PointBatchItem]
|
||||
AS
|
||||
/*************点口明细表*************/
|
||||
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 '点口' WHEN '2' THEN '扩透' END) AS PointState,
|
||||
--(CASE PointBatchItem.IsAudit WHEN 1 THEN '是' ELSE '否' END) AS PointIsAudit,
|
||||
--(CASE WHEN PointBatchItem.IsAudit=1 THEN '是'
|
||||
-- WHEN (PointBatchItem.IsAudit IS NULL OR PointBatchItem.IsAudit=0) AND PointBatchItem.PointState IS NOT NULL THEN '否'
|
||||
-- WHEN (PointBatchItem.IsAudit IS NULL OR PointBatchItem.IsAudit=0) AND PointBatchItem.PointState IS NULL THEN '' END) AS PointIsAudit,
|
||||
PointBatchItem.PointDate,--点口日期
|
||||
PointBatchItem.RepairDate,--返修日期
|
||||
PointBatchItem.CutDate,--切除日期
|
||||
PointBatchItem.RepairRecordId,
|
||||
PointBatchItem.IsBuildTrust,--是否委托
|
||||
WorkArea.WorkAreaCode,--工区号
|
||||
jot.WeldJointCode,--焊口号
|
||||
jot.BackingWelderId AS WelderId, --焊工ID
|
||||
jot.JointArea,--焊接区域
|
||||
jot.Dia,
|
||||
jot.Size,--实际寸径
|
||||
WeldingDaily.WeldingDate,--焊接日期
|
||||
jot.PipelineId, --管线ID
|
||||
jot.Material1Id AS Mat, --材质
|
||||
jot.Specification, --规格
|
||||
jot.JointAttribute,
|
||||
weldType.Flag, --焊缝类型
|
||||
Pipeline.PipelineCode, --管线号
|
||||
PipingClass.PipingClassName, --管道等级
|
||||
PointBatchItem.IsWelderFirst,
|
||||
(CASE WHEN PointBatchItem.JLAudit IS NOT NULL THEN userJL.UserName ELSE (CASE WHEN PointBatchItem.PointState IS NOT NULL THEN '未审核' ELSE '' END) END) AS JLAudit,
|
||||
(CASE WHEN PointBatchItem.GLGSAudit IS NOT NULL THEN userGLGS.UserName ELSE (CASE WHEN PointBatchItem.PointState IS NOT NULL THEN '未审核' ELSE '' END) END) AS GLGSAudit,
|
||||
(CASE WHEN PointBatchItem.QTAudit IS NOT NULL THEN userQT.UserName ELSE (CASE WHEN PointBatchItem.PointState IS NOT NULL THEN '未审核' ELSE '' END) END) AS QTAudit,
|
||||
(CASE WHEN jot.BackingWelderId!=jot.CoverWelderId THEN backingWelder.WelderCode+'/'+coverWelder.WelderCode ELSE backingWelder.WelderCode END) AS WelderCode, --焊工号
|
||||
(CASE WHEN PointBatchItem.JLAudit IS NOT NULL AND PointBatchItem.GLGSAudit IS NOT NULL THEN 1 ELSE 0 END) AS IsPointAudit
|
||||
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 PROCEDURE [dbo].[SpGetNewCode]
|
||||
@tableName VARCHAR(50),/*表名*/
|
||||
@columnName VARCHAR(50),/*列名*/
|
||||
@projectId NVARCHAR(50),/*项目*/
|
||||
@prefix VARCHAR(50),/*流水号编码前缀*/
|
||||
@returnVal NVARCHAR(50) OUTPUT
|
||||
AS
|
||||
/*获取一个新的流水号(后五位上增加)*/
|
||||
DECLARE
|
||||
@sql NVARCHAR(500),
|
||||
@old NVARCHAR(50),
|
||||
@newid VARCHAR(50),
|
||||
@maxId NVARCHAR(50)/*已分配的最大值*/
|
||||
SELECT @sql=N'SELECT @maxId=MAX('+@columnName+') from '+@tableName+' where ProjectId = ''' + @projectId + ''' and ' + @columnName+' like ' + '''%' + @prefix + '%'''
|
||||
EXEC sp_executesql @sql, N'@maxId nvarchar(50) OUTPUT', @maxId OUTPUT
|
||||
/*因为最后字串包括R1,K1,所以这么处理*/
|
||||
SET @old=REVERSE(SUBSTRING(REVERSE(@maxId),1,CHARINDEX('-',REVERSE(@maxId))-1))
|
||||
|
||||
IF(@old IS NULL)
|
||||
BEGIN
|
||||
SET @newid=@prefix+'0001'
|
||||
END
|
||||
ELSE
|
||||
BEGIN
|
||||
--表示为数字
|
||||
IF(ISNUMERIC(@old)=1)
|
||||
BEGIN
|
||||
SET @newid = (SELECT MAX(LEFT(@old,4)))+1
|
||||
SET @newid = @prefix +RIGHT('0000'+@newid,4)
|
||||
END
|
||||
ELSE
|
||||
BEGIN
|
||||
SET @old =SUBSTRING(@maxId,0,len(@maxId)-len(@old))
|
||||
SET @newid = (SELECT MAX(RIGHT(@old,4)))+1
|
||||
SET @newid = @prefix +RIGHT('0000'+@newid,4)
|
||||
END
|
||||
END
|
||||
|
||||
SET @returnVal=@newid
|
||||
|
||||
GO
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,128 @@
|
||||
UPDATE dbo.Batch_PointBatchItem SET IsCompletedPoint=1 WHERE PointState=1
|
||||
GO
|
||||
|
||||
ALTER VIEW [dbo].[View_Batch_PointBatch]
|
||||
AS
|
||||
/*************点口单视图*************/
|
||||
SELECT PointBatch.PointBatchId
|
||||
,PointBatch.PointBatchCode
|
||||
,PointBatch.ProjectId
|
||||
,Project.ProjectCode
|
||||
,Project.ProjectName
|
||||
,PointBatch.UnitId
|
||||
,Unit.UnitName
|
||||
,Unit.UnitCode
|
||||
,Unit.UnitTypeId
|
||||
,PointBatch.InstallationId
|
||||
,Installation.InstallationCode
|
||||
,Installation.InstallationName
|
||||
,PointBatch.DetectionTypeId
|
||||
,DetectionType.DetectionTypeCode
|
||||
,DetectionType.DetectionTypeName
|
||||
,PointBatch.DetectionRateId
|
||||
,DetectionRate.DetectionRateCode
|
||||
,DetectionRate.DetectionRateValue
|
||||
,PointBatch.WelderId
|
||||
,Welder.WelderCode
|
||||
,Welder.WelderName
|
||||
,PointBatch.MediumId
|
||||
,Medium.MediumCode
|
||||
,Medium.MediumName
|
||||
,PointBatch.MaterialId
|
||||
,Material.MaterialCode
|
||||
,PointBatch.WeldTypeId
|
||||
,WeldType.WeldTypeCode
|
||||
,WeldType.WeldTypeName
|
||||
,PointBatch.StartDate
|
||||
,PointBatch.EndDate
|
||||
,PointBatch.ClearDate
|
||||
,PointBatch.IsTrust
|
||||
,PointBatch.IsCheck
|
||||
,pipe.PipelineCode
|
||||
,(CASE WHEN (SELECT COUNT(item.PointBatchItemId) FROM dbo.Batch_PointBatchItem item
|
||||
WHERE item.PointBatchId=PointBatch.PointBatchId AND item.IsCompletedPoint=0)>0
|
||||
THEN 1 ELSE 0 END) AS IsCompletedPoint
|
||||
FROM Batch_PointBatch AS PointBatch
|
||||
LEFT JOIN Base_Project AS Project ON PointBatch.ProjectId=Project.ProjectId
|
||||
LEFT JOIN Base_Unit AS Unit ON PointBatch.UnitId=Unit.UnitId
|
||||
LEFT JOIN Project_Installation AS Installation ON PointBatch.InstallationId=Installation.InstallationId
|
||||
LEFT JOIN Base_DetectionType AS DetectionType ON PointBatch.DetectionTypeId=DetectionType.DetectionTypeId
|
||||
LEFT JOIN Base_DetectionRate AS DetectionRate ON PointBatch.DetectionRateId=DetectionRate.DetectionRateId
|
||||
LEFT JOIN Welder_Welder AS Welder ON PointBatch.WelderId=Welder.WelderId
|
||||
LEFT JOIN Base_Medium AS Medium ON PointBatch.MediumId=Medium.MediumId
|
||||
LEFT JOIN Base_Material AS Material ON PointBatch.MaterialId=Material.MaterialId
|
||||
LEFT JOIN Base_WeldType AS WeldType ON PointBatch.WeldTypeId=WeldType.WeldTypeId
|
||||
LEFT JOIN dbo.Pipeline_Pipeline pipe ON pipe.PipelineId = PointBatch.PipelineId
|
||||
|
||||
|
||||
|
||||
GO
|
||||
|
||||
|
||||
ALTER VIEW [dbo].[View_Batch_PointBatchItem]
|
||||
AS
|
||||
/*************点口明细表*************/
|
||||
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 '点口' WHEN '2' THEN '扩透' END) AS PointState,
|
||||
--(CASE PointBatchItem.IsAudit WHEN 1 THEN '是' ELSE '否' END) AS PointIsAudit,
|
||||
--(CASE WHEN PointBatchItem.IsAudit=1 THEN '是'
|
||||
-- WHEN (PointBatchItem.IsAudit IS NULL OR PointBatchItem.IsAudit=0) AND PointBatchItem.PointState IS NOT NULL THEN '否'
|
||||
-- WHEN (PointBatchItem.IsAudit IS NULL OR PointBatchItem.IsAudit=0) AND PointBatchItem.PointState IS NULL THEN '' END) AS PointIsAudit,
|
||||
PointBatchItem.PointDate,--点口日期
|
||||
PointBatchItem.RepairDate,--返修日期
|
||||
PointBatchItem.CutDate,--切除日期
|
||||
PointBatchItem.RepairRecordId,
|
||||
PointBatchItem.IsBuildTrust,--是否委托
|
||||
WorkArea.WorkAreaCode,--工区号
|
||||
jot.WeldJointCode,--焊口号
|
||||
jot.BackingWelderId AS WelderId, --焊工ID
|
||||
jot.JointArea,--焊接区域
|
||||
jot.Dia,
|
||||
jot.Size,--实际寸径
|
||||
WeldingDaily.WeldingDate,--焊接日期
|
||||
jot.PipelineId, --管线ID
|
||||
jot.Material1Id AS Mat, --材质
|
||||
jot.Specification, --规格
|
||||
jot.JointAttribute,
|
||||
weldType.Flag, --焊缝类型
|
||||
Pipeline.PipelineCode, --管线号
|
||||
PipingClass.PipingClassName, --管道等级
|
||||
PointBatchItem.IsWelderFirst,
|
||||
PointBatchItem.IsCompletedPoint,
|
||||
(CASE WHEN PointBatchItem.JLAudit IS NOT NULL THEN userJL.UserName ELSE (CASE WHEN PointBatchItem.PointState IS NOT NULL THEN '未审核' ELSE '' END) END) AS JLAudit,
|
||||
(CASE WHEN PointBatchItem.GLGSAudit IS NOT NULL THEN userGLGS.UserName ELSE (CASE WHEN PointBatchItem.PointState IS NOT NULL THEN '未审核' ELSE '' END) END) AS GLGSAudit,
|
||||
(CASE WHEN PointBatchItem.QTAudit IS NOT NULL THEN userQT.UserName ELSE (CASE WHEN PointBatchItem.PointState IS NOT NULL THEN '未审核' ELSE '' END) END) AS QTAudit,
|
||||
(CASE WHEN jot.BackingWelderId!=jot.CoverWelderId THEN backingWelder.WelderCode+'/'+coverWelder.WelderCode ELSE backingWelder.WelderCode END) AS WelderCode, --焊工号
|
||||
(CASE WHEN PointBatchItem.JLAudit IS NOT NULL AND PointBatchItem.GLGSAudit IS NOT NULL THEN 1 ELSE 0 END) AS IsPointAudit
|
||||
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
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
|
||||
CREATE TABLE [dbo].[Template_Files](
|
||||
[id] [nvarchar](50) NOT NULL,
|
||||
[title] [nvarchar](255) NULL,
|
||||
[filePath] [nvarchar](255) NULL,
|
||||
[SortIndex] INT
|
||||
PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[id] ASC
|
||||
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
||||
) ON [PRIMARY]
|
||||
GO
|
||||
INSERT [dbo].[Template_Files] ([id], [title], [filePath]) VALUES (N'012F03CB-85D7-4F57-8A4D-38AC209886BF', N'27-TP-11-尾项清单UG-FW-001', N'')
|
||||
GO
|
||||
INSERT [dbo].[Template_Files] ([id], [title], [filePath]) VALUES (N'0400055B-388A-40B0-BB7E-283B94864893', N'23-TP-09-超声&PAUT&TOFD检测比例确认表', N'')
|
||||
GO
|
||||
INSERT [dbo].[Template_Files] ([id], [title], [filePath]) VALUES (N'0DAD1096-EA35-446E-B628-2F20C449C641', N'18-金属材料化学成分检验报告SHT 3503-J129', N'')
|
||||
GO
|
||||
INSERT [dbo].[Template_Files] ([id], [title], [filePath]) VALUES (N'0F1A38BB-C98E-4C21-B9EC-8B03CCB22BF2', N'13-弹簧支吊架安装检验记录SHT 3503-J403', N'')
|
||||
GO
|
||||
INSERT [dbo].[Template_Files] ([id], [title], [filePath]) VALUES (N'114E0846-93CB-4F12-A8BA-CE5B80C26A9C', N'35-TP-13-管道复位记录UG-FW-001', N'')
|
||||
GO
|
||||
INSERT [dbo].[Template_Files] ([id], [title], [filePath]) VALUES (N'1BDF3627-8632-48A3-B8CB-1D388D8A112A', N'21-管道焊接工作记录SHT 3503-J415', N'')
|
||||
GO
|
||||
INSERT [dbo].[Template_Files] ([id], [title], [filePath]) VALUES (N'1C555FBB-DC81-4D2E-8EA7-8F6F0D4A4142', N'36-TP-14-法兰螺栓扭矩记录表', N'')
|
||||
GO
|
||||
INSERT [dbo].[Template_Files] ([id], [title], [filePath]) VALUES (N'1E3D0EA0-CE64-44EA-964F-5B289F5A588B', N'17-管道焊接接头热处理报告SHT 3503-J411', N'')
|
||||
GO
|
||||
INSERT [dbo].[Template_Files] ([id], [title], [filePath]) VALUES (N'2BEFB0F4-A466-4C59-963F-9092BACF2E52', N'1-TP-01-试压包路径表UG-FW-001', N'')
|
||||
GO
|
||||
INSERT [dbo].[Template_Files] ([id], [title], [filePath]) VALUES (N'4B60CC6A-4431-49DF-A754-8B2C595C8C27', N'19-硬度检查报告SHT 3503-J130', N'')
|
||||
GO
|
||||
INSERT [dbo].[Template_Files] ([id], [title], [filePath]) VALUES (N'4C45ABAB-89E9-4874-8F55-5050CDE98DFC', N'25-管道无损检测结果汇总表SHT 3503-J412-2017', N'')
|
||||
GO
|
||||
INSERT [dbo].[Template_Files] ([id], [title], [filePath]) VALUES (N'6947FAA5-0475-4BEA-BE3A-C88BA503A0A5', N'26-管道无损检测数量统计表SHT 3503-J413-2017', N'')
|
||||
GO
|
||||
INSERT [dbo].[Template_Files] ([id], [title], [filePath]) VALUES (N'6CD2710C-2AD6-4E7D-BED7-C8BEDAD300DE', N'3-TP-03-试压包目录UG-FW-001', N'')
|
||||
GO
|
||||
INSERT [dbo].[Template_Files] ([id], [title], [filePath]) VALUES (N'811EF650-7686-447F-BEE8-776D50041CD0', N'6-TP-05-P&ID清单UG-FW-001', N'/upload/6-TP-05-P&ID清单UG-FW-001.xls')
|
||||
GO
|
||||
INSERT [dbo].[Template_Files] ([id], [title], [filePath]) VALUES (N'854BF339-C7FA-4935-9CBD-C844904F62FB', N'15-管道补偿器安装检验记录SHT 3503-J405', N'')
|
||||
GO
|
||||
INSERT [dbo].[Template_Files] ([id], [title], [filePath]) VALUES (N'857BDF12-E4E1-4FF1-A8D5-FC96CF09E70D', N'22-射线检测比例确认表SHT 3503-J412-2007', N'')
|
||||
GO
|
||||
INSERT [dbo].[Template_Files] ([id], [title], [filePath]) VALUES (N'87A66CAA-CA30-4A1E-8382-E8503059A0D0', N'4-TP-04-试压标识', N'')
|
||||
GO
|
||||
INSERT [dbo].[Template_Files] ([id], [title], [filePath]) VALUES (N'9C6CB4B3-446D-4C24-ADD8-DAC5F5DEF302', N'14-滑动固定管托安装检验记录SHT 3503-J404', N'')
|
||||
GO
|
||||
INSERT [dbo].[Template_Files] ([id], [title], [filePath]) VALUES (N'A1E35220-A321-482A-B745-5F6456ADFE43', N'8-TP-06-单线图清单UG-FW-001', N'')
|
||||
GO
|
||||
INSERT [dbo].[Template_Files] ([id], [title], [filePath]) VALUES (N'A5F52E0C-90D2-4228-96ED-5FC4125159C5', N'32-管道系统压力试验记录SHT 3503-J406-2', N'')
|
||||
GO
|
||||
INSERT [dbo].[Template_Files] ([id], [title], [filePath]) VALUES (N'AFC08566-A8D0-4118-B240-AADA04305E1B', N'34-管道系统压力试验条件确认记录SHT 3503-J406-1', N'')
|
||||
GO
|
||||
INSERT [dbo].[Template_Files] ([id], [title], [filePath]) VALUES (N'B1AE758D-3850-4397-A036-7FA54EFD0A69', N'33-管道吹扫清洗记录SHT 3503-J408 UG-FW-001', N'')
|
||||
GO
|
||||
INSERT [dbo].[Template_Files] ([id], [title], [filePath]) VALUES (N'B33E6C98-F999-4DC6-B0A4-633AE85B349C', N'24-TP-10-渗透&MT检测比例确认表', N'')
|
||||
GO
|
||||
INSERT [dbo].[Template_Files] ([id], [title], [filePath]) VALUES (N'D4B4DD64-8361-4A75-AA3E-E484934B9B06', N'2-TP-02-试压包封面UG-FW-001', N'')
|
||||
GO
|
||||
INSERT [dbo].[Template_Files] ([id], [title], [filePath]) VALUES (N'DD6E665D-F784-41BA-88EF-E836AB1EC02F', N'28-TP-12-试压用水(工具)检查清单UG-FW-001', N'')
|
||||
GO
|
||||
INSERT [dbo].[Template_Files] ([id], [title], [filePath]) VALUES (N'F20D530C-29BB-405F-AB0E-342496134375', N'11-TP-07-盲板清单UG-FW-001', N'')
|
||||
GO
|
||||
INSERT [dbo].[Template_Files] ([id], [title], [filePath]) VALUES (N'FEF7F71B-E630-49CE-AB3D-6BFADA074DB6', N'16-TP-08-静电接地清单UG-FW-001', N'')
|
||||
GO
|
||||
|
||||
UPDATE dbo.Template_Files SET SortIndex= REPLACE(SUBSTRING(title,1,2),'-','')
|
||||
GO
|
||||
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
SELECT * FROM dbo.Pipeline_WeldJoint
|
||||
GO
|
||||
|
||||
UPDATE dbo.Pipeline_WeldJoint SET WeldJointCode = JointArea+WeldJointCode
|
||||
GO
|
||||
|
||||
UPDATE dbo.Pipeline_WeldJoint SET WeldJointCode='SC'+WeldJointCode
|
||||
WHERE WeldTypeId='0f74bf37-788e-4fa5-a348-763bd79ca448'
|
||||
GO
|
||||
UPDATE dbo.Pipeline_WeldJoint SET WeldJointCode='OL'+WeldJointCode
|
||||
WHERE WeldTypeId='371acb22-9e46-4117-a8b1-bd0624bc392b'
|
||||
GO
|
||||
UPDATE dbo.Pipeline_WeldJoint SET WeldJointCode='RP'+WeldJointCode
|
||||
WHERE WeldTypeId='0b62795f-32f2-4e5c-8906-4ed0d8fbb307'
|
||||
GO
|
||||
UPDATE dbo.Pipeline_WeldJoint SET WeldJointCode='BR'+WeldJointCode
|
||||
WHERE WeldTypeId='74f21010-8d32-40bc-afee-287004ea5fd6'
|
||||
GO
|
||||
UPDATE dbo.Pipeline_WeldJoint SET WeldJointCode='SUP'+WeldJointCode
|
||||
WHERE WeldTypeId='71f62fc4-d00b-494f-b4f6-42426d753ca2'
|
||||
GO
|
||||
UPDATE dbo.Pipeline_WeldJoint SET WeldJointCode='E'+WeldJointCode
|
||||
WHERE WeldTypeId='5da18457-f244-4a3c-a8e7-f27c9d24c75e'
|
||||
GO
|
||||
|
||||
UPDATE dbo.Pipeline_WeldJoint SET WeldingLocationId =NULL WHERE WeldingDailyId IS NULL
|
||||
GO
|
||||
|
||||
ALTER TABLE dbo.WPQ_WPQList ADD WeldMatId NVARCHAR(50) NULL
|
||||
GO
|
||||
ALTER TABLE dbo.WPQ_WPQList ADD WeldSilkId NVARCHAR(500) NULL
|
||||
GO
|
||||
|
||||
ALTER TABLE dbo.Base_DNCompare ADD OutSize_FB DECIMAL(9,2) NULL
|
||||
ALTER TABLE dbo.Base_DNCompare ADD SCH_FB DECIMAL(9,2) NULL
|
||||
ALTER TABLE dbo.Base_DNCompare ADD DN_FB INT NULL
|
||||
GO
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,81 @@
|
||||
INSERT INTO dbo.Sys_Menu VALUES ('7C4BD351-630C-4E2A-B9AD-F91C042ED7A0','点口待审核','Point For Audit','WeldingProcess/TrustManage/PointForAudit.aspx',15,'4F07D4BF-5971-4D3C-A0DE-B2ACA8CD82FF','3',NULL,1)
|
||||
GO
|
||||
INSERT INTO Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,ButtonEnName,SortIndex)
|
||||
VALUES('E0005937-8A3C-4CE8-8BA8-4C9941675886','7C4BD351-630C-4E2A-B9AD-F91C042ED7A0','监理审核','JLAudit',1)
|
||||
GO
|
||||
INSERT INTO Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,ButtonEnName,SortIndex)
|
||||
VALUES('19B47AD7-A451-4A17-BFDA-C28BF1B356BA','7C4BD351-630C-4E2A-B9AD-F91C042ED7A0','管理公司审核','GLGSAudit',2)
|
||||
GO
|
||||
INSERT INTO Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,ButtonEnName,SortIndex)
|
||||
VALUES('CFF9EAD9-95F9-4C8B-A71A-C00834CBE218','7C4BD351-630C-4E2A-B9AD-F91C042ED7A0','其它审核','OtherAudit',3)
|
||||
GO
|
||||
|
||||
DELETE FROM dbo.Sys_Set WHERE ProjectId<>'0bbe1ae1-e643-4f86-9695-4381ed792ec9' AND ProjectId<>'0'
|
||||
GO
|
||||
|
||||
|
||||
ALTER VIEW [dbo].[View_Batch_PointBatchItem]
|
||||
AS
|
||||
/*************点口明细表*************/
|
||||
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 '点口' WHEN '2' THEN '扩透' END) AS PointState,
|
||||
--(CASE PointBatchItem.IsAudit WHEN 1 THEN '是' ELSE '否' END) AS PointIsAudit,
|
||||
--(CASE WHEN PointBatchItem.IsAudit=1 THEN '是'
|
||||
-- WHEN (PointBatchItem.IsAudit IS NULL OR PointBatchItem.IsAudit=0) AND PointBatchItem.PointState IS NOT NULL THEN '否'
|
||||
-- WHEN (PointBatchItem.IsAudit IS NULL OR PointBatchItem.IsAudit=0) AND PointBatchItem.PointState IS NULL THEN '' END) AS PointIsAudit,
|
||||
PointBatchItem.PointDate,--点口日期
|
||||
PointBatchItem.RepairDate,--返修日期
|
||||
PointBatchItem.CutDate,--切除日期
|
||||
PointBatchItem.RepairRecordId,
|
||||
PointBatchItem.IsBuildTrust,--是否委托
|
||||
WorkArea.WorkAreaCode,--工区号
|
||||
jot.WeldJointCode,--焊口号
|
||||
jot.BackingWelderId AS WelderId, --焊工ID
|
||||
jot.JointArea,--焊接区域
|
||||
jot.Dia,
|
||||
jot.Size,--实际寸径
|
||||
WeldingDaily.WeldingDate,--焊接日期
|
||||
jot.PipelineId, --管线ID
|
||||
jot.Material1Id AS Mat, --材质
|
||||
jot.Specification, --规格
|
||||
jot.JointAttribute,
|
||||
weldType.Flag, --焊缝类型
|
||||
Pipeline.PipelineCode, --管线号
|
||||
PipingClass.PipingClassName, --管道等级
|
||||
PointBatchItem.IsWelderFirst,
|
||||
PointBatchItem.IsCompletedPoint,
|
||||
(CASE WHEN PointBatchItem.JLAudit IS NOT NULL THEN userJL.UserName ELSE (CASE WHEN PointBatchItem.PointState IS NOT NULL THEN '未审核' ELSE '' END) END) AS JLAudit,
|
||||
(CASE WHEN PointBatchItem.GLGSAudit IS NOT NULL THEN userGLGS.UserName ELSE (CASE WHEN PointBatchItem.PointState IS NOT NULL THEN '未审核' ELSE '' END) END) AS GLGSAudit,
|
||||
(CASE WHEN PointBatchItem.QTAudit IS NOT NULL THEN userQT.UserName ELSE (CASE WHEN PointBatchItem.PointState IS NOT NULL THEN '未审核' ELSE '' END) END) AS QTAudit,
|
||||
(CASE WHEN jot.BackingWelderId!=jot.CoverWelderId THEN backingWelder.WelderCode+'/'+coverWelder.WelderCode ELSE backingWelder.WelderCode END) AS WelderCode, --焊工号
|
||||
(CASE WHEN PointBatchItem.JLAudit IS NOT NULL AND PointBatchItem.GLGSAudit IS NOT NULL THEN 1 ELSE 0 END) AS IsPointAudit
|
||||
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.QTAudit
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
GO
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
INSERT INTO dbo.Base_WeldingLocation(WeldingLocationId,WeldingLocationCode)
|
||||
VALUES( '13170FAE-2026-4176-956B-A21604AF0DF8' ,'1F')
|
||||
GO
|
||||
INSERT INTO dbo.Base_WeldingLocation(WeldingLocationId,WeldingLocationCode)
|
||||
VALUES( '5BFAC46F-3688-4EBF-9463-C36A95DC6469' ,'2F')
|
||||
GO
|
||||
INSERT INTO dbo.Base_WeldingLocation(WeldingLocationId,WeldingLocationCode)
|
||||
VALUES( 'F60CFC82-5815-419B-A27B-B1AE4F22854F' ,'3F')
|
||||
GO
|
||||
INSERT INTO dbo.Base_WeldingLocation(WeldingLocationId,WeldingLocationCode)
|
||||
VALUES( '220C4120-AFF2-4161-AD53-FCFF312DA6E6' ,'4F')
|
||||
GO
|
||||
INSERT INTO dbo.Base_WeldingLocation(WeldingLocationId,WeldingLocationCode)
|
||||
VALUES( '2911BE4D-41B2-4F24-BDBB-101419878AEB' ,'5F')
|
||||
GO
|
||||
INSERT INTO dbo.Base_WeldingLocation(WeldingLocationId,WeldingLocationCode)
|
||||
VALUES( '0E4287AC-9253-4AFF-8040-824C5211DA83' ,'6F')
|
||||
GO
|
||||
@@ -0,0 +1,59 @@
|
||||
ALTER TABLE dbo.Sys_DataInTemp ADD Value37 NVARCHAR(50) NULL
|
||||
ALTER TABLE dbo.Sys_DataInTemp ADD Value38 NVARCHAR(50) NULL
|
||||
GO
|
||||
|
||||
ALTER VIEW [dbo].[View_Batch_PointBatchItem]
|
||||
AS
|
||||
/*************点口明细表*************/
|
||||
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 '点口' WHEN '2' THEN '扩透' END) AS PointState,
|
||||
--(CASE PointBatchItem.IsAudit WHEN 1 THEN '是' ELSE '否' END) AS PointIsAudit,
|
||||
(CASE WHEN PointBatchItem.IsAudit=1 THEN '是'
|
||||
WHEN (PointBatchItem.IsAudit IS NULL OR PointBatchItem.IsAudit=0) AND PointBatchItem.PointState IS NOT NULL THEN '否'
|
||||
WHEN (PointBatchItem.IsAudit IS NULL OR PointBatchItem.IsAudit=0) AND PointBatchItem.PointState IS NULL THEN '' END) AS PointIsAudit,
|
||||
PointBatchItem.PointDate,--点口日期
|
||||
PointBatchItem.RepairDate,--返修日期
|
||||
PointBatchItem.CutDate,--切除日期
|
||||
PointBatchItem.RepairRecordId,
|
||||
PointBatchItem.IsBuildTrust,--是否委托
|
||||
WorkArea.WorkAreaCode,--工区号
|
||||
jot.WeldJointCode,--焊口号
|
||||
jot.BackingWelderId AS WelderId, --焊工ID
|
||||
jot.JointArea,--焊接区域
|
||||
jot.Dia,
|
||||
jot.Size,--实际寸径
|
||||
WeldingDaily.WeldingDate,--焊接日期
|
||||
jot.PipelineId, --管线ID
|
||||
jot.Material1Id AS Mat, --材质
|
||||
jot.Specification, --规格
|
||||
weldType.Flag, --焊缝类型
|
||||
Pipeline.PipelineCode, --管线号
|
||||
PipingClass.PipingClassName, --管道等级
|
||||
(CASE WHEN jot.BackingWelderId!=jot.CoverWelderId THEN backingWelder.WelderCode+'/'+coverWelder.WelderCode ELSE backingWelder.WelderCode END) AS WelderCode--焊工号
|
||||
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
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
GO
|
||||
|
||||
|
||||
@@ -0,0 +1,155 @@
|
||||
INSERT INTO dbo.Sys_Menu(MenuId, MenuName, MenuEnName, Url, SortIndex, SuperMenu,MenuModule,IsUse)
|
||||
VALUES('CE3B4B0E-C751-4BA6-A7AF-A46D434AD6DD','焊接日报导出','Weld Daily Export','WeldingProcess/WeldingReport/WeldDailyExport.aspx',25,'F3B157B7-9BEE-4150-80CB-087828F1C51D','3',1)
|
||||
GO
|
||||
INSERT INTO Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,ButtonEnName,SortIndex) VALUES('FDE5C016-1A90-4121-A976-A8D265F9578D','CE3B4B0E-C751-4BA6-A7AF-A46D434AD6DD','查看','See',5)
|
||||
GO
|
||||
|
||||
|
||||
ALTER TABLE dbo.Welder_WelderQualify ADD ExamProject NVARCHAR(50) NULL
|
||||
GO
|
||||
ALTER TABLE dbo.Welder_WelderQualify ADD IsPass BIT NULL
|
||||
GO
|
||||
ALTER TABLE dbo.Welder_WelderQualify ADD Remark NVARCHAR(300) NULL
|
||||
GO
|
||||
|
||||
ALTER TABLE dbo.Batch_BatchTrust ADD QuaCertFile NVARCHAR(50) NULL
|
||||
ALTER TABLE dbo.Batch_BatchTrust ADD AcceptStandard 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.QuaCertFile,
|
||||
BatchTrust.AcceptStandard,
|
||||
Unit.UnitCode,
|
||||
Unit.UnitName,
|
||||
Installation.InstallationName,
|
||||
Installation.InstallationCode,
|
||||
DetectionType.DetectionTypeCode,
|
||||
ndtCheck.TrustBatchId AS CheckTrustBatchId
|
||||
FROM Batch_BatchTrust AS BatchTrust
|
||||
LEFT JOIN Base_Unit AS Unit ON Unit.UnitId=BatchTrust.UnitId
|
||||
LEFT JOIN Project_Installation AS Installation ON Installation.InstallationId=BatchTrust.InstallationId
|
||||
LEFT JOIN Base_DetectionType AS DetectionType ON DetectionType.DetectionTypeId=BatchTrust.DetectionTypeId
|
||||
LEFT JOIN dbo.Base_Project project ON project.ProjectId = BatchTrust.ProjectId
|
||||
LEFT JOIN dbo.Batch_NDE ndtCheck ON ndtCheck.TrustBatchId = BatchTrust.TrustBatchId
|
||||
LEFT JOIN dbo.Pipeline_Pipeline pipe ON pipe.PipelineId = BatchTrust.PipelineId
|
||||
|
||||
WHERE (SELECT COUNT(TrustBatchItemId) FROM Batch_BatchTrustItem WHERE IsCancelTrust IS NULL AND TrustBatchId=BatchTrust.TrustBatchId)>0
|
||||
|
||||
|
||||
GO
|
||||
|
||||
|
||||
|
||||
|
||||
ALTER PROC [dbo].[sp_rpt_JointComprehensive]
|
||||
@projectId NVARCHAR(50),
|
||||
@workAreaId NVARCHAR(50),
|
||||
@pipelineIds NVARCHAR(MAX) = NULL
|
||||
|
||||
AS
|
||||
/**********焊口综合信息**********/
|
||||
SELECT
|
||||
weldJoint.WeldJointId,
|
||||
weldJoint.ProjectId,
|
||||
WorkArea.WorkAreaId,
|
||||
WorkArea.WorkAreaCode,
|
||||
weldJoint.SystemNumber,
|
||||
weldJoint.TestPackageNo,
|
||||
pipeline.SingleNumber,
|
||||
pipeline.PipelineCode,
|
||||
weldJoint.PipeSegment,--所属管段
|
||||
(CASE WHEN weldJoint.JointAttribute='固定F' AND RIGHT(weldJoint.WeldJointCode,1)<>'G' THEN weldJoint.WeldJointCode+'G' ELSE weldJoint.WeldJointCode END) AS WeldJointCode,
|
||||
weldType.WeldTypeCode,
|
||||
weldJoint.JointAttribute,
|
||||
weldJoint.Dia,
|
||||
weldJoint.Thickness,--壁厚
|
||||
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 '是' ELSE '否' 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 '是' ELSE '否' 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)
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
ALTER PROCEDURE [dbo].[sp_TrustReport]
|
||||
(
|
||||
@TrustBatchId NVARCHAR(50)
|
||||
)
|
||||
AS
|
||||
SELECT
|
||||
('工程名称:'+pro.ProjectName) AS ProjectName,
|
||||
('单元名称:'+ins.InstallationName+'('+ins.InstallationCode+')') AS InstallationName,
|
||||
(CASE WHEN trust.NDEUuit IS NOT NULL THEN unit.UnitName ELSE (SELECT UnitName FROM dbo.Base_Unit WHERE UnitId=(SELECT TOP 1 UnitId FROM dbo.Project_Unit WHERE ProjectId= trust.ProjectId AND UnitType='4')) END) AS NDEUnit,
|
||||
trust.TrustBatchCode,nde.DetectionTypeCode,rate.DetectionRateCode,pipe.PipelineCode,
|
||||
(CASE WHEN nde.SysType='射线检测' THEN 'NB/T47013.2' WHEN nde.SysType='超声波检测' THEN 'NB/T47013.3'
|
||||
WHEN nde.SysType='磁粉检测' THEN 'NB/T47013.4' WHEN nde.SysType='渗透检测' THEN 'NB/T47013.5' END) AS ExecStandard,(CASE WHEN nde.SysType='渗透检测' THEN 'Ⅰ' ELSE (CASE WHEN nde.SysType='超声波检测' THEN 'Ⅱ' ELSE (CASE WHEN rate.DetectionRateCode='5%' OR rate.DetectionRateCode='10%' THEN 'Ⅲ' ELSE 'Ⅱ' END) END)END) AS QueClass,dbo.Fun_WeldingMethod(@TrustBatchId) AS WeldingMethodCode,
|
||||
dbo.Fun_GrooveType(@TrustBatchId) AS GrooveTypeCode,
|
||||
('申请单位:'+cunit.UnitName) AS CUnitName,
|
||||
tunit.UnitName AS TrustUnit,
|
||||
trust.QuaCertFile,--质量证明文件编号
|
||||
trust.AcceptStandard--制造/验收标准
|
||||
FROM dbo.Batch_BatchTrust trust
|
||||
LEFT JOIN dbo.Base_Project pro ON pro.ProjectId = trust.ProjectId
|
||||
LEFT JOIN dbo.Project_Installation ins ON ins.InstallationId = trust.InstallationId
|
||||
LEFT JOIN dbo.Base_Unit unit ON unit.UnitId = trust.NDEUuit
|
||||
LEFT JOIN dbo.Base_Unit cunit ON cunit.UnitId = trust.UnitId
|
||||
LEFT JOIN dbo.Base_Unit tunit ON tunit.UnitId = ins.SupervisorUnitId
|
||||
LEFT JOIN dbo.Base_DetectionType nde ON nde.DetectionTypeId = trust.DetectionTypeId
|
||||
LEFT JOIN dbo.Pipeline_Pipeline pipe ON pipe.PipelineId = trust.PipelineId
|
||||
LEFT JOIN dbo.Base_DetectionRate rate ON rate.DetectionRateId = pipe.DetectionRateId
|
||||
WHERE trust.TrustBatchId=@TrustBatchId
|
||||
GO
|
||||
|
||||
ALTER PROCEDURE [dbo].[TrustItemReport]
|
||||
(
|
||||
@TrustBatchId NVARCHAR(50)
|
||||
)
|
||||
AS
|
||||
/******焊缝检测委托单明细表*******/
|
||||
SELECT ROW_NUMBER() OVER(ORDER BY jot.WeldJointCode) AS Number,
|
||||
BatchTrustItem.TrustBatchItemId,
|
||||
BatchTrustItem.TrustBatchId,
|
||||
pipe.PipelineCode, --管线号
|
||||
pipe.SingleNumber, --单线号
|
||||
(CASE WHEN PointBatchItem.PointState='2' then (CASE WHEN jot.JointAttribute='固定F' AND RIGHT(jot.WeldJointCode,1)<>'G' THEN jot.WeldJointCode+'G' ELSE jot.WeldJointCode END)+'K'
|
||||
ELSE (CASE WHEN jot.JointAttribute='固定F' AND RIGHT(jot.WeldJointCode,1)<>'G' THEN jot.WeldJointCode+'G' ELSE jot.WeldJointCode END) END) AS WeldJointCode, --焊口号
|
||||
jot.Specification, --焊缝规格
|
||||
mat.MaterialCode, --材质
|
||||
(CASE WHEN jot.BackingWelderId!=jot.CoverWelderId THEN backingWelder.WelderCode+'/'+coverWelder.WelderCode ELSE backingWelder.WelderCode END) AS WelderCode,--焊工号
|
||||
rate.DetectionRateCode AS DetectionRateCode,--检测比例
|
||||
PointBatchItem.AcceptLevel AS AcceptLevel, --验收等级
|
||||
(case when PointBatchItem.IsWelderFirst=1 then '首三件' else '' end) as Remark,
|
||||
jot.HeartNo1,--炉批1号
|
||||
jot.HeartNo2,--炉批2号
|
||||
(case jot.IsHotProess when 1 then '是' else '否' end) as IsHotProessName--是否热处理
|
||||
FROM dbo.Batch_BatchTrustItem AS BatchTrustItem
|
||||
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 dbo.Welder_Welder backingWelder ON backingWelder.WelderId = jot.BackingWelderId
|
||||
LEFT JOIN dbo.Welder_Welder coverWelder ON coverWelder.WelderId = jot.CoverWelderId
|
||||
LEFT JOIN dbo.Base_Material mat ON mat.MaterialId = jot.Material1Id
|
||||
WHERE BatchTrustItem.TrustBatchId=@TrustBatchId and BatchTrustItem.IsCancelTrust is null
|
||||
GO
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,167 @@
|
||||
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','监理审核','JLAudit',7)
|
||||
GO
|
||||
INSERT INTO Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,ButtonEnName,SortIndex)
|
||||
VALUES('50B2493D-6D31-428B-A7BE-BADAFCD42133','3ACE25CE-C5CE-4CEC-AD27-0D5CF1DF2F01','管理公司审核','GLGSAudit',8)
|
||||
GO
|
||||
INSERT INTO Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,ButtonEnName,SortIndex)
|
||||
VALUES('5767A4F3-3F07-480B-B571-FAF8BD3E3932','3ACE25CE-C5CE-4CEC-AD27-0D5CF1DF2F01','其他审核','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
|
||||
/*************点口明细表*************/
|
||||
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 '点口' WHEN '2' THEN '扩透' END) AS PointState,
|
||||
--(CASE PointBatchItem.IsAudit WHEN 1 THEN '是' ELSE '否' END) AS PointIsAudit,
|
||||
--(CASE WHEN PointBatchItem.IsAudit=1 THEN '是'
|
||||
-- WHEN (PointBatchItem.IsAudit IS NULL OR PointBatchItem.IsAudit=0) AND PointBatchItem.PointState IS NOT NULL THEN '否'
|
||||
-- WHEN (PointBatchItem.IsAudit IS NULL OR PointBatchItem.IsAudit=0) AND PointBatchItem.PointState IS NULL THEN '' END) AS PointIsAudit,
|
||||
PointBatchItem.PointDate,--点口日期
|
||||
PointBatchItem.RepairDate,--返修日期
|
||||
PointBatchItem.CutDate,--切除日期
|
||||
PointBatchItem.RepairRecordId,
|
||||
PointBatchItem.IsBuildTrust,--是否委托
|
||||
WorkArea.WorkAreaCode,--工区号
|
||||
jot.WeldJointCode,--焊口号
|
||||
jot.BackingWelderId AS WelderId, --焊工ID
|
||||
jot.JointArea,--焊接区域
|
||||
jot.Dia,
|
||||
jot.Size,--实际寸径
|
||||
WeldingDaily.WeldingDate,--焊接日期
|
||||
jot.PipelineId, --管线ID
|
||||
jot.Material1Id AS Mat, --材质
|
||||
jot.Specification, --规格
|
||||
weldType.Flag, --焊缝类型
|
||||
Pipeline.PipelineCode, --管线号
|
||||
PipingClass.PipingClassName, --管道等级
|
||||
(CASE WHEN PointBatchItem.JLAudit IS NOT NULL THEN userJL.UserName ELSE (CASE WHEN PointBatchItem.PointState IS NOT NULL THEN '未审核' ELSE '' END) END) AS JLAudit,
|
||||
(CASE WHEN PointBatchItem.GLGSAudit IS NOT NULL THEN userGLGS.UserName ELSE (CASE WHEN PointBatchItem.PointState IS NOT NULL THEN '未审核' ELSE '' END) END) AS GLGSAudit,
|
||||
(CASE WHEN PointBatchItem.QTAudit IS NOT NULL THEN userQT.UserName ELSE (CASE WHEN PointBatchItem.PointState IS NOT NULL THEN '未审核' ELSE '' END) END) AS QTAudit,
|
||||
(CASE WHEN jot.BackingWelderId!=jot.CoverWelderId THEN backingWelder.WelderCode+'/'+coverWelder.WelderCode ELSE backingWelder.WelderCode END) AS WelderCode--焊工号
|
||||
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
|
||||
/**********焊口综合信息**********/
|
||||
SELECT
|
||||
weldJoint.WeldJointId,
|
||||
weldJoint.ProjectId,
|
||||
WorkArea.WorkAreaId,
|
||||
WorkArea.WorkAreaCode,
|
||||
weldJoint.SystemNumber,
|
||||
weldJoint.TestPackageNo,
|
||||
pipeline.SingleNumber,
|
||||
pipeline.PipelineCode,
|
||||
weldJoint.PipeSegment,--所属管段
|
||||
(CASE WHEN weldJoint.JointAttribute='固定F' THEN 'F'+weldJoint.WeldJointCode ELSE 'S'+weldJoint.WeldJointCode END) AS WeldJointCode,
|
||||
weldType.WeldTypeCode,
|
||||
weldJoint.JointAttribute,
|
||||
weldJoint.Dia,
|
||||
weldJoint.Thickness,--壁厚
|
||||
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 '是' ELSE '否' 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 '是' ELSE '否' 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
|
||||
@@ -0,0 +1,81 @@
|
||||
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
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,183 @@
|
||||
INSERT INTO dbo.Base_UnitType(UnitTypeId, UnitTypeName)
|
||||
VALUES ( '6','管理公司' )
|
||||
GO
|
||||
|
||||
|
||||
ALTER PROCEDURE [dbo].[sp_TrustReport]
|
||||
(
|
||||
@TrustBatchId NVARCHAR(50)
|
||||
)
|
||||
AS
|
||||
SELECT
|
||||
('工程名称:'+pro.ProjectName) AS ProjectName,pro.EnProjectName,trust.TrustDate,
|
||||
('单元名称:'+area.WorkAreaName) AS WorkAreaName, area.EnWorkAreaName,
|
||||
(SELECT unit.UnitName FROM dbo.Project_Unit punit LEFT JOIN dbo.Base_Unit unit ON unit.UnitId = punit.UnitId WHERE ProjectId= trust.ProjectId AND punit.UnitType='1') AS TrustUnit,
|
||||
trust.TrustBatchCode,nde.DetectionTypeCode,trust.SurfaceState,nde.TestStandard,rate.DetectionRateCode, nde.TechLevel,
|
||||
(CASE WHEN trust.NDEUuit IS NOT NULL THEN unit.UnitName ELSE (SELECT UnitName FROM dbo.Base_Unit WHERE UnitId=(SELECT TOP 1 UnitId FROM dbo.Project_Unit WHERE ProjectId= trust.ProjectId AND UnitType='4')) END) AS NDEUnit,
|
||||
mat.WeldingMethodCode,groove.GrooveTypeCode,pipe.PipelineCode,trust.DetectionTiming,
|
||||
(CASE WHEN nde.SysType='渗透检测' THEN 'Ⅰ' ELSE (CASE WHEN nde.SysType='超声波检测' THEN 'Ⅱ' ELSE (CASE WHEN rate.DetectionRateCode='5%' OR rate.DetectionRateCode='10%' THEN 'Ⅲ' ELSE 'Ⅱ' END) END)END) AS QueClass,
|
||||
|
||||
trust.QuaCertFile,--质量证明文件编号
|
||||
trust.AcceptStandard--制造/验收标准
|
||||
FROM dbo.Batch_BatchTrust trust
|
||||
LEFT JOIN dbo.Base_Project pro ON pro.ProjectId = trust.ProjectId
|
||||
--LEFT JOIN dbo.Project_Installation ins ON ins.InstallationId = trust.InstallationId
|
||||
LEFT JOIN dbo.Project_WorkArea area ON area.WorkAreaId = trust.WorkAreaId
|
||||
LEFT JOIN dbo.Base_Unit unit ON unit.UnitId = trust.NDEUuit
|
||||
LEFT JOIN dbo.Base_Unit cunit ON cunit.UnitId = trust.UnitId
|
||||
--LEFT JOIN dbo.Base_Unit tunit ON tunit.UnitId = ins.SupervisorUnitId
|
||||
LEFT JOIN dbo.Base_DetectionType nde ON nde.DetectionTypeId = trust.DetectionTypeId
|
||||
LEFT JOIN dbo.Base_WeldingMethod mat ON mat.WeldingMethodId = trust.WeldingMethodId
|
||||
LEFT JOIN dbo.Base_GrooveType groove ON groove.GrooveTypeId = trust.GrooveTypeId
|
||||
LEFT JOIN dbo.Pipeline_Pipeline pipe ON pipe.PipelineId = trust.PipelineId
|
||||
LEFT JOIN dbo.Base_DetectionRate rate ON rate.DetectionRateId = pipe.DetectionRateId
|
||||
WHERE trust.TrustBatchId=@TrustBatchId
|
||||
|
||||
GO
|
||||
|
||||
|
||||
ALTER PROCEDURE [dbo].[TrustItemReport]
|
||||
(
|
||||
@TrustBatchId NVARCHAR(50)
|
||||
)
|
||||
AS
|
||||
/******焊缝检测委托单明细表*******/
|
||||
SELECT ROW_NUMBER() OVER(ORDER BY jot.WeldJointCode) AS Number,
|
||||
BatchTrustItem.TrustBatchItemId,
|
||||
BatchTrustItem.TrustBatchId,
|
||||
pipe.PipelineCode, --管线号
|
||||
pipe.SingleNumber, --单线号
|
||||
(CASE WHEN PointBatchItem.PointState='2' then (CASE WHEN jot.JointAttribute='固定F' THEN 'F'+jot.WeldJointCode ELSE 'S'+jot.WeldJointCode END)+'K'
|
||||
ELSE (CASE WHEN jot.JointAttribute='固定F' THEN 'F'+jot.WeldJointCode ELSE 'S'+jot.WeldJointCode END) END) AS WeldJointCode, --焊口号
|
||||
jot.Specification, --焊缝规格
|
||||
(CASE WHEN mat1.MaterialCode IS NOT NULL AND mat2.MaterialCode IS NOT NULL
|
||||
THEN mat1.MaterialCode + '/' + mat2.MaterialCode
|
||||
ELSE (ISNULL(mat1.MaterialCode,'') + ISNULL(mat2.MaterialCode,'')) END) AS MaterialCode, --材质
|
||||
(CASE WHEN jot.BackingWelderId!=jot.CoverWelderId THEN backingWelder.WelderCode+'/'+coverWelder.WelderCode ELSE backingWelder.WelderCode END) AS WelderCode,--焊工号
|
||||
rate.DetectionRateCode AS DetectionRateCode,--检测比例
|
||||
PointBatchItem.AcceptLevel AS AcceptLevel, --验收等级
|
||||
(case when PointBatchItem.IsWelderFirst=1 then '首三件' else '' end) as Remark,
|
||||
jot.HeartNo1,--炉批1号
|
||||
jot.HeartNo2,--炉批2号
|
||||
(case jot.IsHotProess when 1 then '是' else '否' end) as IsHotProessName--是否热处理
|
||||
FROM dbo.Batch_BatchTrustItem AS BatchTrustItem
|
||||
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 dbo.Welder_Welder backingWelder ON backingWelder.WelderId = jot.BackingWelderId
|
||||
LEFT JOIN dbo.Welder_Welder coverWelder ON coverWelder.WelderId = jot.CoverWelderId
|
||||
LEFT JOIN Base_Material AS mat1 ON mat1.MaterialId = jot.Material1Id
|
||||
LEFT JOIN Base_Material AS mat2 ON mat2.MaterialId = jot.Material2Id
|
||||
WHERE BatchTrustItem.TrustBatchId=@TrustBatchId and BatchTrustItem.IsCancelTrust is null
|
||||
|
||||
GO
|
||||
------------------------------------已下已更新---------------------------------------------
|
||||
|
||||
ALTER TABLE dbo.Batch_BatchTrust ADD GrooveTypeId NVARCHAR(50) NULL
|
||||
ALTER TABLE dbo.Batch_BatchTrust ADD WeldingMethodId NVARCHAR(50) NULL
|
||||
ALTER TABLE dbo.Batch_BatchTrust ADD IsWelderFirst BIT NULL
|
||||
GO
|
||||
|
||||
|
||||
ALTER VIEW [dbo].[View_GenerateTrust_FJ]
|
||||
AS
|
||||
-------正常点口生成委托-----------
|
||||
SELECT point.ProjectId,point.InstallationId,pipe.WorkAreaId ,point.UnitId,pointItem.PointBatchId,
|
||||
point.DetectionTypeId,point.PipelineId,jot.WeldingMethodId,jot.GrooveTypeId,
|
||||
(CASE WHEN pointItem.IsWelderFirst=1 THEN 1 ELSE 0 END) AS IsWelderFirst
|
||||
FROM dbo.Batch_PointBatchItem pointItem
|
||||
LEFT JOIN dbo.Batch_PointBatch point ON point.PointBatchId = pointItem.PointBatchId
|
||||
LEFT JOIN dbo.Batch_BatchTrustItem trustItem ON trustItem.PointBatchItemId = pointItem.PointBatchItemId
|
||||
LEFT JOIN dbo.Pipeline_Pipeline pipe ON pipe.PipelineId = point.PipelineId
|
||||
LEFT JOIN dbo.Pipeline_WeldJoint jot ON jot.WeldJointId = pointItem.WeldJointId
|
||||
WHERE pointItem.CutDate IS NULL AND pointItem.PointDate IS NOT NULL
|
||||
AND trustItem.TrustBatchItemId IS NULL
|
||||
AND pointItem.PointState='1'
|
||||
AND pointItem.JLAudit<>'' AND pointItem.JLAudit IS NOT NULL
|
||||
AND pointItem.GLGSAudit<>'' AND pointItem.GLGSAudit IS NOT NULL
|
||||
GROUP BY point.ProjectId,point.InstallationId,pipe.WorkAreaId,point.UnitId,pointItem.PointBatchId,point.DetectionTypeId,
|
||||
point.PipelineId,jot.WeldingMethodId,jot.GrooveTypeId,CASE WHEN pointItem.IsWelderFirst=1 THEN 1 ELSE 0 END
|
||||
|
||||
|
||||
|
||||
GO
|
||||
|
||||
|
||||
ALTER VIEW [dbo].[View_GenerateTrustItem_FJ]
|
||||
AS
|
||||
SELECT point.ProjectId,point.InstallationId,pipe.WorkAreaId ,point.UnitId,point.DetectionTypeId,
|
||||
point.PipelineId,jot.WeldingMethodId,jot.GrooveTypeId,
|
||||
(CASE WHEN pointItem.IsWelderFirst=1 THEN 1 ELSE 0 END) AS IsWelderFirst,
|
||||
--上面是条件
|
||||
rate.DetectionRateValue,pointItem.PointBatchItemId,pointItem.PointBatchId,pointItem.WeldJointId,jot.Dia
|
||||
FROM dbo.Batch_PointBatchItem pointItem
|
||||
LEFT JOIN dbo.Pipeline_WeldJoint jot ON jot.WeldJointId = pointItem.WeldJointId
|
||||
LEFT JOIN dbo.Batch_PointBatch point ON point.PointBatchId = pointItem.PointBatchId
|
||||
LEFT JOIN dbo.Batch_BatchTrustItem trustItem ON trustItem.PointBatchItemId = pointItem.PointBatchItemId
|
||||
LEFT JOIN dbo.Pipeline_Pipeline pipe ON pipe.PipelineId = point.PipelineId
|
||||
LEFT JOIN dbo.Base_DetectionRate rate ON rate.DetectionRateId = point.DetectionRateId
|
||||
WHERE pointItem.CutDate IS NULL AND pointItem.PointDate IS NOT NULL
|
||||
AND pointItem.PointState='1'
|
||||
AND trustItem.TrustBatchItemId IS NULL
|
||||
AND pointItem.JLAudit<>'' AND pointItem.JLAudit IS NOT NULL
|
||||
AND pointItem.GLGSAudit<>'' AND pointItem.GLGSAudit IS NOT 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,
|
||||
groove.GrooveTypeCode,
|
||||
'巴斯夫一体化基地(广东)有限公司' AS TrustUnit,
|
||||
mat.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.Base_WeldingMethod mat ON mat.WeldingMethodId = BatchTrust.WeldingMethodId
|
||||
LEFT JOIN dbo.Base_GrooveType groove ON groove.GrooveTypeId = BatchTrust.GrooveTypeId
|
||||
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
|
||||
|
||||
|
||||
@@ -0,0 +1,134 @@
|
||||
|
||||
CREATE TABLE [dbo].[Base_PIPClass](
|
||||
[PIPClassId] [NVARCHAR](50) NOT NULL,
|
||||
[PIPClassCode] [NVARCHAR](50) NULL,
|
||||
[PIPClassName] [NVARCHAR](50) NULL,
|
||||
[Remark] [NCHAR](10) NULL,
|
||||
CONSTRAINT [PK_Base_PIPClass] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[PIPClassId] ASC
|
||||
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
||||
) ON [PRIMARY]
|
||||
|
||||
GO
|
||||
|
||||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'压力管道分级ID' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Base_PIPClass', @level2type=N'COLUMN',@level2name=N'PIPClassId'
|
||||
GO
|
||||
|
||||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'压力管道分级代号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Base_PIPClass', @level2type=N'COLUMN',@level2name=N'PIPClassCode'
|
||||
GO
|
||||
|
||||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'压力管道分级名称' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Base_PIPClass', @level2type=N'COLUMN',@level2name=N'PIPClassName'
|
||||
GO
|
||||
|
||||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'备注' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Base_PIPClass', @level2type=N'COLUMN',@level2name=N'Remark'
|
||||
GO
|
||||
|
||||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'压力管道分级表' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Base_PIPClass'
|
||||
GO
|
||||
|
||||
ALTER TABLE dbo.Pipeline_Pipeline ADD PIPClassId NVARCHAR(50) NULL
|
||||
GO
|
||||
ALTER TABLE dbo.Base_Consumables ADD UserFlux NVARCHAR(30) NULL
|
||||
GO
|
||||
|
||||
|
||||
ALTER PROC [dbo].[sp_rpt_JointComprehensive]
|
||||
@projectId NVARCHAR(50),
|
||||
@workAreaId NVARCHAR(50)=NULL,
|
||||
@pipelineIds NVARCHAR(MAX) = NULL
|
||||
|
||||
AS
|
||||
/**********焊口综合信息**********/
|
||||
SELECT
|
||||
weldJoint.WeldJointId,
|
||||
weldJoint.ProjectId,
|
||||
WorkArea.WorkAreaId,
|
||||
WorkArea.WorkAreaCode,
|
||||
weldJoint.SystemNumber,
|
||||
weldJoint.TestPackageNo,
|
||||
pipeline.SingleNumber,
|
||||
pipeline.PipelineCode,
|
||||
weldJoint.PipeSegment,--所属管段
|
||||
(CASE WHEN weldJoint.JointAttribute='固定F' THEN 'F'+weldJoint.WeldJointCode ELSE 'S'+weldJoint.WeldJointCode END) AS WeldJointCode,
|
||||
weldType.WeldTypeCode,
|
||||
weldJoint.JointAttribute,
|
||||
wl.WeldingLocationCode,
|
||||
weldJoint.Dia,
|
||||
weldJoint.Thickness,--壁厚
|
||||
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 '是' ELSE '否' 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,
|
||||
WeldMaterialSilk.UserFlux,
|
||||
weldJoint.Specification,
|
||||
wps.WPQCode,ndttype.DetectionTypeCode,NULL AS HotReportCode,
|
||||
|
||||
(CASE WHEN (PointBatchItem.PointState='1' OR PointBatchItem.PointState='2') then '是' ELSE '否' 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 dbo.Base_WeldingLocation wl ON wl.WeldingLocationId = weldJoint.WeldingLocationId
|
||||
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
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user