678 lines
28 KiB
C#
678 lines
28 KiB
C#
using BLL;
|
|
using FineUIPro.Web.HJGL.WeldingManage;
|
|
using MiniExcelLibs;
|
|
using Model;
|
|
using Newtonsoft.Json.Linq;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Data.SqlClient;
|
|
using System.Drawing;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using AspNet = System.Web.UI.WebControls;
|
|
|
|
namespace FineUIPro.Web.HJGL.InfoQuery
|
|
{
|
|
public partial class JointQuery : PageBase
|
|
{
|
|
public int pageSize = 20;
|
|
public decimal JointComplete
|
|
{
|
|
get
|
|
{
|
|
return (decimal)ViewState["JointComplete"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["JointComplete"] = value;
|
|
}
|
|
}
|
|
public decimal JointNoComplete
|
|
{
|
|
get
|
|
{
|
|
return (decimal)ViewState["JointNoComplete"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["JointNoComplete"] = value;
|
|
}
|
|
}
|
|
public int JointPre
|
|
{
|
|
get
|
|
{
|
|
return (int)ViewState["JointPre"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["JointPre"] = value;
|
|
}
|
|
}
|
|
public int JointNoPre
|
|
{
|
|
get
|
|
{
|
|
return (int)ViewState["JointNoPre"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["JointNoPre"] = value;
|
|
}
|
|
}
|
|
public string Completed_weldedjunction
|
|
{
|
|
get
|
|
{
|
|
return (string)ViewState["Completed_weldedjunction"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["Completed_weldedjunction"] = value;
|
|
}
|
|
}
|
|
public string Incomplete_weldjunction
|
|
{
|
|
get
|
|
{
|
|
return (string)ViewState["Incomplete_weldjunction"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["Incomplete_weldjunction"] = value;
|
|
}
|
|
}
|
|
public static List<Model.View_HJGL_WeldJoint> View_HJGL_WeldJoint = new List<Model.View_HJGL_WeldJoint>();
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
ctlAuditFlow.Url = BLL.Project_SysSetService.GetAvevaNetUrl(this.CurrUser.LoginProjectId);
|
|
if (!IsPostBack)
|
|
{
|
|
this.ddlPageSize.SelectedValue = this.Grid1.PageSize.ToString();
|
|
this.InitTreeMenu();//加载树
|
|
this.JointComplete = 0;
|
|
this.JointNoComplete =0;
|
|
this.JointPre =0;
|
|
this.JointNoPre = 0;
|
|
|
|
}
|
|
}
|
|
#region 加载树装置-单位-工作区
|
|
/// <summary>
|
|
/// 加载树
|
|
/// </summary>
|
|
private void InitTreeMenu()
|
|
{
|
|
this.tvControlItem.Nodes.Clear();
|
|
|
|
TreeNode rootNode1 = new TreeNode();
|
|
rootNode1.NodeID = "1";
|
|
rootNode1.Text = "建筑工程";
|
|
rootNode1.CommandName = "建筑工程";
|
|
rootNode1.Selectable = false;
|
|
this.tvControlItem.Nodes.Add(rootNode1);
|
|
|
|
TreeNode rootNode2 = new TreeNode();
|
|
rootNode2.NodeID = "2";
|
|
rootNode2.Text = "安装工程";
|
|
rootNode2.CommandName = "安装工程";
|
|
rootNode2.Expanded = true;
|
|
this.tvControlItem.Nodes.Add(rootNode2);
|
|
|
|
var pUnits = (from x in Funs.DB.Project_ProjectUnit where x.ProjectId == this.CurrUser.LoginProjectId select x).ToList();
|
|
// 获取当前用户所在单位
|
|
var currUnit = pUnits.FirstOrDefault(x => x.UnitId == this.CurrUser.UnitId);
|
|
|
|
var unitWorkList = (from x in Funs.DB.WBS_UnitWork
|
|
where x.ProjectId == this.CurrUser.LoginProjectId
|
|
&& x.SuperUnitWork == null && x.UnitId != null && x.ProjectType != null
|
|
select x).ToList();
|
|
|
|
List<Model.WBS_UnitWork> unitWork1 = null;
|
|
List<Model.WBS_UnitWork> unitWork2 = null;
|
|
|
|
//// 当前为施工单位,只能操作本单位的数据
|
|
//if (currUnit != null && currUnit.UnitType == Const.ProjectUnitType_2)
|
|
//{
|
|
// unitWork1 = (from x in unitWorkList
|
|
// where x.UnitId == this.CurrUser.UnitId && x.ProjectType == "1"
|
|
// select x).ToList();
|
|
// unitWork2 = (from x in unitWorkList
|
|
// where x.UnitId == this.CurrUser.UnitId && x.ProjectType == "2"
|
|
// select x).ToList();
|
|
//}
|
|
//else
|
|
//{
|
|
unitWork1 = (from x in unitWorkList where x.ProjectType == "1" select x).ToList();
|
|
unitWork2 = (from x in unitWorkList where x.ProjectType == "2" select x).ToList();
|
|
//}
|
|
if (unitWork1.Count() > 0)
|
|
{
|
|
foreach (var q in unitWork1)
|
|
{
|
|
int a = (from x in Funs.DB.HJGL_Pipeline where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == q.UnitWorkId select x).Count();
|
|
var unitNamesUnitIds = BLL.UnitService.getUnitNamesUnitIds(q.UnitId);
|
|
TreeNode tn1 = new TreeNode();
|
|
tn1.NodeID = q.UnitWorkId;
|
|
tn1.Text = q.UnitWorkName + "【" + a.ToString() + "】" + "管线";
|
|
tn1.ToolTip = "施工单位:" + unitNamesUnitIds;
|
|
tn1.CommandName = 1 + "|" + Funs.GetEndPageNumber(a, pageSize);
|
|
tn1.EnableClickEvent = true;
|
|
tn1.EnableExpandEvent = true;
|
|
rootNode1.Nodes.Add(tn1);
|
|
if (a > 0)
|
|
{
|
|
// BindNodes(tn1);
|
|
TreeNode newNode = new TreeNode();
|
|
newNode.Text = "加载管线...";
|
|
newNode.NodeID = "加载管线...";
|
|
tn1.Nodes.Add(newNode);
|
|
}
|
|
//if (a > 0)
|
|
//{
|
|
// BindNodes(tn1);
|
|
//}
|
|
}
|
|
}
|
|
if (unitWork2.Count() > 0)
|
|
{
|
|
foreach (var q in unitWork2)
|
|
{
|
|
int a = (from x in Funs.DB.HJGL_Pipeline
|
|
where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == q.UnitWorkId
|
|
&& x.PipelineCode.Contains(this.tvPipeCode.Text.Trim())
|
|
|
|
select x).Count();
|
|
var unitNamesUnitIds = BLL.UnitService.getUnitNamesUnitIds(q.UnitId);
|
|
TreeNode tn2 = new TreeNode();
|
|
tn2.NodeID = q.UnitWorkId;
|
|
tn2.Text = q.UnitWorkName + "【" + a.ToString() + "】" + "管线";
|
|
if (q.UnitWorkId == this.hdUnitWorkId.Text)
|
|
{
|
|
tn2.Expanded = true;
|
|
}
|
|
tn2.ToolTip = "施工单位:" + unitNamesUnitIds;
|
|
tn2.CommandName = 1 + "|" + Funs.GetEndPageNumber(a, pageSize);
|
|
tn2.EnableClickEvent = true;
|
|
tn2.EnableExpandEvent = true;
|
|
rootNode2.Nodes.Add(tn2);
|
|
if (a > 0)
|
|
{
|
|
// BindNodes(tn2);
|
|
TreeNode newNode = new TreeNode();
|
|
newNode.Text = "加载管线...";
|
|
newNode.NodeID = "加载管线...";
|
|
tn2.Nodes.Add(newNode);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 点击TreeView
|
|
/// <summary>
|
|
/// 点击TreeView
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void tvControlItem_NodeCommand(object sender, TreeCommandEventArgs e)
|
|
{
|
|
if (e.CommandName == "加载")
|
|
{
|
|
string CommandName = e.Node.ParentNode.CommandName;
|
|
e.Node.ParentNode.CommandName = (int.Parse(CommandName.Split('|')[0]) + 1) + "|" + int.Parse(CommandName.Split('|')[1]);
|
|
TreeNode treeNode = e.Node.ParentNode;
|
|
treeNode.Nodes.Remove(e.Node);
|
|
BindNodes(e.Node.ParentNode);
|
|
}
|
|
else
|
|
{
|
|
this.BindGrid();
|
|
|
|
}
|
|
|
|
|
|
}
|
|
protected void tvControlItem_TreeNodeExpanded(object sender, TreeNodeEventArgs e)
|
|
{
|
|
|
|
if (e.Node.Nodes[0].NodeID == "加载管线...")
|
|
{
|
|
e.Node.Nodes.Clear();
|
|
BindNodes(e.Node);
|
|
}
|
|
}
|
|
private void BindNodes(TreeNode node)
|
|
{
|
|
var pipeline = (from x in Funs.DB.HJGL_Pipeline
|
|
where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == node.NodeID
|
|
&& x.PipelineCode.Contains(this.tvPipeCode.Text.Trim())
|
|
orderby x.PipelineCode
|
|
select x).ToList();
|
|
var hJGL_WeldJoints = (from x in Funs.DB.HJGL_WeldJoint where x.ProjectId == this.CurrUser.LoginProjectId select x).ToList();
|
|
int pageindex = int.Parse(node.CommandName.Split('|')[0]);
|
|
int pageCount = int.Parse(node.CommandName.Split('|')[1]);
|
|
if (pageindex <= pageCount)
|
|
{
|
|
pipeline = pipeline.Skip(pageSize * (pageindex - 1)).Take(pageSize).ToList();
|
|
foreach (var item in pipeline)
|
|
{
|
|
var jotCount = (from x in hJGL_WeldJoints where x.PipelineId == item.PipelineId /*&& x.IsTwoJoint == null*/ select x).Count();
|
|
TreeNode newNode = new TreeNode();
|
|
newNode.Text = item.PipelineCode + "【" + jotCount.ToString() + " " + "焊口" + "】";
|
|
newNode.NodeID = item.PipelineId;
|
|
newNode.CommandName = "管线";
|
|
newNode.EnableClickEvent = true;
|
|
node.Nodes.Add(newNode);
|
|
}
|
|
if (pageindex < pageCount)
|
|
{
|
|
TreeNode newNode = new TreeNode();
|
|
newNode.Text = "加载";
|
|
newNode.NodeID = SQLHelper.GetNewID();
|
|
newNode.CommandName = "加载";
|
|
newNode.Icon = Icon.ArrowDown;
|
|
newNode.EnableClickEvent = true;
|
|
node.Nodes.Add(newNode);
|
|
}
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
private void BindGrid()
|
|
{
|
|
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;
|
|
|
|
}
|
|
else if (this.tvControlItem.SelectedNode.CommandName == "管线")
|
|
{
|
|
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();
|
|
Grid1.DataSource = table;
|
|
Grid1.DataBind();
|
|
|
|
}
|
|
|
|
private void get3DParmeter_weldjoint(List<View_HJGL_WeldJoint> model)
|
|
{
|
|
if (model.Any())
|
|
{
|
|
var q = model.Where(x => !string.IsNullOrEmpty(x.WeldingDate));//获取已完成焊口
|
|
if (q.Any())
|
|
{
|
|
List<string> Completed_weldedjunctionList = new List<string>();
|
|
|
|
foreach (var item in q)
|
|
{
|
|
Completed_weldedjunctionList.Add("/" + item.WeldJointCode);
|
|
}
|
|
Completed_weldedjunction = string.Join(",", Completed_weldedjunctionList);
|
|
}
|
|
|
|
var q1 = model.Where(x => string.IsNullOrEmpty(x.WeldingDate));//获取未完成管线
|
|
if (q1.Any())
|
|
{
|
|
List<string> Incomplete_weldjunctionList = new List<string>();
|
|
foreach (var item in q1)
|
|
{
|
|
Incomplete_weldjunctionList.Add("/" + item.WeldJointCode);
|
|
}
|
|
Incomplete_weldjunction = string.Join(",", Incomplete_weldjunctionList);
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#region
|
|
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
|
|
{
|
|
BindGrid();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 分页下拉选择事件
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
|
|
BindGrid();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 排序
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Grid1_Sort(object sender, FineUIPro.GridSortEventArgs e)
|
|
{
|
|
this.BindGrid();
|
|
}
|
|
#endregion
|
|
|
|
#region 统计按钮事件
|
|
/// <summary>
|
|
/// 统计
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void BtnAnalyse_Click(object sender, EventArgs e)
|
|
{
|
|
BindGrid();
|
|
}
|
|
/// <summary>
|
|
/// 树查询
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnTreeFind_Click(object sender, EventArgs e)
|
|
{
|
|
this.InitTreeMenu();
|
|
//this.BindGrid3(this.tvControlItem.SelectedNodeID);
|
|
}
|
|
protected void btnrefresh_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;
|
|
|
|
}
|
|
else if (this.tvControlItem.SelectedNode.CommandName == "管线")
|
|
{
|
|
model.PipelineId = this.tvControlItem.SelectedNodeID;
|
|
}
|
|
model.WeldJointCode = this.txtWeldJointCode.Text;
|
|
var list = BLL.WeldJointService.GetViewWeldJointsBymodel(model);
|
|
if (!string.IsNullOrEmpty(ctlAuditFlow.Url))
|
|
{
|
|
get3DParmeter_weldjoint(list);//获取三维所需焊口参数
|
|
var q = list.Where(x => !string.IsNullOrEmpty(x.WeldingDate));
|
|
var q2 = list.Where(x => x.JointAttribute == "预制口");
|
|
var sumcount = list.Count;
|
|
this.Grid1.RecordCount = list.Count;
|
|
|
|
this.JointComplete = q.Count();
|
|
this.JointNoComplete = sumcount - JointComplete;
|
|
this.JointPre = q2.Count();
|
|
this.JointNoPre = sumcount - JointPre;
|
|
}
|
|
Model.Parameter3D parameter3D = new Model.Parameter3D();
|
|
Model.ColorModel colorModel = new Model.ColorModel();
|
|
colorModel = BLL.Project_SysSetService.GetColorModel(this.CurrUser.LoginProjectId);
|
|
parameter3D.ColorModel = colorModel;
|
|
parameter3D.TagNum = "";
|
|
parameter3D.ButtonType = "2.1";
|
|
parameter3D.ModelName = HJGL_DataImportService.Getlatest3DModelNameByUnitWorkId(tvControlItem.SelectedNodeID);
|
|
|
|
if (this.tvControlItem.SelectedNode.CommandName.Split('|').Count() == 2)
|
|
{
|
|
parameter3D.ModelName = HJGL_DataImportService.Getlatest3DModelNameByUnitWorkId(tvControlItem.SelectedNodeID);
|
|
parameter3D.Crater_data = "0";
|
|
parameter3D.Completed_weldedjunction = Completed_weldedjunction;
|
|
parameter3D.Incomplete_weldjunction = Incomplete_weldjunction;
|
|
|
|
}
|
|
else if (this.tvControlItem.SelectedNode.CommandName == "管线")
|
|
{
|
|
var modelpipeline = PipelineService.GetPipelineByPipelineId(tvControlItem.SelectedNodeID);
|
|
if (modelpipeline != null && !string.IsNullOrEmpty(modelpipeline.UnitWorkId))
|
|
{
|
|
parameter3D.Crater_data = "1";
|
|
parameter3D.TagNum = "/" + modelpipeline.PipelineCode;
|
|
parameter3D.ModelName = HJGL_DataImportService.Getlatest3DModelNameByUnitWorkId(modelpipeline.UnitWorkId);
|
|
|
|
}
|
|
|
|
}
|
|
parameter3D.Transparency = colorModel.PipelineComplete;
|
|
parameter3D.Finished_color = colorModel.JointCompleteColor;
|
|
parameter3D.Incomplete_color = colorModel.JointNOCompleteColor;
|
|
|
|
ctlAuditFlow.Url_item = BLL.Project_SysSetService.GetAvevaNetUrl_Item(this.CurrUser.LoginProjectId) + parameter3D.ModelName;
|
|
ctlAuditFlow.data = parameter3D;
|
|
ctlAuditFlow.BindData();
|
|
|
|
}
|
|
/// <summary>
|
|
/// 查询
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Tree_TextChanged(object sender, EventArgs e)
|
|
{
|
|
this.InitTreeMenu();
|
|
this.BindGrid();
|
|
}
|
|
protected void btnGetChart_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("JointQueryChart.aspx?JointComplete={0}&&JointNoComplete={1}&&JointPre={2}&&JointNoPre={3}", JointComplete, JointNoComplete, JointPre, JointNoPre, "编辑 - ")));
|
|
|
|
}
|
|
#endregion
|
|
|
|
#region 导出按钮
|
|
/// 导出按钮
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnOut_Click(object sender, EventArgs e)
|
|
{
|
|
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,
|
|
|
|
}).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();
|
|
}
|
|
protected void btnOutNOComPipeline_Click(object sender, EventArgs e)
|
|
{
|
|
if (this.tvControlItem.SelectedNode.CommandName.Split('|').Count() == 2)
|
|
{
|
|
var q = (from x in Funs.DB.View_HJGL_WeldJoint where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == this.tvControlItem.SelectedNodeID
|
|
select new {
|
|
PipelineId=x.PipelineId,
|
|
WeldingDate=x.WeldingDate,
|
|
WeldJointCode=x.WeldJointCode,
|
|
PipelineCode=x.PipelineCode,
|
|
Size=x.Size,
|
|
});
|
|
var noCompipeline = from x in q
|
|
group x by x.PipelineId into g
|
|
select new
|
|
{
|
|
PipelineId = g.Key,
|
|
Count = (from x2 in g where x2.WeldingDate!=null && x2.WeldingDate!="" select x2).Count(),
|
|
};
|
|
var Noweldjoint =( from x in q
|
|
join y in noCompipeline on x.PipelineId equals y.PipelineId
|
|
where y.Count == 0
|
|
select new { 焊口号=x.WeldJointCode ,
|
|
管线号=x.PipelineCode,
|
|
达因=x.Size}).ToList();
|
|
|
|
string path = Funs.RootPath + @"File\Excel\Temp\NoCompleteWeldjoint.xlsx";
|
|
path = path.Replace(".xlsx", string.Format("{0:yyyy-MM-dd-HH-mm}", DateTime.Now) + ".xlsx");
|
|
|
|
MiniExcel.SaveAs(path, Noweldjoint);
|
|
|
|
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);
|
|
}
|
|
else
|
|
{
|
|
Alert.Show("请选择主项");
|
|
}
|
|
|
|
}
|
|
/// <summary>
|
|
/// 导出方法
|
|
/// </summary>
|
|
/// <param name="grid"></param>
|
|
/// <returns></returns>
|
|
private string GetGridTableHtml(Grid grid)
|
|
{
|
|
StringBuilder sb = new StringBuilder();
|
|
grid.PageSize = 100000;
|
|
BindGrid();
|
|
sb.Append("<meta http-equiv=\"content-type\" content=\"application/excel; charset=UTF-8\"/>");
|
|
sb.Append("<table cellspacing=\"0\" rules=\"all\" border=\"1\" style=\"border-collapse:collapse;\">");
|
|
sb.Append("<tr>");
|
|
foreach (GridColumn column in grid.Columns)
|
|
{
|
|
sb.AppendFormat("<td>{0}</td>", column.HeaderText);
|
|
}
|
|
sb.Append("</tr>");
|
|
foreach (GridRow row in grid.Rows)
|
|
{
|
|
sb.Append("<tr>");
|
|
foreach (GridColumn column in grid.Columns)
|
|
{
|
|
string html = row.Values[column.ColumnIndex].ToString();
|
|
if (column.ColumnID == "tfNumber")
|
|
{
|
|
html = (row.FindControl("labNumber") as AspNet.Label).Text;
|
|
}
|
|
|
|
sb.AppendFormat("<td>{0}</td>", html);
|
|
}
|
|
|
|
sb.Append("</tr>");
|
|
}
|
|
|
|
sb.Append("</table>");
|
|
|
|
return sb.ToString();
|
|
}
|
|
#endregion
|
|
|
|
protected void Grid1_RowClick(object sender, GridRowClickEventArgs e)
|
|
{
|
|
var Id = Grid1.SelectedRowIDArray;
|
|
List<string> weldjointcodes = new List<string>();
|
|
foreach (var item in Id)
|
|
{
|
|
var WeldJointCode = WeldJointService.GetViewWeldJointById(item).WeldJointCode;
|
|
weldjointcodes.Add("/" + WeldJointCode);
|
|
}
|
|
|
|
//var q = WeldJointService.GetViewWeldJointById(Grid1.SelectedRowID).PipelineCode;
|
|
//var pipecode = "/" + q;
|
|
Model.Parameter3D parameter3D = new Model.Parameter3D();
|
|
Model.ColorModel colorModel = new Model.ColorModel();
|
|
colorModel = BLL.Project_SysSetService.GetColorModel(this.CurrUser.LoginProjectId);
|
|
parameter3D.ColorModel = colorModel;
|
|
parameter3D.TagNum = string.Join(",", weldjointcodes);
|
|
parameter3D.ButtonType = "2.1";
|
|
parameter3D.Crater_data = "1";
|
|
if (this.tvControlItem.SelectedNode.CommandName.Split('|').Count() == 2)
|
|
{
|
|
parameter3D.ModelName = HJGL_DataImportService.Getlatest3DModelNameByUnitWorkId(tvControlItem.SelectedNodeID);
|
|
|
|
|
|
}
|
|
else if (this.tvControlItem.SelectedNode.CommandName == "管线")
|
|
{
|
|
var model = PipelineService.GetPipelineByPipelineId(tvControlItem.SelectedNodeID);
|
|
if (model != null && !string.IsNullOrEmpty(model.UnitWorkId))
|
|
{
|
|
parameter3D.ModelName = HJGL_DataImportService.Getlatest3DModelNameByUnitWorkId(model.UnitWorkId);
|
|
|
|
}
|
|
|
|
}
|
|
parameter3D.Transparency = colorModel.PipelineComplete;
|
|
parameter3D.Finished_color = colorModel.JointCompleteColor;
|
|
parameter3D.Incomplete_color = colorModel.JointNOCompleteColor;
|
|
ctlAuditFlow.Url_item = BLL.Project_SysSetService.GetAvevaNetUrl_Item(this.CurrUser.LoginProjectId) + parameter3D.ModelName;
|
|
ctlAuditFlow.data = parameter3D;
|
|
ctlAuditFlow.BindData();
|
|
}
|
|
|
|
|
|
}
|
|
} |