134 lines
5.3 KiB
C#
134 lines
5.3 KiB
C#
|
|
using APT.BaseData.Domain.Entities.FM;
|
|||
|
|
using APT.BaseData.Domain.Enums.PF;
|
|||
|
|
using APT.BaseData.Domain.IServices;
|
|||
|
|
using APT.BaseData.Domain.IServices.AE;
|
|||
|
|
using APT.BaseData.Domain.IServices.FM;
|
|||
|
|
using APT.Infrastructure.Core;
|
|||
|
|
using APT.MS.Domain.Entities.OH;
|
|||
|
|
using APT.MS.Domain.Entities.TI;
|
|||
|
|
using APT.MS.Domain.Enums;
|
|||
|
|
using APT.Utility;
|
|||
|
|
using Microsoft.AspNetCore.Mvc;
|
|||
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.Linq;
|
|||
|
|
using System.Linq.Expressions;
|
|||
|
|
|
|||
|
|
namespace APT.SC.WebApi.Controllers.Api.OH
|
|||
|
|
{
|
|||
|
|
[Route("api/OH/OHHazardMonitorRule")]
|
|||
|
|
public class OHHazardMonitorRuleController : AuthorizeApiController<T_OH_HAZARD_MONITOR_RULE>
|
|||
|
|
{
|
|||
|
|
IFMFlowPermitService MFlowPermitService { get; set; }
|
|||
|
|
IPFApproveCallBackService ApproveCallBackService { get; set; }
|
|||
|
|
IAEAccidentEventReportService AccidentEventReportService { get; set; }
|
|||
|
|
public OHHazardMonitorRuleController(IFMFlowPermitService mFlowPermitService, IPFApproveCallBackService approveCallBackService, IAEAccidentEventReportService accidentEventReportService)
|
|||
|
|
{
|
|||
|
|
MFlowPermitService = mFlowPermitService;
|
|||
|
|
ApproveCallBackService = approveCallBackService;
|
|||
|
|
AccidentEventReportService = accidentEventReportService;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 体检周期表 修改
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="entity"></param>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
[HttpPost, Route("FullUpdate")]
|
|||
|
|
public JsonActionResult<bool> FullUpdate([FromBody] T_OH_HAZARD_MONITOR_RULE entity)
|
|||
|
|
{
|
|||
|
|
return SafeExecute<bool>(() =>
|
|||
|
|
{
|
|||
|
|
#region 值判断
|
|||
|
|
|
|||
|
|
if (entity.TYPE_ID == null)
|
|||
|
|
{
|
|||
|
|
throw new Exception("请选择监测类型");
|
|||
|
|
}
|
|||
|
|
if (entity.DEPARTMENT_ID_WORKSHOP == null)
|
|||
|
|
{
|
|||
|
|
throw new Exception("请选择监测车间");
|
|||
|
|
}
|
|||
|
|
string Msg = string.Empty;
|
|||
|
|
T_OH_HAZARD_MONITOR_TYPE modelType = GetEntity<T_OH_HAZARD_MONITOR_TYPE>(entity.TYPE_ID.Value);
|
|||
|
|
switch (modelType.MONITOR_TYPE)
|
|||
|
|
{
|
|||
|
|
case OHHazardMonitorFormTypeEnum.DustMonitoring:
|
|||
|
|
if (entity.THRESHOLD_DUST == 0)
|
|||
|
|
{
|
|||
|
|
Msg = "请输入粉尘浓度阈值";
|
|||
|
|
}
|
|||
|
|
break;
|
|||
|
|
case OHHazardMonitorFormTypeEnum.WorkPlaceMonitoring:
|
|||
|
|
if (entity.THRESHOLD_NOISE == 0)
|
|||
|
|
{
|
|||
|
|
Msg = "请输入噪声阈值";
|
|||
|
|
}
|
|||
|
|
break;
|
|||
|
|
case OHHazardMonitorFormTypeEnum.RadiationMonitoring:
|
|||
|
|
if (entity.THRESHOLD_RADIATION_05 == 0)
|
|||
|
|
{
|
|||
|
|
Msg = "请输入放射性0.5m处监测阈值";
|
|||
|
|
}
|
|||
|
|
if (entity.THRESHOLD_RADIATION_10 == 0)
|
|||
|
|
{
|
|||
|
|
Msg += (Msg.Length > 0 ? "、" : "请输入") + "放射性1m处监测阈值";
|
|||
|
|
}
|
|||
|
|
if (entity.THRESHOLD_RADIATION_AROUND == 0)
|
|||
|
|
{
|
|||
|
|
Msg += (Msg.Length > 0 ? "、" : "请输入") + "放射性周围环境监测阈值";
|
|||
|
|
}
|
|||
|
|
break;
|
|||
|
|
case OHHazardMonitorFormTypeEnum.WaterMonitoring:
|
|||
|
|
if (entity.THRESHOLD_WARTER_LOW == 0)
|
|||
|
|
{
|
|||
|
|
Msg = "请输入水质阈值下限";
|
|||
|
|
}
|
|||
|
|
if (entity.THRESHOLD_WARTER_HIGH == 0)
|
|||
|
|
{
|
|||
|
|
Msg += (Msg.Length > 0 ? "、" : "请输入") + "水质阈值上限";
|
|||
|
|
}
|
|||
|
|
if (entity.THRESHOLD_WARTER_LOW != 0 && entity.THRESHOLD_WARTER_HIGH != 0 && entity.THRESHOLD_WARTER_LOW > entity.THRESHOLD_WARTER_HIGH)
|
|||
|
|
{
|
|||
|
|
Msg += "水质阈值下限不能大于上限";
|
|||
|
|
}
|
|||
|
|
break;
|
|||
|
|
default:
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (!string.IsNullOrEmpty(Msg))
|
|||
|
|
{
|
|||
|
|
throw new Exception(Msg);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (!entity.DEPARTMENT_ID.HasValue)
|
|||
|
|
{
|
|||
|
|
throw new Exception("请选择责任部门!");
|
|||
|
|
}
|
|||
|
|
if (!entity.RECORD_POST_ID.HasValue)
|
|||
|
|
{
|
|||
|
|
throw new Exception("请选择记录人岗位!");
|
|||
|
|
}
|
|||
|
|
if (!entity.WARN_POST_ID.HasValue)
|
|||
|
|
{
|
|||
|
|
throw new Exception("请选择警示推送岗位!");
|
|||
|
|
}
|
|||
|
|
if (entity.TIME == DateTime.MinValue)
|
|||
|
|
{
|
|||
|
|
throw new Exception("请选择触发时间!");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
this.UnifiedCommit(() =>
|
|||
|
|
{
|
|||
|
|
if (entity != null)
|
|||
|
|
UpdateEntityNoCommit(entity); //事故事件上报
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
return true;
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|