Files
SGGL_SHJ/SGGL/FineUIPro.Web/HJGL/DataImport/MaterialInformation.aspx.cs
T

1094 lines
47 KiB
C#
Raw Normal View History

2022-09-05 16:36:31 +08:00
using BLL;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Web;
namespace FineUIPro.Web.HJGL.DataImport
{
public partial class MaterialInformation : PageBase
{
2023-02-16 17:19:08 +08:00
public int pageSize = PipelineService.pageSize;
2022-09-05 16:36:31 +08:00
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.InitTreeMenu();//加载树
//显示列
//Model.Sys_UserShowColumns c = BLL.UserShowColumnsService.GetColumnsByUserId(this.CurrUser.PersonId, "Joint");
//if (c != null)
//{
// this.GetShowColumn(c.Columns);
//}
2022-09-05 16:36:31 +08:00
}
}
//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
orderby x.UnitWorkCode
2022-09-05 16:36:31 +08:00
select x).ToList();
List<Model.WBS_UnitWork> unitWork1 = null;
List<Model.WBS_UnitWork> unitWork2 = null;
2023-08-30 16:19:19 +08:00
//// 当前为施工单位,只能操作本单位的数据
//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();
2023-08-30 16:19:19 +08:00
//}
2023-02-20 21:59:35 +08:00
//var dbpipeLineMat = from x in Funs.DB.HJGL_PipeLineMat select x;
//var DBpipeline = from x in Funs.DB.HJGL_Pipeline where x.ProjectId == this.CurrUser.LoginProjectId select x;
2022-09-05 16:36:31 +08:00
if (unitWork1.Count() > 0)
{
foreach (var q in unitWork1)
{
var a = GetUnitWorkTestPackagePipelineCount(q.UnitWorkId);
2023-02-20 21:59:35 +08:00
//int a = (from x in DBpipeline
// join y in dbpipeLineMat on x.PipelineId equals y.PipelineId
// where x.PipelineCode.Contains(tvPipeCode.Text.Trim()) && x.UnitWorkId == q.UnitWorkId
// && y.MaterialCode.Contains(txtMaterialCode.Text.Trim())
// select x.PipelineId).Distinct().Count();
2023-10-25 19:44:10 +08:00
var unitNamesUnitIds = BLL.UnitService.getUnitNamesUnitIds(q.UnitId);
2022-09-05 16:36:31 +08:00
TreeNode tn1 = new TreeNode();
tn1.NodeID = q.UnitWorkId;
tn1.Text = q.UnitWorkName + "【" + a.ToString() + "】" + "管线";
2023-10-25 19:44:10 +08:00
tn1.ToolTip = "施工单位:" + unitNamesUnitIds;
tn1.CommandName = "单位工程";
2022-09-05 16:36:31 +08:00
tn1.EnableExpandEvent = true;
tn1.EnableClickEvent = true;
2022-09-05 16:36:31 +08:00
rootNode1.Nodes.Add(tn1);
if (a > 0)
{
BindTestPackageNodes(tn1);
2022-09-05 16:36:31 +08:00
}
}
}
if (unitWork2.Count() > 0)
{
2023-02-20 21:59:35 +08:00
2022-09-05 16:36:31 +08:00
foreach (var q in unitWork2)
{
var a = GetUnitWorkTestPackagePipelineCount(q.UnitWorkId);
2023-02-20 21:59:35 +08:00
//var b = (from x in Funs.DB.HJGL_Pipeline
// join y in Funs.DB.HJGL_PipeLineMat on x.PipelineId equals y.PipelineId
// where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == q.UnitWorkId && y.MaterialCode.Contains(txtMaterialCode.Text.Trim())
// select x).Distinct();
//var b = (from x in DBpipeline
// join y in dbpipeLineMat on x.PipelineId equals y.PipelineId
// where x.PipelineCode.Contains(tvPipeCode.Text.Trim()) && x.UnitWorkId == q.UnitWorkId
// && y.MaterialCode.Contains(txtMaterialCode.Text.Trim())
// select x.PipelineId).Distinct();
//int a = (from x in DBpipeline
// join y in dbpipeLineMat on x.PipelineId equals y.PipelineId
// where x.PipelineCode.Contains(tvPipeCode.Text.Trim()) && x.UnitWorkId == q.UnitWorkId
// && y.MaterialCode.Contains(txtMaterialCode.Text.Trim())
// select x.PipelineId).Distinct().Count();
2023-10-25 19:44:10 +08:00
var unitNamesUnitIds = BLL.UnitService.getUnitNamesUnitIds(q.UnitId);
2022-09-05 16:36:31 +08:00
TreeNode tn2 = new TreeNode();
tn2.NodeID = q.UnitWorkId;
tn2.Text = q.UnitWorkName + "【" + a.ToString() + "】" + "管线";
2023-02-16 17:19:08 +08:00
//if (q.UnitWorkId == this.hdUnitWorkId.Text)
//{
// tn2.Expanded = true;
//}
2023-10-25 19:44:10 +08:00
tn2.ToolTip = "施工单位:" + unitNamesUnitIds;
tn2.CommandName = "单位工程";
2022-09-05 16:36:31 +08:00
tn2.EnableExpandEvent = true;
tn2.EnableClickEvent = true;
rootNode2.Nodes.Add(tn2);
if (a > 0)
{
BindTestPackageNodes(tn2);
2022-09-05 16:36:31 +08:00
}
}
}
}
#endregion
#region
private void BindNodes(TreeNode node)
{
var pipeline = GetTestPackagePipelineList(node.NodeID);
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 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);
}
}
2022-09-05 16:36:31 +08:00
}
#endregion
private int GetUnitWorkTestPackagePipelineCount(string unitWorkId)
{
return (from x in Funs.DB.HJGL_Pipeline
join y in Funs.DB.PTP_PipelineList on x.PipelineId equals y.PipelineId
join z in Funs.DB.PTP_TestPackage on y.PTP_ID equals z.PTP_ID
join m in Funs.DB.HJGL_PipeLineMat.Where(e => (e.MaterialCode != null && e.MaterialCode.Contains(txtMaterialCode.Text.Trim())) || (e.MaterialCode2 != null && e.MaterialCode2.Contains(txtMaterialCode.Text.Trim())))
on x.PipelineId equals m.PipelineId into temp
from m in temp.DefaultIfEmpty()
where x.ProjectId == this.CurrUser.LoginProjectId
&& x.UnitWorkId == unitWorkId
&& z.UnitWorkId == unitWorkId
&& x.PipelineCode.Contains(tvPipeCode.Text.Trim())
&& (string.IsNullOrEmpty(txtMaterialCode.Text.Trim()) || m != null)
select x.PipelineId).Distinct().Count();
}
private void BindTestPackageNodes(TreeNode unitWorkNode)
{
var testPackages = (from x in Funs.DB.PTP_TestPackage
where x.ProjectId == this.CurrUser.LoginProjectId
&& x.UnitWorkId == unitWorkNode.NodeID
orderby x.TestPackageNo
select x).ToList();
foreach (var item in testPackages)
{
int pipelineCount = GetTestPackagePipelineList(item.PTP_ID).Count();
if (pipelineCount == 0)
{
continue;
}
TreeNode newNode = new TreeNode();
newNode.Text = (string.IsNullOrEmpty(item.TestPackageNo) ? "未知" : item.TestPackageNo) + "【" + pipelineCount.ToString() + "】管线";
newNode.NodeID = item.PTP_ID;
newNode.CommandName = 1 + "|" + Funs.GetEndPageNumber(pipelineCount, pageSize);
newNode.EnableClickEvent = true;
newNode.EnableExpandEvent = true;
unitWorkNode.Nodes.Add(newNode);
TreeNode loadNode = new TreeNode();
loadNode.Text = "加载管线...";
loadNode.NodeID = "加载管线...";
newNode.Nodes.Add(loadNode);
}
}
private List<Model.HJGL_Pipeline> GetTestPackagePipelineList(string ptpId)
{
return (from x in Funs.DB.HJGL_Pipeline
join y in Funs.DB.PTP_PipelineList on x.PipelineId equals y.PipelineId
join m in Funs.DB.HJGL_PipeLineMat.Where(e => (e.MaterialCode != null && e.MaterialCode.Contains(txtMaterialCode.Text.Trim())) || (e.MaterialCode2 != null && e.MaterialCode2.Contains(txtMaterialCode.Text.Trim())))
on x.PipelineId equals m.PipelineId into temp
from m in temp.DefaultIfEmpty()
where y.PTP_ID == ptpId
&& x.ProjectId == this.CurrUser.LoginProjectId
&& x.PipelineCode.Contains(tvPipeCode.Text.Trim())
&& (string.IsNullOrEmpty(txtMaterialCode.Text.Trim()) || m != null)
orderby x.PipelineCode
select x).Distinct().ToList();
}
2022-09-05 16:36:31 +08:00
protected void tvControlItem_TreeNodeExpanded(object sender, TreeNodeEventArgs e)
{
if (e.Node.Nodes[0].NodeID == "加载管线...")
2022-09-05 16:36:31 +08:00
{
e.Node.Nodes.Clear();
2023-02-16 17:19:08 +08:00
BindNodes(e.Node);
2022-09-05 16:36:31 +08:00
}
2023-02-16 17:19:08 +08:00
2022-09-05 16:36:31 +08:00
}
#region TreeView
/// <summary>
/// 点击TreeView
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void tvControlItem_NodeCommand(object sender, TreeCommandEventArgs e)
{
2023-02-16 17:19:08 +08:00
if (e.CommandName == "加载")
2022-09-05 16:36:31 +08:00
{
2023-02-16 17:19:08 +08:00
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))
2022-09-05 16:36:31 +08:00
{
2022-09-05 16:36:31 +08:00
Model.HJGL_Pipeline pipeline = BLL.PipelineService.GetPipelineByPipelineId(this.tvControlItem.SelectedNodeID);
this.hdUnitWorkId.Text = string.Empty;
if (pipeline != null)
{
this.hdUnitWorkId.Text = pipeline.UnitWorkId;
2023-02-16 17:19:08 +08:00
2022-09-05 16:36:31 +08:00
this.BindGrid1(this.tvControlItem.SelectedNodeID, this.hdUnitWorkId.Text);
this.BindGrid2(this.tvControlItem.SelectedNodeID, this.hdUnitWorkId.Text);
2024-09-27 18:17:21 +08:00
this.BindGrid3(this.tvControlItem.SelectedNodeID, this.hdUnitWorkId.Text);
2022-10-11 17:12:13 +08:00
if (pipeline.PipeArea == PipelineService.PipeArea_SHOP)
{
TabStrip1.ActiveTabIndex = 0;
}
2023-02-16 17:19:08 +08:00
else
2022-10-11 17:12:13 +08:00
{
TabStrip1.ActiveTabIndex = 1;
}
}
2023-02-16 17:19:08 +08:00
2022-09-05 16:36:31 +08:00
}
2023-02-16 17:19:08 +08:00
2022-09-05 16:36:31 +08:00
}
}
#endregion
#region
/// <summary>
/// 管线数据
/// </summary>
private void BindGrid1(string pipelineId, string unitworkid)
2022-09-05 16:36:31 +08:00
{
string strSql = @" SELECT pipe.PipeLineMatId, pipe.MaterialCode,ISNULL(pipe.MaterialCode2, lib.Code) AS Code,lib.HeatNo,lib.BatchNo,
ISNULL(lib.MaterialName, libCode.MaterialName) AS MaterialName,
ISNULL(lib.MaterialUnit, libCode.MaterialUnit) AS MaterialUnit,
ISNULL(lib.MaterialSpec, libCode.MaterialSpec) AS MaterialSpec,
ISNULL(lib.MaterialMade, libCode.MaterialMade) AS MaterialMade,
ISNULL(lib.MaterialDef, libCode.MaterialDef) AS MaterialDef,
pipe.Number,pipe.PrefabricatedComponents,
CASE pipe.PipeArea WHEN '1' THEN N'工厂预制' WHEN '2' THEN N'现场安装' END AS PipeAreaText,
weld.WeldJointCode
2022-09-05 16:36:31 +08:00
FROM dbo.HJGL_PipeLineMat pipe
LEFT JOIN dbo.HJGL_MaterialCodeLib lib ON lib.MaterialCode = pipe.MaterialCode
LEFT JOIN HJGL_Pipeline line ON pipe.PipelineId=line.PipelineId
OUTER APPLY (SELECT TOP 1 * FROM dbo.HJGL_MaterialCodeLib codeLib WHERE codeLib.ProjectId=line.ProjectId AND codeLib.Code=pipe.MaterialCode2 ORDER BY codeLib.MaterialCode) libCode
LEFT JOIN dbo.HJGL_WeldJoint weld ON weld.WeldJointId = pipe.WeldJointId
WHERE line.UnitWorkId=@UnitWorkId and pipe.PipeArea='1' and pipe.PrefabricatedComponents !='' ";
2022-09-05 16:36:31 +08:00
List<SqlParameter> listStr = new List<SqlParameter>();
2023-02-20 21:59:35 +08:00
//if (!string.IsNullOrEmpty(txtMaterialCode.Text.Trim()))
//{
// strSql += " and lib.MaterialCode like @MaterialCode ";
// listStr.Add(new SqlParameter("@MaterialCode", "%" + txtMaterialCode.Text.Trim() + "%"));
//}
2022-09-05 16:36:31 +08:00
if (!string.IsNullOrEmpty(pipelineId))
{
strSql += " and pipe.PipelineId=@PipelineId ";
2022-09-05 16:36:31 +08:00
listStr.Add(new SqlParameter("@PipelineId", pipelineId));
}
if (!string.IsNullOrEmpty(txtMaterialCode2.Text.Trim()))
{
strSql += " and (pipe.MaterialCode2 like @MaterialCode or lib.MaterialCode like @MaterialCode or lib.Code like @MaterialCode) ";
listStr.Add(new SqlParameter("@MaterialCode", "%" + txtMaterialCode2.Text.Trim() + "%"));
2023-02-16 17:19:08 +08:00
}
strSql += " order by PrefabricatedComponents ";
2022-09-05 16:36:31 +08:00
listStr.Add(new SqlParameter("@UnitWorkId", unitworkid));
SqlParameter[] parameter = listStr.ToArray();
DataTable dt = SQLHelper.GetDataTableRunText(strSql, parameter);
// 2.获取当前分页数据
Grid1.DataSource = dt;
Grid1.DataBind();
}
private void BindGrid2(string pipelineId, string unitworkid)
{
string strSql = @" SELECT pipe.PipeLineMatId, pipe.MaterialCode,ISNULL(pipe.MaterialCode2, lib.Code) AS Code,lib.HeatNo,lib.BatchNo,
ISNULL(lib.MaterialName, libCode.MaterialName) AS MaterialName,
ISNULL(lib.MaterialUnit, libCode.MaterialUnit) AS MaterialUnit,
ISNULL(lib.MaterialSpec, libCode.MaterialSpec) AS MaterialSpec,
ISNULL(lib.MaterialMade, libCode.MaterialMade) AS MaterialMade,
ISNULL(lib.MaterialDef, libCode.MaterialDef) AS MaterialDef,
pipe.Number,
CASE pipe.PipeArea WHEN '1' THEN N'工厂预制' WHEN '2' THEN N'现场安装' END AS PipeAreaText,
weld.WeldJointCode
2022-09-05 16:36:31 +08:00
FROM dbo.HJGL_PipeLineMat pipe
LEFT JOIN dbo.HJGL_MaterialCodeLib lib ON lib.MaterialCode = pipe.MaterialCode
LEFT JOIN HJGL_Pipeline line ON pipe.PipelineId=line.PipelineId
OUTER APPLY (SELECT TOP 1 * FROM dbo.HJGL_MaterialCodeLib codeLib WHERE codeLib.ProjectId=line.ProjectId AND codeLib.Code=pipe.MaterialCode2 ORDER BY codeLib.MaterialCode) libCode
LEFT JOIN dbo.HJGL_WeldJoint weld ON weld.WeldJointId = pipe.WeldJointId
WHERE line.UnitWorkId=@UnitWorkId and pipe.PipeArea='2' ";
2022-09-05 16:36:31 +08:00
List<SqlParameter> listStr = new List<SqlParameter>();
if (!string.IsNullOrEmpty(pipelineId))
{
strSql += " and pipe.PipelineId=@PipelineId ";
listStr.Add(new SqlParameter("@PipelineId", pipelineId));
}
if (!string.IsNullOrEmpty(txtMaterialCode2.Text.Trim()))
{
strSql += " and (pipe.MaterialCode2 like @MaterialCode or lib.MaterialCode like @MaterialCode or lib.Code like @MaterialCode) ";
listStr.Add(new SqlParameter("@MaterialCode", "%" + txtMaterialCode2.Text.Trim() + "%"));
}
strSql += " order by PrefabricatedComponents ";
2022-09-05 16:36:31 +08:00
listStr.Add(new SqlParameter("@UnitWorkId", unitworkid));
SqlParameter[] parameter = listStr.ToArray();
DataTable dt = SQLHelper.GetDataTableRunText(strSql, parameter);
// 2.获取当前分页数据
Grid2.DataSource = dt;
Grid2.DataBind();
}
2024-09-27 18:17:21 +08:00
private void BindGrid3(string pipelineId, string unitworkid)
{
string strSql = @" SELECT pipe.PipeLineMatId, pipe.MaterialCode,ISNULL(pipe.MaterialCode2, lib.Code) AS Code,lib.HeatNo,lib.BatchNo,
ISNULL(lib.MaterialName, libCode.MaterialName) AS MaterialName,
ISNULL(lib.MaterialUnit, libCode.MaterialUnit) AS MaterialUnit,
ISNULL(lib.MaterialSpec, libCode.MaterialSpec) AS MaterialSpec,
ISNULL(lib.MaterialMade, libCode.MaterialMade) AS MaterialMade,
ISNULL(lib.MaterialDef, libCode.MaterialDef) AS MaterialDef,
pipe.Number,pipe.PrefabricatedComponents,
CASE pipe.PipeArea WHEN '1' THEN N'工厂预制' WHEN '2' THEN N'现场安装' END AS PipeAreaText,
weld.WeldJointCode
2024-09-27 18:17:21 +08:00
FROM dbo.HJGL_PipeLineMat pipe
LEFT JOIN dbo.HJGL_MaterialCodeLib lib ON lib.MaterialCode = pipe.MaterialCode
LEFT JOIN HJGL_Pipeline line ON pipe.PipelineId=line.PipelineId
OUTER APPLY (SELECT TOP 1 * FROM dbo.HJGL_MaterialCodeLib codeLib WHERE codeLib.ProjectId=line.ProjectId AND codeLib.Code=pipe.MaterialCode2 ORDER BY codeLib.MaterialCode) libCode
LEFT JOIN dbo.HJGL_WeldJoint weld ON weld.WeldJointId = pipe.WeldJointId
WHERE line.UnitWorkId=@UnitWorkId and pipe.PipeArea='1' and (pipe.PrefabricatedComponents is null or pipe.PrefabricatedComponents='') ";
2024-09-27 18:17:21 +08:00
List<SqlParameter> listStr = new List<SqlParameter>();
//if (!string.IsNullOrEmpty(txtMaterialCode.Text.Trim()))
//{
// strSql += " and lib.MaterialCode like @MaterialCode ";
// listStr.Add(new SqlParameter("@MaterialCode", "%" + txtMaterialCode.Text.Trim() + "%"));
//}
if (!string.IsNullOrEmpty(pipelineId))
{
strSql += " and pipe.PipelineId=@PipelineId ";
listStr.Add(new SqlParameter("@PipelineId", pipelineId));
}
if (!string.IsNullOrEmpty(txtMaterialCode2.Text.Trim()))
{
strSql += " and (pipe.MaterialCode2 like @MaterialCode or lib.MaterialCode like @MaterialCode or lib.Code like @MaterialCode) ";
2024-09-27 18:17:21 +08:00
listStr.Add(new SqlParameter("@MaterialCode", "%" + txtMaterialCode2.Text.Trim() + "%"));
}
strSql += " order by PrefabricatedComponents ";
listStr.Add(new SqlParameter("@UnitWorkId", unitworkid));
SqlParameter[] parameter = listStr.ToArray();
DataTable dt = SQLHelper.GetDataTableRunText(strSql, parameter);
// 2.获取当前分页数据
Grid3.DataSource = dt;
Grid3.DataBind();
}
2022-09-05 16:36:31 +08:00
#endregion
#region
#region
protected void Grid2_Sort(object sender, GridSortEventArgs e)
{
BindGrid2(this.tvControlItem.SelectedNodeID, this.hdUnitWorkId.Text);
2022-09-05 16:36:31 +08:00
}
/// <summary>
/// 排序
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_Sort(object sender, GridSortEventArgs e)
{
BindGrid1(this.tvControlItem.SelectedNodeID, this.hdUnitWorkId.Text);
}
#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
protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e)
{
}
/// <summary>
/// Grid双击事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
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);
}
}
2022-09-05 16:36:31 +08:00
/// <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);
}
}
#region
/// <summary>
/// 维护工厂预制材料编码。
/// </summary>
protected void btnEditMatGrid1_Click(object sender, EventArgs e)
{
OpenMaterialCodeEdit(Grid1);
}
/// <summary>
/// 维护现场施工材料编码。
/// </summary>
protected void btnEditMatGrid2_Click(object sender, EventArgs e)
{
OpenMaterialCodeEdit(Grid2);
}
/// <summary>
/// 维护预制散件材料编码。
/// </summary>
protected void btnEditMatGrid3_Click(object sender, EventArgs e)
{
OpenMaterialCodeEdit(Grid3);
}
/// <summary>
2026-07-26 17:52:46 +08:00
/// 打开材料信息维护窗口,按管线材料ID维护材料主编码和材料编码。
/// </summary>
private void OpenMaterialCodeEdit(Grid grid)
{
if (!CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.PersonId, Const.HJGL_WeldJointMenuId, Const.BtnModify))
{
ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
return;
}
if (grid.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInTop("请至少选择一条记录", MessageBoxIcon.Warning);
return;
}
if (grid.SelectedRowIndexArray.Length > 1)
{
Alert.ShowInTop("一次只能编辑一条记录", MessageBoxIcon.Warning);
return;
}
2026-07-26 17:52:46 +08:00
PageContext.RegisterStartupScript(Window5.GetShowReference(String.Format("MaterialInformationEdit.aspx?PipeLineMatId={0}", grid.SelectedRowID), "维护材料信息", 500, 300));
}
2022-09-05 16:36:31 +08:00
2024-12-26 14:42:15 +08:00
protected void btnDelMatGrid2_Click(object sender, EventArgs e)
2022-09-05 16:36:31 +08:00
{
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.BindGrid1(this.tvControlItem.SelectedNodeID, this.hdUnitWorkId.Text);
this.BindGrid2(this.tvControlItem.SelectedNodeID, this.hdUnitWorkId.Text);
2024-09-27 18:17:21 +08:00
this.BindGrid3(this.tvControlItem.SelectedNodeID, this.hdUnitWorkId.Text);
2022-09-05 16:36:31 +08:00
}
else
{
ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
}
}
2024-12-26 14:42:15 +08:00
protected void btnDelMatGrid3_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;
}
foreach (int rowIndex in Grid3.SelectedRowIndexArray)
{
string rowID = Grid3.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.BindGrid1(this.tvControlItem.SelectedNodeID, this.hdUnitWorkId.Text);
this.BindGrid2(this.tvControlItem.SelectedNodeID, this.hdUnitWorkId.Text);
this.BindGrid3(this.tvControlItem.SelectedNodeID, this.hdUnitWorkId.Text);
}
else
{
ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
}
}
2022-11-23 18:22:46 +08:00
protected void btnDelMatGrid1_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;
}
foreach (string rowID in Grid1.SelectedRowIDArray)
{
BLL.PipelineMatService.DeletePipeLineMat(rowID);
ShowNotify("删除成功!", MessageBoxIcon.Success);
}
this.BindGrid1(this.tvControlItem.SelectedNodeID, this.hdUnitWorkId.Text);
this.BindGrid2(this.tvControlItem.SelectedNodeID, this.hdUnitWorkId.Text);
2024-09-27 18:17:21 +08:00
this.BindGrid3(this.tvControlItem.SelectedNodeID, this.hdUnitWorkId.Text);
2022-11-23 18:22:46 +08:00
}
else
{
ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
}
}
2022-09-05 16:36:31 +08:00
#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.BindGrid1(this.tvControlItem.SelectedNodeID, this.hdUnitWorkId.Text);
}
protected void Window4_Close(object sender, WindowCloseEventArgs e)
{
this.BindGrid1(this.tvControlItem.SelectedNodeID, this.hdUnitWorkId.Text);
//显示列
//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, this.hdUnitWorkId.Text);
this.BindGrid2(this.tvControlItem.SelectedNodeID, this.hdUnitWorkId.Text);
this.BindGrid3(this.tvControlItem.SelectedNodeID, this.hdUnitWorkId.Text);
2022-09-05 16:36:31 +08:00
}
/// <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);
}
#endregion
#region
/// <summary>
/// 选项卡改变事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void TabStrip1_TabIndexChanged(object sender, EventArgs e)
{
string pipelineid = "";
if (this.tvControlItem.SelectedNode != null && this.tvControlItem.SelectedNode.CommandName == "管线")
2022-09-05 16:36:31 +08:00
{
pipelineid = this.tvControlItem.SelectedNodeID;
}
if (this.TabStrip1.ActiveTabIndex == 0)
{
2022-09-05 16:36:31 +08:00
BindGrid1(pipelineid, this.hdUnitWorkId.Text);
}
else if (this.TabStrip1.ActiveTabIndex == 1)
{
BindGrid2(pipelineid, this.hdUnitWorkId.Text);
}
2024-09-27 18:17:21 +08:00
else if (this.TabStrip1.ActiveTabIndex == 2)
{
BindGrid3(pipelineid, this.hdUnitWorkId.Text);
}
2022-09-05 16:36:31 +08:00
}
#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>
/// 导出方法btnMatImport_Click
/// </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
2023-02-16 17:19:08 +08:00
/// <summary>
/// 查询
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnQuery_Click(object sender, EventArgs e)
{
this.BindGrid1(this.tvControlItem.SelectedNodeID, this.hdUnitWorkId.Text);
this.BindGrid2(this.tvControlItem.SelectedNodeID, this.hdUnitWorkId.Text);
}
2022-09-05 16:36:31 +08:00
#region 线
2022-09-05 16:36:31 +08:00
/// <summary>
/// 管线材料导入
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnMatImport_Click(object sender, EventArgs e)
{
Model.WBS_UnitWork unitWork = BLL.UnitWorkService.GetUnitWorkByUnitWorkId(this.tvControlItem.SelectedNodeID);
if (unitWork != null)
{
PageContext.RegisterStartupScript(Window4.GetShowReference(String.Format("../WeldingManage/PipelineMatIn.aspx?UnitWorkId={0}", this.tvControlItem.SelectedNodeID, "导入 - ")));
}
else
{
ShowNotify("请先选择单位工程!", MessageBoxIcon.Warning);
}
}
#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)
{
}
2024-09-27 18:17:21 +08:00
2022-09-05 16:36:31 +08:00
#endregion
2022-11-23 18:22:46 +08:00
2024-09-27 18:17:21 +08:00
protected void Grid3_Sort(object sender, GridSortEventArgs e)
{
}
2022-09-05 16:36:31 +08:00
}
}