diff --git a/.vs/CNCEC_SUBQHSE_WUHUAN/v17/.wsuo b/.vs/CNCEC_SUBQHSE_WUHUAN/v17/.wsuo
index 64fed920..65891f11 100644
Binary files a/.vs/CNCEC_SUBQHSE_WUHUAN/v17/.wsuo and b/.vs/CNCEC_SUBQHSE_WUHUAN/v17/.wsuo differ
diff --git a/.vs/CNCEC_SUBQHSE_WUHUAN/v17/DocumentLayout.backup.json b/.vs/CNCEC_SUBQHSE_WUHUAN/v17/DocumentLayout.backup.json
index 0ee74a3a..ee21c543 100644
--- a/.vs/CNCEC_SUBQHSE_WUHUAN/v17/DocumentLayout.backup.json
+++ b/.vs/CNCEC_SUBQHSE_WUHUAN/v17/DocumentLayout.backup.json
@@ -59,10 +59,6 @@
"$type": "Bookmark",
"Name": "ST:131:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
},
- {
- "$type": "Bookmark",
- "Name": "ST:0:0:{aa2115a1-9712-457b-9047-dbb71ca2cdd2}"
- },
{
"$type": "Bookmark",
"Name": "ST:0:0:{1a46fd64-28d5-434c-8eb3-17a02d419b53}"
@@ -70,6 +66,14 @@
{
"$type": "Bookmark",
"Name": "ST:0:0:{5726b0e3-1012-5233-81f9-d1fad48e7a56}"
+ },
+ {
+ "$type": "Bookmark",
+ "Name": "ST:0:0:{e1b7d1f8-9b3c-49b1-8f4f-bfc63a88835d}"
+ },
+ {
+ "$type": "Bookmark",
+ "Name": "ST:0:0:{aa2115a1-9712-457b-9047-dbb71ca2cdd2}"
}
]
}
diff --git a/SGGL/FineUIPro.Web/common/mainProject2.aspx b/SGGL/FineUIPro.Web/common/mainProject2.aspx
index 1e81975b..1e02b8e6 100644
--- a/SGGL/FineUIPro.Web/common/mainProject2.aspx
+++ b/SGGL/FineUIPro.Web/common/mainProject2.aspx
@@ -172,19 +172,19 @@
-
<%=getWrokCount0() %>/<%=getALLWrokCount0() %>
+
<%=WrokCount0 %>/<%=AllWrokCount0 %>
-
<%=getWrokCount1() %>/<%=getALLWrokCount1() %>
+
<%=WrokCount1 %>/<%=AllWrokCount1 %>
-
<%=getWrokCount2() %>/<%=getALLWrokCount2() %>
+
<%=WrokCount2 %>/<%=AllWrokCount2 %>
-
<%=getWrokCount3() %>/<%=getALLWrokCount3() %>
+
<%=WrokCount3 %>/<%=AllWrokCount3 %>
diff --git a/SGGL/FineUIPro.Web/common/mainProject2.aspx.cs b/SGGL/FineUIPro.Web/common/mainProject2.aspx.cs
index 00b5d7d4..a22ff052 100644
--- a/SGGL/FineUIPro.Web/common/mainProject2.aspx.cs
+++ b/SGGL/FineUIPro.Web/common/mainProject2.aspx.cs
@@ -6,6 +6,7 @@ using Model;
using Newtonsoft.Json;
using NPOI.Util;
using System;
+using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
@@ -116,7 +117,7 @@ namespace FineUIPro.Web.common
//风险预警
getHazard(),
-
+ getWork(),
//工程概况
getProjectInfo(),
@@ -655,67 +656,131 @@ namespace FineUIPro.Web.common
#endregion 风险预警
#region 作业许可
-
- protected int getAllCount()
+ protected int AllWrokCount0;
+ protected int AllWrokCount1;
+ protected int AllWrokCount2;
+ protected int AllWrokCount3;
+ protected int WrokCount0;
+ protected int WrokCount1;
+ protected int WrokCount2;
+ protected int WrokCount3;
+ protected async Task getWork()
{
- var result = Funs.DB.View_License_LicenseManager.Where(x => x.ProjectId == ProjectId).ToList().Count;
+
+ var AllWrokCount0 = getALLWrokCount0();
+ var AllWrokCount1 = getALLWrokCount1();
+ var AllWrokCount2 = getALLWrokCount2();
+ var AllWrokCount3 = getALLWrokCount3();
+ var WrokCount0 = getWrokCount0();
+ var WrokCount1 = getWrokCount1();
+ var WrokCount2 = getWrokCount2();
+ var WrokCount3 = getWrokCount3();
+ await Task.WhenAll( AllWrokCount0, AllWrokCount1, AllWrokCount2, AllWrokCount3, WrokCount0, WrokCount1, WrokCount2, WrokCount3);
+ this.AllWrokCount0 = await AllWrokCount0;
+ this.AllWrokCount1 = await AllWrokCount1;
+ this.AllWrokCount2 = await AllWrokCount2;
+ this.AllWrokCount3 = await AllWrokCount3;
+ this.WrokCount0 = await WrokCount0;
+ this.WrokCount1 = await WrokCount1;
+ this.WrokCount2 = await WrokCount2;
+ this.WrokCount3 = await WrokCount3;
+
+ }
+ protected IQueryable
GetLicenseQuery()
+ {
+ var query = from lm in Funs.DB.License_LicenseManager
+
+ join lt in Funs.DB.Base_LicenseType on lm.LicenseTypeId equals lt.LicenseTypeId into ltJoin
+ from licenseType in ltJoin.DefaultIfEmpty()
+
+ select new LicenseDto
+ {
+ ProjectId= lm.ProjectId,
+ LicenseTypeName = licenseType.LicenseTypeName ?? "",
+ WorkStatesStr = lm.WorkStates == "1" ? "待开工" :
+ lm.WorkStates == "2" ? "作业中" :
+ lm.WorkStates == "3" ? "已关闭" :
+ lm.WorkStates == "-1" ? "已取消" : ""
+ };
+ return query;
+ }
+ protected async Task getAllCount()
+ {
+ var result = GetLicenseQuery().Where(x => x.ProjectId == ProjectId).ToList().Count;
return result;
}
+
- protected int getALLWrokCount0()
- {
- var result = Funs.DB.View_License_LicenseManager.Where(x => x.ProjectId == ProjectId && x.LicenseTypeName == "动火作业许可证").ToList().Count;
+ protected async Task getALLWrokCount0()
+ {
+ return await Task.Run(() => {
+ var result = GetLicenseQuery().Where(x => x.ProjectId == ProjectId && x.LicenseTypeName == "动火作业许可证").ToList().Count;
return result;
+ });
}
- protected int getALLWrokCount1()
+ protected async Task getALLWrokCount1()
{
- var result = Funs.DB.View_License_LicenseManager.Where(x => x.ProjectId == ProjectId && x.LicenseTypeName == "高处作业许可证").ToList().Count;
+ return await Task.Run(() => {
+ var result = GetLicenseQuery().Where(x => x.ProjectId == ProjectId && x.LicenseTypeName == "高处作业许可证").ToList().Count;
return result;
+ });
}
- protected int getALLWrokCount2()
+ protected async Task getALLWrokCount2()
{
- var result = Funs.DB.View_License_LicenseManager.Where(x => x.ProjectId == ProjectId && x.LicenseTypeName == "吊装作业许可证").ToList().Count;
+ return await Task.Run(() => {
+ var result = GetLicenseQuery().Where(x => x.ProjectId == ProjectId && x.LicenseTypeName == "吊装作业许可证").ToList().Count;
return result;
+ });
}
- protected int getALLWrokCount3()
+ protected async Task getALLWrokCount3()
{
- var result = Funs.DB.View_License_LicenseManager.Where(x => x.ProjectId == ProjectId
- && x.LicenseTypeName != "动火作业许可证" && x.LicenseTypeName != "高处作业许可证" && x.LicenseTypeName != "吊装作业许可证").ToList().Count;
+ return await Task.Run(() => {
+ var result = GetLicenseQuery().Where(x => x.ProjectId == ProjectId
+ && x.LicenseTypeName != "动火作业许可证" && x.LicenseTypeName != "高处作业许可证" && x.LicenseTypeName != "吊装作业许可证").ToList().Count;
return result;
+ });
}
- protected int getTodayCount()
+ protected async Task getTodayCount()
{
- var result = Funs.DB.View_License_LicenseManager.Where(x => x.ProjectId == ProjectId && x.WorkStatesStr == "作业中").ToList().Count;
+ var result = GetLicenseQuery().Where(x => x.ProjectId == ProjectId && x.WorkStatesStr == "作业中").ToList().Count;
return result;
}
///
/// 动火作业许可证
///
///
- protected int getWrokCount0()
+ protected async Task getWrokCount0()
{
- var result = Funs.DB.View_License_LicenseManager.Where(x => x.ProjectId == ProjectId && x.LicenseTypeName == "动火作业许可证" && x.WorkStatesStr == "作业中").ToList().Count;
+ return await Task.Run(() => {
+ var result = GetLicenseQuery().Where(x => x.ProjectId == ProjectId && x.LicenseTypeName == "动火作业许可证" && x.WorkStatesStr == "作业中").ToList().Count;
return result;
+ });
}
- protected int getWrokCount1()
+ protected async Task getWrokCount1()
{
- var result = Funs.DB.View_License_LicenseManager.Where(x => x.ProjectId == ProjectId && x.LicenseTypeName == "高处作业许可证" && x.WorkStatesStr == "作业中").ToList().Count;
+ return await Task.Run(() => {
+ var result = GetLicenseQuery().Where(x => x.ProjectId == ProjectId && x.LicenseTypeName == "高处作业许可证" && x.WorkStatesStr == "作业中").ToList().Count;
return result;
+ });
}
- protected int getWrokCount2()
+ protected async Task getWrokCount2()
{
- var result = Funs.DB.View_License_LicenseManager.Where(x => x.ProjectId == ProjectId && x.LicenseTypeName == "吊装作业许可证" && x.WorkStatesStr == "作业中").ToList().Count;
+ return await Task.Run(() => {
+ var result = GetLicenseQuery().Where(x => x.ProjectId == ProjectId && x.LicenseTypeName == "吊装作业许可证" && x.WorkStatesStr == "作业中").ToList().Count;
return result;
+ });
}
- protected int getWrokCount3()
+ protected async Task getWrokCount3()
{
- var result = Funs.DB.View_License_LicenseManager.Where(x => x.ProjectId == ProjectId
- && x.LicenseTypeName != "动火作业许可证" && x.LicenseTypeName != "高处作业许可证" && x.LicenseTypeName != "吊装作业许可证" && x.WorkStatesStr == "作业中").ToList().Count;
+ return await Task.Run(() => {
+ var result = GetLicenseQuery().Where(x => x.ProjectId == ProjectId
+ && x.LicenseTypeName != "动火作业许可证" && x.LicenseTypeName != "高处作业许可证" && x.LicenseTypeName != "吊装作业许可证" && x.WorkStatesStr == "作业中").ToList().Count;
return result;
+ });
}
#endregion 作业许可
@@ -1211,21 +1276,32 @@ namespace FineUIPro.Web.common
returnHtml += "" + item.LicenseManagerCode + "-" + shortUnitname + "-" + item.WorkAreaName + "-" + gfx + "-" + item.LicenseTypeName
+ "
";
}*/
-
- var result = from x in Funs.DB.View_License_LicenseManager
- join y in Funs.DB.Base_Unit on x.UnitId equals y.UnitId into g
- from z in g.DefaultIfEmpty()
- where x.ProjectId == ProjectId
- select new
- {
- x.LicenseManagerCode,
- x.WorkAreaName,
- x.LicenseTypeName,
- GfxType = x.IsHighRisk == true ? "风险作业" : "非高风险",
- ShortUnitName = z != null ? z.ShortUnitName : "", // 空值防护
- };
+ var result = (from x in Funs.DB.License_LicenseManager
+ join y in Funs.DB.Base_Unit on x.UnitId equals y.UnitId into units
+ from unit in units.DefaultIfEmpty()
+ join z in Funs.DB.WBS_UnitWork on x.WorkAreaId equals z.UnitWorkId into areas
+ from area in areas.DefaultIfEmpty()
+ join w in Funs.DB.Base_LicenseType on x.LicenseTypeId equals w.LicenseTypeId
+ where x.ProjectId == ProjectId
+ select new
+ {
+ x.LicenseManagerCode,
+ WorkAreaName=area.UnitWorkName,
+ w.LicenseTypeName,
+ x.IsHighRisk,
+ unit.ShortUnitName
+ })
+ .AsEnumerable() // 后续操作在内存中进行
+ .Select(x => new
+ {
+ x.LicenseManagerCode,
+ x.WorkAreaName,
+ x.LicenseTypeName,
+ GfxType = x.IsHighRisk == true ? "风险作业" : "非高风险",
+ ShortUnitName = x.ShortUnitName ?? ""
+ }).ToList();
var sb = new StringBuilder();
- foreach (var item in result.ToList())
+ foreach (var item in result)
{
sb.AppendFormat("{0}-{1}-{2}-{3}-{4}
",
item.LicenseManagerCode,
diff --git a/SGGL/FineUIPro.Web/common/main_new.aspx.cs b/SGGL/FineUIPro.Web/common/main_new.aspx.cs
index 548dfe4c..9291f8f8 100644
--- a/SGGL/FineUIPro.Web/common/main_new.aspx.cs
+++ b/SGGL/FineUIPro.Web/common/main_new.aspx.cs
@@ -426,15 +426,21 @@ namespace FineUIPro.Web.common
join y in db.Sys_Const on x.AccidentTypeId equals y.ConstValue
where y.ConstText.Contains("未遂")
select x;
- foreach (var province in provinces)
+ var allProvinceProjectList = (from x in allProjects
+ join y in provinceDic on x.Province equals y.ProvinceCode
+ where provinces.Contains(y.CnShortName )
+ select new { x,y.CnShortName}).ToList();
+ var allProvinces= allProvinceProjectList.Select(x =>x.CnShortName ).Distinct().ToList();
+ foreach (var province in allProvinces)
{
int accidentNum = 0;
DateTime date = DateTime.Now;
decimal money1 = 0, money2 = 0;
- var projects = from x in allProjects
- join y in provinceDic on x.Province equals y.ProvinceCode
- where y.CnShortName == province
- select x;
+ /* var projects = from x in allProjects
+ join y in provinceDic on x.Province equals y.ProvinceCode
+ where y.CnShortName == province
+ select x;*/
+ var projects = allProvinceProjectList.Where(x => x.CnShortName == province);
listdata.Add(projects.Count());
decimal progress = 0;
if (projects.Any())
@@ -443,22 +449,22 @@ namespace FineUIPro.Web.common
foreach (var item in projects)
{
//未遂事故
- var accidentListProject1 = accidentList1.Where(x => x.ProjectId == item.ProjectId);
- var accidentListProject2 = accidentList2.Where(x => x.ProjectId == item.ProjectId);
+ var accidentListProject1 = accidentList1.Where(x => x.ProjectId == item.x.ProjectId);
+ var accidentListProject2 = accidentList2.Where(x => x.ProjectId == item.x.ProjectId);
accidentNum = accidentListProject1.Count() + accidentListProject2.Count();
//时间
- if (item.StartDate != null && item.StartDate < date)
+ if (item.x.StartDate != null && item.x.StartDate < date)
{
- date = Convert.ToDateTime(item.StartDate);
+ date = Convert.ToDateTime(item.x.StartDate);
}
//合同额
- if (item.ConstructionMoney != null)
+ if (item.x.ConstructionMoney != null)
{
- money1 += item.ConstructionMoney.Value;
+ money1 += item.x.ConstructionMoney.Value;
}
- if (item.Progress != null)
+ if (item.x.Progress != null)
{
- progress = item.Progress.Value;
+ progress = item.x.Progress.Value;
}
}
jd.Add("进度:" + progress.ToString("0.##") + "%");
diff --git a/SGGL/Model/APIItem/HSSE/LicenseItem.cs b/SGGL/Model/APIItem/HSSE/LicenseItem.cs
index e520c709..3a45d871 100644
--- a/SGGL/Model/APIItem/HSSE/LicenseItem.cs
+++ b/SGGL/Model/APIItem/HSSE/LicenseItem.cs
@@ -68,4 +68,12 @@ namespace Model
set;
}
}
+
+ public class LicenseDto
+ {
+ public string ProjectId { get; set; }
+ public string WorkStates { get; set; }
+ public string LicenseTypeName { get; set; }
+ public string WorkStatesStr { get; set; }
+ }
}