114 lines
5.0 KiB
C#
114 lines
5.0 KiB
C#
using BLL;
|
|
using FineUIPro.Web.ZHGL.DataSync;
|
|
using Model;
|
|
using NPOI.SS.Formula.Functions;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Runtime.Remoting.Metadata.W3cXsd2001;
|
|
using System.Threading.Tasks;
|
|
using System.Web.Services;
|
|
using System.Web.UI.WebControls;
|
|
|
|
namespace FineUIPro.Web.common
|
|
{
|
|
public partial class main : PageBase
|
|
{
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 看板数据
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[WebMethod]
|
|
public static object GetMainData()
|
|
{
|
|
try
|
|
{
|
|
var page = new main();
|
|
MainSevice mainSevice = new MainSevice(page.CurrUser.UserId);
|
|
|
|
// 获取数据
|
|
var hsseData = Task.Run(() => mainSevice.GetHsseData()).Result;
|
|
//var hiddenDangerList = mainSevice.GetDataHiddenDangerDetailItems();
|
|
|
|
// 获取项目数据
|
|
int unitType = CommonService.GetUnitTypeByUserId(page.CurrUser.UserId);
|
|
var projects = new List<Base_Project>();
|
|
|
|
if (unitType == 0)
|
|
{
|
|
projects = Funs.DB.Base_Project.Where(x => x.MapCoordinates != null && (x.IsDelete == null || x.IsDelete == false)).ToList();
|
|
}
|
|
else if (unitType == 1)
|
|
{
|
|
projects = Funs.DB.Base_Project.Where(x => x.UnitId == page.CurrUser.UnitId && x.MapCoordinates != null && (x.IsDelete == null || x.IsDelete == false)).ToList();
|
|
}
|
|
|
|
//安全生产天数
|
|
int workSafetyDays = DateHelper.DaysDifference(new DateTime(2020, 5, 20), DateTime.Today);
|
|
//事故事件
|
|
var list = AccidentWarningService.GetYearsTodayList();
|
|
|
|
// 构造返回数据
|
|
return new
|
|
{
|
|
success = true,
|
|
data = new
|
|
{
|
|
accidentWarning = (from x in list select new { Title = x.Title, AccidentDate = x.AccidentDate.ToString("yyyy-MM-dd") }).ToList(),
|
|
org = new
|
|
{
|
|
//groupSum = (hsseData.HeadOfficeInspectorGeneralNum ?? 0) + (hsseData.HeadOfficeFullTimeNum ?? 0),
|
|
//director = hsseData.HeadOfficeInspectorGeneralNum ?? 0,
|
|
//fullTime = hsseData.HeadOfficeFullTimeNum ?? 0,
|
|
//enterpriseSum = 0,
|
|
//branchDirector = hsseData.BranchInspectorGeneralNum ?? 0,
|
|
//branchFullTime = hsseData.BranchFullTimeNum ?? 0,
|
|
//attentionSafetyEngineer = hsseData.SafetyInjectionEngineer ?? 0,
|
|
//projectDirector = hsseData.ProjectInspectorGeneralNum ?? 0,
|
|
//projectFullTime = hsseData.ProjectFullTimeNum ?? 0,
|
|
//projectSafetyMonitoring = hsseData.ProjectSafetyMonitorNum ?? 0,
|
|
//aCard = hsseData.CertificateANum ?? 0,
|
|
//bCard = hsseData.CertificateBNum ?? 0,
|
|
//cCard = hsseData.CertificateCNum ?? 0
|
|
},
|
|
projectInfo = new
|
|
{
|
|
workSafetyDay1 = (workSafetyDays % 10),
|
|
workSafetyDay10 = ((workSafetyDays % 100) / 10),
|
|
workSafetyDay100 = ((workSafetyDays % 1000) / 100),
|
|
workSafetyDay1000 = ((workSafetyDays % 10000) / 1000),
|
|
projectsUnderConstruction = hsseData.BeUnderConstructionNum ?? 0,
|
|
shutdownProject = hsseData.ShutdownNum ?? 0,
|
|
participateInNum = hsseData.JoinConstructionPersonNum ?? 0,
|
|
dangerousProject = hsseData.MajorProjectsUnderConstructionNum ?? 0
|
|
},
|
|
//项目地图数据
|
|
chinaData = projects.Select(p => new
|
|
{
|
|
id = p.ProjectId,
|
|
name = p.ShortName,
|
|
projectMoney = p.ProjectMoney,
|
|
startDate = p.StartDate != null ? ((DateTime)p.StartDate).ToString("yyyy-MM-dd") : string.Empty,
|
|
endDate = p.EndDate != null ? ((DateTime)p.EndDate).ToString("yyyy-MM-dd") : string.Empty,
|
|
address = p.ProjectAddress,
|
|
value = p.MapCoordinates.Split(','),
|
|
}).ToList()
|
|
}
|
|
};
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return new { success = false, msg = ex.Message };
|
|
}
|
|
}
|
|
}
|
|
} |