试压看板增加排序和单位工程的试压包完成率
This commit is contained in:
parent
9760d553ab
commit
0ac7d74b5e
|
|
@ -680,9 +680,63 @@ namespace BLL
|
|||
if (!(totalJointNum > totalWeldingJointNum) && !(notCloseBatch > 0) && !(allPointJointNum > allOKCheckNum))
|
||||
passCount = result.TotalPipelines;
|
||||
}
|
||||
// 计算是否具备试压条件:全通过数量 == 管线数量且管线数>0
|
||||
result.CanPressureTest = (result.TotalPipelines > 0 && passCount == result.TotalPipelines);
|
||||
result.PassPipelines = passCount;// 全通过管线数
|
||||
// 计算管线通过率
|
||||
result.PipelinePassPercent = result.TotalPipelines > 0 ? Math.Round((decimal)passCount / result.TotalPipelines * 100, 2) : 0M;
|
||||
// 设置试压条件状态:>=100% -> 已具备;>=80% and <100% -> 易具备;<80% -> 未具备
|
||||
if (result.PipelinePassPercent >= 100M)
|
||||
{
|
||||
result.CanPressureTest = "已具备";
|
||||
}
|
||||
else if (result.PipelinePassPercent >= 80M)
|
||||
{
|
||||
result.CanPressureTest = "易具备";
|
||||
}
|
||||
else
|
||||
{
|
||||
result.CanPressureTest = "未具备";
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取单位工程下已完成试压包的通过率(完成试压包的通过数/总数*100,保留两位小数)
|
||||
/// </summary>
|
||||
/// <param name="projectId">项目ID</param>
|
||||
/// <param name="unitWorkId">单位工程ID</param>
|
||||
/// <returns>完成率百分比</returns>
|
||||
public static decimal GetTestPackagePassPercentByUnitWorkId(string projectId, string unitWorkId)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
// 获取该单位工程下所有试压包
|
||||
int totalPipelines = db.PTP_TestPackage.Count(x => x.ProjectId == projectId && x.UnitWorkId == unitWorkId) ;
|
||||
if (totalPipelines == 0)
|
||||
return 0M;
|
||||
int finishedPipelines = db.PTP_TestPackage.Count(x => x.ProjectId == projectId && x.UnitWorkId == unitWorkId&&x.FinishDate.HasValue);
|
||||
if (totalPipelines == 0)
|
||||
return 0M;
|
||||
return Math.Round((decimal)finishedPipelines / totalPipelines * 100, 2);
|
||||
}
|
||||
public static Dictionary<string, decimal> GetTestPackagePassPercentByProjectId(string projectId)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Dictionary<string, decimal> dic = new Dictionary<string, decimal>();
|
||||
// 获取该项目下所有单位工程分组统计
|
||||
var groupQuery = db.PTP_TestPackage
|
||||
.Where(x => x.ProjectId == projectId)
|
||||
.GroupBy(x => x.UnitWorkId)
|
||||
.Select(g => new {
|
||||
UnitWorkId = g.Key,
|
||||
Total = g.Count(),
|
||||
Finished = g.Count(t => t.FinishDate.HasValue)
|
||||
}).ToList();
|
||||
foreach (var item in groupQuery)
|
||||
{
|
||||
decimal percent = item.Total > 0 ? Math.Round((decimal)item.Finished / item.Total * 100, 2) : 0M;
|
||||
dic[item.UnitWorkId] = percent;
|
||||
}
|
||||
return dic;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -76,34 +76,30 @@
|
|||
runat="server" BoxFlex="1" DataKeyNames="PTP_ID" AllowCellEditing="true"
|
||||
EnableColumnLines="true" ClicksToEdit="2" DataIDField="PTP_ID" AllowSorting="true"
|
||||
SortField="TestPackageNo" SortDirection="ASC" EnableTextSelection="True"
|
||||
AllowPaging="true" IsDatabasePaging="false" PageSize="20" ForceFit="true">
|
||||
AllowPaging="true" IsDatabasePaging="false" PageSize="20" ForceFit="true">
|
||||
<Columns>
|
||||
<f:RenderField HeaderText="单位工程" ColumnID="UnitWorkName" DataField="UnitWorkName" SortField="UnitWorkName"
|
||||
FieldType="String" HeaderTextAlign="Center" TextAlign="Left" Width="140px">
|
||||
</f:RenderField>
|
||||
<f:RenderField HeaderText="试压包号" ColumnID="TestPackageNo" DataField="TestPackageNo" SortField="TestPackageNo"
|
||||
FieldType="String" HeaderTextAlign="Center" TextAlign="Left" Width="90px">
|
||||
</f:RenderField>
|
||||
<f:CheckBoxField RenderAsStaticField="true" DataField="CanPressureTest" HeaderText="是否具备试压条件" Width="120px" />
|
||||
</f:RenderField>
|
||||
<f:RenderField HeaderText="检测完成百分比" ColumnID="DetectionCompletionPercent" DataField="DetectionCompletionPercent" SortField="DetectionCompletionPercent"
|
||||
FieldType="String" HeaderTextAlign="Center" TextAlign="Left" Width="120px">
|
||||
</f:RenderField>
|
||||
<f:RenderField HeaderText="焊口完成百分比" ColumnID="WeldCompletionPercent" DataField="WeldCompletionPercent" SortField="WeldCompletionPercent"
|
||||
FieldType="String" HeaderTextAlign="Center" TextAlign="Left" Width="120px">
|
||||
</f:RenderField>
|
||||
<f:RenderField HeaderText="具备程度比值" ColumnID="TestPressure" DataField="TestPressure" SortField="TestPressure"
|
||||
FieldType="String" HeaderTextAlign="Center" TextAlign="Left" Width="90px">
|
||||
</f:RenderField>
|
||||
<f:RenderField HeaderText="状态" ColumnID="StateStr" DataField="StateStr" SortField="StateStr"
|
||||
FieldType="String" HeaderTextAlign="Center" TextAlign="Left" Width="90px">
|
||||
</f:RenderField>
|
||||
<f:RenderField HeaderText="已完成百分比" ColumnID="TestPressure" DataField="TestPressure" SortField="TestPressure"
|
||||
</f:RenderField>
|
||||
<f:RenderField HeaderText="是否具备试压条件" ColumnID="CanPressureTest" DataField="CanPressureTest" SortField="CanPressureTest"
|
||||
FieldType="String" HeaderTextAlign="Center" TextAlign="Left" Width="120px">
|
||||
</f:RenderField>
|
||||
<f:RenderField HeaderText="单位工程已完成百分比" ColumnID="TestPressure" DataField="TestPressure" SortField="TestPressure"
|
||||
FieldType="String" HeaderTextAlign="Center" TextAlign="Left" Width="120px">
|
||||
</f:RenderField>
|
||||
</Columns>
|
||||
</f:RenderField>
|
||||
<f:RenderField HeaderText="具备程度比值" ColumnID="PipelinePassPercent" DataField="PipelinePassPercent" SortField="PipelinePassPercent"
|
||||
FieldType="String" HeaderTextAlign="Center" TextAlign="Left" Width="90px">
|
||||
</f:RenderField>
|
||||
</Columns>
|
||||
</f:Grid>
|
||||
|
||||
</Items>
|
||||
|
|
|
|||
|
|
@ -197,15 +197,16 @@ namespace FineUIPro.Web.HJGL.TestPackage
|
|||
unitWork2 = (from x in unitWorkList where x.ProjectType == "2" select x).ToList();
|
||||
//}
|
||||
|
||||
var dicUnitWorkTestPackagePassPercent= BLL.TestPackageEditService.GetTestPackagePassPercentByProjectId(this.CurrUser.LoginProjectId);
|
||||
if (unitWork1.Count() > 0)
|
||||
{
|
||||
foreach (var q in unitWork1)
|
||||
{
|
||||
int a = (from x in Funs.DB.HJGL_Pipeline where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == q.UnitWorkId select x).Count();
|
||||
var unitNamesUnitIds = BLL.UnitService.getUnitNamesUnitIds(q.UnitId);
|
||||
TreeNode tn1 = new TreeNode();
|
||||
var unitWorkTestPackagePassPercent = dicUnitWorkTestPackagePassPercent.TryGetValue(q.UnitWorkId, out var value) ? value : 0;
|
||||
TreeNode tn1 = new TreeNode();
|
||||
tn1.NodeID = q.UnitWorkId;
|
||||
tn1.Text = q.UnitWorkName;
|
||||
tn1.Text = q.UnitWorkName+"(已完成"+ unitWorkTestPackagePassPercent+"%)";
|
||||
tn1.ToolTip = "施工单位:" + unitNamesUnitIds;
|
||||
tn1.CommandName = "单位工程";
|
||||
rootNode1.Nodes.Add(tn1);
|
||||
|
|
@ -217,11 +218,12 @@ namespace FineUIPro.Web.HJGL.TestPackage
|
|||
{
|
||||
foreach (var q in unitWork2)
|
||||
{
|
||||
int a = (from x in Funs.DB.HJGL_Pipeline where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == q.UnitWorkId select x).Count();
|
||||
var unitNamesUnitIds = BLL.UnitService.getUnitNamesUnitIds(q.UnitId);
|
||||
var unitWorkTestPackagePassPercent = dicUnitWorkTestPackagePassPercent.TryGetValue(q.UnitWorkId, out var value) ? value : 0;
|
||||
|
||||
TreeNode tn2 = new TreeNode();
|
||||
tn2.NodeID = q.UnitWorkId;
|
||||
tn2.Text = q.UnitWorkName;
|
||||
tn2.Text = q.UnitWorkName + "(已完成" + unitWorkTestPackagePassPercent + "%)";
|
||||
tn2.ToolTip = "施工单位:" + unitNamesUnitIds;
|
||||
tn2.CommandName = "单位工程";
|
||||
rootNode2.Nodes.Add(tn2);
|
||||
|
|
@ -342,6 +344,7 @@ namespace FineUIPro.Web.HJGL.TestPackage
|
|||
var analyze = BLL.TestPackageEditService.getTestPackageAnalyze(pkg.PTP_ID, pkg.ProjectId);
|
||||
analyzeList.Add(analyze);
|
||||
}
|
||||
analyzeList = analyzeList.OrderBy(x => x.UnitWorkName).ThenBy(x => x.TestPackageNo).ToList();
|
||||
// 绑定到Grid1
|
||||
Grid2.RecordCount = analyzeList.Count;
|
||||
Grid2.DataSource = analyzeList;
|
||||
|
|
|
|||
|
|
@ -253,7 +253,6 @@ namespace FineUIPro.Web.HJGL.TestPackage
|
|||
return;
|
||||
}
|
||||
Dictionary<string, string> printFiles = new Dictionary<string, string>();
|
||||
|
||||
foreach (var ptp_id in selectedRows)
|
||||
{
|
||||
var item = exportWord(ptp_id);
|
||||
|
|
@ -262,6 +261,7 @@ namespace FineUIPro.Web.HJGL.TestPackage
|
|||
}
|
||||
if (printFiles.Count>1)
|
||||
{
|
||||
string zipName = "";
|
||||
string rootPath = Funs.RootPath;
|
||||
string startPath = rootPath + "FileUpload\\试压包资料" + DateTime.Now.GetHashCode();
|
||||
if (!Directory.Exists(startPath))
|
||||
|
|
@ -273,18 +273,20 @@ namespace FineUIPro.Web.HJGL.TestPackage
|
|||
{
|
||||
var sourceFile = item.Key;
|
||||
var destFile = startPath + "\\" + item.Value;
|
||||
zipName+= item.Value.Replace(".pdf","")+"," ;
|
||||
if (File.Exists(sourceFile))
|
||||
{
|
||||
File.Copy(sourceFile, destFile, true);
|
||||
File.Delete(sourceFile);
|
||||
}
|
||||
}
|
||||
zipName= zipName.TrimEnd(',');
|
||||
System.IO.Compression.ZipFile.CreateFromDirectory(startPath, zipPath);
|
||||
FileInfo info = new FileInfo(zipPath);
|
||||
long fileSize = info.Length;
|
||||
System.Web.HttpContext.Current.Response.Clear();
|
||||
System.Web.HttpContext.Current.Response.ContentType = "application/x-zip-compressed";
|
||||
System.Web.HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode("试压包资料.zip", System.Text.Encoding.UTF8));
|
||||
System.Web.HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(zipName+".zip", System.Text.Encoding.UTF8));
|
||||
System.Web.HttpContext.Current.Response.AddHeader("Content-Length", fileSize.ToString());
|
||||
System.Web.HttpContext.Current.Response.TransmitFile(zipPath, 0, fileSize);
|
||||
System.Web.HttpContext.Current.Response.Flush();
|
||||
|
|
|
|||
|
|
@ -16,9 +16,14 @@
|
|||
public string UnitWorkName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否具备试压条件(全通过数量 == 管线数量,且未通过数为0)。
|
||||
/// 试压条件状态:"已具备"、"易具备"、"未具备"
|
||||
/// </summary>
|
||||
public bool CanPressureTest { get; set; }
|
||||
public string CanPressureTest { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 管线通过率(通过管线数 / 管线总数 * 100,保留两位小数)
|
||||
/// </summary>
|
||||
public decimal PipelinePassPercent { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 检测完成百分比(已检测焊口 / 总焊口 * 100,保留两位小数)。
|
||||
|
|
@ -34,6 +39,10 @@
|
|||
/// </summary>
|
||||
public string StateStr { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 当前试压包下的通过管线数。
|
||||
/// </summary>
|
||||
public int PassPipelines { get; set; }
|
||||
/// <summary>
|
||||
/// 当前试压包下的管线总数。
|
||||
/// </summary>
|
||||
|
|
|
|||
Loading…
Reference in New Issue