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
+12 -2
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)
{