feat(hjgl): 完善焊接任务与质量管理流程

This commit is contained in:
2026-08-19 17:13:33 +08:00
parent 08792e0dc8
commit 679e9f6cec
68 changed files with 2481 additions and 1170 deletions
@@ -162,7 +162,12 @@ namespace FineUIPro.Web.HJGL.WeldingManage
foreach (var q in unitWork2)
{
var unitNamesUnitIds = BLL.UnitService.getUnitNamesUnitIds(q.UnitId);
if (string.IsNullOrEmpty(this.txtWeldJointCode.Text.Trim()))
// 左侧树的管线号和焊口号为组合筛选条件,任一条件为空时不限制对应字段。
string weldJointCode = this.txtWeldJointCode.Text.Trim();
string pipelineCode = this.txtTreePipelineCode.Text.Trim();
bool hasWeldJointCode = !string.IsNullOrEmpty(weldJointCode);
bool hasPipelineCode = !string.IsNullOrEmpty(pipelineCode);
if (!hasWeldJointCode && !hasPipelineCode)
{
var a = (from x in Funs.DB.HJGL_WeldTask
where x.UnitWorkId == q.UnitWorkId
@@ -190,7 +195,9 @@ namespace FineUIPro.Web.HJGL.WeldingManage
{
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())
where x.UnitWorkId == q.UnitWorkId
&& (!hasWeldJointCode || y.WeldJointCode.Contains(weldJointCode))
&& (!hasPipelineCode || y.PipelineCode.Contains(pipelineCode))
select x.TaskDate.Value.Date).Distinct().Count();
TreeNode tn2 = new TreeNode();
tn2.NodeID = q.UnitWorkId;
@@ -204,7 +211,9 @@ namespace FineUIPro.Web.HJGL.WeldingManage
{
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())
where x.UnitWorkId == q.UnitWorkId
&& (!hasWeldJointCode || y.WeldJointCode.Contains(weldJointCode))
&& (!hasPipelineCode || y.PipelineCode.Contains(pipelineCode))
select x.TaskDate.Value.Date).First();
this.txtTaskDateMonth.Text = string.Format("{0:yyyy-MM}", date);
// BindNodes(tn1);
@@ -229,7 +238,11 @@ namespace FineUIPro.Web.HJGL.WeldingManage
}
private void BindNodes(TreeNode node)
{
if (string.IsNullOrEmpty(this.txtWeldJointCode.Text.Trim()))
string weldJointCode = this.txtWeldJointCode.Text.Trim();
string pipelineCode = this.txtTreePipelineCode.Text.Trim();
bool hasWeldJointCode = !string.IsNullOrEmpty(weldJointCode);
bool hasPipelineCode = !string.IsNullOrEmpty(pipelineCode);
if (!hasWeldJointCode && !hasPipelineCode)
{
var p = (from x in Funs.DB.HJGL_WeldTask
where x.UnitWorkId == node.NodeID
@@ -253,7 +266,9 @@ namespace FineUIPro.Web.HJGL.WeldingManage
{
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())
where x.UnitWorkId == node.NodeID
&& (!hasWeldJointCode || y.WeldJointCode.Contains(weldJointCode))
&& (!hasPipelineCode || y.PipelineCode.Contains(pipelineCode))
orderby x.TaskDate descending
select new { x.TaskDate.Value.Date, x.UnitId, x.SerialNumber }).Distinct().ToList().OrderBy(x => x.SerialNumber);
if (p.Count() > 0)
@@ -278,13 +293,26 @@ namespace FineUIPro.Web.HJGL.WeldingManage
this.InitTreeMenu();
}
/// <summary>
/// 任务单列表、任务单打印和焊口贴纸统一使用此顺序,避免同一任务单在不同入口显示顺序不一致。
/// </summary>
private static List<Model.View_HJGL_WeldingTask> OrderWeldingTaskRows(IEnumerable<Model.View_HJGL_WeldingTask> weldingTasks)
{
return (weldingTasks ?? Enumerable.Empty<Model.View_HJGL_WeldingTask>())
.OrderBy(x => x.PipeLineSortIndex)
.ThenBy(x => x.WeldJointCode)
.ThenBy(x => x.WeldTaskId)
.ToList();
}
private void BindGrid(List<Model.View_HJGL_WeldingTask> weldingTask)
{
UpdateTotalSizeLabel(weldingTask);
if (!string.IsNullOrEmpty(this.txtPipelineCode.Text.Trim()))
{
weldingTask = weldingTask.Where(e => e.PipelineCode.Contains(this.txtPipelineCode.Text.Trim())).OrderBy(x => x.PipeLineSortIndex).ToList();
weldingTask = weldingTask.Where(e => e.PipelineCode.Contains(this.txtPipelineCode.Text.Trim())).ToList();
}
weldingTask = OrderWeldingTaskRows(weldingTask);
DataTable tb = this.LINQToDataTable(weldingTask);
// 2.获取当前分页数据
@@ -366,7 +394,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
BLL.FastReportService.ResetData();
var pipelineIds = taskList.Select(x => x.PipelineId).Distinct().ToList();
var pipelines = Funs.DB.HJGL_Pipeline.Where(x => pipelineIds.Contains(x.PipelineId)).ToList();
var result = taskList.OrderBy(x => x.PipeLineSortIndex).ThenBy(x => x.WeldJointCode).Select(x =>
var result = OrderWeldingTaskRows(taskList).Select(x =>
{
var pipeline = pipelines.FirstOrDefault(y => y.PipelineId == x.PipelineId);
return new
@@ -1301,6 +1329,10 @@ namespace FineUIPro.Web.HJGL.WeldingManage
protected void btnSearch_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty( tvControlItem.SelectedNodeID)||tvControlItem.SelectedNodeID.Split('|').Length!=4)
{
return;
}
//List<Model.View_HJGL_WeldingTask> GetWeldingTaskItem = this.CollectGridJointInfo();
DateTime? taskTime = Funs.GetNewDateTime(tvControlItem.SelectedNodeID.Split('|')[2]);
if (taskTime != null)
@@ -1375,6 +1407,10 @@ namespace FineUIPro.Web.HJGL.WeldingManage
protected void rbIsAudit_SelectedIndexChanged(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(tvControlItem.SelectedNodeID) || tvControlItem.SelectedNodeID.Split('|').Length != 4)
{
return;
}
DateTime? taskTime = Funs.GetNewDateTime(tvControlItem.SelectedNodeID.Split('|')[2]);
if (taskTime != null)
{
@@ -1409,6 +1445,50 @@ namespace FineUIPro.Web.HJGL.WeldingManage
}
}
/// <summary>
/// 根据当前逻辑任务单生成防腐委托单。
/// </summary>
protected void btnGenAntiCorrosionTrust_Click(object sender, EventArgs e)
{
if (!CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.PersonId,
Const.Tw_AntiCorrosionTrustMenuId, Const.BtnAdd))
{
ShowNotify("您没有生成防腐委托单的权限!", MessageBoxIcon.Warning);
return;
}
if (string.IsNullOrEmpty(tvControlItem.SelectedNodeID) || !tvControlItem.SelectedNodeID.Contains("|"))
{
ShowNotify("请选择任务单", MessageBoxIcon.Question);
return;
}
string[] values = tvControlItem.SelectedNodeID.Split('|');
DateTime taskDate;
if (values.Length < 4 || !DateTime.TryParse(values[2], out taskDate))
{
ShowNotify("任务单参数不正确", MessageBoxIcon.Warning);
return;
}
var task = Funs.DB.HJGL_WeldTask.FirstOrDefault(x => x.ProjectId == this.CurrUser.LoginProjectId
&& x.UnitWorkId == values[0] && x.UnitId == values[1]
&& x.TaskDate.HasValue && x.TaskDate.Value.Date == taskDate.Date && x.SerialNumber == values[3]);
if (task == null)
{
ShowNotify("未找到任务单", MessageBoxIcon.Warning);
return;
}
try
{
TwAntiCorrosionTrustService.GenerateByTaskCode(task.ProjectId, task.TaskCode, this.CurrUser.PersonId);
ShowNotify("防腐委托单生成成功", MessageBoxIcon.Success);
}
catch (ArgumentException ex)
{
ShowNotify(ex.Message, MessageBoxIcon.Warning);
}
}
protected void btnPrintJoint_Click(object sender, EventArgs e)
{
var rows = Grid1.SelectedRowIndexArray;
@@ -1422,6 +1502,12 @@ namespace FineUIPro.Web.HJGL.WeldingManage
{
BLL.FastReportService.ResetData();
var selectedTaskOrder = OrderWeldingTaskRows(GetCurrentTaskList())
.Where(x => !string.IsNullOrEmpty(x.WeldJointId) && jointids.Contains(x.WeldJointId))
.Select((x, index) => new { x.WeldJointId, Index = index })
.GroupBy(x => x.WeldJointId)
.ToDictionary(x => x.Key, x => x.First().Index);
// 防腐等级维护在管线上,打印时由焊口关联管线,再通过防腐字典取得显示代码。
var result = (from weldJoint in Funs.DB.View_HJGL_WeldJoint
where jointids.Contains(weldJoint.WeldJointId)
@@ -1438,7 +1524,11 @@ namespace FineUIPro.Web.HJGL.WeldingManage
SortIndex = weldJoint.WeldJointCode.Replace(weldJoint.PipelineCode + "/", ""),
WeldJointPoint = weldJoint.WeldJointPoint,
PaintCode = paint == null ? string.Empty : paint.PaintCode
}).OrderBy(x => x.pipelineCode).ThenBy(x => x.SortIndex).ToList();
}).ToList()
.OrderBy(x => selectedTaskOrder.ContainsKey(x.WeldJointId) ? selectedTaskOrder[x.WeldJointId] : int.MaxValue)
.ThenBy(x => x.pipelineCode)
.ThenBy(x => x.SortIndex)
.ToList();
var tb = LINQToDataTable(result);
if (tb != null && tb.Rows.Count > 0)
{
@@ -1495,8 +1585,8 @@ namespace FineUIPro.Web.HJGL.WeldingManage
DateTime? taskTime = Funs.GetNewDateTime(tvControlItem.SelectedNodeID.Split('|')[2]);
if (taskTime != null)
{
var weldTaskList = BLL.WeldTaskService.GetWeldingTaskList(this.CurrUser.LoginProjectId, tvControlItem.SelectedNodeID.Split('|')[0], tvControlItem.SelectedNodeID.Split('|')[1], Convert.ToDateTime(taskTime), this.rbIsAudit.SelectedValue, tvControlItem.SelectedNodeID.Split('|')[3]);
var pipelines = weldTaskList.OrderBy(x => x.PipeLineSortIndex).Select(x => x.PipelineId).Distinct().ToList();
var weldTaskList = OrderWeldingTaskRows(BLL.WeldTaskService.GetWeldingTaskList(this.CurrUser.LoginProjectId, tvControlItem.SelectedNodeID.Split('|')[0], tvControlItem.SelectedNodeID.Split('|')[1], Convert.ToDateTime(taskTime), this.rbIsAudit.SelectedValue, tvControlItem.SelectedNodeID.Split('|')[3]));
var pipelines = weldTaskList.Select(x => x.PipelineId).Distinct().ToList();
if (pipelines.Any())
{
@@ -1572,9 +1662,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
y.MaterialMade,
y.MaterialSpec
}).ToList();
var sortedTaskList = weldTaskList.OrderBy(x => x.PipeLineSortIndex).ThenBy(x => x.WeldJointCode).ToList();
foreach (var task in sortedTaskList)
foreach (var task in weldTaskList)
{
var taskMaterials = printMaterials.Where(x => x.WeldJointId == task.WeldJointId)
.OrderBy(x => x.Code).ToList();