2023-07-24 小程序巡检增加常规巡检

This commit is contained in:
李鹏飞 2023-07-24 18:45:19 +08:00
parent ca3e8950ae
commit 24b46ac8de
3 changed files with 101 additions and 6 deletions

View File

@ -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
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

View File

@ -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
/// <param name="projectId"></param>
/// <param name="states"></param>
/// <returns></returns>
public static List<Model.HazardRegisterItem> getHazardRegisterByProjectIdStates(string projectId, string states, int pageIndex)
public static List<Model.HazardRegisterItem> 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<Model.View_Hazard_HazardRegister>, List<Model.HazardRegisterItem>>().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)
{

View File

@ -40,18 +40,19 @@ namespace WebAPI.Controllers
/// </summary>
/// <param name="projectId"></param>
/// <param name="states"></param>
/// <param name="type"> 0 日常巡检 1 常规巡检</param>
/// <param name="pageIndex">页码</param>
/// <returns></returns>
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<Model.HazardRegisterItem> getDataList = new List<Model.HazardRegisterItem>();
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 };
}