| 
									
										
										
										
											2023-07-24 17:02:32 +08:00
										 |  |  |  | -- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD>ʶ
 | 
					
						
							|  |  |  |  | ALTER TABLE Bo_Sheng_Exam ADD DeleteTag NVARCHAR(50) NULL
 | 
					
						
							|  |  |  |  | GO
 | 
					
						
							|  |  |  |  | --ALTER TABLE Bo_Sheng_Person ADD DeleteTag NVARCHAR(50) NULL
 | 
					
						
							|  |  |  |  | --GO
 | 
					
						
							|  |  |  |  | ALTER TABLE Bo_Sheng_PersonTrainRecord ADD DeleteTag NVARCHAR(50) NULL
 | 
					
						
							|  |  |  |  | GO
 | 
					
						
							|  |  |  |  | --ALTER TABLE Bo_Sheng_Train ADD DeleteTag NVARCHAR(50) NULL
 | 
					
						
							|  |  |  |  | --GO
 | 
					
						
							|  |  |  |  | --ALTER TABLE Bo_Sheng_TrainPerson ADD DeleteTag NVARCHAR(50) NULL
 | 
					
						
							|  |  |  |  | --GO
 | 
					
						
							|  |  |  |  | ALTER TABLE Bo_Sheng_Unit ADD DeleteTag NVARCHAR(50) NULL
 | 
					
						
							|  |  |  |  | GO
 | 
					
						
							|  |  |  |  | update Sys_DataExchange set IsUpdate =0 where IsUpdate=1 and  MessageText like '%DeleteTag%'
 | 
					
						
							| 
									
										
										
										
											2023-07-24 18:45:19 +08:00
										 |  |  |  | go
 | 
					
						
							|  |  |  |  |  alter table HSSE_Hazard_HazardRegister add  Type int
 | 
					
						
							|  |  |  |  |   go
 | 
					
						
							|  |  |  |  |  update HSSE_Hazard_HazardRegister set Type =0
 | 
					
						
							|  |  |  |  |  go
 | 
					
						
							|  |  |  |  | /**********<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ѳ<EFBFBD>죨<EFBFBD>ֻ<EFBFBD><EFBFBD>ˣ<EFBFBD><EFBFBD><EFBFBD>ͼ*************/
 | 
					
						
							|  |  |  |  | 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 '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' 
 | 
					
						
							|  |  |  |  | 	WHEN Registration.states='1' and Registration.SafeSupervisionIsOK=1 THEN '<EFBFBD>ϸ<EFBFBD>' 
 | 
					
						
							|  |  |  |  | 	WHEN Registration.states='2' THEN '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' 
 | 
					
						
							|  |  |  |  | 	WHEN Registration.states='3' THEN '<EFBFBD>ѱջ<EFBFBD>' 
 | 
					
						
							|  |  |  |  | 	ELSE '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' 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,
 | 
					
						
							|  |  |  |  | 	Registration.Type
 | 
					
						
							|  |  |  |  | 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
 | 
					
						
							| 
									
										
										
										
											2023-07-24 19:51:54 +08:00
										 |  |  |  | delete from  Sys_Menu where MenuId='2FC8AA2A-F421-4174-A05E-2711167AF141'
 | 
					
						
							|  |  |  |  | delete from Sys_ButtonToMenu where MenuId='2FC8AA2A-F421-4174-A05E-2711167AF141' 
 | 
					
						
							|  |  |  |  | go
 | 
					
						
							|  |  |  |  | INSERT INTO dbo.Sys_Menu(MenuId,MenuName,Url,SortIndex,SuperMenu,MenuType,IsOffice,IsEnd,IsUsed)
 | 
					
						
							|  |  |  |  | 	VALUES('2FC8AA2A-F421-4174-A05E-2711167AF141','HSEѲ<EFBFBD><EFBFBD>','HSSE/HiddenInspection/HiddenRectificationList.aspx?Type=0',10,'467A0CB9-737D-4451-965E-869EBC3A4BD6','Menu_HSSE',0,1,1)
 | 
					
						
							|  |  |  |  | 	GO
 | 
					
						
							|  |  |  |  | 	INSERT INTO dbo.Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex)
 | 
					
						
							|  |  |  |  | 	VALUES('E831F780-BDC2-4644-B132-40E27518805E','2FC8AA2A-F421-4174-A05E-2711167AF141','<EFBFBD><EFBFBD><EFBFBD><EFBFBD>',1)
 | 
					
						
							|  |  |  |  | 	INSERT INTO dbo.Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex)
 | 
					
						
							|  |  |  |  | 	VALUES('9112B8B8-50A0-4592-AE06-2AC24E07E20B','2FC8AA2A-F421-4174-A05E-2711167AF141','<EFBFBD><EFBFBD>',2)
 | 
					
						
							|  |  |  |  | 	INSERT INTO dbo.Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex)
 | 
					
						
							|  |  |  |  | 	VALUES('3FF03C33-A07D-48CF-A0E2-D7A7542FBD69','2FC8AA2A-F421-4174-A05E-2711167AF141','ɾ<EFBFBD><EFBFBD>',3)
 | 
					
						
							|  |  |  |  | 	INSERT INTO dbo.Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex)
 | 
					
						
							|  |  |  |  | 	VALUES('55598440-05EF-4E70-86E6-81317BF19D94','2FC8AA2A-F421-4174-A05E-2711167AF141','<EFBFBD><EFBFBD><EFBFBD><EFBFBD>',4)
 | 
					
						
							|  |  |  |  | 	GO
 | 
					
						
							|  |  |  |  | INSERT INTO dbo.Sys_Menu(MenuId,MenuName,Url,SortIndex,SuperMenu,MenuType,IsOffice,IsEnd,IsUsed)
 | 
					
						
							|  |  |  |  | 	VALUES('379555F6-BECF-4E87-8F1C-73F529D260FF','<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ѳ<EFBFBD><EFBFBD>','HSSE/HiddenInspection/HiddenRectificationList.aspx?Type=1',15,'467A0CB9-737D-4451-965E-869EBC3A4BD6','Menu_HSSE',0,1,1)
 | 
					
						
							|  |  |  |  | 	GO
 | 
					
						
							|  |  |  |  | 	INSERT INTO dbo.Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex)
 | 
					
						
							|  |  |  |  | 	VALUES('1B39CEAF-EA02-4053-A767-A8F1CFE75CED','379555F6-BECF-4E87-8F1C-73F529D260FF','<EFBFBD><EFBFBD><EFBFBD><EFBFBD>',1)
 | 
					
						
							|  |  |  |  | 	INSERT INTO dbo.Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex)
 | 
					
						
							|  |  |  |  | 	VALUES('3C6AAA2F-30A5-4785-A7B3-0E4CE3E7FB30','379555F6-BECF-4E87-8F1C-73F529D260FF','<EFBFBD><EFBFBD>',2)
 | 
					
						
							|  |  |  |  | 	INSERT INTO dbo.Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex)
 | 
					
						
							|  |  |  |  | 	VALUES('2227CD60-EAD8-4B7B-9FFE-B6B7A1B8DC82','379555F6-BECF-4E87-8F1C-73F529D260FF','ɾ<EFBFBD><EFBFBD>',3)
 | 
					
						
							|  |  |  |  | 	INSERT INTO dbo.Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex)
 | 
					
						
							|  |  |  |  | 	VALUES('681D60A9-8D04-4EA9-B899-42C925A29134','379555F6-BECF-4E87-8F1C-73F529D260FF','<EFBFBD><EFBFBD><EFBFBD><EFBFBD>',4)
 | 
					
						
							|  |  |  |  | 	GO
 | 
					
						
							| 
									
										
										
										
											2023-07-24 18:45:19 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-24 21:26:31 +08:00
										 |  |  |  |  
 | 
					
						
							|  |  |  |  | --<EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD>ǰ<EFBFBD>˴<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | Create  PROCEDURE [dbo].[Sp_Project_GetToDoItems]     
 | 
					
						
							|  |  |  |  | 	@projectId NVARCHAR(50)=NULL,
 | 
					
						
							|  |  |  |  | 	@userId NVARCHAR(200)=NULL
 | 
					
						
							|  |  |  |  | AS  
 | 
					
						
							|  |  |  |  | /*<EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD>ǰ<EFBFBD>˴<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/          
 | 
					
						
							|  |  |  |  | BEGIN
 | 
					
						
							|  |  |  |  | SELECT HazardRegisterId AS DataId
 | 
					
						
							|  |  |  |  | 	,'B6BE5FE0-CB84-47FF-A6C3-5AD9E1CCE079' AS MenuId
 | 
					
						
							|  |  |  |  | 	,'<EFBFBD><EFBFBD>ȫѲ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' AS MenuName
 | 
					
						
							|  |  |  |  | 	,register.RegisterDef AS Content
 | 
					
						
							|  |  |  |  | 	,UserId
 | 
					
						
							|  |  |  |  | 	,users.UserName
 | 
					
						
							|  |  |  |  | 	,register.RegisterDate AS DataTime
 | 
					
						
							|  |  |  |  | 	,CONVERT(varchar(100),register.RegisterDate, 23) AS DataTimeStr
 | 
					
						
							|  |  |  |  | 	,'../HSSE/HiddenInspection/HiddenRectificationRectify.aspx?HazardRegisterId='+register.HazardRegisterId AS PCUrl
 | 
					
						
							|  |  |  |  | FROM HSSE_Hazard_HazardRegister AS register 
 | 
					
						
							|  |  |  |  | LEFT JOIN Sys_User AS users ON users.UserId =@userId
 | 
					
						
							|  |  |  |  | WHERE register.ProjectId=@projectId AND 
 | 
					
						
							|  |  |  |  | ((register.states = '1' AND (register.ResponsibleMan =@userId OR register.CCManIds LIKE ('%'+@userId+'%') )) 
 | 
					
						
							|  |  |  |  | )		
 | 
					
						
							|  |  |  |  | UNION ALL
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | SELECT HazardRegisterId AS DataId
 | 
					
						
							|  |  |  |  | 	,'B6BE5FE0-CB84-47FF-A6C3-5AD9E1CCE079' AS MenuId
 | 
					
						
							|  |  |  |  | 	,'<EFBFBD><EFBFBD>ȫѲ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><EFBFBD>' AS MenuName
 | 
					
						
							|  |  |  |  | 	,register.RegisterDef AS Content
 | 
					
						
							|  |  |  |  | 	,UserId
 | 
					
						
							|  |  |  |  | 	,users.UserName
 | 
					
						
							|  |  |  |  | 	,register.RegisterDate AS DataTime
 | 
					
						
							|  |  |  |  | 	,CONVERT(varchar(100),register.RegisterDate, 23) AS DataTimeStr
 | 
					
						
							|  |  |  |  | 	,'../HSSE/HiddenInspection/HiddenRectificationConfirm.aspx?HazardRegisterId='+register.HazardRegisterId AS PCUrl
 | 
					
						
							|  |  |  |  | FROM HSSE_Hazard_HazardRegister AS register 
 | 
					
						
							|  |  |  |  | LEFT JOIN Sys_User AS users ON users.UserId =@userId
 | 
					
						
							|  |  |  |  | WHERE register.ProjectId=@projectId AND 
 | 
					
						
							|  |  |  |  | register.states = '2' AND register.CheckManId =@userId
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | ORDER BY DataTime DESC 
 | 
					
						
							|  |  |  |  | END
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 |