From 05b03a2f4e1521734e67e203043feb91ed9c5d97 Mon Sep 17 00:00:00 2001 From: wendy <408182087@qq.com> Date: Tue, 15 Jul 2025 17:25:56 +0800 Subject: [PATCH] =?UTF-8?q?20250715=20=E8=AF=95=E5=8E=8B=E5=8C=85=E8=B5=84?= =?UTF-8?q?=E6=96=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TestPackage/TestPackageEditService.cs | 18 +- .../JGZL/管道无损检测数量统计表.frx | 341 ++++++ .../JGZL/管道无损检测结果汇总表.frx | 368 ++++++ .../JGZL/管道材料材质标识检查记录.frx | 202 ++++ .../File/Fastreport/JGZL/管道焊接工作记录.frx | 224 ++++ .../Fastreport/JGZL/管道系统压力试验记录.frx | 272 ++++- .../HJGL/TestPackage/TestPackageData.aspx | 6 +- .../HJGL/TestPackage/TestPackageData.aspx.cs | 1048 ++++++++++++++++- 8 files changed, 2459 insertions(+), 20 deletions(-) create mode 100644 SGGL/FineUIPro.Web/File/Fastreport/JGZL/管道无损检测数量统计表.frx create mode 100644 SGGL/FineUIPro.Web/File/Fastreport/JGZL/管道无损检测结果汇总表.frx create mode 100644 SGGL/FineUIPro.Web/File/Fastreport/JGZL/管道材料材质标识检查记录.frx create mode 100644 SGGL/FineUIPro.Web/File/Fastreport/JGZL/管道焊接工作记录.frx diff --git a/SGGL/BLL/HJGL/TestPackage/TestPackageEditService.cs b/SGGL/BLL/HJGL/TestPackage/TestPackageEditService.cs index c1ddf1ef..fcf9ea3e 100644 --- a/SGGL/BLL/HJGL/TestPackage/TestPackageEditService.cs +++ b/SGGL/BLL/HJGL/TestPackage/TestPackageEditService.cs @@ -1,4 +1,6 @@ using Model; +using NPOI.SS.Formula.Functions; +using NPOI.SS.UserModel; using System; using System.Collections.Generic; using System.Linq; @@ -435,7 +437,7 @@ namespace BLL { foreach (var pipeline in oldPipeline) { - DeletePipelineListByPTP_ID(pipeline.PTP_ID); + DeletePipelineListByPTP_ID(pipeline.PTP_ID); } } @@ -464,5 +466,19 @@ namespace BLL db.SubmitChanges(); } } + + /// + /// 修改试压包打印状态 + /// + /// + public static void UpdateTestPackagePrintState(Model.PTP_TestPackage testPackage) + { + Model.PTP_TestPackage newTestPackage = Funs.DB.PTP_TestPackage.FirstOrDefault(e => e.PTP_ID == testPackage.PTP_ID); + if (newTestPackage != null) + { + newTestPackage.PrintState = testPackage.PrintState; + Funs.DB.SubmitChanges(); + } + } } } diff --git a/SGGL/FineUIPro.Web/File/Fastreport/JGZL/管道无损检测数量统计表.frx b/SGGL/FineUIPro.Web/File/Fastreport/JGZL/管道无损检测数量统计表.frx new file mode 100644 index 00000000..403719ab --- /dev/null +++ b/SGGL/FineUIPro.Web/File/Fastreport/JGZL/管道无损检测数量统计表.frx @@ -0,0 +1,341 @@ + + + using System; +using System.Collections; +using System.Collections.Generic; +using System.ComponentModel; +using System.Windows.Forms; +using System.Drawing; +using System.Data; +using FastReport; +using FastReport.Data; +using FastReport.Dialog; +using FastReport.Barcode; +using FastReport.Table; +using FastReport.Utils; + +namespace FastReport +{ + public class ReportScript + { + + private void Table3_ManualBuild(object sender, EventArgs e) + { + DataSourceBase rowData = Report.GetDataSource("Data"); + // init the data source + rowData.Init(); + + // print the first table row - it is a header + + // now enumerate the data source and print the table body + while (rowData.HasMoreRows) + { + // print the table body + Table3.PrintRow(0); + Table3.PrintColumns(); + + // go next data source row + rowData.Next(); + } + } + } +} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/File/Fastreport/JGZL/管道无损检测结果汇总表.frx b/SGGL/FineUIPro.Web/File/Fastreport/JGZL/管道无损检测结果汇总表.frx new file mode 100644 index 00000000..740d904b --- /dev/null +++ b/SGGL/FineUIPro.Web/File/Fastreport/JGZL/管道无损检测结果汇总表.frx @@ -0,0 +1,368 @@ + + + using System; +using System.Collections; +using System.Collections.Generic; +using System.ComponentModel; +using System.Windows.Forms; +using System.Drawing; +using System.Data; +using FastReport; +using FastReport.Data; +using FastReport.Dialog; +using FastReport.Barcode; +using FastReport.Table; +using FastReport.Utils; + +namespace FastReport +{ + public class ReportScript + { + + private int x; + private string header=""; + private string s=""; + + private void Table9_ManualBuild(object sender, EventArgs e) + { + DataSourceBase rowData = Report.GetDataSource("Data"); + // init the data source + rowData.Init(); + x=0; + // print the first table row - it is a header + + // now enumerate the data source and print the table body + while (rowData.HasMoreRows) + { + // print the table body + x++; + Table9.PrintRow(0); + Table9.PrintColumns(); + + // go next data source row + rowData.Next(); + } + } + + private void Cell2_BeforePrint(object sender, EventArgs e) + { + if (Report.Engine.PageNo>1) + { + header="(续)"; + + } + } + + private void Cell1_BeforePrint(object sender, EventArgs e) + { + if (Report.Engine.PageNo>1) + { + s="2"; + } + else + { + s="1"; + } + } + } +} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/File/Fastreport/JGZL/管道材料材质标识检查记录.frx b/SGGL/FineUIPro.Web/File/Fastreport/JGZL/管道材料材质标识检查记录.frx new file mode 100644 index 00000000..eeb29ab2 --- /dev/null +++ b/SGGL/FineUIPro.Web/File/Fastreport/JGZL/管道材料材质标识检查记录.frx @@ -0,0 +1,202 @@ + + + using System; +using System.Collections; +using System.Collections.Generic; +using System.ComponentModel; +using System.Windows.Forms; +using System.Drawing; +using System.Data; +using FastReport; +using FastReport.Data; +using FastReport.Dialog; +using FastReport.Barcode; +using FastReport.Table; +using FastReport.Utils; + +namespace FastReport +{ + public class ReportScript + { + + private void Table2_ManualBuild(object sender, EventArgs e) + { + DataSourceBase rowData = Report.GetDataSource("Data"); + // init the data source + rowData.Init(); + + // print the first table row - it is a header + + // now enumerate the data source and print the table body + while (rowData.HasMoreRows) + { + // print the table body + Table2.PrintRow(0); + Table2.PrintColumns(); + + // go next data source row + rowData.Next(); + } + } + } +} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/File/Fastreport/JGZL/管道焊接工作记录.frx b/SGGL/FineUIPro.Web/File/Fastreport/JGZL/管道焊接工作记录.frx new file mode 100644 index 00000000..d30f3ed1 --- /dev/null +++ b/SGGL/FineUIPro.Web/File/Fastreport/JGZL/管道焊接工作记录.frx @@ -0,0 +1,224 @@ + + + using System; +using System.Collections; +using System.Collections.Generic; +using System.ComponentModel; +using System.Windows.Forms; +using System.Drawing; +using System.Data; +using FastReport; +using FastReport.Data; +using FastReport.Dialog; +using FastReport.Barcode; +using FastReport.Table; +using FastReport.Utils; + +namespace FastReport +{ + public class ReportScript + { + + private void Table2_ManualBuild(object sender, EventArgs e) + { + DataSourceBase rowData = Report.GetDataSource("Data"); + // init the data source + rowData.Init(); + + // print the first table row - it is a header + + // now enumerate the data source and print the table body + while (rowData.HasMoreRows) + { + // print the table body + Table2.PrintRow(0); + Table2.PrintColumns(); + + // go next data source row + rowData.Next(); + } + } + } +} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/File/Fastreport/JGZL/管道系统压力试验记录.frx b/SGGL/FineUIPro.Web/File/Fastreport/JGZL/管道系统压力试验记录.frx index f29c6508..dd619c15 100644 --- a/SGGL/FineUIPro.Web/File/Fastreport/JGZL/管道系统压力试验记录.frx +++ b/SGGL/FineUIPro.Web/File/Fastreport/JGZL/管道系统压力试验记录.frx @@ -1,9 +1,269 @@  - - - - - - + + using System; +using System.Collections; +using System.Collections.Generic; +using System.ComponentModel; +using System.Windows.Forms; +using System.Drawing; +using System.Data; +using FastReport; +using FastReport.Data; +using FastReport.Dialog; +using FastReport.Barcode; +using FastReport.Table; +using FastReport.Utils; + +namespace FastReport +{ + public class ReportScript + { + + private void Table2_ManualBuild(object sender, EventArgs e) + { + DataSourceBase rowData = Report.GetDataSource("Data"); + // init the data source + rowData.Init(); + + // print the first table row - it is a header + + // now enumerate the data source and print the table body + while (rowData.HasMoreRows) + { + // print the table body + Table2.PrintRow(0); + Table2.PrintColumns(); + + // go next data source row + rowData.Next(); + } + } + } +} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/HJGL/TestPackage/TestPackageData.aspx b/SGGL/FineUIPro.Web/HJGL/TestPackage/TestPackageData.aspx index e99e0005..f57b4fe2 100644 --- a/SGGL/FineUIPro.Web/HJGL/TestPackage/TestPackageData.aspx +++ b/SGGL/FineUIPro.Web/HJGL/TestPackage/TestPackageData.aspx @@ -54,13 +54,13 @@ - + - diff --git a/SGGL/FineUIPro.Web/HJGL/TestPackage/TestPackageData.aspx.cs b/SGGL/FineUIPro.Web/HJGL/TestPackage/TestPackageData.aspx.cs index 31b0f69e..44802675 100644 --- a/SGGL/FineUIPro.Web/HJGL/TestPackage/TestPackageData.aspx.cs +++ b/SGGL/FineUIPro.Web/HJGL/TestPackage/TestPackageData.aspx.cs @@ -9,6 +9,8 @@ using System.Web.UI; using System.Web.UI.WebControls; using System.IO; using Model; +using Microsoft.SqlServer.Server; +using NPOI.SS.Formula.Functions; namespace FineUIPro.Web.HJGL.TestPackage { @@ -167,7 +169,9 @@ namespace FineUIPro.Web.HJGL.TestPackage t.UnitId, t.UnitWorkId, t.TestPackageNo, - t.TestPackageName + t.TestPackageName, + (case when t.PrintState>0 then '第'+convert(varchar(10),t.PrintState)+'次打印' else '未打印' end) as PrintState, + t.TableDate from PTP_TestPackage t where t.ProjectId=@projectId and t.UnitWorkId=@unitWorkId"; List listStr = new List(); listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId)); @@ -247,25 +251,36 @@ namespace FineUIPro.Web.HJGL.TestPackage { if (!string.IsNullOrEmpty(this.PTP_ID)) { + //修改试压包打印状态 var updateTestPackage = Funs.DB.PTP_TestPackage.FirstOrDefault(x => x.PTP_ID == this.PTP_ID); if (updateTestPackage != null) { + if (updateTestPackage.PrintState.HasValue && updateTestPackage.PrintState > 0) + { + updateTestPackage.PrintState = updateTestPackage.PrintState + 1; + } + else + { + updateTestPackage.PrintState = 1; + } + BLL.TestPackageEditService.UpdateTestPackagePrintState(updateTestPackage); + string rootPath = Server.MapPath("~/"); BLL.FastReportService.ResetData(); if (this.drpPrintType.SelectedValue == "1")//pdf格式 { - ListItem[] list = new ListItem[5]; + ListItem[] list = new ListItem[10]; list[0] = new ListItem("0", "File\\Fastreport\\JGZL\\管道试压包文件资料.frx"); list[1] = new ListItem("1", "File\\Fastreport\\JGZL\\管道压力试验技术要求.frx"); list[2] = new ListItem("2", "File\\Fastreport\\JGZL\\管道压力包文件资料目录.frx"); list[3] = new ListItem("3", "File\\Fastreport\\JGZL\\管道系统压力试验条件确认记录.frx"); list[4] = new ListItem("4", "File\\Fastreport\\JGZL\\管道试压包尾项清单.frx"); - //list[5] = new ListItem("5", "File\\Fastreport\\JGZL\\管道系统压力试验记录.frx"); - //list[6] = new ListItem("6", "File\\Fastreport\\JGZL\\管道材料材质标识检查记录.frx"); - //list[7] = new ListItem("7", "File\\Fastreport\\JGZL\\管道焊接工作记录.frx"); - //list[8] = new ListItem("8", "File\\Fastreport\\JGZL\\管道无损检测数量统计表.frx"); - //list[9] = new ListItem("9", "File\\Fastreport\\JGZL\\无损检测结果汇总表.frx"); + list[5] = new ListItem("5", "File\\Fastreport\\JGZL\\管道系统压力试验记录.frx"); + list[6] = new ListItem("6", "File\\Fastreport\\JGZL\\管道材料材质标识检查记录.frx"); + list[7] = new ListItem("7", "File\\Fastreport\\JGZL\\管道焊接工作记录.frx"); + list[8] = new ListItem("8", "File\\Fastreport\\JGZL\\管道无损检测数量统计表.frx"); + list[9] = new ListItem("9", "File\\Fastreport\\JGZL\\无损检测结果汇总表.frx"); List FastReportItemList = new List(); foreach (var item in list) @@ -281,7 +296,7 @@ namespace FineUIPro.Web.HJGL.TestPackage 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("交工资料.pdf", System.Text.Encoding.UTF8)); + System.Web.HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode("试压包资料.pdf", System.Text.Encoding.UTF8)); System.Web.HttpContext.Current.Response.AddHeader("Content-Length", fileSize.ToString()); System.Web.HttpContext.Current.Response.TransmitFile(Path, 0, fileSize); System.Web.HttpContext.Current.Response.Flush(); @@ -415,7 +430,7 @@ namespace FineUIPro.Web.HJGL.TestPackage break; case "1"://管道压力试验技术要求 { - Dictionary keyValuePairs = new Dictionary(); + Dictionary keyValuePairs = new Dictionary(); BLL.FastReportService.AddFastreportParameter(keyValuePairs); initTemplatePath = "File\\Fastreport\\JGZL\\管道压力试验技术要求.frx"; @@ -490,33 +505,1046 @@ namespace FineUIPro.Web.HJGL.TestPackage } break; case "5"://管道系统压力试验记录 - { + { + string sql = @"select PT_PipeId,PTP_ID,pipelineList.PipelineId,pipeline.PipelineCode,pipeline.DesignPress,pipeline.DesignTemperature, + testMedium.MediumName,pipelineList.TestPressure + from PTP_PipelineList as pipelineList + left join HJGL_Pipeline pipeline on pipeline.PipelineId = pipelineList.PipelineId + LEFT JOIN dbo.Base_TestMedium AS testMedium ON testMedium.TestMediumId = pipelineList.TestMedium + where PTP_ID=@ptp_id"; + List listStr = new List + { + new SqlParameter("@ptp_id", this.PTP_ID), + }; + SqlParameter[] parameter = listStr.ToArray(); + DataTable tb = SQLHelper.GetDataTableRunText(sql, parameter); + DataTable dt = new DataTable(); + dt.TableName = "Data"; + dt.Columns.Add("PipelineCode"); + dt.Columns.Add("DesignPress"); + dt.Columns.Add("DesignTemperature"); + dt.Columns.Add("MediumName"); + dt.Columns.Add("TestPressure"); + + for (int i = 0; i < tb.Rows.Count; i++) + { + var newRows = dt.NewRow(); + newRows["PipelineCode"] = tb.Rows[i]["PipelineCode"].ToString(); + newRows["DesignPress"] = tb.Rows[i]["DesignPress"].ToString(); + newRows["DesignTemperature"] = tb.Rows[i]["DesignTemperature"].ToString(); + newRows["MediumName"] = tb.Rows[i]["MediumName"].ToString(); + newRows["TestPressure"] = tb.Rows[i]["TestPressure"].ToString(); + + dt.Rows.Add(newRows); + } + BLL.FastReportService.AddFastreportTable(dt); + + var projectName = BLL.ProjectService.GetProjectNameByProjectId(this.CurrUser.LoginProjectId); + var InstallationName = BLL.UnitWorkService.getUnitWorkByUnitWorkId(updateTestPackage.UnitWorkId).UnitWorkName; + Dictionary keyValuePairs = new Dictionary(); + keyValuePairs.Add("ProjectName", projectName); + keyValuePairs.Add("InstallationName", InstallationName); + keyValuePairs.Add("TestPackageNo", updateTestPackage.TestPackageNo); + keyValuePairs.Add("TestPackageName", updateTestPackage.TestPackageName); + BLL.FastReportService.AddFastreportParameter(keyValuePairs); + + initTemplatePath = "File\\Fastreport\\JGZL\\管道系统压力试验记录.frx"; + + List dataTables = new List(); + dataTables.Add(dt); + fastReportItem.ReportPath = initTemplatePath; + fastReportItem.ParameterValues = keyValuePairs; + fastReportItem.DataTables = dataTables; } break; case "6"://管道材料材质标识检查记录 { + string sql = @"select PT_PipeId, PTP_ID,pipelineList.PipelineId,pipeline.PipelineCode + from PTP_PipelineList as pipelineList + left join HJGL_Pipeline as pipeline on pipeline.PipelineId = pipelineList.PipelineId + where PTP_ID=@ptp_id"; + List listStr = new List + { + new SqlParameter("@ptp_id", this.PTP_ID), + }; + SqlParameter[] parameter = listStr.ToArray(); + DataTable tb = SQLHelper.GetDataTableRunText(sql, parameter); + DataTable dt = new DataTable(); + dt.TableName = "Data"; + dt.Columns.Add("PipelineCode"); + dt.Columns.Add("ManterialCode"); + dt.Columns.Add("Specification"); + + for (int i = 0; i < tb.Rows.Count; i++) + { + var newRows = dt.NewRow(); + newRows["PipelineCode"] = tb.Rows[i]["PipelineCode"].ToString(); + newRows["ManterialCode"] = getMaterialCodeByPipelineId(tb.Rows[i]["PipelineId"].ToString()); + newRows["Specification"] = getSpecificationByPipelineId(tb.Rows[i]["PipelineId"].ToString()); + + dt.Rows.Add(newRows); + } + BLL.FastReportService.AddFastreportTable(dt); + + var projectName = BLL.ProjectService.GetProjectNameByProjectId(this.CurrUser.LoginProjectId); + var InstallationName = BLL.UnitWorkService.getUnitWorkByUnitWorkId(updateTestPackage.UnitWorkId).UnitWorkName; + Dictionary keyValuePairs = new Dictionary(); + keyValuePairs.Add("ProjectName", projectName); + keyValuePairs.Add("InstallationName", InstallationName); + BLL.FastReportService.AddFastreportParameter(keyValuePairs); + + initTemplatePath = "File\\Fastreport\\JGZL\\管道材料材质标识检查记录.frx"; + + List dataTables = new List(); + dataTables.Add(dt); + fastReportItem.ReportPath = initTemplatePath; + fastReportItem.ParameterValues = keyValuePairs; + fastReportItem.DataTables = dataTables; } break; case "7"://管道焊接工作记录 { + var iosList = BLL.TestPackageEditService.GetPipeLineListByPTP_ID(this.PTP_ID); + if (iosList.Count > 0) + { + var q = iosList[0]; + var isoIds = string.Join("','", iosList.Select(x => x.PipelineId).ToArray()); + string sql = @"select weldJoint.WeldJointId, + weldJoint.PipelineId, + weldJoint.ProjectId, + weldJoint.PipelineCode,--管线号 + weldJoint.WeldJointCode,--焊口号 + (case when person.WelderCode is not null then + case when person2.WelderCode is not null and person.WelderCode<>person2.WelderCode + then person.WelderCode+'/'+person2.WelderCode + else person2.WelderCode end + else person.WelderCode end) as WelderCode,--焊工代号 + weldJoint.Specification, --规格 + (case when material1.MaterialCode is not null then + case when material2.MaterialCode is not null and material1.MaterialCode<>material2.MaterialCode + then material1.MaterialCode+'/'+material2.MaterialCode + else material2.MaterialCode end + else material1.MaterialCode end) as MaterialCode, --材质 + weldJoint.WeldingLocationId,--焊接位置 + weldingMethod.WeldingMethodCode,--焊接方法 + (case when consumables1.ConsumablesName is not null then + case when consumables2.ConsumablesName is not null and consumables1.ConsumablesName<>consumables2.ConsumablesName + then consumables1.ConsumablesName+'+'+consumables2.ConsumablesName + else consumables2.ConsumablesName end + else consumables1.ConsumablesName end) as WeldingMaterial,--焊材牌号 + convert(varchar(10),weldingDaily.WeldingDate,111) as WeldingDate --焊接日期 + from HJGL_WeldJoint as weldJoint + left join HJGL_Pipeline as pipeline on pipeline.PipelineId = weldJoint.PipelineId + left join SitePerson_Person as person on person.PersonId = weldJoint.CoverWelderId + left join SitePerson_Person as person2 on person2.PersonId = weldJoint.BackingWelderId + left join Base_Material as material1 on material1.MaterialId = weldJoint.Material1Id + left join Base_Material as material2 on material2.MaterialId = weldJoint.Material2Id + left join HJGL_WeldingDaily as weldingDaily on weldingDaily.WeldingDailyId = weldJoint.WeldingDailyId + left join Base_WeldingMethod as weldingMethod on weldingMethod.WeldingMethodId = weldJoint.WeldingMethodId + left join Base_Consumables as consumables1 on consumables1.ConsumablesId = weldJoint.WeldingWire + left join Base_Consumables as consumables2 on consumables2.ConsumablesId = weldJoint.WeldingRod + where weldJoint.WeldingDailyId is not null and weldJoint.PipelineId in ('" + isoIds + "')"; + List listStr = new List + { + //new SqlParameter("@ptp_id", this.PTP_ID), + }; + SqlParameter[] parameter = listStr.ToArray(); + DataTable tb = SQLHelper.GetDataTableRunText(sql, parameter); + + DataTable dt = new DataTable(); + dt.TableName = "Data"; + dt.Columns.Add("PipelineCode"); + dt.Columns.Add("WeldJointCode"); + dt.Columns.Add("WelderCode"); + dt.Columns.Add("Specification"); + dt.Columns.Add("MaterialCode"); + dt.Columns.Add("WeldingLocationId"); + dt.Columns.Add("WeldingMethodCode"); + dt.Columns.Add("WeldingMaterial"); + dt.Columns.Add("WeldingDate"); + + for (int i = 0; i < tb.Rows.Count; i++) + { + var newRows = dt.NewRow(); + newRows["PipelineCode"] = tb.Rows[i]["PipelineCode"].ToString(); + newRows["WeldJointCode"] = tb.Rows[i]["WeldJointCode"].ToString(); + newRows["WelderCode"] = tb.Rows[i]["WelderCode"].ToString(); + newRows["Specification"] = tb.Rows[i]["Specification"].ToString(); + newRows["MaterialCode"] = tb.Rows[i]["MaterialCode"].ToString(); + newRows["WeldingLocationId"] = tb.Rows[i]["WeldingLocationId"].ToString(); + newRows["WeldingMethodCode"] = tb.Rows[i]["WeldingMethodCode"].ToString(); + newRows["WeldingMaterial"] = tb.Rows[i]["WeldingMaterial"].ToString(); + newRows["WeldingDate"] = tb.Rows[i]["WeldingDate"].ToString(); + + dt.Rows.Add(newRows); + } + BLL.FastReportService.AddFastreportTable(dt); + + var projectName = BLL.ProjectService.GetProjectNameByProjectId(this.CurrUser.LoginProjectId); + var InstallationName = BLL.UnitWorkService.getUnitWorkByUnitWorkId(updateTestPackage.UnitWorkId).UnitWorkName; + Dictionary keyValuePairs = new Dictionary(); + keyValuePairs.Add("ProjectName", projectName); + keyValuePairs.Add("InstallationName", InstallationName); + BLL.FastReportService.AddFastreportParameter(keyValuePairs); + + initTemplatePath = "File\\Fastreport\\JGZL\\管道焊接工作记录.frx"; + + List dataTables = new List(); + dataTables.Add(dt); + fastReportItem.ReportPath = initTemplatePath; + fastReportItem.ParameterValues = keyValuePairs; + fastReportItem.DataTables = dataTables; + } } break; case "8"://管道无损检测数量统计表 { + var iosList = BLL.TestPackageEditService.GetPipeLineListByPTP_ID(this.PTP_ID); + if (iosList.Count > 0) + { + var q = iosList[0]; + var isoIds = string.Join("','", iosList.Select(x => x.PipelineId).ToArray()); + Dictionary keyValuePairs = new Dictionary(); + var projectName = BLL.ProjectService.GetProjectNameByProjectId(this.CurrUser.LoginProjectId); + var UnitWorkName = BLL.UnitWorkService.getUnitWorkByUnitWorkId(updateTestPackage.UnitWorkId).UnitWorkName; + keyValuePairs.Add("projectName", projectName); + keyValuePairs.Add("UnitWorkName", UnitWorkName); + BLL.FastReportService.AddFastreportParameter(keyValuePairs); + string sql3 = @"SELECT isoList.PT_PipeId, + isoList.PTP_ID, + isoList.PipelineId, + testPackage.ProjectId, + isoInfo.PipelineCode, + isoInfo.SingleNumber, + (convert(nvarchar(10),dr.DetectionRateValue)+'%') as DetectionRateValue, + '' as totalJotCountBW, + '' as RTtotalJotCountBW, + '' as UTtotalJotCountBW, + '' as MTtotalJotCountBW, + '' as PTtotalJotCountBW, + '' as totalJotCountFW, + '' as MTtotalJotCountFW, + '' as PTtotalJotCountFW, + '' as totalJotCountDW, + '' as RTtotalJotCountDW, + '' as UTtotalJotCountDW, + '' as MTtotalJotCountDW, + '' as PTtotalJotCountDW + FROM PTP_PipelineList AS isoList + LEFT JOIN PTP_TestPackage AS testPackage ON testPackage.PTP_ID = isoList.PTP_ID + LEFT JOIN HJGL_Pipeline AS isoInfo ON isoInfo.PipelineId = isoList.PipelineId + left join Base_DetectionRate as dr on dr.DetectionRateId = isoInfo.DetectionRateId + where isoList.PipelineId in ('" + isoIds + "')"; + DataTable dt = SQLHelper.GetDataTableRunText(sql3, null); + if (dt != null) + { + dt.TableName = "Data"; + for (int i = 0; i < dt.Rows.Count; i++) + { + #region 对接焊接头 + int totalJotCountBW = (from x in Funs.DB.HJGL_Batch_NDEItem + join t in Funs.DB.HJGL_Batch_BatchTrustItem on x.TrustBatchItemId equals t.TrustBatchItemId + join y in Funs.DB.HJGL_WeldJoint on t.WeldJointId equals y.WeldJointId + join z in Funs.DB.Base_WeldType on y.WeldTypeId equals z.WeldTypeId + where y.PipelineId == dt.Rows[i]["PipelineId"].ToString() + && x.CheckResult == "1" + && z.WeldTypeCode == "BW" + select x).Count();//对接检测合格数量 + int RTtotalJotCountBW = (from x in Funs.DB.HJGL_Batch_NDEItem + join t in Funs.DB.HJGL_Batch_BatchTrustItem on x.TrustBatchItemId equals t.TrustBatchItemId + join y in Funs.DB.HJGL_WeldJoint on t.WeldJointId equals y.WeldJointId + join z in Funs.DB.Base_WeldType on y.WeldTypeId equals z.WeldTypeId + join w in Funs.DB.Base_DetectionType on x.DetectionTypeId equals w.DetectionTypeId + where y.PipelineId == dt.Rows[i]["PipelineId"].ToString() + && x.CheckResult == "1" + && z.WeldTypeCode == "BW" + && w.DetectionTypeCode == "RT" + select x).Count();//RT对接检测合格数量 + int UTtotalJotCountBW = (from x in Funs.DB.HJGL_Batch_NDEItem + join t in Funs.DB.HJGL_Batch_BatchTrustItem on x.TrustBatchItemId equals t.TrustBatchItemId + join y in Funs.DB.HJGL_WeldJoint on t.WeldJointId equals y.WeldJointId + join z in Funs.DB.Base_WeldType on y.WeldTypeId equals z.WeldTypeId + join w in Funs.DB.Base_DetectionType on x.DetectionTypeId equals w.DetectionTypeId + where y.PipelineId == dt.Rows[i]["PipelineId"].ToString() + && x.CheckResult == "1" + && z.WeldTypeCode == "BW" + && w.DetectionTypeCode == "UT" + select x).Count();//UT对接检测合格数量 + int MTtotalJotCountBW = (from x in Funs.DB.HJGL_Batch_NDEItem + join t in Funs.DB.HJGL_Batch_BatchTrustItem on x.TrustBatchItemId equals t.TrustBatchItemId + join y in Funs.DB.HJGL_WeldJoint on t.WeldJointId equals y.WeldJointId + join z in Funs.DB.Base_WeldType on y.WeldTypeId equals z.WeldTypeId + join w in Funs.DB.Base_DetectionType on x.DetectionTypeId equals w.DetectionTypeId + where y.PipelineId == dt.Rows[i]["PipelineId"].ToString() + && x.CheckResult == "1" + && z.WeldTypeCode == "BW" + && w.DetectionTypeCode == "MT" + select x).Count();// MT对接检测合格数量 + int PTtotalJotCountBW = (from x in Funs.DB.HJGL_Batch_NDEItem + join t in Funs.DB.HJGL_Batch_BatchTrustItem on x.TrustBatchItemId equals t.TrustBatchItemId + join y in Funs.DB.HJGL_WeldJoint on t.WeldJointId equals y.WeldJointId + join z in Funs.DB.Base_WeldType on y.WeldTypeId equals z.WeldTypeId + join w in Funs.DB.Base_DetectionType on x.DetectionTypeId equals w.DetectionTypeId + where y.PipelineId == dt.Rows[i]["PipelineId"].ToString() + && x.CheckResult == "1" + && z.WeldTypeCode == "BW" + && w.DetectionTypeCode == "PT" + select x).Count();//PT对接检测合格数量 + + dt.Rows[i]["totalJotCountBW"] = totalJotCountBW.ToString(); + dt.Rows[i]["RTtotalJotCountBW"] = RTtotalJotCountBW.ToString(); + dt.Rows[i]["UTtotalJotCountBW"] = UTtotalJotCountBW.ToString(); + dt.Rows[i]["MTtotalJotCountBW"] = MTtotalJotCountBW.ToString(); + dt.Rows[i]["PTtotalJotCountBW"] = PTtotalJotCountBW.ToString(); + #endregion + + #region 角焊接头 + int totalJotCountFW = (from x in Funs.DB.HJGL_Batch_NDEItem + join t in Funs.DB.HJGL_Batch_BatchTrustItem on x.TrustBatchItemId equals t.TrustBatchItemId + join y in Funs.DB.HJGL_WeldJoint on t.WeldJointId equals y.WeldJointId + join z in Funs.DB.Base_WeldType on y.WeldTypeId equals z.WeldTypeId + where y.PipelineId == dt.Rows[i]["PipelineId"].ToString() + && x.CheckResult == "1" + && (z.WeldTypeCode == "C"|| z.WeldTypeCode == "E") + select x).Count();//对接检测合格数量 + int MTtotalJotCountFW = (from x in Funs.DB.HJGL_Batch_NDEItem + join t in Funs.DB.HJGL_Batch_BatchTrustItem on x.TrustBatchItemId equals t.TrustBatchItemId + join y in Funs.DB.HJGL_WeldJoint on t.WeldJointId equals y.WeldJointId + join z in Funs.DB.Base_WeldType on y.WeldTypeId equals z.WeldTypeId + join w in Funs.DB.Base_DetectionType on x.DetectionTypeId equals w.DetectionTypeId + where y.PipelineId == dt.Rows[i]["PipelineId"].ToString() + && x.CheckResult == "1" + && (z.WeldTypeCode == "C" || z.WeldTypeCode == "E") + && w.DetectionTypeCode == "MT" + select x).Count();//MT对接检测合格数量 + int PTtotalJotCountFW = (from x in Funs.DB.HJGL_Batch_NDEItem + join t in Funs.DB.HJGL_Batch_BatchTrustItem on x.TrustBatchItemId equals t.TrustBatchItemId + join y in Funs.DB.HJGL_WeldJoint on t.WeldJointId equals y.WeldJointId + join z in Funs.DB.Base_WeldType on y.WeldTypeId equals z.WeldTypeId + join w in Funs.DB.Base_DetectionType on x.DetectionTypeId equals w.DetectionTypeId + where y.PipelineId == dt.Rows[i]["PipelineId"].ToString() + && x.CheckResult == "1" + && (z.WeldTypeCode == "C" || z.WeldTypeCode == "E") + && w.DetectionTypeCode == "PT" + select x).Count();//PT对接检测合格数量 + + dt.Rows[i]["totalJotCountFW"] = totalJotCountFW.ToString(); + dt.Rows[i]["MTtotalJotCountFW"] = MTtotalJotCountFW.ToString(); + dt.Rows[i]["PTtotalJotCountFW"] = PTtotalJotCountFW.ToString(); + #endregion + + #region 支管连接接头 + int totalJotCountDW = (from x in Funs.DB.HJGL_Batch_NDEItem + join t in Funs.DB.HJGL_Batch_BatchTrustItem on x.TrustBatchItemId equals t.TrustBatchItemId + join y in Funs.DB.HJGL_WeldJoint on t.WeldJointId equals y.WeldJointId + join z in Funs.DB.Base_WeldType on y.WeldTypeId equals z.WeldTypeId + where y.PipelineId == dt.Rows[i]["PipelineId"].ToString() + && x.CheckResult == "1" + && z.WeldTypeCode == "D" + select x).Count();//支管检测合格数量 + int RTtotalJotCountDW = (from x in Funs.DB.HJGL_Batch_NDEItem + join t in Funs.DB.HJGL_Batch_BatchTrustItem on x.TrustBatchItemId equals t.TrustBatchItemId + join y in Funs.DB.HJGL_WeldJoint on t.WeldJointId equals y.WeldJointId + join z in Funs.DB.Base_WeldType on y.WeldTypeId equals z.WeldTypeId + join w in Funs.DB.Base_DetectionType on x.DetectionTypeId equals w.DetectionTypeId + where y.PipelineId == dt.Rows[i]["PipelineId"].ToString() + && x.CheckResult == "1" + && z.WeldTypeCode == "D" + && w.DetectionTypeCode == "RT" + select x).Count();//支管检测合格数量 + int UTtotalJotCountDW = (from x in Funs.DB.HJGL_Batch_NDEItem + join t in Funs.DB.HJGL_Batch_BatchTrustItem on x.TrustBatchItemId equals t.TrustBatchItemId + join y in Funs.DB.HJGL_WeldJoint on t.WeldJointId equals y.WeldJointId + join z in Funs.DB.Base_WeldType on y.WeldTypeId equals z.WeldTypeId + join w in Funs.DB.Base_DetectionType on x.DetectionTypeId equals w.DetectionTypeId + where y.PipelineId == dt.Rows[i]["PipelineId"].ToString() + && x.CheckResult == "1" + && z.WeldTypeCode == "D" + && w.DetectionTypeCode == "UT" + select x).Count();//支管检测合格数量 + int MTtotalJotCountDW = (from x in Funs.DB.HJGL_Batch_NDEItem + join t in Funs.DB.HJGL_Batch_BatchTrustItem on x.TrustBatchItemId equals t.TrustBatchItemId + join y in Funs.DB.HJGL_WeldJoint on t.WeldJointId equals y.WeldJointId + join z in Funs.DB.Base_WeldType on y.WeldTypeId equals z.WeldTypeId + join w in Funs.DB.Base_DetectionType on x.DetectionTypeId equals w.DetectionTypeId + where y.PipelineId == dt.Rows[i]["PipelineId"].ToString() + && x.CheckResult == "1" + && z.WeldTypeCode == "D" + && w.DetectionTypeCode == "MT" + select x).Count();//支管检测合格数量 + int PTtotalJotCountDW = (from x in Funs.DB.HJGL_Batch_NDEItem + join t in Funs.DB.HJGL_Batch_BatchTrustItem on x.TrustBatchItemId equals t.TrustBatchItemId + join y in Funs.DB.HJGL_WeldJoint on t.WeldJointId equals y.WeldJointId + join z in Funs.DB.Base_WeldType on y.WeldTypeId equals z.WeldTypeId + join w in Funs.DB.Base_DetectionType on x.DetectionTypeId equals w.DetectionTypeId + where y.PipelineId == dt.Rows[i]["PipelineId"].ToString() + && x.CheckResult == "1" + && z.WeldTypeCode == "D" + && w.DetectionTypeCode == "PT" + select x).Count();//支管检测合格数量 + + dt.Rows[i]["totalJotCountDW"] = totalJotCountDW.ToString(); + dt.Rows[i]["RTtotalJotCountDW"] = RTtotalJotCountDW.ToString(); + dt.Rows[i]["UTtotalJotCountDW"] = UTtotalJotCountDW.ToString(); + dt.Rows[i]["MTtotalJotCountDW"] = MTtotalJotCountDW.ToString(); + dt.Rows[i]["PTtotalJotCountDW"] = PTtotalJotCountDW.ToString(); + #endregion + } + } + BLL.FastReportService.AddFastreportTable(dt); + initTemplatePath = "File\\Fastreport\\JGZL\\管道无损检测数量统计表.frx"; + List dataTables = new List(); + dataTables.Add(dt); + fastReportItem.ReportPath = initTemplatePath; + fastReportItem.ParameterValues = keyValuePairs; + fastReportItem.DataTables = dataTables; + } } break; case "9"://无损检测结果汇总表 { + var iosList = BLL.TestPackageEditService.GetPipeLineListByPTP_ID(this.PTP_ID); + if (iosList.Count > 0) + { + var q = iosList[0]; + var isoNos = string.Join("','", iosList.Select(x => x.PipelineCode).ToArray()); + var isoIds = string.Join("','", iosList.Select(x => x.PipelineId).ToArray()); + Dictionary keyValuePairs = new Dictionary(); + var projectName = BLL.ProjectService.GetProjectNameByProjectId(this.CurrUser.LoginProjectId); + var UnitWorkName = BLL.UnitWorkService.getUnitWorkByUnitWorkId(updateTestPackage.UnitWorkId).UnitWorkName; + var unitNames = BLL.UnitService.GetUnitNameByUnitId(updateTestPackage.UnitId); + keyValuePairs.Add("ProjectName", projectName); + keyValuePairs.Add("UnitWorkName", UnitWorkName); + keyValuePairs.Add("UnitName2", unitNames);//施工单位 + if (!string.IsNullOrEmpty(q.PipingClassId)) + { + var PipingClass = BLL.Base_PipingClassService.GetPipingClassByPipingClassId(q.PipingClassId); + if (PipingClass != null) + { + keyValuePairs.Add("ISOLevel", PipingClass.PipingClassName); + } + } + keyValuePairs.Add("isoCode", isoNos); + //监理单位 + var Unit1 = BLL.UnitService.GetUnitByProjectIdUnitTypeList(this.CurrUser.LoginProjectId, BLL.Const.ProjectUnitType_3); + if (Unit1 != null) + { + var unitNames1 = string.Join(",", Unit1.Select(x => x.UnitName).ToArray()); + keyValuePairs.Add("UnitName1", unitNames1); + + } + #region 定义变量 + int rtdjJoint = 0;//RT对接焊口数 + int? rtdjFilm = 0;//RT对接片数 + int rtjhJoint = 0;//RT角焊焊口数 + int? rtjhFilm = 0;//RT角焊片数 + int rtzgJoint = 0;//RT支管连接焊口数 + int? rtzgFilm = 0;//RT支管连接片数 + + int utdjJoint = 0;//UT对接焊口数 + //int? utdjFilm = 0;//UT对接片数 + int utjhJoint = 0;//UT角焊焊口数 + //int? utjhFilm = 0;//UT角焊片数 + int utzgJoint = 0;//UT支管连接焊口数 + //int? utzgFilm = 0;//UT支管连接片数 + + int mtdjJoint = 0;//MT对接焊口数 + //int? mtdjFilm = 0;//MT对接片数 + int mtjhJoint = 0;//MT角焊焊口数 + //int? mtjhFilm = 0;//MT角焊片数 + int mtzgJoint = 0;//MT支管连接焊口数 + //int? mtzgFilm = 0;//MT支管连接片数 + + int ptdjJoint = 0;//PT对接焊口数 + //int? ptdjFilm = 0;//PT对接片数 + int ptjhJoint = 0;//PT角焊焊口数 + //int? ptjhFilm = 0;//PT角焊片数 + int ptzgJoint = 0;//PT支管连接焊口数 + //int? ptzgFilm = 0;//PT支管连接片数 + + int rtdjNoPassJoint = 0; + int? rtdjNoPassFilm = 0; + int rtjhNoPassJoint = 0; + int? rtjhNoPassFilm = 0; + int rtzgNoPassJoint = 0; + int? rtzgNoPassFilm = 0; + + int utdjNoPassJoint = 0; + decimal? utdjNoPassFilm = 0; + int utjhNoPassJoint = 0; + decimal? utjhNoPassFilm = 0; + int utzgNoPassJoint = 0; + decimal? utzgNoPassFilm = 0; + + int mtdjNoPassJoint = 0; + decimal? mtdjNoPassFilm = 0; + int mtjhNoPassJoint = 0; + decimal? mtjhNoPassFilm = 0; + int mtzgNoPassJoint = 0; + decimal? mtzgNoPassFilm = 0; + + int ptdjNoPassJoint = 0; + decimal? ptdjNoPassFilm = 0; + int ptjhNoPassJoint = 0; + decimal? ptjhNoPassFilm = 0; + int ptzgNoPassJoint = 0; + decimal? ptzgNoPassFilm = 0; + #endregion + foreach (var iso in iosList) + { + #region 检测数量统计 + #region RT对焊接头 + rtdjJoint += (from x in Funs.DB.HJGL_Batch_NDEItem + join y in Funs.DB.Base_DetectionType on x.DetectionTypeId equals y.DetectionTypeId + join t in Funs.DB.HJGL_Batch_BatchTrustItem on x.TrustBatchItemId equals t.TrustBatchItemId + join z in Funs.DB.HJGL_WeldJoint on t.WeldJointId equals z.WeldJointId + join w in Funs.DB.Base_WeldType on z.WeldTypeId equals w.WeldTypeId + where y.DetectionTypeCode == "RT" && w.WeldTypeCode == "BW" && z.PipelineId == iso.PipelineId + select x).Count();//RT对接焊口数 + + rtdjFilm += (from x in Funs.DB.HJGL_Batch_NDEItem + join y in Funs.DB.Base_DetectionType on x.DetectionTypeId equals y.DetectionTypeId + join t in Funs.DB.HJGL_Batch_BatchTrustItem on x.TrustBatchItemId equals t.TrustBatchItemId + join z in Funs.DB.HJGL_WeldJoint on t.WeldJointId equals z.WeldJointId + join w in Funs.DB.Base_WeldType on z.WeldTypeId equals w.WeldTypeId + where y.DetectionTypeCode == "RT" && w.WeldTypeCode == "BW" && z.PipelineId == iso.PipelineId + select x.TotalFilm).Sum();//RT对接片数 + #endregion + #region RT角焊接头 + rtjhJoint += (from x in Funs.DB.HJGL_Batch_NDEItem + join y in Funs.DB.Base_DetectionType on x.DetectionTypeId equals y.DetectionTypeId + join t in Funs.DB.HJGL_Batch_BatchTrustItem on x.TrustBatchItemId equals t.TrustBatchItemId + join z in Funs.DB.HJGL_WeldJoint on t.WeldJointId equals z.WeldJointId + join w in Funs.DB.Base_WeldType on z.WeldTypeId equals w.WeldTypeId + where y.DetectionTypeCode == "RT" && (w.WeldTypeCode == "C"|| w.WeldTypeCode == "E") && z.PipelineId == iso.PipelineId + select x).Count();//RT角焊焊口数 + + rtjhFilm += (from x in Funs.DB.HJGL_Batch_NDEItem + join y in Funs.DB.Base_DetectionType on x.DetectionTypeId equals y.DetectionTypeId + join t in Funs.DB.HJGL_Batch_BatchTrustItem on x.TrustBatchItemId equals t.TrustBatchItemId + join z in Funs.DB.HJGL_WeldJoint on t.WeldJointId equals z.WeldJointId + join w in Funs.DB.Base_WeldType on z.WeldTypeId equals w.WeldTypeId + where y.DetectionTypeCode == "RT" && (w.WeldTypeCode == "C" || w.WeldTypeCode == "E") && z.PipelineId == iso.PipelineId + select x.TotalFilm).Sum();//RT角焊片数 + #endregion + #region RT支管连接焊口数 + rtzgJoint += (from x in Funs.DB.HJGL_Batch_NDEItem + join y in Funs.DB.Base_DetectionType on x.DetectionTypeId equals y.DetectionTypeId + join t in Funs.DB.HJGL_Batch_BatchTrustItem on x.TrustBatchItemId equals t.TrustBatchItemId + join z in Funs.DB.HJGL_WeldJoint on t.WeldJointId equals z.WeldJointId + join w in Funs.DB.Base_WeldType on z.WeldTypeId equals w.WeldTypeId + where y.DetectionTypeCode == "RT" && w.WeldTypeCode == "D" && z.PipelineId == iso.PipelineId + select x).Count();//RT支管连接焊口数 + + rtzgFilm += (from x in Funs.DB.HJGL_Batch_NDEItem + join y in Funs.DB.Base_DetectionType on x.DetectionTypeId equals y.DetectionTypeId + join t in Funs.DB.HJGL_Batch_BatchTrustItem on x.TrustBatchItemId equals t.TrustBatchItemId + join z in Funs.DB.HJGL_WeldJoint on t.WeldJointId equals z.WeldJointId + join w in Funs.DB.Base_WeldType on z.WeldTypeId equals w.WeldTypeId + where y.DetectionTypeCode == "RT" && w.WeldTypeCode == "D" && z.PipelineId == iso.PipelineId + select x.TotalFilm).Sum();//RT支管连接片数 + #endregion + + #region UT对焊接头 + utdjJoint += (from x in Funs.DB.HJGL_Batch_NDEItem + join y in Funs.DB.Base_DetectionType on x.DetectionTypeId equals y.DetectionTypeId + join t in Funs.DB.HJGL_Batch_BatchTrustItem on x.TrustBatchItemId equals t.TrustBatchItemId + join z in Funs.DB.HJGL_WeldJoint on t.WeldJointId equals z.WeldJointId + join w in Funs.DB.Base_WeldType on z.WeldTypeId equals w.WeldTypeId + where y.DetectionTypeCode == "UT" && w.WeldTypeCode == "BW" && z.PipelineId == iso.PipelineId + select x).Count();//UT对接焊口数 + + //utdjFilm += (from x in Funs.DB.CH_CheckItem + // join y in Funs.DB.Base_DetectionType on x.CHT_CheckMethod equals y.DetectionTypeId + // join z in Funs.DB.PW_JointInfo on x.JOT_ID equals z.JOT_ID + // join w in Funs.DB.Base_WeldType on z.JOTY_ID equals w.WeldTypeId + // where y.DetectionTypeCode == "UT" && w.WeldTypeCode == "BW" && z.ISO_ID == iso.ISO_ID + // select x.CHT_TotalFilm).Sum();//UT对接片数 + #endregion + #region UT角焊接头 + utjhJoint += (from x in Funs.DB.HJGL_Batch_NDEItem + join y in Funs.DB.Base_DetectionType on x.DetectionTypeId equals y.DetectionTypeId + join t in Funs.DB.HJGL_Batch_BatchTrustItem on x.TrustBatchItemId equals t.TrustBatchItemId + join z in Funs.DB.HJGL_WeldJoint on t.WeldJointId equals z.WeldJointId + join w in Funs.DB.Base_WeldType on z.WeldTypeId equals w.WeldTypeId + where y.DetectionTypeCode == "UT" && (w.WeldTypeCode == "C" || w.WeldTypeCode == "E") && z.PipelineId == iso.PipelineId + select x).Count();//UT角焊焊口数 + //utjhFilm += (from x in Funs.DB.CH_CheckItem + // join y in Funs.DB.Base_DetectionType on x.CHT_CheckMethod equals y.DetectionTypeId + // join z in Funs.DB.PW_JointInfo on x.JOT_ID equals z.JOT_ID + // join w in Funs.DB.Base_WeldType on z.JOTY_ID equals w.WeldTypeId + // where y.DetectionTypeCode == "UT" && w.WeldTypeCode == "FW" && z.ISO_ID == iso.ISO_ID + // select x.CHT_TotalFilm).Sum();//UT角焊片数 + #endregion + #region UT支管连接焊口数 + utzgJoint += (from x in Funs.DB.HJGL_Batch_NDEItem + join y in Funs.DB.Base_DetectionType on x.DetectionTypeId equals y.DetectionTypeId + join t in Funs.DB.HJGL_Batch_BatchTrustItem on x.TrustBatchItemId equals t.TrustBatchItemId + join z in Funs.DB.HJGL_WeldJoint on t.WeldJointId equals z.WeldJointId + join w in Funs.DB.Base_WeldType on z.WeldTypeId equals w.WeldTypeId + where y.DetectionTypeCode == "UT" && w.WeldTypeCode == "D" && z.PipelineId == iso.PipelineId + select x).Count();//UT支管连接焊口数 + + //utzgFilm += (from x in Funs.DB.CH_CheckItem + // join y in Funs.DB.Base_DetectionType on x.CHT_CheckMethod equals y.DetectionTypeId + // join z in Funs.DB.PW_JointInfo on x.JOT_ID equals z.JOT_ID + // join w in Funs.DB.Base_WeldType on z.JOTY_ID equals w.WeldTypeId + // where y.DetectionTypeCode == "UT" && w.WeldTypeCode == "DW" && z.ISO_ID == iso.ISO_ID + // select x.CHT_TotalFilm).Sum();//UT支管连接片数 + #endregion + + #region MT对焊接头 + mtdjJoint += (from x in Funs.DB.HJGL_Batch_NDEItem + join y in Funs.DB.Base_DetectionType on x.DetectionTypeId equals y.DetectionTypeId + join t in Funs.DB.HJGL_Batch_BatchTrustItem on x.TrustBatchItemId equals t.TrustBatchItemId + join z in Funs.DB.HJGL_WeldJoint on t.WeldJointId equals z.WeldJointId + join w in Funs.DB.Base_WeldType on z.WeldTypeId equals w.WeldTypeId + where y.DetectionTypeCode == "MT" && w.WeldTypeCode == "BW" && z.PipelineId == iso.PipelineId + select x).Count();//MT对接焊口数 + + //mtdjFilm += (from x in Funs.DB.CH_CheckItem + // join y in Funs.DB.Base_DetectionType on x.CHT_CheckMethod equals y.DetectionTypeId + // join z in Funs.DB.PW_JointInfo on x.JOT_ID equals z.JOT_ID + // join w in Funs.DB.Base_WeldType on z.JOTY_ID equals w.WeldTypeId + // where y.DetectionTypeCode == "MT" && w.WeldTypeCode == "BW" && z.ISO_ID == iso.ISO_ID + // select x.CHT_TotalFilm).Sum();//MT对接片数 + #endregion + #region MT角焊接头 + mtjhJoint += (from x in Funs.DB.HJGL_Batch_NDEItem + join y in Funs.DB.Base_DetectionType on x.DetectionTypeId equals y.DetectionTypeId + join t in Funs.DB.HJGL_Batch_BatchTrustItem on x.TrustBatchItemId equals t.TrustBatchItemId + join z in Funs.DB.HJGL_WeldJoint on t.WeldJointId equals z.WeldJointId + join w in Funs.DB.Base_WeldType on z.WeldTypeId equals w.WeldTypeId + where y.DetectionTypeCode == "MT" && (w.WeldTypeCode == "C" || w.WeldTypeCode == "E") && z.PipelineId == iso.PipelineId + select x).Count();//MT角焊焊口数 + + //mtjhFilm += (from x in Funs.DB.CH_CheckItem + // join y in Funs.DB.Base_DetectionType on x.CHT_CheckMethod equals y.DetectionTypeId + // join z in Funs.DB.PW_JointInfo on x.JOT_ID equals z.JOT_ID + // join w in Funs.DB.Base_WeldType on z.JOTY_ID equals w.WeldTypeId + // where y.DetectionTypeCode == "MT" && w.WeldTypeCode == "FW" && z.ISO_ID == iso.ISO_ID + // select x.CHT_TotalFilm).Sum();//MT角焊片数 + #endregion + #region MT支管连接焊口数 + mtzgJoint += (from x in Funs.DB.HJGL_Batch_NDEItem + join y in Funs.DB.Base_DetectionType on x.DetectionTypeId equals y.DetectionTypeId + join t in Funs.DB.HJGL_Batch_BatchTrustItem on x.TrustBatchItemId equals t.TrustBatchItemId + join z in Funs.DB.HJGL_WeldJoint on t.WeldJointId equals z.WeldJointId + join w in Funs.DB.Base_WeldType on z.WeldTypeId equals w.WeldTypeId + where y.DetectionTypeCode == "MT" && w.WeldTypeCode == "D" && z.PipelineId == iso.PipelineId + select x).Count();//MT支管连接焊口数 + //mtzgFilm += (from x in Funs.DB.CH_CheckItem + // join y in Funs.DB.Base_DetectionType on x.CHT_CheckMethod equals y.DetectionTypeId + // join z in Funs.DB.PW_JointInfo on x.JOT_ID equals z.JOT_ID + // join w in Funs.DB.Base_WeldType on z.JOTY_ID equals w.WeldTypeId + // where y.DetectionTypeCode == "MT" && w.WeldTypeCode == "DW" && z.ISO_ID == iso.ISO_ID + // select x.CHT_TotalFilm).Sum();//MT支管连接片数 + #endregion + + #region PT对焊接头 + ptdjJoint += (from x in Funs.DB.HJGL_Batch_NDEItem + join y in Funs.DB.Base_DetectionType on x.DetectionTypeId equals y.DetectionTypeId + join t in Funs.DB.HJGL_Batch_BatchTrustItem on x.TrustBatchItemId equals t.TrustBatchItemId + join z in Funs.DB.HJGL_WeldJoint on t.WeldJointId equals z.WeldJointId + join w in Funs.DB.Base_WeldType on z.WeldTypeId equals w.WeldTypeId + where y.DetectionTypeCode == "PT" && w.WeldTypeCode == "BW" && z.PipelineId == iso.PipelineId + select x).Count();//PT对接焊口数 + //ptdjFilm += (from x in Funs.DB.CH_CheckItem + // join y in Funs.DB.Base_DetectionType on x.CHT_CheckMethod equals y.DetectionTypeId + // join z in Funs.DB.PW_JointInfo on x.JOT_ID equals z.JOT_ID + // join w in Funs.DB.Base_WeldType on z.JOTY_ID equals w.WeldTypeId + // where y.DetectionTypeCode == "PT" && w.WeldTypeCode == "BW" && z.ISO_ID == iso.ISO_ID + // select x.CHT_TotalFilm).Sum();//PT对接片数 + #endregion + #region PT角焊接头 + ptjhJoint += (from x in Funs.DB.HJGL_Batch_NDEItem + join y in Funs.DB.Base_DetectionType on x.DetectionTypeId equals y.DetectionTypeId + join t in Funs.DB.HJGL_Batch_BatchTrustItem on x.TrustBatchItemId equals t.TrustBatchItemId + join z in Funs.DB.HJGL_WeldJoint on t.WeldJointId equals z.WeldJointId + join w in Funs.DB.Base_WeldType on z.WeldTypeId equals w.WeldTypeId + where y.DetectionTypeCode == "PT" && (w.WeldTypeCode == "C" || w.WeldTypeCode == "E") && z.PipelineId == iso.PipelineId + select x).Count();//PT角焊焊口数 + //ptjhFilm += (from x in Funs.DB.CH_CheckItem + // join y in Funs.DB.Base_DetectionType on x.CHT_CheckMethod equals y.DetectionTypeId + // join z in Funs.DB.PW_JointInfo on x.JOT_ID equals z.JOT_ID + // join w in Funs.DB.Base_WeldType on z.JOTY_ID equals w.WeldTypeId + // where y.DetectionTypeCode == "PT" && w.WeldTypeCode == "FW" && z.ISO_ID == iso.ISO_ID + // select x.CHT_TotalFilm).Sum();//PT角焊片数 + #endregion + #region PT支管连接焊口数 + ptzgJoint += (from x in Funs.DB.HJGL_Batch_NDEItem + join y in Funs.DB.Base_DetectionType on x.DetectionTypeId equals y.DetectionTypeId + join t in Funs.DB.HJGL_Batch_BatchTrustItem on x.TrustBatchItemId equals t.TrustBatchItemId + join z in Funs.DB.HJGL_WeldJoint on t.WeldJointId equals z.WeldJointId + join w in Funs.DB.Base_WeldType on z.WeldTypeId equals w.WeldTypeId + where y.DetectionTypeCode == "PT" && w.WeldTypeCode == "D" && z.PipelineId == iso.PipelineId + select x).Count();//PT支管连接焊口数 + //ptzgFilm += (from x in Funs.DB.CH_CheckItem + // join y in Funs.DB.Base_DetectionType on x.CHT_CheckMethod equals y.DetectionTypeId + // join z in Funs.DB.PW_JointInfo on x.JOT_ID equals z.JOT_ID + // join w in Funs.DB.Base_WeldType on z.JOTY_ID equals w.WeldTypeId + // where y.DetectionTypeCode == "PT" && w.WeldTypeCode == "DW" && z.ISO_ID == iso.ISO_ID + // select x.CHT_TotalFilm).Sum();//PT支管连接片数 + #endregion + #endregion + + #region 不合格情况统计 + #region RT对焊接头 + rtdjNoPassJoint += (from x in Funs.DB.HJGL_Batch_NDEItem + join y in Funs.DB.Base_DetectionType on x.DetectionTypeId equals y.DetectionTypeId + join t in Funs.DB.HJGL_Batch_BatchTrustItem on x.TrustBatchItemId equals t.TrustBatchItemId + join z in Funs.DB.HJGL_WeldJoint on t.WeldJointId equals z.WeldJointId + join w in Funs.DB.Base_WeldType on z.WeldTypeId equals w.WeldTypeId + where y.DetectionTypeCode == "RT" && w.WeldTypeCode == "BW" && z.PipelineId == iso.PipelineId && x.CheckResult == "2" + select x).Count();//RT对接焊口数 + rtdjNoPassFilm += (from x in Funs.DB.HJGL_Batch_NDEItem + join y in Funs.DB.Base_DetectionType on x.DetectionTypeId equals y.DetectionTypeId + join t in Funs.DB.HJGL_Batch_BatchTrustItem on x.TrustBatchItemId equals t.TrustBatchItemId + join z in Funs.DB.HJGL_WeldJoint on t.WeldJointId equals z.WeldJointId + join w in Funs.DB.Base_WeldType on z.WeldTypeId equals w.WeldTypeId + where y.DetectionTypeCode == "RT" && w.WeldTypeCode == "BW" && z.PipelineId == iso.PipelineId && x.CheckResult == "2" + select (x.TotalFilm - x.PassFilm)).Sum();//RT对接片数 + #endregion + #region RT角焊接头 + rtjhNoPassJoint += (from x in Funs.DB.HJGL_Batch_NDEItem + join y in Funs.DB.Base_DetectionType on x.DetectionTypeId equals y.DetectionTypeId + join t in Funs.DB.HJGL_Batch_BatchTrustItem on x.TrustBatchItemId equals t.TrustBatchItemId + join z in Funs.DB.HJGL_WeldJoint on t.WeldJointId equals z.WeldJointId + join w in Funs.DB.Base_WeldType on z.WeldTypeId equals w.WeldTypeId + where y.DetectionTypeCode == "RT" && (w.WeldTypeCode == "C" || w.WeldTypeCode=="E") && z.PipelineId == iso.PipelineId && x.CheckResult == "2" + select x).Count();//RT角焊焊口数 + + rtjhNoPassFilm += (from x in Funs.DB.HJGL_Batch_NDEItem + join y in Funs.DB.Base_DetectionType on x.DetectionTypeId equals y.DetectionTypeId + join t in Funs.DB.HJGL_Batch_BatchTrustItem on x.TrustBatchItemId equals t.TrustBatchItemId + join z in Funs.DB.HJGL_WeldJoint on t.WeldJointId equals z.WeldJointId + join w in Funs.DB.Base_WeldType on z.WeldTypeId equals w.WeldTypeId + where y.DetectionTypeCode == "RT" && (w.WeldTypeCode == "C" || w.WeldTypeCode == "E") && z.PipelineId == iso.PipelineId && x.CheckResult == "2" + select (x.TotalFilm - x.PassFilm)).Sum();//RT角焊片数 + #endregion + #region RT支管连接焊口数 + rtzgNoPassJoint += (from x in Funs.DB.HJGL_Batch_NDEItem + join y in Funs.DB.Base_DetectionType on x.DetectionTypeId equals y.DetectionTypeId + join t in Funs.DB.HJGL_Batch_BatchTrustItem on x.TrustBatchItemId equals t.TrustBatchItemId + join z in Funs.DB.HJGL_WeldJoint on t.WeldJointId equals z.WeldJointId + join w in Funs.DB.Base_WeldType on z.WeldTypeId equals w.WeldTypeId + where y.DetectionTypeCode == "RT" && w.WeldTypeCode == "D" && z.PipelineId == iso.PipelineId && x.CheckResult == "2" + select x).Count();//RT支管连接焊口数 + rtzgNoPassFilm += (from x in Funs.DB.HJGL_Batch_NDEItem + join y in Funs.DB.Base_DetectionType on x.DetectionTypeId equals y.DetectionTypeId + join t in Funs.DB.HJGL_Batch_BatchTrustItem on x.TrustBatchItemId equals t.TrustBatchItemId + join z in Funs.DB.HJGL_WeldJoint on t.WeldJointId equals z.WeldJointId + join w in Funs.DB.Base_WeldType on z.WeldTypeId equals w.WeldTypeId + where y.DetectionTypeCode == "RT" && w.WeldTypeCode == "D" && z.PipelineId == iso.PipelineId && x.CheckResult == "2" + select (x.TotalFilm - x.PassFilm)).Sum();//RT支管连接片数 + #endregion + + #region UT对焊接头 + utdjNoPassJoint += (from x in Funs.DB.HJGL_Batch_NDEItem + join y in Funs.DB.Base_DetectionType on x.DetectionTypeId equals y.DetectionTypeId + join t in Funs.DB.HJGL_Batch_BatchTrustItem on x.TrustBatchItemId equals t.TrustBatchItemId + join z in Funs.DB.HJGL_WeldJoint on t.WeldJointId equals z.WeldJointId + join w in Funs.DB.Base_WeldType on z.WeldTypeId equals w.WeldTypeId + where y.DetectionTypeCode == "UT" && w.WeldTypeCode == "BW" && z.PipelineId == iso.PipelineId && x.CheckResult == "2" + select x).Count();//UT对接焊口数 + + utdjNoPassFilm += (from x in Funs.DB.HJGL_Batch_NDEItem + join y in Funs.DB.Base_DetectionType on x.DetectionTypeId equals y.DetectionTypeId + join t in Funs.DB.HJGL_Batch_BatchTrustItem on x.TrustBatchItemId equals t.TrustBatchItemId + join z in Funs.DB.HJGL_WeldJoint on t.WeldJointId equals z.WeldJointId + join w in Funs.DB.Base_WeldType on z.WeldTypeId equals w.WeldTypeId + where y.DetectionTypeCode == "UT" && w.WeldTypeCode == "BW" && z.PipelineId == iso.PipelineId && x.CheckResult == "2" + select x.TotalFilm - x.PassFilm).Sum();//UT对接片数 + #endregion + #region UT角焊接头 + utjhNoPassJoint += (from x in Funs.DB.HJGL_Batch_NDEItem + join y in Funs.DB.Base_DetectionType on x.DetectionTypeId equals y.DetectionTypeId + join t in Funs.DB.HJGL_Batch_BatchTrustItem on x.TrustBatchItemId equals t.TrustBatchItemId + join z in Funs.DB.HJGL_WeldJoint on t.WeldJointId equals z.WeldJointId + join w in Funs.DB.Base_WeldType on z.WeldTypeId equals w.WeldTypeId + where y.DetectionTypeCode == "UT" && (w.WeldTypeCode == "C" || w.WeldTypeCode == "E") && z.PipelineId == iso.PipelineId && x.CheckResult == "2" + select x).Count();//UT角焊焊口数 + utjhNoPassFilm += (from x in Funs.DB.HJGL_Batch_NDEItem + join y in Funs.DB.Base_DetectionType on x.DetectionTypeId equals y.DetectionTypeId + join t in Funs.DB.HJGL_Batch_BatchTrustItem on x.TrustBatchItemId equals t.TrustBatchItemId + join z in Funs.DB.HJGL_WeldJoint on t.WeldJointId equals z.WeldJointId + join w in Funs.DB.Base_WeldType on z.WeldTypeId equals w.WeldTypeId + where y.DetectionTypeCode == "UT" && (w.WeldTypeCode == "C" || w.WeldTypeCode == "E") && z.PipelineId == iso.PipelineId && x.CheckResult == "2" + select x.TotalFilm - x.PassFilm).Sum();//UT角焊片数 + #endregion + #region UT支管连接焊口数 + utzgNoPassJoint += (from x in Funs.DB.HJGL_Batch_NDEItem + join y in Funs.DB.Base_DetectionType on x.DetectionTypeId equals y.DetectionTypeId + join t in Funs.DB.HJGL_Batch_BatchTrustItem on x.TrustBatchItemId equals t.TrustBatchItemId + join z in Funs.DB.HJGL_WeldJoint on t.WeldJointId equals z.WeldJointId + join w in Funs.DB.Base_WeldType on z.WeldTypeId equals w.WeldTypeId + where y.DetectionTypeCode == "UT" && w.WeldTypeCode == "D" && z.PipelineId == iso.PipelineId && x.CheckResult == "2" + select x).Count();//UT支管连接焊口数 + utzgNoPassFilm += (from x in Funs.DB.HJGL_Batch_NDEItem + join y in Funs.DB.Base_DetectionType on x.DetectionTypeId equals y.DetectionTypeId + join t in Funs.DB.HJGL_Batch_BatchTrustItem on x.TrustBatchItemId equals t.TrustBatchItemId + join z in Funs.DB.HJGL_WeldJoint on t.WeldJointId equals z.WeldJointId + join w in Funs.DB.Base_WeldType on z.WeldTypeId equals w.WeldTypeId + where y.DetectionTypeCode == "UT" && w.WeldTypeCode == "D" && z.PipelineId == iso.PipelineId && x.CheckResult == "2" + select x.TotalFilm - x.PassFilm).Sum();//UT支管连接片数 + #endregion + + #region MT对焊接头 + mtdjNoPassJoint += (from x in Funs.DB.HJGL_Batch_NDEItem + join y in Funs.DB.Base_DetectionType on x.DetectionTypeId equals y.DetectionTypeId + join t in Funs.DB.HJGL_Batch_BatchTrustItem on x.TrustBatchItemId equals t.TrustBatchItemId + join z in Funs.DB.HJGL_WeldJoint on t.WeldJointId equals z.WeldJointId + join w in Funs.DB.Base_WeldType on z.WeldTypeId equals w.WeldTypeId + where y.DetectionTypeCode == "MT" && w.WeldTypeCode == "BW" && z.PipelineId == iso.PipelineId && x.CheckResult == "2" + select x).Count();//MT对接焊口数 + mtdjNoPassFilm += (from x in Funs.DB.HJGL_Batch_NDEItem + join y in Funs.DB.Base_DetectionType on x.DetectionTypeId equals y.DetectionTypeId + join t in Funs.DB.HJGL_Batch_BatchTrustItem on x.TrustBatchItemId equals t.TrustBatchItemId + join z in Funs.DB.HJGL_WeldJoint on t.WeldJointId equals z.WeldJointId + join w in Funs.DB.Base_WeldType on z.WeldTypeId equals w.WeldTypeId + where y.DetectionTypeCode == "MT" && w.WeldTypeCode == "BW" && z.PipelineId == iso.PipelineId && x.CheckResult == "2" + select x.TotalFilm - x.PassFilm).Sum();//MT对接片数 + #endregion + #region MT角焊接头 + mtjhNoPassJoint += (from x in Funs.DB.HJGL_Batch_NDEItem + join y in Funs.DB.Base_DetectionType on x.DetectionTypeId equals y.DetectionTypeId + join t in Funs.DB.HJGL_Batch_BatchTrustItem on x.TrustBatchItemId equals t.TrustBatchItemId + join z in Funs.DB.HJGL_WeldJoint on t.WeldJointId equals z.WeldJointId + join w in Funs.DB.Base_WeldType on z.WeldTypeId equals w.WeldTypeId + where y.DetectionTypeCode == "MT" && (w.WeldTypeCode == "C"|| w.WeldTypeCode == "E") && z.PipelineId == iso.PipelineId && x.CheckResult == "2" + select x).Count();//MT角焊焊口数 + mtjhNoPassFilm += (from x in Funs.DB.HJGL_Batch_NDEItem + join y in Funs.DB.Base_DetectionType on x.DetectionTypeId equals y.DetectionTypeId + join t in Funs.DB.HJGL_Batch_BatchTrustItem on x.TrustBatchItemId equals t.TrustBatchItemId + join z in Funs.DB.HJGL_WeldJoint on t.WeldJointId equals z.WeldJointId + join w in Funs.DB.Base_WeldType on z.WeldTypeId equals w.WeldTypeId + where y.DetectionTypeCode == "MT" && (w.WeldTypeCode == "C" || w.WeldTypeCode == "E") && z.PipelineId == iso.PipelineId && x.CheckResult == "2" + select x.TotalFilm - x.PassFilm).Sum();//MT角焊片数 + #endregion + #region MT支管连接焊口数 + mtzgNoPassJoint += (from x in Funs.DB.HJGL_Batch_NDEItem + join y in Funs.DB.Base_DetectionType on x.DetectionTypeId equals y.DetectionTypeId + join t in Funs.DB.HJGL_Batch_BatchTrustItem on x.TrustBatchItemId equals t.TrustBatchItemId + join z in Funs.DB.HJGL_WeldJoint on t.WeldJointId equals z.WeldJointId + join w in Funs.DB.Base_WeldType on z.WeldTypeId equals w.WeldTypeId + where y.DetectionTypeCode == "MT" && w.WeldTypeCode == "D" && z.PipelineId == iso.PipelineId && x.CheckResult == "2" + select x).Count();//MT支管连接焊口数 + mtzgNoPassFilm += (from x in Funs.DB.HJGL_Batch_NDEItem + join y in Funs.DB.Base_DetectionType on x.DetectionTypeId equals y.DetectionTypeId + join t in Funs.DB.HJGL_Batch_BatchTrustItem on x.TrustBatchItemId equals t.TrustBatchItemId + join z in Funs.DB.HJGL_WeldJoint on t.WeldJointId equals z.WeldJointId + join w in Funs.DB.Base_WeldType on z.WeldTypeId equals w.WeldTypeId + where y.DetectionTypeCode == "MT" && w.WeldTypeCode == "D" && z.PipelineId == iso.PipelineId && x.CheckResult == "2" + select x.TotalFilm - x.PassFilm).Sum();//MT支管连接片数 + #endregion + + #region PT对焊接头 + ptdjNoPassJoint += (from x in Funs.DB.HJGL_Batch_NDEItem + join y in Funs.DB.Base_DetectionType on x.DetectionTypeId equals y.DetectionTypeId + join t in Funs.DB.HJGL_Batch_BatchTrustItem on x.TrustBatchItemId equals t.TrustBatchItemId + join z in Funs.DB.HJGL_WeldJoint on t.WeldJointId equals z.WeldJointId + join w in Funs.DB.Base_WeldType on z.WeldTypeId equals w.WeldTypeId + where y.DetectionTypeCode == "PT" && w.WeldTypeCode == "BW" && z.PipelineId == iso.PipelineId && x.CheckResult == "2" + select x).Count();//PT对接焊口数 + ptdjNoPassFilm += (from x in Funs.DB.HJGL_Batch_NDEItem + join y in Funs.DB.Base_DetectionType on x.DetectionTypeId equals y.DetectionTypeId + join t in Funs.DB.HJGL_Batch_BatchTrustItem on x.TrustBatchItemId equals t.TrustBatchItemId + join z in Funs.DB.HJGL_WeldJoint on t.WeldJointId equals z.WeldJointId + join w in Funs.DB.Base_WeldType on z.WeldTypeId equals w.WeldTypeId + where y.DetectionTypeCode == "PT" && w.WeldTypeCode == "BW" && z.PipelineId == iso.PipelineId && x.CheckResult == "2" + select x.TotalFilm - x.PassFilm).Sum();//PT对接片数 + #endregion + #region PT角焊接头 + ptjhNoPassJoint += (from x in Funs.DB.HJGL_Batch_NDEItem + join y in Funs.DB.Base_DetectionType on x.DetectionTypeId equals y.DetectionTypeId + join t in Funs.DB.HJGL_Batch_BatchTrustItem on x.TrustBatchItemId equals t.TrustBatchItemId + join z in Funs.DB.HJGL_WeldJoint on t.WeldJointId equals z.WeldJointId + join w in Funs.DB.Base_WeldType on z.WeldTypeId equals w.WeldTypeId + where y.DetectionTypeCode == "PT" && (w.WeldTypeCode == "C"|| w.WeldTypeCode == "E") && z.PipelineId == iso.PipelineId && x.CheckResult == "2" + select x).Count();//PT角焊焊口数 + ptjhNoPassFilm += (from x in Funs.DB.HJGL_Batch_NDEItem + join y in Funs.DB.Base_DetectionType on x.DetectionTypeId equals y.DetectionTypeId + join t in Funs.DB.HJGL_Batch_BatchTrustItem on x.TrustBatchItemId equals t.TrustBatchItemId + join z in Funs.DB.HJGL_WeldJoint on t.WeldJointId equals z.WeldJointId + join w in Funs.DB.Base_WeldType on z.WeldTypeId equals w.WeldTypeId + where y.DetectionTypeCode == "PT" && (w.WeldTypeCode == "C" || w.WeldTypeCode == "E") && z.PipelineId == iso.PipelineId && x.CheckResult == "2" + select x.TotalFilm - x.PassFilm).Sum();//PT角焊片数 + #endregion + #region PT支管连接焊口数 + ptzgNoPassJoint += (from x in Funs.DB.HJGL_Batch_NDEItem + join y in Funs.DB.Base_DetectionType on x.DetectionTypeId equals y.DetectionTypeId + join t in Funs.DB.HJGL_Batch_BatchTrustItem on x.TrustBatchItemId equals t.TrustBatchItemId + join z in Funs.DB.HJGL_WeldJoint on t.WeldJointId equals z.WeldJointId + join w in Funs.DB.Base_WeldType on z.WeldTypeId equals w.WeldTypeId + where y.DetectionTypeCode == "PT" && w.WeldTypeCode == "D" && z.PipelineId == iso.PipelineId && x.CheckResult == "2" + select x).Count();//PT支管连接焊口数 + ptzgNoPassFilm += (from x in Funs.DB.HJGL_Batch_NDEItem + join y in Funs.DB.Base_DetectionType on x.DetectionTypeId equals y.DetectionTypeId + join t in Funs.DB.HJGL_Batch_BatchTrustItem on x.TrustBatchItemId equals t.TrustBatchItemId + join z in Funs.DB.HJGL_WeldJoint on t.WeldJointId equals z.WeldJointId + join w in Funs.DB.Base_WeldType on z.WeldTypeId equals w.WeldTypeId + where y.DetectionTypeCode == "PT" && w.WeldTypeCode == "D" && z.PipelineId == iso.PipelineId && x.CheckResult == "2" + select x.TotalFilm - x.PassFilm).Sum();//PT支管连接片数 + #endregion + #endregion + } + keyValuePairs.Add("RTBW", (rtdjJoint > 0 ? rtdjJoint.ToString() + "道" : "") + "/" + (rtdjFilm > 0 ? rtdjFilm.ToString() + "张" : "")); + keyValuePairs.Add("RTFW", (rtjhJoint > 0 ? rtjhJoint.ToString() + "道" : "") + "/" + (rtjhFilm > 0 ? rtjhFilm.ToString() + "张" : "")); + keyValuePairs.Add("RTDW", (rtzgJoint > 0 ? rtzgJoint.ToString() + "道" : "") + "/" + (rtzgFilm > 0 ? rtzgFilm.ToString() + "张" : "")); + keyValuePairs.Add("UTBW", (utdjJoint > 0 ? utdjJoint.ToString() + "道" : "") + "/" + (utdjJoint > 0 ? utdjJoint.ToString() + "米" : "")); + keyValuePairs.Add("UTFW", (utjhJoint > 0 ? utjhJoint.ToString() + "道" : "") + "/" + (utjhJoint > 0 ? utjhJoint.ToString() + "米" : "")); + keyValuePairs.Add("UTDW", (utzgJoint > 0 ? utzgJoint.ToString() + "道" : "") + "/" + (utzgJoint > 0 ? utzgJoint.ToString() + "米" : "")); + keyValuePairs.Add("MTBW", (mtdjJoint > 0 ? mtdjJoint.ToString() + "道" : "") + "/" + (mtdjJoint > 0 ? mtdjJoint.ToString() + "米" : "")); + keyValuePairs.Add("MTFW", (mtjhJoint > 0 ? mtjhJoint.ToString() + "道" : "") + "/" + (mtjhJoint > 0 ? mtjhJoint.ToString() + "米" : "")); + keyValuePairs.Add("MTDW", (mtzgJoint > 0 ? mtzgJoint.ToString() + "道" : "") + "/" + (mtzgJoint > 0 ? mtzgJoint.ToString() + "米" : "")); + keyValuePairs.Add("PTBW", (ptdjJoint > 0 ? ptdjJoint.ToString() + "道" : "") + "/" + (ptdjJoint > 0 ? ptdjJoint.ToString() + "米" : "")); + keyValuePairs.Add("PTFW", (ptjhJoint > 0 ? ptjhJoint.ToString() + "道" : "") + "/" + (ptjhJoint > 0 ? ptjhJoint.ToString() + "米" : "")); + keyValuePairs.Add("PTDW", (ptzgJoint > 0 ? ptzgJoint.ToString() + "道" : "") + "/" + (ptzgJoint > 0 ? ptzgJoint.ToString() + "米" : "")); + + keyValuePairs.Add("RTNoPassBW", (rtdjNoPassJoint > 0 ? rtdjNoPassJoint.ToString() + "道" : "") + "/" + (rtdjNoPassFilm > 0 ? rtdjNoPassFilm.ToString() + "张" : "")); + keyValuePairs.Add("RTNoPassFW", (rtjhNoPassJoint > 0 ? rtjhNoPassJoint.ToString() + "道" : "") + "/" + (rtjhNoPassFilm > 0 ? rtjhNoPassFilm.ToString() + "张" : "")); + keyValuePairs.Add("RTNoPassDW", (rtzgNoPassJoint > 0 ? rtzgNoPassJoint.ToString() + "道" : "") + "/" + (rtzgNoPassFilm > 0 ? rtzgNoPassFilm.ToString() + "张" : "")); + keyValuePairs.Add("UTNoPassBW", (utdjNoPassJoint > 0 ? utdjNoPassJoint.ToString() + "道" : "") + "/" + (utdjNoPassFilm > 0 ? utdjNoPassFilm.ToString() + "处" : "")); + keyValuePairs.Add("UTNoPassFW", (utjhNoPassJoint > 0 ? utjhNoPassJoint.ToString() + "道" : "") + "/" + (utjhNoPassFilm > 0 ? utjhNoPassFilm.ToString() + "处" : "")); + keyValuePairs.Add("UTNoPassDW", (utzgNoPassJoint > 0 ? utzgNoPassJoint.ToString() + "道" : "") + "/" + (utzgNoPassFilm > 0 ? utzgNoPassFilm.ToString() + "处" : "")); + keyValuePairs.Add("MTNoPassBW", (mtdjNoPassJoint > 0 ? mtdjNoPassJoint.ToString() + "道" : "") + "/" + (mtdjNoPassFilm > 0 ? mtdjNoPassFilm.ToString() + "处" : "")); + keyValuePairs.Add("MTNoPassFW", (mtjhNoPassJoint > 0 ? mtjhNoPassJoint.ToString() + "道" : "") + "/" + (mtjhNoPassFilm > 0 ? mtjhNoPassFilm.ToString() + "处" : "")); + keyValuePairs.Add("MTNoPassDW", (mtzgNoPassJoint > 0 ? mtzgNoPassJoint.ToString() + "道" : "") + "/" + (mtzgNoPassFilm > 0 ? mtzgNoPassFilm.ToString() + "处" : "")); + keyValuePairs.Add("PTNoPassBW", (ptdjNoPassJoint > 0 ? ptdjNoPassJoint.ToString() + "道" : "") + "/" + (ptdjNoPassFilm > 0 ? ptdjNoPassFilm.ToString() + "处" : "")); + keyValuePairs.Add("PTNoPassFW", (ptjhNoPassJoint > 0 ? ptjhNoPassJoint.ToString() + "道" : "") + "/" + (ptjhNoPassFilm > 0 ? ptjhNoPassFilm.ToString() + "处" : "")); + keyValuePairs.Add("PTNoPassDW", (ptzgNoPassJoint > 0 ? ptzgNoPassJoint.ToString() + "道" : "") + "/" + (ptzgNoPassFilm > 0 ? ptzgNoPassFilm.ToString() + "处" : "")); + keyValuePairs.Add("isoIds", isoIds); + + BLL.FastReportService.AddFastreportParameter(keyValuePairs); + string sql3 = @"select nDEItem.NDEItemID, + i.SingleName, + i.PipelineCode, + j.WeldJointCode, + (case when j.CoverWelderId is not null then ( + case when j.BackingWelderId is not null and j.CoverWelderId<>j.BackingWelderId + then cWelder.JobNum+'/'+fWelder.JobNum + else cWelder.JobNum end) else fWelder.JobNum end) as WelderCode, + (case when d.DetectionTypeCode='RT' or d.DetectionTypeCode='UT' then + (case nDEItem.CheckResult when '1' then '合格' when '2' then '不合格' else '/' end) else '/' end) as RTUTResult, + (case when d.DetectionTypeCode='RT' or d.DetectionTypeCode='UT' then nDEItem.NDEReportNo else '/' end) as RTUTCheckNo, + (case when d.DetectionTypeCode='MT' or d.DetectionTypeCode='PT' then + (case nDEItem.CheckResult when '1' then '合格' when '2' then '不合格' else '/' end) else '/' end) as MTPTResult, + (case when d.DetectionTypeCode='MT' or d.DetectionTypeCode='PT' then nDEItem.NDEReportNo else '/' end) as MTPTCheckNo, + nDEItem.Remark as CHT_Remark,pointBatch.PointBatchCode + from HJGL_Batch_NDEItem as nDEItem + left join HJGL_Batch_NDE as c on c.NDEID = nDEItem.NDEID + left join HJGL_Batch_BatchTrustItem as t on t.TrustBatchItemId = nDEItem.TrustBatchItemId + left join HJGL_WeldJoint as j on j.WeldJointId = t.WeldJointId + left join HJGL_Pipeline as i on i.PipelineId =j.PipelineId + left join Person_Persons as cWelder on cWelder.PersonId = j.CoverWelderId + left join Person_Persons as fWelder on fWelder.PersonId = j.BackingWelderId + left join Base_DetectionType as d on d.DetectionTypeId = nDEItem.DetectionTypeId + left join HJGL_Batch_PointBatchItem as pointBatchItem on pointBatchItem.PointBatchItemId = t.PointBatchItemId + left join HJGL_Batch_PointBatch as pointBatch on pointBatch.PointBatchId = pointBatchItem.PointBatchId + where j.PipelineId in ('" + isoIds + "')"; + + List listStr = new List(); + SqlParameter[] parameter = listStr.ToArray(); + DataTable dt0 = SQLHelper.GetDataTableRunText(sql3, parameter); + + sql3 += " order by PipelineCode,WeldJointCode"; + + DataTable dt = new DataTable(); + dt.TableName = "Data"; + dt.Columns.Add("SingleName"); + dt.Columns.Add("WeldJointCode"); + dt.Columns.Add("WelderCode"); + dt.Columns.Add("PointBatchCode"); + dt.Columns.Add("RTUTResult"); + dt.Columns.Add("RTUTCheckNo"); + dt.Columns.Add("MTPTResult"); + dt.Columns.Add("MTPTCheckNo"); + dt.Columns.Add("CHT_Remark"); + + dt0.DefaultView.Sort = "PipelineCode,WeldJointCode asc"; + DataRow[] rows = dt0.DefaultView.ToTable().Select(); + + foreach (var row in rows) + { + var newRow = dt.NewRow(); + newRow["SingleName"] = row["SingleName"].ToString(); + newRow["WeldJointCode"] = row["WeldJointCode"].ToString(); + newRow["WelderCode"] = row["WelderCode"].ToString(); + newRow["PointBatchCode"] = row["PointBatchCode"].ToString(); + newRow["RTUTResult"] = row["RTUTResult"].ToString(); + newRow["RTUTCheckNo"] = row["RTUTCheckNo"].ToString(); + newRow["MTPTResult"] = row["MTPTResult"].ToString(); + newRow["MTPTCheckNo"] = row["MTPTCheckNo"].ToString(); + newRow["CHT_Remark"] = row["CHT_Remark"].ToString(); + dt.Rows.Add(newRow); + } + BLL.FastReportService.AddFastreportTable(dt); + initTemplatePath = "File\\Fastreport\\JGZL\\管道无损检测结果汇总表.frx"; + List dataTables = new List(); + dataTables.Add(dt); + fastReportItem.ReportPath = initTemplatePath; + fastReportItem.ParameterValues = keyValuePairs; + fastReportItem.DataTables = dataTables; + } } break; } return fastReportItem; } #endregion + + #region 格式化字符串 + protected string getMaterialCodeByPipelineId(string pipelineId) + { + string materialCode = string.Empty; + if (!string.IsNullOrEmpty(pipelineId)) + { + var weldjoint = (from x in Funs.DB.HJGL_WeldJoint + join y in Funs.DB.Base_Material on x.Material1Id equals y.MaterialId + join z in Funs.DB.Base_Material on x.Material2Id equals z.MaterialId + where x.PipelineId == pipelineId + select new { MaterialCode1 = y.MaterialCode, MaterialCode2 = z.MaterialCode }).FirstOrDefault(); + if (weldjoint != null) + { + if (!string.IsNullOrEmpty(weldjoint.MaterialCode1)&&!string.IsNullOrEmpty(weldjoint.MaterialCode2)) + { + materialCode = weldjoint.MaterialCode1 + "/" + weldjoint.MaterialCode2; + } + else + { + if (!string.IsNullOrEmpty(weldjoint.MaterialCode1)) + { + materialCode = weldjoint.MaterialCode1; + } + else + { + materialCode = weldjoint.MaterialCode2; + } + } + + } + } + return materialCode; + } + + protected string getSpecificationByPipelineId(string pipelineId) + { + string spcificaation = string.Empty; + if (!string.IsNullOrEmpty(pipelineId)) + { + var weldjoint = (from x in Funs.DB.HJGL_WeldJoint where x.PipelineId == pipelineId select x).FirstOrDefault(); + if (weldjoint != null) + { + spcificaation = weldjoint.Specification; + } + } + return spcificaation; + } + #endregion } } \ No newline at end of file