88 lines
2.7 KiB
MySQL
88 lines
2.7 KiB
MySQL
|
|
|
|||
|
|
|
|||
|
|
update Check_CheckSpecialProDetail
|
|||
|
|
set riskLevel=1
|
|||
|
|
where riskLevel='0' or riskLevel='<EFBFBD><EFBFBD>' or riskLevel='һ<EFBFBD><EFBFBD>' or riskLevel='' or riskLevel is null
|
|||
|
|
|
|||
|
|
go
|
|||
|
|
update Check_CheckSpecialProDetail
|
|||
|
|
set riskLevel=2
|
|||
|
|
where riskLevel='<EFBFBD>ϴ<EFBFBD>' or riskLevel='<EFBFBD>ϸ<EFBFBD>'
|
|||
|
|
|
|||
|
|
go
|
|||
|
|
update Check_CheckSpecialProDetail
|
|||
|
|
set riskLevel=3
|
|||
|
|
where riskLevel='<EFBFBD><EFBFBD>' or riskLevel='<EFBFBD>ش<EFBFBD>'
|
|||
|
|
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
ALTER VIEW [dbo].[View_CheckSpecialProDetail]
|
|||
|
|
AS
|
|||
|
|
/*ר<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD>б<EFBFBD><EFBFBD><EFBFBD>ͼ*/
|
|||
|
|
SELECT detail.CheckSpecialDetailId,
|
|||
|
|
detail.CheckSpecialId,
|
|||
|
|
detail.CheckItem,
|
|||
|
|
checkItemSet.RegisterTypesName as CheckItemName,
|
|||
|
|
--detail.CheckItemType,
|
|||
|
|
detail.Unqualified,
|
|||
|
|
detail.SortIndex,
|
|||
|
|
detail.UnitId,
|
|||
|
|
detail.HandleStep,
|
|||
|
|
detail.CompleteStatus,
|
|||
|
|
(case when detail.CompleteStatus =1 then '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' else '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' end) as CompleteStatusName,
|
|||
|
|
detail.LimitedDate,
|
|||
|
|
detail.CompletedDate,
|
|||
|
|
--detail.Suggestions,
|
|||
|
|
detail.CheckContent,
|
|||
|
|
detail.CheckArea,
|
|||
|
|
detail.HandleWay,
|
|||
|
|
detail.Suggestions,
|
|||
|
|
detail.RectifyOpinion,
|
|||
|
|
detail.ProposeUnitId,
|
|||
|
|
workArea.UnitWorkName + (CASE WHEN workArea.ProjectType ='1' THEN '(<28><><EFBFBD><EFBFBD>)'
|
|||
|
|
WHEN workArea.ProjectType ='2' THEN '(<28><>װ)' ELSE '' END)AS CheckAreaName,
|
|||
|
|
detail.DataId,
|
|||
|
|
detail.DataType,
|
|||
|
|
unit.UnitName,
|
|||
|
|
dbo.GetConstTextByIds(detail.HandleStep) as HandleStepStr,
|
|||
|
|
--const.ConstText as HandleStepStr,
|
|||
|
|
(CASE WHEN detail.DataType like '%1%'
|
|||
|
|
THEN '<EFBFBD>·<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD>:'+(SELECT RectifyNoticesCode FROM Check_RectifyNotices WHERE detail.DataId like '%'+RectifyNoticesId+'%')
|
|||
|
|
else '' end)+
|
|||
|
|
(CASE WHEN detail.DataType like '%2%'
|
|||
|
|
THEN '<EFBFBD>·<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:'+(SELECT PunishNoticeCode FROM Check_PunishNotice WHERE detail.DataId like '%'+PunishNoticeId+'%')
|
|||
|
|
else '' end)+
|
|||
|
|
(CASE WHEN detail.DataType = '3'
|
|||
|
|
THEN '<EFBFBD>·<EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><EFBFBD>:'+(SELECT PauseNoticeCode FROM Check_PauseNotice WHERE detail.DataId like '%'+ PauseNoticeId+'%')
|
|||
|
|
else '' end) AS HandleStepLink
|
|||
|
|
,
|
|||
|
|
--(case when detail.riskLevel ='0' then '<EFBFBD><EFBFBD>'
|
|||
|
|
-- when detail.riskLevel = '1' then 'һ<><D2BB>'
|
|||
|
|
-- when detail.riskLevel = '2' then '<27>ϸ<EFBFBD>'
|
|||
|
|
-- when detail.riskLevel = '3' then '<27><>'
|
|||
|
|
-- else detail.riskLevel end) as riskLevel,
|
|||
|
|
(case when detail.riskLevel = '1' then 'һ<EFBFBD><EFBFBD>'
|
|||
|
|
when detail.riskLevel = '2' then '<EFBFBD>ϸ<EFBFBD>'
|
|||
|
|
when detail.riskLevel = '3' then '<EFBFBD><EFBFBD>'
|
|||
|
|
else 'һ<EFBFBD><EFBFBD>' end) as riskLevel,
|
|||
|
|
sysuser.userName as HSEManage
|
|||
|
|
|
|||
|
|
FROM dbo.Check_CheckSpecialProDetail AS detail
|
|||
|
|
LEFT JOIN dbo. HSSE_Hazard_HazardRegisterTypes AS checkItemSet ON checkItemSet.RegisterTypesId=detail.CheckItem
|
|||
|
|
LEFT JOIN dbo.Base_Unit AS unit ON unit.UnitId=detail.UnitId
|
|||
|
|
LEFT JOIN dbo.WBS_UnitWork AS workArea ON detail.CheckArea=workArea.UnitWorkId
|
|||
|
|
LEFT JOIN dbo.Sys_User AS sysuser ON sysuser.userid=detail.HSEManage
|
|||
|
|
--LEFT JOIN Sys_Const AS const ON const.ConstValue = detail.HandleStep and const.GroupId='HandleStep'
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
GO
|
|||
|
|
|
|||
|
|
|