This commit is contained in:
2024-06-20 17:12:59 +08:00
parent 8b222bd7c3
commit 6b59df065d
31 changed files with 1138 additions and 404 deletions
@@ -117,6 +117,9 @@
</f:TextBox>
<f:ToolbarFill ID="ToolbarFill2" runat="server">
</f:ToolbarFill>
<f:Button ID="btnExport" Text="打印" ToolTip="导出" EnableAjax="false" DisableControlBeforePostBack="false" Icon="ApplicationGet" runat="server"
OnClick="btnExport_Click">
</f:Button>
</Items>
</f:Toolbar>
</Toolbars>
@@ -144,11 +147,10 @@
HeaderTextAlign="Center" TextAlign="Left" Width="120px">
</f:RenderField>
<f:RenderField HeaderText="<%$ Resources:Lan,QualityNo %>" ColumnID="QualityNo" DataField="QualityNo"
FieldType="String" TextAlign="Left" Width="150px">
FieldType="String" TextAlign="Left" Width="150px" Hidden="true">
</f:RenderField>
<f:RenderField HeaderText="<%$ Resources:Lan,Acceptance %>" ColumnID="Acceptance"
DataField="Acceptance" FieldType="String" TextAlign="Left" Width="150px">
DataField="Acceptance" FieldType="String" TextAlign="Left" Width="150px" Hidden="true">
</f:RenderField>
</Columns>
@@ -4,10 +4,9 @@ using System.Collections.Generic;
using System.Data.SqlClient;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
using NPOI.SS.UserModel;
using NPOI.XSSF.UserModel;
namespace FineUIPro.Web.WeldingProcess.PMI
{
@@ -384,6 +383,176 @@ namespace FineUIPro.Web.WeldingProcess.PMI
#endregion
#endregion
protected void btnExport_Click(object sender, EventArgs e)
{
Alert.ShowInTop("待开发!", MessageBoxIcon.Warning);
return;
//if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.HJGL_BatchTrustMenuId, Const.BtnOut))
//{
// if (string.IsNullOrWhiteSpace(this.tvControlItem.SelectedNodeID))
// {
// Alert.ShowInTop("请选择委托单!", MessageBoxIcon.Warning);
// return;
// }
// string rootPath = Server.MapPath("~/") + Const.ExcelUrl;
// //导出文件
// string filePath = rootPath + DateTime.Now.ToString("yyyyMMddhhmmss") + "\\";
// if (!Directory.Exists(filePath))
// {
// Directory.CreateDirectory(filePath);
// }
// string ReportFileName = filePath + "out1.xlsx";
// int rowIndex = 0;
// XSSFWorkbook hssfworkbook = new XSSFWorkbook();
// XSSFSheet ws = new XSSFSheet();
// string trustBatchId = this.tvControlItem.SelectedNodeID;
//}
//else
//{
// ShowNotify(Resources.Lan.NoPrivilegePrompt, MessageBoxIcon.Warning);
//}
}
#region
/// <summary>
/// 获取某一列的所有值
/// </summary>
/// <typeparam name="T">列数据类型</typeparam>
/// <param name="dtSource">数据表</param>
/// <param name="filedName">列名</param>
/// <returns></returns>
public static List<T> GetColumnValues<T>(DataTable dtSource, string filedName)
{
return (from r in dtSource.AsEnumerable() select r.Field<T>(filedName)).ToList<T>();
}
/// <summary>
/// 无损检测委托单行和列
/// </summary>
/// <returns></returns>
private XSSFSheet WsExcelCreateRow(XSSFSheet ws, XSSFWorkbook hssfworkbook, int sRows, int eRows, ICellStyle style, int cStart, int cEnd, int excelpart, bool isnobk = false)
{
for (int i = sRows; i <= eRows; i++)
{
ws.CreateRow(i);
if (excelpart == 1)
{
ws.GetRow(i).HeightInPoints =
i == sRows ? 27.75f :
i == (sRows + 1) ? 25.5f :
i == (sRows + 2) ? 25.5f :
i == (sRows + 3) ? 25.5f :
i == (sRows + 4) ? 23.25f :
i == (sRows + 5) ? 23.25f :
i == (sRows + 6) ? 23.25f :
i == (sRows + 7) ? 23.25f :
i == (sRows + 8) ? 23.25f :
i == (sRows + 9) ? 23.25f :
i == (sRows + 10) ? 23.25f :
i == (sRows + 11) ? 23.25f :
i == (sRows + 12) ? 23.25f :
17f;
}
else if (excelpart == 2)
{
ws.GetRow(i).HeightInPoints = 25.5f;
}
else
{
ws.GetRow(i).HeightInPoints = 15.5f;
}
for (int j = cStart; j <= cEnd; j++)
{
ws.GetRow(i).CreateCell(j);
if (isnobk)
{
ws.GetRow(i).GetCell(j).CellStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Center, 10.5, true, false);
}
else
{
ws.GetRow(i).GetCell(j).CellStyle = style;
}
}
}
return ws;
}
/// <summary>
/// 材料及配件检测委托单行和列
/// </summary>
/// <returns></returns>
private XSSFSheet ClExcelCreateRow(XSSFSheet ws, XSSFWorkbook hssfworkbook, int sRows, int eRows, ICellStyle style, int cStart, int cEnd, bool istitle = false, bool isnobk = false)
{
for (int i = sRows; i <= eRows; i++)
{
ws.CreateRow(i);
if (istitle)
{
ws.GetRow(i).HeightInPoints =
i == sRows ? 27.75f :
i == (sRows + 1) ? 25f :
i == (sRows + 2) ? 21.75f :
i == (sRows + 3) ? 21.75f :
i == (sRows + 5) ? 28f :
14.75f;
}
else
{
ws.GetRow(i).HeightInPoints = 14.75f;
}
for (int j = cStart; j <= cEnd; j++)
{
ws.GetRow(i).CreateCell(j);
if (isnobk)
{
ws.GetRow(i).GetCell(j).CellStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, NPOI.SS.UserModel.BorderStyle.None, NPOI.SS.UserModel.BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Center, 10, true, false);
}
else
{
ws.GetRow(i).GetCell(j).CellStyle = style;
}
}
}
return ws;
}
/// <summary>
/// 查询指定条数分页
/// </summary>
/// <returns></returns>
public static DataTable GetPageToTable(DataTable dt, int StartNum, int EndNum)
{
//0页代表每页数据,直接返回
if (EndNum == 0) return dt;
//数据源为空返回空DataTable
if (dt == null) return new DataTable();
DataTable newdt = dt.Copy();
newdt.Clear();//copy dt的框架
if (StartNum >= dt.Rows.Count)
return newdt;//源数据记录数小于等于要显示的记录,直接返回dt
if (EndNum > dt.Rows.Count)
EndNum = dt.Rows.Count;
for (int i = StartNum; i <= EndNum - 1; i++)
{
DataRow newdr = newdt.NewRow();
DataRow dr = dt.Rows[i];
foreach (DataColumn column in dt.Columns)
{
newdr[column.ColumnName] = dr[column.ColumnName];
}
newdt.Rows.Add(newdr);
}
return newdt;
}
#endregion
#region
/// <summary>
/// 获取按钮权限
@@ -257,6 +257,15 @@ namespace FineUIPro.Web.WeldingProcess.PMI
/// </remarks>
protected global::FineUIPro.ToolbarFill ToolbarFill2;
/// <summary>
/// btnExport 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnExport;
/// <summary>
/// ToolbarSeparator1 控件。
/// </summary>
@@ -117,14 +117,14 @@
TextAlign="Left" Width="220px">
</f:RenderField>
<f:RenderField HeaderText="<%$ Resources:Lan,QualityNo %>" ColumnID="QualityNo" DataField="QualityNo"
FieldType="String" TextAlign="Left" Width="150px">
FieldType="String" TextAlign="Left" Width="150px" Hidden="true">
<Editor>
<f:TextBox ID="tbxEditorQualityNo" Required="true" runat="server">
</f:TextBox>
</Editor>
</f:RenderField>
<f:RenderField HeaderText="<%$ Resources:Lan,Acceptance %>" ColumnID="Acceptance"
DataField="Acceptance" FieldType="String" TextAlign="Left" Width="150px">
DataField="Acceptance" FieldType="String" TextAlign="Left" Width="150px" Hidden="true">
<Editor>
<f:TextBox ID="txtEditorAcceptance" Required="true" runat="server">
</f:TextBox>
@@ -85,7 +85,15 @@ namespace FineUIPro.Web.WeldingProcess.PMI
this.drpUnitId.SelectedValue = trust.UnitId;
}
this.txtDetectionMethod.Text = "PMI光谱分析";
this.txtDetectionStandard.Text = trust.DetectionStandard;
if (!string.IsNullOrEmpty(trust.DetectionStandard))
{
this.txtDetectionStandard.Text = trust.DetectionStandard;
}
else
{
txtDetectionStandard.Text = "GB 50184-2011";
}
if (!string.IsNullOrEmpty(trust.Tabler))
{
this.txtTabler.Text = BLL.Sys_UserService.GetUserNameByUserId(trust.Tabler);
@@ -94,6 +102,7 @@ namespace FineUIPro.Web.WeldingProcess.PMI
}
else
{
txtDetectionStandard.Text = "GB 50184-2011";
this.txtTabler.Text = this.CurrUser.UserName;
this.SimpleForm1.Reset(); //重置所有字段
}
@@ -151,10 +151,10 @@
TextAlign="Center" Width="160px">
</f:RenderField>
<f:RenderField HeaderText="<%$ Resources:Lan,QualityNo %>" ColumnID="QualityNo" DataField="QualityNo"
FieldType="String" TextAlign="Left" Width="150px">
FieldType="String" TextAlign="Left" Width="150px" Hidden="true">
</f:RenderField>
<f:RenderField HeaderText="<%$ Resources:Lan,Acceptance %>" ColumnID="Acceptance"
DataField="Acceptance" FieldType="String" TextAlign="Left" Width="150px">
DataField="Acceptance" FieldType="String" TextAlign="Left" Width="150px" Hidden="true">
</f:RenderField>
<%-- 检测日期 --%>
<f:RenderField HeaderText="<%$ Resources:Lan,FilmDate %>" ColumnID="checkTime"