02b524b895
焊口台账、材料匹配和任务单打印需要统一到焊口维度处理。 新增焊口查询、匹配保存和打印模板适配,便于按焊口追溯材料和任务。
1109 lines
47 KiB
C#
1109 lines
47 KiB
C#
using BLL;
|
|
using MiniExcelLibs;
|
|
using Model;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using AspNet = System.Web.UI.WebControls;
|
|
using System.Web.Caching;
|
|
|
|
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>();
|
|
|
|
// 缓存相关常量
|
|
private const string CACHE_KEY_PREFIX = "UnitWorkTree_";
|
|
private static readonly System.Web.Caching.Cache Cache = System.Web.HttpRuntime.Cache;
|
|
|
|
/// <summary>
|
|
/// 创建TreeNode的副本(用于缓存)
|
|
/// </summary>
|
|
/// <param name="sourceNode">源节点</param>
|
|
/// <returns>新节点</returns>
|
|
private TreeNode CloneTreeNode(TreeNode sourceNode)
|
|
{
|
|
if (sourceNode == null) return null;
|
|
|
|
TreeNode newNode = new TreeNode();
|
|
newNode.NodeID = sourceNode.NodeID;
|
|
newNode.Text = sourceNode.Text;
|
|
newNode.ToolTip = sourceNode.ToolTip;
|
|
newNode.CommandName = sourceNode.CommandName;
|
|
newNode.Selectable = sourceNode.Selectable;
|
|
newNode.EnableClickEvent = sourceNode.EnableClickEvent;
|
|
newNode.EnableExpandEvent = sourceNode.EnableExpandEvent;
|
|
newNode.Expanded = sourceNode.Expanded;
|
|
newNode.Icon = sourceNode.Icon;
|
|
|
|
// 递归复制子节点
|
|
if (sourceNode.Nodes != null && sourceNode.Nodes.Count > 0)
|
|
{
|
|
foreach (TreeNode childNode in sourceNode.Nodes)
|
|
{
|
|
TreeNode clonedChild = CloneTreeNode(childNode);
|
|
if (clonedChild != null)
|
|
{
|
|
newNode.Nodes.Add(clonedChild);
|
|
}
|
|
}
|
|
}
|
|
|
|
return newNode;
|
|
}
|
|
|
|
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_WithCache();//加载树
|
|
this.JointComplete = 0;
|
|
this.JointNoComplete = 0;
|
|
this.JointPre = 0;
|
|
this.JointNoPre = 0;
|
|
|
|
}
|
|
}
|
|
#region 加载树装置-单位-工作区
|
|
|
|
// 优化后的节点处理方法
|
|
private void ProcessUnitWorkNodes(List<Model.WBS_UnitWork> unitWorks, TreeNode parentNode,
|
|
Dictionary<string, int> pipelineCountDict,
|
|
Dictionary<string, string> unitDict)
|
|
{
|
|
foreach (var unitWork in unitWorks)
|
|
{
|
|
// 优化: 使用字典查找,避免数据库查询
|
|
int pipelineCount = pipelineCountDict.ContainsKey(unitWork.UnitWorkId) ? pipelineCountDict[unitWork.UnitWorkId] : 0;
|
|
string unitName = unitDict.ContainsKey(unitWork.UnitId) ? unitDict[unitWork.UnitId] : "未知单位";
|
|
|
|
TreeNode treeNode = new TreeNode();
|
|
treeNode.NodeID = unitWork.UnitWorkId;
|
|
treeNode.Text = unitWork.UnitWorkName + "【" + pipelineCount.ToString() + "】管线";
|
|
treeNode.ToolTip = "施工单位:" + unitName;
|
|
treeNode.CommandName = 1 + "|" + Funs.GetEndPageNumber(pipelineCount, pageSize);
|
|
treeNode.EnableClickEvent = true;
|
|
treeNode.EnableExpandEvent = true;
|
|
parentNode.Nodes.Add(treeNode);
|
|
|
|
if (pipelineCount > 0)
|
|
{
|
|
TreeNode newNode = new TreeNode();
|
|
newNode.Text = "加载管线...";
|
|
newNode.NodeID = "加载管线...";
|
|
treeNode.Nodes.Add(newNode);
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 带缓存的树加载方法
|
|
/// </summary>
|
|
private void InitTreeMenu_WithCache()
|
|
{
|
|
bool cacheHit = false;
|
|
string projectId = this.CurrUser.LoginProjectId;
|
|
string cacheKey = CACHE_KEY_PREFIX + projectId;
|
|
string searchTerm = this.tvPipeCode.Text.Trim();
|
|
|
|
// 如果有搜索条件,不使用缓存,直接执行优化查询
|
|
if (!string.IsNullOrEmpty(searchTerm))
|
|
{
|
|
InitTreeMenu_Optimized();
|
|
return;
|
|
}
|
|
|
|
// 检查缓存
|
|
if (Cache[cacheKey] != null)
|
|
{
|
|
var cachedData = Cache[cacheKey] as List<TreeNode>;
|
|
if (cachedData != null)
|
|
{
|
|
cacheHit = true;
|
|
this.tvControlItem.Nodes.Clear();
|
|
foreach (var node in cachedData)
|
|
{
|
|
this.tvControlItem.Nodes.Add(CloneTreeNode(node));
|
|
}
|
|
return;
|
|
}
|
|
}
|
|
|
|
// 执行优化的初始化逻辑
|
|
InitTreeMenu_Optimized();
|
|
|
|
// 缓存结果
|
|
var nodesToCache = new List<TreeNode>();
|
|
foreach (TreeNode node in this.tvControlItem.Nodes)
|
|
{
|
|
nodesToCache.Add(CloneTreeNode(node));
|
|
}
|
|
Cache.Insert(cacheKey, nodesToCache, null, DateTime.Now.AddMinutes(30), TimeSpan.Zero);
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// 清理项目相关的缓存
|
|
/// </summary>
|
|
private void ClearProjectCache()
|
|
{
|
|
string projectId = this.CurrUser.LoginProjectId;
|
|
string cacheKey = CACHE_KEY_PREFIX + projectId;
|
|
if (Cache[cacheKey] != null)
|
|
{
|
|
Cache.Remove(cacheKey);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 优化版本的树加载方法
|
|
/// </summary>
|
|
private void InitTreeMenu_Optimized()
|
|
{
|
|
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);
|
|
|
|
string projectId = this.CurrUser.LoginProjectId;
|
|
string searchTerm = this.tvPipeCode.Text.Trim();
|
|
|
|
// 优化1: 使用单次查询获取所需数据,减少数据库往返次数
|
|
var unitWorkList = (from x in Funs.DB.WBS_UnitWork
|
|
where x.ProjectId == projectId
|
|
&& x.SuperUnitWork == null
|
|
&& x.UnitId != null
|
|
&& x.ProjectType != null
|
|
select x).ToList();
|
|
|
|
// 优化2: 批量获取所有相关管线数据,避免N+1查询问题
|
|
var unitWorkIds = unitWorkList.Select(x => x.UnitWorkId).ToList();
|
|
|
|
var pipelineQuery = from p in Funs.DB.HJGL_Pipeline
|
|
where p.ProjectId == projectId
|
|
&& unitWorkIds.Contains(p.UnitWorkId)
|
|
select p;
|
|
|
|
// 如果有搜索条件,添加过滤
|
|
if (!string.IsNullOrEmpty(searchTerm))
|
|
{
|
|
pipelineQuery = pipelineQuery.Where(p => p.PipelineCode.Contains(searchTerm));
|
|
}
|
|
|
|
var pipelineCountDict = (from p in pipelineQuery
|
|
group p by p.UnitWorkId into g
|
|
select new {
|
|
UnitWorkId = g.Key,
|
|
Count = g.Count()
|
|
}).ToDictionary(x => x.UnitWorkId, x => x.Count);
|
|
|
|
// 优化3: 批量获取单位信息
|
|
var unitIds = unitWorkList.Where(x => x.UnitId != null).Select(x => x.UnitId).Distinct().ToList();
|
|
var unitDict = (from u in Funs.DB.Base_Unit
|
|
where unitIds.Contains(u.UnitId)
|
|
select u).ToDictionary(x => x.UnitId, x => x.UnitName);
|
|
|
|
// 优化4: 使用Dictionary进行快速查找,避免重复查询
|
|
List<Model.WBS_UnitWork> unitWork1 = unitWorkList.Where(x => x.ProjectType == "1").ToList();
|
|
List<Model.WBS_UnitWork> unitWork2 = unitWorkList.Where(x => x.ProjectType == "2").ToList();
|
|
|
|
// 处理建筑工程
|
|
if (unitWork1.Count > 0)
|
|
{
|
|
ProcessUnitWorkNodes(unitWork1, rootNode1, pipelineCountDict, unitDict);
|
|
}
|
|
|
|
// 处理安装工程
|
|
if (unitWork2.Count > 0)
|
|
{
|
|
ProcessUnitWorkNodes(unitWork2, rootNode2, pipelineCountDict, unitDict);
|
|
}
|
|
}
|
|
#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 = GetCurrentWeldJointQueryModel();
|
|
|
|
if (this.tvControlItem.SelectedNode.CommandName.Split('|').Count() == 2)
|
|
{
|
|
model.UnitWorkId = this.tvControlItem.SelectedNodeID;
|
|
var list = BLL.WeldJointService.GetDataBymodel(model, Grid1.PageIndex, Grid1.PageSize);
|
|
Grid1.RecordCount = list.Total;
|
|
Grid1.DataSource = list.Data;
|
|
Grid1.DataBind();
|
|
}
|
|
else if (this.tvControlItem.SelectedNode.CommandName == "管线")
|
|
{
|
|
model.PipelineId = this.tvControlItem.SelectedNodeID;
|
|
var list = BLL.WeldJointService.GetViewWeldJointsBymodel(model);
|
|
View_HJGL_WeldJoint = list;
|
|
Grid1.RecordCount = list.Count;
|
|
var table = list.Skip(Grid1.PageSize * (Grid1.PageIndex)).Take(Grid1.PageSize).ToList();
|
|
Grid1.DataSource = table;
|
|
Grid1.DataBind();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 汇总当前焊口台账查询条件,保证列表、导出和打印使用同一套过滤规则。
|
|
/// </summary>
|
|
private Model.View_HJGL_WeldJoint GetCurrentWeldJointQueryModel()
|
|
{
|
|
return new Model.View_HJGL_WeldJoint
|
|
{
|
|
ProjectId = this.CurrUser.LoginProjectId,
|
|
WeldJointCode = this.txtWeldJointCode.Text.Trim(),
|
|
IsWeldOK = this.ddlWeldState.SelectedValue
|
|
};
|
|
}
|
|
|
|
/// <summary>
|
|
/// 按当前树节点和筛选条件获取焊口铭牌待打印焊口。
|
|
/// </summary>
|
|
private List<Model.View_HJGL_WeldJoint> GetCurrentWeldJointList()
|
|
{
|
|
Model.View_HJGL_WeldJoint model = GetCurrentWeldJointQueryModel();
|
|
if (this.tvControlItem.SelectedNode.CommandName.Split('|').Count() == 2)
|
|
{
|
|
model.UnitWorkId = this.tvControlItem.SelectedNodeID;
|
|
}
|
|
else if (this.tvControlItem.SelectedNode.CommandName == "管线")
|
|
{
|
|
model.PipelineId = this.tvControlItem.SelectedNodeID;
|
|
}
|
|
return BLL.WeldJointService.GetViewWeldJointsBymodel(model);
|
|
}
|
|
|
|
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)
|
|
{
|
|
// 清理缓存以确保获取最新数据(特别是当搜索条件改变时)
|
|
ClearProjectCache();
|
|
this.InitTreeMenu_WithCache();
|
|
//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_WithCache();
|
|
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)
|
|
{
|
|
string fileName = "";
|
|
if (this.tvControlItem.SelectedNode.CommandName.Split('|').Count() == 2) //单位工程
|
|
{
|
|
Model.View_HJGL_WeldJoint model = GetCurrentWeldJointQueryModel();
|
|
model.UnitWorkId = this.tvControlItem.SelectedNodeID;
|
|
var list = BLL.WeldJointService.GetViewWeldJointsBymodel(model);
|
|
View_HJGL_WeldJoint = list;
|
|
fileName = UnitWorkService.GetNameById(model.UnitWorkId);
|
|
}
|
|
else if (this.tvControlItem.SelectedNode.CommandName == "管线")
|
|
{
|
|
var list = GetCurrentWeldJointList();
|
|
View_HJGL_WeldJoint = list;
|
|
fileName = PipelineService.GetPipelineByPipelineId(this.tvControlItem.SelectedNodeID)?.PipelineCode;
|
|
}
|
|
|
|
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.IsWeldOK,
|
|
单位名称 = x.UnitName,
|
|
流水段 = x.FlowingSection,
|
|
任务单编号 = x.TaskCode,
|
|
材质1 = x.Material1Code,
|
|
材质2 = x.Material2Code,
|
|
达因 = x.Size,
|
|
外径 = x.Dia,
|
|
壁厚 = x.Thickness,
|
|
规格 = x.Specification,
|
|
焊缝类型 = x.WeldTypeCode,
|
|
焊接方法 = x.WeldingMethodCode,
|
|
WPS编号 = x.WPQCode,
|
|
坡口类型 = x.GrooveTypeCode,
|
|
焊条 = x.WeldingRodCode,
|
|
焊丝 = x.WeldingWireCode,
|
|
预热温度 = x.PreTemperature,
|
|
焊口属性 = x.JointAttribute,
|
|
焊接日期 = x.WeldingDate,
|
|
打底焊工号 = x.BackingWelderCode,
|
|
打底焊工班组 = x.BackingWelderTeamGroupName,
|
|
盖面焊工号 = x.CoverWelderCode,
|
|
盖面焊工班组 = x.CoverWelderTeamGroupName,
|
|
热处理报告编号 = x.HotProessReportNo,
|
|
热处理检测结果 = x.HotProessResult,
|
|
硬度报告编号 = x.HardReportNo,
|
|
硬度检测结果 = x.HardResult,
|
|
委托单编号 = x.TrustBatchCode,
|
|
检测单编号 = x.NDECode,
|
|
探伤类型 = x.DetectionTypeCode,
|
|
探伤比例 = x.DetectionRateCode
|
|
|
|
}).ToList();
|
|
MiniExcel.SaveAs(path, q);
|
|
|
|
fileName = 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 PrintByUnitWork(string unitWorkId)
|
|
{
|
|
const int pageSize = 10000;
|
|
int pageIndex = 0;
|
|
bool isFirstPage = true;
|
|
var model = new Model.View_HJGL_WeldJoint
|
|
{
|
|
ProjectId = this.CurrUser.LoginProjectId,
|
|
UnitWorkId = unitWorkId
|
|
};
|
|
|
|
// 生成唯一文件路径(带GUID哈希值)
|
|
string path = $@"{Funs.RootPath}File\Excel\Temp\JointQuery_{Guid.NewGuid().GetHashCode():x}.xlsx";
|
|
var AllData = new List<object>();
|
|
using (var excelStream = new FileStream(path, FileMode.Create))
|
|
{
|
|
while (true)
|
|
{
|
|
// 分页获取数据
|
|
var pageData = BLL.WeldJointService.GetDataBymodel(model, pageIndex, pageSize);
|
|
|
|
if (!pageData.Data.Any()) break;
|
|
|
|
// 动态转换查询结果
|
|
var currentChunk = pageData.Data.Select(x => new
|
|
{
|
|
焊口号 = x.WeldJointCode,
|
|
完成状态 = x.IsWeldOK,
|
|
单位名称 = x.UnitName,
|
|
流水段 = x.FlowingSection,
|
|
任务单编号 = x.TaskCode,
|
|
材质1 = x.Material1Code,
|
|
材质2 = x.Material2Code,
|
|
达因 = x.Size,
|
|
外径 = x.Dia,
|
|
壁厚 = x.Thickness,
|
|
规格 = x.Specification,
|
|
焊缝类型 = x.WeldTypeCode,
|
|
焊接方法 = x.WeldingMethodCode,
|
|
WPS编号 = x.WPQCode,
|
|
坡口类型 = x.GrooveTypeCode,
|
|
焊条 = x.WeldingRodCode,
|
|
焊丝 = x.WeldingWireCode,
|
|
预热温度 = x.PreTemperature,
|
|
焊口属性 = x.JointAttribute,
|
|
焊接日期 = x.WeldingDate,
|
|
打底焊工号 = x.BackingWelderCode,
|
|
打底焊工班组 = x.BackingWelderTeamGroupName,
|
|
盖面焊工号 = x.CoverWelderCode,
|
|
盖面焊工班组 = x.CoverWelderTeamGroupName,
|
|
热处理报告编号 = x.HotProessReportNo,
|
|
热处理检测结果 = x.HotProessResult,
|
|
硬度报告编号 = x.HardReportNo,
|
|
硬度检测结果 = x.HardResult,
|
|
委托单编号 = x.TrustBatchCode,
|
|
检测单编号 = x.NDECode,
|
|
探伤类型 = x.DetectionTypeCode,
|
|
探伤比例 = x.DetectionRateCode
|
|
|
|
}).ToList();
|
|
|
|
AllData.AddRange(currentChunk);
|
|
// 内存清理 & 翻页操作
|
|
currentChunk = null;
|
|
pageIndex++;
|
|
GC.Collect(GC.MaxGeneration, GCCollectionMode.Optimized, blocking: true);
|
|
}
|
|
|
|
MiniExcel.SaveAs(path, AllData);
|
|
|
|
}
|
|
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); // 多保险清理机制
|
|
}
|
|
|
|
protected void btnOutNOComPipeline_Click(object sender, EventArgs e)
|
|
{
|
|
if (this.tvControlItem.SelectedNode.CommandName.Split('|').Count() == 2)
|
|
{
|
|
var currentQuery = GetCurrentWeldJointQueryModel();
|
|
var q = (from x in Funs.DB.View_HJGL_WeldJoint
|
|
where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == this.tvControlItem.SelectedNodeID
|
|
&& (string.IsNullOrEmpty(currentQuery.WeldJointCode) || x.WeldJointCode.Contains(currentQuery.WeldJointCode))
|
|
&& (string.IsNullOrEmpty(currentQuery.IsWeldOK) || x.IsWeldOK == currentQuery.IsWeldOK)
|
|
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>
|
|
protected void btnPrintJointNameplate_Click(object sender, EventArgs e)
|
|
{
|
|
if (this.Grid1.SelectedRowIDArray == null || this.Grid1.SelectedRowIDArray.Length == 0)
|
|
{
|
|
Alert.Show("请选择要打印的焊口");
|
|
return;
|
|
}
|
|
|
|
var weldJointList = GetSelectedWeldJointList();
|
|
if (weldJointList == null || weldJointList.Count == 0)
|
|
{
|
|
Alert.Show("当前条件下没有可打印的焊口");
|
|
return;
|
|
}
|
|
|
|
var tb = BuildWeldJointNameplateTable(weldJointList);
|
|
if (tb == null || tb.Rows.Count == 0)
|
|
{
|
|
Alert.Show("当前条件下没有可打印的焊口");
|
|
return;
|
|
}
|
|
|
|
BLL.FastReportService.ResetData();
|
|
tb.TableName = "Table1";
|
|
BLL.FastReportService.AddFastreportTable(tb);
|
|
|
|
string rootPath = Server.MapPath("~/");
|
|
string initTemplatePath = "File\\Fastreport\\焊口铭牌.frx";
|
|
if (File.Exists(rootPath + initTemplatePath))
|
|
{
|
|
PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("~/Controls/Fastreport.aspx?ReportPath={0}", rootPath + initTemplatePath)));
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取当前勾选的焊口。
|
|
/// </summary>
|
|
private List<Model.View_HJGL_WeldJoint> GetSelectedWeldJointList()
|
|
{
|
|
var ids = this.Grid1.SelectedRowIDArray;
|
|
if (ids == null || ids.Length == 0)
|
|
{
|
|
return new List<Model.View_HJGL_WeldJoint>();
|
|
}
|
|
|
|
List<Model.View_HJGL_WeldJoint> list = new List<Model.View_HJGL_WeldJoint>();
|
|
foreach (string id in ids)
|
|
{
|
|
var item = WeldJointService.GetViewWeldJointById(id);
|
|
if (item != null)
|
|
{
|
|
list.Add(item);
|
|
}
|
|
}
|
|
|
|
return list;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 组装焊口铭牌打印数据,材料列优先使用已反写主编码对应的材料库信息。
|
|
/// </summary>
|
|
private DataTable BuildWeldJointNameplateTable(List<Model.View_HJGL_WeldJoint> weldJointList)
|
|
{
|
|
DataTable tb = new DataTable();
|
|
// FastReport 对中文字段名兼容性不稳定,这里统一改成 ASCII 列名,模板只负责显示中文表头。
|
|
tb.Columns.Add("PipelineCode", typeof(string));
|
|
tb.Columns.Add("SegmentCode", typeof(string));
|
|
tb.Columns.Add("WeldJointNo", typeof(string));
|
|
tb.Columns.Add("MaterialText", typeof(string));
|
|
tb.Columns.Add("Spec", typeof(string));
|
|
tb.Columns.Add("DesignTemperature", typeof(string));
|
|
tb.Columns.Add("MaterialCode1", typeof(string));
|
|
tb.Columns.Add("MaterialCode2", typeof(string));
|
|
tb.Columns.Add("HeatNo1", typeof(string));
|
|
tb.Columns.Add("BatchNo1", typeof(string));
|
|
tb.Columns.Add("Material1Code", typeof(string));
|
|
tb.Columns.Add("Material2Code", typeof(string));
|
|
tb.Columns.Add("HeatNo2", typeof(string));
|
|
tb.Columns.Add("BatchNo2", typeof(string));
|
|
tb.Columns.Add("WelderCode", typeof(string));
|
|
tb.Columns.Add("WeldingDate", typeof(string));
|
|
tb.Columns.Add("WeldCheck", typeof(string));
|
|
tb.Columns.Add("CheckDate", typeof(string));
|
|
tb.Columns.Add("CleanCheck", typeof(string));
|
|
tb.Columns.Add("CleanCheckDate", typeof(string));
|
|
tb.Columns.Add("WeldJointId", typeof(string));
|
|
|
|
var jointIds = weldJointList.Select(x => x.WeldJointId).Where(x => !string.IsNullOrEmpty(x)).Distinct().ToList();
|
|
var pipelineIds = weldJointList.Select(x => x.PipelineId).Where(x => !string.IsNullOrEmpty(x)).Distinct().ToList();
|
|
var materialRows = (from x in Funs.DB.HJGL_PipeLineMat
|
|
where jointIds.Contains(x.WeldJointId) && pipelineIds.Contains(x.PipelineId)
|
|
orderby x.WeldJointId, x.Number, x.PipeLineMatId
|
|
select x).ToList();
|
|
|
|
var materialCodes = materialRows.Where(x => !string.IsNullOrEmpty(x.MaterialCode)).Select(x => x.MaterialCode).Distinct().ToList();
|
|
var materialCode2s = materialRows.Where(x => !string.IsNullOrEmpty(x.MaterialCode2)).Select(x => x.MaterialCode2).Distinct().ToList();
|
|
var libsByMaterialCode = Funs.DB.HJGL_MaterialCodeLib.Where(x => materialCodes.Contains(x.MaterialCode)).ToList().GroupBy(x => x.MaterialCode).ToDictionary(x => x.Key, x => x.First());
|
|
var libsByCode = Funs.DB.HJGL_MaterialCodeLib.Where(x => materialCode2s.Contains(x.Code)).ToList().GroupBy(x => x.Code).ToDictionary(x => x.Key, x => x.First());
|
|
|
|
foreach (var joint in weldJointList)
|
|
{
|
|
var rows = materialRows.Where(x => x.WeldJointId == joint.WeldJointId).ToList();
|
|
var row1 = rows.FirstOrDefault();
|
|
var row2 = rows.Skip(1).FirstOrDefault();
|
|
|
|
// 预制组件号按现有业务即预制组件编码显示,避免和管线号混淆。
|
|
string preCode = row1 == null ? string.Empty : row1.PrefabricatedComponents;
|
|
if (string.IsNullOrEmpty(preCode))
|
|
{
|
|
preCode = joint.TaskCode;
|
|
}
|
|
|
|
// 焊口号只显示末级编号,和焊口贴纸二维码对应的展示一致,避免带管线前缀。
|
|
string weldJointNo = joint.WeldJointCode;
|
|
if (!string.IsNullOrEmpty(weldJointNo) && weldJointNo.Contains("/"))
|
|
{
|
|
weldJointNo = weldJointNo.Substring(weldJointNo.LastIndexOf("/") + 1);
|
|
}
|
|
|
|
// 优先用已反写主编码匹配材料库;没有主编码时,用导入材料编码 Code 兜底。
|
|
HJGL_MaterialCodeLib lib1 = GetMaterialLib(row1, libsByMaterialCode, libsByCode);
|
|
HJGL_MaterialCodeLib lib2 = GetMaterialLib(row2, libsByMaterialCode, libsByCode);
|
|
|
|
DataRow dr = tb.NewRow();
|
|
dr["PipelineCode"] = joint.PipelineCode;
|
|
dr["SegmentCode"] = preCode;
|
|
dr["WeldJointNo"] = weldJointNo;
|
|
dr["MaterialText"] = string.IsNullOrEmpty(joint.Material1Code) ? joint.Material2Code : joint.Material1Code;
|
|
dr["Spec"] = joint.Specification;
|
|
dr["DesignTemperature"] = joint.PreTemperature;
|
|
dr["MaterialCode1"] = GetMaterialDisplayCode(row1, lib1);
|
|
dr["HeatNo1"] = lib1 == null ? string.Empty : lib1.HeatNo;
|
|
dr["BatchNo1"] = lib1 == null ? string.Empty : lib1.BatchNo;
|
|
dr["MaterialCode2"] = GetMaterialDisplayCode(row2, lib2);
|
|
dr["HeatNo2"] = lib2 == null ? string.Empty : lib2.HeatNo;
|
|
dr["BatchNo2"] = lib2 == null ? string.Empty : lib2.BatchNo;
|
|
dr["WelderCode"] = string.IsNullOrEmpty(joint.WelderCode) ? (string.IsNullOrEmpty(joint.BackingWelderCode) ? joint.CoverWelderCode : joint.BackingWelderCode) : joint.WelderCode;
|
|
dr["WeldingDate"] = joint.WeldingDate;
|
|
dr["WeldCheck"] = joint.CheckResult;
|
|
dr["CheckDate"] = joint.AuditDate == null ? string.Empty : joint.AuditDate.Value.ToString("yyyy-MM-dd");
|
|
dr["CleanCheck"] = joint.IsHotProessStr;
|
|
dr["CleanCheckDate"] = joint.AuditDate2 == null ? string.Empty : joint.AuditDate2.Value.ToString("yyyy-MM-dd");
|
|
dr["WeldJointId"] = joint.WeldJointId;
|
|
dr["Material1Code"] = joint.Material1Code;
|
|
dr["Material2Code"] = joint.Material2Code;
|
|
tb.Rows.Add(dr);
|
|
}
|
|
|
|
return tb;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取材料库记录,优先按主编码,其次按导入编码。
|
|
/// </summary>
|
|
private HJGL_MaterialCodeLib GetMaterialLib(HJGL_PipeLineMat row, Dictionary<string, HJGL_MaterialCodeLib> libsByMaterialCode, Dictionary<string, HJGL_MaterialCodeLib> libsByCode)
|
|
{
|
|
if (row == null)
|
|
{
|
|
return null;
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(row.MaterialCode) && libsByMaterialCode.ContainsKey(row.MaterialCode))
|
|
{
|
|
return libsByMaterialCode[row.MaterialCode];
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(row.MaterialCode2) && libsByCode.ContainsKey(row.MaterialCode2))
|
|
{
|
|
return libsByCode[row.MaterialCode2];
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 返回打印用物料编码,优先显示导入编码。
|
|
/// </summary>
|
|
private string GetMaterialDisplayCode(HJGL_PipeLineMat row, HJGL_MaterialCodeLib lib)
|
|
{
|
|
if (row == null)
|
|
{
|
|
return string.Empty;
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(row.MaterialCode2))
|
|
{
|
|
return row.MaterialCode2;
|
|
}
|
|
|
|
if (lib != null)
|
|
{
|
|
return lib.Code;
|
|
}
|
|
|
|
return row.MaterialCode;
|
|
}
|
|
/// <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();
|
|
}
|
|
|
|
|
|
}
|
|
}
|