diff --git a/DataBase/版本日志/HJGLDB_DS_2026-04-28_bwj.sql b/DataBase/版本日志/HJGLDB_DS_2026-04-28_bwj.sql new file mode 100644 index 0000000..2e701b9 --- /dev/null +++ b/DataBase/版本日志/HJGLDB_DS_2026-04-28_bwj.sql @@ -0,0 +1,155 @@ + + +ALTER PROC [dbo].[HJGL_sp_rpt_iso_analyze] + @unitNo VARCHAR(400) = NULL, + @isono VARCHAR(100) = NULL, + @steel varchar(50) = NULL, + @projectId NVARCHAR(50) = NULL, + @StartDate datetime =null, + @EndDate datetime =null +AS +/*ӹͳ ܴ޸2020.03.06*/ +SELECT iso.ProjectId,iso.ISO_IsoNo,iso.PressureTestPackageNo,Unit.UnitCode AS bsu_unitcode, --λ + Unit.UnitName AS bsu_unitname, --λ + Project.ProjectCode as projectCode, --ʩ + Project.ProjectName as projectName, --Ŀ + ''+cast(cast(ISO_Dia as FLOAT) as nvarchar(50))+''+cast(cast(ISO_Sch as FLOAT) as nvarchar(50)) as IsoDesc, -- + v.ISO_ID,v.total_jot,v.total_din, + ISNULL(v1.finished_total_jot,0) AS finished_total_jot, + ISNULL(v1.finished_total_din,0) AS finished_total_din,v1.maxdate, + ISNULL(v1.total_film,0) AS total_film, + ISNULL(v1.pass_film,0) AS pass_film, + CAST(CASE ISNULL(v1.total_film ,0) WHEN 0 THEN 0 + ELSE 1.0*ISNULL(v1.pass_film,0) / (1.0 * v1.total_film) END AS DECIMAL(19,3)) + AS passrate, --ںϸ + ISNULL(v2.point_jot,0) AS point_jot, + ISNULL(v2.point_total_film,0) AS point_total_film, + ISNULL(v2.point_pass_film,0) AS point_pass_film, + CAST(CASE ISNULL(v2.point_total_film ,0) WHEN 0 THEN 0 + ELSE 1.0*ISNULL(v2.point_pass_film,0) / (1.0 * v2.point_total_film) END AS DECIMAL(19,3)) + AS point_passrate, --ںϸ + + ISNULL(v3.ext_jot,0) AS ext_jot, + ISNULL(v3.ext_total_film,0) AS ext_total_film, + ISNULL(v3.ext_pass_film,0) AS ext_pass_film, + CAST(CASE ISNULL(v3.ext_total_film ,0) WHEN 0 THEN 0 + ELSE 1.0*ISNULL(v3.ext_pass_film,0) / (1.0 * v3.ext_total_film) END AS DECIMAL(19,3)) + AS point_passrate, --͸ϸ + (ISNULL(v2.point_jot,0)+ISNULL(v3.ext_jot,0)) AS check_total_jot, + ISNULL(v4.total_repairjot,0) AS total_repairjot, + ISNULL(v5.trust_total_jot,0) AS trust_total_jot, + CAST(CASE ISNULL(v.total_jot,0) WHEN 0 THEN 0 + ELSE 1.0*ISNULL(v2.point_jot,0) / (1.0 * v.total_jot) END AS DECIMAL(19,3)) + AS trustrate, --ίб + CAST(CASE ISNULL(v.total_jot,0) WHEN 0 THEN 0 + ELSE 1.0*(ISNULL(v3.ext_jot,0) + ISNULL(v2.point_jot,0)) / (1.0 * v.total_jot) + END AS DECIMAL(19,3)) + AS checkrate, --̽ + ISNULL(v6.total_fjot,0) as total_fjot,--װ + ISNULL(v7.total_sjot,0) as total_sjot --Ԥƺ +FROM + (SELECT ISO_ID, COUNT(JOT_ID) AS total_jot,SUM(ISNULL(JOT_Size,0)) AS total_din + FROM dbo.HJGL_PW_JointInfo + GROUP BY ISO_ID) v + LEFT JOIN + (SELECT ISO_ID, COUNT(JOT_ID) AS finished_total_jot,SUM(ISNULL(JOT_Size,0)) AS finished_total_din, + max(weldreport.JOT_WeldDate) AS maxdate, SUM(ISNULL(jot.RT_FilmNum,0)) AS total_film, + SUM(ISNULL(jot.RT_FilmNum,0)-ISNULL(jot.RT1_RepairFilmNum,0)) AS pass_film + FROM dbo.HJGL_PW_JointInfo jot + LEFT join HJGL_BO_WeldReportMain AS weldreport on weldreport.DReportID=jot.DReportID + WHERE (weldreport.JOT_WeldDate>=@StartDate or @StartDate is null) and (weldreport.JOT_WeldDate<=@EndDate or @EndDate is null) + AND jot.DReportID is not null + GROUP BY ISO_ID) v1 ON v1.ISO_ID=v.ISO_ID + LEFT JOIN + (SELECT ISO_ID, COUNT(jot.JOT_ID) AS point_jot,SUM(ISNULL(jot.RT_FilmNum,0)) AS point_total_film, + SUM(ISNULL(jot.RT_FilmNum,0)-ISNULL(jot.RT1_RepairFilmNum,0)) AS point_pass_film + FROM dbo.HJGL_PW_JointInfo jot + LEFT join HJGL_BO_WeldReportMain AS weldreport on weldreport.DReportID=jot.DReportID + WHERE (weldreport.JOT_WeldDate>=@StartDate or @StartDate is null) and (weldreport.JOT_WeldDate<=@EndDate or @EndDate is null) + AND jot.DReportID is not NULL AND jot.PointType='' or ((select top 1 CH_TrustItemID from HJGL_CH_TrustItem ti where ti.JOT_ID=jot.JOT_ID) is not null and jot.PointType is null) + GROUP BY ISO_ID) v2 ON v2.ISO_ID=v.ISO_ID + LEFT JOIN + (SELECT ISO_ID, COUNT(jot.JOT_ID) AS ext_jot,SUM(ISNULL(jot.RT_FilmNum,0)) AS ext_total_film, + SUM(ISNULL(jot.RT_FilmNum,0)-ISNULL(jot.RT1_RepairFilmNum,0)) AS ext_pass_film + FROM dbo.HJGL_PW_JointInfo jot + LEFT join HJGL_BO_WeldReportMain AS weldreport on weldreport.DReportID=jot.DReportID + WHERE (weldreport.JOT_WeldDate>=@StartDate or @StartDate is null) and (weldreport.JOT_WeldDate<=@EndDate or @EndDate is null) + AND jot.DReportID is not NULL AND jot.PointType='͸' + GROUP BY ISO_ID) v3 ON v3.ISO_ID=v.ISO_ID + LEFT JOIN + (SELECT jot.ISO_ID, COUNT(distinct trust.JOT_ID) AS trust_total_jot --trust.CH_TrustItemID + FROM dbo.HJGL_CH_TrustItem trust + LEFT join dbo.HJGL_PW_JointInfo AS jot on jot.JOT_ID=trust.JOT_ID + LEFT join HJGL_BO_WeldReportMain AS weldreport on weldreport.DReportID=jot.DReportID + WHERE (weldreport.JOT_WeldDate>=@StartDate or @StartDate is null) and (weldreport.JOT_WeldDate<=@EndDate or @EndDate is null) + AND jot.DReportID is not NULL + GROUP BY jot.ISO_ID) v5 ON v5.ISO_ID=v.ISO_ID + LEFT JOIN + (SELECT ISO_ID,COUNT(DISTINCT(jot.JOT_ID)) AS total_repairjot + FROM dbo.HJGL_PW_JointInfo jot + LEFT join HJGL_BO_WeldReportMain AS weldreport on weldreport.DReportID=jot.DReportID + WHERE (weldreport.JOT_WeldDate>=@StartDate or @StartDate is null) and (weldreport.JOT_WeldDate<=@EndDate or @EndDate is null) + AND jot.DReportID is not NULL + AND(jot.RT1_RepairFilmNum IS NOT NULL OR jot.PTIsRepair1=1 OR jot.MTIsRepair1=1 OR jot.UTIsRepair1=1) + GROUP BY ISO_ID) v4 ON v4.ISO_ID=v.ISO_ID +--װ + LEFT JOIN + (SELECT ISO_ID,COUNT(jot.JOT_ID) AS total_fjot + FROM dbo.HJGL_PW_JointInfo jot + LEFT join HJGL_BO_WeldReportMain AS weldreport on weldreport.DReportID=jot.DReportID + WHERE (weldreport.JOT_WeldDate>=@StartDate or @StartDate is null) and (weldreport.JOT_WeldDate<=@EndDate or @EndDate is null) + AND jot.DReportID is not NULL + AND jot.WLO_Code='F' + GROUP BY ISO_ID) v6 ON v6.ISO_ID=v.ISO_ID +--Ԥƺ + LEFT JOIN + (SELECT ISO_ID,COUNT(jot.JOT_ID) AS total_sjot + FROM dbo.HJGL_PW_JointInfo jot + LEFT join HJGL_BO_WeldReportMain AS weldreport on weldreport.DReportID=jot.DReportID + WHERE (weldreport.JOT_WeldDate>=@StartDate or @StartDate is null) and (weldreport.JOT_WeldDate<=@EndDate or @EndDate is null) + AND jot.DReportID is not NULL + AND jot.WLO_Code='S' + GROUP BY ISO_ID) v7 ON v7.ISO_ID=v.ISO_ID + + LEFT JOIN dbo.HJGL_PW_IsoInfo iso ON iso.ISO_ID = v.ISO_ID + LEFT JOIN Base_Unit AS Unit ON Unit.UnitId = iso.BSU_ID + LEFT JOIN Base_Project AS Project ON Project.ProjectId = iso.ProjectId + WHERE (iso.ProjectId = @projectId OR @projectId IS NULL) + AND (iso.BSU_ID=@unitno OR @unitno IS NULL) + AND (iso.STE_ID=@steel OR @steel IS NULL) + AND (iso.ISO_IsoNo = @isono OR @isono IS NULL) + + + + + + +GO + + + +ALTER PROCEDURE [dbo].[sp_rpt_WelderQualified] +( + @projectId NVARCHAR(50), + @WED_Name nvarchar(50) = null +) +AS +/***********-ϸ񺸹ǼDZ*************/ +SELECT (ROW_NUMBER() OVER(ORDER BY pw.ProjectWelderId)) AS Number, +pw.ProjectWelderId, +w.WED_Code, +w.WED_Name, +w.WED_WorkCode as CertificateNo, +convert(varchar(10),wqp.LimitDate,111) as LimitDate, + STRING_AGG(wqp.QualifiedProjectCode, '') as QualifiedProjectCode +FROM Project_Welder pw +LEFT JOIN HJGL_BS_Welder w ON w.WED_ID = pw.WED_ID +left join HJGL_BS_WelderQualifiedProject wqp on wqp.WED_ID = pw.WED_ID +where pw.ProjectId=@projectId +and (w.WED_Name like @WED_Name or @WED_Name is null) +and wqp.LimitDate IS NOT NULL AND wqp.LimitDate> = GETDATE() +GROUP BY pw.ProjectWelderId,w.WED_Code,w.WED_Name,w.WED_WorkCode,wqp.LimitDate +order by w.WED_Code,wqp.LimitDate +GO + + diff --git a/HJGL_DS/BLL/Common/Const.cs b/HJGL_DS/BLL/Common/Const.cs index eca89e6..9dc044f 100644 --- a/HJGL_DS/BLL/Common/Const.cs +++ b/HJGL_DS/BLL/Common/Const.cs @@ -2544,6 +2544,11 @@ namespace BLL /// public const string JGZL_QualifiedWelderUrl = "File\\Word\\JGZL\\合格焊工登记表导出模板.docx"; + /// + /// 无损检测人员登记表导出模板 + /// + public const string JGZL_NDTPersonUrl = "File\\Word\\JGZL\\无损检测人员登记表导出模板.docx"; + /// /// 管道系统压力试验条件确认记录导出模板 /// diff --git a/HJGL_DS/FineUIPro.Web/File/Fastreport/JGZL/无损检测人员登记表.frx b/HJGL_DS/FineUIPro.Web/File/Fastreport/JGZL/无损检测人员登记表.frx index 8007f1b..6816dcd 100644 --- a/HJGL_DS/FineUIPro.Web/File/Fastreport/JGZL/无损检测人员登记表.frx +++ b/HJGL_DS/FineUIPro.Web/File/Fastreport/JGZL/无损检测人员登记表.frx @@ -1,5 +1,5 @@  - + using System; using System.Collections; using System.Collections.Generic; @@ -42,7 +42,7 @@ namespace FastReport } - + diff --git a/HJGL_DS/FineUIPro.Web/File/Word/JGZL/合格焊工登记表导出模板.docx b/HJGL_DS/FineUIPro.Web/File/Word/JGZL/合格焊工登记表导出模板.docx index 49ad41a..297ced6 100644 --- a/HJGL_DS/FineUIPro.Web/File/Word/JGZL/合格焊工登记表导出模板.docx +++ b/HJGL_DS/FineUIPro.Web/File/Word/JGZL/合格焊工登记表导出模板.docx @@ -9,12 +9,6 @@ 证书编号 合格项目代号 有效期限 - - - - - - 建设/监理单位 总承包单位 施工单位 diff --git a/HJGL_DS/FineUIPro.Web/File/Word/JGZL/无损检测人员登记表导出模板.docx b/HJGL_DS/FineUIPro.Web/File/Word/JGZL/无损检测人员登记表导出模板.docx new file mode 100644 index 0000000..854d45a --- /dev/null +++ b/HJGL_DS/FineUIPro.Web/File/Word/JGZL/无损检测人员登记表导出模板.docx @@ -0,0 +1,158 @@ + SH/T 3503 -- J116 + 无损检测人员登记表 +工程名称: + + 序号 + 姓名 + 证书编号 + 合格项目代号 + 级别 + 有效期限 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 建设/监理单位 + 总承包单位 + 检测单位 +专业工程师: + + +日期: 年 月 日 +专业工程师: + + +日期: 年 月 日 +专业工程师: +制表人: + +日期: 年 月 日 + diff --git a/HJGL_DS/FineUIPro.Web/HJGL/WeldingReport/IsoCmprehensive.aspx b/HJGL_DS/FineUIPro.Web/HJGL/WeldingReport/IsoCmprehensive.aspx index 6996051..24eb790 100644 --- a/HJGL_DS/FineUIPro.Web/HJGL/WeldingReport/IsoCmprehensive.aspx +++ b/HJGL_DS/FineUIPro.Web/HJGL/WeldingReport/IsoCmprehensive.aspx @@ -112,13 +112,14 @@ - - <%-- - + + <%-- diff --git a/HJGL_DS/FineUIPro.Web/JGZL/NDTPerson.aspx b/HJGL_DS/FineUIPro.Web/JGZL/NDTPerson.aspx index 00346fe..867749b 100644 --- a/HJGL_DS/FineUIPro.Web/JGZL/NDTPerson.aspx +++ b/HJGL_DS/FineUIPro.Web/JGZL/NDTPerson.aspx @@ -43,6 +43,9 @@ + + diff --git a/HJGL_DS/FineUIPro.Web/JGZL/NDTPerson.aspx.cs b/HJGL_DS/FineUIPro.Web/JGZL/NDTPerson.aspx.cs index 82de6c7..18523a1 100644 --- a/HJGL_DS/FineUIPro.Web/JGZL/NDTPerson.aspx.cs +++ b/HJGL_DS/FineUIPro.Web/JGZL/NDTPerson.aspx.cs @@ -1,14 +1,16 @@ -using BLL; +using Aspose.Words; +using Aspose.Words.Tables; +using BLL; +using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; -using System.Data.SqlClient; using System.Data; +using System.Data.SqlClient; +using System.IO; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; -using System.IO; -using Newtonsoft.Json.Linq; namespace FineUIPro.Web.JGZL { @@ -548,6 +550,173 @@ namespace FineUIPro.Web.JGZL return; } } - #endregion + #endregion + + #region 导出按钮 + /// 导出按钮 + /// + /// + /// + protected void btnOut_Click(object sender, EventArgs e) + { + string rootPath = Server.MapPath("~/"); + string initTemplatePath = string.Empty; + string uploadfilepath = string.Empty; + string newUrl = string.Empty; + string filePath = string.Empty; + + int maxrowCount = 22; + + string projectId = this.tvControlItem.SelectedNodeID; + if (!string.IsNullOrEmpty(projectId)) + { + string strSql = @"SELECT * from JGZL_NDTPerson where ProjectId = @ProjectId"; + List listStr = new List(); + listStr.Add(new SqlParameter("@ProjectId", projectId)); + if (!string.IsNullOrEmpty(this.txtPersonNameS.Text)) + { + strSql += " and PersonName like @personName"; + listStr.Add(new SqlParameter("@personName", "%" + this.txtPersonNameS.Text + "%")); + } + strSql += " order by ValidityDate desc"; + SqlParameter[] parameter = listStr.ToArray(); + DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); + + initTemplatePath = Const.JGZL_NDTPersonUrl; + uploadfilepath = rootPath + initTemplatePath; + + newUrl = uploadfilepath.Replace("无损检测人员登记表导出模板", "无损检测人员登记表"); + if (File.Exists(newUrl)) + { + File.Delete(newUrl); + } + File.Copy(uploadfilepath, newUrl); + //更新书签内容 + Document doc = new Aspose.Words.Document(newUrl); + DocumentBuilder builder = new DocumentBuilder(doc); + + Aspose.Words.Tables.Table table = (Aspose.Words.Tables.Table)doc.GetChild(NodeType.Table, 0, true); + + Bookmark projectName = doc.Range.Bookmarks["ProjectName"]; + if (projectName != null) + { + projectName.Text = BLL.Base_ProjectService.GetProjectByProjectId(projectId).ProjectName; + } + + // 设置表头行重复显示 + table.Rows[0].RowFormat.HeadingFormat = true; + table.Rows[1].RowFormat.HeadingFormat = true; + + // 先记录页尾行,并从表格中移除 + Row footerRow = table.Rows[table.Rows.Count - 2]; + table.Rows.RemoveAt(table.Rows.Count - 2); + Row footerRow2 = table.Rows[table.Rows.Count - 1]; + table.Rows.RemoveAt(table.Rows.Count - 1); + + // 清空模板里的旧数据行,只保留2行表头(防止错位) + while (table.Rows.Count > 2) + { + table.Rows.RemoveAt(2); + } + Row headerRow = table.Rows[1]; // 字段名表头行 + double[] colWidths = new double[6]; + for (int i = 0; i < 6; i++) + { + colWidths[i] = headerRow.Cells[i].CellFormat.Width; + } + // 填充数据行 + for (int i = 0; i < tb.Rows.Count; i++) + { + Row row = new Row(doc); + row.Cells.Add(CreateCell((i + 1).ToString(), doc, colWidths[0], "楷体", "10.5")); + row.Cells.Add(CreateCell(tb.Rows[i]["PersonName"].ToString(), doc, colWidths[1], "楷体", "10.5")); + row.Cells.Add(CreateCell(tb.Rows[i]["CertificateNumber"].ToString(), doc, colWidths[2], "楷体", "10.5")); + row.Cells.Add(CreateCell(tb.Rows[i]["QualifiedProjectCode"].ToString(), doc, colWidths[3], "楷体", "10.5")); + row.Cells.Add(CreateCell(tb.Rows[i]["Levels"].ToString(), doc, colWidths[4], "楷体", "10.5")); + row.Cells.Add(CreateCell(tb.Rows[i]["ValidityDate"].ToString(), doc, colWidths[5], "楷体", "10.5")); + table.Rows.Add(row); + } + // 不满一页,自动填充空白行 + int realDataCount = tb.Rows.Count; + int needBlankRows = maxrowCount - realDataCount; + if (needBlankRows > 0) + { + for (int i = 0; i < needBlankRows; i++) + { + Row blankRow = new Row(doc); + blankRow.Cells.Add(CreateCell("", doc, colWidths[0], "楷体", "10.5")); + blankRow.Cells.Add(CreateCell("", doc, colWidths[1], "楷体", "10.5")); + blankRow.Cells.Add(CreateCell("", doc, colWidths[2], "楷体", "10.5")); + blankRow.Cells.Add(CreateCell("", doc, colWidths[3], "楷体", "10.5")); + blankRow.Cells.Add(CreateCell("", doc, colWidths[4], "楷体", "10.5")); + blankRow.Cells.Add(CreateCell("", doc, colWidths[5], "楷体", "10.5")); + table.Rows.Add(blankRow); + } + } + + //把页尾行重新加回表格最后 + table.Rows.Add(footerRow); + table.Rows.Add(footerRow2); + + // 设置表格格式 + table.AutoFit(AutoFitBehavior.FixedColumnWidths); + table.Alignment = TableAlignment.Center; + table.SetBorders(Aspose.Words.LineStyle.Single, 1, System.Drawing.Color.Black); + + // 强制刷新所有单元格宽度,防止个别单元格宽度不生效 + foreach (Row r in table.Rows) + { + foreach (Cell c in r.Cells) + { + c.CellFormat.Width = colWidths[c.ParentRow.Cells.IndexOf(c)]; + } + } + doc.Save(newUrl); + + string fileName = Path.GetFileName(newUrl); + FileInfo info = new FileInfo(newUrl); + long fileSize = info.Length; + Response.Clear(); + Response.ContentType = "application/x-zip-compressed"; + Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8)); + Response.AddHeader("Content-Length", fileSize.ToString()); + Response.TransmitFile(newUrl, 0, fileSize); + Response.Flush(); + Response.Close(); + File.Delete(newUrl); + } + else + { + Alert.ShowInTop("请选择项目!", MessageBoxIcon.Warning); + return; + } + } + /// + /// 创建带字体、宽度的表格单元格 + /// + private Cell CreateCell(string text, Document doc, double width, string fontName, string fontSize) + { + Cell cell = new Cell(doc); + cell.CellFormat.Width = width; + cell.CellFormat.LeftPadding = 2; + cell.CellFormat.RightPadding = 2; + cell.CellFormat.TopPadding = 2; + cell.CellFormat.BottomPadding = 2; + + Paragraph para = new Paragraph(doc); + para.ParagraphFormat.Alignment = ParagraphAlignment.Center; // 居中 + para.ParagraphFormat.SpaceAfter = 0; + para.ParagraphFormat.SpaceBefore = 0; + + Run run = new Run(doc, text); + run.Font.Name = fontName; // 字体 + run.Font.Size = Convert.ToDouble(fontSize); // 字号 + + para.AppendChild(run); + cell.AppendChild(para); + + return cell; + } + #endregion } } \ No newline at end of file diff --git a/HJGL_DS/FineUIPro.Web/JGZL/NDTPerson.aspx.designer.cs b/HJGL_DS/FineUIPro.Web/JGZL/NDTPerson.aspx.designer.cs index ff6f01b..e85ca76 100644 --- a/HJGL_DS/FineUIPro.Web/JGZL/NDTPerson.aspx.designer.cs +++ b/HJGL_DS/FineUIPro.Web/JGZL/NDTPerson.aspx.designer.cs @@ -140,6 +140,15 @@ namespace FineUIPro.Web.JGZL /// protected global::FineUIPro.Button btnPrint; + /// + /// btnOut 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnOut; + /// /// Grid1 控件。 /// diff --git a/HJGL_DS/FineUIPro.Web/JGZL/QualifiedWelder.aspx b/HJGL_DS/FineUIPro.Web/JGZL/QualifiedWelder.aspx index d3353f2..9407050 100644 --- a/HJGL_DS/FineUIPro.Web/JGZL/QualifiedWelder.aspx +++ b/HJGL_DS/FineUIPro.Web/JGZL/QualifiedWelder.aspx @@ -37,6 +37,7 @@ + diff --git a/HJGL_DS/FineUIPro.Web/JGZL/QualifiedWelder.aspx.cs b/HJGL_DS/FineUIPro.Web/JGZL/QualifiedWelder.aspx.cs index b018ee7..47a0934 100644 --- a/HJGL_DS/FineUIPro.Web/JGZL/QualifiedWelder.aspx.cs +++ b/HJGL_DS/FineUIPro.Web/JGZL/QualifiedWelder.aspx.cs @@ -105,6 +105,10 @@ namespace FineUIPro.Web.JGZL { List listStr = new List(); listStr.Add(new SqlParameter("@projectId", this.tvControlItem.SelectedNodeID)); + if (!string.IsNullOrEmpty(this.txtName.Text.Trim())) + { + listStr.Add(new SqlParameter("@WED_Name", "%" + this.txtName.Text.Trim() + "%")); + } SqlParameter[] parameter = listStr.ToArray(); DataTable tb = BLL.SQLHelper.GetDataTableRunProc("sp_rpt_WelderQualified", parameter); @@ -172,6 +176,10 @@ namespace FineUIPro.Web.JGZL List listStr = new List(); listStr.Add(new SqlParameter("@projectId", projectId)); + if (!string.IsNullOrEmpty(this.txtName.Text.Trim())) + { + listStr.Add(new SqlParameter("@WED_Name", "%" + this.txtName.Text.Trim() + "%")); + } SqlParameter[] parameter = listStr.ToArray(); DataTable tb = BLL.SQLHelper.GetDataTableRunProc("sp_rpt_WelderQualified", parameter); @@ -230,14 +238,15 @@ namespace FineUIPro.Web.JGZL string newUrl = string.Empty; string filePath = string.Empty; - //每页显示的固定数据行数 - int rowsPerPage = 36; - string projectId = this.tvControlItem.SelectedNodeID; if (!string.IsNullOrEmpty(projectId)) { List listStr = new List(); listStr.Add(new SqlParameter("@projectId", projectId)); + if (!string.IsNullOrEmpty(this.txtName.Text.Trim())) + { + listStr.Add(new SqlParameter("@WED_Name", "%" + this.txtName.Text.Trim() + "%")); + } SqlParameter[] parameter = listStr.ToArray(); DataTable tb = BLL.SQLHelper.GetDataTableRunProc("sp_rpt_WelderQualified", parameter); @@ -266,49 +275,48 @@ namespace FineUIPro.Web.JGZL table.Rows[0].RowFormat.HeadingFormat = true; table.Rows[1].RowFormat.HeadingFormat = true; - //// 先记录页尾行,并从表格中移除 - //Row footerRow = table.Rows[table.Rows.Count - 1]; - //table.Rows.RemoveAt(table.Rows.Count - 1); + // 先记录页尾行,并从表格中移除 + Row footerRow = table.Rows[table.Rows.Count-2]; + table.Rows.RemoveAt(table.Rows.Count-2); + Row footerRow2 = table.Rows[table.Rows.Count - 1]; + table.Rows.RemoveAt(table.Rows.Count - 1); + + // 清空模板里的旧数据行,只保留2行表头(防止错位) + while (table.Rows.Count > 2) + { + table.Rows.RemoveAt(2); + } + + // 单位:磅 1.69cm ≈ 48磅 + double col1 = 0.93 * 28.35; // 序号 + double col2 = 1.7 * 28.35; // 焊工姓名 + double col3 = 2.19 * 28.35; // 焊工代号 + double col4 = 3.95 * 28.35; // 证书编号 + double col5 = 6.04 * 28.35; // 合格项目代号 + double col6 = 2.27 * 28.35; // 有效日期 for (int i = 0; i < tb.Rows.Count; i++) { //创建行 Row row = new Row(doc); - row.Cells.Add(CreateCell((i + 1).ToString(), doc, 26.37, "", "")); - row.Cells.Add(CreateCell(tb.Rows[i]["WED_Name"].ToString(), doc, 48.2, "", "")); - row.Cells.Add(CreateCell(tb.Rows[i]["WED_Code"].ToString(), doc,62, "", "")); - row.Cells.Add(CreateCell(tb.Rows[i]["CertificateNo"].ToString(), doc, 111.98, "", "")); - row.Cells.Add(CreateCell(tb.Rows[i]["QualifiedProjectCode"].ToString(), doc, 171.23, "", "")); - row.Cells.Add(CreateCell(tb.Rows[i]["LimitDate"].ToString(), doc, 64.3545, "", "")); - table.Rows.Insert(i + 2, row); - } - //// 计算并插入空白行,填满整页 - //// 计算总数据行数 - //int totalDataRows = tb.Rows.Count; - //// 计算需要补充的空白行数量 - //int remainder = totalDataRows % rowsPerPage; - //int needBlankRows = remainder == 0 ? 0 : rowsPerPage - remainder; + row.Cells.Add(CreateCell((i + 1).ToString(), doc, col1, "", "")); + row.Cells.Add(CreateCell(tb.Rows[i]["WED_Name"].ToString(), doc, col2, "", "")); + row.Cells.Add(CreateCell(tb.Rows[i]["WED_Code"].ToString(), doc, col3, "", "")); + row.Cells.Add(CreateCell(tb.Rows[i]["CertificateNo"].ToString(), doc, col4, "", "")); + row.Cells.Add(CreateCell(tb.Rows[i]["QualifiedProjectCode"].ToString(), doc, col5, "", "")); + row.Cells.Add(CreateCell(tb.Rows[i]["LimitDate"].ToString(), doc, col6, "", "")); + table.Rows.Add(row); + } - // 插入空白行(和数据行格式保持一致,仅内容为空) - //for (int i = 0; i < needBlankRows - 1; i++) - //{ - // Row blankRow = new Row(doc); - // // 空白行的单元格宽度和数据行保持一致 - // blankRow.Cells.Add(CreateCell("", doc, 27, "", "")); - // blankRow.Cells.Add(CreateCell("", doc, 118, "", "")); - // blankRow.Cells.Add(CreateCell("", doc, 261.3, "", "")); - // blankRow.Cells.Add(CreateCell("", doc, 74, "", "")); - // blankRow.Cells.Add(CreateCell("", doc, 74, "", "")); - // blankRow.Cells.Add(CreateCell("", doc, 74, "", "")); - // // 插入到表格最后一行 - // table.Rows.Add(blankRow); - //} //把页尾行重新加回表格最后 - //table.Rows.Add(footerRow); + table.Rows.Add(footerRow); + table.Rows.Add(footerRow2); //自动设置表格样式 table.AutoFit(AutoFitBehavior.FixedColumnWidths); table.Alignment = TableAlignment.Center; + table.SetBorders(Aspose.Words.LineStyle.Single, 1, System.Drawing.Color.Black); + doc.Save(newUrl); @@ -329,55 +337,20 @@ namespace FineUIPro.Web.JGZL Alert.ShowInTop("请选择项目!", MessageBoxIcon.Warning); return; } - } - - public static Cell CreateCell(String value, Document doc, double cellWidth, string cellMerge = "", string CenterPage = "", string cellUnitLeft = "") + } + private Cell CreateCell(string text, Document doc, double width, string bgColor, string align) { Cell cell = new Cell(doc); - Paragraph p = new Paragraph(doc); - if (!string.IsNullOrEmpty(cellMerge)) - { - if (cellMerge == "0") - { - cell.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.First;//竖直方向合并的第一个单元格 - } - else - { - cell.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.Previous;//竖直方向合并的第一个单元格 - } - - } - else - { - cell.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None; - } - if (!string.IsNullOrEmpty(CenterPage)) - { - //序号 - value = " " + value; - } - if (!string.IsNullOrEmpty(cellUnitLeft)) - { - p.ParagraphFormat.Alignment = ParagraphAlignment.Left;//表格中字体居左 - } - else - { - p.ParagraphFormat.Alignment = ParagraphAlignment.Center;//表格中字体居中 - } - - - p.AppendChild(new Run(doc, value)); - - cell.CellFormat.Width = cellWidth; - - cell.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center; - - cell.CellFormat.Borders.LineWidth = 0.75; - - cell.AppendChild(p); + cell.AppendChild(new Paragraph(doc)); + cell.FirstParagraph.AppendChild(new Run(doc, text)); + cell.CellFormat.Width = width; return cell; } - #endregion + + protected void txtName_TextChanged(object sender, EventArgs e) + { + BindGrid(); + } } } \ No newline at end of file diff --git a/HJGL_DS/FineUIPro.Web/JGZL/QualifiedWelder.aspx.designer.cs b/HJGL_DS/FineUIPro.Web/JGZL/QualifiedWelder.aspx.designer.cs index 3a4a601..0af31b6 100644 --- a/HJGL_DS/FineUIPro.Web/JGZL/QualifiedWelder.aspx.designer.cs +++ b/HJGL_DS/FineUIPro.Web/JGZL/QualifiedWelder.aspx.designer.cs @@ -95,6 +95,15 @@ namespace FineUIPro.Web.JGZL /// protected global::FineUIPro.Toolbar Toolbar2; + /// + /// txtName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtName; + /// /// ToolbarFill1 控件。 ///