新增管道颜色标识导入功能及API控制器
更新了多个服务和页面,增加了导入管道颜色标识数据的功能,并实现了包装管理、车次管理、管道组件和焊口信息的API控制器。修正了文件路径错误,优化了分页和排序逻辑,删除了不再使用的API方法。
This commit is contained in:
@@ -43,9 +43,12 @@
|
||||
<f:Button ID="btnNew" ToolTip="新增" Text="新增" Hidden="true" Icon="Add" runat="server"
|
||||
OnClick="btnNew_Click">
|
||||
</f:Button>
|
||||
|
||||
<f:Button ID="btnImport" Text="导入" ToolTip="导入" Icon="PackageIn" runat="server" OnClick="btnImport_Click">
|
||||
</f:Button>
|
||||
<f:Button ID="btnOut" OnClick="btnOut_Click" runat="server" Text="导出" ToolTip="导出" Icon="FolderUp"
|
||||
EnableAjax="false" DisableControlBeforePostBack="false">
|
||||
</f:Button>
|
||||
</f:Button>
|
||||
</Items>
|
||||
</f:Toolbar>
|
||||
</Toolbars>
|
||||
@@ -57,7 +60,7 @@
|
||||
</ItemTemplate>
|
||||
</f:TemplateField>
|
||||
<f:RenderField Width="150px" ColumnID="MaterialCode" DataField="MaterialCode" SortField="MaterialCode"
|
||||
FieldType="String" HeaderText="材质id" TextAlign="Left" HeaderTextAlign="Center" >
|
||||
FieldType="String" HeaderText="材质" TextAlign="Left" HeaderTextAlign="Center" >
|
||||
</f:RenderField>
|
||||
<f:RenderField Width="150px" ColumnID="ColorName" DataField="ColorName" SortField="ColorName"
|
||||
FieldType="String" HeaderText="颜色名称" TextAlign="Left" HeaderTextAlign="Center" >
|
||||
@@ -66,7 +69,7 @@
|
||||
FieldType="String" HeaderText="色卡号" TextAlign="Left" HeaderTextAlign="Center" >
|
||||
</f:RenderField>
|
||||
<f:RenderField Width="150px" ColumnID="RGB" DataField="RGB" SortField="RGB"
|
||||
FieldType="String" HeaderText="" TextAlign="Left" HeaderTextAlign="Center" >
|
||||
FieldType="String" HeaderText="RGB" TextAlign="Left" HeaderTextAlign="Center" >
|
||||
</f:RenderField>
|
||||
<f:RenderField Width="150px" ColumnID="Remark" DataField="Remark" SortField="Remark"
|
||||
FieldType="String" HeaderText="备注" TextAlign="Left" HeaderTextAlign="Center" >
|
||||
|
||||
@@ -238,6 +238,13 @@ namespace FineUIPro.Web.HJGL.BaseInfo
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region 导入按钮
|
||||
protected void btnImport_Click(object sender, EventArgs e)
|
||||
{
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("MaterialColorIn.aspx?", "导入 - ")));
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -68,6 +68,15 @@ namespace FineUIPro.Web.HJGL.BaseInfo
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnNew;
|
||||
|
||||
/// <summary>
|
||||
/// btnImport 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnImport;
|
||||
|
||||
/// <summary>
|
||||
/// btnOut 控件。
|
||||
/// </summary>
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MaterialColorIn.aspx.cs" Inherits="FineUIPro.Web.HJGL.BaseInfo.MaterialColorIn" %>
|
||||
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head runat="server">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>管道颜色标识库导入</title>
|
||||
</head>
|
||||
<body>
|
||||
<form id="form1" runat="server">
|
||||
<f:PageManager ID="PageManager1" AutoSizePanelID="Panel1" runat="server" OnCustomEvent="PageManager1_CustomEvent" />
|
||||
<f:Panel ID="Panel1" runat="server" Margin="5px" BodyPadding="5px" ShowBorder="false"
|
||||
ShowHeader="false" Layout="VBox" BoxConfigAlign="Stretch">
|
||||
<Toolbars>
|
||||
<f:Toolbar ID="Toolbar1" runat="server" Position="Bottom">
|
||||
<Items>
|
||||
<f:ToolbarFill ID="ToolbarFill1" runat="server"></f:ToolbarFill>
|
||||
<f:Button ID="btnImport" Icon="DoorIn" runat="server" Text="导入" ToolTip="数据导入" ValidateForms="SimpleForm1"
|
||||
OnClick="btnImport_Click">
|
||||
</f:Button>
|
||||
<f:Button ID="btnDownLoad" runat="server" Icon="ApplicationGo" Text="下载模板" ToolTip="下载模板" OnClick="btnDownLoad_Click">
|
||||
</f:Button>
|
||||
</Items>
|
||||
</f:Toolbar>
|
||||
</Toolbars>
|
||||
<Items>
|
||||
<f:FileUpload runat="server" ID="fuAttachUrl" EmptyText="请选择导入的Eexce文件" Width="500px">
|
||||
</f:FileUpload>
|
||||
<f:HiddenField ID="hdFileName" runat="server"></f:HiddenField>
|
||||
</Items>
|
||||
</f:Panel>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,142 @@
|
||||
using BLL;
|
||||
using Model;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
|
||||
namespace FineUIPro.Web.HJGL.BaseInfo
|
||||
{
|
||||
public partial class MaterialColorIn : PageBase
|
||||
{
|
||||
#region 加载
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 加载页面
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 导入
|
||||
|
||||
/// <summary>
|
||||
/// 导入
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnImport_Click(object sender, EventArgs e)
|
||||
{
|
||||
var message = string.Empty;
|
||||
errorInfos = string.Empty;
|
||||
if (fuAttachUrl.HasFile == false)
|
||||
{
|
||||
ShowNotify("请选择Excel文件!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
var IsXls = Path.GetExtension(fuAttachUrl.FileName).Trim().ToLower();
|
||||
if (IsXls != ".xlsx")
|
||||
{
|
||||
ShowNotify("只能选择Excel文件!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(errorInfos)) errorInfos = string.Empty;
|
||||
var rootPath = Server.MapPath("~/");
|
||||
var initFullPath = rootPath + initPath;
|
||||
if (!Directory.Exists(initFullPath)) Directory.CreateDirectory(initFullPath);
|
||||
//指定上传文件名称
|
||||
hdFileName.Text = Funs.GetNewFileName() + IsXls;
|
||||
//上传文件路径
|
||||
var filePath = initFullPath + hdFileName.Text;
|
||||
//文件上传服务器
|
||||
fuAttachUrl.PostedFile.SaveAs(filePath);
|
||||
//文件上传服务器后的名称
|
||||
var fileName = rootPath + initPath + hdFileName.Text;
|
||||
|
||||
ResponeData responeData;
|
||||
responeData = TwInOutplanmasterService.ImportData(fuAttachUrl.FileName, fileName, this.CurrUser.LoginProjectId, this.CurrUser.PersonId);
|
||||
|
||||
|
||||
if (responeData.code == 1)
|
||||
{
|
||||
ShowNotify("数据导入成功!", MessageBoxIcon.Success);
|
||||
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert alert = new Alert();
|
||||
alert.Message = responeData.message;
|
||||
alert.MessageBoxIcon = MessageBoxIcon.Error;
|
||||
alert.Show();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 定义项
|
||||
|
||||
/// <summary>
|
||||
/// 上传预设的虚拟路径
|
||||
/// </summary>
|
||||
private readonly string initPath = Const.ExcelUrl; //"File\\Excel\\DataIn\\";
|
||||
|
||||
/// <summary>
|
||||
/// 错误集合
|
||||
/// </summary>
|
||||
public static string errorInfos = string.Empty;
|
||||
|
||||
#endregion
|
||||
|
||||
#region 模板下载
|
||||
|
||||
/// <summary>
|
||||
/// 模板下载
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnDownLoad_Click(object sender, EventArgs e)
|
||||
{
|
||||
PageContext.RegisterStartupScript(Confirm.GetShowReference("确定要下载模板吗?", string.Empty,
|
||||
MessageBoxIcon.Question, PageManager1.GetCustomEventReference(false, "Confirm_OK"),
|
||||
PageManager1.GetCustomEventReference("Confirm_Cancel")));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 下载导入模板
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void PageManager1_CustomEvent(object sender, CustomEventArgs e)
|
||||
{
|
||||
if (e.EventArgument == "Confirm_OK")
|
||||
{
|
||||
var rootPath = Server.MapPath("~/");
|
||||
var uploadfilepath = rootPath + Const.Tw_InPlanMasteTemplateUrl;
|
||||
var filePath = Const.Tw_InPlanMasteTemplateUrl;
|
||||
var fileName = Path.GetFileName(filePath);
|
||||
var info = new FileInfo(uploadfilepath);
|
||||
var fileSize = info.Length;
|
||||
Response.ClearContent();
|
||||
Response.AddHeader("Content-Disposition",
|
||||
"attachment;filename=" + HttpUtility.UrlEncode(fileName, Encoding.UTF8));
|
||||
Response.ContentType = "excel/plain";
|
||||
Response.ContentEncoding = Encoding.UTF8;
|
||||
Response.AddHeader("Content-Length", fileSize.ToString().Trim());
|
||||
Response.TransmitFile(uploadfilepath, 0, fileSize);
|
||||
Response.End();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <自动生成>
|
||||
// 此代码由工具生成。
|
||||
//
|
||||
// 对此文件的更改可能导致不正确的行为,如果
|
||||
// 重新生成代码,则所做更改将丢失。
|
||||
// </自动生成>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace FineUIPro.Web.HJGL.BaseInfo
|
||||
{
|
||||
|
||||
|
||||
public partial class MaterialColorIn
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// form1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
|
||||
|
||||
/// <summary>
|
||||
/// PageManager1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.PageManager PageManager1;
|
||||
|
||||
/// <summary>
|
||||
/// Panel1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Panel Panel1;
|
||||
|
||||
/// <summary>
|
||||
/// Toolbar1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Toolbar Toolbar1;
|
||||
|
||||
/// <summary>
|
||||
/// ToolbarFill1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.ToolbarFill ToolbarFill1;
|
||||
|
||||
/// <summary>
|
||||
/// btnImport 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnImport;
|
||||
|
||||
/// <summary>
|
||||
/// btnDownLoad 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnDownLoad;
|
||||
|
||||
/// <summary>
|
||||
/// fuAttachUrl 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.FileUpload fuAttachUrl;
|
||||
|
||||
/// <summary>
|
||||
/// hdFileName 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.HiddenField hdFileName;
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MaterialColorInaspx.aspx.cs" Inherits="FineUIPro.Web.HJGL.BaseInfo.MaterialColorInaspx" %>
|
||||
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head runat="server">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
||||
<title></title>
|
||||
</head>
|
||||
<body>
|
||||
<form id="form1" runat="server">
|
||||
<div>
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,12 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace FineUIPro.Web.HJGL.BaseInfo
|
||||
{
|
||||
public partial class MaterialColorInaspx : System.Web.UI.Page
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 此代码是由工具生成的。
|
||||
//
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果
|
||||
// 重新生成代码,这些更改将会丢失。
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace FineUIPro.Web.HJGL.BaseInfo
|
||||
{
|
||||
|
||||
|
||||
public partial class MaterialColorInaspx
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// form1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user