移交递增报表
This commit is contained in:
@@ -0,0 +1,155 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using BLL;
|
||||
|
||||
namespace FineUIPro.Web.Transfer.Chart
|
||||
{
|
||||
public partial class TransferChart : PageBase
|
||||
{
|
||||
#region 定义项
|
||||
/// <summary>
|
||||
/// 项目主键
|
||||
/// </summary>
|
||||
public string ProjectId
|
||||
{
|
||||
get
|
||||
{
|
||||
return (string)ViewState["ProjectId"];
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["ProjectId"] = value;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 加载页面
|
||||
/// <summary>
|
||||
/// 加载页面
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
this.ProjectId = this.CurrUser.LoginProjectId;
|
||||
if (!string.IsNullOrEmpty(Request.Params["projectId"]))
|
||||
{
|
||||
this.ProjectId = Request.Params["projectId"];
|
||||
}
|
||||
|
||||
//this.AnalyseData();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 统计分析
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void BtnAnalyse_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.AnalyseData();
|
||||
}
|
||||
|
||||
#region 统计
|
||||
private void AnalyseData() {
|
||||
if (string.IsNullOrEmpty(ProjectId))
|
||||
{
|
||||
Alert.ShowInTop("项目未获取到,请刷新页面。", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
var sTime = DateTime.Now.AddDays(-7);
|
||||
var eTime = DateTime.Now;
|
||||
if (string.IsNullOrEmpty(txtStarTime.Text) || string.IsNullOrEmpty(txtEndTime.Text))
|
||||
{
|
||||
Alert.ShowInTop("请选择日期。", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
sTime = Convert.ToDateTime(txtStarTime.Text);
|
||||
|
||||
eTime = Convert.ToDateTime(txtEndTime.Text).AddMonths(1).AddDays(-1);
|
||||
}
|
||||
var AfinishedCountSum = 0;//总的实际完成数量
|
||||
var PfinishedCountSum = 0;//总的计划完成数量
|
||||
switch (drpType.SelectedValue)
|
||||
{
|
||||
#region 全部
|
||||
case "":
|
||||
//根据当前计划完成日期 查询总的计划完成的数量
|
||||
var systemListbyDate = Funs.DB.View_TransferDetail.Where(x => x.Projectid == ProjectId
|
||||
&& x.FDate >= sTime
|
||||
&& x.FDate < eTime
|
||||
&& x.Status.ToLower() == "finished").ToList();
|
||||
//查询TestPackage 去重
|
||||
var testpackageList = (from x in systemListbyDate select x.TestPackage).Distinct();
|
||||
|
||||
foreach (var item in testpackageList) {
|
||||
//查询第12个表的数量
|
||||
var punchlistFromList = Funs.DB.Transfer_PunchlistFrom.Where(x => x.ProjectId == ProjectId
|
||||
&& x.Test_Package == item
|
||||
).ToList();
|
||||
//如果查到
|
||||
if (punchlistFromList.Count > 0)
|
||||
{
|
||||
//12表当前日期完成的数量
|
||||
var punchlistFromFinshCount = punchlistFromList.Where(x => x.PUNCH_ITEM_STATUS.ToLower() == "finished").ToList().Count();
|
||||
//如果完成的数量等于总得数量,则是完成
|
||||
if (punchlistFromFinshCount == punchlistFromList.Count)
|
||||
{
|
||||
PfinishedCountSum += 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
PfinishedCountSum += 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
|
||||
DataTable dtTime = new DataTable();
|
||||
dtTime.Columns.Add("日期", typeof(string));
|
||||
dtTime.Columns.Add("Actual Finished", typeof(string));
|
||||
dtTime.Columns.Add("Plan Finished", typeof(string));
|
||||
|
||||
for (var i = sTime; i <= eTime; i = i.AddMonths(1)) {
|
||||
var AfinishedCount = 0;//实际完成数量
|
||||
var PfinishedCount = 0;//计划完成数量
|
||||
DataRow rowTime = dtTime.NewRow();
|
||||
rowTime["日期"] = string.Format("{0:yyyy-MM}", i);
|
||||
switch (drpType.SelectedValue)
|
||||
{
|
||||
#region 全部
|
||||
case "":
|
||||
//根据当前计划完成日期 查询完成的数量
|
||||
var systemListbyDate = Funs.DB.View_TransferDetail.Where(x => x.Projectid == ProjectId
|
||||
&& x.FDate >= Convert.ToDateTime(rowTime["日期"])
|
||||
&& x.FDate < Convert.ToDateTime(rowTime["日期"]).AddMonths(1)
|
||||
&& x.Status.ToLower()== "finished").ToList();
|
||||
//查询TestPackage的总数量,状态是完成的。
|
||||
var testpackageList = (from x in systemListbyDate select x.TestPackage).Distinct();
|
||||
foreach (var item in testpackageList) {
|
||||
|
||||
}
|
||||
break;
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user