质量管理,管道试压包管理导入功能

This commit is contained in:
夏菊 2025-10-16 18:18:18 +08:00
parent e48087673e
commit bb4969983f
12 changed files with 716 additions and 23 deletions

View File

@ -192,6 +192,16 @@ namespace BLL
return (from x in Funs.DB.WBS_UnitWork where x.UnitWorkCode == UnitWorkCode select x).ToList();
}
/// <summary>
/// 根据项目Id获取单位工程信息
/// </summary>
/// <param name="projectId"></param>
/// <returns></returns>
public static List<Model.WBS_UnitWork> GetUnitWorkByProjectId(string projectId)
{
return (from x in Funs.DB.WBS_UnitWork where x.ProjectId == projectId select x).ToList();
}
/// <summary>
/// 下拉框选择(获取 text value)
/// </summary>

View File

@ -416,6 +416,9 @@
</data>
<data name="ApprovalCompleted" xml:space="preserve">
<value>审批完成</value>
</data>
<data name="ApprovalCompletedUnderConstruction" xml:space="preserve">
<value>已审待施工</value>
</data>
<data name="call" xml:space="preserve">
<value>呼叫</value>

View File

@ -105,6 +105,15 @@ namespace Resources {
}
}
/// <summary>
/// 查找类似 已审待施工 的本地化字符串。
/// </summary>
internal static string ApprovalCompletedUnderConstruction {
get {
return ResourceManager.GetString("ApprovalCompletedUnderConstruction", resourceCulture);
}
}
/// <summary>
/// 查找类似 材料到货 的本地化字符串。
/// </summary>

View File

@ -35,6 +35,8 @@
<f:ToolbarFill runat="server"></f:ToolbarFill>
<f:Button ID="btnNew" Icon="Add" EnablePostBack="true" runat="server" OnClick="btnNew_Click" ToolTip="增加" Hidden="true">
</f:Button>
<f:Button ID="btnImport" ToolTip="导入" Icon="PackageIn" runat="server" OnClick="btnImport_Click" Hidden="true">
</f:Button>
<f:Button ID="btnOut" OnClick="btnOut_Click" runat="server" ToolTip="导出" Icon="FolderUp"
EnableAjax="false" DisableControlBeforePostBack="false">
</f:Button>
@ -91,6 +93,10 @@
Target="Parent" EnableResize="false" runat="server" IsModal="true" OnClose="Window1_Close"
Width="800px" Height="500px">
</f:Window>
<f:Window ID="Window2" Title="弹出窗体" Hidden="true" EnableIFrame="true" EnableMaximize="true"
Target="Top" EnableResize="false" runat="server" OnClose="Window1_Close" IsModal="true"
Width="700px" Height="560px">
</f:Window>
<f:Menu ID="Menu1" runat="server">
<Items>
<f:MenuButton ID="btnMenuModify" EnablePostBack="true" runat="server" Text="修改" Icon="Pencil" OnClick="btnMenuModify_Click" Hidden="true">

View File

@ -197,6 +197,7 @@ namespace FineUIPro.Web.CQMS.ProcessControl
if (buttonList.Contains(BLL.Const.BtnAdd))
{
this.btnNew.Hidden = false;
this.btnImport.Hidden = false;
}
if (buttonList.Contains(BLL.Const.BtnModify))
{
@ -215,6 +216,18 @@ namespace FineUIPro.Web.CQMS.ProcessControl
}
#endregion
#region
/// <summary>
/// 导入按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnImport_Click(object sender, EventArgs e)
{
PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("TestPackageManagementDataIn.aspx", "导入 - ")));
}
#endregion
#region
/// 导出按钮
/// </summary>

View File

@ -7,11 +7,13 @@
// </自动生成>
//------------------------------------------------------------------------------
namespace FineUIPro.Web.CQMS.ProcessControl {
public partial class TestPackageManagement {
namespace FineUIPro.Web.CQMS.ProcessControl
{
public partial class TestPackageManagement
{
/// <summary>
/// form1 控件。
/// </summary>
@ -20,7 +22,7 @@ namespace FineUIPro.Web.CQMS.ProcessControl {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
/// <summary>
/// PageManager1 控件。
/// </summary>
@ -29,7 +31,7 @@ namespace FineUIPro.Web.CQMS.ProcessControl {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.PageManager PageManager1;
/// <summary>
/// Panel1 控件。
/// </summary>
@ -38,7 +40,7 @@ namespace FineUIPro.Web.CQMS.ProcessControl {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Panel Panel1;
/// <summary>
/// Grid1 控件。
/// </summary>
@ -47,7 +49,7 @@ namespace FineUIPro.Web.CQMS.ProcessControl {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Grid Grid1;
/// <summary>
/// ToolSearch 控件。
/// </summary>
@ -56,7 +58,7 @@ namespace FineUIPro.Web.CQMS.ProcessControl {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Toolbar ToolSearch;
/// <summary>
/// drpUnitWork 控件。
/// </summary>
@ -65,7 +67,7 @@ namespace FineUIPro.Web.CQMS.ProcessControl {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DropDownList drpUnitWork;
/// <summary>
/// drpCompletedState 控件。
/// </summary>
@ -74,7 +76,7 @@ namespace FineUIPro.Web.CQMS.ProcessControl {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DropDownList drpCompletedState;
/// <summary>
/// btnSearch 控件。
/// </summary>
@ -83,7 +85,7 @@ namespace FineUIPro.Web.CQMS.ProcessControl {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnSearch;
/// <summary>
/// btnNew 控件。
/// </summary>
@ -92,7 +94,16 @@ namespace FineUIPro.Web.CQMS.ProcessControl {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnNew;
/// <summary>
/// btnImport 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnImport;
/// <summary>
/// btnOut 控件。
/// </summary>
@ -101,7 +112,7 @@ namespace FineUIPro.Web.CQMS.ProcessControl {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnOut;
/// <summary>
/// lblPageIndex 控件。
/// </summary>
@ -110,7 +121,7 @@ namespace FineUIPro.Web.CQMS.ProcessControl {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblPageIndex;
/// <summary>
/// ToolbarText1 控件。
/// </summary>
@ -119,7 +130,7 @@ namespace FineUIPro.Web.CQMS.ProcessControl {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.ToolbarText ToolbarText1;
/// <summary>
/// ddlPageSize 控件。
/// </summary>
@ -128,7 +139,7 @@ namespace FineUIPro.Web.CQMS.ProcessControl {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DropDownList ddlPageSize;
/// <summary>
/// Window1 控件。
/// </summary>
@ -137,7 +148,16 @@ namespace FineUIPro.Web.CQMS.ProcessControl {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Window Window1;
/// <summary>
/// Window2 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Window Window2;
/// <summary>
/// Menu1 控件。
/// </summary>
@ -146,7 +166,7 @@ namespace FineUIPro.Web.CQMS.ProcessControl {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Menu Menu1;
/// <summary>
/// btnMenuModify 控件。
/// </summary>
@ -155,7 +175,7 @@ namespace FineUIPro.Web.CQMS.ProcessControl {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.MenuButton btnMenuModify;
/// <summary>
/// btnMenuDel 控件。
/// </summary>

View File

@ -0,0 +1,68 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TestPackageManagementDataIn.aspx.cs" Inherits="FineUIPro.Web.CQMS.ProcessControl.TestPackageManagementDataIn" %>
<!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="SimpleForm1" runat="server" OnCustomEvent="PageManager1_CustomEvent" />
<f:Form ID="SimpleForm1" ShowBorder="false" ShowHeader="false" AutoScroll="true"
BodyPadding="10px" runat="server" RedStarPosition="BeforeText" LabelAlign="Right">
<Toolbars>
<f:Toolbar ID="Toolbar2" Position="Top" ToolbarAlign="Right" runat="server">
<Items>
<f:HiddenField ID="hdFileName" runat="server">
</f:HiddenField>
<f:Button ID="btnAudit" Icon="ApplicationEdit" runat="server" ToolTip="审核" ValidateForms="SimpleForm1" Text="审核"
OnClick="btnAudit_Click">
</f:Button>
<f:Button ID="btnImport" Icon="ApplicationGet" runat="server" ToolTip="导入" ValidateForms="SimpleForm1" Text="导入"
OnClick="btnImport_Click">
</f:Button>
<f:Button ID="btnDownLoad" runat="server" Icon="ApplicationGo" ToolTip="下载模板" OnClick="btnDownLoad_Click" Text="下载模板">
</f:Button>
<f:HiddenField ID="hdCheckResult" runat="server">
</f:HiddenField>
</Items>
</f:Toolbar>
</Toolbars>
<Rows>
<f:FormRow>
<Items>
<f:FileUpload runat="server" ID="fuAttachUrl" EmptyText="选择要导入的文件" Label="选择要导入的文件"
LabelWidth="150px">
</f:FileUpload>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:Grid ID="gvErrorInfo" ShowBorder="true" EnableAjax="false" ShowHeader="false" Title="管道试压包管理" EnableCollapse="true"
runat="server" BoxFlex="1" AllowCellEditing="true" ClicksToEdit="2" AllowSorting="true"
SortDirection="DESC" EnableColumnLines="true" ForceFit="true" AllowPaging="true" IsDatabasePaging="true" PageSize="10"
EnableRowDoubleClickEvent="true" AllowFilters="true" EnableTextSelection="True">
<Columns>
<f:TemplateField ColumnID="tfPageIndex" Width="55px" HeaderText="序号" HeaderTextAlign="Center" TextAlign="Center"
EnableLock="true" Locked="False">
<ItemTemplate>
<asp:Label ID="lblPageIndex" runat="server" Text='<%# gvErrorInfo.PageIndex * gvErrorInfo.PageSize + Container.DataItemIndex + 1 %>'></asp:Label>
</ItemTemplate>
</f:TemplateField>
<f:BoundField DataField="Row" HeaderText="错误行号">
</f:BoundField>
<f:BoundField DataField="Column" HeaderText="错误列">
</f:BoundField>
<f:BoundField DataField="Reason" HeaderText="错误类型">
</f:BoundField>
</Columns>
</f:Grid>
</Items>
</f:FormRow>
</Rows>
</f:Form>
</form>
</body>
</html>

View File

@ -0,0 +1,431 @@
using BLL;
using FineUIPro.Web.DataShow;
using Model;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.OleDb;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace FineUIPro.Web.CQMS.ProcessControl
{
public partial class TestPackageManagementDataIn : PageBase
{
#region
/// <summary>
/// 上传预设的虚拟路径
/// </summary>
private string initPath = Const.ExcelUrl;
/// <summary>
/// 错误集合
/// </summary>
public static List<Model.ErrorInfo> errorInfos = new List<Model.ErrorInfo>();
#endregion
#region
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.hdCheckResult.Text = string.Empty;
this.hdFileName.Text = string.Empty;
if (errorInfos != null)
{
errorInfos.Clear();
}
}
}
#endregion
#region
/// <summary>
/// 审核
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnAudit_Click(object sender, EventArgs e)
{
try
{
if (this.fuAttachUrl.HasFile == false)
{
ShowNotify("请您选择Excel文件", MessageBoxIcon.Warning);
return;
}
string IsXls = Path.GetExtension(this.fuAttachUrl.FileName).ToString().Trim().ToLower();
if (IsXls != ".xls")
{
ShowNotify("只可以选择Excel文件", MessageBoxIcon.Warning);
return;
}
if (errorInfos != null)
{
errorInfos.Clear();
}
string rootPath = Server.MapPath("~/");
string initFullPath = rootPath + initPath;
if (!Directory.Exists(initFullPath))
{
Directory.CreateDirectory(initFullPath);
}
this.hdFileName.Text = BLL.Funs.GetNewFileName() + IsXls;
string filePath = initFullPath + this.hdFileName.Text;
this.fuAttachUrl.PostedFile.SaveAs(filePath);
ImportXlsToData(rootPath + initPath + this.hdFileName.Text);
}
catch (Exception ex)
{
ShowNotify("'" + ex.Message + "'", MessageBoxIcon.Warning);
}
}
#region Excel提取数据
/// <summary>
/// 从Excel提取数据--》Dataset
/// </summary>
/// <param name="filename">Excel文件路径名</param>
private void ImportXlsToData(string fileName)
{
try
{
string oleDBConnString = String.Empty;
oleDBConnString = "Provider=Microsoft.Jet.OLEDB.4.0;";
oleDBConnString += "Data Source=";
oleDBConnString += fileName;
oleDBConnString += ";Extended Properties='Excel 8.0;HDR=Yes;IMEX=1;'";
OleDbConnection oleDBConn = null;
OleDbDataAdapter oleAdMaster = null;
DataTable m_tableName = new DataTable();
DataSet ds = new DataSet();
oleDBConn = new OleDbConnection(oleDBConnString);
oleDBConn.Open();
m_tableName = oleDBConn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);
if (m_tableName != null && m_tableName.Rows.Count > 0)
{
m_tableName.TableName = m_tableName.Rows[0]["TABLE_NAME"].ToString().Trim();
}
string sqlMaster;
sqlMaster = " SELECT * FROM [" + m_tableName.TableName + "]";
oleAdMaster = new OleDbDataAdapter(sqlMaster, oleDBConn);
oleAdMaster.Fill(ds, "m_tableName");
oleAdMaster.Dispose();
oleDBConn.Close();
oleDBConn.Dispose();
AddDatasetToSQL(ds.Tables[0], 8);
hdCheckResult.Text = "1";
}
catch (Exception exc)
{
Response.Write(exc);
//return null;
// return dt;
}
finally
{
}
}
#endregion
#region Dataset的数据导入数据库
/// <summary>
/// 将Dataset的数据导入数据库
/// </summary>
/// <param name="pds">数据集</param>
/// <param name="Cols">数据集行数</param>
/// <returns></returns>
private bool AddDatasetToSQL(DataTable pds, int Cols)
{
string result = string.Empty;
errorInfos.Clear();
int ic, ir;
ic = pds.Columns.Count;
if (ic < Cols)
{
ShowNotify("导入Excel格式错误Excel只有" + ic.ToString().Trim() + "列", MessageBoxIcon.Warning);
return false;
}
ir = pds.Rows.Count;
if (pds != null && ir > 0)
{
var unitWorks = UnitWorkService.GetUnitWorkByProjectId(this.CurrUser.LoginProjectId);
for (int i = 0; i < ir; i++)
{
string code = pds.Rows[i][0].ToString();
string unitWorkName = pds.Rows[i][1].ToString().Trim();
string testMedium = pds.Rows[i][2].ToString();
string testPressure = pds.Rows[i][3].ToString();
string planTestDate = pds.Rows[i][4].ToString();
string completedDate = pds.Rows[i][5].ToString();
string completedState = pds.Rows[i][6].ToString();
string remark = pds.Rows[i][7].ToString();
if (string.IsNullOrEmpty(code))
{
errorInfos.Add(new ErrorInfo { Row = (i+2).ToString(), Column = "试压包编号", Reason = "此项为必填项!" });
}
if (!string.IsNullOrEmpty(unitWorkName))
{
var isExistUnitWork = unitWorks.Where(x => x.UnitWorkName == unitWorkName);
if (!isExistUnitWork.Any())
{
errorInfos.Add(new ErrorInfo { Row = (i+2).ToString(), Column = "单位工程名称", Reason = $"不存在{unitWorkName}" });
}
}
else
{
errorInfos.Add(new ErrorInfo { Row = (i+2).ToString(), Column = "单位工程名称", Reason = "此项为必填项!" });
}
if (!string.IsNullOrWhiteSpace(planTestDate))
{
try
{
DateTime date = Convert.ToDateTime(planTestDate);
}
catch (Exception)
{
errorInfos.Add(new ErrorInfo { Row = (i+2).ToString(), Column = "计划试验日期", Reason = "不是日期格式!" });
}
}
else
{
errorInfos.Add(new ErrorInfo { Row = (i+2).ToString(), Column = "计划试验日期", Reason = "此项为必填项!" });
}
if (!string.IsNullOrWhiteSpace(completedDate))
{
try
{
DateTime date = Convert.ToDateTime(completedDate);
}
catch (Exception)
{
errorInfos.Add(new ErrorInfo { Row = (i+2).ToString(), Column = "试验完成日期", Reason = "不是日期格式!" });
}
}
else
{
errorInfos.Add(new ErrorInfo { Row = i.ToString(), Column = "试验完成日期", Reason = "此项为必填项!" });
}
if (!string.IsNullOrWhiteSpace(completedState))
{
if (completedState != "已完成" && completedState != "未完成")
{
errorInfos.Add(new ErrorInfo { Row = i.ToString(), Column = "完成状态", Reason = $"不存在{completedState}" });
}
}
else
{
errorInfos.Add(new ErrorInfo { Row = i.ToString(), Column = "完成状态", Reason = "此项为必填项!" });
}
}
if (errorInfos.Count > 0)
{
this.gvErrorInfo.DataSource = errorInfos;
this.gvErrorInfo.DataBind();
}
else
{
ShowNotify("审核完成,请点击导入!", MessageBoxIcon.Success);
}
}
else
{
ShowNotify("导入数据为空!", MessageBoxIcon.Warning);
}
return true;
}
#endregion
#endregion
#region
/// <summary>
/// 导入
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnImport_Click(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(hdCheckResult.Text))
{
if (errorInfos.Count <= 0)
{
string rootPath = Server.MapPath("~/");
ImportXlsToData2(rootPath + initPath + this.hdFileName.Text);
hdCheckResult.Text = string.Empty;
ShowNotify("导入成功!", MessageBoxIcon.Success);
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
}
else
{
ShowNotify("请先将错误数据修正,再重新导入提交!", MessageBoxIcon.Warning);
}
}
else
{
ShowNotify("请先审核要导入的文件!", MessageBoxIcon.Warning);
}
}
#region Excel提取数据
/// <summary>
/// 从Excel提取数据--》Dataset
/// </summary>
/// <param name="filename">Excel文件路径名</param>
private void ImportXlsToData2(string fileName)
{
try
{
string oleDBConnString = String.Empty;
oleDBConnString = "Provider=Microsoft.Jet.OLEDB.4.0;";
oleDBConnString += "Data Source=";
oleDBConnString += fileName;
oleDBConnString += ";Extended Properties='Excel 8.0;HDR=Yes;IMEX=1;'";
OleDbConnection oleDBConn = null;
OleDbDataAdapter oleAdMaster = null;
DataTable m_tableName = new DataTable();
DataSet ds = new DataSet();
oleDBConn = new OleDbConnection(oleDBConnString);
oleDBConn.Open();
m_tableName = oleDBConn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);
if (m_tableName != null && m_tableName.Rows.Count > 0)
{
m_tableName.TableName = m_tableName.Rows[0]["TABLE_NAME"].ToString().Trim();
}
string sqlMaster;
sqlMaster = " SELECT * FROM [" + m_tableName.TableName + "]";
oleAdMaster = new OleDbDataAdapter(sqlMaster, oleDBConn);
oleAdMaster.Fill(ds, "m_tableName");
oleAdMaster.Dispose();
oleDBConn.Close();
oleDBConn.Dispose();
AddDatasetToSQL2(ds.Tables[0], 8);
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region Dataset的数据导入数据库
/// <summary>
/// 将Dataset的数据导入数据库
/// </summary>
/// <param name="pds">数据集</param>
/// <param name="Cols">数据集列数</param>
/// <returns></returns>
private bool AddDatasetToSQL2(DataTable pds, int Cols)
{
int ic, ir;
ic = pds.Columns.Count;
if (ic < Cols)
{
ShowNotify("导入Excel格式错误Excel只有" + ic.ToString().Trim() + "列", MessageBoxIcon.Warning);
}
string result = string.Empty;
ir = pds.Rows.Count;
if (pds != null && ir > 0)
{
var unitWorks = UnitWorkService.GetUnitWorkByProjectId(this.CurrUser.LoginProjectId);
List<Model.ProcessControl_TestPackageManagement> list = new List<Model.ProcessControl_TestPackageManagement>();
for (int i = 0; i < ir; i++)
{
string code = pds.Rows[i][0].ToString();
string unitWorkName = pds.Rows[i][1].ToString().Trim();
string testMedium = pds.Rows[i][2].ToString();
string testPressure = pds.Rows[i][3].ToString();
string planTestDate = pds.Rows[i][4].ToString();
string completedDate = pds.Rows[i][5].ToString();
string completedState = pds.Rows[i][6].ToString();
string remark = pds.Rows[i][7].ToString();
Model.ProcessControl_TestPackageManagement model = new Model.ProcessControl_TestPackageManagement();
model.TestPackageManagementId = SQLHelper.GetNewID(typeof(Model.ProcessControl_TestPackageManagement));
model.ProjectId = this.CurrUser.LoginProjectId;
model.TestPackageManagementCode = code;
model.UnitWorkId = unitWorks.Where(x => x.UnitWorkName == unitWorkName).FirstOrDefault().UnitWorkId;
model.TestMedium = testMedium.Trim();
model.TestPressure = testPressure.Trim();
model.PlanTestDate = Convert.ToDateTime(planTestDate);
model.CompletedDate = Convert.ToDateTime(completedDate);
model.CompletedState = completedState == "已完成" ? "1" : "2";
model.Remark = remark;
list.Add(model);
}
if (list.Count > 0)
{
Funs.DB.ProcessControl_TestPackageManagement.InsertAllOnSubmit(list);
Funs.DB.SubmitChanges();
}
}
else
{
ShowNotify("导入数据为空!", MessageBoxIcon.Warning);
}
return true;
}
#endregion
#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")
{
string rootPath = Server.MapPath("~/");
string uploadfilepath = rootPath + "File\\Excel\\DataIn\\管道试压包管理导入模板.xls";
string filePath = "File\\Excel\\DataIn\\管道试压包管理导入模板.xls";
string fileName = Path.GetFileName(filePath);
FileInfo info = new FileInfo(uploadfilepath);
long fileSize = info.Length;
Response.ClearContent();
Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
Response.ContentType = "excel/plain";
Response.ContentEncoding = System.Text.Encoding.UTF8;
Response.AddHeader("Content-Length", fileSize.ToString().Trim());
Response.TransmitFile(uploadfilepath, 0, fileSize);
Response.End();
}
}
#endregion
}
}

View File

@ -0,0 +1,125 @@
//------------------------------------------------------------------------------
// <自动生成>
// 此代码由工具生成。
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// </自动生成>
//------------------------------------------------------------------------------
namespace FineUIPro.Web.CQMS.ProcessControl
{
public partial class TestPackageManagementDataIn
{
/// <summary>
/// form1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
/// <summary>
/// PageManager1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.PageManager PageManager1;
/// <summary>
/// SimpleForm1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Form SimpleForm1;
/// <summary>
/// Toolbar2 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Toolbar Toolbar2;
/// <summary>
/// hdFileName 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.HiddenField hdFileName;
/// <summary>
/// btnAudit 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnAudit;
/// <summary>
/// btnImport 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnImport;
/// <summary>
/// btnDownLoad 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnDownLoad;
/// <summary>
/// hdCheckResult 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.HiddenField hdCheckResult;
/// <summary>
/// fuAttachUrl 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.FileUpload fuAttachUrl;
/// <summary>
/// gvErrorInfo 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Grid gvErrorInfo;
/// <summary>
/// lblPageIndex 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblPageIndex;
}
}

View File

@ -635,6 +635,7 @@
<Content Include="CQMS\ProcessControl\NondestructiveTestEdit.aspx" />
<Content Include="CQMS\ProcessControl\NondestructiveTest_New.aspx" />
<Content Include="CQMS\ProcessControl\NondestructiveTest_NewEdit.aspx" />
<Content Include="CQMS\ProcessControl\TestPackageManagementDataIn.aspx" />
<Content Include="CQMS\ProcessControl\ShowUnitWork.aspx" />
<Content Include="CQMS\ProcessControl\TestPackageManagement.aspx" />
<Content Include="CQMS\ProcessControl\TestPackageManagementEdit.aspx" />
@ -8925,6 +8926,13 @@
<Compile Include="CQMS\ProcessControl\NondestructiveTest_NewEdit.aspx.designer.cs">
<DependentUpon>NondestructiveTest_NewEdit.aspx</DependentUpon>
</Compile>
<Compile Include="CQMS\ProcessControl\TestPackageManagementDataIn.aspx.cs">
<DependentUpon>TestPackageManagementDataIn.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="CQMS\ProcessControl\TestPackageManagementDataIn.aspx.designer.cs">
<DependentUpon>TestPackageManagementDataIn.aspx</DependentUpon>
</Compile>
<Compile Include="CQMS\ProcessControl\ShowUnitWork.aspx.cs">
<DependentUpon>ShowUnitWork.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>

View File

@ -109,7 +109,7 @@
<span></span>
<div class="inner-box">
<div style="font-size: .14rem;color: #DADADA;width:40px">
<asp:Literal runat="server" Text="<%$ Resources:Lan,ApprovalCompleted %>" />
<asp:Literal runat="server" Text="<%$ Resources:Lan,ApprovalCompletedUnderConstruction %>" />
</div>
<div style="font-size: .25rem;color: #FEB185;"><%=CompletedNum %></div>
</div>
@ -150,7 +150,7 @@
<span></span>
<div class="inner-box">
<div style="font-size: .14rem;color: #DADADA; width:40px">
<asp:Literal runat="server" Text="<%$ Resources:Lan,ApprovalCompleted %>" />
<asp:Literal runat="server" Text="<%$ Resources:Lan,ApprovalCompletedUnderConstruction %>" />
</div>
<div style="font-size: .25rem;color: #FEB185;"><%=SuperCompletedNum %></div>
</div>