专项检查
This commit is contained in:
@@ -4,18 +4,62 @@ using System.Collections.Generic;
|
||||
using System;
|
||||
using BLL;
|
||||
using System.Linq;
|
||||
using static WebAPI.Controllers.HSSE.ImageRecognitionController;
|
||||
|
||||
namespace Mvc.Controllers
|
||||
{
|
||||
public class CheckListController : ApiController
|
||||
{
|
||||
#region 根据项目日期获取巡检记录
|
||||
[HttpGet]
|
||||
public Model.ResponeData GetCheckList(string projectId, string checkDate)
|
||||
{
|
||||
var responeData = new Model.ResponeData();
|
||||
|
||||
try
|
||||
{
|
||||
DateTime mdate = Funs.GetNewDateTimeOrNow(checkDate);
|
||||
var list = Funs.DB.Check_CheckControl.Where(q => q.CheckDate.Value.Year == mdate.Year
|
||||
&& q.CheckDate.Value.Month == mdate.Month
|
||||
&& q.CheckDate.Value.Day == mdate.Day);
|
||||
if(string.IsNullOrEmpty(projectId)&& projectId!=null)
|
||||
{
|
||||
list = list.Where(p=>p.ProjectId == projectId);
|
||||
}
|
||||
responeData.data = list.OrderBy(x=>x.CheckDate).ToList().Select(x => new
|
||||
{
|
||||
CheckControlCode = x.CheckControlCode, // ID
|
||||
DocCode = x.DocCode, // 编号
|
||||
ProjectId = x.ProjectId, // 项目ID
|
||||
ProjectName = Funs.DB.Base_Project.FirstOrDefault(p => p.ProjectId == x.ProjectId).ProjectName,
|
||||
CheckMan = x.CheckMan, // 巡检人ID
|
||||
CheckManName = (from y in Funs.DB.Sys_User where y.UserId == x.CheckMan select y.UserName).First(),// 巡检人
|
||||
CheckDate = String.Format("{0:yyyy-MM-dd}", x.CheckDate), // 巡检日期
|
||||
QuestionType = x.QuestionType, // 问题类型
|
||||
QuestionTypeName = Funs.DB.Base_QualityQuestionType.FirstOrDefault(e => e.QualityQuestionTypeId == x.QuestionType).QualityQuestionType,
|
||||
States = x.State,
|
||||
LimitDate = String.Format("{0:yyyy-MM-dd}", x.LimitDate),
|
||||
QuestionDef = x.QuestionDef,
|
||||
}); ;
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
responeData.code = 0;
|
||||
responeData.message = ex.Message;
|
||||
}
|
||||
|
||||
|
||||
return responeData;
|
||||
}
|
||||
#endregion
|
||||
//
|
||||
// 质量巡检
|
||||
// GET: /Draw/
|
||||
[HttpGet]
|
||||
public ResponseData<List<Check_CheckControl>> Index(string projectId, int index, int page, string state, string name)
|
||||
public ResponseData<object> Index(string projectId, int index, int page, string state, string name)
|
||||
{
|
||||
ResponseData<List<Check_CheckControl>> res = new ResponseData<List<Check_CheckControl>>();
|
||||
ResponseData<object> res = new ResponseData<object>();
|
||||
try
|
||||
{res.successful = true;
|
||||
res.resultValue = BLL.CheckControlService.GetListDataForApi(state, name, projectId, index, page);
|
||||
@@ -30,6 +74,20 @@ namespace Mvc.Controllers
|
||||
return res;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据code获取详情
|
||||
/// </summary>
|
||||
/// <param name="CheckControlCode"></param>
|
||||
/// <returns></returns>
|
||||
public ResponseData<object> GetCheckControl(string code)
|
||||
{
|
||||
ResponseData<object> res = new ResponseData<object>();
|
||||
object checkControl = BLL.CheckControlService.GetCheckControlForApi(code);
|
||||
res.successful = true;
|
||||
res.resultValue = checkControl;
|
||||
return res;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public ResponseData<string> Conut(string projectId, string searchWord, string unitId = null, string unitWork = null, string problemType = null, string professional = null, string dateA = null, string dateZ = null)
|
||||
{
|
||||
@@ -48,19 +106,7 @@ namespace Mvc.Controllers
|
||||
return res;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据code获取详情
|
||||
/// </summary>
|
||||
/// <param name="CheckControlCode"></param>
|
||||
/// <returns></returns>
|
||||
public ResponseData<Check_CheckControl> GetCheckControl(string code)
|
||||
{
|
||||
ResponseData<Check_CheckControl> res = new ResponseData<Check_CheckControl>();
|
||||
Check_CheckControl checkControl = BLL.CheckControlService.GetCheckControlForApi(code);
|
||||
res.successful = true;
|
||||
res.resultValue = BeanUtil.CopyOjbect<Check_CheckControl>(checkControl, true);
|
||||
return res;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据code获取 审核记录
|
||||
/// </summary>
|
||||
@@ -92,24 +138,15 @@ namespace Mvc.Controllers
|
||||
{
|
||||
if (string.IsNullOrEmpty(CheckControl.DocCode))
|
||||
{
|
||||
string prefix = BLL.ProjectService.GetProjectByProjectId(CheckControl.ProjectId).ProjectCode + "-QC-TCC-XJ-";
|
||||
CheckControl.DocCode = BLL.SQLHelper.RunProcNewId("SpGetNewCode5ByProjectId", "dbo.Check_CheckControl", "DocCode",CheckControl.ProjectId, prefix);
|
||||
CheckControl.DocCode = BLL.SQLHelper.RunProcNewId("SpGetNewCode5ByProjectId", "dbo.Check_CheckControl", "DocCode",CheckControl.ProjectId, "QXJ-");
|
||||
}
|
||||
CheckControl.CheckControlCode = Guid.NewGuid().ToString();
|
||||
BLL.CheckControlService.AddCheckControlForApi(CheckControl);
|
||||
//BLL.AttachFileService.updateAttachFile(CheckControl.ReAttachUrl, CheckControl.CheckControlCode+"r", Const.CheckListMenuId);
|
||||
//BLL.AttachFileService.updateAttachFile(CheckControl.AttachUrl, CheckControl.CheckControlCode, Const.CheckListMenuId);
|
||||
SaveAttachFile(CheckControl.CheckControlCode + "r", BLL.Const.CheckListMenuId, CheckControl.ReAttachUrl);
|
||||
SaveAttachFile(CheckControl.CheckControlCode, BLL.Const.CheckListMenuId, CheckControl.AttachUrl);
|
||||
res.resultValue = CheckControl.CheckControlCode;
|
||||
}
|
||||
else
|
||||
{
|
||||
BLL.CheckControlService.UpdateCheckControlForApi(CheckControl);
|
||||
//BLL.AttachFileService.updateAttachFile(CheckControl.ReAttachUrl, CheckControl.CheckControlCode + "r", Const.CheckListMenuId);
|
||||
//BLL.AttachFileService.updateAttachFile(CheckControl.AttachUrl, CheckControl.CheckControlCode, Const.CheckListMenuId);
|
||||
SaveAttachFile(CheckControl.CheckControlCode + "r", BLL.Const.CheckListMenuId, CheckControl.ReAttachUrl);
|
||||
SaveAttachFile(CheckControl.CheckControlCode, BLL.Const.CheckListMenuId, CheckControl.AttachUrl);
|
||||
res.resultValue = CheckControl.CheckControlCode;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,12 +25,12 @@ namespace Mvc.Controllers
|
||||
/// <returns></returns>
|
||||
|
||||
[HttpGet]
|
||||
public ResponseData<List<dynamic>> GetGroupProjectName(int ProjectQualityType)
|
||||
public ResponseData<List<dynamic>> GetGroupProjectName(string Keyword, int PageNumber = 1, int PageSize=15 )
|
||||
{
|
||||
ResponseData<List<dynamic>> res = new ResponseData<List<dynamic>>();
|
||||
|
||||
res.successful = true;
|
||||
res.resultValue = BLL.ProjectQualityService.GetGroupProjectName(ProjectQualityType);
|
||||
res.resultValue = BLL.ProjectQualityService.GetGroupProjectName( PageNumber, PageSize, Keyword);
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -41,11 +41,11 @@ namespace Mvc.Controllers
|
||||
/// <returns></returns>
|
||||
|
||||
[HttpGet]
|
||||
public ResponseData<List<dynamic>> GetGroupProjectQualityDes(string projectName)
|
||||
public ResponseData<List<dynamic>> GetGroupProjectQualityDes(string projectName, string keyword = "")
|
||||
{
|
||||
ResponseData<List<dynamic>> res = new ResponseData<List<dynamic>>();
|
||||
res.successful = true;
|
||||
res.resultValue = BLL.ProjectQualityService.GetGroupProjectQualityDes(projectName);
|
||||
res.resultValue = BLL.ProjectQualityService.GetGroupProjectQualityDes(projectName, keyword);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ namespace WebAPI.Controllers.HSSE
|
||||
try
|
||||
{
|
||||
var query = (from x in Funs.DB.Technique_Rectify
|
||||
where x.IsEndLever == true
|
||||
select new
|
||||
{
|
||||
x.RectifyId,
|
||||
|
||||
@@ -62,12 +62,12 @@ namespace WebAPI.Controllers.HSSE
|
||||
#endregion
|
||||
|
||||
#region 获取专检主项列表
|
||||
public Model.ResponeData getInspectionList(string ProjectId, string States, int PageNumber, int PageSize)
|
||||
public Model.ResponeData getInspectionList(string ProjectId, string States, int PageNumber, int PageSize, string type = "1")
|
||||
{
|
||||
var responeData = new Model.ResponeData();
|
||||
try
|
||||
{
|
||||
responeData.data = Inspect_InspectionService.GetInspectionList(ProjectId, States, PageNumber, PageSize);
|
||||
responeData.data = Inspect_InspectionService.GetInspectionList(ProjectId, type, States, PageNumber, PageSize);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -122,7 +122,7 @@ namespace WebAPI.Controllers.HSSE
|
||||
#endregion
|
||||
|
||||
#region 根据项目和检查日期获取专检 (公司级查询)
|
||||
public Model.ResponeData getInspectionByProjectIdAndCheckDate(string projectId, string checkDate)
|
||||
public Model.ResponeData getInspectionByProjectIdAndCheckDate(string projectId, string checkDate, string type)
|
||||
{
|
||||
var responeData = new Model.ResponeData();
|
||||
try
|
||||
@@ -130,6 +130,7 @@ namespace WebAPI.Controllers.HSSE
|
||||
DateTime mdate = Funs.GetNewDateTimeOrNow(checkDate);
|
||||
|
||||
var getDataLists = (from x in Funs.DB.Inspect_Inspection
|
||||
where x.InspectType == type
|
||||
select new InspectionDto
|
||||
{
|
||||
InspectionId = x.InspectionId,
|
||||
@@ -151,9 +152,9 @@ namespace WebAPI.Controllers.HSSE
|
||||
where a.InspectionId == x.InspectionId
|
||||
select a).Count().ToString(),
|
||||
});
|
||||
if (!string.IsNullOrEmpty(projectId))
|
||||
if (!string.IsNullOrEmpty(projectId)&&projectId!=null)
|
||||
{
|
||||
getDataLists = getDataLists.Where(q => q.ProjectId == projectId&&q.InspectType == "1");
|
||||
getDataLists = getDataLists.Where(q => q.ProjectId == projectId);
|
||||
}
|
||||
|
||||
getDataLists = getDataLists.Where(q => q.CreateTime.Value.Year == mdate.Year
|
||||
|
||||
Reference in New Issue
Block a user