2023-02-16 焊接修改

This commit is contained in:
2023-02-16 17:19:08 +08:00
parent c19e51a290
commit 75431705fb
28 changed files with 599 additions and 342 deletions
@@ -1,5 +1,6 @@
using Apache.NMS.ActiveMQ.Threads;
using BLL;
using FineUIPro.Web.ProjectData;
using System;
using System.Collections.Generic;
using System.Data;
@@ -15,8 +16,16 @@ 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";
protected void Page_Load(object sender, EventArgs e)
{
@@ -107,8 +116,9 @@ namespace FineUIPro.Web.HJGL.WeldingManage
tn1.NodeID = q.UnitWorkId;
tn1.Text = q.UnitWorkName + "【" + a.ToString() + "】" + "管线";
tn1.ToolTip = "施工单位:" + u.UnitName;
tn1.CommandName = "单位工程";
tn1.CommandName = 1 + "|" + Funs.GetEndPageNumber(a, pageSize);
tn1.EnableExpandEvent = true;
tn1.EnableClickEvent = true;
rootNode1.Nodes.Add(tn1);
if (a > 0)
{
@@ -124,18 +134,21 @@ namespace FineUIPro.Web.HJGL.WeldingManage
{
foreach (var q in unitWork2)
{
int a = (from x in Funs.DB.HJGL_Pipeline where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == q.UnitWorkId select x).Count();
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 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;
}
//if (q.UnitWorkId == this.hdUnitWorkId.Text)
//{
// tn2.Expanded = true;
//}
tn2.ToolTip = "施工单位:" + u.UnitName;
tn2.CommandName = "单位工程";
tn2.CommandName = 1 + "|" + Funs.GetEndPageNumber(a, pageSize);
tn2.EnableExpandEvent = true;
tn2.EnableClickEvent= true;
rootNode2.Nodes.Add(tn2);
if (a > 0)
{
@@ -150,65 +163,46 @@ namespace FineUIPro.Web.HJGL.WeldingManage
}
#endregion
#region
#region
private void BindNodes(TreeNode node)
{
//List<Model.HJGL_Pipeline> pipeline = new List<Model.HJGL_Pipeline>();
//var pipelines = from x in Funs.DB.HJGL_Pipeline select x;
//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();
//foreach (var item in pipeline)
//{
// var jotCount = (from x in Funs.DB.HJGL_WeldJoint where x.PipelineId == item.PipelineId && x.IsTwoJoint == null select x).Count();
// var weldJotCount = (from x in Funs.DB.HJGL_WeldJoint where x.PipelineId == item.PipelineId && x.IsTwoJoint == null && x.WeldingDailyId != null select x).Count();
// TreeNode newNode = new TreeNode();
// if (jotCount > weldJotCount)
// {
// newNode.Text = "<font color='#EE0000'>" + item.PipelineCode + "【" + jotCount.ToString() + " " + "焊口" + "】" + "</font>";
// }
// else
// {
// newNode.Text = item.PipelineCode + "【" + jotCount.ToString() + " " + "焊口" + "】";
// }
// newNode.ToolTip = "管线号【焊口数】";
// newNode.NodeID = item.PipelineId;
// newNode.EnableClickEvent = true;
// node.Nodes.Add(newNode);
//}
BLL.PipelineService.BindTreeNodes(node, this.tvPipeCode.Text.Trim(), this.CurrUser.LoginProjectId,pageSize);
}
#endregion
protected void tvControlItem_TreeNodeExpanded(object sender, TreeNodeEventArgs e)
{
e.Node.Nodes.Clear();
if (e.Node.CommandName == "单位工程")
if (e.Node.Nodes[0].NodeID == "加载管线...")
{
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);
}
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);
// }
//}
}
@@ -220,23 +214,40 @@ namespace FineUIPro.Web.HJGL.WeldingManage
/// <param name="e"></param>
protected void tvControlItem_NodeCommand(object sender, TreeCommandEventArgs e)
{
if (!string.IsNullOrEmpty(this.tvControlItem.SelectedNodeID))
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;
this.BindGrid1(this.tvControlItem.SelectedNodeID);
this.BindGrid2(this.tvControlItem.SelectedNodeID);
this.BindGrid3(this.tvControlItem.SelectedNodeID);
}
else
{
this.hdUnitWorkId.Text = this.tvControlItem.SelectedNodeID;
}
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.Text = GetRateByPipelineid(this.tvControlItem.SelectedNodeID);
}
else
{
this.hdUnitWorkId.Text = this.tvControlItem.SelectedNodeID;
this.lbSinglePreRate.Text = GetRateByUnitWork(this.tvControlItem.SelectedNodeID);
}
this.lbShopSize.Text = ShopSumSize;
this.lbFiledSize.Text = FieldSumSize;
}
}
}
#endregion
@@ -379,11 +390,15 @@ namespace FineUIPro.Web.HJGL.WeldingManage
//}
#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
@@ -393,32 +408,78 @@ namespace FineUIPro.Web.HJGL.WeldingManage
{
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;
var a = (decimal)100 * proSum / AllSum;
var rate = Math.Round((decimal)a, 1);
return rate.ToString()+"%";
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 "";
return "0%";
}
void GetRateByPipelineid(string pipelineid)
private string GetRateByPipelineid(string pipelineid)
{
string rate = "";
ShopSumSize = "0";
FieldSumSize = "0";
var db = Funs.DB;
var q = (from x in db.View_HJGL_WeldJoint
group x by x.PipelineId into g
where g.Key == pipelineid
select new
{
SizeSum = g.Sum(x => x.Size)
}).FirstOrDefault().SizeSum;
var q = from x in db.View_HJGL_WeldJoint where x.PipelineId == pipelineid select x;
if (q != null && q.Count() > 0)
{
var proSum = (from x in q
where x.JointAttribute == "预制口"
group x by x.PipelineId 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.PipelineId into g
select new
{
SizeSum = g.Sum(x => x.Size)
}).FirstOrDefault().SizeSum;
var AllSum = (from x in q
group x by x.PipelineId 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%";
}
#endregion
#region
/// <summary>
/// Grid双击事件