2022-09-05 16:36:31 +08:00
|
|
|
|
using BLL;
|
|
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Data;
|
|
|
|
|
|
using System.Data.SqlClient;
|
2022-12-12 14:08:35 +08:00
|
|
|
|
using System.Drawing;
|
2022-09-05 16:36:31 +08:00
|
|
|
|
using System.IO;
|
|
|
|
|
|
using System.Linq;
|
2022-12-12 14:08:35 +08:00
|
|
|
|
using System.Runtime.InteropServices;
|
2022-09-05 16:36:31 +08:00
|
|
|
|
using System.Web;
|
|
|
|
|
|
|
|
|
|
|
|
namespace FineUIPro.Web.HJGL.PreDesign
|
|
|
|
|
|
{
|
|
|
|
|
|
public partial class PrePipeline : PageBase
|
|
|
|
|
|
{
|
2022-12-12 14:08:35 +08:00
|
|
|
|
public int pageSize = 20;
|
|
|
|
|
|
|
2022-09-05 16:36:31 +08:00
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!IsPostBack)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.ddlPageSize.SelectedValue = this.Grid1.PageSize.ToString();
|
|
|
|
|
|
this.InitTreeMenu();//加载树
|
2022-09-23 22:29:48 +08:00
|
|
|
|
HJGL_PipelineComponentService.InitMainItemDownList(drpState,true);
|
2023-02-20 10:49:51 +08:00
|
|
|
|
HJGL_PipelineComponentService.InitMainItemDownProductionStateList(drpProductionState,true);
|
2022-09-23 22:29:48 +08:00
|
|
|
|
|
|
|
|
|
|
|
2022-09-05 16:36:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#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)
|
|
|
|
|
|
{
|
2023-02-21 16:36:13 +08:00
|
|
|
|
int a = (from x in Funs.DB.HJGL_Pipeline where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == q.UnitWorkId && x.PipeArea == "1" && x.PipelineCode.Contains(txtPipelineCode.Text.Trim()) select x).Count();
|
2022-09-05 16:36:31 +08:00
|
|
|
|
var u = BLL.UnitService.GetUnitByUnitId(q.UnitId);
|
|
|
|
|
|
TreeNode tn1 = new TreeNode();
|
|
|
|
|
|
tn1.NodeID = q.UnitWorkId;
|
|
|
|
|
|
tn1.Text = q.UnitWorkName + "【" + a.ToString() + "】" + "管线";
|
|
|
|
|
|
tn1.ToolTip = "施工单位:" + u.UnitName;
|
2022-12-12 14:08:35 +08:00
|
|
|
|
tn1.CommandName = 1+"|"+Funs.GetEndPageNumber(a, pageSize);
|
|
|
|
|
|
tn1.EnableClickEvent = true;
|
|
|
|
|
|
tn1.EnableExpandEvent = true;
|
2022-09-05 16:36:31 +08:00
|
|
|
|
rootNode1.Nodes.Add(tn1);
|
|
|
|
|
|
if (a > 0)
|
|
|
|
|
|
{
|
2022-12-12 14:08:35 +08:00
|
|
|
|
// BindNodes(tn1);
|
|
|
|
|
|
TreeNode newNode = new TreeNode();
|
|
|
|
|
|
newNode.Text = "加载管线...";
|
|
|
|
|
|
newNode.NodeID = "加载管线...";
|
|
|
|
|
|
tn1.Nodes.Add(newNode);
|
2022-09-05 16:36:31 +08:00
|
|
|
|
}
|
2022-12-12 14:08:35 +08:00
|
|
|
|
//if (a > 0)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// BindNodes(tn1);
|
|
|
|
|
|
//}
|
2022-09-05 16:36:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (unitWork2.Count() > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
foreach (var q in unitWork2)
|
|
|
|
|
|
{
|
2023-02-21 16:36:13 +08:00
|
|
|
|
int a = (from x in Funs.DB.HJGL_Pipeline where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == q.UnitWorkId && x.PipeArea == "1" && x.PipelineCode.Contains(txtPipelineCode.Text.Trim()) select x).Count();
|
2022-09-05 16:36:31 +08:00
|
|
|
|
var u = BLL.UnitService.GetUnitByUnitId(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 = "施工单位:" + u.UnitName;
|
2022-12-12 14:08:35 +08:00
|
|
|
|
tn2.CommandName = 1 + "|" + Funs.GetEndPageNumber(a, pageSize);
|
|
|
|
|
|
tn2.EnableClickEvent = true;
|
|
|
|
|
|
tn2.EnableExpandEvent = true;
|
2022-09-05 16:36:31 +08:00
|
|
|
|
rootNode2.Nodes.Add(tn2);
|
|
|
|
|
|
if (a > 0)
|
|
|
|
|
|
{
|
2022-12-12 14:08:35 +08:00
|
|
|
|
// BindNodes(tn1);
|
|
|
|
|
|
TreeNode newNode = new TreeNode();
|
|
|
|
|
|
newNode.Text = "加载管线...";
|
|
|
|
|
|
newNode.NodeID = "加载管线...";
|
|
|
|
|
|
tn2.Nodes.Add(newNode);
|
2022-09-05 16:36:31 +08:00
|
|
|
|
}
|
2022-12-12 14:08:35 +08:00
|
|
|
|
//if (a > 0)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// BindNodes(tn2);
|
|
|
|
|
|
//}
|
2022-09-05 16:36:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2022-12-12 14:08:35 +08:00
|
|
|
|
|
2022-09-05 16:36:31 +08:00
|
|
|
|
private void BindNodes(TreeNode node)
|
2022-12-12 14:08:35 +08:00
|
|
|
|
{
|
2022-09-05 16:36:31 +08:00
|
|
|
|
List<Model.HJGL_Pipeline> pipeline = new List<Model.HJGL_Pipeline>();
|
2022-12-30 15:36:30 +08:00
|
|
|
|
var pipelines = from x in Funs.DB.HJGL_Pipeline where x.ProjectId == this.CurrUser.LoginProjectId && x.PipeArea == "1" select x;
|
2022-09-05 16:36:31 +08:00
|
|
|
|
pipeline = (from x in pipelines
|
|
|
|
|
|
where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == node.NodeID
|
|
|
|
|
|
&& x.PipelineCode.Contains(this.txtPipelineCode.Text.Trim())
|
|
|
|
|
|
orderby x.PipelineCode
|
|
|
|
|
|
select x).ToList();
|
2022-12-12 14:08:35 +08:00
|
|
|
|
int pageindex =int.Parse(node.CommandName.Split('|')[0]);
|
|
|
|
|
|
int pageCount= int.Parse(node.CommandName.Split('|')[1]);
|
|
|
|
|
|
if (pageindex <= pageCount)
|
2022-09-05 16:36:31 +08:00
|
|
|
|
{
|
2022-12-12 14:08:35 +08:00
|
|
|
|
pipeline = pipeline.Skip(pageSize * (pageindex - 1)).Take(pageSize).ToList();
|
|
|
|
|
|
foreach (var item in pipeline)
|
|
|
|
|
|
{
|
|
|
|
|
|
var comCount = (from x in Funs.DB.HJGL_Pipeline_Component where x.PipelineId == item.PipelineId select x).Count();
|
|
|
|
|
|
TreeNode newNode = new TreeNode();
|
|
|
|
|
|
newNode.Text = item.PipelineCode + "【" + comCount.ToString() + " " + "组件" + "】";
|
|
|
|
|
|
newNode.ToolTip = "管线号【组件数】";
|
2023-02-21 16:36:13 +08:00
|
|
|
|
newNode.CommandName = "管线";
|
2022-12-12 14:08:35 +08:00
|
|
|
|
newNode.NodeID = item.PipelineId;
|
|
|
|
|
|
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
|
|
|
|
}
|
2022-12-12 14:08:35 +08:00
|
|
|
|
|
|
|
|
|
|
|
2022-09-05 16:36:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
2022-12-12 14:08:35 +08:00
|
|
|
|
protected void tvControlItem_TreeNodeExpanded(object sender, TreeNodeEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (e.Node.Nodes[0].NodeID == "加载管线...")
|
|
|
|
|
|
{
|
|
|
|
|
|
e.Node.Nodes.Clear();
|
|
|
|
|
|
BindNodes(e.Node);
|
|
|
|
|
|
}
|
2022-09-05 16:36:31 +08:00
|
|
|
|
|
2022-12-12 14:08:35 +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-21 16:36:13 +08:00
|
|
|
|
if (e.CommandName.Split('|').Length == 2)
|
2022-09-05 16:36:31 +08:00
|
|
|
|
{
|
2023-02-21 16:36:13 +08:00
|
|
|
|
this.hdUnitWorkId.Text = this.tvControlItem.SelectedNodeID;
|
|
|
|
|
|
|
|
|
|
|
|
WeldingDailyService.InitDownListByUnitWortId(drpWeldingDailyCode, true, this.tvControlItem.SelectedNodeID);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (e.CommandName == "管线")
|
|
|
|
|
|
{
|
|
|
|
|
|
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;
|
|
|
|
|
|
}
|
2022-09-05 16:36:31 +08:00
|
|
|
|
}
|
2023-02-21 16:36:13 +08:00
|
|
|
|
else if (e.CommandName == "加载")
|
2022-12-12 14:08:35 +08:00
|
|
|
|
{
|
|
|
|
|
|
string CommandName = e.Node.ParentNode.CommandName;
|
2023-02-21 16:36:13 +08:00
|
|
|
|
e.Node.ParentNode.CommandName = (int.Parse(CommandName.Split('|')[0]) + 1) + "|" + int.Parse(CommandName.Split('|')[1]);
|
2022-12-12 14:08:35 +08:00
|
|
|
|
TreeNode treeNode = e.Node.ParentNode;
|
|
|
|
|
|
treeNode.Nodes.Remove(e.Node);
|
|
|
|
|
|
BindNodes(e.Node.ParentNode);
|
|
|
|
|
|
}
|
2022-09-05 16:36:31 +08:00
|
|
|
|
this.BindGrid();
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region 数据绑定
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 数据绑定
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private void BindGrid()
|
|
|
|
|
|
{
|
2023-02-21 16:36:13 +08:00
|
|
|
|
string strSql = @" SELECT distinct com.PipelineComponentId,com.PipelineComponentCode,com.BoxNumber,
|
2022-09-05 16:36:31 +08:00
|
|
|
|
com.PipelineId, punit.UnitName AS PreUnit,aunit.UnitName AS AssembleUnit,
|
2023-02-20 10:49:51 +08:00
|
|
|
|
com.QRCode,com.State,com.ProductionState,pipe.PlanStartDate,com.DrawingName,com.ReceiveDate,
|
2022-10-15 15:40:49 +08:00
|
|
|
|
person.PersonName
|
2022-09-05 16:36:31 +08:00
|
|
|
|
FROM HJGL_Pipeline_Component com
|
|
|
|
|
|
LEFT JOIN HJGL_Pipeline pipe ON pipe.PipelineId =com.PipelineId
|
|
|
|
|
|
LEFT JOIN dbo.Base_Unit punit ON punit.UnitId=com.PreUnit
|
|
|
|
|
|
LEFT JOIN dbo.Base_Unit aunit ON aunit.UnitId=com.AssembleUnit
|
2022-10-15 15:40:49 +08:00
|
|
|
|
LEFT JOIN Person_Persons person on com.ReceiveMan=person.PersonId
|
2023-02-21 16:36:13 +08:00
|
|
|
|
LEFT JOIN HJGL_WeldJoint joint on joint.PipelineId =com.PipelineId
|
|
|
|
|
|
WHERE 1=1 ";
|
|
|
|
|
|
List<SqlParameter> listStr = new List<SqlParameter>();
|
2022-09-05 16:36:31 +08:00
|
|
|
|
|
2023-02-21 16:36:13 +08:00
|
|
|
|
if (tvControlItem.SelectedNode.CommandName.Split('|').Length == 2)
|
|
|
|
|
|
{
|
|
|
|
|
|
strSql += " and pipe.UnitWorkId =@UnitWorkId";
|
|
|
|
|
|
listStr.Add(new SqlParameter("@UnitWorkId", this.tvControlItem.SelectedNodeID));
|
2022-09-05 16:36:31 +08:00
|
|
|
|
|
2023-02-21 16:36:13 +08:00
|
|
|
|
}
|
|
|
|
|
|
else if (tvControlItem.SelectedNode.CommandName=="管线")
|
|
|
|
|
|
{
|
|
|
|
|
|
strSql += " and com.PipelineId = @PipelineId ";
|
|
|
|
|
|
listStr.Add(new SqlParameter("@PipelineId", this.tvControlItem.SelectedNodeID));
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (drpWeldingDailyCode.SelectedValue!=Const._Null &&!string.IsNullOrEmpty(drpWeldingDailyCode.SelectedValue))
|
|
|
|
|
|
{
|
|
|
|
|
|
strSql += " and joint.WeldingDailyId = @WeldingDailyId ";
|
|
|
|
|
|
listStr.Add(new SqlParameter("@WeldingDailyId", drpWeldingDailyCode.SelectedValue));
|
|
|
|
|
|
|
|
|
|
|
|
}
|
2022-09-23 22:29:48 +08:00
|
|
|
|
if (!string.IsNullOrEmpty(txtPipelineComponentCode.Text))
|
|
|
|
|
|
{
|
|
|
|
|
|
strSql += " AND com.PipelineComponentCode like @PipelineComponentCode";
|
|
|
|
|
|
listStr.Add(new SqlParameter("@PipelineComponentCode", "%" + this.txtPipelineComponentCode.Text.Trim() + "%"));
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
if (drpState.SelectedValue!=Const._Null)
|
|
|
|
|
|
{
|
|
|
|
|
|
strSql += " AND com.State =@State";
|
|
|
|
|
|
listStr.Add(new SqlParameter("@State", drpState.SelectedValue));
|
|
|
|
|
|
|
|
|
|
|
|
}
|
2023-02-20 10:49:51 +08:00
|
|
|
|
if (drpProductionState.SelectedValue != Const._Null)
|
|
|
|
|
|
{
|
|
|
|
|
|
strSql += " AND com.ProductionState =@ProductionState";
|
|
|
|
|
|
listStr.Add(new SqlParameter("@ProductionState", drpProductionState.SelectedValue.ToString()));
|
2022-09-23 22:29:48 +08:00
|
|
|
|
|
2023-02-20 10:49:51 +08:00
|
|
|
|
}
|
2022-09-05 16:36:31 +08:00
|
|
|
|
SqlParameter[] parameter = listStr.ToArray();
|
|
|
|
|
|
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
|
|
|
|
|
|
|
|
|
|
|
// 2.获取当前分页数据
|
|
|
|
|
|
Grid1.RecordCount = tb.Rows.Count;
|
|
|
|
|
|
var table = this.GetPagedDataTable(Grid1, tb);
|
|
|
|
|
|
Grid1.DataSource = table;
|
|
|
|
|
|
Grid1.DataBind();
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region 分页排序
|
|
|
|
|
|
#region 页索引改变事件
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 页索引改变事件
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
|
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
BindGrid();
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region 排序
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 排序
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
|
protected void Grid1_Sort(object sender, GridSortEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
BindGrid();
|
|
|
|
|
|
}
|
|
|
|
|
|
#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 管线组件信息 维护事件
|
|
|
|
|
|
/// <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_PrePipelineMenuId, BLL.Const.BtnModify))
|
|
|
|
|
|
{
|
|
|
|
|
|
Model.HJGL_Pipeline pipeline = BLL.PipelineService.GetPipelineByPipelineId(this.tvControlItem.SelectedNodeID);
|
|
|
|
|
|
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("PrePipelineEdit.aspx?PipelineComponentId={0}", Grid1.SelectedRowID, "编辑 - ")));
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
protected void btnPrint_Click(object sender, EventArgs e)
|
2022-10-19 15:49:56 +08:00
|
|
|
|
{
|
|
|
|
|
|
Print(tvControlItem.SelectedNodeID,"");
|
|
|
|
|
|
}
|
|
|
|
|
|
private void Print(string PipelineId ,string PipelineComponentId)
|
2022-09-05 16:36:31 +08:00
|
|
|
|
{
|
|
|
|
|
|
BLL.FastReportService.ResetData();
|
|
|
|
|
|
|
2022-10-28 17:01:51 +08:00
|
|
|
|
string strSql = @" SELECT com.PipelineComponentId,com.PipelineComponentCode,com.BoxNumber,unitwork.UnitWorkName,
|
2022-09-05 16:36:31 +08:00
|
|
|
|
com.PipelineId, punit.UnitName AS PreUnit,aunit.UnitName AS AssembleUnit,mat.PrefabricatedComponents,
|
2022-10-08 15:20:07 +08:00
|
|
|
|
com.QRCode,com.State,CONVERT(varchar(100), pipe.PlanStartDate, 23) as PlanStartDate,pipe.PipelineCode,
|
2022-10-28 17:01:51 +08:00
|
|
|
|
('PrePipeline$'+com.PipelineComponentId )as QRCode2,mater.*
|
2022-09-05 16:36:31 +08:00
|
|
|
|
FROM HJGL_Pipeline_Component com
|
|
|
|
|
|
LEFT JOIN HJGL_PipeLineMat mat ON mat.PipeLineMatId=com.PipeLineMatId
|
|
|
|
|
|
LEFT JOIN HJGL_Pipeline pipe ON pipe.PipelineId =com.PipelineId
|
|
|
|
|
|
LEFT JOIN dbo.Base_Unit punit ON punit.UnitId=com.PreUnit
|
|
|
|
|
|
LEFT JOIN dbo.Base_Unit aunit ON aunit.UnitId=com.AssembleUnit
|
2022-10-13 18:52:45 +08:00
|
|
|
|
LEFT JOIN dbo.WBS_UnitWork unitwork on pipe.UnitWorkId=unitwork.UnitWorkId
|
2022-10-28 17:01:51 +08:00
|
|
|
|
LEFT JOIN dbo.Base_Material AS mater ON mater.MaterialId=pipe.MaterialId
|
2022-10-08 15:20:07 +08:00
|
|
|
|
WHERE com.QRCode!=''";
|
2022-09-05 16:36:31 +08:00
|
|
|
|
List<SqlParameter> listStr = new List<SqlParameter> { };
|
|
|
|
|
|
|
|
|
|
|
|
strSql += " AND com.PipelineId =@PipelineId";
|
2022-10-19 15:49:56 +08:00
|
|
|
|
listStr.Add(new SqlParameter("@PipelineId", PipelineId));
|
|
|
|
|
|
if (PipelineComponentId!="")
|
|
|
|
|
|
{
|
|
|
|
|
|
strSql += " AND com.PipelineComponentId =@PipelineComponentId";
|
|
|
|
|
|
listStr.Add(new SqlParameter("@PipelineComponentId", PipelineComponentId));
|
|
|
|
|
|
}
|
2022-09-05 16:36:31 +08:00
|
|
|
|
SqlParameter[] parameter = listStr.ToArray();
|
|
|
|
|
|
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
|
|
|
|
|
if (tb != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
tb.TableName = "Table1";
|
|
|
|
|
|
}
|
|
|
|
|
|
BLL.FastReportService.AddFastreportTable(tb);
|
|
|
|
|
|
string initTemplatePath = "";
|
|
|
|
|
|
string rootPath = Server.MapPath("~/");
|
|
|
|
|
|
initTemplatePath = "File\\Fastreport\\组件打印.frx";
|
|
|
|
|
|
|
|
|
|
|
|
if (File.Exists(rootPath + initTemplatePath))
|
|
|
|
|
|
{
|
|
|
|
|
|
PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("~/Controls/Fastreport.aspx?ReportPath={0}", rootPath + initTemplatePath)));
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <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_PrePipelineMenuId, Const.BtnAdd))
|
|
|
|
|
|
{
|
|
|
|
|
|
Model.HJGL_Pipeline pipeline = BLL.PipelineService.GetPipelineByPipelineId(this.tvControlItem.SelectedNodeID);
|
|
|
|
|
|
if (pipeline != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("PrePipelineEdit.aspx?PipelineId={0}", this.tvControlItem.SelectedNodeID, "新增 - ")));
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
ShowNotify("请选择管线!", MessageBoxIcon.Warning);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
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_PrePipelineMenuId, Const.BtnAdd))
|
|
|
|
|
|
{
|
|
|
|
|
|
Model.HJGL_Pipeline pipeline = BLL.PipelineService.GetPipelineByPipelineId(this.tvControlItem.SelectedNodeID);
|
|
|
|
|
|
if (pipeline != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("PrePipelineBatchEdit.aspx?PipelineId={0}", this.tvControlItem.SelectedNodeID, "新增 - ")));
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
ShowNotify("请选择管线!", MessageBoxIcon.Warning);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 删除按钮
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
|
protected void btnDelete_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.PersonId, Const.HJGL_PrePipelineMenuId, Const.BtnDelete))
|
|
|
|
|
|
{
|
|
|
|
|
|
if (Grid1.SelectedRowIndexArray.Length == 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
Alert.ShowInTop("请至少选择一条记录", MessageBoxIcon.Warning);
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
foreach (int rowIndex in Grid1.SelectedRowIndexArray)
|
|
|
|
|
|
{
|
|
|
|
|
|
string rowID = Grid1.DataKeys[rowIndex][0].ToString();
|
|
|
|
|
|
BLL.HJGL_PipelineComponentService.DeletePipelineComponent(rowID);
|
|
|
|
|
|
ShowNotify("删除成功!", MessageBoxIcon.Success);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
//this.InitTreeMenu();//加载树
|
|
|
|
|
|
this.BindGrid();
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-02-21 16:36:13 +08:00
|
|
|
|
|
|
|
|
|
|
protected void Grid1_RowCommand(object sender, GridCommandEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (e.CommandName == "PreviewQRCode")
|
|
|
|
|
|
{
|
|
|
|
|
|
var ID = e.RowID;
|
|
|
|
|
|
var q = HJGL_PipelineComponentService.GetPipelineComponentById(ID);
|
|
|
|
|
|
string path = "";
|
|
|
|
|
|
if (!string.IsNullOrEmpty(q.QRCode))
|
|
|
|
|
|
{
|
|
|
|
|
|
path = BLL.CreateQRCodeService.CreateCode_Simple(q.QRCode, ID);
|
|
|
|
|
|
if (!string.IsNullOrEmpty(path))
|
|
|
|
|
|
{
|
|
|
|
|
|
string filepath = Funs.SGGLUrl + path.Replace("\\", "//");
|
|
|
|
|
|
|
|
|
|
|
|
ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script type='text/javascript'>window.open('" + filepath + "');</script>");
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (e.CommandName == "cmd_print")
|
|
|
|
|
|
{
|
|
|
|
|
|
string Id = this.Grid1.SelectedRowID;
|
|
|
|
|
|
Print(tvControlItem.SelectedNodeID, Id);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
protected void btnSearch_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
BindGrid();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-09-05 16:36:31 +08:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region 关闭弹出窗口及刷新页面
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 关闭弹出窗口
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
|
protected void Window1_Close(object sender, WindowCloseEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
//this.InitTreeMenu();//加载树
|
|
|
|
|
|
this.BindGrid();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 查询
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
|
protected void TextBox_TextChanged(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.BindGrid();
|
|
|
|
|
|
}
|
2023-02-21 16:36:13 +08:00
|
|
|
|
protected void btnTreeFind_Click1(object sender, EventArgs e)
|
2022-09-05 16:36:31 +08:00
|
|
|
|
{
|
|
|
|
|
|
this.InitTreeMenu();
|
2023-02-21 16:36:13 +08:00
|
|
|
|
|
2022-09-05 16:36:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
2022-09-23 22:29:48 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 搜索
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
2022-09-05 16:36:31 +08:00
|
|
|
|
public string ConvertImageUrlByImage(object str, object id)
|
|
|
|
|
|
{
|
|
|
|
|
|
string path = string.Empty;
|
|
|
|
|
|
if (!string.IsNullOrEmpty(str.ToString()))
|
|
|
|
|
|
{
|
|
|
|
|
|
path = BLL.CreateQRCodeService.CreateCode_Simple(str.ToString(), id.ToString());
|
|
|
|
|
|
path = HttpUtility.HtmlDecode(BLL.UploadAttachmentService.ShowImage("../../", path));
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
return path;
|
|
|
|
|
|
}
|
|
|
|
|
|
public string ConvertState(object state)
|
|
|
|
|
|
{
|
|
|
|
|
|
string StateName = string.Empty;
|
|
|
|
|
|
if (!string.IsNullOrEmpty(state.ToString()))
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
if (state != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
string txt = HJGL_PipelineComponentService.GetState().FirstOrDefault(x => x.Value == state.ToString()).Text;
|
|
|
|
|
|
|
|
|
|
|
|
return txt;
|
|
|
|
|
|
}
|
|
|
|
|
|
return "";
|
|
|
|
|
|
}
|
|
|
|
|
|
return StateName;
|
|
|
|
|
|
}
|
2023-02-20 10:49:51 +08:00
|
|
|
|
public string ConvertProductionState(object state)
|
|
|
|
|
|
{
|
|
|
|
|
|
string StateName = string.Empty;
|
|
|
|
|
|
if (!string.IsNullOrEmpty(state.ToString()))
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
if (state != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
string txt = HJGL_PipelineComponentService.GetProductionState().FirstOrDefault(x => x.Value == state.ToString()).Text;
|
|
|
|
|
|
|
|
|
|
|
|
return txt;
|
|
|
|
|
|
}
|
|
|
|
|
|
return "";
|
|
|
|
|
|
}
|
|
|
|
|
|
return StateName;
|
|
|
|
|
|
}
|
2022-09-05 16:36:31 +08:00
|
|
|
|
protected void btnImportQRCode_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
2022-09-23 00:01:54 +08:00
|
|
|
|
PageContext.RegisterStartupScript(Window3.GetShowReference(String.Format("PrePipelineQRCodeIn.aspx?", "导入 - ")));
|
2022-09-05 16:36:31 +08:00
|
|
|
|
|
|
|
|
|
|
}
|
2022-09-23 22:29:48 +08:00
|
|
|
|
protected void btnSinglePreview_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
//string httpUrl = @"FileUpload\HJGL_DataImport\095e9691-99c2-4f70-8e67-e70c8fa6be9c\2022-06\管道焊接工作记录.pdf";
|
|
|
|
|
|
//var newurl = Funs.SGGLUrl + httpUrl.Replace(Funs.RootPath, "");
|
|
|
|
|
|
var id = Grid1.SelectedRowID;
|
|
|
|
|
|
if (string.IsNullOrEmpty(id))
|
|
|
|
|
|
{
|
2022-10-13 18:52:45 +08:00
|
|
|
|
ShowNotify("请选择相对应的管道预制加工图", MessageBoxIcon.Warning);
|
2022-09-23 22:29:48 +08:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
var SingleName = (from x in Funs.DB.HJGL_Pipeline_Component where x.PipelineComponentId == id select (x.DrawingName)).FirstOrDefault();
|
2022-10-13 18:52:45 +08:00
|
|
|
|
var filemodel = BLL.HJGL_DataImportService.GetLatestFileByFileName(SingleName,"3", this.CurrUser.LoginProjectId);
|
2022-09-23 22:29:48 +08:00
|
|
|
|
if (filemodel != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
string httpUrl = filemodel.FilePath;
|
|
|
|
|
|
PageContext.RegisterStartupScript(Window4.GetShowReference(String.Format("~/AttachFile/Look.aspx?fileUrl={0}", httpUrl, "查看 -")));
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2022-10-13 18:52:45 +08:00
|
|
|
|
ShowNotify("请上传相关管道预制加工图", MessageBoxIcon.Warning);
|
2022-09-23 22:29:48 +08:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-02-21 16:36:13 +08:00
|
|
|
|
|
2022-09-05 16:36:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|