UPDATE [dbo].[Sys_Menu] SET  [IsUsed] = '0' WHERE CONVERT(NVARCHAR(MAX), [MenuId]) = N'C502FC6D-DE43-4646-AE28-168D8C7BF4C0';
UPDATE [dbo].[Sys_Menu] SET  [IsUsed] = '0' WHERE CONVERT(NVARCHAR(MAX), [MenuId]) = N'6090DD54-FE59-4011-92EE-9906C9BC69B6';
UPDATE [dbo].[Sys_Menu] SET  [IsUsed] = '0' WHERE CONVERT(NVARCHAR(MAX), [MenuId]) = N'DEE90726-E00D-462B-A4BF-7E36180DD5B8';


INSERT INTO [dbo].[Sys_Menu] ([MenuId], [MenuName], [Icon], [Url], [SortIndex], [SuperMenu], [MenuType], [IsOffice], [IsEnd], [IsUsed], [MenuEnName]) 
VALUES (N'CAAD533A-D199-4CFB-BCC1-980FBE1085EC', N'安全专检', NULL, N'OfficeCheck/Inspect/SafetyInspection.aspx', 40, N'0', N'Menu_Server', '1', '1', '1', NULL);

INSERT INTO [dbo].[Sys_ButtonToMenu] ([ButtonToMenuId], [MenuId], [ButtonName], [SortIndex]) 
VALUES (NEWID(), N'CAAD533A-D199-4CFB-BCC1-980FBE1085EC', N'增加', 1);
INSERT INTO [dbo].[Sys_ButtonToMenu] ([ButtonToMenuId], [MenuId], [ButtonName], [SortIndex]) 
VALUES (NEWID(), N'CAAD533A-D199-4CFB-BCC1-980FBE1085EC', N'修改', 2);
INSERT INTO [dbo].[Sys_ButtonToMenu] ([ButtonToMenuId], [MenuId], [ButtonName], [SortIndex])
VALUES (NEWID(), N'CAAD533A-D199-4CFB-BCC1-980FBE1085EC', N'删除', 3);
INSERT INTO [dbo].[Sys_ButtonToMenu] ([ButtonToMenuId], [MenuId], [ButtonName], [SortIndex]) 
VALUES (NEWID(), N'CAAD533A-D199-4CFB-BCC1-980FBE1085EC', N'保存', 4);



INSERT INTO [dbo].[Sys_Menu] ([MenuId], [MenuName], [Icon], [Url], [SortIndex], [SuperMenu], [MenuType], [IsOffice], [IsEnd], [IsUsed], [MenuEnName]) 
VALUES (N'BDCCE638-E9EF-421D-B09B-699F02A4462C', N'质量专检', NULL, N'OfficeCheck/Inspect/QualityInspection.aspx', 50, N'0', N'Menu_Server', '1', '1', '1', NULL);

INSERT INTO [dbo].[Sys_ButtonToMenu] ([ButtonToMenuId], [MenuId], [ButtonName], [SortIndex]) 
VALUES (NEWID(), N'BDCCE638-E9EF-421D-B09B-699F02A4462C', N'增加', 1);
INSERT INTO [dbo].[Sys_ButtonToMenu] ([ButtonToMenuId], [MenuId], [ButtonName], [SortIndex]) 
VALUES (NEWID(), N'BDCCE638-E9EF-421D-B09B-699F02A4462C', N'修改', 2);
INSERT INTO [dbo].[Sys_ButtonToMenu] ([ButtonToMenuId], [MenuId], [ButtonName], [SortIndex])
VALUES (NEWID(), N'BDCCE638-E9EF-421D-B09B-699F02A4462C', N'删除', 3);
INSERT INTO [dbo].[Sys_ButtonToMenu] ([ButtonToMenuId], [MenuId], [ButtonName], [SortIndex]) 
VALUES (NEWID(), N'BDCCE638-E9EF-421D-B09B-699F02A4462C', N'保存', 4);

INSERT INTO [dbo].[Sys_Menu] ([MenuId], [MenuName], [Icon], [Url], [SortIndex], [SuperMenu], [MenuType], [IsOffice], [IsEnd], [IsUsed], [MenuEnName]) 
VALUES (N'0DAAF731-D058-41E9-9C8A-0647DF82E0D0', N'安全专检', NULL, N'OfficeCheck/Inspect/ProjectSafetyInspection.aspx', 140, N'467A0CB9-737D-4451-965E-869EBC3A4BD6', N'Menu_HSSE', '1', '1', '1', NULL);

INSERT INTO [dbo].[Sys_ButtonToMenu] ([ButtonToMenuId], [MenuId], [ButtonName], [SortIndex]) 
VALUES (NEWID(), N'0DAAF731-D058-41E9-9C8A-0647DF82E0D0', N'增加', 1);
INSERT INTO [dbo].[Sys_ButtonToMenu] ([ButtonToMenuId], [MenuId], [ButtonName], [SortIndex]) 
VALUES (NEWID(), N'0DAAF731-D058-41E9-9C8A-0647DF82E0D0', N'修改', 2);
INSERT INTO [dbo].[Sys_ButtonToMenu] ([ButtonToMenuId], [MenuId], [ButtonName], [SortIndex])
VALUES (NEWID(), N'0DAAF731-D058-41E9-9C8A-0647DF82E0D0', N'删除', 3);
INSERT INTO [dbo].[Sys_ButtonToMenu] ([ButtonToMenuId], [MenuId], [ButtonName], [SortIndex]) 
VALUES (NEWID(), N'0DAAF731-D058-41E9-9C8A-0647DF82E0D0', N'保存', 4);


INSERT INTO [dbo].[Sys_Menu] ([MenuId], [MenuName], [Icon], [Url], [SortIndex], [SuperMenu], [MenuType], [IsOffice], [IsEnd], [IsUsed], [MenuEnName]) 
VALUES (N'66A8D852-A542-47C7-B474-C0EEA73AC58E', N'质量专检', NULL, N'OfficeCheck/Inspect/ProjectQualityInspection.aspx', 40, N'A54EC449-5F77-4068-83B9-AA305B721A0B', N'Menu_CQMS', '1', '1', '1', NULL);

INSERT INTO [dbo].[Sys_ButtonToMenu] ([ButtonToMenuId], [MenuId], [ButtonName], [SortIndex]) 
VALUES (NEWID(), N'66A8D852-A542-47C7-B474-C0EEA73AC58E', N'增加', 1);
INSERT INTO [dbo].[Sys_ButtonToMenu] ([ButtonToMenuId], [MenuId], [ButtonName], [SortIndex]) 
VALUES (NEWID(), N'66A8D852-A542-47C7-B474-C0EEA73AC58E', N'修改', 2);
INSERT INTO [dbo].[Sys_ButtonToMenu] ([ButtonToMenuId], [MenuId], [ButtonName], [SortIndex])
VALUES (NEWID(), N'66A8D852-A542-47C7-B474-C0EEA73AC58E', N'删除', 3);
INSERT INTO [dbo].[Sys_ButtonToMenu] ([ButtonToMenuId], [MenuId], [ButtonName], [SortIndex]) 
VALUES (NEWID(), N'66A8D852-A542-47C7-B474-C0EEA73AC58E', N'保存', 4);



CREATE TABLE [dbo].[Inspect_Inspection] (
  [InspectionId] nvarchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [InspectionCode] nvarchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [ProjectId] nvarchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [PersonResponsible] nvarchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [InspectTime] datetime  NULL,
  [Description] nvarchar(2000) COLLATE Chinese_PRC_CI_AS  NULL,
  [States] char(1) COLLATE Chinese_PRC_CI_AS  NULL,
  [InspectMan] nvarchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [InspectType] char(1) COLLATE Chinese_PRC_CI_AS  NULL,
  [InspectItemSetId] nvarchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [ProjectStates] char(1) COLLATE Chinese_PRC_CI_AS  NULL,
  [CreateMan] nvarchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [CreateTime] datetime  NULL,
  CONSTRAINT [PK_Inspect_Inspection_1] PRIMARY KEY CLUSTERED ([InspectionId])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY],

  CONSTRAINT [FK_Inspect_Inspection_Base_Project] FOREIGN KEY ([ProjectId]) REFERENCES [dbo].[Base_Project] ([ProjectId]) ON DELETE NO ACTION ON UPDATE NO ACTION
)  
ON [PRIMARY]
GO

ALTER TABLE [dbo].[Inspect_Inspection] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'专检编号',
'SCHEMA', N'dbo',
'TABLE', N'Inspect_Inspection',
'COLUMN', N'InspectionCode'
GO

EXEC sp_addextendedproperty
'MS_Description', N'项目',
'SCHEMA', N'dbo',
'TABLE', N'Inspect_Inspection',
'COLUMN', N'ProjectId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'项目责任人',
'SCHEMA', N'dbo',
'TABLE', N'Inspect_Inspection',
'COLUMN', N'PersonResponsible'
GO

EXEC sp_addextendedproperty
'MS_Description', N'检查时间',
'SCHEMA', N'dbo',
'TABLE', N'Inspect_Inspection',
'COLUMN', N'InspectTime'
GO

EXEC sp_addextendedproperty
'MS_Description', N'检查人',
'SCHEMA', N'dbo',
'TABLE', N'Inspect_Inspection',
'COLUMN', N'InspectMan'
GO
  

EXEC sp_addextendedproperty
'MS_Description', N'描述',
'SCHEMA', N'dbo',
'TABLE', N'Inspect_Inspection',
'COLUMN', N'Description'
GO

EXEC sp_addextendedproperty
'MS_Description', N'检查类型(1安全;2质量)',
'SCHEMA', N'dbo',
'TABLE', N'Inspect_Inspection',
'COLUMN', N'InspectType'
GO


EXEC sp_addextendedproperty
'MS_Description', N'(安全/质量)专检表',
'SCHEMA', N'dbo',
'TABLE', N'Inspect_Inspection'




CREATE TABLE [dbo].[Inspect_InspectionItem] (
  [InspectionItemId] nvarchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [InspectionId] nvarchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [InspectionItemCode] nvarchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [ProjectId] nvarchar(50) COLLATE Chinese_PRC_CI_AS  NULL,	
  [InspectionDescribe] nvarchar(1000) COLLATE Chinese_PRC_CI_AS  NULL,
  [PhotoUrl] nvarchar(1000) COLLATE Chinese_PRC_CI_AS  NULL,
  [VideoUrl] nvarchar(1000) COLLATE Chinese_PRC_CI_AS  NULL,
  [EvaluateResults] nvarchar(20) COLLATE Chinese_PRC_CI_AS  NULL,
  [TimeLimited] datetime  NULL,
  [RectificationDescription] nvarchar(1000) COLLATE Chinese_PRC_CI_AS  NULL,
  [RectificationResults] nvarchar(20) COLLATE Chinese_PRC_CI_AS  NULL,
  [States] char(1) COLLATE Chinese_PRC_CI_AS  NULL,
  [CompileMan] nvarchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [CompileTime] datetime  NULL,
  [RectificationPhotoUrl] nvarchar(1000) COLLATE Chinese_PRC_CI_AS  NULL,
  CONSTRAINT [PK_Inspect_InspectionItem_1] PRIMARY KEY CLUSTERED ([InspectionItemId])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY],

CONSTRAINT [FK_Inspect_InspectionItem_Base_Project] FOREIGN KEY ([ProjectId]) REFERENCES [dbo].[Base_Project] ([ProjectId]) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT [FK_Inspect_InspectionItem_Inspect_Inspection] FOREIGN KEY ([InspectionId]) REFERENCES [dbo].[Inspect_Inspection] ([InspectionId]) ON DELETE NO ACTION ON UPDATE NO ACTION
)  
ON [PRIMARY]
GO

ALTER TABLE [dbo].[Inspect_InspectionItem] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'专项表id',
'SCHEMA', N'dbo',
'TABLE', N'Inspect_InspectionItem',
'COLUMN', N'InspectionId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'项目',
'SCHEMA', N'dbo',
'TABLE', N'Inspect_InspectionItem',
'COLUMN', N'ProjectId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'检查项',
'SCHEMA', N'dbo',
'TABLE', N'Inspect_InspectionItem',
'COLUMN', N'InspectionDescribe'
GO

EXEC sp_addextendedproperty
'MS_Description', N'图片',
'SCHEMA', N'dbo',
'TABLE', N'Inspect_InspectionItem',
'COLUMN', N'PhotoUrl'
GO

EXEC sp_addextendedproperty
'MS_Description', N'视频',
'SCHEMA', N'dbo',
'TABLE', N'Inspect_InspectionItem',
'COLUMN', N'VideoUrl'
GO
  

EXEC sp_addextendedproperty
'MS_Description', N'评价结果(合格/不合格)',
'SCHEMA', N'dbo',
'TABLE', N'Inspect_InspectionItem',
'COLUMN', N'EvaluateResults'
GO

EXEC sp_addextendedproperty
'MS_Description', N'限时时间',
'SCHEMA', N'dbo',
'TABLE', N'Inspect_InspectionItem',
'COLUMN', N'TimeLimited'
GO

EXEC sp_addextendedproperty
'MS_Description', N'整改描述',
'SCHEMA', N'dbo',
'TABLE', N'Inspect_InspectionItem',
'COLUMN', N'RectificationDescription'
GO

EXEC sp_addextendedproperty
'MS_Description', N'整改结果',
'SCHEMA', N'dbo',
'TABLE', N'Inspect_InspectionItem',
'COLUMN', N'RectificationResults'
GO

EXEC sp_addextendedproperty
'MS_Description', N'状态',
'SCHEMA', N'dbo',
'TABLE', N'Inspect_InspectionItem',
'COLUMN', N'States'
GO


EXEC sp_addextendedproperty
'MS_Description', N'(安全/质量)专检明细表',
'SCHEMA', N'dbo',
'TABLE', N'Inspect_InspectionItem'


