initproject
This commit is contained in:
@@ -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