This commit is contained in:
2024-11-20 09:08:00 +08:00
parent f1abdbc6d0
commit 9300d77ab0
181 changed files with 28244 additions and 119 deletions
@@ -1,5 +1,7 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Net;
using System.Net.Http;
@@ -184,5 +186,95 @@ namespace WebAPI.Controllers
return responeData;
}
#endregion
public Model.ResponeData GetReportQueryByProjectId(string projectId, string unitId)
{
var responeData = new Model.ResponeData();
try
{
List<Dictionary<string, string>> res = new List<Dictionary<string, string>>();
Dictionary<string, Dictionary<string, string>> tempDic = new Dictionary<string, Dictionary<string, string>>();
string sql31 = @"SELECT WorkArea.WorkAreaId, WorkArea.WorkAreaName, SUM(JOT_Size) total_jot, SUM(JOT_DoneDin) finished_total_jot
FROM pw_jointinfo
LEFT JOIN pw_isoinfo ON pw_jointinfo.ISO_ID = pw_isoinfo.ISO_ID
LEFT JOIN ProjectData_WorkArea WorkArea ON WorkArea.WorkAreaId = pw_isoinfo.WorkAreaId
WHERE pw_jointinfo.ProjectId = @projectId";
if (!string.IsNullOrEmpty(unitId) || unitId != CommonService.GetThisUnitId())
{
sql31 += " AND pw_isoinfo.UnitId = @unitId";
}
sql31 += " GROUP BY WorkArea.WorkAreaId, WorkArea.WorkAreaName";
SqlCommand command = new SqlCommand(sql31);
command.Parameters.AddWithValue("@projectId", projectId);
if (!string.IsNullOrEmpty(unitId))
{
command.Parameters.AddWithValue("@unitId", unitId);
}
DataTable tb31 = SQLHelper.GetDataTableRunCommand(command);
if (tb31 != null)
{
foreach (DataRow row in tb31.Rows)
{
Dictionary<string, string> dic = new Dictionary<string, string>();
dic.Add("WorkAreaName", row["WorkAreaName"].ToString());
dic.Add("finishRate", (100.0 * Funs.GetNewDoubleOrZero(row["finished_total_jot"].ToString()) / Funs.GetNewDoubleOrZero(row["total_jot"].ToString())).ToString("#0.00"));
tempDic.Add(row["WorkAreaName"].ToString(), dic);
res.Add(dic);
}
}
string sql41 = @"SELECT WorkArea.WorkAreaId, WorkArea.WorkAreaName, SUM(cht_totalfilm) total_film, SUM(cht_passfilm) pass_film
FROM CH_CheckItem ch_checkitem
LEFT JOIN PW_JointInfo JointInfo ON JointInfo.JOT_ID = ch_checkitem.JOT_ID
LEFT JOIN PW_IsoInfo IsoInfo ON IsoInfo.ISO_ID = JointInfo.ISO_ID
LEFT JOIN ProjectData_WorkArea WorkArea ON WorkArea.WorkAreaId = IsoInfo.WorkAreaId
WHERE JointInfo.ProjectId = @projectId";
if (!string.IsNullOrEmpty(unitId) || unitId != CommonService.GetThisUnitId())
{
sql41 += " AND IsoInfo.UnitId = @unitId";
}
sql41 += " GROUP BY WorkArea.WorkAreaId, WorkArea.WorkAreaName";
SqlCommand command2 = new SqlCommand(sql41);
command2.Parameters.AddWithValue("@projectId", projectId);
if (!string.IsNullOrEmpty(unitId))
{
command2.Parameters.AddWithValue("@unitId", unitId);
}
DataTable tb41 = SQLHelper.GetDataTableRunCommand(command2);
if (tb41 != null)
{
foreach (DataRow row in tb41.Rows)
{
Dictionary<string, string> dic;
if (tempDic.TryGetValue(row["WorkAreaName"].ToString(), out dic))
{
dic.Add("passRate", (100.0 * Funs.GetNewDoubleOrZero(row["pass_film"].ToString()) / Funs.GetNewDoubleOrZero(row["total_film"].ToString())).ToString("#0.00"));
}
else
{
dic = new Dictionary<string, string>();
dic.Add("WorkAreaName", row["WorkAreaName"].ToString());
dic.Add("finishRate", "0");
dic.Add("passRate", (100.0 * Funs.GetNewDoubleOrZero(row["pass_film"].ToString()) / Funs.GetNewDoubleOrZero(row["total_film"].ToString())).ToString("#0.00"));
res.Add(dic);
}
}
}
responeData.data = res;
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
}
}
@@ -35,5 +35,84 @@ namespace WebAPI.Controllers
return responeData;
}
#endregion
#region ID
/// <summary>
/// 根据项目ID 获取整改单数据
/// </summary>
/// <param name="projectId">项目ID</param>
/// <returns></returns>
public Model.ResponeData getHSSERectifyNoticesChartAnalysis(string projectId)
{
var responeData = new Model.ResponeData();
try
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
int allCount = 0, uCount = 0, cCount = 0;
double rate = 1;
var getRectifyNotices = from x in db.Check_RectifyNotices
where x.States != Const.State_0 && x.States != null && x.ProjectId == projectId
select x;
if (!string.IsNullOrEmpty(projectId) && projectId != "")
{
getRectifyNotices = getRectifyNotices.Where(x => x.ProjectId == projectId);
}
//// 整改总数
allCount = getRectifyNotices.Count();
if (allCount > 0)
{
//// 已闭环
cCount = getRectifyNotices.Where(x => x.States == "5").Count();
uCount = allCount - cCount;
rate = Math.Round(uCount * 1.0 / allCount * 100, 1);
}
responeData.data = new { allCount, uCount, rate };
}
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
#endregion
#region ID
/// <summary>
/// 根据项目ID 获取整改单数据
/// </summary>
/// <param name="projectId">项目ID</param>
/// <returns></returns>
public Model.ResponeData getHSSEPersonQualityChartAnalysis(string projectId)
{
var responeData = new Model.ResponeData();
try
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
int allCount = 0;
var getPersonQualitys = from x in db.QualityAudit_PersonQuality
join y in db.SitePerson_Person on x.PersonId equals y.PersonId
where (projectId == null || projectId == "" || y.ProjectId == projectId)
&& x.LimitDate.HasValue && x.LimitDate < DateTime.Now
select x;
//// 预警人数
allCount = getPersonQualitys.Count();
responeData.data = new { allCount };
}
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
#endregion
}
}
@@ -218,18 +218,33 @@ namespace WebAPI.Controllers
/// <param name="strPass">0-未通过;1通过;空所有</param>
/// <param name="pageIndex">页码</param>
/// <returns>考试记录列表</returns>
public Model.ResponeData getTrainingTestRecordListQuery(string projectId, string unitId, string workPostId, string strPass, int pageIndex)
public Model.ResponeData getTrainingTestRecordListQuery(string projectId, string unitId, string workPostId, string departId, string strPass, int pageIndex)
{
var responeData = new Model.ResponeData();
try
{
var getDataLists = APITestRecordService.getTrainingTestRecordListByProjectId(projectId, unitId, workPostId, strPass, string.Empty);
int pageCount = getDataLists.Count;
if (pageCount > 0 && pageIndex > 0)
if (!string.IsNullOrEmpty(departId))
{
getDataLists = getDataLists.OrderByDescending(x => x.TestStartTime).Skip(Funs.PageSize * (pageIndex - 1)).Take(Funs.PageSize).ToList();
var getDataLists = APITestRecordService.getTrainingTestRecordListByDepartId(unitId, departId, strPass, string.Empty);
int pageCount = getDataLists.Count;
if (pageCount > 0 && pageIndex > 0)
{
getDataLists = getDataLists.OrderByDescending(x => x.TestStartTime).Skip(Funs.PageSize * (pageIndex - 1)).Take(Funs.PageSize).ToList();
}
responeData.data = new { pageCount, getDataLists };
}
else
{
var getDataLists = APITestRecordService.getTrainingTestRecordListByProjectId(projectId, unitId, workPostId, strPass, string.Empty);
int pageCount = getDataLists.Count;
if (pageCount > 0 && pageIndex > 0)
{
getDataLists = getDataLists.OrderByDescending(x => x.TestStartTime).Skip(Funs.PageSize * (pageIndex - 1)).Take(Funs.PageSize).ToList();
}
responeData.data = new { pageCount, getDataLists };
}
responeData.data = new { pageCount, getDataLists };
}
catch (Exception ex)
{
@@ -240,38 +255,6 @@ namespace WebAPI.Controllers
}
#endregion
#region ProjectId获取所有考试记录列表
/// <summary>
/// 根据ProjectId获取所有考试记录列表
/// </summary>
/// <param name="projectId">项目ID</param>
/// <param name="unitId">单位ID</param>
/// <param name="workPostId">岗位ID</param>
/// <param name="strPass">0-未通过;1通过;空所有</param>
/// <param name="strParam">参数</param>
/// <param name="pageIndex">页码</param>
/// <returns>考试记录列表</returns>
public Model.ResponeData getTrainingTestRecordListQuery(string projectId, string unitId, string workPostId, string strPass,string strParam, int pageIndex)
{
var responeData = new Model.ResponeData();
try
{
var getDataLists = APITestRecordService.getTrainingTestRecordListByProjectId(projectId, unitId, workPostId, strPass, strParam);
int pageCount = getDataLists.Count;
if (pageCount > 0 && pageIndex > 0)
{
getDataLists = getDataLists.OrderByDescending(x => x.TestStartTime).Skip(Funs.PageSize * (pageIndex - 1)).Take(Funs.PageSize).ToList();
}
responeData.data = new { pageCount, getDataLists };
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
#endregion
#region TestRecordItemIdselectedItem
/// <summary>
+20 -6
View File
@@ -352,18 +352,32 @@ namespace WebAPI.Controllers
/// <param name="trainTypeId">培训类型ID(可为空)</param>
/// <param name="pageIndex">分页</param>
/// <returns></returns>
public Model.ResponeData getTrainingPersonListByTrainTypeId(string projectId, string unitIds, string workPostIds, string trainTypeId, int pageIndex)
public Model.ResponeData getTrainingPersonListByTrainTypeId(string projectId, string unitIds, string workPostIds, string departIds, string trainTypeId, int pageIndex, string strParam, string InTime)
{
var responeData = new Model.ResponeData();
try
{
var getDataList = APIPersonService.getTrainingPersonListByTrainTypeId(projectId, unitIds, workPostIds, trainTypeId).OrderBy(x => x.UnitName).ThenBy(x => x.ProjectName).ToList();
int pageCount = getDataList.Count;
if (pageCount > 0 && pageIndex > 0)
if (string.IsNullOrEmpty(projectId))
{
getDataList = getDataList.OrderBy(u => u.UnitName).ThenBy(u => u.PersonName).Skip(Funs.PageSize * (pageIndex - 1)).Take(Funs.PageSize).ToList(); ////200 ->Funs.PageSize
var getDataList = APIPersonService.getTrainingPersonListByDepartAndTrainTypeId(unitIds, departIds, trainTypeId).OrderBy(x => x.UnitName).ThenBy(x => x.ProjectName).ToList();
int pageCount = getDataList.Count;
if (pageCount > 0 && pageIndex > 0)
{
getDataList = getDataList.OrderBy(u => u.UnitName).ThenBy(u => u.PersonName).Skip(Funs.PageSize * (pageIndex - 1)).Take(Funs.PageSize).ToList(); ////200 ->Funs.PageSize
}
responeData.data = new { pageCount, getDataList };
}
else
{
var getDataList = APIPersonService.getTrainingPersonListByTrainTypeId(projectId, unitIds, workPostIds, departIds, trainTypeId, InTime, strParam).OrderBy(x => x.UnitName).ThenBy(x => x.ProjectName).ToList();
int pageCount = getDataList.Count;
if (pageCount > 0 && pageIndex > 0)
{
getDataList = getDataList.OrderBy(u => u.UnitName).ThenBy(u => u.PersonName).Skip(Funs.PageSize * (pageIndex - 1)).Take(Funs.PageSize).ToList(); ////200 ->Funs.PageSize
}
responeData.data = new { pageCount, getDataList };
}
responeData.data = new { pageCount, getDataList };
}
catch (Exception ex)
{
+144
View File
@@ -0,0 +1,144 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Http;
using System.Web.Mvc;
namespace WebAPI.Controllers
{
public class ShouYeController : ApiController
{
#region HSSE首页数据
/// <summary>
/// 获取HSSE首页数据
/// </summary>
/// <returns></returns>
public Model.ResponeData getHsse( )
{
var responeData = new Model.ResponeData();
try
{
responeData.data = BLL.API.APIIndexService.hsse();
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
#endregion
#region HSSE首页隐患排查治理数据明细
/// <summary>
/// 获取HSSE首页隐患排查治理数据明细
/// </summary>
/// <returns></returns>
public Model.ResponeData getHiddenDanger()
{
var responeData = new Model.ResponeData();
try
{
responeData.data = BLL.API.APIIndexService.hiddenDanger();
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
#endregion
#region CQMS首页
/// <summary>
/// 获取CQMS首页
/// </summary>
/// <returns></returns>
public Model.ResponeData getCqms()
{
var responeData = new Model.ResponeData();
try
{
responeData.data = BLL.API.APIIndexService.cqms();
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
#endregion
#region HJGL首页
/// <summary>
/// 获取HJGL首页
/// </summary>
/// <returns></returns>
public Model.ResponeData getHjgl()
{
var responeData = new Model.ResponeData();
try
{
responeData.data = BLL.API.APIIndexService.hjgl();
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
#endregion
#region
/// <summary>
/// 获取焊接缺陷
/// </summary>
/// <returns></returns>
public Model.ResponeData getDefect()
{
var responeData = new Model.ResponeData();
try
{
responeData.data = BLL.API.APIIndexService.defect();
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
#endregion
#region SHIYE首页
/// <summary>
/// 获取SHIYE首页
/// </summary>
/// <returns></returns>
public Model.ResponeData getShiye()
{
var responeData = new Model.ResponeData();
try
{
responeData.data = BLL.API.APIIndexService.shiye();
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
#endregion
}
}