This commit is contained in:
2025-05-16 17:54:16 +08:00
parent 1d2aee2c7c
commit 1773ec1dde
24 changed files with 1025 additions and 475 deletions
+13 -13
View File
@@ -226,7 +226,7 @@
</div>
<div class="zyp">
<div class="lab">
<asp:Literal runat="server" Text="<%$ Resources:Lan,altitude %>" />
<asp:Literal runat="server" Text="<%$ Resources:Lan,lifting %>" />
</div>
<div class="num"><%=WrokCount2 %>/<%=AllWrokCount2 %></div>
</div>
@@ -499,10 +499,10 @@
<div class="main" style="padding: .1875rem .25rem;">
<div class="cl-tab">
<div class="cl-btn cl-btn-act" id="span_gdcl" onclick="clOnclick(0)" style="cursor: pointer">
<asp:Literal runat="server" Text="<%$ Resources:Lan,mainProject2_MaterialLabel %>" />
<asp:Literal runat="server" Text="<%$ Resources:Lan,mainProject2_PipeMaterials %>" />
</div>
<div class="cl-btn" onclick="clOnclick(1)" id="span_sbcl" style="cursor: pointer">
<asp:Literal runat="server" Text="<%$ Resources:Lan,mainProject2_PipeMaterials %>" />
<asp:Literal runat="server" Text="<%$ Resources:Lan,mainProject2_EquipmentMaterials %>" />
</div>
</div>
<div class="table">
@@ -1988,20 +1988,20 @@
textStyle: {
rich: {
a: {
fontSize: 14,
fontSize: 12,
color: '#DADADA',
},
b: {
color: '#FFFFFF',
fontSize: 14,
fontSize: 12,
},
c: {
padding: [0, 6],
fontSize: 14,
padding: [0, 3],
fontSize: 12,
color: '#FFFFFF',
},
d: {
fontSize: 14,
fontSize: 12,
color: '#12CDA2',
}
}
@@ -2150,20 +2150,20 @@
textStyle: {
rich: {
a: {
fontSize: 14,
fontSize: 12,
color: '#DADADA',
},
b: {
color: '#FFFFFF',
fontSize: 14,
fontSize: 12,
},
c: {
padding: [0, 6],
fontSize: 14,
padding: [0, 3],
fontSize: 12,
color: '#FFFFFF',
},
d: {
fontSize: 14,
fontSize: 12,
color: '#12CDA2',
}
}
+59 -34
View File
@@ -1,6 +1,7 @@
using BLL;
using FineUIPro.Web.BaseInfo;
using FineUIPro.Web.DataShow;
using FineUIPro.Web.OfficeCheck.Check;
using FineUIPro.Web.SysManage;
using Model;
using Newtonsoft.Json;
@@ -30,7 +31,7 @@ namespace FineUIPro.Web.common
protected string completed = string.Empty;
protected string qualified = string.Empty;
protected string Cumulative_actual_value = string.Empty;
//实际值
@@ -202,7 +203,8 @@ namespace FineUIPro.Web.common
//int wHours = db.SitePerson_PersonInOutNumber.Where(x => x.ProjectId == ProjectId).Max(x => x.WorkHours) ?? 0;
int wHours = 0;
DateTime? sDate = Funs.GetNewDateTime(DateTime.Now.Year.ToString() + "-" + DateTime.Now.Month.ToString());
wHours = (from x in db.T_d_EmployInOutRecord where x.ProjectId == ProjectId select x.ManHours ?? 0).ToList().Sum();
//wHours = (from x in db.T_d_EmployInOutRecord where x.ProjectId == ProjectId select x.ManHours ?? 0).ToList().Sum();
wHours = (from x in db.SitePerson_PersonInOutNumber where x.ProjectId == ProjectId orderby x.InOutDate descending select x.WorkHours ?? 0).ToList().FirstOrDefault();
this.divSafeWorkTime.InnerHtml = wHours.ToString();
//本月安全人工时
@@ -215,19 +217,20 @@ namespace FineUIPro.Web.common
this.divSafeWorkTimeMonth.InnerHtml = wHoursMonth.ToString();
//安全培训累计人员
var getTrainRecord = db.EduTrain_TrainRecord.Where(x => x.ProjectId == ProjectId).Sum(x => x.TrainPersonNum) ?? 0;
//var getTrainRecord = db.EduTrain_TrainRecord.Where(x => x.ProjectId == ProjectId).Sum(x => x.TrainPersonNum) ?? 0;
var getTrainRecord = db.View_EduTrain_TrainFind.Where(x => x.ProjectId == ProjectId).Count();
//修改:增加博晟教育中的人数
var boShengCount = db.Bo_Sheng_TrainPerson.Count(x => x.ProjectId == ProjectId && (x.DeleteTag == "False" || x.DeleteTag == null));
this.divSafePersonNum.InnerHtml = (getTrainRecord + boShengCount).ToString();
//安全管理人员
var allSum = from x in Funs.DB.SitePerson_Person
var allSum = from x in db.SitePerson_Person
where x.ProjectId == ProjectId && x.IsUsed == true && x.InTime <= DateTime.Now && (!x.OutTime.HasValue || x.OutTime.Value > DateTime.Now)
select x;
var glAllPerson = from x in allSum
join y in Funs.DB.Base_WorkPost on x.WorkPostId equals y.WorkPostId
join y in db.Base_WorkPost on x.WorkPostId equals y.WorkPostId
where y.IsHsse == true && x.ProjectId == ProjectId //安管人员
select x;
this.divSafeManagePersonNum.InnerHtml = glAllPerson.Count().ToString();
@@ -260,9 +263,29 @@ namespace FineUIPro.Web.common
var getallin = from x in Funs.DB.T_d_EmployInOutRecord
join z in Funs.DB.Base_WorkPost on x.PostId equals z.WorkPostId into zGroup
from z in zGroup.DefaultIfEmpty()
where x.ProjectId == this.CurrUser.LoginProjectId && x.RecordDate.Value == DateTime.Now.Date
//where x.ProjectId == this.CurrUser.LoginProjectId && x.RecordDate.Value == DateTime.Now.Date
where x.ProjectId == this.CurrUser.LoginProjectId && x.RecordDate.Value == Convert.ToDateTime("2023-08-28")
select new { x.IDCardNo, z.PostType };
//var getallin = (from x in Funs.DB.SitePerson_Checking
// join z in Funs.DB.SitePerson_Person on x.PersonId equals z.PersonId into zGroup
// from z in zGroup.DefaultIfEmpty()
// //join y in Funs.DB.Base_Unit on x.UnitId equals y.UnitId into yGroup
// //from y in yGroup.DefaultIfEmpty()
// join w in Funs.DB.Base_WorkPost on z.WorkPostId equals w.WorkPostId into wGroup
// from w in wGroup.DefaultIfEmpty()
// where x.ProjectId == this.CurrUser.LoginProjectId && x.IntoOut == "1" && x.IntoOutTime >= DateTime.Now.Date
// select new { x.PersonId, w.PostType }).Union
// (from x in Funs.DB.SitePerson_PersonInOut
// join z in Funs.DB.SitePerson_Person on x.PersonId equals z.PersonId into zGroup
// from z in zGroup.DefaultIfEmpty()
// //join y in Funs.DB.Base_Unit on x.UnitId equals y.UnitId into yGroup
// //from y in yGroup.DefaultIfEmpty()
// join w in Funs.DB.Base_WorkPost on z.WorkPostId equals w.WorkPostId into wGroup
// from w in wGroup.DefaultIfEmpty()
// where x.ProjectId == this.CurrUser.LoginProjectId && x.IsIn == true && x.ChangeTime >= DateTime.Now.Date
// select new { x.PersonId, w.PostType });
AllCount = getallin.Count();
if (AllCount > 0)
{
@@ -505,7 +528,8 @@ namespace FineUIPro.Web.common
int allCount = 0;
var getPersonQualitys = from x in Funs.DB.QualityAudit_PersonQuality
join y in Funs.DB.SitePerson_Person on x.PersonId equals y.PersonId
where x.LimitDate.HasValue && x.LimitDate < DateTime.Now && y.ProjectId == ProjectId && y.OutTime == null
join z in Funs.DB.Base_WorkPost on y.WorkPostId equals z.WorkPostId
where x.LimitDate.HasValue && x.LimitDate < DateTime.Now && y.ProjectId == ProjectId && y.OutTime == null && z.PostType == Const.PostType_2
select x;
//// 预警人数
allCount = getPersonQualitys.Count();
@@ -864,19 +888,19 @@ namespace FineUIPro.Web.common
select x).Count().ToString();
var num2 = (from x in db.ProcessControl_InspectionManagement
where x.IsOnceQualified == true && x.ProjectId == ProjectId
where (x.IsOnceQualified == null || x.IsOnceQualified == true) && x.ProjectId == ProjectId
select x).Count();
zlgjfinishNumber = num2.ToString();
var num3 = (from x in db.ProcessControl_InspectionManagement
where (x.IsOnceQualified == false || x.IsOnceQualified == null) && x.ProjectId == ProjectId
select x).Count();
var allnum = (from x in db.ProcessControl_InspectionManagement
where x.ProjectId == ProjectId
select x).Count();
var zgl = "0";
if (num2 != 0)
{
zgl = String.Format("{0:N2}", 100.0 * num2 / (num2 + num3));
zgl = String.Format("{0:N2}", 100.0 * num2 / allnum);
zlgjzgl = zgl.ToString();
zggjzglDataValue = (100 - (100.0 * num2 / (num2 + num3))).ToString();
zggjzglDataValue = (100 - (100.0 * num2 / allnum)).ToString();
}
else
{
@@ -945,8 +969,8 @@ namespace FineUIPro.Web.common
decimal a = 0, b = 0;
if (ndtList.Count > 0)
{
//取每个单位最新的一条数据
var datalist = ndtList.GroupBy(r => r.UnitId).Select(g => g.OrderByDescending(r => r.CreateDate).First()).ToList();
//取每个单位、专业最新的一条数据
var datalist = ndtList.GroupBy(r => new { r.UnitId, r.ProfessionalName }).Select(g => g.OrderByDescending(r => r.CreateDate).First()).ToList();
foreach (var item in datalist)
{
if (item.TotalQuantity.HasValue)
@@ -957,23 +981,23 @@ namespace FineUIPro.Web.common
}
result = Convert.ToDouble(Convert.ToDecimal(100.0) * b / a);
}
else
{
var hjglData =
(from x in db.HJGL_FL_Data
where x.ProjectId == ProjectId
orderby x.CompileDate descending
select x).FirstOrDefault();
if (hjglData != null)
{
a = Funs.GetNewDecimalOrZero(hjglData.OneTimeFilmQualifiedAmount);
b = Funs.GetNewDecimalOrZero(hjglData.OneTimeFilmAmount);
if (a > 0 && b > 0)
{
result = Convert.ToDouble(Convert.ToDecimal(100.0) * b / a);
}
}
}
//else
//{
// var hjglData =
// (from x in db.HJGL_FL_Data
// where x.ProjectId == ProjectId
// orderby x.CompileDate descending
// select x).FirstOrDefault();
// if (hjglData != null)
// {
// a = Funs.GetNewDecimalOrZero(hjglData.OneTimeFilmQualifiedAmount);
// b = Funs.GetNewDecimalOrZero(hjglData.OneTimeFilmAmount);
// if (a > 0 && b > 0)
// {
// result = Convert.ToDouble(Convert.ToDecimal(100.0) * b / a);
// }
// }
//}
if (b > 0)
@@ -1655,7 +1679,8 @@ where qc.QuantityCompletionId=(select top 1 QuantityCompletionId from[JDGL_Quant
SqlParameter[] Staticparameter = listStaticListStr.ToArray();
DataTable statcitbDataTable = SQLHelper.GetDataTableRunProc("Sp_GJSXStatistic", Staticparameter);
var list = from x in Funs.DB.GJSX where x.ProjectId == this.CurrUser.LoginProjectId && x.State != "1" select x;
var allcount = list.Count(x => x.State == "0") + list.Count(x => x.State != "0" && x.CompleteDate < DateTime.Now);
//var allcount = list.Count(x => x.State == "0") + list.Count(x => x.State != "0" && x.CompleteDate < DateTime.Now);
var allcount = list.Count();
var closecount = list.Count(x => x.State == "0");
gjsxRate = String.Format("{0:N2}", 100.0 * closecount / allcount);
gjsxRate = gjsxRate.ToString().Replace("NaN", "0") + "%";
@@ -1744,7 +1769,7 @@ where qc.QuantityCompletionId=(select top 1 QuantityCompletionId from[JDGL_Quant
}
//设备材料
var SbclList = Funs.DB.CLGL_ContractListSum.Where(x => x.C1 == "管道" && x.ProjectId == pid);
var SbclList = Funs.DB.CLGL_ContractListSum.Where(x => x.C1 == "设备" && x.ProjectId == pid);
foreach (var item in SbclList)
{
sbclHtml += "<div class=\"row\">";
+180 -23
View File
@@ -1902,7 +1902,7 @@
]--%>
createZL({ name: '<%=main_new_qualityIssuesRectificationRate%>', value1: <%=zlallNumber%>, value2: <%=zlfinishNumber%>, el: 'zl-map1' })
createZL({ name: '<%=OnePassRate%>', value1: <%=zlgjallNumber%>, value2: <%=zlgjfinishNumber%>, el: 'zl-map2' })
createZL({ name: '<%=OnePassRateOfWelding%>', value1: <%=hjallNumber%>, value2: <%=hjfinishNumber%>, el: 'zl-map3' })
createZL3({ name: '<%=OnePassRateOfWelding%>', value1: <%=hjallNumber%>, value2: <%=hjfinishNumber%>, el: 'zl-map3' })
function createZL(obj) {
let AOption1 = {
@@ -1916,32 +1916,189 @@
fontWeight: 100
}
}, {
// text: `总计:${obj.value1} | 完成:${obj.value2}`,
text: [`{a|<%=total%>}{b|${obj.value1}}{c||}{a|<%=completed%>}{d|${obj.value2}}`],
top: '80%',
left: 'center',
textStyle: {
rich: {
a: {
fontSize: 12,
color: '#DADADA',
// text: `总计:${obj.value1} | 完成:${obj.value2}`,
text: [`{a|<%=total%>}{b|${obj.value1}}{c||}{a|<%=completed%>}{d|${obj.value2}}`],
top: '80%',
left: 'center',
textStyle: {
rich: {
a: {
fontSize: 12,
color: '#DADADA',
},
b: {
color: '#FFFFFF',
fontSize: 12,
},
c: {
padding: [0, 3],
fontSize: 12,
color: '#FFFFFF',
},
d: {
fontSize: 12,
color: '#12CDA2',
}
},
b: {
color: '#FFFFFF',
fontSize: 12,
},
c: {
padding: [0, 6],
fontSize: 12,
color: '#FFFFFF',
},
d: {
fontSize: 12,
color: '#12CDA2',
}
},
],
series: [
{
name: '',
type: 'gauge',
radius: "60%",
center: ["50%", "30%"],
startAngle: 360,
endAngle: 0,
splitNumber: 20,
progress: {
show: false
},
axisLine: {
roundCap: true,
lineStyle: {
width: 20,
color: [[1, new echarts.graphic.LinearGradient(
0, 0, 0, 1, // 这四个参数分别表示渐变的起点 (x1, y1) 与终点 (x2, y2)
[
{ offset: 0, color: 'RGBA(38, 223, 235, .4)' }, // 0% 处的颜色
{ offset: 1, color: '#29F1FA' } // 100% 处的颜色
]
)]]
}
},
detail: {
valueAnimation: true,
formatter: function (value) {
//str = `{a|${(obj.value2 / obj.value1 * 100).toFixed(2)}}{b|%}`
str = `{a|${parseFloat((obj.value2 / obj.value1 * 100).toFixed(2))}}{b|%}`
return str;
},
color: 'inherit',
offsetCenter: [0, 0],
rich: {
a: {
fontSize: 20,
color: '#FFFFFF'
},
b: {
fontSize: 12,
color: '#FFFFFF'
}
}
},
pointer: {
show: false
},
axisLabel: {
show: false
},
splitLine: {
distance: -20,
length: 20,
lineStyle: {
color: '#021837',
width: 4,
}
},
axisTick: {
show: false
},
anchor: {
show: false
},
data: [
{ value: obj.value1 },
],
},
{
name: '',
type: 'gauge',
radius: "68%",
center: ["50%", "30%"],
startAngle: 20,
endAngle: 200,
splitNumber: 20,
progress: {
show: false
},
axisLine: {
roundCap: true,
lineStyle: {
width: 1,
color: [[1, new echarts.graphic.LinearGradient(
0, 0, 0, 1, // 这四个参数分别表示渐变的起点 (x1, y1) 与终点 (x2, y2)
[
{ offset: 0, color: 'RGBA(38, 223, 235, .4)' }, // 0% 处的颜色
{ offset: 1, color: '#29F1FA' } // 100% 处的颜色
]
)]]
}
},
pointer: {
show: false
},
axisLabel: {
show: false
},
splitLine: {
show: false
},
axisTick: {
show: false
},
anchor: {
show: false
},
}
},
]
};
var aPassChart = echarts.init(document.getElementById(obj.el));
aPassChart.setOption(AOption1);
}
function createZL3(obj) {
let AOption1 = {
title: [{
text: obj.name || '',
top: '62%',
left: 'center',
textStyle: {
color: '#FFFFFF',
fontSize: 14,
fontWeight: 100
}
}, {
// text: `总计:${obj.value1} | 完成:${obj.value2}`,
text: [`{a|<%=total%>}{b|${obj.value1}}{c||}{a|<%=qualified%>}{d|${obj.value2}}`],
top: '80%',
left: 'center',
textStyle: {
rich: {
a: {
fontSize: 12,
color: '#DADADA',
},
b: {
color: '#FFFFFF',
fontSize: 12,
},
c: {
padding: [0, 3],
fontSize: 12,
color: '#FFFFFF',
},
d: {
fontSize: 12,
color: '#12CDA2',
}
},
}
},
],
series: [
{
+214 -134
View File
@@ -12,6 +12,7 @@ using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Org.BouncyCastle.Ocsp;
using FineUIPro.Web.HJGL.FL;
namespace FineUIPro.Web.common
{
@@ -29,6 +30,7 @@ namespace FineUIPro.Web.common
protected string OnePassRateOfWelding = string.Empty;
protected string total = string.Empty;
protected string completed = string.Empty;
protected string qualified = string.Empty;
protected string mainI_progressStatistics = string.Empty;
protected string Percentage_of_progress = string.Empty;
@@ -75,7 +77,7 @@ namespace FineUIPro.Web.common
: db.Base_Project
.Where(x => x.ProjectState == "1")
.Select(x => x.ProjectId)
.ToArray();
.ToArray();
//在建项目
if (pids == null)
{
@@ -102,7 +104,6 @@ namespace FineUIPro.Web.common
if (countAqrgsSum > 10000)
{
countAqrgsSum = countAqrgsSum / Convert.ToDecimal(10000.00);
this.divSafeWorkTime.InnerHtml = Math.Round(countAqrgsSum, 2).ToString() + "万";
}
else
@@ -112,8 +113,8 @@ namespace FineUIPro.Web.common
// 当月安全人工时
var countMonthAqrgs = pids?.Any() == true
? CountAqrgs(getStartMonth(), getEndMonth(), pids)
: CountAqrgs(getStartMonth(), getEndMonth());
? CountAqrgs(getLastMonthEndDay(), getEndMonth(), pids)
: CountAqrgs(getLastMonthEndDay(), getEndMonth());
if (countMonthAqrgs > 10000)
@@ -130,7 +131,8 @@ namespace FineUIPro.Web.common
var trainingQuery = db.EduTrain_TrainRecord
.Where(x => pids.Contains(x.ProjectId))
.GroupBy(x => 1)
.Select(g => new {
.Select(g => new
{
TrainCount = g.Sum(x => x.TrainPersonNum) ?? 0,
BoShengCount = db.Bo_Sheng_TrainPerson
.Where(x => (x.DeleteTag == "False" || x.DeleteTag == null))
@@ -141,94 +143,96 @@ namespace FineUIPro.Web.common
divSafePersonNum.InnerHtml = trainingQuery != null
? (trainingQuery.TrainCount + trainingQuery.BoShengCount).ToString()
: "0";
: "0";
// 安全管理人员(优化关联查询)
var safetyStaffCount = db.SitePerson_Person
.Where(x=> x.IsUsed == true && x.InTime < DateTime.Now && (x.OutTime == null || x.OutTime > DateTime.Now))
.Where(x => x.IsUsed == true && x.InTime < DateTime.Now && (x.OutTime == null || x.OutTime > DateTime.Now))
.Where(x => pids.Contains(x.ProjectId))
.Join(db.Base_WorkPost.Where(x => x.IsHsse==true),
.Join(db.Base_WorkPost.Where(x => x.IsHsse == true),
person => person.WorkPostId,
post => post.WorkPostId,
(person, post) => person)
.Count();
divSafeManagePersonNum.InnerText = safetyStaffCount.ToString();
});
});
}
// 质量统计模块封装
private async Task BindQualityStatisticsAsync()
{
await Task.Run(() => {
await Task.Run(() =>
{
var db = Funs.DB;
var db = Funs.DB;
// 质量管理人员(合并公司+项目级查询)
var qualityQuery = db.Base_WorkPost
.Where(x => x.IsCQMS == true)
.GroupJoin(db.SitePerson_Person.Where(x=> x.IsUsed == true),
.GroupJoin(db.SitePerson_Person.Where(x => x.IsUsed == true),
post => post.WorkPostId,
person => person.WorkPostId,
(post, persons) => new { post, persons })
.SelectMany(x => x.persons.DefaultIfEmpty(),
(x, person) => new { x.post, person })
.Where(x => pids.Contains(x.person.ProjectId));
//企业总部人员和分支机构人员
var query = (from person in db.Person_CompanyBranchPerson
join unit in db.Base_Unit on person.UnitId equals unit.UnitId into unitJoin
from unit in unitJoin.DefaultIfEmpty() // 左连接
join workPost in db.Base_WorkPost on person.WorkPostId equals workPost.WorkPostId into workPostJoin
from workPost in workPostJoin.DefaultIfEmpty() // 左连接
where person.IsOnJob == true && workPost.IsCQMS == true
select new
{
ID = person.CompanyBranchPersonId,
UnitName = unit.UnitName,
PersonName = person.PersonName,
SexStr = person.Sex == "1" ? "男" : "女",
IdentityCard = person.IdentityCard,
WorkPostName = workPost.WorkPostName,
Telephone = person.Telephone,
IsOnJob = person.IsOnJob,
Remark = person.Remark,
ProjectName = ""
}).ToList();
join unit in db.Base_Unit on person.UnitId equals unit.UnitId into unitJoin
from unit in unitJoin.DefaultIfEmpty() // 左连接
join workPost in db.Base_WorkPost on person.WorkPostId equals workPost.WorkPostId into workPostJoin
from workPost in workPostJoin.DefaultIfEmpty() // 左连接
where person.IsOnJob == true && workPost.IsCQMS == true
select new
{
ID = person.CompanyBranchPersonId,
UnitName = unit.UnitName,
PersonName = person.PersonName,
SexStr = person.Sex == "1" ? "男" : "女",
IdentityCard = person.IdentityCard,
WorkPostName = workPost.WorkPostName,
Telephone = person.Telephone,
IsOnJob = person.IsOnJob,
Remark = person.Remark,
ProjectName = ""
}).ToList();
divCqmsManageNum.InnerText = (qualityQuery.Count() + query.Count()).ToString();
// 质量培训人员
divCqmsPxNum.InnerText = db.Comprehensive_InspectionPerson
.Where(x => pids.Contains(x.ProjectId))
.Count(x => x.IsTrain == true).ToString();
divCqmsPxNum.InnerText = db.Comprehensive_InspectionPerson
.Where(x => pids.Contains(x.ProjectId))
.Count(x => x.IsTrain == true).ToString();
});
}
// 项目统计优化
private async Task BindProjectStatisticsAsync()
{
await Task.Run(() => {
var db = Funs.DB;
int acount = allProjects.Count();
int pcount1 = 0;
int pcount2 = 0;
int pcount3 = 0;
if (acount > 0)
await Task.Run(() =>
{
pcount1 = allProjects.Where(x => x.ProjectState == Const.ProjectState_1 || x.ProjectState == null).Select( x => x.ProjectId).Count();
var pidzjsg = string.Join(",", allProjects.Where(x => x.ProjectState == Const.ProjectState_1 || x.ProjectState == null).Select(x => x.ProjectId)).Split(',');
if (pids == null)
var db = Funs.DB;
int acount = allProjects.Count();
int pcount1 = 0;
int pcount2 = 0;
int pcount3 = 0;
if (acount > 0)
{
pcount2 = (from x in Funs.DB.SitePerson_Person where x.IsUsed == true && pidzjsg.Contains(x.ProjectId) select x.ProjectId).Count();
pcount1 = allProjects.Where(x => x.ProjectState == Const.ProjectState_1 || x.ProjectState == null).Select(x => x.ProjectId).Count();
var pidzjsg = string.Join(",", allProjects.Where(x => x.ProjectState == Const.ProjectState_1 || x.ProjectState == null).Select(x => x.ProjectId)).Split(',');
if (pids == null)
{
pcount2 = (from x in Funs.DB.SitePerson_Person where x.IsUsed == true && pidzjsg.Contains(x.ProjectId) select x.ProjectId).Count();
}
else
{
pidzjsg = pids;
pcount2 = (from x in Funs.DB.SitePerson_Person where x.IsUsed == true && pids.Contains(x.ProjectId) select x.ProjectId).Count();
}
pcount3 = Count3(pidzjsg);
}
else
{
pidzjsg = pids;
pcount2 = (from x in Funs.DB.SitePerson_Person where x.IsUsed == true && pids.Contains(x.ProjectId) select x.ProjectId).Count();
}
pcount3 = Count3(pidzjsg);
}
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>";
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>";
});
}
@@ -236,16 +240,31 @@ namespace FineUIPro.Web.common
#region
/// <summary>
/// 获取上月的月末日期
/// </summary>
/// <returns></returns>
public static DateTime getLastMonthEndDay()
{
// 获取当前日期
DateTime currentDate = DateTime.Now.AddMonths(-1);
// 获取当前月的最后一天
DateTime lastDayOfMonth = new DateTime(currentDate.Year, currentDate.Month, DateTime.DaysInMonth(currentDate.Year, currentDate.Month));
return lastDayOfMonth;
}
/// <summary>
/// 获取当前月的月末日期
/// </summary>
/// <returns></returns>
public static DateTime getEndMonth()
{
// 获取当前日期
DateTime currentDate = DateTime.Now;
// 获取当前月的最后一天
DateTime lastDayOfMonth = new DateTime(currentDate.Year, currentDate.Month, DateTime.DaysInMonth(currentDate.Year, currentDate.Month));
int span = Convert.ToInt32(System.DateTime.Now.Day);
System.DateTime dateEnd = System.DateTime.Now.AddMonths(1).AddDays(-span);
return dateEnd;
return lastDayOfMonth;
}
/// <summary>
/// 获取当前月初日期
@@ -253,10 +272,11 @@ namespace FineUIPro.Web.common
/// <returns></returns>
public static DateTime getStartMonth()
{
int span = Convert.ToInt32(System.DateTime.Now.Day);
span = span - 1;
System.DateTime dateStart = System.DateTime.Now.AddDays(-span);
return dateStart;
// 获取当前日期
DateTime currentDate = DateTime.Now;
// 获取当前月的月初日期
DateTime firstDayOfMonth = new DateTime(currentDate.Year, currentDate.Month, 1);
return firstDayOfMonth;
}
//安全人工时(穿透)
@@ -272,8 +292,7 @@ namespace FineUIPro.Web.common
var datetime1 = d1;
var datetime2 = d2;
var getAllPersonInOutList = from x in Funs.DB.SitePerson_PersonInOutNumber
select new { x.ProjectId, x.InOutDate, x.WorkHours };
select new { x.ProjectId, x.InOutDate, x.WorkHours };
if (pids != null)
{
getAllPersonInOutList = getAllPersonInOutList.Where(x => pids.Contains(x.ProjectId));
@@ -286,18 +305,20 @@ namespace FineUIPro.Web.common
{
getAllPersonInOutList = getAllPersonInOutList.Where(x => x.InOutDate <= datetime2);
}
var projects = getAllPersonInOutList
.GroupBy(x => x.ProjectId)
.Select(g => new
{
Project = g.Key,
Items = g.OrderBy(x => x.InOutDate).ToList()
})
.Where(g => g.Items.Any());
cout1 = projects.ToList().Sum(g =>
(g.Items.Last().WorkHours ?? 0) -
(g.Items.First().WorkHours ?? 0));
var projects = getAllPersonInOutList.GroupBy(x => x.ProjectId).Select(g => new
{
Project = g.Key,
Items = g.OrderBy(x => x.InOutDate).ToList()
}).Where(g => g.Items.Any());
if (!datetime1.HasValue && !datetime2.HasValue)
{//查累计人工时
cout1 = projects.ToList().Sum(g => (g.Items.Last().WorkHours ?? 0));
}
else
{//查当月人工时
cout1 = projects.ToList().Sum(g => (g.Items.Last().WorkHours ?? 0) - (g.Items.First().WorkHours ?? 0));
}
var getD1 = from x in Funs.DB.Accident_AccidentHandle
join y in Funs.DB.Base_Project on x.ProjectId equals y.ProjectId
@@ -322,7 +343,7 @@ namespace FineUIPro.Web.common
{
getD1 = getD1.Where(x => x.AccidentDate <= datetime2);
getD2 = getD2.Where(x => x.CompileDate <= datetime2);
}
}
if (getD1.Any())
{
cout1 = cout1 - getD1.Sum(x => x.WorkHoursLoss ?? 0);
@@ -388,7 +409,7 @@ 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).Select(x=> new { x.ProjectId, x.ProjectName, x.ProjectState2, x.Province, x.ShortName }).ToList();
var project1s = allProjects.Where(x => x.ProjectState == Const.ProjectState_1 || x.ProjectState == null).Select(x => new { x.ProjectId, x.ProjectName, x.ProjectState2, x.Province, x.ShortName }).ToList();
var consts = Funs.DB.Sys_Const.Where(x => x.GroupId == ConstValue.GroupId_ProjectState).ToList();
string name = string.Empty;
if (project1s.Any())
@@ -456,25 +477,25 @@ namespace FineUIPro.Web.common
var accidentList1 = from x in db.Accident_AccidentPersonRecord
join y in db.Base_AccidentType on x.AccidentTypeId equals y.AccidentTypeId
where y.AccidentTypeName.Contains("未遂")
select new { x.ProjectId, x.AccidentDate } ;
select new { x.ProjectId, x.AccidentDate };
var accidentList2 = from x in db.Accident_AccidentReportOther
join y in db.Sys_Const on x.AccidentTypeId equals y.ConstValue
where y.ConstText.Contains("未遂")
select new { x.ProjectId, x.AccidentDate };
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();
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;
@@ -699,7 +720,7 @@ namespace FineUIPro.Web.common
select x).Count().ToString();
var num2 = (from x in Funs.DB.Check_CheckControl
where x.State == "7"
where x.State == "7"
select x).Count();
zlfinishNumber = num2.ToString();
@@ -716,11 +737,11 @@ namespace FineUIPro.Web.common
else
{
zlallNumber = (from x in Funs.DB.Check_CheckControl
where pids.Contains(x.ProjectId)
where pids.Contains(x.ProjectId)
select x).Count().ToString();
var num2 = (from x in Funs.DB.Check_CheckControl
where x.State == "7" && pids.Contains(x.ProjectId)
where x.State == "7" && pids.Contains(x.ProjectId)
select x).Count();
zlfinishNumber = num2.ToString();
@@ -755,7 +776,7 @@ namespace FineUIPro.Web.common
zlgjallNumber = num1.ToString();
var num2 = (from x in Funs.DB.ProcessControl_InspectionManagement
where x.IsOnceQualified == true
where (x.IsOnceQualified == null || x.IsOnceQualified == true)
select x).Count();
zlgjfinishNumber = num2.ToString();
@@ -771,7 +792,7 @@ namespace FineUIPro.Web.common
zlgjallNumber = num1.ToString();
var num2 = (from x in Funs.DB.ProcessControl_InspectionManagement
where x.IsOnceQualified == true && pids.Contains(x.ProjectId)
where (x.IsOnceQualified == null || x.IsOnceQualified == true) && pids.Contains(x.ProjectId)
select x).Count();
zlgjfinishNumber = num2.ToString();
@@ -799,40 +820,83 @@ namespace FineUIPro.Web.common
List<double> listdata = new List<double>();
double result = 0;
Model.SGGLDB db = Funs.DB;
var ndtLists = from x in db.ProcessControl_NondestructiveTest_New select x;
var ndtLists = (from x in db.ProcessControl_NondestructiveTest_New select x).ToList();
if (pids != null)
{
ndtLists = ndtLists.Where(x=>pids.Contains(x.ProjectId));
ndtLists = ndtLists.Where(x => pids.Contains(x.ProjectId)).ToList();
}
decimal a = 0, b = 0;
var sumResult = ndtLists
.GroupBy(x => x.ProjectId)
.Select(g => new {
TotalQ = g.OrderByDescending(x => x.CreateDate)
.Select(x => x.TotalQuantity)
.FirstOrDefault(),
Rate = g.OrderByDescending(x => x.CreateDate)
.Select(x => x.TotalRate)
.FirstOrDefault()
})
.Where(x => x.TotalQ.HasValue).ToList()
.Select(x => new {
A = Math.Floor(x.TotalQ.Value * (decimal.Parse(x.Rate)) / 100),
B = x.TotalQ.Value
});
a = sumResult.Sum(x=>x.A);
b = sumResult.Sum(x => x.B);
if (ndtLists.Count > 0)
{
//取每个单位、专业最新的一条数据
var datalist = ndtLists.GroupBy(r => new { r.UnitId, r.ProfessionalName }).Select(g => g.OrderByDescending(r => r.CreateDate).First()).ToList();
foreach (var item in datalist)
{
if (item.TotalQuantity.HasValue)
{
a += Math.Floor(item.TotalQuantity.Value * Funs.GetNewDecimalOrZero(item.TotalRate) / 100);
b += item.TotalQuantity.Value;
}
}
result = Convert.ToDouble(Convert.ToDecimal(100.0) * b / a);
}
//else
//{
// var hjglData =
// (from x in db.HJGL_FL_Data
// where x.ProjectId == ProjectId
// orderby x.CompileDate descending
// select x).FirstOrDefault();
// if (hjglData != null)
// {
// a = Funs.GetNewDecimalOrZero(hjglData.OneTimeFilmQualifiedAmount);
// b = Funs.GetNewDecimalOrZero(hjglData.OneTimeFilmAmount);
// if (a > 0 && b > 0)
// {
// result = Convert.ToDouble(Convert.ToDecimal(100.0) * b / a);
// }
// }
//}
if (b > 0)
{
result = Convert.ToDouble(decimal.Round(decimal.Parse((a / b * 100).ToString()), 2));
hjallNumber = b.ToString();
hjfinishNumber = a.ToString();
hjzgl = result.ToString();
hjDataValue = (100 - result).ToString();
}
//var sumResult = ndtLists
// .GroupBy(x => x.ProjectId)
// .Select(g => new
// {
// TotalQ = g.OrderByDescending(x => x.CreateDate)
// .Select(x => x.TotalQuantity)
// .FirstOrDefault(),
// Rate = g.OrderByDescending(x => x.CreateDate)
// .Select(x => x.TotalRate)
// .FirstOrDefault()
// })
// .Where(x => x.TotalQ.HasValue).ToList()
// .Select(x => new
// {
// A = Math.Floor(x.TotalQ.Value * (decimal.Parse(x.Rate)) / 100),
// B = x.TotalQ.Value
// });
//a = sumResult.Sum(x => x.A);
//b = sumResult.Sum(x => x.B);
//if (b > 0)
//{
// result = Convert.ToDouble(decimal.Round(decimal.Parse((a / b * 100).ToString()), 2));
// hjallNumber = b.ToString();
// hjfinishNumber = a.ToString();
// hjzgl = result.ToString();
// hjDataValue = (100 - result).ToString();
//}
});
}
@@ -906,7 +970,7 @@ namespace FineUIPro.Web.common
var getallin = new List<Model.PageDataPersonInOutItem>();
if (pids == null)
{
getallin = APIPageDataService.getPersonNum(new List<string>(),DateTime.Now);
getallin = APIPageDataService.getPersonNum(new List<string>(), DateTime.Now);
}
else
{
@@ -928,8 +992,8 @@ namespace FineUIPro.Web.common
ProjectPersonMc += "'" + item.ShortName + "',";
ProjectPersonCount += "'" + getallin.Count(x => x.ProjectId == item.ProjectId) + "',";
}
ProjectPersonMc = ProjectPersonMc.TrimEnd(',');
ProjectPersonCount = ProjectPersonCount.TrimEnd(',');
ProjectPersonMc = !string.IsNullOrWhiteSpace(ProjectPersonMc) ? ProjectPersonMc.TrimEnd(',') : string.Empty;
ProjectPersonCount = !string.IsNullOrWhiteSpace(ProjectPersonCount) ? ProjectPersonCount.TrimEnd(',') : string.Empty;
});
}
#endregion
@@ -947,7 +1011,7 @@ namespace FineUIPro.Web.common
foreach (var item in allProjects)
{
ProjectPersonMc += "'" + item.ShortName + "',";
ProjectPersonCount += "'" + allperson.Count(x=>x.ProjectId==item.ProjectId) + "',";
ProjectPersonCount += "'" + allperson.Count(x => x.ProjectId == item.ProjectId) + "',";
}
ProjectPersonMc = ProjectPersonMc.TrimEnd(',');
ProjectPersonCount = ProjectPersonCount.TrimEnd(',');
@@ -963,7 +1027,7 @@ namespace FineUIPro.Web.common
var list = allProjects;
if (list.Any())
{
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();
@@ -989,7 +1053,7 @@ namespace FineUIPro.Web.common
div_zgwwc.InnerHtml = GeneralNotClosedNum.ToString();
div_zgwcl.InnerHtml = (100.0 * GeneralClosedNum / (GeneralNotClosedNum + GeneralClosedNum)).ToString("0.##") + "%";
});
}
/// <summary>
@@ -1112,13 +1176,11 @@ namespace FineUIPro.Web.common
#endregion
#region
sbclHtml += " <div class=\"row\">";
pname = item.ShortName;
if (item.ShortName.Length > 5)
{
pname = item.ShortName.Substring(0, 5) + "...";
}
sbclHtml += "<div class=\"th-p\" title=\"" + item.ShortName + "\">" + pname + "</div>";
//采购量
var SbcllCglList = SbclList.Where(x => x.ProjectId == pid).ToList();
double SbcllCgl = 0.0;
@@ -1137,6 +1199,8 @@ namespace FineUIPro.Web.common
}
}
sbclHtml += "<div class=\"row\">";
sbclHtml += "<div class=\"th-p\" title=\"" + item.ShortName + "\">" + pname + "</div>";
sbclHtml += "<div class=\"th-p\">" + SbcllCgl + "</div>";
sbclHtml += "<div class=\"th-p\">" + Sbdhs + "</div>";
//百分比
@@ -1149,10 +1213,6 @@ namespace FineUIPro.Web.common
{
sbclHtml += "<div class=\"th-p\">0%</div>";
}
sbclHtml += " </div>";
#endregion
}
@@ -1165,7 +1225,8 @@ namespace FineUIPro.Web.common
/// <returns></returns>
private int GetNearMissNum()
{
string cacheKey = "NearMissNum_" + string.Join("_",pids);
Model.SGGLDB db = Funs.DB;
string cacheKey = "NearMissNum_" + string.Join("_", pids);
var memoryCache = MemoryCache.Default;
if (memoryCache.Get(cacheKey) != null)
{
@@ -1174,18 +1235,36 @@ namespace FineUIPro.Web.common
int result = 0;
if (pids == null)
{
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();
var wsAccidentList1 = from x in db.Accident_AccidentPersonRecord
join y in db.Base_AccidentType on x.AccidentTypeId equals y.AccidentTypeId
where y.AccidentTypeName.Contains("未遂")
select x;
var wsAccidentList2 = from x in db.Accident_AccidentReportOther
join y in db.Sys_Const on x.AccidentTypeId equals y.ConstValue
where y.ConstText.Contains("未遂")
select x;
result = wsAccidentList1.Count() + wsAccidentList2.Count();
//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();
}
else
{
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();
var wsAccidentList1 = from x in db.Accident_AccidentPersonRecord
join y in db.Base_AccidentType on x.AccidentTypeId equals y.AccidentTypeId
where y.AccidentTypeName.Contains("未遂") && pids.Contains(x.ProjectId)
select x;
var wsAccidentList2 = from x in db.Accident_AccidentReportOther
join y in db.Sys_Const on x.AccidentTypeId equals y.ConstValue
where y.ConstText.Contains("未遂") && pids.Contains(x.ProjectId)
select x;
result = wsAccidentList1.Count() + wsAccidentList2.Count();
//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();
}
var policy = new CacheItemPolicy
@@ -1210,6 +1289,7 @@ namespace FineUIPro.Web.common
OnePassRateOfWelding = Resources.Lan.OnePassRateOfWelding;
total = Resources.Lan.total;
completed = Resources.Lan.completed;
qualified = Resources.Lan.qualified;
mainI_progressStatistics = Resources.Lan.mainI_progressStatistics;
Percentage_of_progress = Resources.Lan.Percentage_of_progress;
});