This commit is contained in:
2026-08-28 16:37:52 +08:00
9 changed files with 312 additions and 59 deletions
@@ -2,9 +2,8 @@
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<UseIISExpress>true</UseIISExpress> <UseIISExpress>true</UseIISExpress>
<LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig> <LastActiveSolutionConfig>Release|Any CPU</LastActiveSolutionConfig>
<Use64BitIISExpress> <Use64BitIISExpress />
</Use64BitIISExpress>
<IISExpressSSLPort /> <IISExpressSSLPort />
<IISExpressAnonymousAuthentication /> <IISExpressAnonymousAuthentication />
<IISExpressWindowsAuthentication /> <IISExpressWindowsAuthentication />
@@ -36,7 +36,7 @@
<f:FileUpload ID="FileExcel" runat="server" Label="数据文件" EmptyText="请上传EXCEl格式文件" Width="400px" LabelWidth="70px"></f:FileUpload> <f:FileUpload ID="FileExcel" runat="server" Label="数据文件" EmptyText="请上传EXCEl格式文件" Width="400px" LabelWidth="70px"></f:FileUpload>
<f:Button ID="btnAudit" runat="server" Text="审核" ToolTip="文件审核!" OnClick="btnAudit_Click"></f:Button> <f:Button ID="btnAudit" runat="server" Text="审核" ToolTip="文件审核!" OnClick="btnAudit_Click"></f:Button>
<f:Button ID="imgbtnImport" runat="server" Text="上传" ToolTip="文件上传!" OnClick="imgbtnImport_Click"></f:Button> <f:Button ID="imgbtnImport" runat="server" Text="上传" ToolTip="文件上传!" OnClick="imgbtnImport_Click"></f:Button>
<f:CheckBox ID="cbUpdateIn" runat="server" Text="更新导入"></f:CheckBox> <f:CheckBox ID="cbUpdateIn" runat="server" Text="更新导入" Hidden="true"></f:CheckBox>
<f:ToolbarFill ID="ToolbarFill1" runat="server"></f:ToolbarFill> <f:ToolbarFill ID="ToolbarFill1" runat="server"></f:ToolbarFill>
<f:Button ID="imgbtnUpload" runat="server" Icon="DiskDownload" Text="模板下载" OnClick="imgbtnUpload_Click" EnableAjaxLoading="false"></f:Button> <f:Button ID="imgbtnUpload" runat="server" Icon="DiskDownload" Text="模板下载" OnClick="imgbtnUpload_Click" EnableAjaxLoading="false"></f:Button>
<f:HiddenField ID="hdFileName" runat="server"> <f:HiddenField ID="hdFileName" runat="server">
@@ -58,7 +58,10 @@
<f:Toolbar ID="Toolbar1" Position="Bottom" runat="server" ToolbarAlign="Right"> <f:Toolbar ID="Toolbar1" Position="Bottom" runat="server" ToolbarAlign="Right">
<Items> <Items>
<f:HiddenField ID="HiddenField2" runat="server"></f:HiddenField> <f:HiddenField ID="HiddenField2" runat="server"></f:HiddenField>
<f:Button ID="btnImport" ToolTip="导入数据库" Text="导入数据库" OnClick="btnImport_Click" Icon="SystemSave" runat="server" > <f:Button ID="btnOut2" OnClick="btnOut2_Click" runat="server" Text="按导入模板导出" Icon="Accept"
EnableAjax="false" DisableControlBeforePostBack="false">
</f:Button>
<f:Button ID="btnImport" ToolTip="导入数据库" Text="导入数据库" OnClick="btnImport_Click" Hidden="true" Icon="SystemSave" runat="server" >
</f:Button> </f:Button>
</Items> </Items>
</f:Toolbar> </f:Toolbar>
@@ -233,11 +233,11 @@ namespace FineUIPro.Web.HJGL.DataIn
var datas = rowData.ToList(); var datas = rowData.ToList();
row["Id"] = Guid.NewGuid().ToString(); row["Id"] = Guid.NewGuid().ToString();
foreach(DataRow row1 in dtTemp.Rows) foreach (DataRow row1 in dtTemp.Rows)
{ {
if (datas[0].ToString() == row1[0].ToString()) if (datas[0].ToString() == row1[0].ToString())
{ {
for(int index = 0; index < dtTemp.Columns.Count; index++) for (int index = 0; index < dtTemp.Columns.Count; index++)
{ {
row[index] = row1[index]; row[index] = row1[index];
} }
@@ -312,7 +312,7 @@ namespace FineUIPro.Web.HJGL.DataIn
isoInfo.ISO_IsoNo = row[dataColumn.ColumnName].ToString(); isoInfo.ISO_IsoNo = row[dataColumn.ColumnName].ToString();
break; break;
case "管道等级": case "管道等级":
isoInfo.ISC_ID = isoClasss.Where(x=>x.ISC_IsoName==row[dataColumn.ColumnName].ToString()|| x.ISC_IsoCode == row[dataColumn.ColumnName].ToString()).Select(x=>x.ISC_ID).FirstOrDefault(); isoInfo.ISC_ID = isoClasss.Where(x => x.ISC_IsoName == row[dataColumn.ColumnName].ToString() || x.ISC_IsoCode == row[dataColumn.ColumnName].ToString()).Select(x => x.ISC_ID).FirstOrDefault();
break; break;
case "执行标准": case "执行标准":
if (!string.IsNullOrEmpty(row[dataColumn.ColumnName].ToString())) if (!string.IsNullOrEmpty(row[dataColumn.ColumnName].ToString()))
@@ -330,12 +330,12 @@ namespace FineUIPro.Web.HJGL.DataIn
if (steel != null) if (steel != null)
{ {
isoInfo.STE_ID = steel.STE_ID; isoInfo.STE_ID = steel.STE_ID;
if(steel.STE_SteelType == "FeⅣ") if (steel.STE_SteelType == "FeⅣ")
{ {
isoInfo.IsHotType = "1"; isoInfo.IsHotType = "1";
} }
else if (steel.STE_SteelType == "Fe" || steel.STE_SteelType == "FeⅡ" || steel.STE_SteelType == "FeⅢ" ) else if (steel.STE_SteelType == "Fe" || steel.STE_SteelType == "FeⅡ" || steel.STE_SteelType == "FeⅢ")
{ {
isoInfo.IsHotType = "2"; isoInfo.IsHotType = "2";
@@ -343,7 +343,7 @@ namespace FineUIPro.Web.HJGL.DataIn
} }
break; break;
case "材质标准": case "材质标准":
isoInfo.MaterialStandardId = materialStandards.Where(x => x.MaterialStandardName == row[dataColumn.ColumnName].ToString()||x.MaterialStandardCode == row[dataColumn.ColumnName].ToString()).Select(x => x.MaterialStandardId).FirstOrDefault(); isoInfo.MaterialStandardId = materialStandards.Where(x => x.MaterialStandardName == row[dataColumn.ColumnName].ToString() || x.MaterialStandardCode == row[dataColumn.ColumnName].ToString()).Select(x => x.MaterialStandardId).FirstOrDefault();
break; break;
case "介质": case "介质":
var SER_ID = services.Where(x => x.SER_Name == row[dataColumn.ColumnName].ToString() || x.SER_Code == row[dataColumn.ColumnName].ToString()).Select(x => x.SER_ID).FirstOrDefault(); var SER_ID = services.Where(x => x.SER_Name == row[dataColumn.ColumnName].ToString() || x.SER_Code == row[dataColumn.ColumnName].ToString()).Select(x => x.SER_ID).FirstOrDefault();
@@ -824,7 +824,7 @@ namespace FineUIPro.Web.HJGL.DataIn
{ {
if (STE_ID != null) if (STE_ID != null)
{ {
var steel= Funs.DB.HJGL_BS_Steel.FirstOrDefault(x => x.STE_ID == STE_ID.ToString()); var steel = Funs.DB.HJGL_BS_Steel.FirstOrDefault(x => x.STE_ID == STE_ID.ToString());
if (steel != null) if (steel != null)
{ {
return steel.STE_Code; return steel.STE_Code;
@@ -906,10 +906,254 @@ namespace FineUIPro.Web.HJGL.DataIn
throw; throw;
} }
}
#region
/// <summary>
/// 按导入模板导出
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnOut2_Click(object sender, EventArgs e)
{
string rootPath = Server.MapPath("~/");
string initTemplatePath = Const.PiprLineInTemplateUrl;
string uploadfilepath = string.Empty;
string newUrl = string.Empty;
uploadfilepath = rootPath + initTemplatePath;
Model.SGGLDB db = Funs.DB;
var isoClasss = from x in Funs.DB.HJGL_BS_IsoClass orderby x.ISC_IsoCode select x;
var execStandards = from x in Funs.DB.HJGL_BS_ExecStandard orderby x.ExecStandardName select x;
var steels = from x in Funs.DB.HJGL_BS_Steel where x.IsUse == true orderby x.STE_Code select x;
var materialStandards = from x in Funs.DB.HJGL_BS_MaterialStandard orderby x.MaterialStandardCode select x;
var services = from x in Funs.DB.HJGL_BS_Service orderby x.SER_Code select x;
if (isoList.Count() > 0)
{
newUrl = uploadfilepath.Replace("工艺管线参数信息导入模板", "管线信息");
if (File.Exists(newUrl))
{
File.Delete(newUrl);
}
File.Copy(uploadfilepath, newUrl);
// 第一步:读取文件流
NPOI.SS.UserModel.IWorkbook workbook;
using (FileStream stream = new FileStream(newUrl, FileMode.Open, FileAccess.Read))
{
//workbook = new NPOI.XSSF.UserModel.XSSFWorkbook(stream);
workbook = new NPOI.HSSF.UserModel.HSSFWorkbook(stream);
}
// 创建单元格样式
NPOI.SS.UserModel.ICellStyle cellStyle = workbook.CreateCellStyle();
cellStyle.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
cellStyle.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
cellStyle.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
cellStyle.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
cellStyle.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Center;
cellStyle.VerticalAlignment = NPOI.SS.UserModel.VerticalAlignment.Center;
cellStyle.WrapText = true;//自动换行
var font = workbook.CreateFont();
font.FontHeightInPoints = 11;
cellStyle.SetFont(font);
// 第二步:创建新数据行
NPOI.SS.UserModel.ISheet sheet = workbook.GetSheetAt(0);
NPOI.SS.UserModel.IRow row = sheet.GetRow(0);
NPOI.SS.UserModel.ICell cell;
int i = 1;
foreach (var iso in isoList)
{
// 第二步:创建新数据行
row = sheet.CreateRow(i);
// 添加数据
// 单位名称
cell = row.CreateCell(0);
cell.CellStyle = cellStyle;
cell.SetCellValue(string.Empty);
//施工号
cell = row.CreateCell(1);
cell.CellStyle = cellStyle;
string proCode = string.Empty;
var pro = BLL.Base_ProjectService.GetProjectByProjectId(iso.ProjectId);
if (pro != null)
{
proCode = pro.ProjectCode;
}
cell.SetCellValue(proCode);
//单线图号
cell = row.CreateCell(2);
cell.CellStyle = cellStyle;
cell.SetCellValue(iso.ISO_IsoNo);
//管道等级
cell = row.CreateCell(3);
cell.CellStyle = cellStyle;
var isoClass = isoClasss.FirstOrDefault(x => x.ISC_ID == iso.ISC_ID);
if (isoClass != null)
{
cell.SetCellValue(isoClass.ISC_IsoName);
}
//执行标准
cell = row.CreateCell(4);
cell.CellStyle = cellStyle;
var execStandard = execStandards.FirstOrDefault(x => x.ExecStandardId == iso.ISO_Executive);
if (execStandard != null)
{
cell.SetCellValue(execStandard.ExecStandardName);
}
//材质
cell = row.CreateCell(5);
cell.CellStyle = cellStyle;
var steel = steels.FirstOrDefault(x => x.STE_ID == iso.STE_ID);
if (steel != null)
{
cell.SetCellValue(steel.STE_Code);
}
//材质标准
cell = row.CreateCell(6);
cell.CellStyle = cellStyle;
var materialStandard = materialStandards.FirstOrDefault(x => x.MaterialStandardId == iso.MaterialStandardId);
if (materialStandard != null)
{
cell.SetCellValue(materialStandard.MaterialStandardCode);
}
//介质
cell = row.CreateCell(7);
cell.CellStyle = cellStyle;
var service = services.FirstOrDefault(x => x.SER_ID == iso.SER_ID);
if (service != null)
{
cell.SetCellValue(service.SER_Name);
}
//试压包号
cell = row.CreateCell(8);
cell.CellStyle = cellStyle;
if (!string.IsNullOrEmpty(iso.PressureTestPackageNo))
{
cell.SetCellValue(iso.PressureTestPackageNo);
}
//管道类别
cell = row.CreateCell(9);
cell.CellStyle = cellStyle;
if (!string.IsNullOrEmpty(iso.PipeLineClass))
{
cell.SetCellValue(iso.PipeLineClass);
}
//涂漆类别
cell = row.CreateCell(10);
cell.CellStyle = cellStyle;
if (!string.IsNullOrEmpty(iso.ISO_Paint))
{
cell.SetCellValue(iso.ISO_Paint);
}
//绝热类别
cell = row.CreateCell(11);
cell.CellStyle = cellStyle;
if (!string.IsNullOrEmpty(iso.ISO_Insulator))
{
cell.SetCellValue(iso.ISO_Insulator);
}
//操作压力
cell = row.CreateCell(12);
cell.CellStyle = cellStyle;
if (!string.IsNullOrEmpty(iso.OperatingPressure))
{
cell.SetCellValue(iso.OperatingPressure);
}
//操作温度
cell = row.CreateCell(13);
cell.CellStyle = cellStyle;
if (!string.IsNullOrEmpty(iso.OperatingTemperature))
{
cell.SetCellValue(iso.OperatingTemperature);
}
//泄露性试验
cell = row.CreateCell(14);
cell.CellStyle = cellStyle;
if (!string.IsNullOrEmpty(iso.LeakageTest))
{
cell.SetCellValue(iso.LeakageTest);
}
//设计压力
cell = row.CreateCell(15);
cell.CellStyle = cellStyle;
if (iso.ISO_DesignPress != null)
{
cell.SetCellValue(iso.ISO_DesignPress.ToString());
}
//设计温度
cell = row.CreateCell(16);
cell.CellStyle = cellStyle;
if (iso.ISO_DesignTemperature != null)
{
cell.SetCellValue(iso.ISO_DesignTemperature.ToString());
}
//耐压试验
cell = row.CreateCell(17);
cell.CellStyle = cellStyle;
if (iso.ISO_TestPress != null)
{
cell.SetCellValue(iso.ISO_TestPress.ToString());
}
//外径
cell = row.CreateCell(18);
cell.CellStyle = cellStyle;
if (iso.ISO_Dia != null)
{
cell.SetCellValue(iso.ISO_Dia.ToString());
}
//壁厚
cell = row.CreateCell(19);
cell.CellStyle = cellStyle;
if (iso.ISO_Sch != null)
{
cell.SetCellValue(iso.ISO_Sch.ToString());
}
//管线长度
cell = row.CreateCell(20);
cell.CellStyle = cellStyle;
if (iso.PipeLineLength != null)
{
cell.SetCellValue(iso.PipeLineLength.ToString());
}
//检测类别序号
cell = row.CreateCell(21);
cell.CellStyle = cellStyle;
if (!string.IsNullOrEmpty(iso.TestCategoryNum))
{
cell.SetCellValue(iso.TestCategoryNum);
}
//备注
cell = row.CreateCell(22);
cell.CellStyle = cellStyle;
if (!string.IsNullOrEmpty(iso.ISO_Remark))
{
cell.SetCellValue(iso.ISO_Remark);
}
i++;
}
// 第三步:写入文件流
using (FileStream stream = new FileStream(newUrl, FileMode.Create, FileAccess.Write))
{
workbook.Write(stream);
workbook.Close();
}
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);
}
}
#endregion
} }
} }
@@ -7,12 +7,10 @@
// </自动生成> // </自动生成>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
namespace FineUIPro.Web.HJGL.DataIn namespace FineUIPro.Web.HJGL.DataIn {
{
public partial class PipelineGrid public partial class PipelineGrid {
{
/// <summary> /// <summary>
/// form1 控件。 /// form1 控件。
@@ -113,6 +111,15 @@ namespace FineUIPro.Web.HJGL.DataIn
/// </remarks> /// </remarks>
protected global::FineUIPro.HiddenField HiddenField2; protected global::FineUIPro.HiddenField HiddenField2;
/// <summary>
/// btnOut2 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnOut2;
/// <summary> /// <summary>
/// btnImport 控件。 /// btnImport 控件。
/// </summary> /// </summary>
+1 -1
View File
@@ -11,7 +11,7 @@
<FineUIPro DebugMode="false" Theme="Cupertino"/> <FineUIPro DebugMode="false" Theme="Cupertino"/>
<appSettings> <appSettings>
<!--连接字符串--> <!--连接字符串-->
<add key="ConnectionString" value="Server=.\MSSQLSERVER2022;Database=HJGLDB_DS;Integrated Security=False;User ID=sa;Password=1111;MultipleActiveResultSets=true;Max Pool Size = 1000;Connect Timeout=1200"/> <add key="ConnectionString" value="Server=.\MSSQLSERVER01;Database=HJGLDB_DS;Integrated Security=False;User ID=sa;Password=1111;MultipleActiveResultSets=true;Max Pool Size = 1000;Connect Timeout=1200"/>
<!--系统名称--> <!--系统名称-->
<add key="SystemName" value="诺必达焊接管理系统"/> <add key="SystemName" value="诺必达焊接管理系统"/>
<add key="ChartImageHandler" value="storage=file;timeout=20;url=~/Images/;"/> <add key="ChartImageHandler" value="storage=file;timeout=20;url=~/Images/;"/>
@@ -85,13 +85,13 @@
<publishTime>04/12/2024 09:54:20</publishTime> <publishTime>04/12/2024 09:54:20</publishTime>
</File> </File>
<File Include="bin/BLL.dll"> <File Include="bin/BLL.dll">
<publishTime>08/10/2026 17:58:50</publishTime> <publishTime>08/25/2026 14:28:26</publishTime>
</File> </File>
<File Include="bin/BLL.dll.config"> <File Include="bin/BLL.dll.config">
<publishTime>12/31/2025 16:32:37</publishTime> <publishTime>12/31/2025 16:32:37</publishTime>
</File> </File>
<File Include="bin/BLL.pdb"> <File Include="bin/BLL.pdb">
<publishTime>08/10/2026 17:58:50</publishTime> <publishTime>08/25/2026 14:28:26</publishTime>
</File> </File>
<File Include="bin/BouncyCastle.Crypto.dll"> <File Include="bin/BouncyCastle.Crypto.dll">
<publishTime>12/17/2020 21:32:28</publishTime> <publishTime>12/17/2020 21:32:28</publishTime>
@@ -121,10 +121,10 @@
<publishTime>07/25/2012 11:48:56</publishTime> <publishTime>07/25/2012 11:48:56</publishTime>
</File> </File>
<File Include="bin/Model.dll"> <File Include="bin/Model.dll">
<publishTime>08/10/2026 17:58:50</publishTime> <publishTime>08/25/2026 14:28:25</publishTime>
</File> </File>
<File Include="bin/Model.pdb"> <File Include="bin/Model.pdb">
<publishTime>08/10/2026 17:58:50</publishTime> <publishTime>08/25/2026 14:28:25</publishTime>
</File> </File>
<File Include="bin/Newtonsoft.Json.dll"> <File Include="bin/Newtonsoft.Json.dll">
<publishTime>11/28/2018 02:07:34</publishTime> <publishTime>11/28/2018 02:07:34</publishTime>
@@ -295,13 +295,13 @@
<publishTime>05/24/2018 13:38:24</publishTime> <publishTime>05/24/2018 13:38:24</publishTime>
</File> </File>
<File Include="bin/SgManager.AI.dll"> <File Include="bin/SgManager.AI.dll">
<publishTime>08/10/2026 17:58:52</publishTime> <publishTime>08/25/2026 14:28:32</publishTime>
</File> </File>
<File Include="bin/SgManager.AI.dll.config"> <File Include="bin/SgManager.AI.dll.config">
<publishTime>07/28/2025 11:00:31</publishTime> <publishTime>07/28/2025 11:00:31</publishTime>
</File> </File>
<File Include="bin/SgManager.AI.pdb"> <File Include="bin/SgManager.AI.pdb">
<publishTime>08/10/2026 17:58:52</publishTime> <publishTime>08/25/2026 14:28:32</publishTime>
</File> </File>
<File Include="bin/System.Net.Http.Formatting.dll"> <File Include="bin/System.Net.Http.Formatting.dll">
<publishTime>02/01/2018 12:17:18</publishTime> <publishTime>02/01/2018 12:17:18</publishTime>
@@ -337,10 +337,10 @@
<publishTime>06/29/2015 16:49:52</publishTime> <publishTime>06/29/2015 16:49:52</publishTime>
</File> </File>
<File Include="bin/WebAPI.dll"> <File Include="bin/WebAPI.dll">
<publishTime>08/10/2026 17:58:53</publishTime> <publishTime>08/25/2026 14:28:35</publishTime>
</File> </File>
<File Include="bin/WebAPI.pdb"> <File Include="bin/WebAPI.pdb">
<publishTime>08/10/2026 17:58:53</publishTime> <publishTime>08/25/2026 14:28:35</publishTime>
</File> </File>
<File Include="bin/WebGrease.dll"> <File Include="bin/WebGrease.dll">
<publishTime>01/23/2014 13:57:34</publishTime> <publishTime>01/23/2014 13:57:34</publishTime>
@@ -466,7 +466,7 @@
<publishTime>07/03/2024 11:01:07</publishTime> <publishTime>07/03/2024 11:01:07</publishTime>
</File> </File>
<File Include="Web.config"> <File Include="Web.config">
<publishTime>08/10/2026 17:52:59</publishTime> <publishTime>08/25/2026 14:28:48</publishTime>
</File> </File>
</ItemGroup> </ItemGroup>
</Project> </Project>
+1 -1
View File
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig> <LastActiveSolutionConfig>Release|Any CPU</LastActiveSolutionConfig>
<NameOfLastUsedPublishProfile>FolderProfile</NameOfLastUsedPublishProfile> <NameOfLastUsedPublishProfile>FolderProfile</NameOfLastUsedPublishProfile>
<UseIISExpress>true</UseIISExpress> <UseIISExpress>true</UseIISExpress>
<Use64BitIISExpress /> <Use64BitIISExpress />