优化现场人员统计
This commit is contained in:
parent
dc3f0bdc97
commit
7c43296f41
|
@ -13,6 +13,7 @@ using System.Web.UI;
|
|||
using System.Web.UI.WebControls;
|
||||
using Org.BouncyCastle.Ocsp;
|
||||
using FineUIPro.Web.HJGL.FL;
|
||||
using System.Data;
|
||||
|
||||
namespace FineUIPro.Web.common
|
||||
{
|
||||
|
@ -983,20 +984,48 @@ namespace FineUIPro.Web.common
|
|||
{
|
||||
int AllCount = 0;
|
||||
int MCount = 0;
|
||||
var getallin = new List<Model.PageDataPersonInOutItem>();
|
||||
if (pids == null)
|
||||
//var getallin = new List<Model.PageDataPersonInOutItem>();
|
||||
//if (pids == null)
|
||||
//{
|
||||
// getallin = APIPageDataService.getPersonNum(new List<string>(), DateTime.Now);
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// getallin = APIPageDataService.getPersonNum(pids.ToList(), DateTime.Now);
|
||||
//}
|
||||
|
||||
|
||||
var startDate = DateTime.Now.Date;
|
||||
var endDate = startDate.AddDays(1);
|
||||
|
||||
string strSql = @"select ProjectId,PostType,COUNT(distinct PersonId)PersonNum from SitePerson_PersonInOutNow
|
||||
where ChangeTime >= '" + startDate.ToString("yyyy-MM-dd") + "' and ChangeTime <='" + endDate.ToString("yyyy-MM-dd") + "' and ProjectId in ('" + string.Join("','", allProjects.Select(x => x.ProjectId)) + @"')
|
||||
group by ProjectId,PostType";
|
||||
|
||||
DataTable dt = SQLHelper.GetDataTableRunText(strSql, null);
|
||||
Dictionary<string, int> dic = new Dictionary<string, int>();
|
||||
foreach (DataRow row in dt.Rows)
|
||||
{
|
||||
getallin = APIPageDataService.getPersonNum(new List<string>(), DateTime.Now);
|
||||
string projectid = row["ProjectId"].ToString();
|
||||
string postType = row["PostType"].ToString();
|
||||
int PersonNum = int.Parse(row["PersonNum"].ToString());
|
||||
if (!dic.ContainsKey(projectid))
|
||||
{
|
||||
dic.Add(projectid, PersonNum);
|
||||
}
|
||||
else
|
||||
{
|
||||
getallin = APIPageDataService.getPersonNum(pids.ToList(), DateTime.Now);
|
||||
dic[projectid] = dic[projectid] + PersonNum;
|
||||
}
|
||||
AllCount = getallin.Count();
|
||||
if (AllCount > 0)
|
||||
AllCount += PersonNum;
|
||||
if(postType == Const.PostType_1)
|
||||
{
|
||||
MCount = getallin.Count(x => x.PostType == Const.PostType_1);
|
||||
MCount += PersonNum;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
div_xcrs.InnerHtml = AllCount.ToString();
|
||||
div_zyxcrs.InnerHtml = (AllCount - MCount).ToString();
|
||||
|
@ -1006,7 +1035,14 @@ namespace FineUIPro.Web.common
|
|||
foreach (var item in allProjects)
|
||||
{
|
||||
ProjectPersonMc += "'" + item.ShortName + "',";
|
||||
ProjectPersonCount += "'" + getallin.Count(x => x.ProjectId == item.ProjectId) + "',";
|
||||
if (dic.ContainsKey(item.ProjectId))
|
||||
{
|
||||
ProjectPersonCount += "'" + dic[item.ProjectId] + "',";
|
||||
}
|
||||
else
|
||||
{
|
||||
ProjectPersonCount += "'0',";
|
||||
}
|
||||
}
|
||||
ProjectPersonMc = !string.IsNullOrWhiteSpace(ProjectPersonMc) ? ProjectPersonMc.TrimEnd(',') : string.Empty;
|
||||
ProjectPersonCount = !string.IsNullOrWhiteSpace(ProjectPersonCount) ? ProjectPersonCount.TrimEnd(',') : string.Empty;
|
||||
|
|
Loading…
Reference in New Issue