河北专项检查和移动端
This commit is contained in:
@@ -171,12 +171,12 @@ namespace WebAPI.Controllers
|
||||
#endregion
|
||||
|
||||
#region 按项目和检查日期获取日常巡检
|
||||
public Model.ResponeData getHazardRegisterByProjectIdStates(string projectId, string date)
|
||||
public Model.ResponeData getHazardRegisterByProjectIdStates(string projectId, string checkDate)
|
||||
{
|
||||
var responeData = new Model.ResponeData();
|
||||
try
|
||||
{
|
||||
responeData.data = APIHazardRegisterService.getHazardRegisterByProjectIdStates(projectId, date);
|
||||
responeData.data = APIHazardRegisterService.getHazardRegisterByProjectIdStates(projectId, checkDate);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using BLL;
|
||||
using System;
|
||||
using System.Data.Linq.SqlClient;
|
||||
using System.Linq;
|
||||
using System.Web.Http;
|
||||
|
||||
@@ -7,6 +8,114 @@ namespace WebAPI.Controllers.HSSE
|
||||
{
|
||||
public class RectifyController : ApiController
|
||||
{
|
||||
#region 获取问题类型
|
||||
public Model.ResponeData getProcessTypes(string RectifyName, int PageNumber, int PageSize)
|
||||
{
|
||||
var responeData = new Model.ResponeData();
|
||||
try
|
||||
{
|
||||
var query = (from x in Funs.DB.Technique_Rectify
|
||||
select new
|
||||
{
|
||||
x.RectifyId,
|
||||
x.RectifyName,
|
||||
}).ToList();
|
||||
if (!string.IsNullOrEmpty(RectifyName))
|
||||
{
|
||||
query = query.Where(x => x.RectifyName.Contains(RectifyName)).ToList();
|
||||
}
|
||||
|
||||
var paginatedQuery = query
|
||||
.Skip((PageNumber - 1) * PageSize)
|
||||
.Take(PageSize)
|
||||
.ToList();
|
||||
|
||||
responeData.data = paginatedQuery;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
responeData.code = 0;
|
||||
responeData.message = ex.Message;
|
||||
}
|
||||
|
||||
return responeData;
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 根据问题类型ID获取问题描述
|
||||
public Model.ResponeData getProblemDescs(string RectifyId, string keyword, int PageNumber, int PageSize)
|
||||
{
|
||||
var responeData = new Model.ResponeData();
|
||||
try
|
||||
{
|
||||
var query = (from x in Funs.DB.Technique_RectifyItem
|
||||
where x.RectifyId == RectifyId
|
||||
select new
|
||||
{
|
||||
x.RectifyId,
|
||||
x.HazardSourcePoint,
|
||||
x.RiskAnalysis,
|
||||
x.RiskPrevention
|
||||
}).ToList();
|
||||
if (!string.IsNullOrEmpty(keyword))
|
||||
{
|
||||
query = query.Where(x => x.HazardSourcePoint.Contains(keyword)).ToList();
|
||||
}
|
||||
|
||||
var paginatedQuery = query
|
||||
.Skip((PageNumber - 1) * PageSize)
|
||||
.Take(PageSize)
|
||||
.ToList();
|
||||
responeData.data = paginatedQuery;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
responeData.code = 0;
|
||||
responeData.message = ex.Message;
|
||||
}
|
||||
return responeData;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 保存问题描述
|
||||
[HttpPost]
|
||||
public Model.ResponeData SaveRectifyItem(Model.Technique_RectifyItem rectifyItem)
|
||||
{
|
||||
var responeData = new Model.ResponeData();
|
||||
try
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
int count = db.Technique_RectifyItem.Count(x=>x.HazardSourcePoint == rectifyItem.HazardSourcePoint);
|
||||
if(count > 0)
|
||||
{
|
||||
responeData.code = 0;
|
||||
responeData.message = "描述已存在";
|
||||
} else
|
||||
{
|
||||
Model.Technique_RectifyItem item = new Model.Technique_RectifyItem
|
||||
{
|
||||
RectifyItemId = SQLHelper.GetNewID(),
|
||||
RectifyId = rectifyItem.RectifyId,
|
||||
HazardSourcePoint = rectifyItem.HazardSourcePoint,
|
||||
RiskPrevention = rectifyItem.RiskPrevention,
|
||||
CompileMan = rectifyItem.CompileMan,
|
||||
CompileDate = rectifyItem.CompileDate,
|
||||
UnitId = rectifyItem.UnitId,
|
||||
};
|
||||
db.Technique_RectifyItem.InsertOnSubmit(item);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
|
||||
} catch (Exception ex)
|
||||
{
|
||||
responeData.code = 0;
|
||||
responeData.message = ex.Message;
|
||||
}
|
||||
return responeData;
|
||||
}
|
||||
#endregion
|
||||
#region 获取集合
|
||||
/// <summary>
|
||||
/// 获取集合
|
||||
|
||||
@@ -7,179 +7,77 @@ using Model;
|
||||
using static BLL.OfficeCheck.Inspect.Inspect_InspectionService;
|
||||
using System.Collections.Generic;
|
||||
using static WebAPI.Controllers.HSSE.ImageRecognitionController;
|
||||
using Microsoft.Office.Interop.Word;
|
||||
|
||||
namespace WebAPI.Controllers.HSSE
|
||||
{
|
||||
public class SafetyInspectionController : ApiController
|
||||
{
|
||||
//新增
|
||||
/// <summary>
|
||||
/// 编辑 保存
|
||||
/// </summary>
|
||||
/// <param name="trainingPlan">安全专检</param>
|
||||
|
||||
#region 保存专检主项
|
||||
[HttpPost]
|
||||
public Model.ResponeData Save([FromBody] Model.Inspect_Inspection Inspection)
|
||||
public Model.ResponeData SaveInspection(Model.Inspect_Inspection inspection)
|
||||
{
|
||||
var responeData = new Model.ResponeData();
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrEmpty(Inspection.InspectionId))
|
||||
Model.Inspect_Inspection obj = new Model.Inspect_Inspection();
|
||||
if (inspection.InspectionId == null)
|
||||
{
|
||||
Inspection.InspectionId = Guid.NewGuid().ToString();
|
||||
Inspection.CreateTime = DateTime.Now;
|
||||
Inspect_InspectionService.AddInspection(Inspection);
|
||||
}
|
||||
else
|
||||
obj = Inspect_InspectionService.SaveInspection(inspection);
|
||||
|
||||
}else
|
||||
{
|
||||
Inspect_InspectionService.UpdateInspection(Inspection);
|
||||
Inspect_InspectionService.UpdateInspection(inspection);
|
||||
}
|
||||
responeData.data = obj.InspectionId;
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
|
||||
} catch (Exception ex)
|
||||
{
|
||||
responeData.code = 0;
|
||||
responeData.message = ex.Message;
|
||||
}
|
||||
|
||||
return responeData;
|
||||
}
|
||||
|
||||
//查询
|
||||
public Model.ResponeData getList(string ProjectId,string States,string PersonResponsible, int PageNumber, int PageSize)
|
||||
{
|
||||
var responeData = new Model.ResponeData();
|
||||
try
|
||||
{
|
||||
|
||||
responeData.data = Inspect_InspectionService.GetInspectionList(ProjectId,States,PersonResponsible,PageNumber,PageSize);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
responeData.code = 0;
|
||||
responeData.message = ex.Message;
|
||||
}
|
||||
#endregion
|
||||
|
||||
return responeData;
|
||||
}
|
||||
|
||||
//专检明细
|
||||
|
||||
#region 获取专检主项详细
|
||||
public Model.ResponeData getInspectionById(string InspectionId)
|
||||
{
|
||||
var responeData = new Model.ResponeData();
|
||||
try
|
||||
{
|
||||
var getDataLists = (from x in Funs.DB.Inspect_Inspection
|
||||
join user in Funs.DB.Sys_User on x.InspectMan equals user.UserId into userJoin1
|
||||
from subUser1 in userJoin1.DefaultIfEmpty()
|
||||
join user in Funs.DB.Sys_User on x.CreateMan equals user.UserId into userJoin2
|
||||
from subUser2 in userJoin2.DefaultIfEmpty()
|
||||
join user in Funs.DB.Sys_User on x.PersonResponsible equals user.UserId into userJoin3
|
||||
from subUser3 in userJoin3.DefaultIfEmpty()
|
||||
join p in Funs.DB.Base_Project on x.ProjectId equals p.ProjectId into project
|
||||
from pro in project.DefaultIfEmpty()
|
||||
where x.InspectionId == InspectionId
|
||||
select new InspectionDto
|
||||
{
|
||||
InspectionId = x.InspectionId,
|
||||
InspectionCode = x.InspectionCode,
|
||||
ProjectId = x.ProjectId,
|
||||
ProjectName = pro.ProjectName,
|
||||
PersonResponsible = x.PersonResponsible,
|
||||
PersonResponsibleName = subUser3.UserName,
|
||||
InspectTime = x.InspectTime,
|
||||
Description = x.Description,
|
||||
States = x.States,
|
||||
InspectMan = subUser1.UserName,
|
||||
InspectManId = x.InspectMan,
|
||||
InspectType = x.InspectType,
|
||||
InspectItemSetId = x.InspectItemSetId,
|
||||
CreateMan = subUser2.UserName,
|
||||
CreateTime = x.CreateTime,
|
||||
}).FirstOrDefault();
|
||||
|
||||
responeData.data = getDataLists;
|
||||
responeData.data = Inspect_InspectionService.GetInspectionById(InspectionId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
responeData.code = 0;
|
||||
responeData.message = ex.Message;
|
||||
}
|
||||
|
||||
return responeData;
|
||||
}
|
||||
#endregion
|
||||
|
||||
//项目负责人下拉
|
||||
public Model.ResponeData getPersonResponsibleList(string ProjectId)
|
||||
#region 获取专检主项列表
|
||||
public Model.ResponeData getInspectionList(string ProjectId, string States, int PageNumber, int PageSize)
|
||||
{
|
||||
var responeData = new Model.ResponeData();
|
||||
try
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
var users = (from x in db.Sys_User
|
||||
where x.IsPost == true && x.UserId != Const.hfnbdId && x.UserId != Const.sedinId
|
||||
orderby x.UserName
|
||||
select new UserDto
|
||||
{
|
||||
UserId = x.UserId,
|
||||
UserName = x.UserName,
|
||||
}).ToList();
|
||||
if (!string.IsNullOrEmpty(ProjectId))
|
||||
{
|
||||
users = (from x in users
|
||||
join y in db.Project_ProjectUser on x.UserId equals y.UserId
|
||||
where y.ProjectId == ProjectId
|
||||
orderby x.UserName
|
||||
select new UserDto
|
||||
{
|
||||
UserId = x.UserId,
|
||||
UserName = x.UserName,
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
responeData.data = users;
|
||||
}
|
||||
responeData.data = Inspect_InspectionService.GetInspectionList(ProjectId, States, PageNumber, PageSize);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
responeData.code = 0;
|
||||
responeData.message = ex.Message;
|
||||
}
|
||||
|
||||
return responeData;
|
||||
}
|
||||
#endregion
|
||||
|
||||
public class UserDto
|
||||
{
|
||||
public string UserId
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
public string UserName
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//专检明细
|
||||
public Model.ResponeData getInspectItemsByInspectionId(string InspectionId, int PageNumber, int PageSize)
|
||||
{
|
||||
var responeData = new Model.ResponeData();
|
||||
try
|
||||
{
|
||||
responeData.data = Inspect_InspectionService.GetInspectionItemList(InspectionId,PageNumber,PageSize);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
responeData.code = 0;
|
||||
responeData.message = ex.Message;
|
||||
}
|
||||
|
||||
return responeData;
|
||||
}
|
||||
#region 保存专检子项
|
||||
[HttpPost]
|
||||
public Model.ResponeData SaveInspectionChild(Model.Inspect_InspectionItem child)
|
||||
@@ -189,9 +87,7 @@ namespace WebAPI.Controllers.HSSE
|
||||
{
|
||||
if (string.IsNullOrEmpty(child.InspectionItemId))
|
||||
{
|
||||
child.InspectionItemId = Guid.NewGuid().ToString();
|
||||
child.CompileTime = DateTime.Now;
|
||||
Inspect_InspectionService.AddInspectionItem(child);
|
||||
Inspect_InspectionService.SaveInspectionItem(child);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -207,85 +103,78 @@ namespace WebAPI.Controllers.HSSE
|
||||
return responeData;
|
||||
}
|
||||
#endregion
|
||||
//编辑 新增明细
|
||||
[HttpPost]
|
||||
public Model.ResponeData SaveInspectionItem([FromBody] List<Model.Inspect_InspectionItem> InspectionItems)
|
||||
{
|
||||
var responeData = new Model.ResponeData();
|
||||
try
|
||||
{
|
||||
foreach (var InspectionItem in InspectionItems)
|
||||
{
|
||||
if (string.IsNullOrEmpty(InspectionItem.InspectionItemId))
|
||||
{
|
||||
InspectionItem.InspectionItemId = Guid.NewGuid().ToString();
|
||||
InspectionItem.CompileTime = DateTime.Now;
|
||||
Inspect_InspectionService.AddInspectionItem(InspectionItem);
|
||||
}
|
||||
else
|
||||
{
|
||||
Inspect_InspectionService.UpdateInspectionItem(InspectionItem);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
responeData.code = 0;
|
||||
responeData.message = ex.Message;
|
||||
}
|
||||
|
||||
return responeData;
|
||||
}
|
||||
|
||||
|
||||
//专检子表明细
|
||||
|
||||
#region 获取专检子项详细
|
||||
public Model.ResponeData getInspectItemsById(string InspectionItemId)
|
||||
{
|
||||
var responeData = new Model.ResponeData();
|
||||
try
|
||||
{
|
||||
|
||||
var getDataLists = (from x in Funs.DB.Inspect_InspectionItem
|
||||
join user in Funs.DB.Sys_User on x.CompileMan equals user.UserId into userJoin1
|
||||
from subUser1 in userJoin1.DefaultIfEmpty()
|
||||
join p in Funs.DB.Base_Project on x.ProjectId equals p.ProjectId into project
|
||||
from pro in project.DefaultIfEmpty()
|
||||
where x.InspectionItemId == InspectionItemId
|
||||
select new InspectionItemDto
|
||||
{
|
||||
InspectionItemId = x.InspectionItemId,
|
||||
InspectionId = x.InspectionId,
|
||||
InspectionItemCode = x.InspectionItemCode,
|
||||
ProjectId = x.ProjectId,
|
||||
ProjectName = pro.ProjectName,
|
||||
InspectionDescribe = x.InspectionDescribe,
|
||||
PhotoUrl = x.PhotoUrl,
|
||||
VideoUrl = x.VideoUrl,
|
||||
EvaluateResults = x.EvaluateResults,
|
||||
TimeLimited = x.TimeLimited,
|
||||
RectificationDescription = x.RectificationDescription,
|
||||
RectificationResults = x.RectificationResults,
|
||||
RectificationPhotoUrl = x.RectificationPhotoUrl,
|
||||
RectificationVideoUrl = x.RectificationVideoUrl,
|
||||
States = x.States,
|
||||
CompileMan = subUser1.UserName,
|
||||
CompileTime = x.CompileTime,
|
||||
}).FirstOrDefault();
|
||||
|
||||
|
||||
|
||||
responeData.data = getDataLists;
|
||||
responeData.data = Inspect_InspectionService.GetInspectItemsById(InspectionItemId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
responeData.code = 0;
|
||||
responeData.message = ex.Message;
|
||||
}
|
||||
|
||||
return responeData;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 根据项目和检查日期获取专检 (公司级查询)
|
||||
public Model.ResponeData getInspectionByProjectIdAndCheckDate(string projectId, string checkDate)
|
||||
{
|
||||
var responeData = new Model.ResponeData();
|
||||
try
|
||||
{
|
||||
DateTime mdate = Funs.GetNewDateTimeOrNow(checkDate);
|
||||
|
||||
var getDataLists = (from x in Funs.DB.Inspect_Inspection
|
||||
select new InspectionDto
|
||||
{
|
||||
InspectionId = x.InspectionId,
|
||||
InspectionCode = x.InspectionCode,
|
||||
ProjectId = x.ProjectId,
|
||||
ProjectName = Funs.DB.Base_Project.FirstOrDefault(p => p.ProjectId == x.ProjectId).ProjectName,
|
||||
PersonResponsible = x.PersonResponsible,
|
||||
PersonResponsibleName = Funs.DB.Sys_User.FirstOrDefault(u => u.UserId == x.PersonResponsible).UserName,
|
||||
Description = x.Description,
|
||||
States = x.States,
|
||||
CreateManName = Funs.DB.Sys_User.FirstOrDefault(u => u.UserId == x.CreateMan).UserName,
|
||||
CreateMan = x.CreateMan,
|
||||
CreateTime = x.CreateTime,
|
||||
InspectType = x.InspectType,
|
||||
ProblemTypeId = x.ProblemTypeId,
|
||||
ProblemTypeName = x.ProblemTypeName,
|
||||
Place = x.Place,
|
||||
ChildsCount = (from a in Funs.DB.Inspect_InspectionItem
|
||||
where a.InspectionId == x.InspectionId
|
||||
select a).Count().ToString(),
|
||||
});
|
||||
if (!string.IsNullOrEmpty(projectId))
|
||||
{
|
||||
getDataLists = getDataLists.Where(q => q.ProjectId == projectId&&q.InspectType == "1");
|
||||
}
|
||||
|
||||
getDataLists = getDataLists.Where(q => q.CreateTime.Value.Year == mdate.Year
|
||||
&& q.CreateTime.Value.Month == mdate.Month
|
||||
&& q.CreateTime.Value.Day == mdate.Day);
|
||||
responeData.data = getDataLists.ToList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
responeData.code = 0;
|
||||
responeData.message = ex.Message;
|
||||
}
|
||||
return responeData;
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -13,6 +13,24 @@ namespace WebAPI.Controllers
|
||||
/// </summary>
|
||||
public class ProjectController : ApiController
|
||||
{
|
||||
#region
|
||||
public Model.ResponeData getALLProjects()
|
||||
{
|
||||
Model.ResponeData responeData = new Model.ResponeData();
|
||||
try
|
||||
{
|
||||
List<Model.ProjectItem> projectList = BLL.APIProjectService.geProjects();
|
||||
responeData.data = projectList;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
responeData.code = 0;
|
||||
responeData.message = ex.Message;
|
||||
}
|
||||
return responeData;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 根据userid获取用户参与项目
|
||||
/// <summary>
|
||||
/// 根据userid获取用户参与项目
|
||||
|
||||
Reference in New Issue
Block a user