refactor(hjgl): 整理历史资源并完善焊接查询

归档数据库版本脚本并清理历史地图资源,补充焊口查询和焊接任务相关逻辑,降低项目资源维护成本并完善焊接业务查询。
This commit is contained in:
2026-09-22 14:22:04 +08:00
parent dc19b6d6b6
commit 2105a7c6d6
1321 changed files with 3432 additions and 47368 deletions
@@ -1645,22 +1645,34 @@ namespace FineUIPro.Web.HJGL.WeldingManage
var taskWeldJointIds = weldTaskList.Where(x => !string.IsNullOrEmpty(x.WeldJointId))
.Select(x => x.WeldJointId).Distinct().ToList();
var pipelineList = Funs.DB.HJGL_Pipeline.Where(x => pipelines.Contains(x.PipelineId)).ToList();
var weldJointFlowingSections = Funs.DB.HJGL_WeldJoint
.Where(x => taskWeldJointIds.Contains(x.WeldJointId))
.Select(x => new { x.WeldJointId, x.FlowingSection })
.ToDictionary(x => x.WeldJointId, x => x.FlowingSection);
var materialIds = pipelineList.Where(x => !string.IsNullOrEmpty(x.MaterialId))
.Select(x => x.MaterialId).Distinct().ToList();
var pipelineMaterials = Funs.DB.Base_Material.Where(x => materialIds.Contains(x.MaterialId))
.ToDictionary(x => x.MaterialId, x => x.MaterialCode);
var paintIds = pipelineList.Where(x => !string.IsNullOrEmpty(x.PaintId))
.Select(x => x.PaintId).Distinct().ToList();
var paintCodes = Funs.DB.Tw_PaintCodeDict.Where(x => paintIds.Contains(x.Id))
.ToDictionary(x => x.Id, x => x.PaintCode);
var printMaterials = (from x in Funs.DB.HJGL_PipeLineMat
join y in Funs.DB.HJGL_MaterialCodeLib on x.MaterialCode equals y.MaterialCode
join y in Funs.DB.HJGL_MaterialCodeLib on x.MaterialCode equals y.MaterialCode into materialGroup
from y in materialGroup.DefaultIfEmpty()
where pipelines.Contains(x.PipelineId)
&& taskWeldJointIds.Contains(x.WeldJointId)
&& x.PrefabricatedComponents != null
select new
{
x.PipelineId,
x.WeldJointId,
x.MaterialCode,
x.Number,
y.Code,
y.HeatNo,
y.BatchNo,
y.MaterialMade,
y.MaterialSpec
Code = y == null ? null : y.Code,
HeatNo = y == null ? null : y.HeatNo,
BatchNo = y == null ? null : y.BatchNo,
MaterialMade = y == null ? null : y.MaterialMade,
MaterialSpec = y == null ? null : y.MaterialSpec
}).ToList();
foreach (var task in weldTaskList)
{
@@ -1673,17 +1685,41 @@ namespace FineUIPro.Web.HJGL.WeldingManage
foreach (var material in taskMaterials)
{
var pipeline = pipelineList.FirstOrDefault(x => x.PipelineId == task.PipelineId);
string flowingSection;
weldJointFlowingSections.TryGetValue(task.WeldJointId ?? string.Empty, out flowingSection);
if (string.IsNullOrEmpty(flowingSection))
{
flowingSection = pipeline?.FlowingSection ?? string.Empty;
}
string pipelineMaterial = string.Empty;
if (pipeline != null && !string.IsNullOrEmpty(pipeline.MaterialId))
{
pipelineMaterials.TryGetValue(pipeline.MaterialId, out pipelineMaterial);
}
string paintCode = string.Empty;
if (pipeline != null && !string.IsNullOrEmpty(pipeline.PaintId))
{
paintCodes.TryGetValue(pipeline.PaintId, out paintCode);
}
string materialMade = material?.MaterialMade;
if (string.IsNullOrEmpty(materialMade))
{
materialMade = !string.IsNullOrEmpty(pipelineMaterial)
? pipelineMaterial
: task.MaterialCode ?? string.Empty;
}
DataRow dr = dataTable.NewRow();
dr["PipelineCode"] = task.PipelineCode;
dr["FlowingSection"] = pipelineList.FirstOrDefault(x => x.PipelineId == task.PipelineId)?.FlowingSection ?? string.Empty;
dr["FlowingSection"] = flowingSection;
dr["WeldJointCode"] = !string.IsNullOrEmpty(task.PipelineCode) ? task.WeldJointCode.Replace(task.PipelineCode + "/", "") : task.WeldJointCode;
dr["MaterialCode"] = material?.Code ?? material?.MaterialCode ?? string.Empty;
dr["BatchNo"] = material == null ? string.Empty : string.Join("/", new[] { material.HeatNo, material.BatchNo }.Where(x => !string.IsNullOrEmpty(x)));
dr["NeedNum"] = material?.Number != null ? material.Number.Value.ToString("0.##") : string.Empty;
dr["MaterialMade"] = material?.MaterialMade ?? string.Empty;
dr["MaterialMade"] = materialMade;
dr["MaterialSpec"] = material?.MaterialSpec ?? string.Empty;
// 当前焊接任务单取数链路未维护油漆号,先输出空列,避免模板字段缺失。
dr["PaintCode"] = string.Empty;
dr["PaintCode"] = paintCode ?? string.Empty;
dr["WeldingSize"] = task.Size.HasValue ? task.Size.Value.ToString("0.##") : string.Empty;
dr["Remark"] = string.Empty;
dataTable.Rows.Add(dr);