444
This commit is contained in:
commit
f3a6f6165b
|
@ -1,9 +1,13 @@
|
|||
using BLL;
|
||||
using Model;
|
||||
using Org.BouncyCastle.Bcpg.OpenPgp;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Mail;
|
||||
using System.Web;
|
||||
using System.Web.Mail;
|
||||
|
||||
namespace FineUIPro.Web.common
|
||||
{
|
||||
public class MailHelper
|
||||
|
@ -123,6 +127,15 @@ namespace FineUIPro.Web.common
|
|||
if(mailCC!=null &&mailCC.Length>0)
|
||||
mail.Cc = string.Join(",", mailCC);
|
||||
|
||||
if (!string.IsNullOrEmpty(mailAttch))
|
||||
{
|
||||
string[] arr = mailAttch.Split(',');
|
||||
for (int i = 0; i < arr.Length; i++)
|
||||
{
|
||||
|
||||
mail.Attachments.Add(new System.Web.Mail.MailAttachment(@arr[i]));
|
||||
}
|
||||
}
|
||||
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1");
|
||||
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", ps.EmailYx);
|
||||
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", ps.EmailPass);
|
||||
|
|
Binary file not shown.
|
@ -23,7 +23,7 @@
|
|||
EnableCollapse="true" runat="server" BoxFlex="1" EnableColumnLines="true"
|
||||
AllowSorting="true" SortField="PipelineCode,WeldJointCode" OnSort="Grid1_Sort"
|
||||
AllowPaging="true" IsDatabasePaging="true" PageSize="15" OnPageIndexChange="Grid1_PageIndexChange"
|
||||
EnableTextSelection="True" EnableSummary="true" SummaryPosition="Flow">
|
||||
EnableTextSelection="True" EnableCheckBoxSelect="true" EnableSummary="true" SummaryPosition="Flow">
|
||||
<Toolbars>
|
||||
<f:Toolbar ID="Toolbar1" Position="Top" runat="server" ToolbarAlign="Left">
|
||||
<Items>
|
||||
|
@ -34,11 +34,16 @@
|
|||
LabelAlign="Right" Width="180px" LabelWidth="80px">
|
||||
</f:DropDownList>
|
||||
|
||||
<f:DropDownList ID="drpUnit" runat="server" Label="施工单位" LabelAlign="Right" Width="220px" EmptyText="请选择施工单位"
|
||||
<f:DropDownList ID="drpUnit" runat="server" Label="施工单位" LabelAlign="Right" Width="240px" EmptyText="请选择施工单位"
|
||||
LabelWidth="90px">
|
||||
</f:DropDownList>
|
||||
<f:DropDownList ID="drpTeamGroup" runat="server" Label="班组" EnableCheckBoxSelect="true" EnableMultiSelect="true"
|
||||
LabelAlign="Right" Width="240px" LabelWidth="80px">
|
||||
LabelAlign="Right" Width="160px" LabelWidth="80px">
|
||||
</f:DropDownList>
|
||||
<f:DropDownList ID="drpAudit" runat="server" Label="审核状态" LabelWidth="80" Width="160" EmptyText="请选择">
|
||||
<f:ListItem Value="全部" Text="全部" />
|
||||
<f:ListItem Value="未审核" Text="未审核" />
|
||||
<f:ListItem Value="已审核" Text="已审核" />
|
||||
</f:DropDownList>
|
||||
<f:DatePicker runat="server" Label="焊接日期" ID="txtStarTime" LabelAlign="Right"
|
||||
LabelWidth="90px" Width="210px">
|
||||
|
@ -50,12 +55,22 @@
|
|||
</f:DatePicker>
|
||||
<f:ToolbarFill ID="ToolbarFill1" runat="server">
|
||||
</f:ToolbarFill>
|
||||
|
||||
</Items>
|
||||
</f:Toolbar>
|
||||
</Toolbars>
|
||||
<Toolbars>
|
||||
<f:Toolbar ID="Toolbar2" Position="Top" runat="server" ToolbarAlign="Left">
|
||||
<Items>
|
||||
<f:Button ID="BtnAnalyse" Text="<%$ Resources:Lan,Statistics %>" Icon="ChartPie"
|
||||
runat="server" OnClick="BtnAnalyse_Click">
|
||||
</f:Button>
|
||||
<f:Button ID="btnAudit" runat="server" Text="审核" ConfirmText="确定要审核这些日报吗?" ConfirmTarget="Top" OnClick="btnAudit_Click" Icon="Accept"></f:Button>
|
||||
<f:Button ID="btnCancel" runat="server" Text="取消审核" ConfirmText="确定要取消审核这些日报吗?" ConfirmTarget="Top" OnClick="btnCancel_Click" Icon="Cancel"></f:Button>
|
||||
<f:Button ID="btnOut" OnClick="btnOut_Click" runat="server" Text="<%$ Resources:Lan,Export %>"
|
||||
Icon="TableGo" EnableAjax="false" DisableControlBeforePostBack="false">
|
||||
</f:Button>
|
||||
<f:Button ID="btnSendEmail" runat="server" Text="发送日报" OnClick="btnSendEmail_Click"></f:Button>
|
||||
</Items>
|
||||
</f:Toolbar>
|
||||
</Toolbars>
|
||||
|
@ -63,9 +78,11 @@
|
|||
<f:TemplateField ColumnID="tfNumber" HeaderText="序号<br>S/N"
|
||||
Width="70px" HeaderTextAlign="Center" TextAlign="Center">
|
||||
<ItemTemplate>
|
||||
<asp:HiddenField ID="hidId" runat="server" Value='<%#Eval("WeldJointId") %>' />
|
||||
<asp:Label ID="labNumber" runat="server" Text=' <%# Grid1.PageIndex * Grid1.PageSize + Container.DataItemIndex + 1%>'></asp:Label>
|
||||
</ItemTemplate>
|
||||
</f:TemplateField>
|
||||
<f:RenderField ColumnID="AuditStatus" runat="server" DataField="AuditStatus" Width="100" TextAlign="Center" HeaderText="审核状态"></f:RenderField>
|
||||
<f:RenderField HeaderText="管线号-页码<br>LineNo.-PageNo." ColumnID="SingleNumber"
|
||||
DataField="SingleNumber" SortField="SingleNumber" FieldType="String" HeaderTextAlign="Center"
|
||||
Width="180px">
|
||||
|
@ -167,6 +184,10 @@
|
|||
</f:Grid>
|
||||
</Items>
|
||||
</f:Panel>
|
||||
<f:Window ID="Window1" Title="发送焊接日报" Hidden="true" EnableIFrame="true" EnableMaximize="true"
|
||||
Target="Top" EnableResize="true" runat="server" OnClose="Window1_Close" IsModal="true"
|
||||
Width="1200px" Height="460px">
|
||||
</f:Window>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -10,8 +10,11 @@ using System.IO;
|
|||
using System.Linq;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using BorderStyle = NPOI.SS.UserModel.BorderStyle;
|
||||
|
||||
|
||||
using System.ServiceModel.Activation;
|
||||
using AspNet = System.Web.UI.WebControls;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
|
||||
using FineUIPro.Web.common;
|
||||
using System.Web;
|
||||
|
||||
namespace FineUIPro.Web.WeldingProcess.WeldingReport
|
||||
{
|
||||
|
@ -45,7 +48,8 @@ namespace FineUIPro.Web.WeldingProcess.WeldingReport
|
|||
/// </summary>
|
||||
private DataTable GetDataTable()
|
||||
{
|
||||
string strSql = @"SELECT weldJoint.WeldJointId,weldJoint.ProjectId,ins.InstallationCode,unit.UnitName,weldJoint.PipelineId,pipeline.PipelineCode,
|
||||
string strSql = @"SELECT weldJoint.WeldJointId,weldJoint.ProjectId,ins.InstallationCode,unit.UnitName,pipeline.PipelineCode,
|
||||
(case weldJoint.AuditStatus when 1 then '已审核' else '未审核' end ) as AuditStatus,
|
||||
(CASE WHEN weldJoint.PageNum IS NOT NULL AND weldJoint.PageNum<>'' THEN pipeline.SingleNumber+'-'+weldJoint.PageNum ELSE pipeline.SingleNumber END) AS SingleNumber,
|
||||
pipeline.DrawingsNum,CONVERT(NVARCHAR(10),weldingDaily.WeldingDate,120) AS WeldingDate,rate.DetectionRateCode,weldJoint.WeldJointCode,
|
||||
CAST(ISNULL(weldJoint.Size,0) AS REAL) AS Size,(CAST(ISNULL(weldJoint.Thickness,0) AS REAL)) AS Thickness,weldJoint.Specification,
|
||||
|
@ -82,14 +86,13 @@ namespace FineUIPro.Web.WeldingProcess.WeldingReport
|
|||
{
|
||||
strSql += " AND pipeline.InstallationId = @InstallationId";
|
||||
listStr.Add(new SqlParameter("@InstallationId", this.drpInstallation.SelectedValue));
|
||||
//string[] pipeList = drpPipeLine.SelectedValueArray;
|
||||
//string pipeLineIds = string.Join(",", pipeList);
|
||||
//listStr.Add(new SqlParameter("@pipelineIds", pipeLineIds));
|
||||
}
|
||||
//else
|
||||
//{
|
||||
// listStr.Add(new SqlParameter("@pipelineIds", null));
|
||||
//}
|
||||
if (drpAudit.SelectedValue!= Const._Null && drpAudit.SelectedValue != "全部")
|
||||
{
|
||||
int status = drpAudit.SelectedValue == "已审核" ? 1 : 0;
|
||||
strSql += " AND weldJoint.AuditStatus=@AuditStatus";
|
||||
listStr.Add(new SqlParameter("@AuditStatus", status));
|
||||
}
|
||||
if (this.drpWorkAreaId.SelectedValue != Const._Null && this.drpWorkAreaId.SelectedValue != null)
|
||||
{
|
||||
strSql += " AND pipeline.WorkAreaId = @WorkAreaId";
|
||||
|
@ -124,6 +127,80 @@ namespace FineUIPro.Web.WeldingProcess.WeldingReport
|
|||
return dt;
|
||||
}
|
||||
|
||||
private DataTable GetDataTableAuditStatus()
|
||||
{
|
||||
string strSql = @"SELECT weldJoint.WeldJointId,weldJoint.ProjectId,ins.InstallationCode,unit.UnitName,pipeline.PipelineCode,
|
||||
(case weldJoint.AuditStatus when 1 then '已审核' else '未审核' end ) as AuditStatus,
|
||||
(CASE WHEN weldJoint.PageNum IS NOT NULL AND weldJoint.PageNum<>'' THEN pipeline.SingleNumber+'-'+weldJoint.PageNum ELSE pipeline.SingleNumber END) AS SingleNumber,
|
||||
pipeline.DrawingsNum,CONVERT(NVARCHAR(10),weldingDaily.WeldingDate,120) AS WeldingDate,rate.DetectionRateCode,weldJoint.WeldJointCode,
|
||||
CAST(ISNULL(weldJoint.Size,0) AS REAL) AS Size,(CAST(ISNULL(weldJoint.Thickness,0) AS REAL)) AS Thickness,weldJoint.Specification,
|
||||
weldType.WeldTypeCode,com1.ComponentsCode AS ComponentsName1,mat1.MaterialCode AS MaterialCode1,weldJoint.HeartNo1,
|
||||
com2.ComponentsCode AS ComponentsName2,mat2.MaterialCode AS MaterialCode2,weldJoint.HeartNo2, WeldMethod.WeldingMethodName,
|
||||
(CASE WHEN weldJoint.CoverWelderId!=weldJoint.BackingWelderId THEN cw.WelderCode+'/'+fw.WelderCode ELSE cw.WelderCode END) AS WelderCode ,
|
||||
(CASE WHEN weldJoint.WeldMatId IS NOT NULL AND weldJoint.WeldSilkId IS NOT NULL THEN weldJoint.WeldSilkId+'|'+ weldJoint.WeldMatId
|
||||
WHEN weldJoint.WeldMatId IS NOT NULL AND weldJoint.WeldSilkId IS NULL THEN weldJoint.WeldMatId
|
||||
WHEN weldJoint.WeldSilkId IS NOT NULL AND weldJoint.WeldMatId IS NULL THEN weldJoint.WeldSilkId
|
||||
ELSE '' END) AS WeldMaterial, wl.WeldingLocationCode,weldJoint.Remark
|
||||
FROM Pipeline_WeldJoint AS weldJoint
|
||||
LEFT JOIN Pipeline_Pipeline AS pipeline ON pipeline.PipelineId = weldJoint.PipelineId
|
||||
LEFT JOIN dbo.Project_Installation ins ON ins.InstallationId = pipeline.InstallationId
|
||||
LEFT JOIN dbo.Base_Unit unit ON unit.UnitId = pipeline.UnitId
|
||||
LEFT JOIN dbo.Base_Components com1 ON com1.ComponentsId =weldJoint.PipeAssembly1Id
|
||||
LEFT JOIN Base_Material AS mat1 ON mat1.MaterialId = weldJoint.Material1Id
|
||||
LEFT JOIN dbo.Base_WeldingLocation wl ON wl.WeldingLocationId = weldJoint.WeldingLocationId
|
||||
LEFT JOIN dbo.Base_Components com2 ON com2.ComponentsId =weldJoint.PipeAssembly2Id
|
||||
LEFT JOIN Base_Material AS mat2 ON mat2.MaterialId = weldJoint.Material2Id
|
||||
LEFT JOIN Base_WeldingMethod AS WeldMethod ON WeldMethod.WeldingMethodId = weldJoint.WeldingMethodId
|
||||
LEFT JOIN dbo.Base_WeldType weldType ON weldType.WeldTypeId = weldJoint.WeldTypeId
|
||||
LEFT JOIN Pipeline_WeldingDaily AS weldingDaily ON weldingDaily.WeldingDailyId = weldJoint.WeldingDailyId
|
||||
left join Welder_Welder AS fw on weldJoint.BackingWelderId = fw.WelderId
|
||||
left join Welder_Welder AS cw on weldJoint.CoverWelderId = cw.WelderId
|
||||
LEFT JOIN dbo.Base_DetectionRate rate ON rate.DetectionRateId = pipeline.DetectionRateId
|
||||
LEFT JOIN dbo.Welder_ProjectWelder pcw ON pcw.WelderId = weldJoint.CoverWelderId AND pcw.ProjectId=weldJoint.ProjectId
|
||||
LEFT JOIN dbo.Welder_ProjectWelder pfw ON pfw.WelderId = weldJoint.BackingWelderId AND pfw.ProjectId=weldJoint.ProjectId
|
||||
WHERE weldJoint.WeldingDailyId IS NOT NULL AND weldJoint.ProjectId=@projectId AND weldJoint.AuditStatus=1 ";
|
||||
|
||||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||||
listStr.Add(new SqlParameter("@projectId", this.CurrUser.LoginProjectId));
|
||||
|
||||
if (drpInstallation.SelectedValue != Const._Null)
|
||||
{
|
||||
strSql += " AND pipeline.InstallationId = @InstallationId";
|
||||
listStr.Add(new SqlParameter("@InstallationId", this.drpInstallation.SelectedValue));
|
||||
}
|
||||
if (this.drpWorkAreaId.SelectedValue != Const._Null && this.drpWorkAreaId.SelectedValue != null)
|
||||
{
|
||||
strSql += " AND pipeline.WorkAreaId = @WorkAreaId";
|
||||
listStr.Add(new SqlParameter("@WorkAreaId", drpWorkAreaId.SelectedValue));
|
||||
}
|
||||
if (this.drpUnit.SelectedValue != Const._Null)
|
||||
{
|
||||
strSql += " AND pipeline.UnitId = @UnitId";
|
||||
listStr.Add(new SqlParameter("@UnitId", drpUnit.SelectedValue));
|
||||
}
|
||||
if (this.drpTeamGroup.SelectedValueArray.Length > 0)
|
||||
{
|
||||
string[] teamGroupList = drpTeamGroup.SelectedValueArray;
|
||||
string teamGroups = string.Join(",", teamGroupList);
|
||||
strSql += " AND (CHARINDEX(pcw.TeamGroupId,@TeamGroupId)>0 OR CHARINDEX(pfw.TeamGroupId,@TeamGroupId)>0) ";
|
||||
listStr.Add(new SqlParameter("@TeamGroupId", teamGroups));
|
||||
}
|
||||
if (txtStarTime.Text != "")
|
||||
{
|
||||
strSql += " AND weldingDaily.WeldingDate> = @WeldingStartDate";
|
||||
listStr.Add(new SqlParameter("@WeldingStartDate", txtStarTime.Text.Trim()));
|
||||
}
|
||||
if (txtEndTime.Text != "")
|
||||
{
|
||||
strSql += " AND weldingDaily.WeldingDate< = @WeldingEndDate";
|
||||
listStr.Add(new SqlParameter("@WeldingEndDate", txtEndTime.Text.Trim()));
|
||||
}
|
||||
|
||||
strSql += " ORDER BY pipeline.PipelineCode,WeldJointCode";
|
||||
SqlParameter[] parameter = listStr.ToArray();
|
||||
DataTable dt = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||||
return dt;
|
||||
}
|
||||
/// <summary>
|
||||
/// 绑定数据
|
||||
/// </summary>
|
||||
|
@ -173,6 +250,230 @@ namespace FineUIPro.Web.WeldingProcess.WeldingReport
|
|||
}
|
||||
}
|
||||
|
||||
//获取焊口ID集合
|
||||
|
||||
|
||||
//审核
|
||||
protected void btnAudit_Click(object sender,EventArgs e)
|
||||
{
|
||||
ModifyAuditStatus(1);
|
||||
this.BindGrid();
|
||||
|
||||
ShowNotify("批量审核成功!", MessageBoxIcon.Success);
|
||||
}
|
||||
//取消审核
|
||||
protected void btnCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
ModifyAuditStatus(0);
|
||||
this.BindGrid();
|
||||
ShowNotify("批量取消审核成功!", MessageBoxIcon.Success);
|
||||
}
|
||||
//发送邮件
|
||||
protected void btnSendEmail_Click(object sender,EventArgs e)
|
||||
{
|
||||
DataTable dt = GetDataTableAuditStatus();
|
||||
if (dt.Rows.Count == 0)
|
||||
{
|
||||
ShowNotify("暂无已审核的数据!",MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
string rootPath = Server.MapPath("~/") + Const.ExcelUrl;
|
||||
//模板文件
|
||||
string TempletFileName = rootPath + "WeldDailyExport.xlsx";
|
||||
//导出文件
|
||||
string filePath = rootPath + DateTime.Now.ToString("yyyyMMddhhmmss") + "\\";
|
||||
if (!Directory.Exists(filePath))
|
||||
{
|
||||
Directory.CreateDirectory(filePath);
|
||||
}
|
||||
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++)
|
||||
{
|
||||
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);
|
||||
}
|
||||
protected void Window1_Close(object sender, EventArgs e)
|
||||
{
|
||||
this.BindGrid();
|
||||
}
|
||||
/// <summary>
|
||||
/// 改变索引事件
|
||||
/// </summary>
|
||||
|
@ -564,6 +865,31 @@ namespace FineUIPro.Web.WeldingProcess.WeldingReport
|
|||
|
||||
#endregion
|
||||
|
||||
#region 私有方法
|
||||
|
||||
private List<string> GetWeldJointIdList()
|
||||
{
|
||||
List<string> listIds = new List<string>();
|
||||
for (int i = 0; i < Grid1.Rows.Count; i++)
|
||||
{
|
||||
AspNet.HiddenField WeldJointIdVal = Grid1.Rows[i].FindControl("hidId") as AspNet.HiddenField;
|
||||
if (WeldJointIdVal != null)
|
||||
{
|
||||
listIds.Add(WeldJointIdVal.Value);
|
||||
}
|
||||
}
|
||||
return listIds;
|
||||
}
|
||||
private void ModifyAuditStatus(int auditStatus)
|
||||
{
|
||||
var listIds = GetWeldJointIdList();
|
||||
var result = Funs.DB.Pipeline_WeldJoint.Where(t => listIds.Contains(t.WeldJointId)).ToList();
|
||||
foreach (var item in result)
|
||||
{
|
||||
item.AuditStatus = auditStatus;
|
||||
}
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
public static DataTable GetPageToTable(DataTable dt, int StartNum, int EndNum)
|
||||
{
|
||||
//0页代表每页数据,直接返回
|
||||
|
@ -627,5 +953,40 @@ namespace FineUIPro.Web.WeldingProcess.WeldingReport
|
|||
|
||||
return style;
|
||||
}
|
||||
#region 获取发送邮件的模版
|
||||
private void GetEmailTemplateAndSendEmail(string fileList)
|
||||
{
|
||||
var pop = MailHelper.getEmailPop();
|
||||
if (pop == null)
|
||||
{
|
||||
BLL.ErrLogInfo.WriteLog($"未配置邮件服务器");
|
||||
return;
|
||||
}
|
||||
string templateContent = string.Empty;
|
||||
string mailSubject = string.Empty;
|
||||
|
||||
var emailTemplate = BLL.Email_Send.Email_SendTemplateService.GetEmailNotifier("焊接日报");
|
||||
if (emailTemplate == null)
|
||||
{
|
||||
BLL.ErrLogInfo.WriteLog($"不存在此邮件模版");
|
||||
return;
|
||||
}
|
||||
List<string> emailSend = new List<string>(); //发送人
|
||||
List<string> emailCC = new List<string>(); //抄送给
|
||||
emailSend = BLL.Email_Send.Email_SendTemplateService.GetEmailByTemplateId(emailTemplate.EmailId, "0");
|
||||
emailCC = BLL.Email_Send.Email_SendTemplateService.GetEmailByTemplateId(emailTemplate.EmailId, "1");
|
||||
if (emailSend.Count == 0)
|
||||
{
|
||||
BLL.ErrLogInfo.WriteLog($"未检测到发送人邮箱,请先配置邮箱地址");
|
||||
return;
|
||||
}
|
||||
mailSubject = $"焊接日报—{emailTemplate.EailTiaoJian}"; //发送主题
|
||||
templateContent = emailTemplate.EmailContext;
|
||||
string resultMessage = "";
|
||||
MailHelper.SendNetMail(pop, pop.EmailYx, emailSend.ToArray(), mailSubject, templateContent, fileList, string.Empty, string.Empty, emailCC.ToArray(), out resultMessage);
|
||||
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -95,6 +95,15 @@ namespace FineUIPro.Web.WeldingProcess.WeldingReport
|
|||
/// </remarks>
|
||||
protected global::FineUIPro.DropDownList drpTeamGroup;
|
||||
|
||||
/// <summary>
|
||||
/// drpAudit 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DropDownList drpAudit;
|
||||
|
||||
/// <summary>
|
||||
/// txtStarTime 控件。
|
||||
/// </summary>
|
||||
|
@ -131,6 +140,15 @@ namespace FineUIPro.Web.WeldingProcess.WeldingReport
|
|||
/// </remarks>
|
||||
protected global::FineUIPro.ToolbarFill ToolbarFill1;
|
||||
|
||||
/// <summary>
|
||||
/// Toolbar2 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Toolbar Toolbar2;
|
||||
|
||||
/// <summary>
|
||||
/// BtnAnalyse 控件。
|
||||
/// </summary>
|
||||
|
@ -140,6 +158,24 @@ namespace FineUIPro.Web.WeldingProcess.WeldingReport
|
|||
/// </remarks>
|
||||
protected global::FineUIPro.Button BtnAnalyse;
|
||||
|
||||
/// <summary>
|
||||
/// btnAudit 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnAudit;
|
||||
|
||||
/// <summary>
|
||||
/// btnCancel 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnCancel;
|
||||
|
||||
/// <summary>
|
||||
/// btnOut 控件。
|
||||
/// </summary>
|
||||
|
@ -149,6 +185,24 @@ namespace FineUIPro.Web.WeldingProcess.WeldingReport
|
|||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnOut;
|
||||
|
||||
/// <summary>
|
||||
/// btnSendEmail 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnSendEmail;
|
||||
|
||||
/// <summary>
|
||||
/// hidId 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.HiddenField hidId;
|
||||
|
||||
/// <summary>
|
||||
/// labNumber 控件。
|
||||
/// </summary>
|
||||
|
@ -193,5 +247,14 @@ namespace FineUIPro.Web.WeldingProcess.WeldingReport
|
|||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DropDownList ddlPageSize;
|
||||
|
||||
/// <summary>
|
||||
/// Window1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Window Window1;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue