提交代码

This commit is contained in:
2023-11-28 17:41:03 +08:00
parent f02101acd1
commit 469f621c13
4 changed files with 213 additions and 113 deletions
@@ -65,6 +65,16 @@ namespace FineUIPro.Web.HJGL.WeldingManage
}
#endregion
/// <summary>
/// 树查询
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnTreeFind_Click(object sender, EventArgs e)
{
this.InitTreeMenu();
}
#region -
/// <summary>
/// 加载树
@@ -114,8 +124,8 @@ namespace FineUIPro.Web.HJGL.WeldingManage
//}
//else
//{
unitWork1 = (from x in unitWorkList where x.ProjectType == "1" select x).ToList();
unitWork2 = (from x in unitWorkList where x.ProjectType == "2" select x).ToList();
unitWork1 = (from x in unitWorkList where x.ProjectType == "1" select x).ToList();
unitWork2 = (from x in unitWorkList where x.ProjectType == "2" select x).ToList();
//}
if (unitWork1.Count() > 0)
{
@@ -151,26 +161,57 @@ namespace FineUIPro.Web.HJGL.WeldingManage
foreach (var q in unitWork2)
{
var unitNamesUnitIds = BLL.UnitService.getUnitNamesUnitIds(q.UnitId);
var a = (from x in Funs.DB.HJGL_WeldTask
where x.UnitWorkId == q.UnitWorkId
&& x.TaskDate < Convert.ToDateTime(this.txtTaskDateMonth.Text.Trim() + "-01").AddMonths(1)
&& x.TaskDate >= Convert.ToDateTime(this.txtTaskDateMonth.Text.Trim() + "-01")
select x.TaskDate.Value.Date).Distinct().Count();
TreeNode tn2 = new TreeNode();
tn2.NodeID = q.UnitWorkId;
tn2.Text = q.UnitWorkName;
tn2.CommandName = "单位工程";
tn2.ToolTip = "施工单位:" + unitNamesUnitIds;
tn2.EnableClickEvent = true;
tn2.EnableExpandEvent = true;
rootNode2.Nodes.Add(tn2);
if (a > 0)
if (string.IsNullOrEmpty(this.txtWeldJointCode.Text.Trim()))
{
// BindNodes(tn1);
TreeNode newNode = new TreeNode();
newNode.Text = "加载管线...";
newNode.NodeID = "加载管线...";
tn2.Nodes.Add(newNode);
var a = (from x in Funs.DB.HJGL_WeldTask
where x.UnitWorkId == q.UnitWorkId
&& x.TaskDate < Convert.ToDateTime(this.txtTaskDateMonth.Text.Trim() + "-01").AddMonths(1)
&& x.TaskDate >= Convert.ToDateTime(this.txtTaskDateMonth.Text.Trim() + "-01")
select x.TaskDate.Value.Date).Distinct().Count();
TreeNode tn2 = new TreeNode();
tn2.NodeID = q.UnitWorkId;
tn2.Text = q.UnitWorkName;
tn2.CommandName = "单位工程";
tn2.ToolTip = "施工单位:" + unitNamesUnitIds;
tn2.EnableClickEvent = true;
tn2.EnableExpandEvent = true;
rootNode2.Nodes.Add(tn2);
if (a > 0)
{
// BindNodes(tn1);
TreeNode newNode = new TreeNode();
newNode.Text = "加载管线...";
newNode.NodeID = "加载管线...";
tn2.Nodes.Add(newNode);
}
}
else
{
var a = (from x in Funs.DB.HJGL_WeldTask
join y in Funs.DB.HJGL_WeldJoint on x.WeldJointId equals y.WeldJointId
where x.UnitWorkId == q.UnitWorkId && y.WeldJointCode.Contains(this.txtWeldJointCode.Text.Trim())
select x.TaskDate.Value.Date).Distinct().Count();
TreeNode tn2 = new TreeNode();
tn2.NodeID = q.UnitWorkId;
tn2.Text = q.UnitWorkName;
tn2.CommandName = "单位工程";
tn2.ToolTip = "施工单位:" + unitNamesUnitIds;
tn2.EnableClickEvent = true;
tn2.EnableExpandEvent = true;
rootNode2.Nodes.Add(tn2);
if (a > 0)
{
var date = (from x in Funs.DB.HJGL_WeldTask
join y in Funs.DB.HJGL_WeldJoint on x.WeldJointId equals y.WeldJointId
where x.UnitWorkId == q.UnitWorkId && y.WeldJointCode.Contains(this.txtWeldJointCode.Text.Trim())
select x.TaskDate.Value.Date).First();
this.txtTaskDateMonth.Text = string.Format("{0:yyyy-MM}", date);
// BindNodes(tn1);
TreeNode newNode = new TreeNode();
newNode.Text = "加载管线...";
newNode.NodeID = "加载管线...";
tn2.Nodes.Add(newNode);
}
}
}
}
@@ -187,21 +228,43 @@ namespace FineUIPro.Web.HJGL.WeldingManage
}
private void BindNodes(TreeNode node)
{
var p = (from x in Funs.DB.HJGL_WeldTask
where x.UnitWorkId == node.NodeID
&& x.TaskDate < Convert.ToDateTime(this.txtTaskDateMonth.Text.Trim() + "-01").AddMonths(1)
&& x.TaskDate >= Convert.ToDateTime(this.txtTaskDateMonth.Text.Trim() + "-01")
select new { x.TaskDate.Value.Date ,x.UnitId}).Distinct();
if (p.Count() > 0)
if (string.IsNullOrEmpty(this.txtWeldJointCode.Text.Trim()))
{
foreach (var item in p)
var p = (from x in Funs.DB.HJGL_WeldTask
where x.UnitWorkId == node.NodeID
&& x.TaskDate < Convert.ToDateTime(this.txtTaskDateMonth.Text.Trim() + "-01").AddMonths(1)
&& x.TaskDate >= Convert.ToDateTime(this.txtTaskDateMonth.Text.Trim() + "-01")
select new { x.TaskDate.Value.Date, x.UnitId }).Distinct();
if (p.Count() > 0)
{
TreeNode newNode = new TreeNode();
newNode.CommandName = "Date";
newNode.Text = string.Format("{0:yyyy-MM-dd}", item.Date)+"("+BLL.UnitService.getUnitNamesUnitIds(item.UnitId)+")";
newNode.NodeID = node.NodeID + "|" + string.Format("{0:yyyy-MM-dd}", item.Date);
newNode.EnableClickEvent = true;
node.Nodes.Add(newNode);
foreach (var item in p)
{
TreeNode newNode = new TreeNode();
newNode.CommandName = "Date";
newNode.Text = string.Format("{0:yyyy-MM-dd}", item.Date) + "(" + BLL.UnitService.getUnitNamesUnitIds(item.UnitId) + ")";
newNode.NodeID = node.NodeID + "|" + string.Format("{0:yyyy-MM-dd}", item.Date);
newNode.EnableClickEvent = true;
node.Nodes.Add(newNode);
}
}
}
else
{
var p = (from x in Funs.DB.HJGL_WeldTask
join y in Funs.DB.HJGL_WeldJoint on x.WeldJointId equals y.WeldJointId
where x.UnitWorkId == node.NodeID && y.WeldJointCode.Contains(this.txtWeldJointCode.Text.Trim())
select new { x.TaskDate.Value.Date, x.UnitId }).Distinct();
if (p.Count() > 0)
{
foreach (var item in p)
{
TreeNode newNode = new TreeNode();
newNode.CommandName = "Date";
newNode.Text = string.Format("{0:yyyy-MM-dd}", item.Date) + "(" + BLL.UnitService.getUnitNamesUnitIds(item.UnitId) + ")";
newNode.NodeID = node.NodeID + "|" + string.Format("{0:yyyy-MM-dd}", item.Date);
newNode.EnableClickEvent = true;
node.Nodes.Add(newNode);
}
}
}
@@ -219,7 +282,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
weldingTask = weldingTask.Where(e => e.PipelineCode.Contains(this.txtPipelineCode.Text.Trim())).ToList();
}
DataTable tb = this.LINQToDataTable(weldingTask);
// 2.获取当前分页数据
//var table = this.GetPagedDataTable(GridNewDynamic, tb1);
Grid1.RecordCount = tb.Rows.Count;
@@ -823,7 +886,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
NewItem.WeldingWireCode = values.Value<string>("WeldingWireCode").ToString();
}
if (!string.IsNullOrEmpty(values.Value<string>("Size"))&&!string.IsNullOrEmpty(values.Value<int>("Size").ToString()))
if (!string.IsNullOrEmpty(values.Value<string>("Size")) && !string.IsNullOrEmpty(values.Value<int>("Size").ToString()))
{
NewItem.Size = values.Value<int>("Size");
}
@@ -853,7 +916,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
{
string UnitWorkId = w.UnitWorkId;
string taskDate = "";
string strList = UnitWorkId + "|" + taskDate;
string strList = UnitWorkId + "|" + taskDate;
string window = String.Format("SelectTaskWeldJoint.aspx?strList={0}", strList, "编辑 - ");
PageContext.RegisterStartupScript(Window1.GetSaveStateReference(hdTaskWeldJoint.ClientID) + Window1.GetShowReference(window));
@@ -880,7 +943,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
{
taskDate = tvControlItem.SelectedNodeID;
}
string strList = UnitWorkId + "|" + taskDate;
string strList = UnitWorkId + "|" + taskDate;
string window = String.Format("SelectTaskWeldJoint.aspx?strList={0}", strList, "编辑 - ");
PageContext.RegisterStartupScript(Window1.GetSaveStateReference(hdTaskWeldJoint.ClientID) + Window1.GetShowReference(window));
@@ -994,7 +1057,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
{
List<Model.View_HJGL_WeldingTask> GetWeldingTaskList = BLL.WeldTaskService.GetWeldingTaskList(this.CurrUser.LoginProjectId, tvControlItem.SelectedNode.ParentNode.NodeID, Convert.ToDateTime(taskTime));
this.BindGrid(GetWeldingTaskList);
}
}
@@ -1122,48 +1185,48 @@ namespace FineUIPro.Web.HJGL.WeldingManage
DateTime? taskTime = Funs.GetNewDateTime(tvControlItem.SelectedNodeID.Split('|')[1]);
if (taskTime != null)
{
var pipelines = BLL.WeldTaskService.GetWeldingTaskList(this.CurrUser.LoginProjectId, tvControlItem.SelectedNode.ParentNode.NodeID, Convert.ToDateTime(taskTime)).Select(x=>x.PipelineId).Distinct().ToList();
var pipelines = BLL.WeldTaskService.GetWeldingTaskList(this.CurrUser.LoginProjectId, tvControlItem.SelectedNode.ParentNode.NodeID, Convert.ToDateTime(taskTime)).Select(x => x.PipelineId).Distinct().ToList();
if (pipelines.Any())
{
BLL.FastReportService.ResetData();
if (pipelines.Any())
{
BLL.FastReportService.ResetData();
var result = HJGL_PipelineComponentService.GetPrintModelByPipelineComponentIds(null, pipelines.ToArray(),true);
var PipelineComponentIds = result.Select(x => x.PipelineComponentId).ToArray();
var tb = LINQToDataTable(result);
if (tb != null && tb.Rows.Count>0)
{
tb.TableName = "Table1";
}
else
{
ShowNotify("该管线已打印完成", MessageBoxIcon.Question);
return;
}
BLL.FastReportService.AddFastreportTable(tb);
string initTemplatePath = "";
string rootPath = Server.MapPath("~/");
initTemplatePath = "File\\Fastreport\\组件打印.frx";
var result = HJGL_PipelineComponentService.GetPrintModelByPipelineComponentIds(null, pipelines.ToArray(), true);
var PipelineComponentIds = result.Select(x => x.PipelineComponentId).ToArray();
var tb = LINQToDataTable(result);
if (tb != null && tb.Rows.Count > 0)
{
tb.TableName = "Table1";
}
else
{
ShowNotify("该管线已打印完成", MessageBoxIcon.Question);
return;
}
BLL.FastReportService.AddFastreportTable(tb);
string initTemplatePath = "";
string rootPath = Server.MapPath("~/");
initTemplatePath = "File\\Fastreport\\组件打印.frx";
if (File.Exists(rootPath + initTemplatePath))
{
PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("~/Controls/Fastreport.aspx?ReportPath={0}", rootPath + initTemplatePath)));
if (File.Exists(rootPath + initTemplatePath))
{
PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("~/Controls/Fastreport.aspx?ReportPath={0}", rootPath + initTemplatePath)));
HJGL_PipelineComponentService.UpdateIsPrint(PipelineComponentIds);
HJGL_PipelineComponentService.UpdateIsPrint(PipelineComponentIds);
}
}
else
{
ShowNotify("无关联管线", MessageBoxIcon.Question);
}
else
{
ShowNotify("无关联管线", MessageBoxIcon.Question);
}
}
}
else
{
ShowNotify("请选择任务单",MessageBoxIcon.Question);
ShowNotify("请选择任务单", MessageBoxIcon.Question);
}
}
}