焊接管理修改

This commit is contained in:
2025-08-28 15:41:32 +08:00
parent edebefa3c9
commit 87bbd83e25
24 changed files with 444 additions and 170 deletions
@@ -62,7 +62,7 @@
</Toolbars>
<Columns>
<f:RenderField Width="120px" ColumnID="TestPackageNo" DataField="TestPackageNo"
HeaderTextAlign="Center" HeaderText="试压包号" TextAlign="Left">
HeaderTextAlign="Center" HeaderText="试压包号" TextAlign="Left">
</f:RenderField>
<f:RenderField Width="120px" ColumnID="TestPackageName" DataField="TestPackageName"
HeaderTextAlign="Center" HeaderText="试压包名称" TextAlign="Left" ExpandUnusedSpace="true">
@@ -67,9 +67,9 @@
<Toolbars>
<f:Toolbar ID="Toolbar2" Position="Top" runat="server" ToolbarAlign="Right">
<Items>
<f:Label ID="txtTestPackageNo" Label="系统号" runat="server" LabelAlign="Right">
<f:Label ID="txtTestPackageNo" Label="试压包号" runat="server" LabelAlign="Right">
</f:Label>
<f:Label ID="txtTestPackageName" Label="系统名称" runat="server" LabelAlign="Right">
<f:Label ID="txtTestPackageName" Label="试压包名称" runat="server" LabelAlign="Right">
</f:Label>
<f:Label ID="txtRemark" Label="备注" runat="server" LabelAlign="Right">
</f:Label>
@@ -72,9 +72,9 @@
<Rows>
<f:FormRow>
<Items>
<f:Label ID="txtTestPackageNo" Label="系统号" runat="server" LabelWidth="130px">
<f:Label ID="txtTestPackageNo" Label="试压包号" runat="server" LabelWidth="130px">
</f:Label>
<f:Label ID="txtTestPackageName" Label="系统名称" runat="server" LabelWidth="130px">
<f:Label ID="txtTestPackageName" Label="试压包名称" runat="server" LabelWidth="130px">
</f:Label>
<f:Label ID="txtadjustTestPressure" Label="调整试验压力" runat="server" LabelWidth="130px">
</f:Label>
@@ -49,7 +49,7 @@
<f:RenderField HeaderText="试压包号" ColumnID="TestPackageNo" DataField="TestPackageNo" SortField="TestPackageNo"
FieldType="String" HeaderTextAlign="Center" TextAlign="Left" Width="160px">
</f:RenderField>
<f:RenderField HeaderText="试压名称" ColumnID="TestPackageName" DataField="TestPackageName" SortField="TestPackageName"
<f:RenderField HeaderText="试压名称" ColumnID="TestPackageName" DataField="TestPackageName" SortField="TestPackageName"
FieldType="String" HeaderTextAlign="Center" TextAlign="Left" Width="150px">
</f:RenderField>
<%--<f:RenderField HeaderText="试压状态" ColumnID="" DataField="" SortField=""
@@ -252,19 +252,67 @@ namespace FineUIPro.Web.HJGL.TestPackage
Alert.ShowInTop("请选择一条试压包", MessageBoxIcon.Warning);
return;
}
Dictionary<string, string> printFiles = new Dictionary<string, string>();
foreach (var ptp_id in selectedRows)
{
exportWord(ptp_id);
}
var item = exportWord(ptp_id);
printFiles.Add(item.FirstOrDefault().Key, item.FirstOrDefault().Value);
}
if (printFiles.Count>1)
{
string rootPath = Funs.RootPath;
string startPath = rootPath + "FileUpload\\试压包资料" + DateTime.Now.GetHashCode();
if (!Directory.Exists(startPath))
{
Directory.CreateDirectory(startPath);
}
string zipPath = rootPath + "FileUpload\\试压包资料" + DateTime.Now.GetHashCode() + ".zip";
foreach (var item in printFiles)
{
var sourceFile = item.Key;
var destFile = startPath + "\\" + item.Value;
if (File.Exists(sourceFile))
{
File.Copy(sourceFile, destFile, true);
File.Delete(sourceFile);
}
}
System.IO.Compression.ZipFile.CreateFromDirectory(startPath, zipPath);
FileInfo info = new FileInfo(zipPath);
long fileSize = info.Length;
System.Web.HttpContext.Current.Response.Clear();
System.Web.HttpContext.Current.Response.ContentType = "application/x-zip-compressed";
System.Web.HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode("试压包资料.zip", System.Text.Encoding.UTF8));
System.Web.HttpContext.Current.Response.AddHeader("Content-Length", fileSize.ToString());
System.Web.HttpContext.Current.Response.TransmitFile(zipPath, 0, fileSize);
System.Web.HttpContext.Current.Response.Flush();
System.Web.HttpContext.Current.Response.Close();
Funs.DeleteDir(startPath);
File.Delete(zipPath);
}
else
{
FileInfo info = new FileInfo(printFiles.FirstOrDefault().Key);
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(printFiles.FirstOrDefault().Value, System.Text.Encoding.UTF8));
System.Web.HttpContext.Current.Response.AddHeader("Content-Length", fileSize.ToString());
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 exportWord(string ptp_id)
protected Dictionary<string,string> exportWord(string ptp_id)
{
Dictionary<string,string> keyValuePairs = new Dictionary<string,string>();
if (string.IsNullOrEmpty(ptp_id))
{
Alert.ShowInTop("请选择要打印的单据!", MessageBoxIcon.Warning);
return;
return null;
}
//修改试压包打印状态
var updateTestPackage = Funs.DB.PTP_TestPackage.FirstOrDefault(x => x.PTP_ID == ptp_id);
@@ -286,6 +334,7 @@ namespace FineUIPro.Web.HJGL.TestPackage
if (this.drpPrintType.SelectedValue == "1")//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");
@@ -301,26 +350,28 @@ namespace FineUIPro.Web.HJGL.TestPackage
List<Model.FastReportItem> FastReportItemList = new List<Model.FastReportItem>();
foreach (var item in list)
{
FastReportItemList.Add(GetFastReportItem(updateTestPackage, item.Text));
FastReportItemList.Add(GetFastReportItem(updateTestPackage, item.Text, ptp_id));
}
var Path = Funs.RootPath + "FileUpload/" + ptp_id + ".pdf";
string Path = Funs.RootPath + "FileUpload/" + ptp_id + ".pdf";
BLL.FastReportService.ExportMergeReport(FastReportItemList, Path, this.drpPrintType.SelectedValue);
FileInfo info = new FileInfo(Path);
long fileSize = info.Length;
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);
File.Delete(Path);*/
}
else if (this.drpPrintType.SelectedValue == "2")//word格式
{
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");
@@ -329,7 +380,7 @@ namespace FineUIPro.Web.HJGL.TestPackage
List<Model.FastReportItem> FastReportItemList = new List<Model.FastReportItem>();
foreach (var item in list)
{
FastReportItemList.Add(GetFastReportItem(updateTestPackage, item.Text));
FastReportItemList.Add(GetFastReportItem(updateTestPackage, item.Text, ptp_id));
}
var PathA = Funs.RootPath + "FileUpload/" + ptp_id + ".docx";
BLL.FastReportService.ExportMergeReport(FastReportItemList, PathA, this.drpPrintType.SelectedValue);
@@ -340,7 +391,7 @@ namespace FineUIPro.Web.HJGL.TestPackage
List<Model.FastReportItem> FastReportItemList2 = new List<Model.FastReportItem>();
foreach (var item in list2)
{
FastReportItemList2.Add(GetFastReportItem(updateTestPackage, item.Text));
FastReportItemList2.Add(GetFastReportItem(updateTestPackage, item.Text, ptp_id));
}
var PathB = Funs.RootPath + "FileUpload/" + ptp_id + "2.docx";
BLL.FastReportService.ExportMergeReport(FastReportItemList2, PathB, this.drpPrintType.SelectedValue);
@@ -355,7 +406,7 @@ namespace FineUIPro.Web.HJGL.TestPackage
List<Model.FastReportItem> FastReportItemList3 = new List<Model.FastReportItem>();
foreach (var item in list3)
{
FastReportItemList3.Add(GetFastReportItem(updateTestPackage, item.Text));
FastReportItemList3.Add(GetFastReportItem(updateTestPackage, item.Text, ptp_id));
}
var PathC = Funs.RootPath + "FileUpload/" + ptp_id + "3.docx";
BLL.FastReportService.ExportMergeReport(FastReportItemList3, PathC, this.drpPrintType.SelectedValue);
@@ -369,7 +420,7 @@ namespace FineUIPro.Web.HJGL.TestPackage
List<Model.FastReportItem> FastReportItemList4 = new List<Model.FastReportItem>();
foreach (var item in list4)
{
FastReportItemList4.Add(GetFastReportItem(updateTestPackage, item.Text));
FastReportItemList4.Add(GetFastReportItem(updateTestPackage, item.Text, ptp_id));
}
var PathD = Funs.RootPath + "FileUpload/" + ptp_id + "4.docx";
BLL.FastReportService.ExportMergeReport(FastReportItemList4, PathD, this.drpPrintType.SelectedValue);
@@ -384,7 +435,7 @@ namespace FineUIPro.Web.HJGL.TestPackage
List<Model.FastReportItem> FastReportItemList5 = new List<Model.FastReportItem>();
foreach (var item in list5)
{
FastReportItemList5.Add(GetFastReportItem(updateTestPackage, item.Text));
FastReportItemList5.Add(GetFastReportItem(updateTestPackage, item.Text, ptp_id));
}
var PathE = Funs.RootPath + "FileUpload/" + ptp_id + "5.docx";
BLL.FastReportService.ExportMergeReport(FastReportItemList5, PathE, this.drpPrintType.SelectedValue);
@@ -393,10 +444,12 @@ namespace FineUIPro.Web.HJGL.TestPackage
doc1.AppendDocument(doc5, Aspose.Words.ImportFormatMode.KeepSourceFormatting);
//将合并的文档保存为 DOCX 文件
doc1.Save(Funs.RootPath + "FileUpload/doc.docx");
var Path = Funs.RootPath + "FileUpload/"+ ptp_id + "Result.docx";
doc1.Save(Path);
var Path = Funs.RootPath + "FileUpload/doc.docx";
FileInfo info = new FileInfo(Path);
keyValuePairs.Add(Path, exportName);
/* FileInfo info = new FileInfo(Path);
long fileSize = info.Length;
System.Web.HttpContext.Current.Response.Clear();
@@ -405,20 +458,22 @@ namespace FineUIPro.Web.HJGL.TestPackage
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);
System.Web.HttpContext.Current.Response.Close();*/
//File.Delete(Path);
File.Delete(PathA);
File.Delete(PathB);
File.Delete(PathC);
File.Delete(PathD);
File.Delete(PathE);
}
}
return keyValuePairs;
}
protected Model.FastReportItem GetFastReportItem(Model.PTP_TestPackage updateTestPackage, string printType)
protected Model.FastReportItem GetFastReportItem(Model.PTP_TestPackage updateTestPackage, string printType, string ptp_id)
{
string initTemplatePath = "";
Model.FastReportItem fastReportItem = new Model.FastReportItem();
@@ -483,7 +538,7 @@ namespace FineUIPro.Web.HJGL.TestPackage
where PTP_ItemEndCheckList.PTP_ID=@ptp_id";
List<SqlParameter> listStr = new List<SqlParameter>
{
new SqlParameter("@ptp_id", this.PTP_ID),
new SqlParameter("@ptp_id", ptp_id),
};
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(sql, parameter);
@@ -539,7 +594,7 @@ namespace FineUIPro.Web.HJGL.TestPackage
where ptpPipe.PTP_ID=@ptp_id";
List<SqlParameter> listStr = new List<SqlParameter>
{
new SqlParameter("@ptp_id", this.PTP_ID),
new SqlParameter("@ptp_id", ptp_id),
};
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(sql, parameter);
@@ -596,7 +651,7 @@ namespace FineUIPro.Web.HJGL.TestPackage
where PTP_ID=@ptp_id";
List<SqlParameter> listStr = new List<SqlParameter>
{
new SqlParameter("@ptp_id", this.PTP_ID),
new SqlParameter("@ptp_id", ptp_id),
};
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(sql, parameter);
@@ -636,7 +691,7 @@ namespace FineUIPro.Web.HJGL.TestPackage
break;
case "7"://管道焊接工作记录
{
var iosList = BLL.TestPackageEditService.GetPipeLineListByPTP_ID(this.PTP_ID);
var iosList = BLL.TestPackageEditService.GetPipeLineListByPTP_ID(ptp_id);
if (iosList.Count > 0)
{
var q = iosList[0];
@@ -659,11 +714,13 @@ namespace FineUIPro.Web.HJGL.TestPackage
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,--焊材牌号
(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 consumables1.ConsumablesName end
else consumables2.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
@@ -732,7 +789,7 @@ namespace FineUIPro.Web.HJGL.TestPackage
break;
case "8"://管道无损检测数量统计表
{
var iosList = BLL.TestPackageEditService.GetPipeLineListByPTP_ID(this.PTP_ID);
var iosList = BLL.TestPackageEditService.GetPipeLineListByPTP_ID(ptp_id);
if (iosList.Count > 0)
{
var q = iosList[0];
@@ -937,7 +994,7 @@ namespace FineUIPro.Web.HJGL.TestPackage
break;
case "9"://无损检测结果汇总表
{
var iosList = BLL.TestPackageEditService.GetPipeLineListByPTP_ID(this.PTP_ID);
var iosList = BLL.TestPackageEditService.GetPipeLineListByPTP_ID(ptp_id);
if (iosList.Count > 0)
{
var q = iosList[0];
@@ -7,11 +7,13 @@
// </自动生成>
//------------------------------------------------------------------------------
namespace FineUIPro.Web.HJGL.TestPackage {
public partial class TestPackageData {
namespace FineUIPro.Web.HJGL.TestPackage
{
public partial class TestPackageData
{
/// <summary>
/// form1 控件。
/// </summary>
@@ -20,7 +22,7 @@ namespace FineUIPro.Web.HJGL.TestPackage {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
/// <summary>
/// PageManager1 控件。
/// </summary>
@@ -29,7 +31,7 @@ namespace FineUIPro.Web.HJGL.TestPackage {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.PageManager PageManager1;
/// <summary>
/// Panel1 控件。
/// </summary>
@@ -38,7 +40,7 @@ namespace FineUIPro.Web.HJGL.TestPackage {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Panel Panel1;
/// <summary>
/// panelLeftRegion 控件。
/// </summary>
@@ -47,7 +49,7 @@ namespace FineUIPro.Web.HJGL.TestPackage {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Panel panelLeftRegion;
/// <summary>
/// tvControlItem 控件。
/// </summary>
@@ -56,7 +58,7 @@ namespace FineUIPro.Web.HJGL.TestPackage {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Tree tvControlItem;
/// <summary>
/// hdPTP_ID 控件。
/// </summary>
@@ -65,7 +67,7 @@ namespace FineUIPro.Web.HJGL.TestPackage {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.HiddenField hdPTP_ID;
/// <summary>
/// Panel2 控件。
/// </summary>
@@ -74,7 +76,7 @@ namespace FineUIPro.Web.HJGL.TestPackage {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Panel Panel2;
/// <summary>
/// Grid1 控件。
/// </summary>
@@ -83,7 +85,7 @@ namespace FineUIPro.Web.HJGL.TestPackage {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Grid Grid1;
/// <summary>
/// Toolbar2 控件。
/// </summary>
@@ -92,7 +94,7 @@ namespace FineUIPro.Web.HJGL.TestPackage {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Toolbar Toolbar2;
/// <summary>
/// txtTestPackageNo 控件。
/// </summary>
@@ -101,7 +103,7 @@ namespace FineUIPro.Web.HJGL.TestPackage {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtTestPackageNo;
/// <summary>
/// ToolbarFill1 控件。
/// </summary>
@@ -110,7 +112,7 @@ namespace FineUIPro.Web.HJGL.TestPackage {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.ToolbarFill ToolbarFill1;
/// <summary>
/// drpPrintType 控件。
/// </summary>
@@ -119,7 +121,7 @@ namespace FineUIPro.Web.HJGL.TestPackage {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DropDownList drpPrintType;
/// <summary>
/// btnPrint 控件。
/// </summary>
@@ -128,7 +130,7 @@ namespace FineUIPro.Web.HJGL.TestPackage {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnPrint;
/// <summary>
/// ToolbarSeparator1 控件。
/// </summary>
@@ -137,7 +139,7 @@ namespace FineUIPro.Web.HJGL.TestPackage {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.ToolbarSeparator ToolbarSeparator1;
/// <summary>
/// ToolbarText1 控件。
/// </summary>
@@ -146,7 +148,7 @@ namespace FineUIPro.Web.HJGL.TestPackage {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.ToolbarText ToolbarText1;
/// <summary>
/// ddlPageSize 控件。
/// </summary>
@@ -60,9 +60,9 @@
<Toolbars>
<f:Toolbar ID="Toolbar2" Position="Top" runat="server" ToolbarAlign="Left">
<Items>
<f:Label ID="txtTestPackageNo" Label="系统号" runat="server" LabelWidth="130px">
<f:Label ID="txtTestPackageNo" Label="试压包号" runat="server" LabelWidth="130px">
</f:Label>
<f:Label ID="txtTestPackageName" Label="系统名称" runat="server" LabelWidth="130px">
<f:Label ID="txtTestPackageName" Label="试压包名称" runat="server" LabelWidth="130px">
</f:Label>
<f:Label ID="txtRemark" Label="备注" runat="server" LabelWidth="130px">
</f:Label>
@@ -66,7 +66,7 @@
TextAlign="Left">
</f:RenderField>
<f:RenderField Width="200px" ColumnID="TestPackageName" DataField="TestPackageName" SortField="TestPackageName"
FieldType="String" HeaderText="系统名称" HeaderTextAlign="Center"
FieldType="String" HeaderText="试压包名称" HeaderTextAlign="Center"
TextAlign="Left">
</f:RenderField>
<f:RenderField Width="330px" ColumnID="PipelineCode" DataField="PipelineCode" SortField="PipelineCode"
@@ -20,7 +20,7 @@
<Items>
<f:TextBox ID="txtTestPackageNo" Label="试压包号" ShowRedStar="true" Required="true" runat="server" FocusOnPageLoad="true" LabelWidth="120px">
</f:TextBox>
<f:TextBox ID="txtTestPackageName" Label="系统名称" runat="server" LabelWidth="120px">
<f:TextBox ID="txtTestPackageName" Label="试压包名称" runat="server" LabelWidth="120px">
</f:TextBox>
<f:DropDownList runat="server" ID="drpUnit" Label ="单位名称"></f:DropDownList>
<f:DropDownList runat="server" ID="drpUnitWork" Label ="单位工程"></f:DropDownList>