提交代码

This commit is contained in:
2024-03-11 09:46:11 +08:00
parent 7772c5b682
commit 9dcce0f81c
30 changed files with 5368 additions and 417 deletions
+2
View File
@@ -83,4 +83,6 @@
</TreeNode>
<TreeNode id="EA413D2A-8D29-4DE2-932D-8511BB7F6CB2" Text="各项目巡查汇总" NavigateUrl="ZHGL/InspectionSummary/InspectionSummary.aspx"></TreeNode>
<TreeNode id="F2133BD6-C786-407A-AD6F-3EEF613229A8" Text="施工管理绩效数据" NavigateUrl="ZHGL/Performance/PerformanceAllData.aspx"></TreeNode>
<TreeNode id="53D8CED2-9AA7-43EA-B27D-EA10A06DF713" Text="开车人员绩效管理" NavigateUrl=""><TreeNode id="383290E0-60AE-4D16-8B5E-3899B85EC2ED" Text="开车绩效评分标准" NavigateUrl="ZHGL/TestRunPerformance/TestRunPerformanceStandard.aspx"></TreeNode>
</TreeNode>
</Tree>
+419 -51
View File
@@ -95,6 +95,19 @@
</div>
</div>
</div>
<div class="bottom-wrap">
<div class="top">
<div class="item">
<div class="bw-b-bottom ptop6">
<div class="bw-b-bottom-up">
<div class="bw-item-content">
<div id='three' style="width: 100%; height: 100%;"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
@@ -204,7 +217,7 @@
var oneNameData = [];
var oneArr = JSON.parse(oneArrStr);
var oneData = JSON.parse(oneDataStr);
$.each(oneData, function (inxex, item) {
$.each(oneData, function (index, item) {
var obj = { name: item };
oneNameData.push(obj);
});
@@ -224,15 +237,6 @@
tooltip: {
formatter: '{a}:{c}%'//a 是series中每条数据name值,c 是data数值
},
//legend: {
// orient: 'vertical', // 'horizontal'
// data: oneData,
// textStyle: { // 图列内容样式
// color: '#fff', // 字体颜色
// },
// x: '70%',//图例位置,设置right发现图例和文字位置反了,设置一个数值就好了
// y: 'center'//延Y轴居中
//},
grid: {
left: '3%',
//right: '30%',
@@ -253,7 +257,9 @@
},
axisLabel: {
interval: 0,
rotate: -90,
formatter: function (value) {
return value.split("").join("\n");
}
}
}
],
@@ -271,16 +277,6 @@
}
}
],
//dataZoom: [
// {
// type: "slider",//slider表示有滑动块的,
// show: true,
//// xAxisIndex: [0],//表示x轴折叠
// start: 1,//数据窗口范围的起始百分比,表示1%
// end: 70,//数据窗口范围的结束百分比,表示35%坐标
// bottom: "0",
// },
//],
series: [{
name: '进度率',
type: 'bar',
@@ -288,9 +284,11 @@
data: oneArr,
label: {
show: true,
position: 'inside',
interval: 0,
rotate: -90,
position: 'top',
color: "#00D8FE",
fontWeight: "bold",
//interval: 0,
//rotate: -90,
formatter: function (params) {
if (params.value > 0) {
return params.value + '%';
@@ -308,35 +306,10 @@
}
}
}]
//series: oneNameData
};
//for (var i = 0; i < option.series.length; i++) {
// var style = { //定义柱状图的样式
// type: 'bar',
// barWidth: 20,
// normal: {
// label: {
// show: true,
// position: 'inside', //柱子下显示 数值
// interval: 0,
// rotate: -90,
// formatter: function (params) {
// if (params.value > 0) {
// return params.value + '%';
// } else {
// return ' ';
// }
// },
// }
// }
// };
// option.series[i].type = 'bar'; //每条数据指定类型为'bar'
// option.series[i].itemStyle = style; // series中每条数据都加的样式
// option.series[i].data = [bar_data[i]]; //series 中 data赋值
//};
chart.setOption(option);
//图2
var twoDataStr = '<%=twoDataStr%>';
var towData = JSON.parse(twoDataStr);
var data = towData.map((item, index) => item.Rate);
@@ -397,11 +370,12 @@
fontSize: 12,
},
itemStyle: {
borderRadius: 10,
borderRadius: [10, 10, 10, 10],
color: new echarts.graphic.LinearGradient(0, 1, 1, 1, [
{ offset: 0, color: '#395CFE' },
{ offset: 1, color: '#2EC7CF' },
]),
barBorderRadius: [10, 10, 10, 10]
},
},
{
@@ -428,12 +402,406 @@
itemStyle: {
borderRadius: 10,
color: 'rgba(3,169,244, 0.5)',
barBorderRadius: [10, 10, 10, 10]
},
},
],
};
chart1.setOption(option);
//图3
var fourDecisionStr = '<%=fourDecisionStr%>';
var threeData = JSON.parse(fourDecisionStr);
var threewidth = Math.floor(100 / threeData.length);
$.each(threeData, function (index, item) {
$("#three").append("<div id='three" + index + "' style='width:" + threewidth + "%; height:100%; display:inline-block'></div>");
});
$(function () {
$.each(threeData, function (index, item) {
var chart = echarts.init(document.getElementById('three' + index));
var value = item.Rate;
option = {
backgroundColor: '000',
title: {
text: `${value}%`,
subtext: '三查四定' + item.Name + '类',
left: 'center',
top: '45%', //top待调整
textStyle: {
color: '#fff',
fontSize: 20,
fontFamily: 'DINAlternate-Bold',
},
subtextStyle: {
color: '#ff',
fontSize: 14,
fontFamily: 'PingFangSC-Regular',
top: 'center'
},
itemGap: 16 //主副标题间距
},
xAxis: {
splitLine: {
show: false
},
axisLabel: {
show: false
},
axisLine: {
show: false
}
},
yAxis: {
splitLine: {
show: false
},
axisLabel: {
show: false
},
axisLine: {
show: false
}
},
series: [
// 内圆
{
type: 'pie',
radius: ['0', '50%'],
center: ['50%', '50%'],
z: 0,
itemStyle: {
normal: {
color: new echarts.graphic.RadialGradient(0.5, 0.5, 0.5, [
{
offset: 0,
color: '#1a68c0'
},
{
offset: 0.44,
color: '#1a68c0'
},
{
offset: 0.73,
color: '#194c88'
},
{
offset: 1,
color: '#162c46'
}
]),
label: {
show: false
},
labelLine: {
show: false
}
},
},
label: {
normal: {
position: "center",
}
},
data: [100],
},
// 进度圈
{
type: 'pie',
clockWise: true,
radius: ["60%", "55%"],
data: [{
value: value,
itemStyle: {
normal: {
borderWidth: 2,
borderColor: {
colorStops: [{
offset: 0,
color: '#1d87ff' || '#00cefc' // 0% 处的颜色
}, {
offset: 1,
color: '#1d87ff' || '#367bec' // 100% 处的颜色
}]
},
color: { // 完成的圆环的颜色
colorStops: [{
offset: 0,
color: '#1d87ff' || '#00cefc' // 0% 处的颜色
}, {
offset: 1,
color: '#1d87ff' || '#367bec' // 100% 处的颜色
}]
},
label: {
show: false
},
labelLine: {
show: false
},
},
}
},
{
name: '',
value: 100 - value,
itemStyle: {
normal: {
label: {
show: false
},
labelLine: {
show: false
},
color: 'rgba(0, 0, 0, 0)',
borderColor: 'rgba(0, 0, 0, 0)',
borderWidth: 0,
}
},
}
]
},
//刻度尺
{
// name: "白色圈刻度",
type: "gauge",
radius: "77%",
startAngle: 225, //刻度起始
endAngle: -134.8, //刻度结束
z: 4,
axisTick: {
show: true,
lineStyle: {
width: 2,
color: '#354e6c'
}
},
splitLine: {
length: 16, //刻度节点线长度
lineStyle: {
width: 2,
color: '#354e6c'
} //刻度节点线
},
axisLabel: {
color: 'rgba(255,255,255,0)',
fontSize: 12,
}, //刻度节点文字颜色
pointer: {
show: false
},
axisLine: {
lineStyle: {
opacity: 0
}
},
detail: {
show: false
},
data: [{
value: 0,
name: ""
}]
},
]
};
chart.setOption(option);
});
});
//data = [
// {
// name: 'A类',
// value: 20,
// },
// {
// name: 'B类',
// value: 30,
// },
// {
// name: 'C类',
// value: 50,
// },
//];
//arrName = getArrayValue(data, 'name');
//arrValue = getArrayValue(data, 'value');
//sumValue = eval(arrValue.join('+'));
//objData = array2obj(data, 'name');
//optionData = getData(data);
//function getArrayValue(array, key) {
// var key = key || 'value';
// var res = [];
// if (array) {
// array.forEach(function (t) {
// res.push(t[key]);
// });
// }
// return res;
//}
//function array2obj(array, key) {
// var resObj = {};
// for (var i = 0; i < array.length; i++) {
// resObj[array[i][key]] = array[i];
// }
// return resObj;
//}
//function getData(data) {
// var res = {
// series: [],
// yAxis: [],
// };
// for (let i = 0; i < data.length; i++) {
// res.series.push({
// name: '',
// type: 'pie',
// clockWise: false, //顺时加载
// hoverAnimation: false, //鼠标移入变大
// radius: [73 - i * 15 + '%', 68 - i * 15 + '%'],
// center: ['40%', '55%'],
// label: {
// show: false,
// },
// itemStyle: {
// label: {
// show: false,
// },
// labelLine: {
// show: false,
// },
// borderWidth: 5,
// },
// data: [
// {
// value: data[i].value,
// name: data[i].name,
// },
// {
// value: sumValue - data[i].value,
// name: '',
// itemStyle: {
// color: 'rgba(0,0,0,0)',
// borderWidth: 0,
// },
// tooltip: {
// show: false,
// },
// hoverAnimation: false,
// },
// ],
// });
// res.series.push({
// name: '',
// type: 'pie',
// silent: true,
// z: 1,
// clockWise: false, //顺时加载
// hoverAnimation: false, //鼠标移入变大
// radius: [73 - i * 15 + '%', 68 - i * 15 + '%'],
// center: ['40%', '55%'],
// label: {
// show: false,
// },
// itemStyle: {
// label: {
// show: false,
// },
// labelLine: {
// show: false,
// },
// borderWidth: 5,
// },
// data: [
// {
// value: 7.5,
// itemStyle: {
// color: '#add2d2', //圆环背景色-全
// borderWidth: 0,
// },
// tooltip: {
// show: false,
// },
// hoverAnimation: false,
// },
// {
// value: 2.5,
// name: '',
// itemStyle: {
// color: 'rgba(0,0,0,0)',
// borderWidth: 0,
// },
// tooltip: {
// show: false,
// },
// hoverAnimation: false,
// },
// ],
// });
// res.yAxis.push(((data[i].value / sumValue) * 100).toFixed(2) + '%');
// }
// return res;
//}
//option = {
// //backgroundColor: '#ddd',
// legend: {
// show: true,
// icon: 'circle',
// top: 'center',
// top: '16%',
// bottom: '53%',
// left: '40%',
// data: arrName,
// width: 40,
// padding: [0, 16],
// itemGap: 25,
// //图例显示
// formatter: function (name) {
// return '{title|' + name + '}{value|' + ((objData[name].value / sumValue) * 100).toFixed(2) + '} {title|%}';
// },
// textStyle: {
// rich: {
// title: {
// fontSize: 20,
// lineHeight: 30,
// color: '#fff',
// },
// value: {
// fontSize: 18,
// lineHeight: 20,
// color: '#fff',
// },
// },
// },
// },
// title: {
// text: '', //图形标题,配置在中间对应效果图的80%
// left: '20%',
// top: '50%',
// textStyle: {
// color: 'rgb(50,197,233)',
// fontSize: 16,
// align: 'left',
// },
// },
// tooltip: {
// show: true,
// trigger: 'item',
// formatter: '{a}<br>{b}:{c}({d}%)',
// },
// color: ['yellow', 'blue', 'green'],
// xAxis: [
// {
// show: false,
// },
// ],
// series: optionData.series,
//};
//chart2.setOption(option);
</script>
<%--<script type="text/javascript">
@@ -12,6 +12,11 @@ using static FineUIPro.Web.TestRun.Report.ScheduleSetUp;
using NPOI.SS.Formula.Functions;
using Model;
using Newtonsoft.Json.Linq;
using System.Reflection;
using static FineUIPro.Web.TestRun.Report.PreRunSchedule;
using Aspose.Words;
using static FineUIPro.Web.TestRun.Report.TestRunSchedule;
using System.Web.UI.DataVisualization.Charting;
namespace FineUIPro.Web
{
@@ -20,6 +25,8 @@ namespace FineUIPro.Web
public string oneArrStr { get; set; }
public string oneDataStr { get; set; }
public string twoDataStr { get; set; }
public string fourDecisionStr { get; set; }
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
@@ -32,6 +39,7 @@ namespace FineUIPro.Web
{
OneYsc();
TwoSc();
FourDecision();
}
/// <summary>
@@ -63,27 +71,86 @@ namespace FineUIPro.Web
}
else
{
string strSql = @"select a.WorkPackId,a.WorkPackName,(select COUNT(1) from PreRun_SubInspectTerm as b where b.WorkPackId=a.WorkPackId and b.ProjectId=@ProjectId) as AllNum,(select COUNT(1) from PreRun_SubInspectTerm as b where b.WorkPackId=a.WorkPackId and b.ProjectId=@ProjectId and ISNULL(b.InspectIsClose,0)=0) as ProgressNum,(select COUNT(1) from PreRun_SubInspectTerm as b where b.WorkPackId=a.WorkPackId and b.ProjectId=@ProjectId and ISNULL(b.InspectIsClose,0)=1) as CompleteNum from PreRun_WorkPackage as a order by a.Sort"; List<SqlParameter> listStr = new List<SqlParameter>();
listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
if (tb.Rows.Count > 0)
List<string> SubSystemIds = new List<string>();
var devices = Funs.DB.PreRun_SysDevice.Where(x => x.ProjectId == this.CurrUser.LoginProjectId && x.PreRunLevel == 4).ToList();
if (devices.Count > 0)
{
var allCompleteNum = float.Parse(tb.Compute("sum(CompleteNum)", "").ToString());
var allSumNum = float.Parse(tb.Compute("sum(AllNum)", "").ToString());
var allrate = (float)Math.Round(allCompleteNum / allSumNum * 100, 2, MidpointRounding.AwayFromZero);
SubSystemIds = devices.ConvertAll(x => x.PreRunId);
}
var result = new List<Run_ScheduleSetUpDto>();
string allStr = $"select a.SubSystemId,a.SystemId,b.WorkPackId,b.WorkPackName,b.WorkPackType,(select count(1) from PreRun_SubPropertySelect as gd where gd.SubSystemId = a.SubSystemId) as GdallNum,(select count(1) from PreRun_SubTechnologySelect as sb where sb.SubSystemId = a.SubSystemId) as SballNum,(select count(1) from PreRun_SubInstrumentSelect as sy where sy.SubSystemId = a.SubSystemId) as SyallNum from PreRun_SubSysWorkPackage as a inner join PreRun_WorkPackage as b on a.WorkPackId = b.WorkPackId where a.SubSystemId in ('{string.Join("','", SubSystemIds)}') order by a.WorkPackCode asc";
var dt = SQLHelper.GetDataTableRunText(allStr);
string inspectStr = $"select a.WorkPackId,b.WorkPackName,b.Sort,SUM(case ISNULL(a.InspectIsClose, 0) when 1 then 1 else 0 end) as CloseNum,SUM(case ISNULL(a.InspectIsClose, 0) when 0 then 1 else 0 end) as NoCloseNum,COUNT(1) as AllNum from PreRun_SubInspectTerm as a inner join PreRun_WorkPackage as b on a.WorkPackId = b.WorkPackId where 1=1 and a.ProjectId = '{this.CurrUser.LoginProjectId}' and a.SubSystemId in ('{string.Join("','", SubSystemIds)}') group by a.WorkPackId,b.WorkPackName,b.Sort order by b.Sort asc";
var inspectDt = SQLHelper.GetDataTableRunText(inspectStr);
var inspectlist = DataTableToList<WorkPackageInspectDto>(inspectDt);
if (dt.Rows.Count > 0)
{
//获取所有子系统数量
var inspects = Funs.DB.PreRun_SubInspectTerm.Where(x => x.ProjectId == this.CurrUser.LoginProjectId && SubSystemIds.Contains(x.SubSystemId));
var querylist = DataTableToList<QuerySubSysWorkPackage>(dt);
var queryGroup = querylist.GroupBy(x => new { x.WorkPackId, x.WorkPackName, x.WorkPackType }).Select(p => new
{
p.Key.WorkPackId,
p.Key.WorkPackName,
p.Key.WorkPackType
});
int progressNum = 0;
int completeNum = 0;
float allCompleteNum = 0;
float allProgressNum = 0;
int allNum = 0;
int allSumNum = 0;
List<float> oneDataArr = new List<float>();
List<string> oneDataData = new List<string>();
foreach (var itemPack in queryGroup)
{
var itemQueryList = querylist.Where(x => x.WorkPackId == itemPack.WorkPackId).ToList();
var subsystemids = itemQueryList.ConvertAll(a => a.SubSystemId).Distinct();
allNum = itemQueryList.Count(x => x.WorkPackId == itemPack.WorkPackId);
foreach (var itemsubid in subsystemids)
{
if (inspects.Count(x => x.SubSystemId == itemsubid) > 0)
{
var itemQuerylist = itemQueryList.FirstOrDefault(x => x.SubSystemId == itemsubid && x.WorkPackId == itemPack.WorkPackId);
if (inspects.Count(x => x.SubInspectId == itemsubid && x.InspectIsClose != 1) > 0)
{
progressNum += 1;
}
else
{
var closeInspect = inspects.Where(x => x.SubInspectId == itemsubid && x.InspectIsClose == 1);
var closeNums = closeInspect.Count() > 0 ? closeInspect.Select(x => x.PropertyTechnologyId.Split(',').Count()).Sum(x => x) : 0;
if (allNum > closeNums)
{
progressNum += 1;
}
else
{
completeNum += 1;
}
}
}
else
{
progressNum += 1;
}
}
var rate = completeNum > 0 ? (float)Math.Round((float)completeNum / (float)allNum * 100, 2, MidpointRounding.AwayFromZero) : 0;
if (rate > 100) rate = 100;
allSumNum += allNum;
allCompleteNum += completeNum;
allProgressNum += progressNum;
oneDataArr.Add(rate);
oneDataData.Add(itemPack.WorkPackName);
}
var allrate = allCompleteNum > 0 ? (float)Math.Round(allCompleteNum / allSumNum * 100, 2, MidpointRounding.AwayFromZero) : 0;
if (allrate > 100) allrate = 100;
oneArr.Add(allrate);
oneData.Add("全部");
foreach (DataRow row in tb.Rows)
{
float allNum = float.Parse(row["AllNum"].ToString());
float completeNum = float.Parse(row["CompleteNum"].ToString());
var rate = completeNum > 0 ? (float)Math.Round((completeNum / allNum * 100), 2, MidpointRounding.AwayFromZero) : 0;
if (rate > 100) rate = 100;
oneArr.Add(rate);
oneData.Add(row["WorkPackName"].ToString());
}
oneArr.AddRange(oneDataArr);
oneData.AddRange(oneDataData);
}
}
oneArrStr = JsonConvert.SerializeObject(oneArr);
@@ -117,21 +184,37 @@ namespace FineUIPro.Web
}
else
{
string strSql = @"select a.WorkPackId,a.WorkPackName,(select COUNT(1) from TestRun_SubInspectTerm as b where b.WorkPackId=a.WorkPackId and b.ProjectId=@ProjectId) as AllNum,(select COUNT(1) from TestRun_SubInspectTerm as b where b.WorkPackId=a.WorkPackId and b.ProjectId=@ProjectId and ISNULL(b.InspectIsClose,0)=0) as ProgressNum,(select COUNT(1) from TestRun_SubInspectTerm as b where b.WorkPackId=a.WorkPackId and b.ProjectId=@ProjectId and ISNULL(b.InspectIsClose,0)=1) as CompleteNum from TestRun_WorkPackage as a order by a.Sort"; List<SqlParameter> listStr = new List<SqlParameter>();
listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
if (tb.Rows.Count > 0)
List<string> SystemIds = new List<string>();
var devices = Funs.DB.PreRun_SysDevice.Where(x => x.ProjectId == this.CurrUser.LoginProjectId && x.PreRunLevel == 3).ToList();
if (devices.Count > 0)
{
foreach (DataRow row in tb.Rows)
SystemIds = devices.ConvertAll(x => x.PreRunId);
}
string allStr = $"select b.WorkPackId,b.WorkPackName,COUNT(a.SystemId) as WorkPackNum from TestRun_SubSysWorkPackage as a inner join TestRun_WorkPackage as b on a.WorkPackId = b.WorkPackId where a.SystemId in ('{string.Join("','", SystemIds)}') group by b.WorkPackId,b.WorkPackName";
var dt = SQLHelper.GetDataTableRunText(allStr);
var data = new List<TwoDto>();
if (dt.Rows.Count > 0)
{
string inspectStr = $"select a.WorkPackId,b.WorkPackName,b.Sort,SUM(case ISNULL(a.InspectIsClose, 0) when 1 then 1 else 0 end) as CloseNum,SUM(case ISNULL(a.InspectIsClose, 0) when 0 then 1 else 0 end) as NoCloseNum,COUNT(1) as AllNum from TestRun_SubInspectTerm as a inner join TestRun_WorkPackage as b on a.WorkPackId = b.WorkPackId where 1=1 and a.ProjectId = '{this.CurrUser.LoginProjectId}' group by a.WorkPackId,b.WorkPackName,b.Sort order by b.Sort asc";
var inspectDt = SQLHelper.GetDataTableRunText(inspectStr);
var inspectlist = DataTableToList<WorkPackageInspectDto>(inspectDt);
int progressNum = 0;
int completeNum = 0;
int allNum = 0;
var testlist = DataTableToList<TestRunScheduleDto>(dt);
foreach (var item in testlist)
{
float allNum = float.Parse(row["AllNum"].ToString());
float completeNum = float.Parse(row["CompleteNum"].ToString());
var rate = completeNum > 0 ? (float)Math.Round((completeNum / allNum) * 100, 2, MidpointRounding.AwayFromZero) : 0;
if (rate > 100) rate = 100;
if (inspectlist.Count(x => x.WorkPackId == item.WorkPackId) > 0)
{
var itemInspect = inspectlist.FirstOrDefault(x => x.WorkPackId == item.WorkPackId);
allNum = itemInspect.AllNum;
progressNum = itemInspect.NoCloseNum;
completeNum = itemInspect.CloseNum;
}
var rate = completeNum > 0 ? (float)Math.Round((float)completeNum / (float)allNum, 2, MidpointRounding.AwayFromZero) : 0;
result.Add(new TwoDto()
{
Name = row["WorkPackName"].ToString(),
Name = item.WorkPackName,
Rate = rate
});
}
@@ -140,11 +223,204 @@ namespace FineUIPro.Web
twoDataStr = JsonConvert.SerializeObject(result);
}
/// <summary>
/// 三查四定
/// </summary>
public void FourDecision()
{
var result = new List<ThreeDto>();
var list = Funs.DB.Run_ScheduleSetUp.Where(x => x.ProjectId == this.CurrUser.LoginProjectId && x.States == 3).OrderBy(o => o.LevelName).ToList();
if (list.Count > 0)
{
foreach (var item in list)
{
var rate = item.CompleteNum > 0 ? (float)Math.Round((float)item.CompleteNum / (float)item.AllNum * 100, 2, MidpointRounding.AwayFromZero) : 0;
if (rate > 100) rate = 100;
result.Add(new ThreeDto()
{
Name = item.LevelName,
Rate = rate
});
}
}
else
{
var fourlist = new List<FourDecisionScheduleBridDto>();
string allStr = $"select Level,COUNT(1) as AllNum,SUM(case ISNULL(a.DecisionIsClose,0) when 0 then 1 else 0 end) as NoCloseNum,SUM(case ISNULL(a.DecisionIsClose,0) when 1 then 1 else 0 end) as CloseNum from PreRun_SubThreeChecksFourDecision as a where a.ProjectId='{this.CurrUser.LoginProjectId}' group by a.Level order by a.Level asc";
var dt = SQLHelper.GetDataTableRunText(allStr);
if (dt.Rows.Count > 0)
{
fourlist = DataTableToList<FourDecisionScheduleBridDto>(dt);
foreach (var item in fourlist)
{
float rate = item.CloseNum > 0 ? (float)Math.Round((float)item.CloseNum / (float)item.AllNum * 100, 2, MidpointRounding.AwayFromZero) : 0;
result.Add(new ThreeDto()
{
Name = item.Level,
Rate = rate
});
}
}
}
fourDecisionStr = JsonConvert.SerializeObject(result);
}
#region
/// <summary>
/// 图2
/// </summary>
public class TwoDto
{
public float Rate { get; set; }
public string Name { get; set; }
}
/// <summary>
/// 图3
/// </summary>
public class ThreeDto
{
public string Name { get; set; }
public float Rate { get; set; }
}
public class WorkPackageInspectDto
{
/// <summary>
/// 工作包主键
/// </summary>
public string WorkPackId { get; set; }
/// <summary>
/// 工作包名称
/// </summary>
public string WorkPackName { get; set; }
/// <summary>
/// 检查表数量
/// </summary>
public int AllNum { get; set; }
/// <summary>
/// 未关闭任务单数量
/// </summary>
public int NoCloseNum { get; set; }
/// <summary>
/// 已关闭任务单数量
/// </summary>
public int CloseNum { get; set; }
}
public class Run_ScheduleSetUpDto : Run_ScheduleSetUp
{
/// <summary>
/// 工作包名称
/// </summary>
public string WorkPackName { get; set; }
}
public class TestRunScheduleDto
{
/// <summary>
/// 工作包主键
/// </summary>
public string WorkPackId { get; set; }
/// <summary>
/// 工作包名称
/// </summary>
public string WorkPackName { get; set; }
/// <summary>
/// 装置名称
/// </summary>
public string InstallationName { get; set; }
/// <summary>
/// 工序名称
/// </summary>
public string ProcessesName { get; set; }
/// <summary>
/// 系统名称
/// </summary>
public string SystemName { get; set; }
/// <summary>
/// 工作包数量
/// </summary>
public int WorkPackNum { get; set; }
/// <summary>
/// 工作包未关闭数量
/// </summary>
public int WorkPackNoCloseNum { get; set; }
/// <summary>
/// 工作包已关闭数量
/// </summary>
public int WorkPackCloseNum { get; set; }
/// <summary>
/// 检查表数量
/// </summary>
public int InspectNum { get; set; }
/// <summary>
/// 检查表未关闭数量
/// </summary>
public int InspectNoCloseNum { get; set; }
/// <summary>
/// 检查表已关闭数量
/// </summary>
public int InspectCloseNum { get; set; }
}
public class FourDecisionScheduleBridDto
{
/// <summary>
/// 级别
/// </summary>
public string Level { get; set; }
/// <summary>
/// 尾项数量
/// </summary>
public int AllNum { get; set; }
/// <summary>
/// 未关闭尾项数量
/// </summary>
public int NoCloseNum { get; set; }
/// <summary>
/// 已关闭尾项数量
/// </summary>
public int CloseNum { get; set; }
}
#endregion
#region
/// <summary>
/// DataTable转换List
/// </summary>
/// <returns></returns>
public List<T> DataTableToList<T>(DataTable table)
{
List<T> list = new List<T>();
T t = default(T);
PropertyInfo[] propertypes = null;
string tempName = string.Empty;
foreach (DataRow row in table.Rows)
{
t = Activator.CreateInstance<T>();
propertypes = t.GetType().GetProperties();
foreach (PropertyInfo pro in propertypes)
{
tempName = pro.Name;
if (table.Columns.Contains(tempName))
{
object value = row[tempName];
if (!value.ToString().Equals(""))
{
pro.SetValue(t, value, null);
}
}
}
list.Add(t);
}
return list.Count == 0 ? new List<T>() : list;
}
#endregion
}
}