20240624 PU看板接口推送修改
This commit is contained in:
parent
e962cf661d
commit
f67d7129ae
Binary file not shown.
|
@ -23,7 +23,7 @@ namespace BLL
|
||||||
{
|
{
|
||||||
List<ProjectDataItem> projectDataItems = new List<ProjectDataItem>();
|
List<ProjectDataItem> projectDataItems = new List<ProjectDataItem>();
|
||||||
|
|
||||||
var projectlist = ProjectService.GetProjectWorkList().Where(x=>x.ProjectCode== "E21028");
|
var projectlist = ProjectService.GetProjectWorkList();
|
||||||
foreach (var item in projectlist)
|
foreach (var item in projectlist)
|
||||||
{
|
{
|
||||||
var getSGName = (from x in db.Project_ProjectUnit
|
var getSGName = (from x in db.Project_ProjectUnit
|
||||||
|
@ -31,21 +31,35 @@ namespace BLL
|
||||||
where x.ProjectId == item.ProjectId && x.UnitType == Const.ProjectUnitType_2
|
where x.ProjectId == item.ProjectId && x.UnitType == Const.ProjectUnitType_2
|
||||||
select y.UnitName);
|
select y.UnitName);
|
||||||
ProjectDataItem projectDataItem = new ProjectDataItem();
|
ProjectDataItem projectDataItem = new ProjectDataItem();
|
||||||
projectDataItem.projectnumber = item.ProjectCode;
|
projectDataItem.projectnumber = item.ProjectCode??"";
|
||||||
projectDataItem.projectname = item.ProjectName;
|
projectDataItem.projectname = item.ProjectName ?? "";
|
||||||
projectDataItem.projcost = item.ProjectMoney.ToString();
|
projectDataItem.projcost = item.ProjectMoney.ToString() ?? "";
|
||||||
projectDataItem.buildco = item.WorkRange;
|
projectDataItem.buildco = "";
|
||||||
projectDataItem.constructionco= string .Join(",", getSGName);
|
projectDataItem.constructionco= string .Join(",", getSGName) ?? "";
|
||||||
|
projectDataItem.remains = "";
|
||||||
|
projectDataItem.contractdurition = "";
|
||||||
|
projectDataItem.contractenddate = "";
|
||||||
|
projectDataItem.supervisoryco = "";
|
||||||
|
projectDataItem.onsiteworkers = "";
|
||||||
|
projectDataItem.risknum = "";
|
||||||
|
projectDataItem.accidentsnum = "";
|
||||||
|
projectDataItem.constructionnum = "";
|
||||||
|
|
||||||
string unit_JL = ProjectService.getProjectUnitNameByUnitType(item.ProjectId, Const.ProjectUnitType_3);
|
string unit_JL = ProjectService.getProjectUnitNameByUnitType(item.ProjectId, Const.ProjectUnitType_3);
|
||||||
|
string unit_yz = ProjectService.getProjectUnitNameByUnitType(item.ProjectId, Const.ProjectUnitType_4);
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(unit_JL))
|
if (!string.IsNullOrEmpty(unit_JL))
|
||||||
{
|
{
|
||||||
projectDataItem.supervisoryco = unit_JL;
|
projectDataItem.supervisoryco = unit_JL ?? "";
|
||||||
}
|
}
|
||||||
|
if (!string.IsNullOrEmpty(unit_yz))
|
||||||
|
{
|
||||||
|
projectDataItem.buildco = unit_yz ?? "";
|
||||||
|
|
||||||
|
}
|
||||||
if (item.EndDate.HasValue)
|
if (item.EndDate.HasValue)
|
||||||
{
|
{
|
||||||
projectDataItem.contractenddate = string.Format("{0:yyyy-MM-dd}", item.EndDate);
|
projectDataItem.contractenddate = string.Format("{0:yyyy-MM-dd}", item.EndDate) ?? "";
|
||||||
|
|
||||||
if (item.StartDate.HasValue)
|
if (item.StartDate.HasValue)
|
||||||
{
|
{
|
||||||
|
@ -56,12 +70,47 @@ namespace BLL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
projectDataItem.location = item.ProjectAddress;
|
projectDataItem.location = item.ProjectAddress ?? "";
|
||||||
projectDataItem.safehours = Project_HSSEData_HSSEService.GetSafeWorkingHour(item.ProjectId).ToString();
|
projectDataItem.safehours = Project_HSSEData_HSSEService.GetSafeWorkingHour(item.ProjectId).ToString() ?? "";
|
||||||
projectDataItem.losshours = Project_HSSEData_HSSEService.GetLostWorkingHour(item.ProjectId).ToString();
|
projectDataItem.losshours = Project_HSSEData_HSSEService.GetLostWorkingHour(item.ProjectId).ToString() ?? "";
|
||||||
List<Model.Comprehensive_NCRManagement> NondestructiveTestList = (from x in db.Comprehensive_NCRManagement
|
List<Model.Comprehensive_NCRManagement> NondestructiveTestList = (from x in db.Comprehensive_NCRManagement
|
||||||
where x.ProjectId == item.ProjectId && (x.IssuedDate ==null || x.IssuedDate >DateTime.Now) select x).ToList();
|
where x.ProjectId == item.ProjectId && (x.IssuedDate ==null || x.IssuedDate >DateTime.Now) select x).ToList();
|
||||||
projectDataItem.ncr = NondestructiveTestList.Count.ToString();
|
projectDataItem.ncr = NondestructiveTestList.Count.ToString() ?? "";
|
||||||
|
|
||||||
|
var ProjectTotal1 = (from x in Funs.DB.HSSE_MonthReportItem
|
||||||
|
join y in Funs.DB.HSSE_MonthReport on x.MonthReportId equals y.MonthReportId
|
||||||
|
// where ("成达公司HSE管理人数" == x.ReportItem || "分包商HSE管理人数" == x.ReportItem) && y.Years == DateTime.Now.Year && y.ProjectId==CurrUser.LoginProjectId
|
||||||
|
where ("成达公司现场人数" == x.ReportItem) && y.Years == DateTime.Now.Year && y.ProjectId == item.ProjectId
|
||||||
|
select x.YearTotal).Sum();
|
||||||
|
var ProjectTotal2 = (from x in Funs.DB.HSSE_MonthReportItem
|
||||||
|
join y in Funs.DB.HSSE_MonthReport on x.MonthReportId equals y.MonthReportId
|
||||||
|
// where ("成达公司现场人数" == x.ReportItem || "分包商现场人数" == x.ReportItem) && y.Years == DateTime.Now.Year && y.ProjectId == CurrUser.LoginProjectId
|
||||||
|
where ("分包商现场人数" == x.ReportItem) && y.Years == DateTime.Now.Year && y.ProjectId == item.ProjectId
|
||||||
|
select x.YearTotal).Sum();
|
||||||
|
|
||||||
|
if (ProjectTotal2.HasValue && ProjectTotal1.HasValue)
|
||||||
|
{
|
||||||
|
projectDataItem.onsiteworkers = (ProjectTotal1.Value + ProjectTotal2.Value).ToString();//项目现场总人数
|
||||||
|
}
|
||||||
|
|
||||||
|
var getHazards = from x in Funs.DB.Hazard_HazardSelectedItem
|
||||||
|
join y in Funs.DB.Base_RiskLevel on x.HazardLevel equals y.RiskLevelId
|
||||||
|
where x.ProjectId == item.ProjectId && x.IsStart == true
|
||||||
|
select new { x.HazardSelectedItemId, y.RiskLevel };
|
||||||
|
projectDataItem.risknum = getHazards.Count(x => x.RiskLevel == 1).ToString();//一级风险预警数量
|
||||||
|
|
||||||
|
var accidentNum1 = (from x in Funs.DB.Accident_AccidentPersonRecord
|
||||||
|
join y in Funs.DB.Base_AccidentType on x.AccidentTypeId equals y.AccidentTypeId
|
||||||
|
where x.ProjectId == item.ProjectId
|
||||||
|
select x).Count();
|
||||||
|
|
||||||
|
var accidentNum2 = (from x in Funs.DB.Accident_AccidentReport
|
||||||
|
where x.ProjectId == item.ProjectId
|
||||||
|
select x).Count();
|
||||||
|
projectDataItem.accidentsnum = (accidentNum1 + accidentNum2).ToString() ?? "";//安全事故数量
|
||||||
|
|
||||||
|
projectDataItem.constructionnum= ProjectService.GetProjectWorkList().Count().ToString();//施工项目数量
|
||||||
|
|
||||||
projectDataItems.Add(projectDataItem);
|
projectDataItems.Add(projectDataItem);
|
||||||
}
|
}
|
||||||
var JsonBody = Newtonsoft.Json.JsonConvert.SerializeObject(projectDataItems);
|
var JsonBody = Newtonsoft.Json.JsonConvert.SerializeObject(projectDataItems);
|
||||||
|
|
|
@ -20,7 +20,7 @@ namespace Model
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string projcost { get; set; }
|
public string projcost { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 建设范围
|
/// 建设单位
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string buildco { get; set; }
|
public string buildco { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -166,27 +166,5 @@ namespace WebAPI.Controllers
|
||||||
{
|
{
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
/// <summary>
|
|
||||||
/// 给pu推送数据
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="url"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpGet]
|
|
||||||
public Model.ResponeData PushPuData()
|
|
||||||
{
|
|
||||||
var responeData = new Model.ResponeData();
|
|
||||||
try
|
|
||||||
{
|
|
||||||
|
|
||||||
responeData.data = APICdPuService.PushData();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
responeData.code = 0;
|
|
||||||
responeData.message = ex.Message;
|
|
||||||
}
|
|
||||||
|
|
||||||
return responeData;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using BLL;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
@ -113,5 +114,27 @@ namespace WebAPI.Controllers
|
||||||
return responeData;
|
return responeData;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 给pu推送数据
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="url"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public Model.ResponeData PushPuData()
|
||||||
|
{
|
||||||
|
var responeData = new Model.ResponeData();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
|
||||||
|
responeData.data = APICdPuService.PushData();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
responeData.code = 0;
|
||||||
|
responeData.message = ex.Message;
|
||||||
|
}
|
||||||
|
|
||||||
|
return responeData;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,9 +10,8 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||||
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
|
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
|
||||||
<LastUsedPlatform>Any CPU</LastUsedPlatform>
|
<LastUsedPlatform>Any CPU</LastUsedPlatform>
|
||||||
<PublishProvider>FileSystem</PublishProvider>
|
<PublishProvider>FileSystem</PublishProvider>
|
||||||
<PublishUrl>D:\发布\辰达</PublishUrl>
|
<PublishUrl>bin\app.publish\</PublishUrl>
|
||||||
<WebPublishMethod>FileSystem</WebPublishMethod>
|
<WebPublishMethod>FileSystem</WebPublishMethod>
|
||||||
<_TargetId>Folder</_TargetId>
|
<_TargetId>Folder</_TargetId>
|
||||||
<SiteUrlToLaunchAfterPublish />
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
Loading…
Reference in New Issue