feat(hjgl): 支持组件焊口导入和优先匹配

组件与焊口关系需要参与材料匹配、任务生成和出库明细计算。
新增组件焊口导入入口,并允许在材料匹配时手动指定优先组件,
确保按组件范围生成任务单和领料数据。
This commit is contained in:
2026-05-27 12:01:30 +08:00
parent 883493e02e
commit 49d59df7df
13 changed files with 841 additions and 47 deletions
+15 -2
View File
@@ -240,7 +240,7 @@ var stockList = TwMaterialstockService.GetTw_MaterialStockByModle(twMaterialStoc
/// <param name="pipelineIds"></param>
/// <param name="warehouseCode"></param>
/// <returns></returns>
public static List<Tw_PipeMatMatchOutput> GetPipeMatMatch(string projectId, List<string> pipelineIds, string warehouseCode)
public static List<Tw_PipeMatMatchOutput> GetPipeMatMatch(string projectId, List<string> pipelineIds, string warehouseCode, Dictionary<string, List<string>> priorityComponents = null)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
@@ -271,7 +271,20 @@ var stockList = TwMaterialstockService.GetTw_MaterialStockByModle(twMaterialStoc
var newRequiredMaterials = new List<Tw_PipeMatMatchOutput>();
foreach (string id in pipelineIds)
{
newRequiredMaterials.AddRange(requiredMaterials.Where(x => x.PipelineId == id));
var pipelineMaterials = requiredMaterials.Where(x => x.PipelineId == id).ToList();
if (priorityComponents != null && priorityComponents.ContainsKey(id) && priorityComponents[id] != null && priorityComponents[id].Any())
{
var components = priorityComponents[id];
newRequiredMaterials.AddRange(pipelineMaterials
.Where(x => components.Contains(x.PrefabricatedComponents))
.OrderBy(x => components.IndexOf(x.PrefabricatedComponents)));
newRequiredMaterials.AddRange(pipelineMaterials
.Where(x => !components.Contains(x.PrefabricatedComponents)));
}
else
{
newRequiredMaterials.AddRange(pipelineMaterials);
}
}
results = GetMatMatchOutput(newRequiredMaterials, warehouseCode, projectId);
return results;