2023-02-17 焊接任务单修改

This commit is contained in:
2023-02-17 15:30:04 +08:00
parent 5f6569d82e
commit 86b9931597
8 changed files with 393 additions and 147 deletions
@@ -85,9 +85,8 @@ namespace FineUIPro.Web.HJGL.WeldingManage
}
}
public List<HJGL_Pipeline> Tree_hJGL_Pipelines;
public int pageindex=1;
public int pageindex_2=1;
public int pageSize=20;
public int pageSize = PipelineService.pageSize;
#endregion
#region
@@ -102,8 +101,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
{
HJGL_MaterialService.materialStockItems_FIELD = new List<Model.MaterialStockItem>();
HJGL_MaterialService.materialStockItems_SHOP = new List<Model.MaterialStockItem>();
pageindex = 1;
pageindex_2 = 1;
Tree_hJGL_Pipelines =new List<HJGL_Pipeline> ();
this.txtTaskDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now.AddDays(1));
this.txtTaskCode.Text = BLL.WeldTaskService.GetTaskCodeByDate(this.CurrUser.LoginProjectId, this.txtTaskDate.Text);
@@ -166,77 +164,57 @@ namespace FineUIPro.Web.HJGL.WeldingManage
/// </summary>
private void InitTreeMenu()
{
pageindex = 1;
pageindex_2 = 1;
this.tvControlItem.Nodes.Clear();
int a = (from x in Funs.DB.HJGL_Pipeline where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == this.UnitWorkId && x.UnitId == this.UnitId && x.PipeArea == PipelineService.PipeArea_SHOP && x.PipelineCode.Contains(this.txtPipelineCode.Text.Trim()) select x).Count();
int b = (from x in Funs.DB.HJGL_Pipeline where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == this.UnitWorkId && x.UnitId == this.UnitId && x.PipeArea == PipelineService.PipeArea_FIELD && x.PipelineCode.Contains(this.txtPipelineCode.Text.Trim()) select x).Count();
TreeNode rootNode1 = new TreeNode();
rootNode1.NodeID = BLL.PipelineService.PipeArea_SHOP;
rootNode1.Text = "工厂预制";
rootNode1.CommandName = "工厂预制";
rootNode1.CommandName = 1 + "|" + Funs.GetEndPageNumber(a, pageSize); //页码|总页
rootNode1.EnableClickEvent = true;
rootNode1.EnableExpandEvent = true;
this.tvControlItem.Nodes.Add(rootNode1);
int a = (from x in Funs.DB.HJGL_Pipeline where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == this.UnitWorkId && x.UnitId == this.UnitId && x.PipeArea == PipelineService.PipeArea_SHOP select x).Count();
if (a > 0)
{
// BindNodes(tn1);
TreeNode newNode = new TreeNode();
newNode.Text = "加载管线...";
newNode.NodeID = "加载管线...";
rootNode1.Nodes.Add(newNode);
}
TreeNode rootNode2 = new TreeNode();
rootNode2.NodeID = BLL.PipelineService.PipeArea_FIELD;
rootNode2.Text = "现场安装";
rootNode2.CommandName = "现场安装";
rootNode2.CommandName = 1 + "|" + Funs.GetEndPageNumber(a, pageSize);
rootNode2.EnableClickEvent = true;
rootNode2.EnableExpandEvent = true;
this.tvControlItem.Nodes.Add(rootNode2);
int b = (from x in Funs.DB.HJGL_Pipeline where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == this.UnitWorkId && x.UnitId == this.UnitId && x.PipeArea == PipelineService.PipeArea_FIELD select x).Count();
if (b > 0)
{
// BindNodes(tn1);
TreeNode newNode = new TreeNode();
TreeNode newNode = new TreeNode();
newNode.Text = "加载管线...";
newNode.NodeID = "加载管线...";
rootNode2.Nodes.Add(newNode);
}
//TreeNode rootNode = new TreeNode();
//rootNode.Text = "管线号";
//rootNode.NodeID = "0";
//rootNode.Expanded = true;
//this.tvControlItem.Nodes.Add(rootNode);
}
void AddTreeNode(string PipeArea , TreeNode node )
{
var iso = (from x in Funs.DB.HJGL_Pipeline where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == this.UnitWorkId && x.UnitId == this.UnitId && x.PipeArea == PipeArea orderby x.PipelineCode select x).ToList();
if (!string.IsNullOrEmpty(this.txtPipelineCode.Text))
{
iso = (from x in iso where x.PipelineCode.Contains(this.txtPipelineCode.Text.Trim()) orderby x.PipelineCode select x).ToList();
}
int pagenum = 1 ;
switch (PipeArea)
{
var pipeline = (from x in Funs.DB.HJGL_Pipeline
where x.ProjectId == this.CurrUser.LoginProjectId
&& x.UnitWorkId == this.UnitWorkId
&& x.UnitId == this.UnitId
&& x.PipeArea == PipeArea
&& x.PipelineCode.Contains(this.txtPipelineCode.Text.Trim())
orderby x.PipelineCode select x).ToList();
var joints = (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)
{
case "1":
pagenum = pageindex;
break;
case "2":
pagenum = pageindex_2;
break;
}
var Count = iso.Count();
if (pagenum <= Funs.GetEndPageNumber(Count,pageSize))
{
iso = iso.Skip(pageSize * (pagenum - 1)).Take(pageSize).ToList(); ;
var joints = (from x in Funs.DB.HJGL_WeldJoint where x.ProjectId == this.CurrUser.LoginProjectId select x).ToList();
foreach (var item in iso)
pipeline = pipeline.Skip(pageSize * (pageindex - 1)).Take(pageSize).ToList(); ;
foreach (var item in pipeline)
{
TreeNode newNode = new TreeNode();
int totalJointNum = joints.Count(x => x.PipelineId == item.PipelineId);
@@ -253,7 +231,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
node.Nodes.Add(newNode);
}
if (pagenum < Count)
if (pageindex < pageCount)
{
TreeNode newNode = new TreeNode();
newNode.Text = "加载";
@@ -272,12 +250,12 @@ namespace FineUIPro.Web.HJGL.WeldingManage
if (e.Node.Nodes[0].NodeID == "加载管线...")
{
e.Node.Nodes.Clear();
if (e.Node.CommandName == "工厂预制")
if (e.Node.Text == "工厂预制")
{
AddTreeNode(BLL.PipelineService.PipeArea_SHOP, e.Node);
}
else if (e.Node.CommandName == "现场安装")
else if (e.Node.Text == "现场安装")
{
AddTreeNode(BLL.PipelineService.PipeArea_FIELD, e.Node);
@@ -285,12 +263,46 @@ namespace FineUIPro.Web.HJGL.WeldingManage
}
}
#endregion
#endregion
#region
/// <summary>
/// 数据绑定
/// </summary>
#region TreeView
/// <summary>
/// 点击TreeView
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void tvControlItem_NodeCommand(object sender, TreeCommandEventArgs e)
{
if (e.Node.Text == "加载")
{
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);
if (e.Node.CommandName == "1")
{
AddTreeNode(BLL.PipelineService.PipeArea_SHOP, e.Node.ParentNode);
}
else if (e.Node.CommandName == "2")
{
AddTreeNode(BLL.PipelineService.PipeArea_FIELD, e.Node.ParentNode);
}
}
else
{
this.BindGrid();
}
}
#endregion
#region
/// <summary>
/// 数据绑定
/// </summary>
private void BindGrid()
{
string pipelineId = this.tvControlItem.SelectedNodeID;
@@ -354,42 +366,6 @@ namespace FineUIPro.Web.HJGL.WeldingManage
}
#endregion
#region TreeView
/// <summary>
/// 点击TreeView
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void tvControlItem_NodeCommand(object sender, TreeCommandEventArgs e)
{
if (e.Node.Text == "加载")
{
if (e.Node.CommandName == "1")
{
pageindex = pageindex + 1;
TreeNode treeNode = e.Node.ParentNode;
treeNode.Nodes.Remove(e.Node);
AddTreeNode(BLL.PipelineService.PipeArea_SHOP, e.Node.ParentNode);
}
else if (e.Node.CommandName == "2")
{
pageindex_2 = pageindex_2 + 1;
TreeNode treeNode = e.Node.ParentNode;
treeNode.Nodes.Remove(e.Node);
AddTreeNode(BLL.PipelineService.PipeArea_FIELD, e.Node.ParentNode);
}
}
else
{
this.BindGrid();
}
}
#endregion
#region
/// <summary>
/// 排序