From 24b46ac8de358d32b0cabd050587bed2904d0830 Mon Sep 17 00:00:00 2001 From: fly-l <1420031550@qq.com> Date: Mon, 24 Jul 2023 18:45:19 +0800 Subject: [PATCH] =?UTF-8?q?2023-07-24=20=E5=B0=8F=E7=A8=8B=E5=BA=8F?= =?UTF-8?q?=E5=B7=A1=E6=A3=80=E5=A2=9E=E5=8A=A0=E5=B8=B8=E8=A7=84=E5=B7=A1?= =?UTF-8?q?=E6=A3=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../版本日志/SGGLDB_WH_2023-07-24.sql | 86 ++++++++++++++++++- SGGL/BLL/API/HSSE/APIHazardRegisterService.cs | 14 ++- .../HSSE/HazardRegisterController.cs | 7 +- 3 files changed, 101 insertions(+), 6 deletions(-) diff --git a/DataBase/版本日志/SGGLDB_WH_2023-07-24.sql b/DataBase/版本日志/SGGLDB_WH_2023-07-24.sql index 9e7ae46b..fd987c22 100644 --- a/DataBase/版本日志/SGGLDB_WH_2023-07-24.sql +++ b/DataBase/版本日志/SGGLDB_WH_2023-07-24.sql @@ -12,4 +12,88 @@ 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%' -go \ No newline at end of file +go + alter table HSSE_Hazard_HazardRegister add Type int + go + update HSSE_Hazard_HazardRegister set Type =0 + 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, + 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 + + + \ No newline at end of file diff --git a/SGGL/BLL/API/HSSE/APIHazardRegisterService.cs b/SGGL/BLL/API/HSSE/APIHazardRegisterService.cs index 8ef5ef6f..a1c60a36 100644 --- a/SGGL/BLL/API/HSSE/APIHazardRegisterService.cs +++ b/SGGL/BLL/API/HSSE/APIHazardRegisterService.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using EmitMapper; +using NPOI.SS.Formula.Functions; namespace BLL { @@ -29,12 +30,12 @@ namespace BLL /// /// /// - public static List getHazardRegisterByProjectIdStates(string projectId, string states, int pageIndex) + public static List getHazardRegisterByProjectIdStates(string projectId, string states, int type ,int pageIndex) { using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { var hazardRegisters = (from x in db.View_Hazard_HazardRegister - where x.ProjectId == projectId && (x.States == states || states == null) + where x.ProjectId == projectId && x.Type == type && (x.States == states || states == null) orderby x.CheckTime descending select x).Skip(Funs.PageSize * (pageIndex - 1)).Take(Funs.PageSize).ToList(); return ObjectMapperManager.DefaultInstance.GetMapper, List>().Map(hazardRegisters.ToList()); @@ -80,6 +81,15 @@ namespace BLL CCManIds = hazardRegister.CCManIds, Requirements = hazardRegister.Requirements, }; + var RegisterTypesDt = db.HSSE_Hazard_HazardRegisterTypes.FirstOrDefault(x => x.RegisterTypesId == newHazardRegister.RegisterTypesId); + if (RegisterTypesDt != null && RegisterTypesDt.HazardRegisterType == "4") + { + newHazardRegister.Type = 1; //常规巡检 + } + else + { + newHazardRegister.Type = 0; //日常巡检 + } var isUpdate = db.HSSE_Hazard_HazardRegister.FirstOrDefault(x => x.HazardRegisterId == newHazardRegister.HazardRegisterId); if (isUpdate == null) { diff --git a/SGGL/WebAPI/Controllers/HSSE/HazardRegisterController.cs b/SGGL/WebAPI/Controllers/HSSE/HazardRegisterController.cs index ac18b0e0..82749dd7 100644 --- a/SGGL/WebAPI/Controllers/HSSE/HazardRegisterController.cs +++ b/SGGL/WebAPI/Controllers/HSSE/HazardRegisterController.cs @@ -40,18 +40,19 @@ namespace WebAPI.Controllers /// /// /// + /// 0 日常巡检 1 常规巡检 /// 页码 /// - public Model.ResponeData getHazardRegisterByProjectIdStates(string projectId, string states, int pageIndex) + public Model.ResponeData getHazardRegisterByProjectIdStates(string projectId, string states,int type, int pageIndex ) { var responeData = new Model.ResponeData(); try { List getDataList = new List(); - int pageCount = Funs.DB.HSSE_Hazard_HazardRegister.Count(x => x.ProjectId == projectId && (x.States == states || states == null)); + int pageCount = Funs.DB.HSSE_Hazard_HazardRegister.Count(x => x.ProjectId == projectId && x.Type == type && (x.States == states || states == null)); if (pageCount > 0 && pageIndex > 0) { - getDataList = APIHazardRegisterService.getHazardRegisterByProjectIdStates(projectId, states, pageIndex); + getDataList = APIHazardRegisterService.getHazardRegisterByProjectIdStates(projectId, states, type, pageIndex); } responeData.data = new { pageCount, getDataList }; }