795 lines
31 KiB
Transact-SQL
795 lines
31 KiB
Transact-SQL
|
||
|
||
--五环二期集团大屏数据同步更新脚本
|
||
|
||
|
||
|
||
--新增菜单:质量公共资源库-质量隐患!!!!!!根据定制客户的菜单type(MenuType)新增菜单
|
||
--标准版:Menu_DigData
|
||
insert into Sys_Menu(MenuId,MenuName,Url,SortIndex,SuperMenu,MenuType,IsOffice,IsEnd,IsUsed)
|
||
values('D72BB321-11A8-485B-BAC7-367C7FCA7FBA','质量隐患','CQMS/Technique/Rectify.aspx',1,'A5D13C77-33B2-4D47-B7FD-5256543A8DC1','Menu_DigData',1,1,1)
|
||
GO
|
||
|
||
|
||
--新增菜单:质量管理-QC管理!!!!!!根据定制客户的菜单type(MenuType)新增菜单
|
||
--标准版:Menu_CQMS
|
||
--五环(综合管理):Menu_ZHGL
|
||
insert into dbo.Sys_Menu (MenuId, MenuName, Icon, Url, SortIndex, SuperMenu, MenuType, IsOffice, IsEnd, IsUsed)
|
||
values (N'5708024C-CD74-42CD-839C-2E4FD83D1897', N'QC管理', null, N'', 121, N'0', 'Menu_ZHGL', 0, 0, 1),
|
||
(N'8B1DFB6D-B48C-4FAB-821F-25AD582DBFAB', N'QC小组注册', null, N'CQMS/QualityActivity/QCManage/QCGroupRegistration.aspx', 20, N'5708024C-CD74-42CD-839C-2E4FD83D1897', 'Menu_ZHGL', 0, 1, 1),
|
||
(N'B1D48FD8-F44A-46DD-AB9F-6D431365F6D1', N'QC统计', null, N'CQMS/QualityActivity/QCManage/QCStatics.aspx', 60, N'5708024C-CD74-42CD-839C-2E4FD83D1897', 'Menu_ZHGL', 0, 1, 1);
|
||
go
|
||
|
||
|
||
--新增菜单:特设质保体系
|
||
insert into Sys_Menu(MenuId,MenuName,Url,SortIndex,SuperMenu,MenuType,IsOffice,IsEnd,IsUsed)
|
||
values('2C49EC5E-BF6F-4C44-BA02-9BD183CF68C6','特设质保体系','CQMS/Comprehensive/QualityAssurance.aspx',190,'4a0e62cb-ee50-4a14-80b7-377602e9902c','Menu_CQMS',0,1,1)
|
||
go
|
||
|
||
insert into Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex)
|
||
values('395F6F1E-9033-4B7E-9A74-EFA0EE9A3149','2C49EC5E-BF6F-4C44-BA02-9BD183CF68C6','增加',1)
|
||
insert into Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex)
|
||
values('2E498DB2-82B4-49F3-A80B-0352A061DB1F','2C49EC5E-BF6F-4C44-BA02-9BD183CF68C6','修改',2)
|
||
insert into Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex)
|
||
values('3236569E-BBF8-4B8F-8C21-094B2F761F39','2C49EC5E-BF6F-4C44-BA02-9BD183CF68C6','删除',3)
|
||
insert into Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex)
|
||
values('2AD98DF0-2D47-4B00-A577-FC37A41A099C','2C49EC5E-BF6F-4C44-BA02-9BD183CF68C6','保存',4)
|
||
go
|
||
|
||
|
||
|
||
--------------------------------------------------------------------------------------
|
||
|
||
--质量公共资源库-质量隐患
|
||
IF NOT EXISTS (SELECT * FROM Sys_ButtonToMenu WHERE MenuId = 'D72BB321-11A8-485B-BAC7-367C7FCA7FBA')
|
||
BEGIN
|
||
insert into Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex)
|
||
values('E770B99A-3935-4489-9A41-95552E54C853','D72BB321-11A8-485B-BAC7-367C7FCA7FBA','增加',1)
|
||
insert into Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex)
|
||
values('3FAD3BFA-3E69-40AB-9299-631CB308755E','D72BB321-11A8-485B-BAC7-367C7FCA7FBA','修改',2)
|
||
insert into Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex)
|
||
values('D073D5A7-89BC-4E24-9D56-8CEBE6B8FC19','D72BB321-11A8-485B-BAC7-367C7FCA7FBA','删除',3)
|
||
insert into Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex)
|
||
values('F3EC43F7-BBB1-407E-83D1-47B9B946C804','D72BB321-11A8-485B-BAC7-367C7FCA7FBA','保存',4)
|
||
insert into Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex)
|
||
values('BB0DEF29-17BA-44DA-99EC-A80E99220D5E','D72BB321-11A8-485B-BAC7-367C7FCA7FBA','导出',5)
|
||
END
|
||
GO
|
||
|
||
--QC管理/QC小组注册按钮
|
||
INSERT INTO dbo.Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex)
|
||
VALUES('2C35922B-5D10-4BC0-9AD8-619F03EAED5C','8B1DFB6D-B48C-4FAB-821F-25AD582DBFAB','增加',1)
|
||
INSERT INTO dbo.Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex)
|
||
VALUES('537C8FD5-F7F7-4BC9-A84F-0FD3A5E79551','8B1DFB6D-B48C-4FAB-821F-25AD582DBFAB','修改',2)
|
||
INSERT INTO dbo.Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex)
|
||
VALUES('EB398ED2-B6A7-41E1-A09D-1B454A7ACBF8','8B1DFB6D-B48C-4FAB-821F-25AD582DBFAB','删除',3)
|
||
INSERT INTO dbo.Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex)
|
||
VALUES('F221FA9D-0BB3-433E-B5D4-AC831F8B0855','8B1DFB6D-B48C-4FAB-821F-25AD582DBFAB','保存',4)
|
||
GO
|
||
|
||
|
||
|
||
--菜单名称修改
|
||
update Sys_Menu
|
||
set MenuName='企业大检查'
|
||
where MenuId='CD9FC4C8-4B02-4619-8B02-50DA6AE6146E'
|
||
|
||
update Sys_Menu
|
||
set MenuName='监督检查报告'
|
||
where MenuId='40387C48-95A0-435C-82FB-57AF0A81B9D4'
|
||
|
||
update Sys_Menu
|
||
set MenuName='监督检查整改'
|
||
where MenuId='A02E0365-383C-49A0-BF1A-B3E42052959B'
|
||
|
||
GO
|
||
|
||
|
||
--1、监督检查报告增加检查大类(0:安全、1:质量)、检查单位
|
||
IF NOT EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Supervise_SuperviseCheckReport' AND COLUMN_NAME = 'CheckMainType')
|
||
BEGIN
|
||
ALTER TABLE Supervise_SuperviseCheckReport ADD CheckMainType nvarchar(50);
|
||
ALTER TABLE Supervise_SuperviseCheckReport ADD CheckUnitId nvarchar(50);
|
||
END
|
||
GO
|
||
alter table dbo.Supervise_SuperviseCheckReport add IsUpdate bit
|
||
go
|
||
|
||
alter table HSSE_Hazard_HazardRegister add IsUpdate bit null
|
||
GO
|
||
|
||
alter table dbo.Solution_LargerHazard add IsUpdate bit
|
||
go
|
||
alter table dbo.License_LicenseManager add IsUpdate bit
|
||
go
|
||
|
||
|
||
alter table dbo.Check_CheckControl add IsUpdate bit
|
||
go
|
||
alter table dbo.Hazard_HazardSelectedItem add IsUpdate bit
|
||
go
|
||
|
||
|
||
--1、历史数据检查大类为安全
|
||
update Supervise_SuperviseCheckReport set CheckMainType='0';
|
||
GO
|
||
|
||
--2、历史数据检查单位为本单位
|
||
update Supervise_SuperviseCheckReport set CheckUnitId=(select UnitId from Base_Unit where IsThisUnit=1);
|
||
GO
|
||
|
||
|
||
--企业大检查类别表
|
||
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'Base_SuperviseCheckType') AND type = N'U')
|
||
BEGIN
|
||
CREATE TABLE [dbo].[Base_SuperviseCheckType](
|
||
[CheckTypeId] [nvarchar](50) NOT NULL,
|
||
[CheckTypeCode] [nvarchar](50) NULL,
|
||
[CheckTypeName] [nvarchar](50) NULL,
|
||
[CheckMainType] [nvarchar](10) NULL,
|
||
[Remark] [nvarchar](200) NULL,
|
||
CONSTRAINT [PK_Base_SuperviseCheckType] PRIMARY KEY CLUSTERED
|
||
(
|
||
[CheckTypeId] ASC
|
||
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
||
) ON [PRIMARY]
|
||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'主键' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Base_SuperviseCheckType', @level2type=N'COLUMN',@level2name=N'CheckTypeId'
|
||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'检查类别编号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Base_SuperviseCheckType', @level2type=N'COLUMN',@level2name=N'CheckTypeCode'
|
||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'检查类别' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Base_SuperviseCheckType', @level2type=N'COLUMN',@level2name=N'CheckTypeName'
|
||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'检查大类' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Base_SuperviseCheckType', @level2type=N'COLUMN',@level2name=N'CheckMainType'
|
||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'备注' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Base_SuperviseCheckType', @level2type=N'COLUMN',@level2name=N'Remark'
|
||
END
|
||
|
||
GO
|
||
|
||
--企业大检查类别表初始化数据
|
||
IF NOT EXISTS (SELECT * FROM Base_SuperviseCheckType WHERE CheckTypeId = 'AC59B57B-E9E9-45A3-AF20-6B26085EA678')
|
||
BEGIN
|
||
INSERT INTO dbo.Base_SuperviseCheckType(CheckTypeId,CheckTypeCode,CheckTypeName,CheckMainType,Remark)
|
||
VALUES('AC59B57B-E9E9-45A3-AF20-6B26085EA678','1','企业负责人带班检查','0','')
|
||
INSERT INTO dbo.Base_SuperviseCheckType(CheckTypeId,CheckTypeCode,CheckTypeName,CheckMainType,Remark)
|
||
VALUES('A9E180A3-57DE-47FF-AEC1-9EA186E2DB61','2','企业综合检查','0','')
|
||
INSERT INTO dbo.Base_SuperviseCheckType(CheckTypeId,CheckTypeCode,CheckTypeName,CheckMainType,Remark)
|
||
VALUES('9792D11C-71F6-4C4C-A516-C887C84CA151','3','企业专项检查','0','')
|
||
INSERT INTO dbo.Base_SuperviseCheckType(CheckTypeId,CheckTypeCode,CheckTypeName,CheckMainType,Remark)
|
||
VALUES('81BEEB75-1BD1-49EA-8EAD-9AA91902A97E','1','企业质量大检查','1','')
|
||
END
|
||
|
||
GO
|
||
|
||
|
||
--
|
||
IF NOT EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'HSSEData_HSSE' AND COLUMN_NAME = 'BranchLeadShiftCheckNum')
|
||
BEGIN
|
||
alter table dbo.HSSEData_HSSE add BranchLeadShiftCheckNum int;
|
||
alter table dbo.HSSEData_HSSE add BranchComprehensiveCheckNum int;
|
||
alter table dbo.HSSEData_HSSE add BranchSpecialCheckNum int;
|
||
|
||
exec sp_addextendedproperty 'MS_Description', N'分支机构负责人带班检查次数', 'SCHEMA', 'dbo', 'TABLE',
|
||
'HSSEData_HSSE', 'COLUMN', 'BranchLeadShiftCheckNum'
|
||
exec sp_addextendedproperty 'MS_Description', N'分支机构综合检查次数', 'SCHEMA', 'dbo', 'TABLE',
|
||
'HSSEData_HSSE', 'COLUMN', 'BranchComprehensiveCheckNum'
|
||
exec sp_addextendedproperty 'MS_Description', N'分支机构专项检查次数', 'SCHEMA', 'dbo', 'TABLE',
|
||
'HSSEData_HSSE', 'COLUMN', 'BranchSpecialCheckNum'
|
||
END
|
||
GO
|
||
--
|
||
IF NOT EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Project_HSSEData_HSSE' AND COLUMN_NAME = 'BranchLeadShiftCheckNum')
|
||
BEGIN
|
||
alter table dbo.Project_HSSEData_HSSE add BranchLeadShiftCheckNum int;
|
||
alter table dbo.Project_HSSEData_HSSE add BranchComprehensiveCheckNum int;
|
||
alter table dbo.Project_HSSEData_HSSE add BranchSpecialCheckNum int;
|
||
|
||
exec sp_addextendedproperty 'MS_Description', N'分支机构负责人带班检查次数', 'SCHEMA', 'dbo', 'TABLE',
|
||
'Project_HSSEData_HSSE', 'COLUMN', 'BranchLeadShiftCheckNum'
|
||
exec sp_addextendedproperty 'MS_Description', N'分支机构综合检查次数', 'SCHEMA', 'dbo', 'TABLE',
|
||
'Project_HSSEData_HSSE', 'COLUMN', 'BranchComprehensiveCheckNum'
|
||
exec sp_addextendedproperty 'MS_Description', N'分支机构专项检查次数', 'SCHEMA', 'dbo', 'TABLE',
|
||
'Project_HSSEData_HSSE', 'COLUMN', 'BranchSpecialCheckNum'
|
||
END
|
||
GO
|
||
alter table dbo.HSSEData_HSSE
|
||
add QualityPersonNum int
|
||
go
|
||
|
||
exec sp_addextendedproperty 'MS_Description', N'特种作业人员数量', 'SCHEMA', 'dbo', 'TABLE', 'HSSEData_HSSE',
|
||
'COLUMN', 'QualityPersonNum'
|
||
go
|
||
|
||
alter table dbo.Project_HSSEData_HSSE
|
||
add QualityPersonNum int
|
||
go
|
||
|
||
exec sp_addextendedproperty 'MS_Description', N'特种作业人员数量', 'SCHEMA', 'dbo', 'TABLE', 'Project_HSSEData_HSSE',
|
||
'COLUMN', 'QualityPersonNum'
|
||
go
|
||
|
||
|
||
alter table dbo.CQMSData_CQMS
|
||
add UnitCheckNum int;
|
||
go
|
||
alter table dbo.CQMSData_CQMS
|
||
add UnitCheckClosedNum int;
|
||
go
|
||
alter table dbo.CQMSData_CQMS
|
||
add UnitCheckNotClosedNum int;
|
||
go
|
||
alter table dbo.CQMSData_CQMS
|
||
add BranchCheckNum int;
|
||
go
|
||
alter table dbo.CQMSData_CQMS
|
||
add BranchCheckClosedNum int;
|
||
go
|
||
alter table dbo.CQMSData_CQMS
|
||
add BranchCheckNotClosedNum int;
|
||
go
|
||
|
||
exec sp_addextendedproperty 'MS_Description', N'企业级检查项数', 'SCHEMA', 'dbo', 'TABLE', 'CQMSData_CQMS', 'COLUMN',
|
||
'UnitCheckNum'
|
||
go
|
||
|
||
exec sp_addextendedproperty 'MS_Description', N'企业级检查整改闭环项', 'SCHEMA', 'dbo', 'TABLE', 'CQMSData_CQMS',
|
||
'COLUMN', 'UnitCheckClosedNum'
|
||
go
|
||
|
||
exec sp_addextendedproperty 'MS_Description', N'企业级检查未整改完成项', 'SCHEMA', 'dbo', 'TABLE', 'CQMSData_CQMS',
|
||
'COLUMN', 'UnitCheckNotClosedNum'
|
||
go
|
||
exec sp_addextendedproperty 'MS_Description', N'分支机构检查项数', 'SCHEMA', 'dbo', 'TABLE',
|
||
'CQMSData_CQMS', 'COLUMN', 'BranchCheckNum'
|
||
go
|
||
|
||
exec sp_addextendedproperty 'MS_Description', N'分支机构检查整改闭环项', 'SCHEMA', 'dbo', 'TABLE',
|
||
'CQMSData_CQMS', 'COLUMN', 'BranchCheckClosedNum'
|
||
go
|
||
exec sp_addextendedproperty 'MS_Description', N'分支机构检查未整改完成项', 'SCHEMA', 'dbo', 'TABLE',
|
||
'CQMSData_CQMS', 'COLUMN', 'BranchCheckNotClosedNum'
|
||
go
|
||
|
||
|
||
|
||
|
||
alter table dbo.CQMSData_CQMS
|
||
add SpecialEquipmentQualityAssuranceSystemNum int;
|
||
go
|
||
|
||
exec sp_addextendedproperty 'MS_Description', N'特设质保体系数量', 'SCHEMA', 'dbo', 'TABLE', 'CQMSData_CQMS', 'COLUMN',
|
||
'SpecialEquipmentQualityAssuranceSystemNum'
|
||
go
|
||
|
||
|
||
alter table dbo.Project_CQMSData_CQMS
|
||
add SpecialEquipmentQualityAssuranceSystemNum int;
|
||
go
|
||
|
||
exec sp_addextendedproperty 'MS_Description', N'特设质保体系数量', 'SCHEMA', 'dbo', 'TABLE', 'Project_CQMSData_CQMS', 'COLUMN',
|
||
'SpecialEquipmentQualityAssuranceSystemNum'
|
||
go
|
||
|
||
|
||
alter table dbo.Solution_LargerHazard add OperativesNum int
|
||
go
|
||
|
||
exec sp_addextendedproperty 'MS_Description', N'作业人员数', 'SCHEMA', 'dbo', 'TABLE', 'Solution_LargerHazard',
|
||
'COLUMN', 'OperativesNum'
|
||
go
|
||
|
||
alter table dbo.HSSEData_HSSE add OperativesNum int
|
||
go
|
||
|
||
exec sp_addextendedproperty 'MS_Description', N'危大工程作业人员数', 'SCHEMA', 'dbo', 'TABLE', 'HSSEData_HSSE',
|
||
'COLUMN', 'OperativesNum'
|
||
go
|
||
|
||
alter table dbo.HSSEData_HSSE add SuperOperativesNum int
|
||
go
|
||
|
||
exec sp_addextendedproperty 'MS_Description', N'超危大工程作业人员数', 'SCHEMA', 'dbo', 'TABLE', 'HSSEData_HSSE',
|
||
'COLUMN', 'SuperOperativesNum'
|
||
go
|
||
|
||
|
||
|
||
|
||
alter table dbo.Project_HSSEData_HSSE add OperativesNum int
|
||
go
|
||
|
||
exec sp_addextendedproperty 'MS_Description', N'危大工程作业人员数', 'SCHEMA', 'dbo', 'TABLE', 'Project_HSSEData_HSSE',
|
||
'COLUMN', 'OperativesNum'
|
||
go
|
||
|
||
alter table dbo.Project_HSSEData_HSSE add SuperOperativesNum int
|
||
go
|
||
|
||
exec sp_addextendedproperty 'MS_Description', N'超危大工程作业人员数', 'SCHEMA', 'dbo', 'TABLE', 'Project_HSSEData_HSSE',
|
||
'COLUMN', 'SuperOperativesNum'
|
||
go
|
||
|
||
|
||
|
||
|
||
--1、隐患类型补充类别:0安全、1质量
|
||
IF NOT EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Technique_Rectify' AND COLUMN_NAME = 'RectifyType')
|
||
BEGIN
|
||
ALTER TABLE Technique_Rectify ADD RectifyType nvarchar(10);
|
||
END
|
||
GO
|
||
--2、历史数据为安全隐患类别
|
||
update Technique_Rectify set RectifyType='0';
|
||
GO
|
||
|
||
|
||
|
||
|
||
|
||
|
||
---1、统计汇总施工施工技术交底、图纸会审
|
||
|
||
alter table dbo.CQMSData_CQMS
|
||
add ComprehensiveReviewDrawingsNum int;
|
||
go
|
||
|
||
exec sp_addextendedproperty 'MS_Description', N'图纸会审数', 'SCHEMA', 'dbo', 'TABLE', 'CQMSData_CQMS', 'COLUMN',
|
||
'ComprehensiveReviewDrawingsNum'
|
||
go
|
||
alter table dbo.CQMSData_CQMS
|
||
add ComprehensiveConTechnologyDisclosureNum int;
|
||
go
|
||
|
||
exec sp_addextendedproperty 'MS_Description', N'施工技术交底数', 'SCHEMA', 'dbo', 'TABLE', 'CQMSData_CQMS', 'COLUMN',
|
||
'ComprehensiveConTechnologyDisclosureNum'
|
||
go
|
||
alter table dbo.CQMSData_CQMS
|
||
add ComprehensiveConTechnologyDisclosurePersonNum int;
|
||
go
|
||
|
||
exec sp_addextendedproperty 'MS_Description', N'施工技术交底人数', 'SCHEMA', 'dbo', 'TABLE', 'CQMSData_CQMS', 'COLUMN',
|
||
'ComprehensiveConTechnologyDisclosurePersonNum'
|
||
go
|
||
|
||
|
||
|
||
|
||
alter table dbo.Project_CQMSData_CQMS
|
||
add ComprehensiveReviewDrawingsNum int;
|
||
go
|
||
|
||
exec sp_addextendedproperty 'MS_Description', N'图纸会审数', 'SCHEMA', 'dbo', 'TABLE', 'Project_CQMSData_CQMS', 'COLUMN',
|
||
'ComprehensiveReviewDrawingsNum'
|
||
go
|
||
alter table dbo.Project_CQMSData_CQMS
|
||
add ComprehensiveConTechnologyDisclosureNum int;
|
||
go
|
||
|
||
exec sp_addextendedproperty 'MS_Description', N'施工技术交底数', 'SCHEMA', 'dbo', 'TABLE', 'Project_CQMSData_CQMS', 'COLUMN',
|
||
'ComprehensiveConTechnologyDisclosureNum'
|
||
go
|
||
alter table dbo.Project_CQMSData_CQMS
|
||
add ComprehensiveConTechnologyDisclosurePersonNum int;
|
||
go
|
||
|
||
exec sp_addextendedproperty 'MS_Description', N'施工技术交底人数', 'SCHEMA', 'dbo', 'TABLE', 'Project_CQMSData_CQMS', 'COLUMN',
|
||
'ComprehensiveConTechnologyDisclosurePersonNum'
|
||
go
|
||
|
||
|
||
--2、分支机构应急预案
|
||
|
||
alter table dbo.HSSEData_HSSE
|
||
add BranchComprehensivePlanNum int;
|
||
go
|
||
|
||
exec sp_addextendedproperty 'MS_Description', N'分支机构综合预案数', 'SCHEMA', 'dbo', 'TABLE', 'HSSEData_HSSE', 'COLUMN',
|
||
'BranchComprehensivePlanNum'
|
||
go
|
||
|
||
alter table dbo.HSSEData_HSSE
|
||
add BranchSpecialPlanNum int;
|
||
go
|
||
|
||
exec sp_addextendedproperty 'MS_Description', N'分支机构专项预案数', 'SCHEMA', 'dbo', 'TABLE', 'HSSEData_HSSE', 'COLUMN',
|
||
'BranchSpecialPlanNum'
|
||
go
|
||
|
||
alter table dbo.HSSEData_HSSE
|
||
add BranchOnSiteDisposalPlan int;
|
||
go
|
||
|
||
exec sp_addextendedproperty 'MS_Description', N'分支机构现场处置预案', 'SCHEMA', 'dbo', 'TABLE', 'HSSEData_HSSE', 'COLUMN',
|
||
'BranchOnSiteDisposalPlan'
|
||
go
|
||
|
||
|
||
alter table dbo.Project_HSSEData_HSSE
|
||
add BranchComprehensivePlanNum int;
|
||
go
|
||
|
||
exec sp_addextendedproperty 'MS_Description', N'分支机构综合预案数', 'SCHEMA', 'dbo', 'TABLE', 'Project_HSSEData_HSSE', 'COLUMN',
|
||
'BranchComprehensivePlanNum'
|
||
go
|
||
|
||
alter table dbo.Project_HSSEData_HSSE
|
||
add BranchSpecialPlanNum int;
|
||
go
|
||
|
||
exec sp_addextendedproperty 'MS_Description', N'分支机构专项预案数', 'SCHEMA', 'dbo', 'TABLE', 'Project_HSSEData_HSSE', 'COLUMN',
|
||
'BranchSpecialPlanNum'
|
||
go
|
||
|
||
alter table dbo.Project_HSSEData_HSSE
|
||
add BranchOnSiteDisposalPlan int;
|
||
go
|
||
|
||
exec sp_addextendedproperty 'MS_Description', N'分支机构现场处置预案', 'SCHEMA', 'dbo', 'TABLE', 'Project_HSSEData_HSSE', 'COLUMN',
|
||
'BranchOnSiteDisposalPlan'
|
||
go
|
||
|
||
|
||
|
||
|
||
--3、应急演练
|
||
|
||
alter table dbo.HSSEData_HSSE
|
||
add BranchDrillNum int;
|
||
go
|
||
|
||
exec sp_addextendedproperty 'MS_Description', N'分支机构应急演练数', 'SCHEMA', 'dbo', 'TABLE', 'HSSEData_HSSE', 'COLUMN',
|
||
'BranchDrillNum'
|
||
go
|
||
|
||
alter table dbo.HSSEData_HSSE
|
||
add BranchDrillPersonNum int;
|
||
go
|
||
|
||
exec sp_addextendedproperty 'MS_Description', N'分支机构应急演练人次', 'SCHEMA', 'dbo', 'TABLE', 'HSSEData_HSSE', 'COLUMN',
|
||
'BranchDrillPersonNum'
|
||
go
|
||
|
||
|
||
alter table dbo.Project_HSSEData_HSSE
|
||
add BranchDrillNum int;
|
||
go
|
||
|
||
exec sp_addextendedproperty 'MS_Description', N'分支机构应急演练数', 'SCHEMA', 'dbo', 'TABLE', 'Project_HSSEData_HSSE', 'COLUMN',
|
||
'BranchDrillNum'
|
||
go
|
||
|
||
alter table dbo.Project_HSSEData_HSSE
|
||
add BranchDrillPersonNum int;
|
||
go
|
||
|
||
exec sp_addextendedproperty 'MS_Description', N'分支机构应急演练人次', 'SCHEMA', 'dbo', 'TABLE', 'Project_HSSEData_HSSE', 'COLUMN',
|
||
'BranchDrillPersonNum'
|
||
go
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
alter table dbo.HSSEData_HSSE
|
||
add ProjectSubFullTimeNum int
|
||
go
|
||
|
||
exec sp_addextendedproperty 'MS_Description', N'项目分包专职人员', 'SCHEMA', 'dbo', 'TABLE', 'HSSEData_HSSE', 'COLUMN',
|
||
'ProjectSubFullTimeNum'
|
||
go
|
||
alter table dbo.Project_HSSEData_HSSE
|
||
add ProjectSubFullTimeNum int
|
||
go
|
||
|
||
exec sp_addextendedproperty 'MS_Description', N'项目分包专职人员', 'SCHEMA', 'dbo', 'TABLE', 'Project_HSSEData_HSSE', 'COLUMN',
|
||
'ProjectSubFullTimeNum'
|
||
go
|
||
|
||
alter table dbo.CQMSData_CQMS
|
||
add ProjectSubPersonNum int
|
||
go
|
||
|
||
exec sp_addextendedproperty 'MS_Description', N'项目部分包人员', 'SCHEMA', 'dbo', 'TABLE', 'CQMSData_CQMS', 'COLUMN',
|
||
'ProjectSubPersonNum'
|
||
go
|
||
alter table dbo.Project_CQMSData_CQMS
|
||
add ProjectSubPersonNum int
|
||
go
|
||
|
||
exec sp_addextendedproperty 'MS_Description', N'项目部分包人员', 'SCHEMA', 'dbo', 'TABLE', 'Project_CQMSData_CQMS', 'COLUMN',
|
||
'ProjectSubPersonNum'
|
||
go
|
||
|
||
|
||
|
||
|
||
|
||
CREATE TABLE [dbo].[QCManage_QCGroupRegistration](
|
||
[QCGroupRegistrationId] [nvarchar](50) NOT NULL,
|
||
[ProjectId] [nvarchar](50) NULL,
|
||
[Code] [nvarchar](100) NULL,
|
||
[Name] [nvarchar](200) NULL,
|
||
[CompileMan] [nvarchar](50) NULL,
|
||
[CompileDate] [datetime] NULL,
|
||
CONSTRAINT [PK_QCManage_QCGroupRegistration] PRIMARY KEY CLUSTERED
|
||
(
|
||
[QCGroupRegistrationId] 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'主键' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'QCManage_QCGroupRegistration', @level2type=N'COLUMN',@level2name=N'QCGroupRegistrationId'
|
||
GO
|
||
|
||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'项目id' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'QCManage_QCGroupRegistration', @level2type=N'COLUMN',@level2name=N'ProjectId'
|
||
GO
|
||
|
||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'编号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'QCManage_QCGroupRegistration', @level2type=N'COLUMN',@level2name=N'Code'
|
||
GO
|
||
|
||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'名称' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'QCManage_QCGroupRegistration', @level2type=N'COLUMN',@level2name=N'Name'
|
||
GO
|
||
|
||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'编制人' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'QCManage_QCGroupRegistration', @level2type=N'COLUMN',@level2name=N'CompileMan'
|
||
GO
|
||
|
||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'编制时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'QCManage_QCGroupRegistration', @level2type=N'COLUMN',@level2name=N'CompileDate'
|
||
GO
|
||
|
||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'QC管理-QC小组注册表' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'QCManage_QCGroupRegistration'
|
||
GO
|
||
|
||
|
||
alter table dbo.QCManage_QCGroupRegistration add AwardType nvarchar(2) COLLATE Chinese_PRC_CI_AS NULL
|
||
go
|
||
exec sp_addextendedproperty 'MS_Description', N'获奖类型', 'SCHEMA', 'dbo', 'TABLE', 'QCManage_QCGroupRegistration',
|
||
'COLUMN', 'AwardType'
|
||
go
|
||
|
||
|
||
alter table dbo.QCManage_QCGroupRegistration add IsUpdate bit
|
||
go
|
||
|
||
|
||
alter table QCManage_QCGroupRegistration add UnitId nvarchar(50)
|
||
alter table QCManage_QCGroupRegistration add Subjects nvarchar(200)
|
||
alter table QCManage_QCGroupRegistration add Process nvarchar(500)
|
||
alter table QCManage_QCGroupRegistration add Achievement nvarchar(200)
|
||
alter table QCManage_QCGroupRegistration add AwardName nvarchar(100)
|
||
alter table QCManage_QCGroupRegistration add AwardLevel nvarchar(50)
|
||
alter table QCManage_QCGroupRegistration add AwardingUnit nvarchar(200)
|
||
go
|
||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'所属公司' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'QCManage_QCGroupRegistration', @level2type=N'COLUMN',@level2name=N'UnitId'
|
||
GO
|
||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'课题' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'QCManage_QCGroupRegistration', @level2type=N'COLUMN',@level2name=N'Subjects'
|
||
GO
|
||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'过程' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'QCManage_QCGroupRegistration', @level2type=N'COLUMN',@level2name=N'Process'
|
||
GO
|
||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'成果' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'QCManage_QCGroupRegistration', @level2type=N'COLUMN',@level2name=N'Achievement'
|
||
GO
|
||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'获奖名称' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'QCManage_QCGroupRegistration', @level2type=N'COLUMN',@level2name=N'AwardName'
|
||
GO
|
||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'获奖等级(1-国家、2-省部、3-企业)' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'QCManage_QCGroupRegistration', @level2type=N'COLUMN',@level2name=N'AwardLevel'
|
||
GO
|
||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'颁奖单位' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'QCManage_QCGroupRegistration', @level2type=N'COLUMN',@level2name=N'AwardingUnit'
|
||
GO
|
||
|
||
|
||
|
||
|
||
alter table Project_CQMSData_CQMS add InspectionMachineNum int
|
||
alter table Project_CQMSData_CQMS add InspectionMachineQualifiedNum int
|
||
alter table CQMSData_CQMS add InspectionMachineNum int
|
||
alter table CQMSData_CQMS add InspectionMachineQualifiedNum int
|
||
go
|
||
|
||
|
||
--update Comprehensive_InspectionMachine set sType='机具'
|
||
--go
|
||
|
||
|
||
CREATE TABLE [dbo].[Comprehensive_QualityAssurance](
|
||
[QualityAssuranceId] [nvarchar](50) NOT NULL,
|
||
[ProjectId] [nvarchar](50) NULL,
|
||
[QualityAssuranceCode] [nvarchar](50) NULL,
|
||
[QualityAssuranceName] [nvarchar](100) NULL,
|
||
[QualityAssuranceType] [nvarchar](50) NULL,
|
||
[ContentTexts] [nvarchar](max) NULL,
|
||
[CompileMan] [nvarchar](50) NULL,
|
||
[CompileDate] [datetime] NULL,
|
||
CONSTRAINT [PK_Comprehensive_QualityAssurance] PRIMARY KEY CLUSTERED
|
||
(
|
||
[QualityAssuranceId] ASC
|
||
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON ) ON [PRIMARY]
|
||
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
||
GO
|
||
|
||
ALTER TABLE [dbo].[Comprehensive_QualityAssurance] WITH CHECK ADD CONSTRAINT [FK_Comprehensive_QualityAssurance_Base_Project] FOREIGN KEY([ProjectId])
|
||
REFERENCES [dbo].[Base_Project] ([ProjectId])
|
||
GO
|
||
|
||
ALTER TABLE [dbo].[Comprehensive_QualityAssurance] CHECK CONSTRAINT [FK_Comprehensive_QualityAssurance_Base_Project]
|
||
GO
|
||
|
||
ALTER TABLE [dbo].[Comprehensive_QualityAssurance] WITH CHECK ADD CONSTRAINT [FK_Comprehensive_QualityAssurance_Sys_User] FOREIGN KEY([CompileMan])
|
||
REFERENCES [dbo].[Sys_User] ([UserId])
|
||
GO
|
||
|
||
ALTER TABLE [dbo].[Comprehensive_QualityAssurance] CHECK CONSTRAINT [FK_Comprehensive_QualityAssurance_Sys_User]
|
||
GO
|
||
|
||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'主键' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Comprehensive_QualityAssurance', @level2type=N'COLUMN',@level2name=N'QualityAssuranceId'
|
||
GO
|
||
|
||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'项目Id' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Comprehensive_QualityAssurance', @level2type=N'COLUMN',@level2name=N'ProjectId'
|
||
GO
|
||
|
||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'编号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Comprehensive_QualityAssurance', @level2type=N'COLUMN',@level2name=N'QualityAssuranceCode'
|
||
GO
|
||
|
||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'名称' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Comprehensive_QualityAssurance', @level2type=N'COLUMN',@level2name=N'QualityAssuranceName'
|
||
GO
|
||
|
||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'类型(压力管道安装、压力容器制造、压力容器安装、锅炉安装、起重机械安装、电梯安装)' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Comprehensive_QualityAssurance', @level2type=N'COLUMN',@level2name=N'QualityAssuranceType'
|
||
GO
|
||
|
||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'文档内容' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Comprehensive_QualityAssurance', @level2type=N'COLUMN',@level2name=N'ContentTexts'
|
||
GO
|
||
|
||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'整理人' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Comprehensive_QualityAssurance', @level2type=N'COLUMN',@level2name=N'CompileMan'
|
||
GO
|
||
|
||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'整理时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Comprehensive_QualityAssurance', @level2type=N'COLUMN',@level2name=N'CompileDate'
|
||
GO
|
||
|
||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'特设质保体系表' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Comprehensive_QualityAssurance'
|
||
GO
|
||
|
||
|
||
GO
|
||
|
||
|
||
|
||
ALTER VIEW [dbo].[View_Hazard_HazardRegister]
|
||
AS
|
||
SELECT Registration.HazardRegisterId,
|
||
Registration.HazardCode,
|
||
Registration.RegisterDate,
|
||
Registration.RegisterDef,
|
||
Registration.Rectification,
|
||
Registration.Place,
|
||
Registration.ResponsibleUnit,
|
||
Registration.Observer,
|
||
Registration.Risk_Level,
|
||
Registration.RectifiedDate,
|
||
Registration.ProjectId,
|
||
Project.UnitId AS PUnitId,
|
||
Project.ProjectState as ProjectState,
|
||
Project.isDelete as isDelete,
|
||
ProjectUnit.UnitName AS PUnitName,
|
||
ProjectUnit.IsBranch as IsBranch,
|
||
Project.ProjectAddress,
|
||
Registration.states,
|
||
Registration.IsEffective,
|
||
Registration.ResponsibleMan,
|
||
Registration.CheckManId,
|
||
Registration.CheckTime,
|
||
Registration.RectificationPeriod,
|
||
Registration.ImageUrl,
|
||
Registration.RectificationImageUrl,
|
||
Registration.RectificationTime,
|
||
Registration.ConfirmMan,
|
||
Registration.ConfirmDate,
|
||
Registration.HandleIdea,
|
||
Registration.CutPayment,
|
||
Registration.ProblemTypes,
|
||
Registration.CheckSpecialId,
|
||
Registration.CheckItemDetailId,
|
||
Registration.SupCheckItemSetId,
|
||
Registration.CheckItemSetId,
|
||
Registration.SafeSupervisionId,
|
||
Registration.SafeSupervisionIsOK,
|
||
Registration.IsUpdate,
|
||
Project.ProjectName,
|
||
Registration.CheckCycle,
|
||
ISNULL(WorkArea.UnitWorkName,'') AS WorkAreaName,
|
||
Unit.UnitName as ResponsibilityUnitName,
|
||
Unit.CollCropCode as ResponsibilityUnitCollCropCode,
|
||
User1.UserName AS ResponsibilityManName,
|
||
ISNULL(User1.Telephone,'') AS ResponsibilityManTel,
|
||
User2.UserName AS CheckManName,
|
||
ISNULL(User2.Telephone,'') AS CheckManTel,
|
||
User2.UnitId AS SendUnitId,
|
||
User3.UserName AS ConfirmManName,
|
||
ISNULL(User3.Telephone,'') AS ConfirmManTel,
|
||
User4.UserName AS ResponsibilityManName2,
|
||
ISNULL(User4.Telephone,'') AS ResponsibilityMan2Tel,
|
||
(CASE WHEN Registration.states='1' and (Registration.SafeSupervisionIsOK is null OR Registration.SafeSupervisionIsOK=0) THEN '待整改'
|
||
WHEN Registration.states='1' and Registration.SafeSupervisionIsOK=1 THEN '合格'
|
||
WHEN Registration.states='2' THEN '已整改-待复查验收'
|
||
WHEN Registration.states='3' THEN '已闭环'
|
||
ELSE '已作废' END ) AS StatesStr,
|
||
(CASE WHEN Registration.states='3' THEN '已整改' ELSE '未整改' END ) AS ConfirmStr,
|
||
RegisterTypes.RegisterTypesId,
|
||
RegisterTypes.RegisterTypesName,
|
||
Registration.DIC_ID,
|
||
Registration.CCManIds,
|
||
CCManNames = STUFF(( SELECT ',' + UserName FROM Sys_User
|
||
where PATINDEX('%,' + RTRIM(Sys_User.UserId) + ',%',',' + Registration.CCManIds + ',')>0
|
||
ORDER BY PATINDEX('%,' + RTRIM(Registration.CCManIds) + ',%',',' + Registration.CCManIds + ',')
|
||
FOR XML PATH('')), 1, 1,''),
|
||
Registration.Requirements,
|
||
Registration.Type,
|
||
Registration.HiddenType
|
||
FROM dbo.HSSE_Hazard_HazardRegister AS Registration
|
||
LEFT JOIN dbo.Base_Project AS Project ON Project.ProjectId = Registration.ProjectId
|
||
LEFT JOIN dbo.Base_Unit AS ProjectUnit ON Project.UnitId = ProjectUnit.UnitId
|
||
LEFT JOIN dbo.WBS_UnitWork AS WorkArea ON WorkArea.UnitWorkId = Registration.Place
|
||
LEFT JOIN dbo.HSSE_Hazard_HazardRegisterTypes AS RegisterTypes ON RegisterTypes.RegisterTypesId = Registration.RegisterTypesId
|
||
LEFT JOIN dbo.Base_Unit AS Unit ON Unit.UnitId = Registration.ResponsibleUnit
|
||
LEFT JOIN dbo.Sys_User AS User1 ON User1.UserId = Registration.ResponsibleMan
|
||
LEFT JOIN dbo.Sys_User AS User2 ON User2.UserId = Registration.CheckManId
|
||
LEFT JOIN dbo.Sys_User AS User3 ON User3.UserId = Registration.ConfirmMan
|
||
LEFT JOIN dbo.Sys_User AS User4 ON User4.UserId = Registration.ResponsibleMan2
|
||
|
||
|
||
GO
|
||
|
||
|
||
|
||
GO
|
||
|
||
|
||
|
||
ALTER VIEW [dbo].[View_License_LicenseManager]
|
||
AS
|
||
/*现场安全许可证*/
|
||
SELECT LicenseManager.LicenseManagerId,
|
||
LicenseManager.ProjectId,
|
||
LicenseManager.LicenseTypeId,
|
||
LicenseManager.LicenseManagerCode,
|
||
LicenseManager.LicenseManageName,
|
||
LicenseManager.UnitId,
|
||
LicenseManager.LicenseManageContents,
|
||
LicenseManager.CompileMan,
|
||
LicenseManager.CompileDate,
|
||
LicenseManager.States,
|
||
Project.ProjectCode,
|
||
Project.ProjectName,
|
||
LicenseType.LicenseTypeName,
|
||
Unit.UnitName,
|
||
UnitType.UnitTypeId,
|
||
UnitType.UnitTypeName,
|
||
Users.UserName,
|
||
LicenseManager.WorkAreaId,
|
||
--WorkArea.WorkAreaName,
|
||
LicenseManager.StartDate,
|
||
LicenseManager.EndDate,
|
||
LicenseManager.ApplicantMan,
|
||
LicenseManager.IsHighRisk,
|
||
LicenseManager.WorkStates,
|
||
LicenseManager.IsUpdate,
|
||
case LicenseManager.WorkStates when '1' then '待开工'
|
||
when '2' then '作业中'
|
||
when '3' then '已关闭'
|
||
when '-1' then '已取消'
|
||
else '' end as WorkStatesStr,
|
||
WorkAreaName = STUFF(( SELECT ',' + UnitWorkName FROM WBS_UnitWork
|
||
where PATINDEX('%,' + RTRIM(WBS_UnitWork.UnitWorkId) + ',%',',' + LicenseManager.WorkAreaId + ',')>0
|
||
ORDER BY PATINDEX('%,' + RTRIM(LicenseManager.WorkAreaId) + ',%',',' + LicenseManager.WorkAreaId + ',')
|
||
FOR XML PATH('')), 1, 1,'')
|
||
FROM dbo.License_LicenseManager AS LicenseManager
|
||
LEFT JOIN dbo.Base_Project AS Project ON Project.ProjectId = LicenseManager.ProjectId
|
||
LEFT JOIN dbo.Base_LicenseType AS LicenseType ON LicenseType.LicenseTypeId = LicenseManager.LicenseTypeId
|
||
LEFT JOIN dbo.Base_Unit AS Unit ON Unit.UnitId = LicenseManager.UnitId
|
||
LEFT JOIN dbo.Sys_User AS Users ON Users.UserId = LicenseManager.CompileMan
|
||
LEFT JOIN dbo.WBS_UnitWork AS WorkArea ON WorkArea.UnitWorkId = LicenseManager.WorkAreaId
|
||
LEFT JOIN dbo.Base_UnitType as UnitType ON UnitType.UnitTypeId=Unit.UnitTypeId
|
||
|
||
|
||
|
||
GO
|
||
|
||
|