大屏优化
This commit is contained in:
@@ -6,10 +6,12 @@ using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.Caching;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using Org.BouncyCastle.Ocsp;
|
||||
|
||||
namespace FineUIPro.Web.common
|
||||
{
|
||||
@@ -18,7 +20,7 @@ namespace FineUIPro.Web.common
|
||||
List<Model.Base_Project> allProjects;
|
||||
public static List<Model.Solution_LargerHazard> LargerHazard = new List<Model.Solution_LargerHazard>();
|
||||
|
||||
public string[] pids { get; set; }
|
||||
public string[] pids { get; set; }
|
||||
protected async void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
@@ -145,6 +147,8 @@ namespace FineUIPro.Web.common
|
||||
// 质量统计模块封装
|
||||
private async Task BindQualityStatisticsAsync()
|
||||
{
|
||||
await Task.Run(() => {
|
||||
|
||||
var db = Funs.DB;
|
||||
// 质量管理人员(合并公司+项目级查询)
|
||||
var qualityQuery = db.Base_WorkPost
|
||||
@@ -161,13 +165,13 @@ namespace FineUIPro.Web.common
|
||||
divCqmsPxNum.InnerText = db.Comprehensive_InspectionPerson
|
||||
.Where(x => pids.Contains(x.ProjectId))
|
||||
.Count(x => x.IsTrain == true).ToString();
|
||||
});
|
||||
}
|
||||
// 项目统计优化
|
||||
private async Task BindProjectStatisticsAsync()
|
||||
{
|
||||
var db = Funs.DB;
|
||||
|
||||
|
||||
await Task.Run(() => {
|
||||
var db = Funs.DB;
|
||||
int acount = allProjects.Count();
|
||||
int pcount1 = 0;
|
||||
int pcount2 = 0;
|
||||
@@ -190,6 +194,7 @@ namespace FineUIPro.Web.common
|
||||
div_zjxmCount.InnerHtml = pcount1.ToString() + "<div class=\"th\">个</div>";
|
||||
div_cjrsCount.InnerHtml = pcount2.ToString() + "<div class=\"th\">人</div>";
|
||||
div_wdgcCount.InnerHtml = pcount3.ToString() + "<div class=\"th\">个</div>";
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -304,7 +309,7 @@ namespace FineUIPro.Web.common
|
||||
var getAllPersonInOutList = from x in db.SitePerson_PersonInOutNumber
|
||||
|
||||
select x;
|
||||
if (getAllPersonInOutList.Count() > 0)
|
||||
if (getAllPersonInOutList.Any())
|
||||
{
|
||||
var getInMonths = (from x in getAllPersonInOutList select new { x.InOutDate.Year, x.InOutDate.Month }).Distinct();
|
||||
if (sDate.HasValue)
|
||||
@@ -348,10 +353,10 @@ namespace FineUIPro.Web.common
|
||||
return await Task.Run(() =>
|
||||
{
|
||||
Model.SingleSerie series = new Model.SingleSerie();
|
||||
var project1s = allProjects.Where(x => x.ProjectState == Const.ProjectState_1 || x.ProjectState == null);
|
||||
var consts = Funs.DB.Sys_Const.Where(x => x.GroupId == ConstValue.GroupId_ProjectState);
|
||||
var project1s = allProjects.Where(x => x.ProjectState == Const.ProjectState_1 || x.ProjectState == null).ToList();
|
||||
var consts = Funs.DB.Sys_Const.Where(x => x.GroupId == ConstValue.GroupId_ProjectState).ToList();
|
||||
string name = string.Empty;
|
||||
if (project1s.Count() > 0)
|
||||
if (project1s.Any())
|
||||
{
|
||||
foreach (var project1 in project1s)
|
||||
{
|
||||
@@ -432,7 +437,7 @@ namespace FineUIPro.Web.common
|
||||
select x;
|
||||
listdata.Add(projects.Count());
|
||||
decimal progress = 0;
|
||||
if (projects.Count() > 0)
|
||||
if (projects.Any())
|
||||
{
|
||||
convert.Add(province);
|
||||
foreach (var item in projects)
|
||||
@@ -570,7 +575,6 @@ namespace FineUIPro.Web.common
|
||||
return await Task.Run(() =>
|
||||
{
|
||||
Model.SingleSerie series = new Model.SingleSerie();
|
||||
var project1s = allProjects.Where(x => x.ProjectState == Const.ProjectState_1 || x.ProjectState == null);
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
string str = string.Empty;
|
||||
foreach (var item in allProjects)
|
||||
@@ -871,7 +875,7 @@ namespace FineUIPro.Web.common
|
||||
AllCount = getallin.Count();
|
||||
if (AllCount > 0)
|
||||
{
|
||||
MCount = getallin.Where(x => x.PostType == Const.PostType_1).Count();
|
||||
MCount = getallin.Count(x => x.PostType == Const.PostType_1);
|
||||
}
|
||||
|
||||
div_xcrs.InnerHtml = AllCount.ToString();
|
||||
@@ -888,20 +892,13 @@ namespace FineUIPro.Web.common
|
||||
{
|
||||
await Task.Run(() =>
|
||||
{
|
||||
var list = new List<Model.Base_Project>();
|
||||
if (pids == null)
|
||||
{
|
||||
list = Funs.DB.Base_Project.Where(x => (x.ProjectState == Const.ProjectState_1 || x.ProjectState == null)).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
list = Funs.DB.Base_Project.Where(x => pids.Contains(x.ProjectId)).ToList();
|
||||
}
|
||||
var allperson =
|
||||
APIPageDataService.getPersonNum(allProjects.Select(x => x.ProjectId).ToList(), DateTime.Now);
|
||||
|
||||
foreach (var item in list)
|
||||
foreach (var item in allProjects)
|
||||
{
|
||||
ProjectPersonMc += "'" + item.ShortName + "',";
|
||||
ProjectPersonCount += "'" + APIPageDataService.getPersonNum(item.ProjectId, DateTime.Now).Count() + "',";
|
||||
ProjectPersonCount += "'" + allperson.Count(x=>x.ProjectId==item.ProjectId) + "',";
|
||||
}
|
||||
ProjectPersonMc = ProjectPersonMc.TrimEnd(',');
|
||||
ProjectPersonCount = ProjectPersonCount.TrimEnd(',');
|
||||
@@ -914,21 +911,14 @@ namespace FineUIPro.Web.common
|
||||
protected string ProjectMc;
|
||||
protected async Task GetJdAsync()
|
||||
{
|
||||
var list = new List<Model.Base_Project>();
|
||||
if (pids == null)
|
||||
var list = allProjects;
|
||||
if (list.Any())
|
||||
{
|
||||
list = Funs.DB.Base_Project.Where(x => (x.ProjectState == Const.ProjectState_1 || x.ProjectState == null)).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
list = Funs.DB.Base_Project.Where(x => pids.Contains(x.ProjectId)).ToList();
|
||||
}
|
||||
if (list.Count > 0)
|
||||
{
|
||||
var progressCompletions = from x in Funs.DB.JDGL_ProgressCompletion select x;
|
||||
var progressCompletions = from x in Funs.DB.JDGL_ProgressCompletion select x ;
|
||||
foreach (var item in list)
|
||||
{
|
||||
var pCs = progressCompletions.Where(x => x.ProjectId == item.ProjectId).ToList();
|
||||
|
||||
ProjectJd += "'" + pCs.Sum(x => x.RealNum ?? 0).ToString("0.##") + "',";
|
||||
ProjectMc += "'" + item.ShortName + "',";
|
||||
}
|
||||
@@ -1001,15 +991,7 @@ namespace FineUIPro.Web.common
|
||||
protected string sbclHead = "<div class=\"th-p\">项目</div><div class=\"th-p\">采购量</div><div class=\"th-p\">到货量</div><div class=\"th-p\">已到货百分比</div>";
|
||||
private async Task GetCldhAsync()
|
||||
{
|
||||
var list = new List<Model.Base_Project>();
|
||||
if (pids == null)
|
||||
{
|
||||
list = Funs.DB.Base_Project.Where(x => (x.ProjectState == Const.ProjectState_1 || x.ProjectState == null)).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
list = Funs.DB.Base_Project.Where(x => pids.Contains(x.ProjectId)).ToList();
|
||||
}
|
||||
var list = allProjects;
|
||||
var PipelinList = Funs.DB.CLGL_PipelineMaterialSumList.Where(x => x.Type == "M");
|
||||
var SbclList = Funs.DB.CLGL_ContractListSum.Where(x => x.C1 == "设备");
|
||||
foreach (var item in list)
|
||||
@@ -1025,7 +1007,7 @@ namespace FineUIPro.Web.common
|
||||
gdclHtml += "<div class=\"th-p\" title =\"" + item.ShortName + "\">" + pname + "</div>";
|
||||
var pid = BLL.ProjectService.GetCLProjectCodeByProjectId(item.ProjectId).ToString();
|
||||
//管子
|
||||
var num1 = PipelinList.Where(x => x.ProjectId == pid && x.C1 == "管子").FirstOrDefault();
|
||||
var num1 = PipelinList.FirstOrDefault(x => x.ProjectId == pid && x.C1 == "管子");
|
||||
if (num1 != null)
|
||||
{
|
||||
gdclHtml += "<div class=\"th-p\">" + (num1.C7 == "" ? "0%" : num1.C7) + "</div>";
|
||||
@@ -1128,23 +1110,38 @@ namespace FineUIPro.Web.common
|
||||
/// <returns></returns>
|
||||
private int GetNearMissNum()
|
||||
{
|
||||
string cacheKey = "NearMissNum_" + string.Join("_",pids);
|
||||
var memoryCache = MemoryCache.Default;
|
||||
if (memoryCache.Get(cacheKey) != null)
|
||||
{
|
||||
return (int)memoryCache.Get(cacheKey);
|
||||
}
|
||||
int result = 0;
|
||||
if (pids == null)
|
||||
{
|
||||
var result = (from x in Funs.DB.Accident_AccidentPersonRecord
|
||||
result = (from x in Funs.DB.Accident_AccidentPersonRecord
|
||||
join y in Funs.DB.Base_AccidentType on x.AccidentTypeId equals y.AccidentTypeId
|
||||
where x.IsAttempt == "1" && x.CompileDate > Const.DtmarkTime
|
||||
select x).Count();
|
||||
return result;
|
||||
}
|
||||
else
|
||||
{
|
||||
var result = (from x in Funs.DB.Accident_AccidentPersonRecord
|
||||
result = (from x in Funs.DB.Accident_AccidentPersonRecord
|
||||
join y in Funs.DB.Base_AccidentType on x.AccidentTypeId equals y.AccidentTypeId
|
||||
where x.IsAttempt == "1" && x.CompileDate > Const.DtmarkTime
|
||||
&& pids.Contains(x.ProjectId)
|
||||
select x).Count();
|
||||
return result;
|
||||
select x).Count();
|
||||
}
|
||||
|
||||
var policy = new CacheItemPolicy
|
||||
{
|
||||
AbsoluteExpiration = DateTimeOffset.Now.AddMinutes(Const.CacheMinutes),
|
||||
};
|
||||
memoryCache.Set(cacheKey, result, policy);
|
||||
|
||||
return result;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user