1
This commit is contained in:
Binary file not shown.
@@ -2,7 +2,7 @@
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<UseIISExpress>true</UseIISExpress>
|
||||
<LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig>
|
||||
<LastActiveSolutionConfig>Release|Any CPU</LastActiveSolutionConfig>
|
||||
<Use64BitIISExpress />
|
||||
<IISExpressSSLPort />
|
||||
<IISExpressAnonymousAuthentication />
|
||||
|
||||
@@ -58,7 +58,10 @@
|
||||
<f:Toolbar ID="Toolbar1" Position="Bottom" runat="server" ToolbarAlign="Right">
|
||||
<Items>
|
||||
<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>
|
||||
</Items>
|
||||
</f:Toolbar>
|
||||
|
||||
@@ -233,11 +233,11 @@ namespace FineUIPro.Web.HJGL.DataIn
|
||||
var datas = rowData.ToList();
|
||||
row["Id"] = Guid.NewGuid().ToString();
|
||||
|
||||
foreach(DataRow row1 in dtTemp.Rows)
|
||||
foreach (DataRow row1 in dtTemp.Rows)
|
||||
{
|
||||
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];
|
||||
}
|
||||
@@ -312,7 +312,7 @@ namespace FineUIPro.Web.HJGL.DataIn
|
||||
isoInfo.ISO_IsoNo = row[dataColumn.ColumnName].ToString();
|
||||
break;
|
||||
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;
|
||||
case "执行标准":
|
||||
if (!string.IsNullOrEmpty(row[dataColumn.ColumnName].ToString()))
|
||||
@@ -330,12 +330,12 @@ namespace FineUIPro.Web.HJGL.DataIn
|
||||
if (steel != null)
|
||||
{
|
||||
isoInfo.STE_ID = steel.STE_ID;
|
||||
if(steel.STE_SteelType == "FeⅣ")
|
||||
if (steel.STE_SteelType == "FeⅣ")
|
||||
{
|
||||
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";
|
||||
|
||||
@@ -343,7 +343,7 @@ namespace FineUIPro.Web.HJGL.DataIn
|
||||
}
|
||||
break;
|
||||
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;
|
||||
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();
|
||||
@@ -824,7 +824,7 @@ namespace FineUIPro.Web.HJGL.DataIn
|
||||
{
|
||||
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)
|
||||
{
|
||||
return steel.STE_Code;
|
||||
@@ -906,10 +906,254 @@ namespace FineUIPro.Web.HJGL.DataIn
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
+11
-4
@@ -7,12 +7,10 @@
|
||||
// </自动生成>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace FineUIPro.Web.HJGL.DataIn
|
||||
{
|
||||
namespace FineUIPro.Web.HJGL.DataIn {
|
||||
|
||||
|
||||
public partial class PipelineGrid
|
||||
{
|
||||
public partial class PipelineGrid {
|
||||
|
||||
/// <summary>
|
||||
/// form1 控件。
|
||||
@@ -113,6 +111,15 @@ namespace FineUIPro.Web.HJGL.DataIn
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.HiddenField HiddenField2;
|
||||
|
||||
/// <summary>
|
||||
/// btnOut2 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnOut2;
|
||||
|
||||
/// <summary>
|
||||
/// btnImport 控件。
|
||||
/// </summary>
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
<add path="ChartImg.axd" verb="GET,POST,HEAD" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
|
||||
<add path="FastReport.Export.axd" verb="*" type="FastReport.Web.Handlers.WebExport"/>
|
||||
</httpHandlers>
|
||||
<compilation debug="false" targetFramework="4.6.1">
|
||||
<compilation debug="true" targetFramework="4.6.1">
|
||||
<assemblies>
|
||||
<add assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
</assemblies>
|
||||
|
||||
@@ -85,13 +85,13 @@
|
||||
<publishTime>04/12/2024 09:54:20</publishTime>
|
||||
</File>
|
||||
<File Include="bin/BLL.dll">
|
||||
<publishTime>08/10/2026 17:58:50</publishTime>
|
||||
<publishTime>08/25/2026 14:28:26</publishTime>
|
||||
</File>
|
||||
<File Include="bin/BLL.dll.config">
|
||||
<publishTime>12/31/2025 16:32:37</publishTime>
|
||||
</File>
|
||||
<File Include="bin/BLL.pdb">
|
||||
<publishTime>08/10/2026 17:58:50</publishTime>
|
||||
<publishTime>08/25/2026 14:28:26</publishTime>
|
||||
</File>
|
||||
<File Include="bin/BouncyCastle.Crypto.dll">
|
||||
<publishTime>12/17/2020 21:32:28</publishTime>
|
||||
@@ -121,10 +121,10 @@
|
||||
<publishTime>07/25/2012 11:48:56</publishTime>
|
||||
</File>
|
||||
<File Include="bin/Model.dll">
|
||||
<publishTime>08/10/2026 17:58:50</publishTime>
|
||||
<publishTime>08/25/2026 14:28:25</publishTime>
|
||||
</File>
|
||||
<File Include="bin/Model.pdb">
|
||||
<publishTime>08/10/2026 17:58:50</publishTime>
|
||||
<publishTime>08/25/2026 14:28:25</publishTime>
|
||||
</File>
|
||||
<File Include="bin/Newtonsoft.Json.dll">
|
||||
<publishTime>11/28/2018 02:07:34</publishTime>
|
||||
@@ -295,13 +295,13 @@
|
||||
<publishTime>05/24/2018 13:38:24</publishTime>
|
||||
</File>
|
||||
<File Include="bin/SgManager.AI.dll">
|
||||
<publishTime>08/10/2026 17:58:52</publishTime>
|
||||
<publishTime>08/25/2026 14:28:32</publishTime>
|
||||
</File>
|
||||
<File Include="bin/SgManager.AI.dll.config">
|
||||
<publishTime>07/28/2025 11:00:31</publishTime>
|
||||
</File>
|
||||
<File Include="bin/SgManager.AI.pdb">
|
||||
<publishTime>08/10/2026 17:58:52</publishTime>
|
||||
<publishTime>08/25/2026 14:28:32</publishTime>
|
||||
</File>
|
||||
<File Include="bin/System.Net.Http.Formatting.dll">
|
||||
<publishTime>02/01/2018 12:17:18</publishTime>
|
||||
@@ -337,10 +337,10 @@
|
||||
<publishTime>06/29/2015 16:49:52</publishTime>
|
||||
</File>
|
||||
<File Include="bin/WebAPI.dll">
|
||||
<publishTime>08/10/2026 17:58:53</publishTime>
|
||||
<publishTime>08/25/2026 14:28:35</publishTime>
|
||||
</File>
|
||||
<File Include="bin/WebAPI.pdb">
|
||||
<publishTime>08/10/2026 17:58:53</publishTime>
|
||||
<publishTime>08/25/2026 14:28:35</publishTime>
|
||||
</File>
|
||||
<File Include="bin/WebGrease.dll">
|
||||
<publishTime>01/23/2014 13:57:34</publishTime>
|
||||
@@ -466,7 +466,7 @@
|
||||
<publishTime>07/03/2024 11:01:07</publishTime>
|
||||
</File>
|
||||
<File Include="Web.config">
|
||||
<publishTime>08/10/2026 17:52:59</publishTime>
|
||||
<publishTime>08/25/2026 14:28:48</publishTime>
|
||||
</File>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig>
|
||||
<LastActiveSolutionConfig>Release|Any CPU</LastActiveSolutionConfig>
|
||||
<NameOfLastUsedPublishProfile>FolderProfile</NameOfLastUsedPublishProfile>
|
||||
<UseIISExpress>true</UseIISExpress>
|
||||
<Use64BitIISExpress />
|
||||
|
||||
Reference in New Issue
Block a user