1329 lines
56 KiB
C#
1329 lines
56 KiB
C#
using Apache.NMS.ActiveMQ.Threads;
|
|
using BLL;
|
|
using FineUIPro.Web.ProjectData;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Data.SqlClient;
|
|
using System.Diagnostics;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Text.RegularExpressions;
|
|
using System.Threading.Tasks;
|
|
using System.Web;
|
|
|
|
namespace FineUIPro.Web.HJGL.WeldingManage
|
|
{
|
|
public partial class WeldJointList : PageBase
|
|
{
|
|
public int pageSize = PipelineService.pageSize;
|
|
public static List<Model.HJGL_WeldJoint> WeldJointlist = new List<Model.HJGL_WeldJoint>();
|
|
/// <summary>
|
|
/// 预制口总达因
|
|
/// </summary>
|
|
public static string ShopSumSize = "0";
|
|
/// <summary>
|
|
/// 安装口总达因
|
|
/// </summary>
|
|
public static string FieldSumSize = "0";
|
|
|
|
/// <summary>
|
|
/// 预制口总数量
|
|
/// </summary>
|
|
public static string ShopSum = "0";
|
|
/// <summary>
|
|
/// 安装口总数量
|
|
/// </summary>
|
|
public static string FieldSum = "0";
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
|
|
if (!IsPostBack)
|
|
{
|
|
// WeldJointlist = WeldJointService.GetWeldJointByProjectid(this.CurrUser.LoginProjectId);
|
|
this.InitTreeMenu();//加载树
|
|
//显示列
|
|
//Model.Sys_UserShowColumns c = BLL.UserShowColumnsService.GetColumnsByUserId(this.CurrUser.PersonId, "Joint");
|
|
//if (c != null)
|
|
//{
|
|
// this.GetShowColumn(c.Columns);
|
|
//}
|
|
Model.Project_Sys_Set pressUnit = BLL.Project_SysSetService.GetSysSetBySetId("8", this.CurrUser.LoginProjectId);
|
|
if (pressUnit != null && pressUnit.SetValue == "2")
|
|
{
|
|
this.Grid1.Columns[9].HeaderText = "设计压力 kPa(g)";
|
|
this.Grid1.Columns[12].HeaderText = "压力试验压力 kPa(g)";
|
|
this.Grid1.Columns[16].HeaderText = "泄露试验压力 kPa(g)";
|
|
this.Grid1.Columns[18].HeaderText = "真空试验压力 kPa(a)";
|
|
}
|
|
}
|
|
}
|
|
|
|
//protected void drpProjectId_SelectedIndexChanged(object sender, EventArgs e)
|
|
//{
|
|
// this.InitTreeMenu();
|
|
//}
|
|
|
|
#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.EnableExpandEvent = true;
|
|
tn1.EnableClickEvent = true;
|
|
rootNode1.Nodes.Add(tn1);
|
|
if (a > 0)
|
|
{
|
|
// BindNodes(tn1);
|
|
TreeNode newNode = new TreeNode();
|
|
newNode.Text = "加载管线...";
|
|
newNode.NodeID = "加载管线...";
|
|
tn1.Nodes.Add(newNode);
|
|
}
|
|
}
|
|
}
|
|
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.EnableExpandEvent = true;
|
|
tn2.EnableClickEvent = true;
|
|
rootNode2.Nodes.Add(tn2);
|
|
if (a > 0)
|
|
{
|
|
// BindNodes(tn2);
|
|
TreeNode newNode = new TreeNode();
|
|
newNode.Text = "加载管线...";
|
|
newNode.NodeID = "加载管线...";
|
|
tn2.Nodes.Add(newNode);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region
|
|
private void BindNodes(TreeNode node)
|
|
{
|
|
BLL.PipelineService.BindTreeNodes(node, this.tvPipeCode.Text.Trim(), this.CurrUser.LoginProjectId, pageSize);
|
|
}
|
|
#endregion
|
|
|
|
protected void tvControlItem_TreeNodeExpanded(object sender, TreeNodeEventArgs e)
|
|
{
|
|
if (e.Node.Nodes[0].NodeID == "加载管线...")
|
|
{
|
|
e.Node.Nodes.Clear();
|
|
BindNodes(e.Node);
|
|
}
|
|
|
|
//e.Node.Nodes.Clear();
|
|
|
|
//if (e.Node.CommandName == "单位工程")
|
|
//{
|
|
// var pipeline = (from x in Funs.DB.HJGL_Pipeline
|
|
// where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == e.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();
|
|
|
|
// // var WeldJointlist = (from x in Funs.DB.View_HJGL_WeldJoint where x.UnitWorkId == e.Node.NodeID && x.IsTwoJoint == null select x).ToList();
|
|
|
|
// foreach (var item in pipeline)
|
|
// {
|
|
// //var jotCount = WeldJointlist.Where(x => x.PipelineId == item.PipelineId).Count();
|
|
// var jotCount = hJGL_WeldJoints.Where(x => x.PipelineId == item.PipelineId).Count();
|
|
// TreeNode newNode = new TreeNode();
|
|
// newNode.Text = item.PipelineCode + "【" + jotCount.ToString() + " " + "焊口" + "】";
|
|
// newNode.NodeID = item.PipelineId;
|
|
// newNode.EnableClickEvent = true;
|
|
// e.Node.Nodes.Add(newNode);
|
|
|
|
// }
|
|
|
|
//}
|
|
}
|
|
|
|
|
|
#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
|
|
{
|
|
if (!string.IsNullOrEmpty(this.tvControlItem.SelectedNodeID))
|
|
{
|
|
Model.HJGL_Pipeline pipeline = BLL.PipelineService.GetPipelineByPipelineId(this.tvControlItem.SelectedNodeID);
|
|
this.hdUnitWorkId.Text = string.Empty;
|
|
if (pipeline != null)
|
|
{
|
|
this.hdUnitWorkId.Text = this.tvControlItem.SelectedNode.ParentNode.NodeID;
|
|
this.BindGrid1(this.tvControlItem.SelectedNodeID);
|
|
this.BindGrid2(this.tvControlItem.SelectedNodeID);
|
|
this.BindGrid3(this.tvControlItem.SelectedNodeID);
|
|
this.lbSinglePreRate.Label = "图纸预制率(达因)";
|
|
this.lbSinglePreRate.Text = GetRateByPipelineid(this.tvControlItem.SelectedNodeID);
|
|
|
|
this.lbSinglePreRateByWeldJoint.Label = "图纸预制率(焊口)";
|
|
this.lbSinglePreRateByWeldJoint.Text = GetWeldJointRateByPipelineid(this.tvControlItem.SelectedNodeID);
|
|
|
|
}
|
|
else
|
|
{
|
|
this.hdUnitWorkId.Text = this.tvControlItem.SelectedNodeID;
|
|
this.lbSinglePreRate.Label = "主项预制率(达因)";
|
|
this.lbSinglePreRate.Text = GetRateByUnitWork(this.tvControlItem.SelectedNodeID);
|
|
|
|
this.lbSinglePreRateByWeldJoint.Label = "主项预制率(焊口)";
|
|
this.lbSinglePreRateByWeldJoint.Text = GetWeldJointRateByUnitWork(this.tvControlItem.SelectedNodeID);
|
|
|
|
}
|
|
this.lbShopSize.Text = ShopSumSize;
|
|
this.lbFiledSize.Text = FieldSumSize;
|
|
this.lbShopSum.Text = ShopSum;
|
|
this.lbFiledSum.Text = FieldSum;
|
|
}
|
|
}
|
|
|
|
}
|
|
#endregion
|
|
|
|
#region 数据绑定
|
|
/// <summary>
|
|
/// 管线数据
|
|
/// </summary>
|
|
private void BindGrid1(string pipelineId)
|
|
{
|
|
string strSql = @"SELECT ProjectId,UnitWorkId,PipelineId,PipelineCode,UnitName,MediumCode,MediumName,PipingClassCode,UnitWorkCode,SingleName,
|
|
TestPressure,SingleNumber,DetectionRateCode,DetectionType,Remark,FlowingSection,TestMediumCode,TotalDin,
|
|
JointCount,PressurePipingClassCode,PipeLenth,DesignPress,DesignTemperature,LeakPressure,VacuumPressure,
|
|
LeakMediumName,PCMediumName,MaterialCode
|
|
FROM dbo.View_HJGL_Pipeline
|
|
WHERE ProjectId= @ProjectId";
|
|
List<SqlParameter> listStr = new List<SqlParameter>();
|
|
listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
|
|
strSql += " AND PipelineId = @PipelineId";
|
|
listStr.Add(new SqlParameter("@PipelineId", pipelineId));
|
|
//strSql += " AND UnitWorkId =@UnitWorkId";
|
|
//listStr.Add(new SqlParameter("@UnitWorkId", this.tvControlItem.SelectedNodeID));
|
|
//if (!string.IsNullOrEmpty(this.txtPipelineCode.Text.Trim()))
|
|
//{
|
|
// strSql += " AND PipelineCode LIKE @PipelineCode";
|
|
// listStr.Add(new SqlParameter("@PipelineCode", "%" + this.txtPipelineCode.Text.Trim() + "%"));
|
|
//}
|
|
//if (!string.IsNullOrEmpty(this.txtSingleNumber.Text.Trim()))
|
|
//{
|
|
// strSql += " AND SingleNumber LIKE @SingleNumber";
|
|
// listStr.Add(new SqlParameter("@SingleNumber", "%" + this.txtSingleNumber.Text.Trim() + "%"));
|
|
//}
|
|
|
|
SqlParameter[] parameter = listStr.ToArray();
|
|
DataTable dt = SQLHelper.GetDataTableRunText(strSql, parameter);
|
|
|
|
// 2.获取当前分页数据
|
|
//var table = this.GetPagedDataTable(Grid1, tb1);
|
|
//Grid1.RecordCount = tb.Rows.Count;
|
|
//tb = GetFilteredTable(Grid1.FilteredData, tb);
|
|
//var table = this.GetPagedDataTable(Grid1, tb);
|
|
//this.OutputSummaryData(tb); ///取合计值
|
|
Grid1.DataSource = dt;
|
|
Grid1.DataBind();
|
|
}
|
|
|
|
private void BindGrid2(string pipelineId)
|
|
{
|
|
string strSql = @" SELECT pipe.PipeLineMatId, lib.MaterialCode,lib.MaterialName,lib.MaterialUnit,
|
|
lib.MaterialSpec,lib.MaterialMade,lib.MaterialDef,pipe.Number
|
|
FROM dbo.HJGL_PipeLineMat pipe
|
|
LEFT JOIN dbo.HJGL_MaterialCodeLib lib ON lib.MaterialCode = pipe.MaterialCode
|
|
WHERE PipelineId=@PipelineId";
|
|
List<SqlParameter> listStr = new List<SqlParameter>();
|
|
listStr.Add(new SqlParameter("@PipelineId", pipelineId));
|
|
SqlParameter[] parameter = listStr.ToArray();
|
|
DataTable dt = SQLHelper.GetDataTableRunText(strSql, parameter);
|
|
|
|
// 2.获取当前分页数据
|
|
Grid2.DataSource = dt;
|
|
Grid2.DataBind();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 数据绑定 焊口数据绑定
|
|
/// </summary>
|
|
private void BindGrid3(string pipelineId)
|
|
{
|
|
string strSql = @"SELECT WeldJointId,JointAttribute,WeldJointCode,PipelineId,PipelineCode,JointAttribute,
|
|
IsWelding,IsHotProessStr,Material1Code,Material2Code,WeldTypeCode,
|
|
Specification,HeartNo1,HeartNo2,Size,Dia,DNDia,Thickness,GrooveTypeCode,
|
|
WeldingMethodCode,WeldingWireCode,WeldingRodCode,WeldingDate,WeldingDailyCode,
|
|
BackingWelderCode,CoverWelderCode,MediumCode ,PreTemperature,JointArea,WPQCode,Remark
|
|
FROM View_HJGL_WeldJoint WHERE IsTwoJoint IS NULL ";
|
|
List<SqlParameter> listStr = new List<SqlParameter> { };
|
|
|
|
strSql += " AND PipelineId =@PipelineId";
|
|
listStr.Add(new SqlParameter("@PipelineId", pipelineId));
|
|
|
|
if (!string.IsNullOrEmpty(this.txtWeldJointCode.Text.Trim()))
|
|
{
|
|
strSql += " AND WeldJointCode LIKE @WeldJointCode";
|
|
listStr.Add(new SqlParameter("@WeldJointCode", "%" + this.txtWeldJointCode.Text.Trim() + "%"));
|
|
}
|
|
SqlParameter[] parameter = listStr.ToArray();
|
|
DataTable dt = SQLHelper.GetDataTableRunText(strSql, parameter);
|
|
|
|
// 2.获取当前分页数据 不分页
|
|
//Grid3.RecordCount = tb.Rows.Count;
|
|
//var table = this.GetPagedDataTable(Grid3, tb);
|
|
Grid3.DataSource = dt;
|
|
Grid3.DataBind();
|
|
}
|
|
#endregion
|
|
|
|
#region 分页排序
|
|
#region 页索引改变事件
|
|
/// <summary>
|
|
/// 页索引改变事件
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
//protected void Grid3_PageIndexChange(object sender, GridPageEventArgs e)
|
|
//{
|
|
// BindGrid3();
|
|
//}
|
|
#endregion
|
|
|
|
#region 排序
|
|
|
|
protected void Grid1_Sort(object sender, GridSortEventArgs e)
|
|
{
|
|
BindGrid1(this.tvControlItem.SelectedNodeID);
|
|
}
|
|
|
|
protected void Grid2_Sort(object sender, GridSortEventArgs e)
|
|
{
|
|
BindGrid2(this.tvControlItem.SelectedNodeID);
|
|
}
|
|
/// <summary>
|
|
/// 排序
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Grid3_Sort(object sender, GridSortEventArgs e)
|
|
{
|
|
BindGrid3(this.tvControlItem.SelectedNodeID);
|
|
}
|
|
#endregion
|
|
|
|
#region 分页选择下拉改变事件 暂不用
|
|
/// <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();
|
|
//}
|
|
#endregion
|
|
#endregion
|
|
|
|
#region 预制率计算
|
|
private string GetRateByUnitWork(string unitworkid)
|
|
{
|
|
var db = Funs.DB;
|
|
var q = from x in db.View_HJGL_WeldJoint where x.UnitWorkId == unitworkid select x;
|
|
string rate = "";
|
|
ShopSumSize = "0";
|
|
FieldSumSize = "0";
|
|
if (q != null && q.Count() > 0)
|
|
{
|
|
var proSum = (from x in q
|
|
where x.JointAttribute == "预制口"
|
|
group x by x.UnitWorkId into g
|
|
select new
|
|
{
|
|
SizeSum = g.Sum(x => x.Size)
|
|
}).FirstOrDefault()?.SizeSum;
|
|
var FieldSum = (from x in q
|
|
where x.JointAttribute == "安装口"
|
|
group x by x.UnitWorkId into g
|
|
select new
|
|
{
|
|
SizeSum = g.Sum(x => x.Size)
|
|
}).FirstOrDefault()?.SizeSum;
|
|
var AllSum = (from x in q
|
|
group x by x.UnitWorkId into g
|
|
select new
|
|
{
|
|
SizeSum = g.Sum(x => x.Size)
|
|
}).FirstOrDefault()?.SizeSum;
|
|
proSum = (proSum != null) ? proSum : 0;
|
|
FieldSum = (FieldSum != null) ? FieldSum : 0;
|
|
ShopSumSize = proSum.ToString();
|
|
FieldSumSize = FieldSum.ToString();
|
|
if (AllSum > 0)
|
|
{
|
|
var a = (decimal)100 * proSum / AllSum;
|
|
rate = Math.Round((decimal)a, 1).ToString() + "%";
|
|
}
|
|
|
|
return rate;
|
|
}
|
|
return "0%";
|
|
}
|
|
|
|
private string GetWeldJointRateByUnitWork(string unitworkid)
|
|
{
|
|
string rate = "";
|
|
int shopNum = 0;
|
|
int fieldNum = 0;
|
|
int AllNum = 0;
|
|
var db = Funs.DB;
|
|
var q = from x in db.View_HJGL_WeldJoint where x.UnitWorkId == unitworkid select x;
|
|
if (q != null && q.Count() > 0)
|
|
{
|
|
shopNum = (from x in q
|
|
where x.JointAttribute == "预制口"
|
|
select x
|
|
).Count();
|
|
fieldNum = (from x in q
|
|
where x.JointAttribute == "安装口"
|
|
select x
|
|
).Count();
|
|
ShopSum = shopNum.ToString();
|
|
FieldSum = fieldNum.ToString();
|
|
AllNum = shopNum + fieldNum;
|
|
|
|
if (AllNum > 0)
|
|
{
|
|
var a = (decimal)100 * shopNum / AllNum;
|
|
rate = Math.Round((decimal)a, 1).ToString() + "%";
|
|
}
|
|
|
|
return rate;
|
|
}
|
|
return "0%";
|
|
}
|
|
private string GetRateByPipelineid(string pipelineid)
|
|
{
|
|
string rate = "";
|
|
ShopSumSize = "0";
|
|
FieldSumSize = "0";
|
|
var db = Funs.DB;
|
|
var q = from x in db.View_HJGL_WeldJoint where x.PipelineId == pipelineid select x;
|
|
if (q != null && q.Count() > 0)
|
|
{
|
|
var proSumModel = (from x in q
|
|
where x.JointAttribute == "预制口"
|
|
group x by x.PipelineId into g
|
|
select new
|
|
{
|
|
SizeSum = g.Sum(x => x.Size)
|
|
}).FirstOrDefault();
|
|
var proSum = (proSumModel != null) ? proSumModel.SizeSum : 0;
|
|
var FieldSumModel = (from x in q
|
|
where x.JointAttribute == "安装口"
|
|
group x by x.PipelineId into g
|
|
select new
|
|
{
|
|
SizeSum = g.Sum(x => x.Size)
|
|
}).FirstOrDefault();
|
|
var FieldSum = (FieldSumModel != null) ? FieldSumModel.SizeSum : 0;
|
|
var AllSumModel = (from x in q
|
|
group x by x.PipelineId into g
|
|
select new
|
|
{
|
|
SizeSum = g.Sum(x => x.Size)
|
|
}).FirstOrDefault();
|
|
var AllSum = (AllSumModel != null) ? AllSumModel.SizeSum : 0;
|
|
|
|
proSum = (proSum != null) ? proSum : 0;
|
|
FieldSum = (FieldSum != null) ? FieldSum : 0;
|
|
ShopSumSize = proSum.ToString();
|
|
FieldSumSize = FieldSum.ToString();
|
|
if (AllSum > 0)
|
|
{
|
|
var a = (decimal)100 * proSum / AllSum;
|
|
rate = Math.Round((decimal)a, 1).ToString() + "%";
|
|
}
|
|
|
|
return rate;
|
|
}
|
|
return "0%";
|
|
}
|
|
/// <summary>
|
|
/// 获取预制率(焊口) 预制口数量/总焊口数量
|
|
/// </summary>
|
|
/// <param name="pipelineid"></param>
|
|
/// <returns></returns>
|
|
private string GetWeldJointRateByPipelineid(string pipelineid)
|
|
{
|
|
string rate = "";
|
|
int shopNum = 0;
|
|
int fieldNum = 0;
|
|
int AllNum = 0;
|
|
var db = Funs.DB;
|
|
var q = from x in db.View_HJGL_WeldJoint where x.PipelineId == pipelineid select x;
|
|
if (q != null && q.Count() > 0)
|
|
{
|
|
shopNum = (from x in q
|
|
where x.JointAttribute == "预制口"
|
|
select x
|
|
).Count();
|
|
fieldNum = (from x in q
|
|
where x.JointAttribute == "安装口"
|
|
select x
|
|
).Count();
|
|
ShopSum = shopNum.ToString();
|
|
FieldSum = fieldNum.ToString();
|
|
AllNum = shopNum + fieldNum;
|
|
|
|
if (AllNum > 0)
|
|
{
|
|
var a = (decimal)100 * shopNum / AllNum;
|
|
rate = Math.Round((decimal)a, 1).ToString() + "%";
|
|
}
|
|
|
|
return rate;
|
|
}
|
|
return "0%";
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 焊口信息 维护事件
|
|
/// <summary>
|
|
/// Grid双击事件
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e)
|
|
{
|
|
if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.PersonId, BLL.Const.HJGL_WeldJointMenuId, BLL.Const.BtnModify))
|
|
{
|
|
PageContext.RegisterStartupScript(Window5.GetShowReference(String.Format("PipelineEdit.aspx?PipelineId={0}", Grid1.SelectedRowID, "编辑 - ")));
|
|
}
|
|
else
|
|
{
|
|
ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
|
}
|
|
}
|
|
|
|
protected void Grid2_RowDoubleClick(object sender, GridRowClickEventArgs e)
|
|
{
|
|
}
|
|
|
|
protected void Grid3_RowDoubleClick(object sender, GridRowClickEventArgs e)
|
|
{
|
|
if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.PersonId, BLL.Const.HJGL_WeldJointMenuId, BLL.Const.BtnModify))
|
|
{
|
|
if (BLL.WeldTaskService.GetWeldTaskByWeldJointId(Grid1.SelectedRowID) != null) //已下任务单,不可修改数据
|
|
{
|
|
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("WeldJointView.aspx?WeldJointId={0}", Grid3.SelectedRowID, "编辑 - ")));
|
|
}
|
|
else
|
|
{
|
|
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("WeldJointEdit.aspx?WeldJointId={0}", Grid3.SelectedRowID, "编辑 - ")));
|
|
}
|
|
}
|
|
else
|
|
{
|
|
ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
|
}
|
|
}
|
|
|
|
protected void btnMenuPipeLineEdit_Click(object sender, EventArgs e)
|
|
{
|
|
if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.PersonId, BLL.Const.HJGL_WeldJointMenuId, BLL.Const.BtnModify))
|
|
{
|
|
if (Grid1.SelectedRowIndexArray.Length == 0)
|
|
{
|
|
Alert.ShowInTop("请至少选择一条记录", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
PageContext.RegisterStartupScript(Window5.GetShowReference(String.Format("PipelineEdit.aspx?PipelineId={0}", Grid1.SelectedRowID, "维护 - ")));
|
|
}
|
|
else
|
|
{
|
|
ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 增加焊口信息
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnNew_Click(object sender, EventArgs e)
|
|
{
|
|
if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.PersonId, Const.HJGL_WeldJointMenuId, Const.BtnAdd))
|
|
{
|
|
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("WeldJointEdit.aspx?PipelineId={0}", this.tvControlItem.SelectedNodeID, "新增 - ")));
|
|
}
|
|
else
|
|
{
|
|
ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 批量增加焊口信息
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnBatchAdd_Click(object sender, EventArgs e)
|
|
{
|
|
if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.PersonId, Const.HJGL_WeldJointMenuId, Const.BtnAdd))
|
|
{
|
|
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("WeldJointBatchEdit.aspx?PipelineId={0}", this.tvControlItem.SelectedNodeID, "新增 - ")));
|
|
}
|
|
else
|
|
{
|
|
ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 焊口信息编辑
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnMenuEdit_Click(object sender, EventArgs e)
|
|
{
|
|
if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.PersonId, BLL.Const.HJGL_WeldJointMenuId, BLL.Const.BtnModify))
|
|
{
|
|
if (Grid3.SelectedRowIndexArray.Length == 0)
|
|
{
|
|
Alert.ShowInTop("请至少选择一条记录", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
if (BLL.WeldTaskService.GetWeldTaskByWeldJointId(Grid3.SelectedRowID) != null) //已下任务单,不可修改数据
|
|
{
|
|
Alert.ShowInTop("该焊口已生成焊接任务单,不能编辑!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("WeldJointEdit.aspx?WeldJointId={0}", Grid3.SelectedRowID, "维护 - ")));
|
|
}
|
|
else
|
|
{
|
|
ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 焊口信息插入
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnMenuInsert_Click(object sender, EventArgs e)
|
|
{
|
|
if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.PersonId, BLL.Const.HJGL_WeldJointMenuId, BLL.Const.BtnModify))
|
|
{
|
|
if (Grid3.SelectedRowIndexArray.Length == 0)
|
|
{
|
|
Alert.ShowInTop("请至少选择一条记录", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("WeldJointEdit.aspx?WeldJointId={0}&Type=add", Grid3.SelectedRowID, "维护 - ")));
|
|
}
|
|
else
|
|
{
|
|
ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 焊口信息查看
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnView_Click(object sender, EventArgs e)
|
|
{
|
|
if (Grid3.SelectedRowIndexArray.Length == 0)
|
|
{
|
|
Alert.ShowInTop("请至少选择一条记录", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("WeldJointView.aspx?WeldJointId={0}", Grid3.SelectedRowID, "维护 - ")));
|
|
}
|
|
|
|
#region 右键菜单删除
|
|
|
|
protected void btnMenuPipeLineDelete_Click(object sender, EventArgs e)
|
|
{
|
|
if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.PersonId, Const.HJGL_WeldJointMenuId, Const.BtnDelete))
|
|
{
|
|
if (Grid1.SelectedRowIndexArray.Length == 0)
|
|
{
|
|
Alert.ShowInTop("请至少选择一条记录", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
|
|
bool isShow = true;
|
|
if (Grid1.SelectedRowIndexArray.Length > 1)
|
|
{
|
|
isShow = false;
|
|
}
|
|
foreach (int rowIndex in Grid1.SelectedRowIndexArray)
|
|
{
|
|
string rowID = Grid1.DataKeys[rowIndex][0].ToString();
|
|
if (judgePipeLineDelete(rowID, isShow))
|
|
{
|
|
BLL.PipelineService.DeletePipeline(rowID);
|
|
//BLL.Sys_LogService.AddLog(BLL.Const.System_6, this.CurrUser.LoginProjectId, this.CurrUser.PersonId, Const.HJGL_PipelineMenuId, Const.BtnDelete, rowID);
|
|
ShowNotify("删除成功!", MessageBoxIcon.Success);
|
|
}
|
|
}
|
|
|
|
this.InitTreeMenu();
|
|
}
|
|
else
|
|
{
|
|
ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
|
}
|
|
}
|
|
|
|
protected void btnMenuPipeLineAllDelete_Click(object sender, EventArgs e)
|
|
{
|
|
if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.PersonId, Const.HJGL_WeldJointMenuId, Const.BtnDelete))
|
|
{
|
|
if (this.tvControlItem.SelectedNode.CommandName != "管线")
|
|
{
|
|
Alert.ShowInTop("请选择一条管线!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
string pipelineId = this.tvControlItem.SelectedNodeID;
|
|
var weldJoints = from x in Funs.DB.HJGL_WeldJoint
|
|
where x.PipelineId == pipelineId && x.WeldingDailyId != null
|
|
select x;
|
|
if (weldJoints.Count() > 0)
|
|
{
|
|
Alert.ShowInTop("存在已焊接的焊口,无法删除管线!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
BLL.WeldJointService.DeleteWeldJointByPipelineId(pipelineId);
|
|
BLL.PipelineService.DeletePipeline(pipelineId);
|
|
//BLL.Sys_LogService.AddLog(BLL.Const.System_6, this.CurrUser.LoginProjectId, this.CurrUser.PersonId, Const.HJGL_PipelineMenuId, Const.BtnDelete, rowID);
|
|
ShowNotify("删除成功!", MessageBoxIcon.Success);
|
|
|
|
|
|
this.InitTreeMenu();
|
|
}
|
|
else
|
|
{
|
|
ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
|
}
|
|
}
|
|
|
|
protected void btnDelMat_Click(object sender, EventArgs e)
|
|
{
|
|
if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.PersonId, Const.HJGL_WeldJointMenuId, Const.BtnDelete))
|
|
{
|
|
if (Grid2.SelectedRowIndexArray.Length == 0)
|
|
{
|
|
Alert.ShowInTop("请至少选择一条记录", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
|
|
foreach (int rowIndex in Grid2.SelectedRowIndexArray)
|
|
{
|
|
string rowID = Grid2.DataKeys[rowIndex][0].ToString();
|
|
|
|
BLL.PipelineMatService.DeletePipeLineMat(rowID);
|
|
//BLL.Sys_LogService.AddLog(BLL.Const.System_6, this.CurrUser.LoginProjectId, this.CurrUser.PersonId, Const.HJGL_PipelineMenuId, Const.BtnDelete, rowID);
|
|
ShowNotify("删除成功!", MessageBoxIcon.Success);
|
|
|
|
}
|
|
|
|
this.BindGrid2(this.Grid1.SelectedRowID);
|
|
}
|
|
else
|
|
{
|
|
ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 焊口删除按钮
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnMenuDelete_Click(object sender, EventArgs e)
|
|
{
|
|
if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.PersonId, Const.HJGL_WeldJointMenuId, Const.BtnDelete))
|
|
{
|
|
if (Grid3.SelectedRowIndexArray.Length == 0)
|
|
{
|
|
Alert.ShowInTop("请至少选择一条记录", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
|
|
bool isShow = true;
|
|
if (Grid3.SelectedRowIndexArray.Length > 1)
|
|
{
|
|
isShow = false;
|
|
}
|
|
foreach (int rowIndex in Grid3.SelectedRowIndexArray)
|
|
{
|
|
string rowID = Grid3.DataKeys[rowIndex][0].ToString();
|
|
if (judgementDelete(rowID, isShow))
|
|
{
|
|
BLL.WeldJointService.DeleteWeldJointById(rowID);
|
|
ShowNotify("删除成功!", MessageBoxIcon.Success);
|
|
//BLL.Sys_LogService.AddLog(BLL.Const.System_6, this.CurrUser.LoginProjectId, this.CurrUser.PersonId, Const.HJGL_WeldJointMenuId, Const.BtnDelete, rowID);
|
|
}
|
|
}
|
|
this.InitTreeMenu();//加载树
|
|
this.BindGrid3(this.tvControlItem.SelectedNodeID);
|
|
}
|
|
else
|
|
{
|
|
Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
#region 报表打印
|
|
/// <summary>
|
|
/// 报表打印
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnPrint_Click(object sender, EventArgs e)
|
|
{
|
|
string pipelineId = this.tvControlItem.SelectedNodeID;
|
|
var q = BLL.PipelineService.GetPipelineByPipelineId(pipelineId);
|
|
|
|
if (q != null)
|
|
{
|
|
var jotCount = (from x in Funs.DB.HJGL_WeldJoint where x.PipelineId == pipelineId select x).Count();
|
|
var weldJotCount = (from x in Funs.DB.HJGL_WeldJoint where x.PipelineId == pipelineId && x.WeldingDailyId != null select x).Count();
|
|
if (jotCount == weldJotCount)
|
|
{
|
|
string varValue = string.Empty;
|
|
var project = BLL.ProjectService.GetProjectByProjectId(this.CurrUser.LoginProjectId);
|
|
if (project != null)
|
|
{
|
|
varValue = project.ProjectName;
|
|
var unitWork = BLL.UnitWorkService.GetUnitWorkByUnitWorkId(q.UnitWorkId);
|
|
if (unitWork != null)
|
|
{
|
|
varValue = varValue + "|" + unitWork.UnitWorkName;
|
|
}
|
|
}
|
|
List<SqlParameter> listStr = new List<SqlParameter>();
|
|
listStr.Add(new SqlParameter("@IsoId", pipelineId));
|
|
listStr.Add(new SqlParameter("@Flag", "0"));
|
|
SqlParameter[] parameter = listStr.ToArray();
|
|
DataTable tb = BLL.SQLHelper.GetDataTableRunProc("HJGL_spJointWorkRecordNew", parameter);
|
|
string page = Funs.GetPagesCountByPageSize(11, 16, tb.Rows.Count).ToString();
|
|
|
|
|
|
varValue = varValue + "|" + page;
|
|
|
|
if (!string.IsNullOrEmpty(varValue))
|
|
{
|
|
varValue = HttpUtility.UrlEncodeUnicode(varValue);
|
|
}
|
|
if (tb.Rows.Count <= 11)
|
|
{
|
|
PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("../../ReportPrint/ExReportPrint.aspx?ispop=1&reportId={0}&replaceParameter={1}&varValue={2}&projectId={3}", BLL.Const.HJGL_JointInfoReport1Id, pipelineId, varValue, this.CurrUser.LoginProjectId)));
|
|
}
|
|
else
|
|
{
|
|
PageContext.RegisterStartupScript(Window3.GetShowReference(String.Format("../../ReportPrint/ExReportPrint.aspx?ispop=1&reportId={0}&replaceParameter={1}&varValue={2}&projectId={3}", BLL.Const.HJGL_JointInfoReport2Id, pipelineId, varValue, this.CurrUser.LoginProjectId)));
|
|
PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("../../ReportPrint/ExReportPrint.aspx?ispop=1&reportId={0}&replaceParameter={1}&varValue={2}&projectId={3}", BLL.Const.HJGL_JointInfoReport1Id, pipelineId, varValue, this.CurrUser.LoginProjectId)));
|
|
}
|
|
}
|
|
else
|
|
{
|
|
ShowNotify("请选择焊接完成管线!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
}
|
|
|
|
else
|
|
{
|
|
ShowNotify("请选择管线!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 关闭弹出窗口及刷新页面
|
|
/// <summary>
|
|
/// 关闭弹出窗口
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Window1_Close(object sender, WindowCloseEventArgs e)
|
|
{
|
|
//this.InitTreeMenu();//加载树
|
|
this.BindGrid3(this.tvControlItem.SelectedNodeID);
|
|
}
|
|
|
|
protected void Window4_Close(object sender, WindowCloseEventArgs e)
|
|
{
|
|
this.BindGrid3(this.tvControlItem.SelectedNodeID);
|
|
//显示列
|
|
//Model.Sys_UserShowColumns c = BLL.UserShowColumnsService.GetColumnsByUserId(this.CurrUser.PersonId, "Joint");
|
|
//if (c != null)
|
|
//{
|
|
// this.GetShowColumn(c.Columns);
|
|
//}
|
|
}
|
|
|
|
protected void Window5_Close(object sender, WindowCloseEventArgs e)
|
|
{
|
|
this.BindGrid1(this.tvControlItem.SelectedNodeID);
|
|
}
|
|
|
|
/// <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 txtWeldJointCode_TextChanged(object sender, EventArgs e)
|
|
{
|
|
this.BindGrid3(this.tvControlItem.SelectedNodeID);
|
|
}
|
|
|
|
protected void txtMaterialCode_TextChanged(object sender, EventArgs e)
|
|
{
|
|
this.BindGrid2(this.tvControlItem.SelectedNodeID);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 选项卡改变事件
|
|
/// <summary>
|
|
/// 选项卡改变事件
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void TabStrip1_TabIndexChanged(object sender, EventArgs e)
|
|
{
|
|
if (this.TabStrip1.ActiveTabIndex == 0)
|
|
{
|
|
|
|
BindGrid3(this.tvControlItem.SelectedNodeID);
|
|
|
|
}
|
|
else if (this.TabStrip1.ActiveTabIndex == 1)
|
|
{
|
|
BindGrid2(this.tvControlItem.SelectedNodeID);
|
|
}
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
#region 判断是否可删除
|
|
|
|
private bool judgePipeLineDelete(string id, bool isShow)
|
|
{
|
|
string content = string.Empty;
|
|
|
|
var q = from x in Funs.DB.HJGL_WeldJoint where x.PipelineId == id select x;
|
|
var c = from x in Funs.DB.HJGL_Pipeline_Component where x.PipelineId == id select x;
|
|
if (q.Count() > 0)
|
|
{
|
|
content = "该管线已有焊口,无法删除!";
|
|
}
|
|
if (c.Count() > 0)
|
|
{
|
|
content = content + "该管线已有组件属性,无法删除!";
|
|
}
|
|
|
|
if (string.IsNullOrEmpty(content))
|
|
{
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
if (isShow)
|
|
{
|
|
Alert.ShowInTop(content, MessageBoxIcon.Error);
|
|
}
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 判断是否可以删除
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
private bool judgementDelete(string id, bool isShow)
|
|
{
|
|
string content = string.Empty;
|
|
if (BLL.WeldTaskService.GetWeldTaskByWeldJointId(id) != null)
|
|
{
|
|
content = "该焊口已生成焊接任务单,不能删除!";
|
|
}
|
|
//if (!string.IsNullOrEmpty(BLL.WeldJointService.GetWeldJointByWeldJointId(id).WeldingDailyId))
|
|
//{
|
|
// content = "该焊口已焊接,不能删除!";
|
|
//}
|
|
//if (BLL.Funs.DB.HJGL_HotProess_TrustItem.FirstOrDefault(x => x.WeldJointId == id) != null)
|
|
//{
|
|
// content = "热处理已经使用了该焊口,不能删除!";
|
|
//}
|
|
|
|
if (string.IsNullOrEmpty(content))
|
|
{
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
if (isShow)
|
|
{
|
|
Alert.ShowInTop(content, MessageBoxIcon.Error);
|
|
}
|
|
return false;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 导出焊口信息
|
|
/// <summary>
|
|
/// 导出焊口信息
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnOut_Click(object sender, EventArgs e)
|
|
{
|
|
//var iso = BLL.Pipeline_PipelineService.GetPipelineByPipelineId(this.tvControlItem.SelectedNodeID);
|
|
//var workArea = BLL.Project_WorkAreaService.GetProject_WorkAreaByWorkAreaId(this.tvControlItem.SelectedNodeID);
|
|
//if (iso != null)
|
|
//{
|
|
// PageContext.RegisterStartupScript(Window3.GetShowReference(String.Format("JointInfoOut.aspx?PipelineId={0}", this.tvControlItem.SelectedNodeID, "导出 - ")));
|
|
//}
|
|
//else if (workArea != null)
|
|
//{
|
|
// PageContext.RegisterStartupScript(Window3.GetShowReference(String.Format("JointInfoOut.aspx?WorkAreaId={0}", this.tvControlItem.SelectedNodeID, "导出 - ")));
|
|
//}
|
|
//else
|
|
//{
|
|
// Alert.ShowInTop("请选择"PipelineOrArea, MessageBoxIcon.Warning);
|
|
//}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 导出焊口初始信息
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnOut2_Click(object sender, EventArgs e)
|
|
{
|
|
//var iso = BLL.Pipeline_PipelineService.GetPipelineByPipelineId(this.tvControlItem.SelectedNodeID);
|
|
//if (iso != null)
|
|
//{
|
|
// Response.ClearContent();
|
|
// string filename = Funs.GetNewFileName();
|
|
// Response.AddHeader("content-disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode(Resources.Lan.WeldingJointInfo + filename, System.Text.Encoding.UTF8) + ".xls");
|
|
// Response.ContentType = "application/excel";
|
|
// Response.ContentEncoding = System.Text.Encoding.UTF8;
|
|
// this.Grid1.PageSize = 100000;
|
|
// this.BindGrid();
|
|
// Response.Write(GetGridTableHtml(Grid1));
|
|
// Response.End();
|
|
//}
|
|
//else
|
|
//{
|
|
// Alert.ShowInTop("请选择"PipelinetFirst, MessageBoxIcon.Warning);
|
|
//}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 导出方法
|
|
/// </summary>
|
|
/// <param name="grid"></param>
|
|
/// <returns></returns>
|
|
private string GetGridTableHtml(Grid grid)
|
|
{
|
|
StringBuilder sb = new StringBuilder();
|
|
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)
|
|
{
|
|
if (column.HeaderText != "序号")
|
|
{
|
|
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("lblNumber") as AspNet.Label).Text;
|
|
sb.AppendFormat("<td>{0}</td>", html);
|
|
}
|
|
//sb.AppendFormat("<td>{0}</td>", html);
|
|
}
|
|
|
|
sb.Append("</tr>");
|
|
}
|
|
|
|
sb.Append("</table>");
|
|
|
|
return sb.ToString();
|
|
}
|
|
#endregion
|
|
|
|
#region 导入
|
|
/// <summary>
|
|
/// 导入按钮
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnImport_Click(object sender, EventArgs e)
|
|
{
|
|
Model.WBS_UnitWork unitWork = BLL.UnitWorkService.GetUnitWorkByUnitWorkId(this.tvControlItem.SelectedNodeID);
|
|
if (unitWork != null)
|
|
{
|
|
PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("PipelineListIn.aspx?UnitWorkId={0}", this.tvControlItem.SelectedNodeID, "导入 - ")));
|
|
}
|
|
else
|
|
{
|
|
ShowNotify("请先选择单位工程!", MessageBoxIcon.Warning);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 更新导入
|
|
/// <summary>
|
|
/// 更新导入按钮
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnUpdateImport_Click(object sender, EventArgs e)
|
|
{
|
|
Model.WBS_UnitWork unitWork = BLL.UnitWorkService.GetUnitWorkByUnitWorkId(this.tvControlItem.SelectedNodeID);
|
|
if (unitWork != null)
|
|
{
|
|
PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("PipelineListUpdateIn.aspx?UnitWorkId={0}", this.tvControlItem.SelectedNodeID, "更新导入 - ")));
|
|
}
|
|
else
|
|
{
|
|
ShowNotify("请先选择单位工程!", MessageBoxIcon.Warning);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region PDMS导入
|
|
/// <summary>
|
|
/// 导入按钮
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnPDMSImport_Click(object sender, EventArgs e)
|
|
{
|
|
Model.WBS_UnitWork unitWork = BLL.UnitWorkService.GetUnitWorkByUnitWorkId(this.tvControlItem.SelectedNodeID);
|
|
if (unitWork != null)
|
|
{
|
|
PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("PipelineListPDMSIn.aspx?UnitWorkId={0}", this.tvControlItem.SelectedNodeID, "导入 - ")));
|
|
}
|
|
else
|
|
{
|
|
ShowNotify("请先选择单位工程!", MessageBoxIcon.Warning);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 管线材料导入
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnMatImport_Click(object sender, EventArgs e)
|
|
{
|
|
PageContext.RegisterStartupScript(Window4.GetShowReference(String.Format("PipelineMatIn.aspx", "导入 - ")));
|
|
}
|
|
#endregion
|
|
|
|
protected string ConvertDetectionType(object detectionType)
|
|
{
|
|
string detectionName = string.Empty;
|
|
if (detectionType != null)
|
|
{
|
|
string[] types = detectionType.ToString().Split('|');
|
|
foreach (string t in types)
|
|
{
|
|
var type = BLL.Base_DetectionTypeService.GetDetectionTypeByDetectionTypeId(t);
|
|
if (type != null)
|
|
{
|
|
detectionName += type.DetectionTypeCode + ",";
|
|
}
|
|
}
|
|
}
|
|
if (detectionName != string.Empty)
|
|
{
|
|
return detectionName.Substring(0, detectionName.Length - 1);
|
|
}
|
|
else
|
|
{
|
|
return "";
|
|
}
|
|
}
|
|
|
|
#region 选择要显示列 不用了
|
|
/// <summary>
|
|
/// 选择显示列
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnSelectColumn_Click(object sender, EventArgs e)
|
|
{
|
|
//((FineUIPro.GroupField)this.Grid1.Columns[1]).Columns[0];
|
|
PageContext.RegisterStartupScript(Window4.GetShowReference(String.Format("JointShowColumn.aspx", "显示列 - ")));
|
|
}
|
|
#endregion
|
|
|
|
#region 显示列 不用了
|
|
/// <summary>
|
|
/// 显示的列
|
|
/// </summary>
|
|
/// <param name="column"></param>
|
|
private void GetShowColumn(string column)
|
|
{
|
|
if (!string.IsNullOrEmpty(column))
|
|
{
|
|
this.Grid1.Columns[1].Hidden = true;
|
|
((FineUIPro.GroupField)this.Grid1.Columns[1]).Columns[1].Hidden = true;
|
|
((FineUIPro.GroupField)this.Grid1.Columns[1]).Columns[2].Hidden = true;
|
|
((FineUIPro.GroupField)this.Grid1.Columns[1]).Columns[3].Hidden = true;
|
|
((FineUIPro.GroupField)this.Grid1.Columns[1]).Columns[4].Hidden = true;
|
|
((FineUIPro.GroupField)this.Grid1.Columns[1]).Columns[5].Hidden = true;
|
|
((FineUIPro.GroupField)this.Grid1.Columns[1]).Columns[6].Hidden = true;
|
|
((FineUIPro.GroupField)this.Grid1.Columns[1]).Columns[7].Hidden = true;
|
|
((FineUIPro.GroupField)this.Grid1.Columns[1]).Columns[8].Hidden = true;
|
|
((FineUIPro.GroupField)this.Grid1.Columns[1]).Columns[9].Hidden = true;
|
|
this.Grid1.Columns[2].Hidden = true;
|
|
((FineUIPro.GroupField)this.Grid1.Columns[2]).Columns[0].Hidden = true;
|
|
((FineUIPro.GroupField)this.Grid1.Columns[2]).Columns[1].Hidden = true;
|
|
((FineUIPro.GroupField)this.Grid1.Columns[2]).Columns[2].Hidden = true;
|
|
((FineUIPro.GroupField)this.Grid1.Columns[2]).Columns[3].Hidden = true;
|
|
((FineUIPro.GroupField)this.Grid1.Columns[2]).Columns[4].Hidden = true;
|
|
((FineUIPro.GroupField)this.Grid1.Columns[2]).Columns[5].Hidden = true;
|
|
((FineUIPro.GroupField)this.Grid1.Columns[2]).Columns[6].Hidden = true;
|
|
this.Grid1.Columns[3].Hidden = true;
|
|
List<string> columns = column.Split(',').ToList();
|
|
foreach (var item in columns)
|
|
{
|
|
if (!string.IsNullOrEmpty(item))
|
|
{
|
|
if (item.Length == 1)
|
|
{
|
|
this.Grid1.Columns[Convert.ToInt32(item)].Hidden = false;
|
|
}
|
|
else
|
|
{
|
|
int c1 = Convert.ToInt32(item.Substring(0, 1));
|
|
int c2 = Convert.ToInt32(item.Substring(1, 1));
|
|
this.Grid1.Columns[c1].Hidden = false;
|
|
((FineUIPro.GroupField)this.Grid1.Columns[c1]).Columns[c2].Hidden = false;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
}
|
|
} |