Alter table [dbo].[WPQ_WPQList] Add ApproveManId nvarchar(50) NuLL,state nvarchar(10) NULL,ApproveTime datetime NULL ALTER TABLE [dbo].[WPQ_WPQList] WITH CHECK ADD CONSTRAINT [FK_WPQ_WPQList_Sys_User] FOREIGN KEY([ApproveManId]) REFERENCES [dbo].[Sys_User] ([UserId]) GO Alter table HJGL_Batch_PointBatchItem Add PBackingWelderId nvarchar(50) NULL,PCoverWelderId nvarchar(50) NULL ALTER TABLE [dbo].[HJGL_Batch_PointBatchItem] WITH CHECK ADD CONSTRAINT [FK_HJGL_Batch_PointBatchItem_SitePerson_Person_BackingWelder] FOREIGN KEY([PBackingWelderId]) REFERENCES [dbo].[SitePerson_Person] ([PersonId]) GO ALTER TABLE [dbo].[HJGL_Batch_PointBatchItem] CHECK CONSTRAINT [FK_HJGL_Batch_PointBatchItem_SitePerson_Person_BackingWelder] GO ALTER TABLE [dbo].[HJGL_Batch_PointBatchItem] WITH CHECK ADD CONSTRAINT [FK_HJGL_Batch_PointBatchItem_SitePerson_Person_CoverWelder] FOREIGN KEY([PCoverWelderId]) REFERENCES [dbo].[SitePerson_Person] ([PersonId]) GO ALTER TABLE [dbo].[HJGL_Batch_PointBatchItem] CHECK CONSTRAINT [FK_HJGL_Batch_PointBatchItem_SitePerson_Person_CoverWelder] GO Alter table Welder_WelderQualify Add WelderMode nvarchar(10) NULL EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'焊工机动化程序(手工、机动/自动)' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Welder_WelderQualify', @level2type=N'COLUMN',@level2name=N'WelderMode' GO ALTER VIEW [dbo].[View_HJGL_Batch_PointBatchItem] AS /*************点口明细表*************/ SELECT PointBatchItem.PointBatchItemId, PointBatchItem.PointBatchId, PointBatch.ProjectId, PointBatch.UnitId, PointBatch.DetectionTypeId, PointBatch.PointBatchCode, Pipeline.UnitWorkId, PointBatchItem.WeldJointId, (CASE PointBatchItem.PointState WHEN '1' THEN '点口' WHEN '2' THEN '扩透' END) AS PointState, (CASE PointBatchItem.IsBuildTrust WHEN 1 THEN '是' ELSE '' END) AS IsBuildTrust, (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,--点口日期 (CASE PointBatchItem.IsWelderFirst WHEN 1 THEN '是' ELSE '' END) AS IsWelderFirst, PointBatchItem.RepairDate,--返修日期 PointBatchItem.RepairRecordId, PointBatchItem.CutDate,--切除日期 PointBatchItem.PBackingWelderId,--返修打底焊工 PointBatchItem.PCoverWelderId,--返修盖面焊工 UnitWork.UnitWorkCode,--工区号 WeldJoint.WeldJointCode,--焊口号 WeldJoint.BackingWelderId AS WelderId, --焊工ID BackingWelder.WelderCode AS BackingWelderCode, CoverWelder.WelderCode AS CoverWelderCode, WeldType.WeldTypeCode, WeldJoint.JointAttribute, WeldJoint.JointArea,--焊接区域 WeldJoint.Size,--实际寸径 WeldingDaily.WeldingDate,--焊接日期 WeldJoint.PipelineId, --管线ID WeldJoint.Material1Id AS Mat, --材质 WeldJoint.Specification, --规格 Pipeline.PipelineCode, --管线号 PipingClass.PipingClassName , --管道等级 WeldJoint.BackingWelderId, WeldJoint.CoverWelderId FROM dbo.HJGL_Batch_PointBatchItem AS PointBatchItem LEFT JOIN dbo.HJGL_Batch_PointBatch AS PointBatch ON PointBatch.PointBatchId=PointBatchItem.PointBatchId LEFT JOIN dbo.HJGL_WeldJoint AS WeldJoint ON WeldJoint.WeldJointId=PointBatchItem.WeldJointId LEFT JOIN dbo.HJGL_Pipeline AS Pipeline ON Pipeline.PipelineId=WeldJoint.PipelineId LEFT JOIN dbo.WBS_UnitWork AS UnitWork ON UnitWork.UnitWorkId=Pipeline.UnitWorkId LEFT JOIN dbo.HJGL_WeldingDaily AS WeldingDaily ON WeldingDaily.WeldingDailyId=WeldJoint.WeldingDailyId LEFT JOIN dbo.Base_PipingClass AS PipingClass ON PipingClass.PipingClassId=Pipeline.PipingClassId LEFT JOIN SitePerson_Person AS BackingWelder ON BackingWelder.PersonId=WeldJoint.BackingWelderId LEFT JOIN SitePerson_Person AS CoverWelder ON CoverWelder.PersonId=WeldJoint.CoverWelderId LEFT JOIN Base_WeldType AS WeldType ON WeldType.WeldTypeId=WeldJoint.WeldTypeId GO CREATE TABLE [dbo].[WPQ_WPQListFlowOperate]( [FlowOperateId] [nvarchar](50) NOT NULL, [WPQId] [nvarchar](50) NULL, [OperateName] [nvarchar](50) NULL, [OperateManId] [nvarchar](50) NULL, [OperateTime] [datetime] NULL CONSTRAINT [PK_WPQ_WPQListFlowOperate] PRIMARY KEY CLUSTERED ( [FlowOperateId] 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 ALTER TABLE [dbo].[WPQ_WPQListFlowOperate] WITH CHECK ADD CONSTRAINT [FK_WPQ_WPQListFlowOperate_WPQ_WPQList] FOREIGN KEY([WPQId]) REFERENCES [dbo].[WPQ_WPQList] ([WPQId]) GO ALTER TABLE [dbo].[WPQ_WPQListFlowOperate] CHECK CONSTRAINT [FK_WPQ_WPQListFlowOperate_WPQ_WPQList] GO EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'主键ID' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'WPQ_WPQListFlowOperate', @level2type=N'COLUMN',@level2name=N'FlowOperateId' GO EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'焊评ID' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'WPQ_WPQListFlowOperate', @level2type=N'COLUMN',@level2name=N'WPQId' GO EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'操作步骤名称' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'WPQ_WPQListFlowOperate', @level2type=N'COLUMN',@level2name=N'OperateName' GO EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'焊评审核记录表' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'WPQ_WPQListFlowOperate' GO ALTER VIEW [dbo].[View_HJGL_Pipeline] AS /*************管线视图*****************/ SELECT pipeline.PipelineId, pipeline.ProjectId, pipeline.UnitId, pipeline.UnitWorkId, pipeline.PipelineCode, pipeline.SingleNumber, pipeline.PipingClassId, pipeline.MediumId, pipingClass.PipingClassCode, pipeline.DetectionRateId, rate.DetectionRateCode, pipeline.DetectionType, pipeline.TestPressure, pipeline.TestMedium, pipeline.PressurePipingClassId, pc.PressurePipingClassCode, pipeline.PipeLenth, pipeline.DesignPress, pipeline.DesignTemperature, pipeline.Remark, pipeline.LeakPressure, pipeline.LeakMedium, pipeline.VacuumPressure, pipeline.PCMedium , pipeline.PCtype, lea.MediumName as LeakMediumName, pur.PurgeMethodName as PCMediumName, CAST((SELECT SUM(ISNULL(Size,0)) FROM dbo.HJGL_WeldJoint WHERE PipelineId=pipeline.PipelineId) AS DECIMAL(8,3)) AS TotalDin, (SELECT COUNT(WeldJointId) FROM dbo.HJGL_WeldJoint WHERE PipelineId=pipeline.PipelineId) AS JointCount, unit.UnitName, workArea.UnitWorkCode, medium.MediumCode, testMedium.MediumCode AS TestMediumCode FROM dbo.HJGL_Pipeline AS pipeline LEFT JOIN Base_PipingClass AS pipingClass ON pipingClass.PipingClassId=pipeline.PipingClassId LEFT JOIN dbo.Base_Unit AS unit ON unit.UnitId=pipeline.UnitId LEFT JOIN WBS_UnitWork AS workArea ON workArea.UnitWorkId=pipeline.UnitWorkId LEFT JOIN Base_Medium AS medium ON medium.MediumId=pipeline.MediumId LEFT JOIN dbo.Base_TestMedium AS testMedium ON testMedium.TestMediumId=pipeline.TestMedium LEFT JOIN dbo.Base_DetectionRate rate ON rate.DetectionRateId = pipeline.DetectionRateId LEFT JOIN dbo.Base_PressurePipingClass pc ON pc.PressurePipingClassId = pipeline.PressurePipingClassId LEFT JOIN dbo.Base_TestMedium AS lea ON lea.TestMediumId=pipeline.LeakMedium LEFT JOIN dbo.Base_PurgeMethod AS pur ON pur.PurgeMethodId=pipeline.PCMedium GO