Files
SGGL_SHJ/DataBase/版本日志/已更新脚本/2020年度/SGGLDB_V2020-08-12-001.sql
T
2022-09-05 16:36:31 +08:00

140 lines
6.9 KiB
Transact-SQL

CREATE INDEX Check_RectifyNoticesProjectIdStates
ON Check_RectifyNotices (ProjectId,States)
GO
CREATE INDEX Index_AttachFile_ToKeyId
ON AttachFile (ToKeyId)
GO
CREATE PROC [dbo].[SP_RectifyNoticesListByProjectStates]
@projectId NVARCHAR(50) = NULL,
@states NVARCHAR(50)=NULL
AS
/*茶뻤憐맣데죗깊*/
SELECT Notices.RectifyNoticesId
,Notices.ProjectId
,Project.ProjectName
,Notices.RectifyNoticesCode
,Notices.UnitId
,Unit.UnitCode
,Unit.UnitName
,Notices.WorkAreaId
,WorkAreaName= STUFF((SELECT ',' + UnitWorkName FROM dbo.WBS_UnitWork where PATINDEX('%,' + RTRIM(UnitWorkId) + ',%',',' +Notices.WorkAreaId + ',')>0 FOR XML PATH('')), 1, 1,'')
,Notices.CheckManNames
,Notices.CheckManIds
,CONVERT(varchar(100),Notices.CheckedDate,20) AS CheckedDate
,Notices.CheckedDate AS CheckedDateD
,Notices.HiddenHazardType
,(CASE WHEN Notices.HiddenHazardType ='2' THEN '싹댕' WHEN Notices.HiddenHazardType = '3' THEN '路댕' ELSE '寧겹' END) AS HiddenHazardTypeName
,Notices.CompleteManId
,CompleteManUser.UserName AS CompleteManName
,Notices.SignPerson AS SignPersonId
,SignPersonUser.UserName AS SignPersonName
,CONVERT(varchar(100),Notices.SignDate,20) AS SignDate
,Notices.DutyPersonId
,DutyPersonUser.UserName AS DutyPersonName
,CONVERT(varchar(100),Notices.DutyPersonTime,20) AS DutyPersonTime
,CONVERT(varchar(100),Notices.CompleteDate,20) AS CompleteDate
,Notices.UnitHeadManId
,UnitHeadManUser.UserName as UnitHeadManUserName
,CONVERT(varchar(100),Notices.UnitHeadManDate,20) AS UnitHeadManDate
,Notices.CheckPerson AS CheckPersonId
,CheckPersonUser.UserName as CheckPersonName
,CONVERT(varchar(100),Notices.ReCheckDate,20) AS ReCheckDate
,ProfessionalEngineerId
,ProfessionalEngineerUser.UserName as ProjectManagerName
,CONVERT(varchar(100),Notices.ProfessionalEngineerTime1,20) AS ProfessionalEngineerTime1
,CONVERT(varchar(100),Notices.ProfessionalEngineerTime2,20) AS ProfessionalEngineerTime2
,ConstructionManagerId
,ConstructionManagerUser.UserName as ConstructionManagerName
,ConstructionManagerTime1
,CONVERT(varchar(100),Notices.ConstructionManagerTime1,20) AS ConstructionManagerTime1
,CONVERT(varchar(100),Notices.ConstructionManagerTime2,20) AS ConstructionManagerTime2
,ProjectManagerId
,ProjectManagerUser.UserName as ProjectManagerName
,CONVERT(varchar(100),Notices.ProjectManagerTime1,20) AS ProjectManagerTime1
,CONVERT(varchar(100),Notices.ProjectManagerTime2,20) AS ProjectManagerTime2
,Notices.ReCheckOpinion
,Notices.IsRectify
,Notices.States
,REPLACE(AttachFile.AttachUrl,'\\', '/') AS AttachUrl
FROM Check_RectifyNotices AS Notices
LEFT JOIN Base_Project AS Project ON Notices.ProjectId =Project.ProjectId
LEFT JOIN Base_Unit AS Unit ON Notices.UnitId =Unit.UnitId
LEFT JOIN Sys_User AS CompleteManUser ON Notices.CompleteManId =CompleteManUser.UserId
LEFT JOIN Sys_User AS SignPersonUser ON Notices.SignPerson =SignPersonUser.UserId
LEFT JOIN Sys_User AS DutyPersonUser ON Notices.DutyPersonId =DutyPersonUser.UserId
LEFT JOIN Sys_User AS UnitHeadManUser ON Notices.UnitHeadManId =UnitHeadManUser.UserId
LEFT JOIN Sys_User AS CheckPersonUser ON Notices.CheckPerson =CheckPersonUser.UserId
LEFT JOIN AttachFile AS AttachFile ON AttachFile.ToKeyId =Notices.RectifyNoticesId
LEFT JOIN Sys_User AS ProfessionalEngineerUser ON Notices.ProfessionalEngineerId =ProfessionalEngineerUser.UserId
LEFT JOIN Sys_User AS ConstructionManagerUser ON Notices.ConstructionManagerId =ConstructionManagerUser.UserId
LEFT JOIN Sys_User AS ProjectManagerUser ON Notices.ProjectManagerId =ProjectManagerUser.UserId
WHERE (@projectId IS NULL OR Notices.ProjectId=@projectId)
AND (@states IS NULL OR Notices.States=@states)
ORDER BY Notices.RectifyNoticesCode DESC
GO
ALTER TABLE dbo.Welder_WelderQualify ADD WeldType NVARCHAR(20) NULL
GO
ALTER TABLE dbo.Welder_WelderQualify ADD IsCanWeldG BIT NULL
GO
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'WeldType'
GO
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'IsCanWeldG'
GO
ALTER TABLE dbo.WPQ_WPQList ADD MinCImpactDia DECIMAL(9,2) NULL
ALTER TABLE dbo.WPQ_WPQList ADD MaxCImpactDia DECIMAL(9,2) NULL
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'밗쓺림맨離鬼令(뚤쌈보룹)' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'WPQ_WPQList', @level2type=N'COLUMN',@level2name=N'MinImpactDia'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'밗쓺림맨離댕令(뚤쌈보룹)' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'WPQ_WPQList', @level2type=N'COLUMN',@level2name=N'MaxImpactDia'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'귿비림맨離鬼令(뚤쌈보룹)' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'WPQ_WPQList', @level2type=N'COLUMN',@level2name=N'MinImpactThickness'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'귿비림맨離댕令(뚤쌈보룹)' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'WPQ_WPQList', @level2type=N'COLUMN',@level2name=N'MaxImpactThickness'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'귿비림맨離鬼令(실보룹)' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'WPQ_WPQList', @level2type=N'COLUMN',@level2name=N'NoMinImpactThickness'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'귿비림맨離댕令(실보룹)' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'WPQ_WPQList', @level2type=N'COLUMN',@level2name=N'NoMaxImpactThickness'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'밗쓺림맨離鬼令(실보룹)' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'WPQ_WPQList', @level2type=N'COLUMN',@level2name=N'MinCImpactDia'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'밗쓺림맨離댕令(실보룹)' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'WPQ_WPQList', @level2type=N'COLUMN',@level2name=N'MaxCImpactDia'
GO
ALTER VIEW [dbo].[View_Welder_WelderQualify]
AS
/*******보묏栗醴***********/
SELECT WelderQualify.WelderQualifyId,
WelderQualify.WelderId,
WelderQualify.QualificationItem,
WelderQualify.LimitDate,
WelderQualify.CheckDate,
WelderQualify.ThicknessMax,
WelderQualify.SizesMin,
WelderQualify.Remark,
Welder.WelderCode,
Welder.PersonName,
WelderQualify.WeldingMethod,
WelderQualify.WeldingLocation,
WelderQualify.MaterialType,
WelderQualify.IsPrintShow,
WelderQualify.WeldType,
WelderQualify.IsCanWeldG
FROM Welder_WelderQualify AS WelderQualify
LEFT JOIN SitePerson_Person AS Welder ON Welder.PersonId=WelderQualify.WelderId
GO