xinjiang/DataBase/版本日志/SGGLDB_V2023-06-16-001.sql

275 lines
14 KiB
Transact-SQL

--人员管理
INSERT INTO dbo.Sys_Menu(MenuId,MenuName,Url,SortIndex,SuperMenu,MenuType,IsOffice,IsEnd,IsUsed)
VALUES('175FAEE8-F6B3-483D-839B-001AF4B45D0A','人员管理','',15,'0','Menu_ZHGL',1,0,1)
GO
INSERT INTO dbo.Sys_Menu(MenuId,MenuName,Url,SortIndex,SuperMenu,MenuType,IsOffice,IsEnd,IsUsed)
VALUES('8E229597-B2D8-407B-8192-787E65E5052E','企业总部人员','ZHGL/Person/CompanyPerson.aspx',10,'175FAEE8-F6B3-483D-839B-001AF4B45D0A','Menu_ZHGL',1,1,1)
GO
INSERT INTO dbo.Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex)
VALUES('BC370144-AA46-4AD3-B26C-DF3E995388C4','8E229597-B2D8-407B-8192-787E65E5052E','增加',1)
INSERT INTO dbo.Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex)
VALUES('62AC6438-952A-49BE-81BA-580F7C060E33','8E229597-B2D8-407B-8192-787E65E5052E','修改',2)
INSERT INTO dbo.Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex)
VALUES('9B133AF0-CA02-4383-9AB8-9B13BC6A84CE','8E229597-B2D8-407B-8192-787E65E5052E','删除',3)
INSERT INTO dbo.Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex)
VALUES('A8EA6A33-090C-4D92-9CFB-225ED38FAE93','8E229597-B2D8-407B-8192-787E65E5052E','保存',4)
GO
INSERT INTO dbo.Sys_Menu(MenuId,MenuName,Url,SortIndex,SuperMenu,MenuType,IsOffice,IsEnd,IsUsed)
VALUES('FE342650-9E64-4B9C-8023-34399E198B6F','分支机构人员','ZHGL/Person/BranchPerson.aspx',20,'175FAEE8-F6B3-483D-839B-001AF4B45D0A','Menu_ZHGL',1,1,1)
GO
INSERT INTO dbo.Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex)
VALUES('CB3CDFC7-1B77-4948-A431-683D197E5684','FE342650-9E64-4B9C-8023-34399E198B6F','增加',1)
INSERT INTO dbo.Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex)
VALUES('232A054B-E244-4412-852B-670AA5F6CC24','FE342650-9E64-4B9C-8023-34399E198B6F','修改',2)
INSERT INTO dbo.Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex)
VALUES('C29706B8-8092-4733-83C6-811F5F195EC9','FE342650-9E64-4B9C-8023-34399E198B6F','删除',3)
INSERT INTO dbo.Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex)
VALUES('D4A95692-847A-41C6-97EF-B36E04AFB335','FE342650-9E64-4B9C-8023-34399E198B6F','保存',4)
GO
INSERT INTO dbo.Sys_Menu(MenuId,MenuName,Url,SortIndex,SuperMenu,MenuType,IsOffice,IsEnd,IsUsed)
VALUES('D2C91885-974A-448A-9BA5-0EEAE8FA98CA','项目现场人员','ZHGL/Person/ProjectPerson.aspx',30,'175FAEE8-F6B3-483D-839B-001AF4B45D0A','Menu_ZHGL',1,1,1)
GO
INSERT INTO dbo.Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex)
VALUES('13369C09-3301-4BA8-B0DC-7BC2B41981C9','D2C91885-974A-448A-9BA5-0EEAE8FA98CA','增加',1)
INSERT INTO dbo.Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex)
VALUES('16DD0C20-AAB5-46C3-A927-B0A159B39706','D2C91885-974A-448A-9BA5-0EEAE8FA98CA','修改',2)
INSERT INTO dbo.Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex)
VALUES('F19E234F-D938-45BD-8C32-8F7F8C35BD07','D2C91885-974A-448A-9BA5-0EEAE8FA98CA','删除',3)
INSERT INTO dbo.Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex)
VALUES('4E93A42D-BEAB-4991-8396-0A6E51BF1AF1','D2C91885-974A-448A-9BA5-0EEAE8FA98CA','保存',4)
GO
--安全会议
INSERT INTO dbo.Sys_Menu(MenuId,MenuName,Url,SortIndex,SuperMenu,MenuType,IsOffice,IsEnd,IsUsed)
VALUES('BFFBE172-7473-486E-9833-49F13B359C6C','安全会议','',60,'0','Menu_ZHGL',1,0,1)
GO
INSERT INTO dbo.Sys_Menu(MenuId,MenuName,Url,SortIndex,SuperMenu,MenuType,IsOffice,IsEnd,IsUsed)
VALUES('B911B4F8-DDFD-4F37-9EAC-EB104F753432','企业安委会','ZHGL/Meeting/CompanySafetyMeeting.aspx',10,'BFFBE172-7473-486E-9833-49F13B359C6C','Menu_ZHGL',1,1,1)
GO
INSERT INTO dbo.Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex)
VALUES('27DD0084-A559-4723-90B9-5F68DF3B61C4','B911B4F8-DDFD-4F37-9EAC-EB104F753432','增加',1)
INSERT INTO dbo.Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex)
VALUES('1F841CFB-1AFC-4C9C-A56F-681E407B52F9','B911B4F8-DDFD-4F37-9EAC-EB104F753432','修改',2)
INSERT INTO dbo.Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex)
VALUES('60142F0A-3362-4264-876C-F27FFB533891','B911B4F8-DDFD-4F37-9EAC-EB104F753432','删除',3)
INSERT INTO dbo.Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex)
VALUES('05901FC0-D482-442D-9764-7DE5EA4ED991','B911B4F8-DDFD-4F37-9EAC-EB104F753432','保存',4)
GO
INSERT INTO dbo.Sys_Menu(MenuId,MenuName,Url,SortIndex,SuperMenu,MenuType,IsOffice,IsEnd,IsUsed)
VALUES('2497EF13-C052-4228-B388-EBC5C18963BC','企业专题会','ZHGL/Meeting/CompanySpecialMeeting.aspx',20,'BFFBE172-7473-486E-9833-49F13B359C6C','Menu_ZHGL',1,1,1)
GO
INSERT INTO dbo.Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex)
VALUES('58BC6E5C-E45F-47A2-A7FC-D02F91DEF058','2497EF13-C052-4228-B388-EBC5C18963BC','增加',1)
INSERT INTO dbo.Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex)
VALUES('92627BA3-A14A-4886-805E-038324E9747A','2497EF13-C052-4228-B388-EBC5C18963BC','修改',2)
INSERT INTO dbo.Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex)
VALUES('395E1B2B-AF35-4867-A8F0-E471FB10C25D','2497EF13-C052-4228-B388-EBC5C18963BC','删除',3)
INSERT INTO dbo.Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex)
VALUES('1DF4AADF-2207-4A9E-83D0-8899E21E91BA','2497EF13-C052-4228-B388-EBC5C18963BC','保存',4)
GO
INSERT INTO dbo.Sys_Menu(MenuId,MenuName,Url,SortIndex,SuperMenu,MenuType,IsOffice,IsEnd,IsUsed)
VALUES('DFB56743-17BA-40BA-82EA-FCB9B0DBFAFF','安全领导小组会议','HSSE/Meeting/SafetyLeaderGroupMeeting.aspx',5,'5309E7E0-395E-4F11-8F5E-D52E11526A2A','Menu_HSSE',0,1,1)
GO
INSERT INTO dbo.Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex)
VALUES('0A65A42F-2701-4DD3-9C72-7B39F1ECD560','DFB56743-17BA-40BA-82EA-FCB9B0DBFAFF','增加',1)
INSERT INTO dbo.Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex)
VALUES('DCAB0B09-EA07-443C-9B04-2E86D9E8C2DC','DFB56743-17BA-40BA-82EA-FCB9B0DBFAFF','修改',2)
INSERT INTO dbo.Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex)
VALUES('FE3476FB-1D5B-4E8E-801E-E4B9B4D287F0','DFB56743-17BA-40BA-82EA-FCB9B0DBFAFF','删除',3)
INSERT INTO dbo.Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex)
VALUES('739A0815-D4B3-4B9F-B001-5D04EB94B9EF','DFB56743-17BA-40BA-82EA-FCB9B0DBFAFF','保存',4)
GO
update InApproveManager_EquipmentInItem set IsUsed=1
update InApproveManager_GeneralEquipmentInItem set IsUsed=1
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,
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
update License_LicenseManager set WorkStates='3'
GO
update HSSE_Hazard_HazardRegister set Risk_Level='一般'
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,
ProjectUnit.UnitName AS PUnitName,
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,
Project.ProjectName,
Registration.CheckCycle,
ISNULL(WorkArea.UnitWorkName,'') AS WorkAreaName,
Unit.UnitName as ResponsibilityUnitName,
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,
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
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
INSERT INTO dbo.Sys_Menu(MenuId,MenuName,Url,SortIndex,SuperMenu,MenuType,IsOffice,IsEnd,IsUsed)
VALUES('355265DE-901A-4110-B934-B4DA067C4334','领导带班检查','HSSE/Check/ProjectLeaderCheck.aspx',35,'467A0CB9-737D-4451-965E-869EBC3A4BD6','Menu_HSSE',0,1,1)
GO
--领导带班检查按钮
INSERT INTO dbo.Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex)
VALUES('E0860211-E41A-4D51-B5B4-99A5D0676C73','355265DE-901A-4110-B934-B4DA067C4334','增加',1)
INSERT INTO dbo.Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex)
VALUES('87B6E85C-48DA-4BD3-8518-35968E564557','355265DE-901A-4110-B934-B4DA067C4334','修改',2)
INSERT INTO dbo.Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex)
VALUES('B07D2E39-60CE-4F59-895B-7D0763A65341','355265DE-901A-4110-B934-B4DA067C4334','删除',3)
INSERT INTO dbo.Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex)
VALUES('AAB617C6-A800-4D59-8761-AC134C7885D3','355265DE-901A-4110-B934-B4DA067C4334','保存',4)
GO
INSERT INTO dbo.Sys_Menu(MenuId,MenuName,Url,SortIndex,SuperMenu,MenuType,IsOffice,IsEnd,IsUsed)
VALUES('3BBFCD70-D7A3-435C-9571-DD499D5ED7B8','应急信息','',120,'0','Menu_ZHGL',0,0,1)
GO
INSERT INTO dbo.Sys_Menu(MenuId,MenuName,Url,SortIndex,SuperMenu,MenuType,IsOffice,IsEnd,IsUsed)
VALUES('D12C2412-E12A-4F78-9AEF-1EE8AC84A561','应急预案管理清单','ZHGL/Emergency/EmergencyList.aspx',10,'3BBFCD70-D7A3-435C-9571-DD499D5ED7B8','Menu_ZHGL',0,1,1)
GO
INSERT INTO dbo.Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex)
VALUES('4A638D22-1515-4967-B149-8362F81E3A95','D12C2412-E12A-4F78-9AEF-1EE8AC84A561','增加',1)
INSERT INTO dbo.Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex)
VALUES('11F44E2B-F3EB-4189-B324-69DB226CF39B','D12C2412-E12A-4F78-9AEF-1EE8AC84A561','修改',2)
INSERT INTO dbo.Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex)
VALUES('826C9DEB-7A48-4B70-9312-FC5D0D5D2555','D12C2412-E12A-4F78-9AEF-1EE8AC84A561','删除',3)
INSERT INTO dbo.Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex)
VALUES('C4A17D4C-25A7-4F37-B6CF-F07526AECBC2','D12C2412-E12A-4F78-9AEF-1EE8AC84A561','保存',4)
GO
INSERT INTO Sys_Menu(MenuId,MenuName,Url,SortIndex,SuperMenu,MenuType,IsOffice,IsEnd,IsUsed)
VALUES('172F25E0-F5E2-42E3-AD67-AC824D4E0FBB','应急演练开展情况','ZHGL/Emergency/DrillRecordList.aspx',20,'3BBFCD70-D7A3-435C-9571-DD499D5ED7B8','Menu_ZHGL',0,1,1)
GO
INSERT INTO dbo.Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex)
VALUES('9F63FB64-5F34-4CD4-B266-59F6E8FF4FA5','172F25E0-F5E2-42E3-AD67-AC824D4E0FBB','增加',1)
INSERT INTO dbo.Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex)
VALUES('2193449B-4C40-49DA-9C23-82A94126AE05','172F25E0-F5E2-42E3-AD67-AC824D4E0FBB','修改',2)
INSERT INTO dbo.Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex)
VALUES('7C866795-2E56-47CD-B937-C468C46DB007','172F25E0-F5E2-42E3-AD67-AC824D4E0FBB','删除',3)
INSERT INTO dbo.Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex)
VALUES('27E0EE6E-D96F-4300-9574-423F378D79C4','172F25E0-F5E2-42E3-AD67-AC824D4E0FBB','保存',4)
GO
update Comprehensive_InspectionPerson set IsTrain=1
GO
update Comprehensive_DesignDetails set JoinPersonNum=6
GO
update Comprehensive_InspectionMachine set IsCheckOK=1
GO