2022-12-12 焊接wbs树速度优化
This commit is contained in:
parent
99b6e632b6
commit
d372b10ce2
Binary file not shown.
|
|
@ -2,6 +2,7 @@ namespace BLL
|
|||
{
|
||||
using MiniExcelLibs;
|
||||
using Model;
|
||||
using NPOI.SS.Formula.Functions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
|
|
@ -1153,6 +1154,19 @@ namespace BLL
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///获取最大页数
|
||||
/// </summary>
|
||||
/// <param name="pageTotal">总数</param>
|
||||
/// <param name="pagesize">每页条数</param>
|
||||
/// <returns></returns>
|
||||
public static int GetEndPageNumber(int pageTotal,int pagesize )
|
||||
{
|
||||
double aa = (pageTotal + pagesize - 1) / pagesize; //使用数据条数/每页显示条数,来获得最大页数,是double类型
|
||||
|
||||
return Convert.ToInt32(Math.Ceiling(aa)); //返回double类型取上限后的结果
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 过滤空白行
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
<Items>
|
||||
<f:Tree ID="tvControlItem" ShowHeader="false" Height="560px" Title="单位工程"
|
||||
OnNodeCommand="tvControlItem_NodeCommand" runat="server" ShowBorder="false" EnableCollapse="true"
|
||||
EnableSingleClickExpand="true" AutoLeafIdentification="true"
|
||||
EnableSingleClickExpand="true" AutoLeafIdentification="true" OnNodeExpand="tvControlItem_TreeNodeExpanded"
|
||||
EnableTextSelection="true">
|
||||
</f:Tree>
|
||||
</Items>
|
||||
|
|
|
|||
|
|
@ -3,14 +3,18 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Web;
|
||||
|
||||
namespace FineUIPro.Web.HJGL.PreDesign
|
||||
{
|
||||
public partial class PrePipeline : PageBase
|
||||
{
|
||||
public int pageSize = 20;
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
|
|
@ -83,11 +87,22 @@ namespace FineUIPro.Web.HJGL.PreDesign
|
|||
tn1.NodeID = q.UnitWorkId;
|
||||
tn1.Text = q.UnitWorkName + "【" + a.ToString() + "】" + "管线";
|
||||
tn1.ToolTip = "施工单位:" + u.UnitName;
|
||||
tn1.CommandName = 1+"|"+Funs.GetEndPageNumber(a, pageSize);
|
||||
tn1.EnableClickEvent = true;
|
||||
tn1.EnableExpandEvent = true;
|
||||
rootNode1.Nodes.Add(tn1);
|
||||
if (a > 0)
|
||||
{
|
||||
BindNodes(tn1);
|
||||
// BindNodes(tn1);
|
||||
TreeNode newNode = new TreeNode();
|
||||
newNode.Text = "加载管线...";
|
||||
newNode.NodeID = "加载管线...";
|
||||
tn1.Nodes.Add(newNode);
|
||||
}
|
||||
//if (a > 0)
|
||||
//{
|
||||
// BindNodes(tn1);
|
||||
//}
|
||||
}
|
||||
}
|
||||
if (unitWork2.Count() > 0)
|
||||
|
|
@ -104,11 +119,22 @@ namespace FineUIPro.Web.HJGL.PreDesign
|
|||
tn2.Expanded = true;
|
||||
}
|
||||
tn2.ToolTip = "施工单位:" + u.UnitName;
|
||||
tn2.CommandName = 1 + "|" + Funs.GetEndPageNumber(a, pageSize);
|
||||
tn2.EnableClickEvent = true;
|
||||
tn2.EnableExpandEvent = true;
|
||||
rootNode2.Nodes.Add(tn2);
|
||||
if (a > 0)
|
||||
{
|
||||
BindNodes(tn2);
|
||||
// BindNodes(tn1);
|
||||
TreeNode newNode = new TreeNode();
|
||||
newNode.Text = "加载管线...";
|
||||
newNode.NodeID = "加载管线...";
|
||||
tn2.Nodes.Add(newNode);
|
||||
}
|
||||
//if (a > 0)
|
||||
//{
|
||||
// BindNodes(tn2);
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -122,6 +148,11 @@ namespace FineUIPro.Web.HJGL.PreDesign
|
|||
&& x.PipelineCode.Contains(this.txtPipelineCode.Text.Trim())
|
||||
orderby x.PipelineCode
|
||||
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 comCount = (from x in Funs.DB.HJGL_Pipeline_Component where x.PipelineId == item.PipelineId select x).Count();
|
||||
|
|
@ -131,10 +162,32 @@ namespace FineUIPro.Web.HJGL.PreDesign
|
|||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
#endregion
|
||||
protected void tvControlItem_TreeNodeExpanded(object sender, TreeNodeEventArgs e)
|
||||
{
|
||||
if (e.Node.Nodes[0].NodeID == "加载管线...")
|
||||
{
|
||||
e.Node.Nodes.Clear();
|
||||
BindNodes(e.Node);
|
||||
}
|
||||
|
||||
}
|
||||
#region 点击TreeView
|
||||
/// <summary>
|
||||
/// 点击TreeView
|
||||
|
|
@ -149,6 +202,15 @@ namespace FineUIPro.Web.HJGL.PreDesign
|
|||
{
|
||||
this.hdUnitWorkId.Text = this.tvControlItem.SelectedNode.ParentNode.NodeID;
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
this.BindGrid();
|
||||
}
|
||||
#endregion
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
<Items>
|
||||
<f:Tree ID="tvControlItem" ShowHeader="false" Height="560px" Title="单位工程"
|
||||
OnNodeCommand="tvControlItem_NodeCommand" runat="server" ShowBorder="false" EnableCollapse="true"
|
||||
EnableSingleClickExpand="true" AutoLeafIdentification="true"
|
||||
EnableSingleClickExpand="true" AutoLeafIdentification="true" OnNodeExpand="tvControlItem_TreeNodeExpanded"
|
||||
EnableTextSelection="true">
|
||||
</f:Tree>
|
||||
</Items>
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
|||
{
|
||||
public partial class JotTwoDesign : PageBase
|
||||
{
|
||||
public int pageSize = 20;
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
|
|
@ -87,10 +88,17 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
|||
tn1.NodeID = q.UnitWorkId;
|
||||
tn1.Text = q.UnitWorkName + "【" + a.ToString() + "】" + "管线";
|
||||
tn1.ToolTip = "施工单位:" + u.UnitName;
|
||||
tn1.CommandName = 1 + "|" + Funs.GetEndPageNumber(a, pageSize);
|
||||
tn1.EnableClickEvent = true;
|
||||
tn1.EnableExpandEvent = true;
|
||||
rootNode1.Nodes.Add(tn1);
|
||||
if (a > 0)
|
||||
{
|
||||
BindNodes(tn1);
|
||||
// BindNodes(tn1);
|
||||
TreeNode newNode = new TreeNode();
|
||||
newNode.Text = "加载管线...";
|
||||
newNode.NodeID = "加载管线...";
|
||||
tn1.Nodes.Add(newNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -108,10 +116,17 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
|||
tn2.Expanded = true;
|
||||
}
|
||||
tn2.ToolTip = "施工单位:" + u.UnitName;
|
||||
tn2.CommandName = 1 + "|" + Funs.GetEndPageNumber(a, pageSize);
|
||||
tn2.EnableClickEvent = true;
|
||||
tn2.EnableExpandEvent = true;
|
||||
rootNode2.Nodes.Add(tn2);
|
||||
if (a > 0)
|
||||
{
|
||||
BindNodes(tn2);
|
||||
// BindNodes(tn1);
|
||||
TreeNode newNode = new TreeNode();
|
||||
newNode.Text = "加载管线...";
|
||||
newNode.NodeID = "加载管线...";
|
||||
tn2.Nodes.Add(newNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -125,6 +140,11 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
|||
&& x.PipelineCode.Contains(this.txtPipelineCode.Text.Trim())
|
||||
orderby x.PipelineCode
|
||||
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 Funs.DB.HJGL_WeldJoint where x.PipelineId == item.PipelineId && x.IsTwoJoint == true select x).Count();
|
||||
|
|
@ -171,6 +191,17 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
|||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region 点击TreeView
|
||||
|
|
@ -187,8 +218,25 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
|||
{
|
||||
this.hdUnitWorkId.Text = this.tvControlItem.SelectedNode.ParentNode.NodeID;
|
||||
}
|
||||
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);
|
||||
}
|
||||
this.BindGrid();
|
||||
}
|
||||
protected void tvControlItem_TreeNodeExpanded(object sender, TreeNodeEventArgs e)
|
||||
{
|
||||
if (e.Node.Nodes[0].NodeID == "加载管线...")
|
||||
{
|
||||
e.Node.Nodes.Clear();
|
||||
BindNodes(e.Node);
|
||||
}
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 数据绑定
|
||||
|
|
|
|||
|
|
@ -86,7 +86,10 @@
|
|||
</f:DropDownList>
|
||||
<f:ToolbarFill ID="ToolbarFill1" runat="server">
|
||||
</f:ToolbarFill>
|
||||
<f:Button ID="btnAccept" Icon="Accept" runat="server" ToolTip="确定"
|
||||
<f:Button ID="btnSave" Icon="PageSave" runat="server" ToolTip="保存" Text="保存"
|
||||
OnClick="btnSave_Click">
|
||||
</f:Button>
|
||||
<f:Button ID="btnAccept" Icon="Accept" runat="server" ToolTip="提交" Text="提交"
|
||||
OnClick="btnAccept_Click">
|
||||
</f:Button>
|
||||
</Items>
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
|||
public List<HJGL_Pipeline> Tree_hJGL_Pipelines;
|
||||
public int pageindex=1;
|
||||
public int pageindex_2=1;
|
||||
public int page;
|
||||
public int pageSize=20;
|
||||
#endregion
|
||||
|
||||
#region 加载页面
|
||||
|
|
@ -232,11 +232,9 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
|||
}
|
||||
|
||||
var Count = iso.Count();
|
||||
if (pagenum <= Count)
|
||||
if (pagenum <= Funs.GetEndPageNumber(Count,pageSize))
|
||||
{
|
||||
iso = iso.Skip(30 * (pagenum - 1)).Take(30).ToList(); ;
|
||||
|
||||
}
|
||||
iso = iso.Skip(pageSize * (pagenum - 1)).Take(pageSize).ToList(); ;
|
||||
var joints = from x in WeldJointService.hJGL_WeldJoints select x;
|
||||
foreach (var item in iso)
|
||||
{
|
||||
|
|
@ -259,13 +257,16 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
|||
{
|
||||
TreeNode newNode = new TreeNode();
|
||||
newNode.Text = "加载";
|
||||
newNode.NodeID = "加载";
|
||||
newNode.NodeID = SQLHelper.GetNewID();
|
||||
newNode.Icon = Icon.ArrowDown;
|
||||
newNode.CommandName = PipeArea;
|
||||
newNode.EnableClickEvent = true;
|
||||
node.Nodes.Add(newNode);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
protected void tvControlItem_TreeNodeExpanded(object sender, TreeNodeEventArgs e)
|
||||
{
|
||||
if (e.Node.Nodes[0].NodeID == "加载管线...")
|
||||
|
|
@ -360,7 +361,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
|||
/// <param name="e"></param>
|
||||
protected void tvControlItem_NodeCommand(object sender, TreeCommandEventArgs e)
|
||||
{
|
||||
if (e.NodeID == "加载")
|
||||
if (e.Node.Text == "加载")
|
||||
{
|
||||
|
||||
if (e.Node.CommandName == "1")
|
||||
|
|
@ -407,6 +408,46 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
|||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnAccept_Click(object sender, EventArgs e)
|
||||
{
|
||||
PageContext.RegisterStartupScript(ActiveWindow.GetWriteBackValueReference(txtTaskDate.Text) + ActiveWindow.GetHidePostBackReference());
|
||||
|
||||
//if (string.IsNullOrEmpty(this.txtTaskCode.Text.Trim()))
|
||||
//{
|
||||
// ShowNotify("请输入焊接任务单编号", MessageBoxIcon.Warning);
|
||||
// return;
|
||||
//}
|
||||
//if (!string.IsNullOrEmpty(txtTaskDate.Text))
|
||||
//{
|
||||
// if (!string.IsNullOrEmpty(TaskDate))
|
||||
// {
|
||||
// SaveTask(true);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// var task = from x in Funs.DB.HJGL_WeldTask
|
||||
// where x.UnitWorkId == UnitWorkId
|
||||
// && x.TaskDate.Value.Date.ToString() == Convert.ToDateTime(txtTaskDate.Text.Trim()).ToString("yyyy-MM-dd")
|
||||
// select x;
|
||||
// if (task.Count() > 0)
|
||||
// {
|
||||
// ShowNotify("所选预计焊接日期已存在,请重新选择!", MessageBoxIcon.Warning);
|
||||
// return;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// SaveTask(true);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
//else
|
||||
//{
|
||||
// ShowNotify("请选择预计焊接日期", MessageBoxIcon.Warning);
|
||||
// return;
|
||||
//}
|
||||
}
|
||||
|
||||
protected void btnSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(this.txtTaskCode.Text.Trim()))
|
||||
{
|
||||
|
|
@ -417,7 +458,8 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
|||
{
|
||||
if (!string.IsNullOrEmpty(TaskDate))
|
||||
{
|
||||
SaveTask();
|
||||
SaveTask(false);
|
||||
BindGrid();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -432,7 +474,9 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
|||
}
|
||||
else
|
||||
{
|
||||
SaveTask();
|
||||
SaveTask(false);
|
||||
TaskDate = txtTaskDate.Text;
|
||||
BindGrid();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -442,10 +486,9 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
|||
ShowNotify("请选择预计焊接日期", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void SaveTask()
|
||||
private void SaveTask(bool IsCloseForm)
|
||||
{
|
||||
var weldingRods = from x in Funs.DB.Base_Consumables where x.ConsumablesType == "2" select x;
|
||||
var weldingWires = from x in Funs.DB.Base_Consumables where x.ConsumablesType == "1" select x;
|
||||
|
|
@ -535,7 +578,11 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
|||
//model.State = 1;
|
||||
//PipelineService.UpdatePipeline(model);
|
||||
ShowNotify("保存成功!", MessageBoxIcon.Success);
|
||||
if (IsCloseForm)
|
||||
{
|
||||
PageContext.RegisterStartupScript(ActiveWindow.GetWriteBackValueReference(txtTaskDate.Text) + ActiveWindow.GetHidePostBackReference());
|
||||
|
||||
}
|
||||
//PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
||||
}
|
||||
|
||||
|
|
@ -594,5 +641,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
|||
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -194,6 +194,15 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
|||
/// </remarks>
|
||||
protected global::FineUIPro.ToolbarFill ToolbarFill1;
|
||||
|
||||
/// <summary>
|
||||
/// btnSave 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnSave;
|
||||
|
||||
/// <summary>
|
||||
/// btnAccept 控件。
|
||||
/// </summary>
|
||||
|
|
|
|||
Loading…
Reference in New Issue