196 lines
8.2 KiB
C#
196 lines
8.2 KiB
C#
using BLL;
|
|
using Newtonsoft.Json;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
namespace FineUIPro.Web.common
|
|
{
|
|
public partial class mainMenu_PDigData : PageBase
|
|
{
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
getEmployInOutRecords = Funs.DB.T_d_EmployInOutRecord.Where(x => x.ProjectId == this.CurrUser.LoginProjectId && x.RecordDate.Value == DateTime.Now.Date).ToList();
|
|
getPersons = Funs.DB.SitePerson_Person.Where(x => x.ProjectId == this.CurrUser.LoginProjectId && x.IsUsed == 1
|
|
&& x.InTime <= DateTime.Now && (!x.OutTime.HasValue || x.OutTime > DateTime.Now)).ToList();
|
|
///当前现场总人数
|
|
getSitePerson();
|
|
}
|
|
}
|
|
|
|
#region 当前现场总人数
|
|
/// <summary>
|
|
/// 当前现场总人数
|
|
/// </summary>
|
|
private void getSitePerson()
|
|
{
|
|
var AllCount = getEmployInOutRecords.Count();
|
|
if (AllCount > 0)
|
|
{
|
|
////总人数
|
|
this.divperson.InnerHtml = ((AllCount % 10000) / 1000).ToString();
|
|
this.person00.InnerHtml = ((AllCount % 1000) / 100).ToString();
|
|
this.person01.InnerHtml = ((AllCount % 100) / 10).ToString();
|
|
this.person02.InnerHtml = (AllCount % 10).ToString();
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 项目安全人工时
|
|
/// <summary>
|
|
/// 项目安全人工时
|
|
/// </summary>
|
|
protected string Two
|
|
{
|
|
get
|
|
{
|
|
List<Model.SingleSerie> series = new List<Model.SingleSerie>();
|
|
Model.BusinessColumn businessColumn = new Model.BusinessColumn();
|
|
List<string> listCategories = new List<string>();
|
|
businessColumn.title = "项目安全人工时";
|
|
Model.SingleSerie s = new Model.SingleSerie();
|
|
List<double> listdata = new List<double>();
|
|
|
|
Model.SingleSerie s2 = new Model.SingleSerie();
|
|
List<double> listdata2 = new List<double>();
|
|
var getMonts = SitePerson_MonthReportService.getMonthReports(CurrUser.LoginProjectId, null);
|
|
foreach (var month in getMonts.OrderBy(x => x.CompileDate))
|
|
{
|
|
listCategories.Add(string.Format("{0:yyyy-MM}", month.CompileDate));
|
|
listdata.Add(double.Parse((month.TotalPersonWorkTime ?? 0).ToString()));
|
|
listdata2.Add(double.Parse((month.DayWorkTime ?? 0).ToString()));
|
|
}
|
|
s.data = listdata;
|
|
series.Add(s);
|
|
s2.data = listdata2;
|
|
series.Add(s2);
|
|
businessColumn.categories = listCategories;
|
|
businessColumn.series = series;
|
|
return JsonConvert.SerializeObject(businessColumn);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 现场人员
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public static List<Model.T_d_EmployInOutRecord> getEmployInOutRecords;
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public static List<Model.SitePerson_Person> getPersons;
|
|
|
|
/// <summary>
|
|
/// 按单位统计
|
|
/// </summary>
|
|
protected string Four1
|
|
{
|
|
get
|
|
{
|
|
List<Model.SingleSerie> series = new List<Model.SingleSerie>();
|
|
Model.BusinessColumn businessColumn = new Model.BusinessColumn();
|
|
List<string> listCategories = new List<string>();
|
|
Model.SingleSerie s = new Model.SingleSerie();
|
|
Model.SingleSerie s2 = new Model.SingleSerie();
|
|
List<double> listdata = new List<double>();
|
|
List<double> listdata2 = new List<double>();
|
|
businessColumn.title = "现场人员";
|
|
var units = (from x in getEmployInOutRecords
|
|
select new { x.UnitId, x.UnitName }).Distinct();
|
|
if (units.Count() > 0)
|
|
{
|
|
foreach (var unit in units)
|
|
{
|
|
listCategories.Add(UnitService.GetShortUnitNameByUnitId(unit.UnitId) ?? "未知");
|
|
var unitRords = getEmployInOutRecords.Where(x => x.UnitId == unit.UnitId);
|
|
var unitPersons = getPersons.Where(x => x.UnitId == unit.UnitId);
|
|
listdata.Add(unitRords.Count());
|
|
listdata2.Add(unitPersons.Count());
|
|
}
|
|
}
|
|
else
|
|
{
|
|
var getunits = UnitService.GetUnitByProjectIdList(this.CurrUser.LoginProjectId).Take(10);
|
|
foreach (var unit in getunits)
|
|
{
|
|
string name = unit.ShortUnitName ?? unit.UnitName;
|
|
if (string.IsNullOrEmpty(unit.UnitId) || string.IsNullOrEmpty(name))
|
|
{
|
|
name = "未知";
|
|
}
|
|
listCategories.Add(unit.ShortUnitName ?? unit.UnitName);
|
|
var unitRords = getEmployInOutRecords.Where(x => x.UnitId == unit.UnitId);
|
|
var unitPersons = getPersons.Where(x => x.UnitId == unit.UnitId);
|
|
listdata.Add(unitRords.Count());
|
|
listdata2.Add(unitPersons.Count());
|
|
}
|
|
}
|
|
s.data = listdata;
|
|
series.Add(s);
|
|
|
|
s2.data = listdata2;
|
|
series.Add(s2);
|
|
|
|
businessColumn.categories = listCategories;
|
|
businessColumn.series = series;
|
|
return JsonConvert.SerializeObject(businessColumn);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 按岗位统计
|
|
/// </summary>
|
|
protected string Four2
|
|
{
|
|
get
|
|
{
|
|
List<Model.SingleSerie> series = new List<Model.SingleSerie>();
|
|
Model.BusinessColumn businessColumn = new Model.BusinessColumn();
|
|
List<string> listCategories = new List<string>();
|
|
Model.SingleSerie s = new Model.SingleSerie();
|
|
List<double> listdata = new List<double>();
|
|
Model.SingleSerie s2 = new Model.SingleSerie();
|
|
List<double> listdata2 = new List<double>();
|
|
businessColumn.title = "现场人员";
|
|
var getTypes = (from x in getEmployInOutRecords
|
|
select new { x.PostId, x.PostName }).Distinct();
|
|
if (getTypes.Count() > 0)
|
|
{
|
|
foreach (var item in getTypes)
|
|
{
|
|
listCategories.Add(item.PostName ?? "未知");
|
|
var unitRords = getEmployInOutRecords.Where(x => x.PostId == item.PostId);
|
|
var unitPersons = getPersons.Where(x => x.WorkPostId == item.PostId);
|
|
listdata.Add(unitRords.Count());
|
|
listdata2.Add(unitPersons.Count());
|
|
}
|
|
}
|
|
else
|
|
{
|
|
var getpTypes = getPersons.Select(x => x.WorkPostId).Distinct();
|
|
foreach (var item in getpTypes)
|
|
{
|
|
listCategories.Add(WorkPostService.getWorkPostNameById(item));
|
|
var unitRords = getEmployInOutRecords.Where(x => x.PostId == item);
|
|
var unitPersons = getPersons.Where(x => x.WorkPostId == item);
|
|
listdata.Add(unitRords.Count());
|
|
listdata2.Add(unitPersons.Count());
|
|
}
|
|
}
|
|
|
|
s.data = listdata;
|
|
series.Add(s);
|
|
s2.data = listdata2;
|
|
series.Add(s2);
|
|
businessColumn.categories = listCategories;
|
|
businessColumn.series = series;
|
|
return JsonConvert.SerializeObject(businessColumn);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
}
|
|
} |