代码无效引用清理,试压包资料界面看板修改

This commit is contained in:
2025-10-10 14:33:21 +08:00
parent 87fb529521
commit 55b798135c
933 changed files with 5897 additions and 7541 deletions
@@ -1,16 +1,11 @@
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.Data.SqlClient;
using System.IO;
using Model;
using Microsoft.SqlServer.Server;
using NPOI.SS.Formula.Functions;
using System.Linq;
using System.Web.UI.WebControls;
namespace FineUIPro.Web.HJGL.TestPackage
{
@@ -247,7 +242,7 @@ namespace FineUIPro.Web.HJGL.TestPackage
protected void btnPrint_Click(object sender, EventArgs e)
{
var selectedRows = this.Grid1.SelectedRowIDArray;
if (selectedRows.Length==0)
if (selectedRows.Length == 0)
{
Alert.ShowInTop("请选择一条试压包", MessageBoxIcon.Warning);
return;
@@ -257,11 +252,11 @@ namespace FineUIPro.Web.HJGL.TestPackage
{
var item = exportWord(ptp_id);
TestPackagePrintService.AddPrintCountByPTP_ID(ptp_id);//增加明细打印次数
printFiles.Add(item.FirstOrDefault().Key, item.FirstOrDefault().Value);
printFiles.Add(item.FirstOrDefault().Key, item.FirstOrDefault().Value);
}
if (printFiles.Count>1)
if (printFiles.Count > 1)
{
string zipName = "";
string zipName = "";
string rootPath = Funs.RootPath;
string startPath = rootPath + "FileUpload\\试压包资料" + DateTime.Now.GetHashCode();
if (!Directory.Exists(startPath))
@@ -273,20 +268,20 @@ namespace FineUIPro.Web.HJGL.TestPackage
{
var sourceFile = item.Key;
var destFile = startPath + "\\" + item.Value;
zipName+= item.Value.Replace(".pdf","")+"," ;
zipName += item.Value.Replace(".pdf", "") + ",";
if (File.Exists(sourceFile))
{
File.Copy(sourceFile, destFile, true);
File.Delete(sourceFile);
}
}
zipName= zipName.TrimEnd(',');
zipName = zipName.TrimEnd(',');
System.IO.Compression.ZipFile.CreateFromDirectory(startPath, zipPath);
FileInfo info = new FileInfo(zipPath);
long fileSize = info.Length;
System.Web.HttpContext.Current.Response.Clear();
System.Web.HttpContext.Current.Response.ContentType = "application/x-zip-compressed";
System.Web.HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(zipName+".zip", System.Text.Encoding.UTF8));
System.Web.HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(zipName + ".zip", System.Text.Encoding.UTF8));
System.Web.HttpContext.Current.Response.AddHeader("Content-Length", fileSize.ToString());
System.Web.HttpContext.Current.Response.TransmitFile(zipPath, 0, fileSize);
System.Web.HttpContext.Current.Response.Flush();
@@ -305,8 +300,8 @@ namespace FineUIPro.Web.HJGL.TestPackage
System.Web.HttpContext.Current.Response.TransmitFile(printFiles.FirstOrDefault().Key, 0, fileSize);
System.Web.HttpContext.Current.Response.Flush();
System.Web.HttpContext.Current.Response.Close();
}
}
}
protected void Grid1_RowCommand(object sender, GridCommandEventArgs e)
{
@@ -316,8 +311,8 @@ namespace FineUIPro.Web.HJGL.TestPackage
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("TestPackageDatePrint.aspx?PTP_ID={0}", keys[0], "编辑 - ")));
}
}
protected Dictionary<string,string> exportWord(string ptp_id)
}
protected Dictionary<string, string> exportWord(string ptp_id)
{
var keyValuePairs = new Dictionary<string, string>();
if (string.IsNullOrEmpty(ptp_id))
@@ -345,7 +340,7 @@ namespace FineUIPro.Web.HJGL.TestPackage
if (this.drpPrintType.SelectedValue == "1")//pdf格式
{
exportName+=".pdf";
exportName += ".pdf";
ListItem[] list = new ListItem[10];
list[0] = new ListItem("0", "File\\Fastreport\\JGZL\\管道试压包文件资料.frx");
list[1] = new ListItem("1", "File\\Fastreport\\JGZL\\管道压力试验技术要求.frx");
@@ -368,21 +363,21 @@ namespace FineUIPro.Web.HJGL.TestPackage
BLL.FastReportService.ExportMergeReport(FastReportItemList, Path, this.drpPrintType.SelectedValue);
keyValuePairs.Add(Path, exportName);
/* FileInfo info = new FileInfo(Path);
long fileSize = info.Length;
System.Web.HttpContext.Current.Response.Clear();
System.Web.HttpContext.Current.Response.ClearHeaders();
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);*/
/* FileInfo info = new FileInfo(Path);
long fileSize = info.Length;
System.Web.HttpContext.Current.Response.Clear();
System.Web.HttpContext.Current.Response.ClearHeaders();
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格式
{
exportName += ".docx";
exportName += ".docx";
ListItem[] list = new ListItem[3];
list[0] = new ListItem("0", "File\\Fastreport\\JGZL\\管道试压包文件资料.frx");
list[1] = new ListItem("1", "File\\Fastreport\\JGZL\\管道压力试验技术要求.frx");
@@ -455,21 +450,21 @@ namespace FineUIPro.Web.HJGL.TestPackage
doc1.AppendDocument(doc5, Aspose.Words.ImportFormatMode.KeepSourceFormatting);
//将合并的文档保存为 DOCX 文件
var Path = Funs.RootPath + "FileUpload/"+ ptp_id + "Result.docx";
var Path = Funs.RootPath + "FileUpload/" + ptp_id + "Result.docx";
doc1.Save(Path);
keyValuePairs.Add(Path, exportName);
keyValuePairs.Add(Path, exportName);
/* FileInfo info = new FileInfo(Path);
long fileSize = info.Length;
/* 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();*/
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);
@@ -481,7 +476,7 @@ namespace FineUIPro.Web.HJGL.TestPackage
}
return keyValuePairs;
}
}
#endregion
@@ -498,7 +493,7 @@ namespace FineUIPro.Web.HJGL.TestPackage
select new { MaterialCode1 = y.MaterialCode, MaterialCode2 = z.MaterialCode }).FirstOrDefault();
if (weldjoint != null)
{
if (!string.IsNullOrEmpty(weldjoint.MaterialCode1)&&!string.IsNullOrEmpty(weldjoint.MaterialCode2))
if (!string.IsNullOrEmpty(weldjoint.MaterialCode1) && !string.IsNullOrEmpty(weldjoint.MaterialCode2))
{
materialCode = weldjoint.MaterialCode1 + "/" + weldjoint.MaterialCode2;
}
@@ -513,7 +508,7 @@ namespace FineUIPro.Web.HJGL.TestPackage
materialCode = weldjoint.MaterialCode2;
}
}
}
}
return materialCode;