diff --git a/SGGL/FineUIPro.Web/HJGL/InfoQuery/JointQuery.aspx b/SGGL/FineUIPro.Web/HJGL/InfoQuery/JointQuery.aspx index 28398273..f30af990 100644 --- a/SGGL/FineUIPro.Web/HJGL/InfoQuery/JointQuery.aspx +++ b/SGGL/FineUIPro.Web/HJGL/InfoQuery/JointQuery.aspx @@ -188,16 +188,16 @@ - - - View_HJGL_WeldJoint = new List(); + protected void Page_Load(object sender, EventArgs e) { ctlAuditFlow.Url = BLL.Project_SysSetService.GetAvevaNetUrl(this.CurrUser.LoginProjectId); @@ -293,9 +295,10 @@ namespace FineUIPro.Web.HJGL.InfoQuery else if (this.tvControlItem.SelectedNode.CommandName == "管线") { } - model.PipelineId= this.tvControlItem.SelectedNodeID; + model.PipelineId= this.tvControlItem.SelectedNodeID; model.WeldJointCode = this.txtWeldJointCode.Text; var list= BLL.WeldJointService.GetViewWeldJointsBymodel(model); + View_HJGL_WeldJoint = list; Grid1.RecordCount = list.Count; // var table = this.GetPagedDataTable(Grid1, list); var table = list.Skip(Grid1.PageSize * (Grid1.PageIndex)).Take(Grid1.PageSize).ToList(); @@ -473,28 +476,68 @@ namespace FineUIPro.Web.HJGL.InfoQuery /// protected void btnOut_Click(object sender, EventArgs e) { - //Model.View_HJGL_WeldJoint model = new Model.View_HJGL_WeldJoint(); - //model.ProjectId = this.CurrUser.LoginProjectId; - //if (this.tvControlItem.SelectedNode.CommandName.Split('|').Count() == 2) - //{ - // model.UnitWorkId = this.tvControlItem.SelectedNodeID; + if (this.tvControlItem.SelectedNode.CommandName.Split('|').Count() == 2) + { + Model.View_HJGL_WeldJoint model = new Model.View_HJGL_WeldJoint(); + model.ProjectId = this.CurrUser.LoginProjectId; + model.UnitWorkId = this.tvControlItem.SelectedNodeID; + var list = BLL.WeldJointService.GetViewWeldJointsBymodel(model); + View_HJGL_WeldJoint = list; + } + + string path = Funs.RootPath + @"File\Excel\Temp\JointQuery.xlsx"; + path = path.Replace(".xlsx", string.Format("{0:yyyy-MM-dd-HH-mm}", DateTime.Now) + ".xlsx"); + var q = (from x in View_HJGL_WeldJoint + select new + { + 焊口号 = x.WeldJointCode, + 单位名称 = x.UnitName, + 材质1 = x.Material1Code, + 材质2 = x.Material2Code, + 达因 = x.Size, + 外径 = x.Dia, + 壁厚 = x.Thickness, + 规格 = x.Specification, + 焊缝类型 = x.WeldTypeCode, + 焊接方法 = x.WeldingMethodCode, + WPS编号 = x.WPQCode, + 坡口类型 = x.GrooveTypeCode, + 焊条 = x.WeldingRod, + 焊丝 = x.WeldingWire, + 预热温度 = x.PreTemperature, + 焊口属性 = x.JointAttribute, + 焊接日期 = x.WeldingDate, + 打底焊工号 = x.BackingWelderCode, + 盖面焊工号 = x.WelderCode, + 热处理报告编号 = x.HotProessReportNo, + 热处理检测结果 = x.HotProessResult, + 硬度报告编号 = x.HardReportNo, + 硬度检测结果 = x.HardResult, + 委托单编号 = x.TrustBatchCode, + 检测单编号 = x.NDECode, - //} - //else if (this.tvControlItem.SelectedNode.CommandName == "管线") - //{ - // model.PipelineId = this.tvControlItem.SelectedNodeID; - //} - //model.WeldJointCode = this.txtWeldJointCode.Text; - //var list = BLL.WeldJointService.GetViewWeldJointsBymodel(model); + }).ToList(); + MiniExcel.SaveAs(path, q); + string fileName = "焊口信息总览.xlsx"; + FileInfo info = new FileInfo(path); + long fileSize = info.Length; + System.Web.HttpContext.Current.Response.Clear(); + System.Web.HttpContext.Current.Response.ContentType = "application/x-zip-compressed"; + System.Web.HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8)); + System.Web.HttpContext.Current.Response.AddHeader("Content-Length", fileSize.ToString()); + System.Web.HttpContext.Current.Response.TransmitFile(path, 0, fileSize); + System.Web.HttpContext.Current.Response.Flush(); + System.Web.HttpContext.Current.Response.Close(); + File.Delete(path); - Response.ClearContent(); - string filename = Funs.GetNewFileName(); - Response.AddHeader("content-disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode("焊口台账总览" + filename, System.Text.Encoding.UTF8) + ".xls"); - Response.ContentType = "application/excel"; - Response.ContentEncoding = System.Text.Encoding.UTF8; - Response.Write(GetGridTableHtml(Grid1)); - Response.End(); + //Response.ClearContent(); + //string filename = Funs.GetNewFileName(); + //Response.AddHeader("content-disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode("焊口台账总览" + filename, System.Text.Encoding.UTF8) + ".xls"); + //Response.ContentType = "application/excel"; + //Response.ContentEncoding = System.Text.Encoding.UTF8; + //Response.Write(GetGridTableHtml(Grid1)); + //Response.End(); } protected void btnOutNOComPipeline_Click(object sender, EventArgs e) {