|
|
|
@ -250,13 +250,35 @@ namespace FineUIPro.Web.WeldingProcess.WeldingReport
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//获取焊口ID集合
|
|
|
|
|
//批量审核
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected void btnAuditAll_Click(object sender,EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
var data = this.GetDataTable();
|
|
|
|
|
if (string.IsNullOrEmpty(txtStarTime.Text) && string.IsNullOrEmpty(txtEndTime.Text))
|
|
|
|
|
{
|
|
|
|
|
ShowNotify("请按照日期选择要审核的日报!",MessageBoxIcon.Warning);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
List<string> ids = new List<string>();
|
|
|
|
|
foreach (DataRow dr in data.Rows)
|
|
|
|
|
{
|
|
|
|
|
ids.Add(dr["WeldJointId"].ToString());
|
|
|
|
|
}
|
|
|
|
|
ModifyAuditStatus(ids, 1);
|
|
|
|
|
this.BindGrid();
|
|
|
|
|
ShowNotify("批量审核成功!", MessageBoxIcon.Success);
|
|
|
|
|
}
|
|
|
|
|
//审核
|
|
|
|
|
protected void btnAudit_Click(object sender,EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
ModifyAuditStatus(1);
|
|
|
|
|
var listIds = GetWeldJointIdList();
|
|
|
|
|
if (listIds.Count == 0)
|
|
|
|
|
{
|
|
|
|
|
ShowNotify("请选择要审核的焊接日报数据", MessageBoxIcon.Warning);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
ModifyAuditStatus(listIds,1);
|
|
|
|
|
this.BindGrid();
|
|
|
|
|
|
|
|
|
|
ShowNotify("批量审核成功!", MessageBoxIcon.Success);
|
|
|
|
@ -264,10 +286,17 @@ namespace FineUIPro.Web.WeldingProcess.WeldingReport
|
|
|
|
|
//取消审核
|
|
|
|
|
protected void btnCancel_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
ModifyAuditStatus(0);
|
|
|
|
|
var listIds = GetWeldJointIdList();
|
|
|
|
|
if (listIds.Count == 0)
|
|
|
|
|
{
|
|
|
|
|
ShowNotify("请选择要取消审核的焊接日报数据", MessageBoxIcon.Warning);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
ModifyAuditStatus(listIds,0);
|
|
|
|
|
this.BindGrid();
|
|
|
|
|
ShowNotify("批量取消审核成功!", MessageBoxIcon.Success);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//发送邮件
|
|
|
|
|
protected void btnSendEmail_Click(object sender,EventArgs e)
|
|
|
|
|
{
|
|
|
|
@ -288,187 +317,195 @@ namespace FineUIPro.Web.WeldingProcess.WeldingReport
|
|
|
|
|
}
|
|
|
|
|
string ReportFileName = filePath + $"焊接日报_{DateTime.Now.ToString("yyyyMMddhhmmss")}.xlsx";
|
|
|
|
|
|
|
|
|
|
FileStream file = new FileStream(TempletFileName, FileMode.Open, FileAccess.Read);
|
|
|
|
|
XSSFWorkbook hssfworkbook = new XSSFWorkbook(file);
|
|
|
|
|
|
|
|
|
|
hssfworkbook.RemoveAt(0);
|
|
|
|
|
XSSFSheet ws = (XSSFSheet)hssfworkbook.CreateSheet("Sheet1");
|
|
|
|
|
|
|
|
|
|
int rowIndex = 0;
|
|
|
|
|
var style = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 20, true, true, "微软雅黑");
|
|
|
|
|
|
|
|
|
|
#region 头部
|
|
|
|
|
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex, rowIndex, style, 0, 19, true);
|
|
|
|
|
ws.AddMergedRegion(new NPOI.SS.Util.CellRangeAddress(rowIndex, rowIndex, 0, 19));
|
|
|
|
|
//设置表头文字
|
|
|
|
|
ws.GetRow(rowIndex).GetCell(0).SetCellValue("焊接日报表\nWelding Daily Report");
|
|
|
|
|
var style2 = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 9, true, true, "Arial");
|
|
|
|
|
|
|
|
|
|
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 1, rowIndex + 2, style2, 0, 19, true);
|
|
|
|
|
//设置表格表头
|
|
|
|
|
ws.GetRow(rowIndex + 1).GetCell(0).SetCellValue("序号");
|
|
|
|
|
ws.GetRow(rowIndex + 1).GetCell(1).SetCellValue("管线号-页码");
|
|
|
|
|
ws.GetRow(rowIndex + 1).GetCell(2).SetCellValue("图纸版本");
|
|
|
|
|
ws.GetRow(rowIndex + 1).GetCell(3).SetCellValue("焊口号");
|
|
|
|
|
ws.GetRow(rowIndex + 1).GetCell(4).SetCellValue("焊接形式");
|
|
|
|
|
ws.GetRow(rowIndex + 1).GetCell(5).SetCellValue("焊接位置");
|
|
|
|
|
ws.GetRow(rowIndex + 1).GetCell(6).SetCellValue("寸径");
|
|
|
|
|
ws.GetRow(rowIndex + 1).GetCell(7).SetCellValue("规格");
|
|
|
|
|
ws.GetRow(rowIndex + 1).GetCell(8).SetCellValue("焊工号");
|
|
|
|
|
ws.GetRow(rowIndex + 1).GetCell(9).SetCellValue("组对部件1");
|
|
|
|
|
ws.GetRow(rowIndex + 1).GetCell(10).SetCellValue("组件1材质");
|
|
|
|
|
ws.GetRow(rowIndex + 1).GetCell(11).SetCellValue("组件1炉批号");
|
|
|
|
|
ws.GetRow(rowIndex + 1).GetCell(12).SetCellValue("组对部件2");
|
|
|
|
|
ws.GetRow(rowIndex + 1).GetCell(13).SetCellValue("组件2材质");
|
|
|
|
|
ws.GetRow(rowIndex + 1).GetCell(14).SetCellValue("组件2炉批号");
|
|
|
|
|
ws.GetRow(rowIndex + 1).GetCell(15).SetCellValue("焊接方法");
|
|
|
|
|
ws.GetRow(rowIndex + 1).GetCell(16).SetCellValue("组对");
|
|
|
|
|
ws.GetRow(rowIndex + 1).GetCell(17).SetCellValue("外观");
|
|
|
|
|
ws.GetRow(rowIndex + 1).GetCell(18).SetCellValue("焊接日期");
|
|
|
|
|
ws.GetRow(rowIndex + 1).GetCell(19).SetCellValue("备注");
|
|
|
|
|
|
|
|
|
|
ws.GetRow(rowIndex + 2).GetCell(0).SetCellValue("S/N");
|
|
|
|
|
ws.GetRow(rowIndex + 2).GetCell(1).SetCellValue("LineNo.-PageNo.");
|
|
|
|
|
ws.GetRow(rowIndex + 2).GetCell(2).SetCellValue("Drawing\nRev");
|
|
|
|
|
ws.GetRow(rowIndex + 2).GetCell(3).SetCellValue("Joint\nNo.");
|
|
|
|
|
ws.GetRow(rowIndex + 2).GetCell(4).SetCellValue("JointType");
|
|
|
|
|
ws.GetRow(rowIndex + 2).GetCell(5).SetCellValue("Welding\nLocation");
|
|
|
|
|
ws.GetRow(rowIndex + 2).GetCell(6).SetCellValue("Inch");
|
|
|
|
|
ws.GetRow(rowIndex + 2).GetCell(7).SetCellValue("Size");
|
|
|
|
|
ws.GetRow(rowIndex + 2).GetCell(8).SetCellValue("Welder\nNo.");
|
|
|
|
|
ws.GetRow(rowIndex + 2).GetCell(9).SetCellValue("Part(1)");
|
|
|
|
|
ws.GetRow(rowIndex + 2).GetCell(10).SetCellValue("Material(1)");
|
|
|
|
|
ws.GetRow(rowIndex + 2).GetCell(11).SetCellValue("Heat\nNo.(1)");
|
|
|
|
|
ws.GetRow(rowIndex + 2).GetCell(12).SetCellValue("Part(2)");
|
|
|
|
|
ws.GetRow(rowIndex + 2).GetCell(13).SetCellValue("Material(2)");
|
|
|
|
|
ws.GetRow(rowIndex + 2).GetCell(14).SetCellValue("Heat\nNo.(2)");
|
|
|
|
|
ws.GetRow(rowIndex + 2).GetCell(15).SetCellValue("Weld\nProcess");
|
|
|
|
|
ws.GetRow(rowIndex + 2).GetCell(16).SetCellValue("Fit\nUp");
|
|
|
|
|
ws.GetRow(rowIndex + 2).GetCell(17).SetCellValue("VT");
|
|
|
|
|
ws.GetRow(rowIndex + 2).GetCell(18).SetCellValue("Welding\nDate");
|
|
|
|
|
ws.GetRow(rowIndex + 2).GetCell(19).SetCellValue("Remark");
|
|
|
|
|
|
|
|
|
|
ws.GetRow(rowIndex).Height = 69 * 20;
|
|
|
|
|
ws.GetRow(rowIndex + 1).Height = 15 * 20;
|
|
|
|
|
ws.GetRow(rowIndex + 2).Height = 30 * 20;
|
|
|
|
|
|
|
|
|
|
ws.SetColumnWidth(0, 5 * 256);
|
|
|
|
|
ws.SetColumnWidth(1, (int)(21.67 * 256));
|
|
|
|
|
ws.SetColumnWidth(2, (int)(9.78 * 256));
|
|
|
|
|
ws.SetColumnWidth(3, (int)(5.33 * 256));
|
|
|
|
|
ws.SetColumnWidth(4, (int)(7.67 * 256));
|
|
|
|
|
ws.SetColumnWidth(5, (int)(8.33 * 256));
|
|
|
|
|
ws.SetColumnWidth(6, (int)(7 * 256));
|
|
|
|
|
ws.SetColumnWidth(7, (int)(10.82 * 256));
|
|
|
|
|
ws.SetColumnWidth(8, (int)(8.33 * 256));
|
|
|
|
|
ws.SetColumnWidth(9, (int)(8.40 * 256));
|
|
|
|
|
ws.SetColumnWidth(10, (int)(15.67 * 256));
|
|
|
|
|
ws.SetColumnWidth(11, (int)(12 * 256));
|
|
|
|
|
ws.SetColumnWidth(12, (int)(8.22 * 256));
|
|
|
|
|
ws.SetColumnWidth(13, (int)(16.33 * 256));
|
|
|
|
|
ws.SetColumnWidth(14, (int)(11.45 * 256));
|
|
|
|
|
ws.SetColumnWidth(15, (int)(11.00 * 256));
|
|
|
|
|
ws.SetColumnWidth(16, (int)(4.00 * 256));
|
|
|
|
|
ws.SetColumnWidth(17, (int)(4.00 * 256));
|
|
|
|
|
ws.SetColumnWidth(18, (int)(9.00 * 256));
|
|
|
|
|
ws.SetColumnWidth(19, (int)(7 * 256));
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
const int pageSize = 65;
|
|
|
|
|
|
|
|
|
|
var style3 = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 9, false, false, "sans-serif");
|
|
|
|
|
|
|
|
|
|
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 3, dt.Rows.Count + 2, style3, 0, 19);
|
|
|
|
|
for (int i = 0; i < dt.Rows.Count; i++)
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
int startIndex = (i + 3);
|
|
|
|
|
ws.GetRow(startIndex).GetCell(0).SetCellValue(i + 1);
|
|
|
|
|
ws.GetRow(startIndex).GetCell(1).SetCellValue(dt.Rows[i]["SingleNumber"].ToString());
|
|
|
|
|
ws.GetRow(startIndex).GetCell(2).SetCellValue(dt.Rows[i]["DrawingsNum"].ToString());
|
|
|
|
|
ws.GetRow(startIndex).GetCell(3).SetCellValue(dt.Rows[i]["WeldJointCode"].ToString());
|
|
|
|
|
ws.GetRow(startIndex).GetCell(4).SetCellValue(dt.Rows[i]["WeldTypeCode"].ToString());
|
|
|
|
|
ws.GetRow(startIndex).GetCell(5).SetCellValue(dt.Rows[i]["WeldingLocationCode"].ToString());
|
|
|
|
|
ws.GetRow(startIndex).GetCell(6).SetCellValue(dt.Rows[i]["Size"].ToString());
|
|
|
|
|
ws.GetRow(startIndex).GetCell(7).SetCellValue(dt.Rows[i]["Specification"].ToString());
|
|
|
|
|
ws.GetRow(startIndex).GetCell(8).SetCellValue(dt.Rows[i]["WelderCode"].ToString());
|
|
|
|
|
ws.GetRow(startIndex).GetCell(9).SetCellValue(dt.Rows[i]["ComponentsName1"].ToString());
|
|
|
|
|
ws.GetRow(startIndex).GetCell(10).SetCellValue(dt.Rows[i]["MaterialCode1"].ToString());
|
|
|
|
|
ws.GetRow(startIndex).GetCell(11).SetCellValue(dt.Rows[i]["HeartNo1"].ToString());
|
|
|
|
|
ws.GetRow(startIndex).GetCell(12).SetCellValue(dt.Rows[i]["ComponentsName2"].ToString());
|
|
|
|
|
ws.GetRow(startIndex).GetCell(13).SetCellValue(dt.Rows[i]["MaterialCode2"].ToString());
|
|
|
|
|
ws.GetRow(startIndex).GetCell(14).SetCellValue(dt.Rows[i]["HeartNo2"].ToString());
|
|
|
|
|
ws.GetRow(startIndex).GetCell(15).SetCellValue(dt.Rows[i]["WeldingMethodName"].ToString());
|
|
|
|
|
ws.GetRow(startIndex).GetCell(16).SetCellValue("ACC");
|
|
|
|
|
ws.GetRow(startIndex).GetCell(17).SetCellValue("ACC");
|
|
|
|
|
ws.GetRow(startIndex).GetCell(18).SetCellValue(dt.Rows[i]["WeldingDate"].ToString());
|
|
|
|
|
ws.GetRow(startIndex).GetCell(19).SetCellValue(dt.Rows[i]["Remark"].ToString());
|
|
|
|
|
ws.GetRow(startIndex).Height = 10 * 20;
|
|
|
|
|
if (startIndex == pageSize)
|
|
|
|
|
{
|
|
|
|
|
ws.SetRowBreak(startIndex);
|
|
|
|
|
startIndex += pageSize;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
FileStream file = new FileStream(TempletFileName, FileMode.Open, FileAccess.Read);
|
|
|
|
|
XSSFWorkbook hssfworkbook = new XSSFWorkbook(file);
|
|
|
|
|
|
|
|
|
|
if (dt.Rows.Count > 0)
|
|
|
|
|
hssfworkbook.RemoveAt(0);
|
|
|
|
|
XSSFSheet ws = (XSSFSheet)hssfworkbook.CreateSheet("Sheet1");
|
|
|
|
|
|
|
|
|
|
int rowIndex = 0;
|
|
|
|
|
var style = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 20, true, true, "微软雅黑");
|
|
|
|
|
|
|
|
|
|
#region 头部
|
|
|
|
|
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex, rowIndex, style, 0, 19, true);
|
|
|
|
|
ws.AddMergedRegion(new NPOI.SS.Util.CellRangeAddress(rowIndex, rowIndex, 0, 19));
|
|
|
|
|
//设置表头文字
|
|
|
|
|
ws.GetRow(rowIndex).GetCell(0).SetCellValue("焊接日报表\nWelding Daily Report");
|
|
|
|
|
var style2 = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 9, true, true, "Arial");
|
|
|
|
|
|
|
|
|
|
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 1, rowIndex + 2, style2, 0, 19, true);
|
|
|
|
|
//设置表格表头
|
|
|
|
|
ws.GetRow(rowIndex + 1).GetCell(0).SetCellValue("序号");
|
|
|
|
|
ws.GetRow(rowIndex + 1).GetCell(1).SetCellValue("管线号-页码");
|
|
|
|
|
ws.GetRow(rowIndex + 1).GetCell(2).SetCellValue("图纸版本");
|
|
|
|
|
ws.GetRow(rowIndex + 1).GetCell(3).SetCellValue("焊口号");
|
|
|
|
|
ws.GetRow(rowIndex + 1).GetCell(4).SetCellValue("焊接形式");
|
|
|
|
|
ws.GetRow(rowIndex + 1).GetCell(5).SetCellValue("焊接位置");
|
|
|
|
|
ws.GetRow(rowIndex + 1).GetCell(6).SetCellValue("寸径");
|
|
|
|
|
ws.GetRow(rowIndex + 1).GetCell(7).SetCellValue("规格");
|
|
|
|
|
ws.GetRow(rowIndex + 1).GetCell(8).SetCellValue("焊工号");
|
|
|
|
|
ws.GetRow(rowIndex + 1).GetCell(9).SetCellValue("组对部件1");
|
|
|
|
|
ws.GetRow(rowIndex + 1).GetCell(10).SetCellValue("组件1材质");
|
|
|
|
|
ws.GetRow(rowIndex + 1).GetCell(11).SetCellValue("组件1炉批号");
|
|
|
|
|
ws.GetRow(rowIndex + 1).GetCell(12).SetCellValue("组对部件2");
|
|
|
|
|
ws.GetRow(rowIndex + 1).GetCell(13).SetCellValue("组件2材质");
|
|
|
|
|
ws.GetRow(rowIndex + 1).GetCell(14).SetCellValue("组件2炉批号");
|
|
|
|
|
ws.GetRow(rowIndex + 1).GetCell(15).SetCellValue("焊接方法");
|
|
|
|
|
ws.GetRow(rowIndex + 1).GetCell(16).SetCellValue("组对");
|
|
|
|
|
ws.GetRow(rowIndex + 1).GetCell(17).SetCellValue("外观");
|
|
|
|
|
ws.GetRow(rowIndex + 1).GetCell(18).SetCellValue("焊接日期");
|
|
|
|
|
ws.GetRow(rowIndex + 1).GetCell(19).SetCellValue("备注");
|
|
|
|
|
|
|
|
|
|
ws.GetRow(rowIndex + 2).GetCell(0).SetCellValue("S/N");
|
|
|
|
|
ws.GetRow(rowIndex + 2).GetCell(1).SetCellValue("LineNo.-PageNo.");
|
|
|
|
|
ws.GetRow(rowIndex + 2).GetCell(2).SetCellValue("Drawing\nRev");
|
|
|
|
|
ws.GetRow(rowIndex + 2).GetCell(3).SetCellValue("Joint\nNo.");
|
|
|
|
|
ws.GetRow(rowIndex + 2).GetCell(4).SetCellValue("JointType");
|
|
|
|
|
ws.GetRow(rowIndex + 2).GetCell(5).SetCellValue("Welding\nLocation");
|
|
|
|
|
ws.GetRow(rowIndex + 2).GetCell(6).SetCellValue("Inch");
|
|
|
|
|
ws.GetRow(rowIndex + 2).GetCell(7).SetCellValue("Size");
|
|
|
|
|
ws.GetRow(rowIndex + 2).GetCell(8).SetCellValue("Welder\nNo.");
|
|
|
|
|
ws.GetRow(rowIndex + 2).GetCell(9).SetCellValue("Part(1)");
|
|
|
|
|
ws.GetRow(rowIndex + 2).GetCell(10).SetCellValue("Material(1)");
|
|
|
|
|
ws.GetRow(rowIndex + 2).GetCell(11).SetCellValue("Heat\nNo.(1)");
|
|
|
|
|
ws.GetRow(rowIndex + 2).GetCell(12).SetCellValue("Part(2)");
|
|
|
|
|
ws.GetRow(rowIndex + 2).GetCell(13).SetCellValue("Material(2)");
|
|
|
|
|
ws.GetRow(rowIndex + 2).GetCell(14).SetCellValue("Heat\nNo.(2)");
|
|
|
|
|
ws.GetRow(rowIndex + 2).GetCell(15).SetCellValue("Weld\nProcess");
|
|
|
|
|
ws.GetRow(rowIndex + 2).GetCell(16).SetCellValue("Fit\nUp");
|
|
|
|
|
ws.GetRow(rowIndex + 2).GetCell(17).SetCellValue("VT");
|
|
|
|
|
ws.GetRow(rowIndex + 2).GetCell(18).SetCellValue("Welding\nDate");
|
|
|
|
|
ws.GetRow(rowIndex + 2).GetCell(19).SetCellValue("Remark");
|
|
|
|
|
|
|
|
|
|
ws.GetRow(rowIndex).Height = 69 * 20;
|
|
|
|
|
ws.GetRow(rowIndex + 1).Height = 15 * 20;
|
|
|
|
|
ws.GetRow(rowIndex + 2).Height = 30 * 20;
|
|
|
|
|
|
|
|
|
|
ws.SetColumnWidth(0, 5 * 256);
|
|
|
|
|
ws.SetColumnWidth(1, (int)(21.67 * 256));
|
|
|
|
|
ws.SetColumnWidth(2, (int)(9.78 * 256));
|
|
|
|
|
ws.SetColumnWidth(3, (int)(5.33 * 256));
|
|
|
|
|
ws.SetColumnWidth(4, (int)(7.67 * 256));
|
|
|
|
|
ws.SetColumnWidth(5, (int)(8.33 * 256));
|
|
|
|
|
ws.SetColumnWidth(6, (int)(7 * 256));
|
|
|
|
|
ws.SetColumnWidth(7, (int)(10.82 * 256));
|
|
|
|
|
ws.SetColumnWidth(8, (int)(8.33 * 256));
|
|
|
|
|
ws.SetColumnWidth(9, (int)(8.40 * 256));
|
|
|
|
|
ws.SetColumnWidth(10, (int)(15.67 * 256));
|
|
|
|
|
ws.SetColumnWidth(11, (int)(12 * 256));
|
|
|
|
|
ws.SetColumnWidth(12, (int)(8.22 * 256));
|
|
|
|
|
ws.SetColumnWidth(13, (int)(16.33 * 256));
|
|
|
|
|
ws.SetColumnWidth(14, (int)(11.45 * 256));
|
|
|
|
|
ws.SetColumnWidth(15, (int)(11.00 * 256));
|
|
|
|
|
ws.SetColumnWidth(16, (int)(4.00 * 256));
|
|
|
|
|
ws.SetColumnWidth(17, (int)(4.00 * 256));
|
|
|
|
|
ws.SetColumnWidth(18, (int)(9.00 * 256));
|
|
|
|
|
ws.SetColumnWidth(19, (int)(7 * 256));
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
const int pageSize = 65;
|
|
|
|
|
|
|
|
|
|
var style3 = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 9, false, false, "sans-serif");
|
|
|
|
|
|
|
|
|
|
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 3, dt.Rows.Count + 2, style3, 0, 19);
|
|
|
|
|
for (int i = 0; i < dt.Rows.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
int startIndex = (i + 3);
|
|
|
|
|
ws.GetRow(startIndex).GetCell(0).SetCellValue(i + 1);
|
|
|
|
|
ws.GetRow(startIndex).GetCell(1).SetCellValue(dt.Rows[i]["SingleNumber"].ToString());
|
|
|
|
|
ws.GetRow(startIndex).GetCell(2).SetCellValue(dt.Rows[i]["DrawingsNum"].ToString());
|
|
|
|
|
ws.GetRow(startIndex).GetCell(3).SetCellValue(dt.Rows[i]["WeldJointCode"].ToString());
|
|
|
|
|
ws.GetRow(startIndex).GetCell(4).SetCellValue(dt.Rows[i]["WeldTypeCode"].ToString());
|
|
|
|
|
ws.GetRow(startIndex).GetCell(5).SetCellValue(dt.Rows[i]["WeldingLocationCode"].ToString());
|
|
|
|
|
ws.GetRow(startIndex).GetCell(6).SetCellValue(dt.Rows[i]["Size"].ToString());
|
|
|
|
|
ws.GetRow(startIndex).GetCell(7).SetCellValue(dt.Rows[i]["Specification"].ToString());
|
|
|
|
|
ws.GetRow(startIndex).GetCell(8).SetCellValue(dt.Rows[i]["WelderCode"].ToString());
|
|
|
|
|
ws.GetRow(startIndex).GetCell(9).SetCellValue(dt.Rows[i]["ComponentsName1"].ToString());
|
|
|
|
|
ws.GetRow(startIndex).GetCell(10).SetCellValue(dt.Rows[i]["MaterialCode1"].ToString());
|
|
|
|
|
ws.GetRow(startIndex).GetCell(11).SetCellValue(dt.Rows[i]["HeartNo1"].ToString());
|
|
|
|
|
ws.GetRow(startIndex).GetCell(12).SetCellValue(dt.Rows[i]["ComponentsName2"].ToString());
|
|
|
|
|
ws.GetRow(startIndex).GetCell(13).SetCellValue(dt.Rows[i]["MaterialCode2"].ToString());
|
|
|
|
|
ws.GetRow(startIndex).GetCell(14).SetCellValue(dt.Rows[i]["HeartNo2"].ToString());
|
|
|
|
|
ws.GetRow(startIndex).GetCell(15).SetCellValue(dt.Rows[i]["WeldingMethodName"].ToString());
|
|
|
|
|
ws.GetRow(startIndex).GetCell(16).SetCellValue("ACC");
|
|
|
|
|
ws.GetRow(startIndex).GetCell(17).SetCellValue("ACC");
|
|
|
|
|
ws.GetRow(startIndex).GetCell(18).SetCellValue(dt.Rows[i]["WeldingDate"].ToString());
|
|
|
|
|
ws.GetRow(startIndex).GetCell(19).SetCellValue(dt.Rows[i]["Remark"].ToString());
|
|
|
|
|
ws.GetRow(startIndex).Height = 10 * 20;
|
|
|
|
|
if (startIndex == pageSize)
|
|
|
|
|
{
|
|
|
|
|
ws.SetRowBreak(startIndex);
|
|
|
|
|
startIndex += pageSize;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (dt.Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
string weldingDate = string.Empty;
|
|
|
|
|
if (txtStarTime.Text == txtEndTime.Text)
|
|
|
|
|
{
|
|
|
|
|
weldingDate = txtStarTime.Text;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
weldingDate = txtStarTime.Text + "-" + txtEndTime.Text;
|
|
|
|
|
}
|
|
|
|
|
var style4 = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 9, true, true, "Arial");
|
|
|
|
|
|
|
|
|
|
ws = ExcelCreateRow(ws, hssfworkbook, dt.Rows.Count + 3, dt.Rows.Count + 3, style4, 0, 19);
|
|
|
|
|
var distinctPipelineCode = dt.AsEnumerable().GroupBy(row => row.Field<string>("PipelineCode")).Select(group => group.First());
|
|
|
|
|
var distinctWelder = dt.AsEnumerable().GroupBy(row => row.Field<string>("WelderCode")).Select(group => group.First());
|
|
|
|
|
decimal sumSize = decimal.Parse(dt.Compute("sum(Size)", "").ToString());
|
|
|
|
|
|
|
|
|
|
ws.GetRow(dt.Rows.Count + 3).GetCell(0).SetCellValue("Total");
|
|
|
|
|
ws.GetRow(dt.Rows.Count + 3).GetCell(1).SetCellValue($"{distinctPipelineCode.Count().ToString()}");
|
|
|
|
|
ws.GetRow(dt.Rows.Count + 3).GetCell(3).SetCellValue($"{dt.Rows.Count}");
|
|
|
|
|
ws.GetRow(dt.Rows.Count + 3).GetCell(6).SetCellValue($"{sumSize}");
|
|
|
|
|
ws.GetRow(dt.Rows.Count + 3).GetCell(8).SetCellValue($"{distinctWelder.Count().ToString()}");
|
|
|
|
|
ws.GetRow(dt.Rows.Count + 3).Height = 20 * 20;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 页脚部分
|
|
|
|
|
IFooter footer = ws.Footer;
|
|
|
|
|
string str = " CC7: 监理: Worley:";
|
|
|
|
|
str += "\n\n第 &P 页,共 &N 页";
|
|
|
|
|
footer.Center = str;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
ws.FitToPage = true;
|
|
|
|
|
ws.PrintSetup.FitWidth = 1;
|
|
|
|
|
ws.PrintSetup.FitHeight = short.MaxValue;
|
|
|
|
|
|
|
|
|
|
ws.SetMargin(MarginType.LeftMargin, (double)1.2 / 3);
|
|
|
|
|
ws.SetMargin(MarginType.RightMargin, (double)0.5 / 3);
|
|
|
|
|
ws.SetMargin(MarginType.TopMargin, (double)1.8 / 3);
|
|
|
|
|
ws.SetMargin(MarginType.BottomMargin, (double)2.9 / 3);
|
|
|
|
|
ws.PrintSetup.Landscape = true;
|
|
|
|
|
ws.ForceFormulaRecalculation = true;
|
|
|
|
|
ws.PrintSetup.PaperSize = (int)PaperSize.A4_Small;
|
|
|
|
|
ws.RepeatingRows = new NPOI.SS.Util.CellRangeAddress(0, 2, 0, 19);
|
|
|
|
|
|
|
|
|
|
using (FileStream filess = System.IO.File.OpenWrite(ReportFileName))
|
|
|
|
|
{
|
|
|
|
|
hssfworkbook.Write(filess);
|
|
|
|
|
}
|
|
|
|
|
hssfworkbook.Close();
|
|
|
|
|
|
|
|
|
|
this.GetEmailTemplateAndSendEmail(ReportFileName);
|
|
|
|
|
File.Delete(ReportFileName);
|
|
|
|
|
ShowNotify("焊接日报发送成功!", MessageBoxIcon.Success);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
string weldingDate = string.Empty;
|
|
|
|
|
if (txtStarTime.Text == txtEndTime.Text)
|
|
|
|
|
{
|
|
|
|
|
weldingDate = txtStarTime.Text;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
weldingDate = txtStarTime.Text + "-" + txtEndTime.Text;
|
|
|
|
|
}
|
|
|
|
|
var style4 = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 9, true, true, "Arial");
|
|
|
|
|
|
|
|
|
|
ws = ExcelCreateRow(ws, hssfworkbook, dt.Rows.Count + 3, dt.Rows.Count + 3, style4, 0, 19);
|
|
|
|
|
var distinctPipelineCode = dt.AsEnumerable().GroupBy(row => row.Field<string>("PipelineCode")).Select(group => group.First());
|
|
|
|
|
var distinctWelder = dt.AsEnumerable().GroupBy(row => row.Field<string>("WelderCode")).Select(group => group.First());
|
|
|
|
|
decimal sumSize = decimal.Parse(dt.Compute("sum(Size)", "").ToString());
|
|
|
|
|
|
|
|
|
|
ws.GetRow(dt.Rows.Count + 3).GetCell(0).SetCellValue("Total");
|
|
|
|
|
ws.GetRow(dt.Rows.Count + 3).GetCell(1).SetCellValue($"{distinctPipelineCode.Count().ToString()}");
|
|
|
|
|
ws.GetRow(dt.Rows.Count + 3).GetCell(3).SetCellValue($"{dt.Rows.Count}");
|
|
|
|
|
ws.GetRow(dt.Rows.Count + 3).GetCell(6).SetCellValue($"{sumSize}");
|
|
|
|
|
ws.GetRow(dt.Rows.Count + 3).GetCell(8).SetCellValue($"{distinctWelder.Count().ToString()}");
|
|
|
|
|
ws.GetRow(dt.Rows.Count + 3).Height = 20 * 20;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ShowNotify($"发送失败,原因:{ex.Message}", MessageBoxIcon.Error);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 页脚部分
|
|
|
|
|
IFooter footer = ws.Footer;
|
|
|
|
|
string str = " CC7: 监理: Worley:";
|
|
|
|
|
str += "\n\n第 &P 页,共 &N 页";
|
|
|
|
|
footer.Center = str;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
ws.FitToPage = true;
|
|
|
|
|
ws.PrintSetup.FitWidth = 1;
|
|
|
|
|
ws.PrintSetup.FitHeight = short.MaxValue;
|
|
|
|
|
|
|
|
|
|
ws.SetMargin(MarginType.LeftMargin, (double)1.2 / 3);
|
|
|
|
|
ws.SetMargin(MarginType.RightMargin, (double)0.5 / 3);
|
|
|
|
|
ws.SetMargin(MarginType.TopMargin, (double)1.8 / 3);
|
|
|
|
|
ws.SetMargin(MarginType.BottomMargin, (double)2.9 / 3);
|
|
|
|
|
ws.PrintSetup.Landscape = true;
|
|
|
|
|
ws.ForceFormulaRecalculation = true;
|
|
|
|
|
ws.PrintSetup.PaperSize = (int)PaperSize.A4_Small;
|
|
|
|
|
ws.RepeatingRows = new NPOI.SS.Util.CellRangeAddress(0, 2, 0, 19);
|
|
|
|
|
|
|
|
|
|
using (FileStream filess = System.IO.File.OpenWrite(ReportFileName))
|
|
|
|
|
{
|
|
|
|
|
hssfworkbook.Write(filess);
|
|
|
|
|
}
|
|
|
|
|
hssfworkbook.Close();
|
|
|
|
|
|
|
|
|
|
this.GetEmailTemplateAndSendEmail(ReportFileName);
|
|
|
|
|
File.Delete(ReportFileName);
|
|
|
|
|
}
|
|
|
|
|
protected void Window1_Close(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
@ -870,19 +907,16 @@ namespace FineUIPro.Web.WeldingProcess.WeldingReport
|
|
|
|
|
private List<string> GetWeldJointIdList()
|
|
|
|
|
{
|
|
|
|
|
List<string> listIds = new List<string>();
|
|
|
|
|
for (int i = 0; i < Grid1.Rows.Count; i++)
|
|
|
|
|
int[] selections = Grid1.SelectedRowIndexArray;
|
|
|
|
|
foreach (int rowIndex in selections)
|
|
|
|
|
{
|
|
|
|
|
AspNet.HiddenField WeldJointIdVal = Grid1.Rows[i].FindControl("hidId") as AspNet.HiddenField;
|
|
|
|
|
if (WeldJointIdVal != null)
|
|
|
|
|
{
|
|
|
|
|
listIds.Add(WeldJointIdVal.Value);
|
|
|
|
|
}
|
|
|
|
|
string rowId = Grid1.DataKeys[rowIndex][0].ToString();
|
|
|
|
|
listIds.Add(rowId);
|
|
|
|
|
}
|
|
|
|
|
return listIds;
|
|
|
|
|
}
|
|
|
|
|
private void ModifyAuditStatus(int auditStatus)
|
|
|
|
|
private void ModifyAuditStatus(List<string> listIds, int auditStatus)
|
|
|
|
|
{
|
|
|
|
|
var listIds = GetWeldJointIdList();
|
|
|
|
|
var result = Funs.DB.Pipeline_WeldJoint.Where(t => listIds.Contains(t.WeldJointId)).ToList();
|
|
|
|
|
foreach (var item in result)
|
|
|
|
|
{
|
|
|
|
|