2023-07-24 小程序巡检增加常规巡检
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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 };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user