2022-12-12 焊接wbs树速度优化

This commit is contained in:
2022-12-12 14:08:35 +08:00
parent 99b6e632b6
commit d372b10ce2
9 changed files with 279 additions and 94 deletions
@@ -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,39 +232,40 @@ 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(); ;
}
var joints = from x in WeldJointService.hJGL_WeldJoints select x;
foreach (var item in iso)
{
TreeNode newNode = new TreeNode();
int totalJointNum = joints.Count(x => x.PipelineId == item.PipelineId);
int weldJointNum = joints.Count(x => x.PipelineId == item.PipelineId && x.WeldingDailyId != null);
bool istrue = BLL.HJGL_MaterialService.isInStockByPipeline(item.PipelineId, this.CurrUser.LoginProjectId);
if (istrue)
iso = iso.Skip(pageSize * (pagenum - 1)).Take(pageSize).ToList(); ;
var joints = from x in WeldJointService.hJGL_WeldJoints select x;
foreach (var item in iso)
{
newNode.CssClass = "tn-color-green";
TreeNode newNode = new TreeNode();
int totalJointNum = joints.Count(x => x.PipelineId == item.PipelineId);
int weldJointNum = joints.Count(x => x.PipelineId == item.PipelineId && x.WeldingDailyId != null);
bool istrue = BLL.HJGL_MaterialService.isInStockByPipeline(item.PipelineId, this.CurrUser.LoginProjectId);
if (istrue)
{
newNode.CssClass = "tn-color-green";
}
newNode.Text = item.PipelineCode + "(" + (totalJointNum - weldJointNum).ToString() + ")";
newNode.NodeID = item.PipelineId;
newNode.ToolTip = item.PipelineCode;
newNode.EnableClickEvent = true;
node.Nodes.Add(newNode);
}
if (pagenum < Count)
{
TreeNode newNode = new TreeNode();
newNode.Text = "加载";
newNode.NodeID = SQLHelper.GetNewID();
newNode.Icon = Icon.ArrowDown;
newNode.CommandName = PipeArea;
newNode.EnableClickEvent = true;
node.Nodes.Add(newNode);
}
newNode.Text = item.PipelineCode + "(" + (totalJointNum - weldJointNum).ToString() + ")";
newNode.NodeID = item.PipelineId;
newNode.ToolTip = item.PipelineCode;
newNode.EnableClickEvent = true;
node.Nodes.Add(newNode);
}
if (pagenum < Count)
{
TreeNode newNode = new TreeNode();
newNode.Text = "加载";
newNode.NodeID = "加载";
newNode.Icon = Icon.ArrowDown;
newNode.CommandName = PipeArea;
newNode.EnableClickEvent = true;
node.Nodes.Add(newNode);
}
}
protected void tvControlItem_TreeNodeExpanded(object sender, TreeNodeEventArgs e)
{
@@ -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);
PageContext.RegisterStartupScript(ActiveWindow.GetWriteBackValueReference(txtTaskDate.Text) + ActiveWindow.GetHidePostBackReference());
if (IsCloseForm)
{
PageContext.RegisterStartupScript(ActiveWindow.GetWriteBackValueReference(txtTaskDate.Text) + ActiveWindow.GetHidePostBackReference());
}
//PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
}
@@ -594,5 +641,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
};
}
}
}