焊接达因数、完成达因数汇总逻辑优化
This commit is contained in:
@@ -163,11 +163,13 @@
|
||||
<div class="hj-box_label"><asp:Literal runat="server" Text="<%$ Resources:Lan,main_new1_HjData_WelderNum_Label%>"/></div>
|
||||
</div>
|
||||
<div class="y_column">
|
||||
<div class="hj-box_number"><%=GetTotalDineNum() %></div>
|
||||
<%--<div class="hj-box_number"><%=GetTotalDineNum() %></div>--%>
|
||||
<div class="hj-box_number"><%=WeldDine.Size %></div>
|
||||
<div class="hj-box_label"><asp:Literal runat="server" Text="<%$ Resources:Lan,main_new1_HjData_TotalDineNum_Label%>"/></div>
|
||||
</div>
|
||||
<div class="y_column">
|
||||
<div class="hj-box_number" style="color: #12CDA2;"><%=GetCompleteDineNum() %></div>
|
||||
<%--<div class="hj-box_number" style="color: #12CDA2;"><%=GetCompleteDineNum() %></div>--%>
|
||||
<div class="hj-box_number" style="color: #12CDA2;"><%=WeldDine.DoneDin %></div>
|
||||
<div class="hj-box_label"><asp:Literal runat="server" Text="<%$ Resources:Lan,main_new1_HjData_CompleteDineNum_Label%>"/></div>
|
||||
</div>
|
||||
<div class="y_column">
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using BLL;
|
||||
using FineUIPro.Web.BaseInfo;
|
||||
using FineUIPro.Web.DataShow;
|
||||
using Model;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -68,6 +69,9 @@ namespace FineUIPro.Web.common
|
||||
|
||||
getCNEN();
|
||||
|
||||
//焊接达因数
|
||||
GetWeldDineOutput();
|
||||
|
||||
//焊接数据
|
||||
double result = 0;
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
@@ -554,6 +558,76 @@ namespace FineUIPro.Web.common
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
protected WeldDineOutput WeldDine = new WeldDineOutput();
|
||||
/// <summary>
|
||||
/// 获取总达因数和完成达因数
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public WeldDineOutput GetWeldDineOutput()
|
||||
{
|
||||
var projectIds = new List<string>();
|
||||
if (pids == null)
|
||||
{
|
||||
//加载所有在建项目的数据
|
||||
projectIds = Funs.DB.Base_Project.Where(x => x.ProjectState == "1").Select(x => x.ProjectId).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
projectIds = new List<string>(pids);
|
||||
}
|
||||
|
||||
var result = new List<WeldDineOutput>();
|
||||
var getD1 = from x in Funs.DB.HJGL_FL_TotalQuantity
|
||||
where projectIds.Contains(x.ProjectId)
|
||||
select x;
|
||||
var proIds = getD1.Select(x => x.ProjectId).Distinct();
|
||||
foreach (var pro in proIds)
|
||||
{
|
||||
double pTotalWeldQuantity = 0;
|
||||
double pTotalCompleted = 0;
|
||||
var proD1 = getD1.Where(x => x.ProjectId == pro);
|
||||
foreach (var item in getD1)
|
||||
{
|
||||
var dAll = !string.IsNullOrWhiteSpace(item.TotalWeldQuantity) ? Convert.ToDouble(item.TotalWeldQuantity) : 0;
|
||||
var dCompleted = !string.IsNullOrWhiteSpace(item.TotalCompleted) ? Convert.ToDouble(item.TotalCompleted) : 0;
|
||||
pTotalWeldQuantity += dAll;
|
||||
pTotalCompleted += dCompleted;
|
||||
}
|
||||
result.Add(new WeldDineOutput
|
||||
{
|
||||
ProjectId = pro,
|
||||
Size = pTotalWeldQuantity,
|
||||
DoneDin = pTotalCompleted
|
||||
});
|
||||
}
|
||||
|
||||
var differenceProjectIds = projectIds.Except(proIds).ToList();
|
||||
foreach (var pro in differenceProjectIds)
|
||||
{
|
||||
double pTotalWeldQuantity = 0;
|
||||
double pTotalCompleted = 0;
|
||||
var getD2 = (from x in Funs.DB.HJGL_FL_Data
|
||||
where x.ProjectId == pro
|
||||
orderby x.CompileDate descending
|
||||
select x).FirstOrDefault();
|
||||
if (getD2 != null)
|
||||
{
|
||||
pTotalWeldQuantity = !string.IsNullOrWhiteSpace(getD2.TotalWeldQuantity) ? Convert.ToDouble(getD2.TotalWeldQuantity) : 0;
|
||||
pTotalCompleted = !string.IsNullOrWhiteSpace(getD2.TotalCompleted) ? Convert.ToDouble(getD2.TotalCompleted) : 0;
|
||||
}
|
||||
result.Add(new WeldDineOutput
|
||||
{
|
||||
ProjectId = pro,
|
||||
Size = pTotalWeldQuantity,
|
||||
DoneDin = pTotalCompleted
|
||||
});
|
||||
}
|
||||
WeldDine.Size = Convert.ToInt32(result.Sum(x => x.Size));
|
||||
WeldDine.DoneDin = Convert.ToInt32(result.Sum(x => x.DoneDin));
|
||||
return WeldDine;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取总达因数
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user