2022-11-23 焊接wbs树加载优化,管线划分数据加载优化

This commit is contained in:
2022-11-23 00:02:22 +08:00
parent fe520d1201
commit 0759a36121
17 changed files with 186 additions and 134 deletions
@@ -81,7 +81,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
{
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();
int a = (from x in PipelineService.hJGL_Pipelines where x.UnitWorkId == q.UnitWorkId select x).Count();
var u = BLL.UnitService.GetUnitByUnitId(q.UnitId);
TreeNode tn1 = new TreeNode();
tn1.NodeID = q.UnitWorkId;
@@ -98,7 +98,7 @@ 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 PipelineService.hJGL_Pipelines where x.UnitWorkId == q.UnitWorkId select x).Count();
var u = BLL.UnitService.GetUnitByUnitId(q.UnitId);
TreeNode tn2 = new TreeNode();
tn2.NodeID = q.UnitWorkId;
@@ -120,9 +120,8 @@ namespace FineUIPro.Web.HJGL.WeldingManage
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
pipeline = (from x in PipelineService.hJGL_Pipelines
where x.UnitWorkId == node.NodeID
&& x.PipelineCode.Contains(this.txtPipelineCode.Text.Trim())
orderby x.PipelineCode
select x).ToList();
@@ -140,8 +139,8 @@ namespace FineUIPro.Web.HJGL.WeldingManage
// newNode.Text = item.PipelineCode + "【" + jotCount.ToString() + " " + "焊口" + "】";
//}
var jotCount = (from x in Funs.DB.HJGL_WeldJoint where x.PipelineId == item.PipelineId && x.IsTwoJoint == true select x).Count();
var AuditCount= (from x in Funs.DB.HJGL_WeldJoint where x.PipelineId == item.PipelineId && x.IsTwoJoint == true && x.AuditDate !=null select x).Count();
var jotCount = (from x in WeldJointService.hJGL_WeldJoints where x.PipelineId == item.PipelineId && x.IsTwoJoint == true select x).Count();
var AuditCount= (from x in WeldJointService.hJGL_WeldJoints where x.PipelineId == item.PipelineId && x.IsTwoJoint == true && x.AuditDate !=null select x).Count();
TreeNode newNode = new TreeNode();
if (jotCount== AuditCount) //全部审核
@@ -1381,6 +1381,8 @@ namespace FineUIPro.Web.HJGL.WeldingManage
}
ShowNotify("导入成功!", MessageBoxIcon.Success);
PipelineService.hJGL_Pipelines = PipelineService.GetPipelinesByProjectId(this.CurrUser.LoginProjectId);
WeldJointService.hJGL_WeldJoints = WeldJointService.GetWeldJointByProjectid(this.CurrUser.LoginProjectId);
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
}
else
@@ -1485,7 +1487,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
#endregion
void addPipelines(List<Model.View_HJGL_WeldJoint> PipelineList, string UnitWorkId)
{
var getPipeline = from x in Funs.DB.View_HJGL_WeldJoint where x.UnitWorkId == UnitWorkId select x;
// var getPipeline = from x in Funs.DB.View_HJGL_WeldJoint where x.UnitWorkId == UnitWorkId select x;
var pipelines = (from x in PipelineList
select new Model.HJGL_Pipeline
{
@@ -1565,8 +1567,8 @@ namespace FineUIPro.Web.HJGL.WeldingManage
pipeline.MaterialId = pipelines[i].MaterialId;
pipeline.Remark = pipelines[i].Remark;
var isExistPipelineCode = getPipeline.FirstOrDefault(x => x.PipelineCode == pipeline.PipelineCode && x.UnitWorkId == UnitWorkId);
if (isExistPipelineCode != null) // 更新管线
var isExistPipelineCode = PipelineService.GetPipelineByCode(pipeline.PipelineCode, pipeline.UnitWorkId);
if (isExistPipelineCode!=null) // 更新管线
{
pipeline.PipelineId = isExistPipelineCode.PipelineId;
BLL.PipelineService.UpdatePipeline(pipeline);
@@ -1582,7 +1584,6 @@ namespace FineUIPro.Web.HJGL.WeldingManage
}
void addHJGL_WeldJoints(List<Model.View_HJGL_WeldJoint> PipelineList, string UnitWorkId)
{
var getweldjonts = from x in Funs.DB.View_HJGL_WeldJoint where x.UnitWorkId == UnitWorkId select x;
var getpipelines= from y in Funs.DB.HJGL_Pipeline where y.UnitWorkId== UnitWorkId select y;
List<Model.HJGL_WeldJoint> weldJoints_add = new List<Model.HJGL_WeldJoint>();
@@ -1637,7 +1638,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
weldJoint.JointAttribute = weldJoints[i].JointAttribute;
weldJoint.ProjectId = weldJoints[i].ProjectId;
var isExistJot = getweldjonts.FirstOrDefault(x => x.PipelineId == weldJoint.PipelineId && x.WeldJointCode == PipelineList[i].WeldJointCode);
var isExistJot = WeldJointService.GetWeldJointsByWeldJointCode(weldJoint.PipelineId, weldJoint.WeldJointCode);
if (isExistJot != null) // 更新焊口
{
weldJoint.WeldJointId = isExistJot.WeldJointId;
@@ -1,21 +1,27 @@
using BLL;
using Apache.NMS.ActiveMQ.Threads;
using BLL;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web;
namespace FineUIPro.Web.HJGL.WeldingManage
{
public partial class WeldJointList : PageBase
{
public static List<Model.HJGL_WeldJoint> WeldJointlist = new List<Model.HJGL_WeldJoint>();
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");
@@ -173,36 +179,33 @@ namespace FineUIPro.Web.HJGL.WeldingManage
//}
}
#endregion
protected void tvControlItem_TreeNodeExpanded(object sender, TreeNodeEventArgs e)
{
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())
var pipeline = (from x in BLL.PipelineService.hJGL_Pipelines
where x.UnitWorkId == e.Node.NodeID && x.PipelineCode.Contains(this.tvPipeCode.Text.Trim())
orderby x.PipelineCode
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 = (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();
//var jotCount = WeldJointlist.Where(x => x.PipelineId == item.PipelineId).Count();
var jotCount = WeldJointService.hJGL_WeldJoints.Where(x => x.PipelineId == item.PipelineId).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.Text = item.PipelineCode + "【" + jotCount.ToString() + " " + "焊口" + "】";
newNode.NodeID = item.PipelineId;
newNode.EnableClickEvent = true;
e.Node.Nodes.Add(newNode);
}
}
}
@@ -96,7 +96,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
foreach (var q in unitWork1)
{
int a = (from x in Funs.DB.HJGL_Pipeline where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == q.UnitWorkId && x.PipeArea == PipeArea select x).Count();
int a = (from x in PipelineService.hJGL_Pipelines where x.UnitWorkId == q.UnitWorkId && x.PipeArea == PipeArea select x).Count();
var u = BLL.UnitService.GetUnitByUnitId(q.UnitId);
TreeNode tn1 = new TreeNode();
tn1.NodeID = q.UnitWorkId;
@@ -119,7 +119,7 @@ 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 && x.PipeArea == PipeArea select x).Count();
int a = (from x in PipelineService.hJGL_Pipelines where x.UnitWorkId == q.UnitWorkId && x.PipeArea == PipeArea select x).Count();
var u = BLL.UnitService.GetUnitByUnitId(q.UnitId);
TreeNode tn2 = new TreeNode();
tn2.NodeID = q.UnitWorkId;
@@ -151,8 +151,8 @@ namespace FineUIPro.Web.HJGL.WeldingManage
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.PipeArea == PipeArea
var pipeline = (from x in PipelineService.hJGL_Pipelines
where x.UnitWorkId == e.Node.NodeID && x.PipeArea == PipeArea
orderby x.PipelineCode
select x).ToList();
if (!string .IsNullOrEmpty (txtPipelineCode.Text.Trim()))
@@ -71,7 +71,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
{
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();
int a = (from x in PipelineService.hJGL_Pipelines where x.UnitWorkId == q.UnitWorkId select x).Count();
var u = BLL.UnitService.GetUnitByUnitId(q.UnitId);
TreeNode tn1 = new TreeNode();
tn1.NodeID = q.UnitWorkId;
@@ -94,7 +94,7 @@ 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 PipelineService.hJGL_Pipelines where x.UnitWorkId == q.UnitWorkId select x).Count();
var u = BLL.UnitService.GetUnitByUnitId(q.UnitId);
TreeNode tn2 = new TreeNode();
tn2.NodeID = q.UnitWorkId;
@@ -124,14 +124,14 @@ namespace FineUIPro.Web.HJGL.WeldingManage
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
var pipeline = (from x in PipelineService.hJGL_Pipelines
where x.UnitWorkId == e.Node.NodeID
&& x.PipelineCode.Contains(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 jotCount = (from x in WeldJointService.hJGL_WeldJoints 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();
//if (jotCount > weldJotCount)
@@ -83,7 +83,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
{
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();
int a = (from x in PipelineService.hJGL_Pipelines where x.UnitWorkId == q.UnitWorkId select x).Count();
var u = BLL.UnitService.GetUnitByUnitId(q.UnitId);
TreeNode tn1 = new TreeNode();
tn1.NodeID = q.UnitWorkId;
@@ -97,7 +97,7 @@ 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 PipelineService.hJGL_Pipelines where x.UnitWorkId == q.UnitWorkId select x).Count();
var u = BLL.UnitService.GetUnitByUnitId(q.UnitId);
TreeNode tn2 = new TreeNode();
tn2.NodeID = q.UnitWorkId;