using BLL; using System; using System.Collections.Generic; using System.Data.SqlClient; using System.Data; using System.Linq; using System.Web; 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 { public partial class TestPackageData : PageBase { #region 定义项 /// /// 试压包主键 /// public string PTP_ID { get { return (string)ViewState["PTP_ID"]; } set { ViewState["PTP_ID"] = value; } } /// /// 单位工程Id /// public string UnitWorkId { get { return (string)ViewState["UnitWorkId"]; } set { ViewState["UnitWorkId"] = value; } } #endregion protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.ddlPageSize.SelectedValue = this.Grid1.PageSize.ToString(); this.InitTreeMenu();//加载树 BindGrid(); } } #region 加载树装置-单位-工作区 /// /// 加载树 /// private void InitTreeMenu() { this.tvControlItem.Nodes.Clear(); TreeNode rootNode1 = new TreeNode(); rootNode1.NodeID = "1"; rootNode1.Text = "建筑工程"; rootNode1.CommandName = "建筑工程"; rootNode1.Selectable = false; rootNode1.EnableClickEvent = true; this.tvControlItem.Nodes.Add(rootNode1); TreeNode rootNode2 = new TreeNode(); rootNode2.NodeID = "2"; rootNode2.Text = "安装工程"; rootNode2.CommandName = "安装工程"; rootNode2.Expanded = true; rootNode2.EnableClickEvent = true; this.tvControlItem.Nodes.Add(rootNode2); var pUnits = (from x in Funs.DB.Project_ProjectUnit where x.ProjectId == this.CurrUser.LoginProjectId select x).ToList(); // 获取当前用户所在单位 var currUnit = pUnits.FirstOrDefault(x => x.UnitId == this.CurrUser.UnitId); var unitWorkList = (from x in Funs.DB.WBS_UnitWork where x.ProjectId == this.CurrUser.LoginProjectId && x.SuperUnitWork == null && x.UnitId != null && x.ProjectType != null select x).ToList(); //List testPackageLists = (from x in Funs.DB.PTP_TestPackage //where x.ProjectId == this.CurrUser.LoginProjectId //select x).ToList(); List unitWork1 = null; List unitWork2 = null; //// 当前为施工单位,只能操作本单位的数据 //if (currUnit != null && currUnit.UnitType == Const.ProjectUnitType_2) //{ // unitWork1 = (from x in unitWorkList // where x.UnitId == this.CurrUser.UnitId && x.ProjectType == "1" // select x).ToList(); // unitWork2 = (from x in unitWorkList // where x.UnitId == this.CurrUser.UnitId && x.ProjectType == "2" // select x).ToList(); //} //else //{ unitWork1 = (from x in unitWorkList where x.ProjectType == "1" select x).ToList(); unitWork2 = (from x in unitWorkList where x.ProjectType == "2" select x).ToList(); //} if (unitWork1.Count() > 0) { foreach (var q in unitWork1) { var unitNamesUnitIds = BLL.UnitService.getUnitNamesUnitIds(q.UnitId); TreeNode tn1 = new TreeNode(); tn1.NodeID = q.UnitWorkId; tn1.Text = q.UnitWorkName; tn1.ToolTip = "施工单位:" + unitNamesUnitIds; tn1.CommandName = "单位工程"; tn1.EnableClickEvent = true; rootNode1.Nodes.Add(tn1); //var testPackageUnitList = testPackageLists.Where(x => x.UnitWorkId == q.UnitWorkId).ToList(); //BindNodes(tn1, testPackageUnitList); } } if (unitWork2.Count() > 0) { foreach (var q in unitWork2) { var unitNamesUnitIds = BLL.UnitService.getUnitNamesUnitIds(q.UnitId); TreeNode tn2 = new TreeNode(); tn2.NodeID = q.UnitWorkId; tn2.Text = q.UnitWorkName; tn2.ToolTip = "施工单位:" + unitNamesUnitIds; tn2.CommandName = "单位工程"; tn2.EnableClickEvent = true; rootNode2.Nodes.Add(tn2); //var testPackageUnitList = testPackageLists.Where(x => x.UnitWorkId == q.UnitWorkId).ToList(); //BindNodes(tn2, testPackageUnitList); } } } #endregion #region 点击TreeView /// /// 点击TreeView /// /// /// protected void tvControlItem_NodeCommand(object sender, TreeCommandEventArgs e) { this.UnitWorkId = tvControlItem.SelectedNodeID; this.BindGrid(); } #endregion #region 数据绑定 /// /// 数据绑定 /// private void BindGrid() { string strSql = @" select t.PTP_ID, t.ProjectId, t.UnitId, t.UnitWorkId, t.TestPackageNo, t.TestPackageName, t.FinishDef, (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"; List listStr = new List(); listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId)); if (!string.IsNullOrEmpty(this.UnitWorkId)) { strSql += " and t.UnitWorkId =@unitWorkId"; listStr.Add(new SqlParameter("@unitWorkId", this.UnitWorkId)); } if (!string.IsNullOrEmpty(this.txtTestPackageNo.Text.Trim())) { strSql += " and t.TestPackageNo like @testPackageNo"; listStr.Add(new SqlParameter("@testPackageNo", "%" + this.txtTestPackageNo.Text.Trim() + "%")); } SqlParameter[] parameter = listStr.ToArray(); DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); // 2.获取当前分页数据 //var table = this.GetPagedDataTable(Grid1, tb1); Grid1.RecordCount = tb.Rows.Count; var table = this.GetPagedDataTable(Grid1, tb); Grid1.DataSource = table; Grid1.DataBind(); } #endregion #region 分页排序 #region 页索引改变事件 /// /// 页索引改变事件 /// /// /// protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e) { BindGrid(); } #endregion #region 排序 /// /// 排序 /// /// /// protected void Grid1_Sort(object sender, GridSortEventArgs e) { BindGrid(); } #endregion #region 分页选择下拉改变事件 /// /// 分页选择下拉改变事件 /// /// /// protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e) { Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue); BindGrid(); } #endregion #endregion #region 打印 /// /// 打印按钮 /// /// /// protected void btnPrint_Click(object sender, EventArgs e) { var selectedRows = this.Grid1.SelectedRowIDArray; if (selectedRows.Length==0) { Alert.ShowInTop("请选择一条试压包", MessageBoxIcon.Warning); return; } foreach (var ptp_id in selectedRows) { exportWord(ptp_id); } } protected void exportWord(string ptp_id) { if (string.IsNullOrEmpty(ptp_id)) { Alert.ShowInTop("请选择要打印的单据!", MessageBoxIcon.Warning); return; } //修改试压包打印状态 var updateTestPackage = Funs.DB.PTP_TestPackage.FirstOrDefault(x => x.PTP_ID == ptp_id); string exportName = updateTestPackage?.TestPackageNo; //导出文件名称 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[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 FastReportItemList = new List(); foreach (var item in list) { FastReportItemList.Add(GetFastReportItem(updateTestPackage, item.Text)); } var Path = Funs.RootPath + "FileUpload/" + ptp_id + ".pdf"; BLL.FastReportService.ExportMergeReport(FastReportItemList, Path, this.drpPrintType.SelectedValue); FileInfo info = new FileInfo(Path); 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(exportName + ".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(); System.Web.HttpContext.Current.Response.Close(); File.Delete(Path); } else if (this.drpPrintType.SelectedValue == "2")//word格式 { ListItem[] list = new ListItem[3]; 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 FastReportItemList = new List(); foreach (var item in list) { FastReportItemList.Add(GetFastReportItem(updateTestPackage, item.Text)); } var PathA = Funs.RootPath + "FileUpload/" + ptp_id + ".docx"; BLL.FastReportService.ExportMergeReport(FastReportItemList, PathA, this.drpPrintType.SelectedValue); Aspose.Words.Document doc1 = new Aspose.Words.Document(PathA); ListItem[] list2 = new ListItem[1]; list2[0] = new ListItem("3", "File\\Fastreport\\JGZL\\管道系统压力试验条件确认记录.frx"); List FastReportItemList2 = new List(); foreach (var item in list2) { FastReportItemList2.Add(GetFastReportItem(updateTestPackage, item.Text)); } var PathB = Funs.RootPath + "FileUpload/" + ptp_id + "2.docx"; BLL.FastReportService.ExportMergeReport(FastReportItemList2, PathB, this.drpPrintType.SelectedValue); Aspose.Words.Document doc2 = new Aspose.Words.Document(PathB); // 合并 Word DOcx 文档 doc1.AppendDocument(doc2, Aspose.Words.ImportFormatMode.KeepSourceFormatting); ListItem[] list3 = new ListItem[1]; list3[0] = new ListItem("4", "File\\Fastreport\\JGZL\\管道试压包尾项清单.frx"); List FastReportItemList3 = new List(); foreach (var item in list3) { FastReportItemList3.Add(GetFastReportItem(updateTestPackage, item.Text)); } var PathC = Funs.RootPath + "FileUpload/" + ptp_id + "3.docx"; BLL.FastReportService.ExportMergeReport(FastReportItemList3, PathC, this.drpPrintType.SelectedValue); Aspose.Words.Document doc3 = new Aspose.Words.Document(PathC); // 合并 Word DOcx 文档 doc1.AppendDocument(doc3, Aspose.Words.ImportFormatMode.KeepSourceFormatting); ListItem[] list4 = new ListItem[2]; list4[0] = new ListItem("5", "File\\Fastreport\\JGZL\\管道系统压力试验记录.frx"); list4[1] = new ListItem("6", "File\\Fastreport\\JGZL\\管道材料材质标识检查记录.frx"); List FastReportItemList4 = new List(); foreach (var item in list4) { FastReportItemList4.Add(GetFastReportItem(updateTestPackage, item.Text)); } var PathD = Funs.RootPath + "FileUpload/" + ptp_id + "4.docx"; BLL.FastReportService.ExportMergeReport(FastReportItemList4, PathD, this.drpPrintType.SelectedValue); Aspose.Words.Document doc4 = new Aspose.Words.Document(PathD); // 合并 Word DOcx 文档 doc1.AppendDocument(doc4, Aspose.Words.ImportFormatMode.KeepSourceFormatting); ListItem[] list5 = new ListItem[3]; list5[0] = new ListItem("7", "File\\Fastreport\\JGZL\\管道焊接工作记录.frx"); list5[1] = new ListItem("8", "File\\Fastreport\\JGZL\\管道无损检测数量统计表.frx"); list5[2] = new ListItem("9", "File\\Fastreport\\JGZL\\无损检测结果汇总表.frx"); List FastReportItemList5 = new List(); foreach (var item in list5) { FastReportItemList5.Add(GetFastReportItem(updateTestPackage, item.Text)); } var PathE = Funs.RootPath + "FileUpload/" + ptp_id + "5.docx"; BLL.FastReportService.ExportMergeReport(FastReportItemList5, PathE, this.drpPrintType.SelectedValue); Aspose.Words.Document doc5 = new Aspose.Words.Document(PathE); // 合并 Word DOcx 文档 doc1.AppendDocument(doc5, Aspose.Words.ImportFormatMode.KeepSourceFormatting); //将合并的文档保存为 DOCX 文件 doc1.Save(Funs.RootPath + "FileUpload/doc.docx"); var Path = Funs.RootPath + "FileUpload/doc.docx"; FileInfo info = new FileInfo(Path); 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(exportName + ".docx", 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(); System.Web.HttpContext.Current.Response.Close(); File.Delete(Path); File.Delete(PathA); File.Delete(PathB); File.Delete(PathC); File.Delete(PathD); File.Delete(PathE); } } } protected Model.FastReportItem GetFastReportItem(Model.PTP_TestPackage updateTestPackage, string printType) { string initTemplatePath = ""; Model.FastReportItem fastReportItem = new Model.FastReportItem(); switch (printType) { case "0"://管道试压包文件资料 { Dictionary keyValuePairs = new Dictionary(); var projectName = BLL.ProjectService.GetProjectNameByProjectId(this.CurrUser.LoginProjectId); var InstallationName = BLL.UnitWorkService.getUnitWorkByUnitWorkId(updateTestPackage.UnitWorkId).UnitWorkName; keyValuePairs.Add("ProjectName", projectName); keyValuePairs.Add("InstallationName", projectName + InstallationName); keyValuePairs.Add("TestPackageNo", updateTestPackage.TestPackageNo); BLL.FastReportService.AddFastreportParameter(keyValuePairs); initTemplatePath = "File\\Fastreport\\JGZL\\管道试压包文件资料.frx"; fastReportItem.ReportPath = initTemplatePath; fastReportItem.ParameterValues = keyValuePairs; } break; case "1"://管道压力试验技术要求 { Dictionary keyValuePairs = new Dictionary(); BLL.FastReportService.AddFastreportParameter(keyValuePairs); initTemplatePath = "File\\Fastreport\\JGZL\\管道压力试验技术要求.frx"; fastReportItem.ReportPath = initTemplatePath; fastReportItem.ParameterValues = keyValuePairs; } break; case "2"://管道压力包文件资料目录 { Dictionary keyValuePairs = new Dictionary(); BLL.FastReportService.AddFastreportParameter(keyValuePairs); initTemplatePath = "File\\Fastreport\\JGZL\\管道压力包文件资料目录.frx"; fastReportItem.ReportPath = initTemplatePath; fastReportItem.ParameterValues = keyValuePairs; } break; case "3"://管道系统压力试验条件确认记录 { Dictionary keyValuePairs = new Dictionary(); var projectName = BLL.ProjectService.GetProjectNameByProjectId(this.CurrUser.LoginProjectId); var InstallationName = BLL.UnitWorkService.getUnitWorkByUnitWorkId(updateTestPackage.UnitWorkId).UnitWorkName; 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"; fastReportItem.ReportPath = initTemplatePath; fastReportItem.ParameterValues = keyValuePairs; } break; case "4"://管道试压包尾项清单 { string sql = @"select ItemCheckId,PTP_ID,PTP_ItemEndCheck.PipelineId,Content,ItemType,Result,HJGL_Pipeline.PipelineCode from PTP_ItemEndCheck left join PTP_ItemEndCheckList on PTP_ItemEndCheckList.ItemEndCheckListId = PTP_ItemEndCheck.ItemEndCheckListId left join HJGL_Pipeline on HJGL_Pipeline.PipelineId = PTP_ItemEndCheck.PipelineId where PTP_ItemEndCheckList.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("SortNumber"); dt.Columns.Add("PipelineCode"); dt.Columns.Add("Content"); dt.Columns.Add("ItemType"); for (int i = 0; i < tb.Rows.Count; i++) { var newRows = dt.NewRow(); newRows["SortNumber"] = (i + 1).ToString(); newRows["PipelineCode"] = tb.Rows[i]["PipelineCode"].ToString(); newRows["Content"] = tb.Rows[i]["Content"].ToString(); newRows["ItemType"] = tb.Rows[i]["ItemType"].ToString(); dt.Rows.Add(newRows); } BLL.FastReportService.AddFastreportTable(dt); Dictionary keyValuePairs = new Dictionary(); keyValuePairs.Add("TestPackageNo", updateTestPackage.TestPackageNo); 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 "5"://管道系统压力试验记录 { string sql = @"SELECT ptpPipe.PT_PipeId, ptpPipe.PTP_ID, ptpPipe.PipelineId, IsoInfo.DesignPress, --设计压力 IsoInfo.DesignTemperature, --设计温度 IsoInfo.TestPressure, --试验压力 IsoInfo.PipelineCode,--管道编号/单线号 testMedium.MediumName,--试验介质 testPackage.AmbientTemperature,--试验环境温度 testPackage.TestMediumTemperature--试验介质温度 FROM dbo.PTP_PipelineList AS ptpPipe LEFT JOIN dbo.HJGL_Pipeline AS IsoInfo ON ptpPipe.PipelineId = IsoInfo.PipelineId LEFT JOIN dbo.Base_TestMedium AS testMedium ON testMedium.TestMediumId = IsoInfo.TestMedium left join PTP_TestPackage as testPackage on testPackage.PTP_ID = ptpPipe.PTP_ID where ptpPipe.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"); dt.Columns.Add("AmbientTemperature"); dt.Columns.Add("TestMediumTemperature"); 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(); newRows["AmbientTemperature"] = tb.Rows[i]["AmbientTemperature"].ToString(); var temp = tb.Rows[i]["TestMediumTemperature"].ToString(); newRows["TestMediumTemperature"] = tb.Rows[i]["TestMediumTemperature"].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 #region 搜索 /// /// 查询 /// /// /// protected void txtTestPackageNo_TextChanged(object sender, EventArgs e) { BindGrid(); } #endregion } }